Skip to content
Code-Schnipsel Gruppen Projekte
Commit e42b4ba0 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

Merge branch 'main' into 'next-3.x'

Update 'next-3.x' with latest changes from 'main'

See merge request !117
Übergeordnete 932daabb 3b281ef8
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
1 Merge Request!117Update 'next-3.x' with latest changes from 'main'
Pipeline-Nr. 14543 bestanden
werden angezeigt mit 906 Ergänzungen und 343 Löschungen
# Ignore developer files when exporting
.gitattributes export-ignore
.gitignore export-ignore
.gitlab-ci.yml export-ignore
.phive export-ignore
captainhook.json export-ignore
phpcs.xml.dist export-ignore
phpstan-baseline.neon export-ignore
phpstan.dist.neon export-ignore
phpunit.dist.xml export-ignore
tests export-ignore
# Explicitly set file type and line endings for PHP files, improves git diff output
*.php text eol=lf diff=php
\ No newline at end of file
......@@ -2,3 +2,11 @@ tools/
phpstan.neon
.phpunit.result.cache
phpunit.xml
tools/
phpstan.neon
.phpunit.result.cache
phpunit.xml
include:
- project: 'quiqqer/stabilization/semantic-release'
file: '/ci-templates/.gitlab-ci.yml'
- component: dev.quiqqer.com/quiqqer/stabilization/ci-cd-components/quiqqer-package-bundle/quiqqer-package-bundle@main
# Remove the entire phpunit-php8.1 block, to allow PHPUnit to run on PHP 8.1 in your pipeline
phpunit-php8.1:
rules:
- when: never
# Remove the entire phpunit-php8.2 block, to allow PHPUnit to run on PHP 8.2 in your pipeline
phpunit-php8.2:
rules:
- when: never
# Remove the entire phpunit-php8.3 block, to allow PHPUnit to run on PHP 8.3 in your pipeline
phpunit-php8.3:
rules:
- when: never
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpstan" version="^1.10.67" installed="1.10.67" location="./tools/phpstan" copy="false"/>
<phar name="phpstan" version="1.11.8" installed="1.11.8" location="./tools/phpstan" copy="false"/>
<phar name="phpunit" version="^10.5.20" installed="10.5.20" location="./tools/phpunit" copy="false"/>
<phar name="phpcs" version="^3.10.1" installed="3.10.1" location="./tools/phpcs" copy="false"/>
<phar name="phpcbf" version="^3.10.1" installed="3.10.1" location="./tools/phpcbf" copy="false"/>
<phar name="captainhook" version="^5.23.3" installed="5.23.3" location="./tools/captainhook" copy="false"/>
</phive>
# Contributing
This package follows the [QUIQQER contribution guidelines](https://dev.quiqqer.com/quiqqer/stabilization/documentation/-/wikis/home).
\ No newline at end of file
......@@ -26,7 +26,7 @@ function () {
$paymentId = $Payment->getId();
if (!isset($section[$paymentId])) {
$result[$paymentId] = 1;
$result[$paymentId] = 0;
continue;
}
......
......@@ -27,7 +27,10 @@ function ($orderId, $data) {
$Customer = null;
if (isset($data['customerId']) && !isset($data['customer'])) {
$Customer = QUI::getUsers()->get($data['customerId']);
try {
$Customer = QUI::getUsers()->get($data['customerId']);
} catch (QUI\Exception) {
}
}
if (!empty($data['cDate'])) {
......@@ -44,8 +47,16 @@ function ($orderId, $data) {
}
if (!$Customer && isset($data['customer'])) {
if (isset($data['customerId']) && !isset($data['customer']['id'])) {
$data['customer']['id'] = $data['customerId'];
// refresh customer id data
if (isset($data['customerId'])) {
try {
$Customer = QUI::getUsers()->get($data['customerId']);
$data['customer']['id'] = $Customer->getUUID();
$data['customer']['uuid'] = $Customer->getUUID();
$data['customer']['customerId'] = $Customer->getAttribute('customerId');
} catch (QUI\Exception) {
}
}
if (isset($data['addressInvoice']['country']) && !isset($data['customer']['country'])) {
......@@ -138,7 +149,7 @@ function ($orderId, $data) {
if (isset($data['shippingStatus']) && $data['shippingStatus'] !== false) {
try {
$Order->setShippingStatus($data['shippingStatus']);
$Order->setShippingStatus((int)$data['shippingStatus']);
// Send status notification
if (!empty($data['notificationShipping']) && class_exists('QUI\ERP\Shipping\Shipping')) {
......@@ -157,6 +168,10 @@ function ($orderId, $data) {
$Order->setData('shippingTracking', $data['shippingTracking']);
}
if (!empty($data['project_name'])) {
$Order->setAttribute('project_name', $data['project_name']);
}
if (!empty($data['shipping'])) {
try {
if (
......
......@@ -48,6 +48,144 @@
</table>
</form>
<form>
<table class="data-table data-table-flexbox order-data">
<thead>
<tr>
<th>{{textOrderData}}</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<label class="field-container">
<span class="field-container-item" title="{{textOrderDate}}">
{{textOrderDate}}
</span>
<span class="field-container-field field-container-field-no-padding">
<input class=""
type="text"
name="date"
value="{{date}}"
disabled
style="width: calc(100% - 50px); float: left"
/>
<button type="button" name="edit-date" class="qui-button" style="width: 50px">
<span class="fa fa-edit"></span>
</button>
</span>
</label>
</td>
</tr>
<tr>
<td>
<label class="field-container">
<span class="field-container-item" title="{{textProjectName}}">
{{textProjectName}}
</span>
<input class="field-container-field"
type="text"
name="project_name"
value="{{project_name}}"
/>
</label>
</td>
</tr>
<tr>
<td>
<label class="field-container">
<span class="field-container-item" title="{{textOrderedBy}}">
{{textOrderedBy}}
</span>
<input class="field-container-field"
type="text"
name="orderedBy"
value="{{ordered_by}}"
disabled
/>
</label>
</td>
</tr>
<tr>
<td>
<label class="field-container">
<span class="field-container-item" title="{{textStatus}}">
{{textStatus}}
</span>
<span class="field-container-field field-container-field-no-padding order-data-status-field">
<span class="order-data-status-field-colorPreview"></span>
<select name="status" class="order-data-status-field-select" disabled></select>
</span>
</label>
</td>
</tr>
</tbody>
</table>
<table class="data-table data-table-flexbox order-shipping" style="display: none">
<thead>
<tr>
<th>{{textShippingStatusTitle}}</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<label class="field-container">
<span class="field-container-item" title="{{textShippingStatus}}">
{{textShippingStatus}}
</span>
<span class="field-container-field field-container-field-no-padding order-data-shipping-status-field">
<span class="order-data-shipping-status-field-colorPreview"></span>
<select type="text" class="field-container-field" name="shippingStatus" disabled></select>
</span>
</label>
</td>
</tr>
<tr>
<td>
<label class="field-container">
<span class="field-container-item" title="{{textShipping}}">
{{textShipping}}
</span>
<select type="text" class="field-container-field" name="shipping"></select>
</label>
</td>
</tr>
<tr>
<td>
<label class="field-container">
<span class="field-container-item" title="{{textShippingTracking}}">
{{textShippingTracking}}
</span>
<input type="text"
class="field-container-field"
name="shippingTracking"
{{#isShippingInstalled}}
data-qui="package/quiqqer/shipping/bin/backend/controls/TrackingInput"
{{/isShippingInstalled}}
/>
</label>
</td>
</tr>
<tr>
<td>
<button name="shippingConfirmationButton"
class="qui-button"
style="float: right"
disabled
>
<span class="fa fa-truck"></span>
<span>{{textShippingConfirmationButton}}</span>
</button>
</td>
</tr>
</tbody>
</table>
</form>
<form name="invoice">
<table class="data-table data-table-flexbox order-invoice"
data-qui="package/quiqqer/order/bin/backend/controls/panels/order/Address"
......@@ -245,130 +383,6 @@
</table>
</form>
<form>
<table class="data-table data-table-flexbox order-data">
<thead>
<tr>
<th>{{textOrderData}}</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<label class="field-container">
<span class="field-container-item" title="{{textOrderDate}}">
{{textOrderDate}}
</span>
<span class="field-container-field field-container-field-no-padding">
<input class=""
type="text"
name="date"
value="{{date}}"
disabled
style="width: calc(100% - 50px); float: left"
/>
<button type="button" name="edit-date" class="qui-button" style="width: 50px">
<span class="fa fa-edit"></span>
</button>
</span>
</label>
</td>
</tr>
<tr>
<td>
<label class="field-container">
<span class="field-container-item" title="{{textOrderedBy}}">
{{textOrderedBy}}
</span>
<input class="field-container-field"
type="text"
name="orderedBy"
value="{{ordered_by}}"
disabled
/>
</label>
</td>
</tr>
<tr>
<td>
<label class="field-container">
<span class="field-container-item" title="{{textStatus}}">
{{textStatus}}
</span>
<span class="field-container-field field-container-field-no-padding order-data-status-field">
<span class="order-data-status-field-colorPreview"></span>
<select name="status" class="order-data-status-field-select" disabled></select>
</span>
</label>
</td>
</tr>
</tbody>
</table>
<table class="data-table data-table-flexbox order-shipping" style="display: none">
<thead>
<tr>
<th>{{textShippingStatusTitle}}</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<label class="field-container">
<span class="field-container-item" title="{{textShippingStatus}}">
{{textShippingStatus}}
</span>
<span class="field-container-field field-container-field-no-padding order-data-shipping-status-field">
<span class="order-data-shipping-status-field-colorPreview"></span>
<select type="text" class="field-container-field" name="shippingStatus" disabled></select>
</span>
</label>
</td>
</tr>
<tr>
<td>
<label class="field-container">
<span class="field-container-item" title="{{textShipping}}">
{{textShipping}}
</span>
<select type="text" class="field-container-field" name="shipping"></select>
</label>
</td>
</tr>
<tr>
<td>
<label class="field-container">
<span class="field-container-item" title="{{textShippingTracking}}">
{{textShippingTracking}}
</span>
<input type="text"
class="field-container-field"
name="shippingTracking"
{{#isShippingInstalled}}
data-qui="package/quiqqer/shipping/bin/backend/controls/TrackingInput"
{{/isShippingInstalled}}
/>
</label>
</td>
</tr>
<tr>
<td>
<button name="shippingConfirmationButton"
class="qui-button"
style="float: right"
disabled
>
<span class="fa fa-truck"></span>
<span>{{textShippingConfirmationButton}}</span>
</button>
</td>
</tr>
</tbody>
</table>
</form>
<form name="payment">
<table class="data-table data-table-flexbox order-payment">
<thead>
......
......@@ -52,6 +52,7 @@ define('package/quiqqer/order/bin/backend/controls/panels/Order', [
'openInfo',
'openHistory',
'openPreview',
'openOrderFiles',
'openCommunication',
'openArticles',
'openDeleteDialog',
......@@ -231,6 +232,7 @@ define('package/quiqqer/order/bin/backend/controls/panels/Order', [
this.setAttribute('status', orderData.status);
this.setAttribute('shippingStatus', orderData.shippingStatus);
this.setAttribute('shippingConfirmation', orderData.shippingConfirmation);
this.setAttribute('project_name', orderData.project_name);
this.$initialStatus = parseInt(orderData.status);
this.$initialShippingStatus = parseInt(orderData.shippingStatus);
......@@ -282,6 +284,7 @@ define('package/quiqqer/order/bin/backend/controls/panels/Order', [
shipping: this.getAttribute('shipping'),
shippingTracking: this.getAttribute('shippingTracking'),
cDate: this.getAttribute('cDate'),
project_name: this.getAttribute('project_name'),
priceFactors: this.$serializedList.priceFactors
};
......@@ -304,7 +307,7 @@ define('package/quiqqer/order/bin/backend/controls/panels/Order', [
}
resolve();
this.refresh();
this.showSavedIconAnimation();
}).catch((err) => {
console.error(err);
......@@ -335,6 +338,14 @@ define('package/quiqqer/order/bin/backend/controls/panels/Order', [
self.Loader.show();
require([
'package/quiqqer/erp/bin/backend/controls/process/ProcessWindowButton'
], (ProcessWindowButton) => {
new ProcessWindowButton({
hash: this.getAttribute('orderId')
}).inject(this.getHeader());
});
this.$AddProduct = new QUIButtonMultiple({
textimage: 'fa fa-plus',
text: QUILocale.get(lg, 'panel.order.button.buttonAdd'),
......@@ -525,6 +536,15 @@ define('package/quiqqer/order/bin/backend/controls/panels/Order', [
}
});
this.addCategory({
name: 'orderFiles',
icon: 'fa fa-file-text-o',
text: QUILocale.get(lg, 'erp.panel.order.orderFiles'),
events: {
onClick: this.openOrderFiles
}
});
this.addCategory({
icon: 'fa fa fa-eye',
name: 'preview',
......@@ -784,6 +804,7 @@ define('package/quiqqer/order/bin/backend/controls/panels/Order', [
textOrderData: QUILocale.get(lg, 'panel.order.data.title'),
textOrderDate: QUILocale.get(lg, 'panel.order.data.date'),
textOrderedBy: QUILocale.get(lg, 'panel.order.data.orderedBy'),
textProjectName: QUILocale.get(lg, 'panel.order.data.textProjectName'),
textStatus: QUILocale.get(lg, 'panel.order.data.status'),
textPaymentTitle: QUILocale.get(lg, 'order.payment.panel.paymentTitle'),
textPayment: QUILocale.get(lg, 'order.payment.panel.payment'),
......@@ -813,11 +834,16 @@ define('package/quiqqer/order/bin/backend/controls/panels/Order', [
const DateField = Content.getElement('[name="date"]');
const DateEdit = Content.getElement('[name="edit-date"]');
const OrderedByField = Content.getElement('[name="orderedBy"]');
const ProjectName = Content.getElement('[name="project_name"]');
const customer = self.getAttribute('customer');
const Currency = Content.getElement('[name="currency"]');
Currency.value = self.getAttribute('currency');
if (self.getAttribute('project_name')) {
ProjectName.value = self.getAttribute('project_name');
}
if (customer) {
TaxId.value = '';
EUVAT.value = '';
......@@ -1265,6 +1291,50 @@ define('package/quiqqer/order/bin/backend/controls/panels/Order', [
});
},
/**
* Open order files category.
*/
openOrderFiles: function() {
this.Loader.show();
this.getCategory('orderFiles').setActive();
return this.$closeCategory().then((Container) => {
Container.setStyle('overflow', 'hidden');
Container.setStyle('padding', 20);
Container.setStyle('height', '100%');
const customerId = this.$Customer.getValue();
if (!customerId || customerId == 0) {
new Element('p', {
html: QUILocale.get(lg, 'erp.panel.order.files_no_customer')
}).inject(Container);
return;
}
return new Promise((resolve) => {
require(['package/quiqqer/erp/bin/backend/controls/customerFiles/Grid'], (FileGrid) => {
new FileGrid({
hash: this.getAttribute('hash')
}).inject(Container);
resolve();
});
});
}).then(() => {
this.Loader.hide();
return this.$openCategory();
}).catch((err) => {
console.error('ERROR');
console.error(err);
return this.$openCategory();
});
},
/**
* Open the post / invoice creation dialog
*/
......@@ -1590,6 +1660,7 @@ define('package/quiqqer/order/bin/backend/controls/panels/Order', [
const Content = this.getContent(),
deliverAddress = Content.getElement('[name="differentDeliveryAddress"]'),
PaymentForm = Content.getElement('form[name="payment"]'),
ProjectName = Content.getElement('[name="project_name"]'),
StatusNode = Content.getElement('[name="status"]'),
ShippingStatus = Content.getElement('[name="shippingStatus"]'),
Shipping = Content.getElement('[name="shipping"]'),
......@@ -1640,6 +1711,10 @@ define('package/quiqqer/order/bin/backend/controls/panels/Order', [
this.setAttribute('currency', Currency.value);
}
if (ProjectName) {
this.setAttribute('project_name', ProjectName.value);
}
// customer
if (this.$Customer) {
let customer = this.getAttribute('customer'),
......@@ -2195,5 +2270,4 @@ define('package/quiqqer/order/bin/backend/controls/panels/Order', [
//endregion
});
})
;
});
......@@ -68,8 +68,14 @@
width: 100%;
}
.td.clickable:hover .order-status {
border-color: #fff !important;
color: #fff !important;
}
/** product details
================================================= */
.orders-order-details {
border: 1px solid #DDDDDD;
float: left;
......
......@@ -113,6 +113,7 @@ define('package/quiqqer/order/bin/backend/controls/panels/Orders', [
let sortOn = self.$Grid.options.sortOn;
switch (sortOn) {
case 'customer_id_view':
case 'customer_id':
sortOn = 'customerId';
break;
......@@ -173,6 +174,10 @@ define('package/quiqqer/order/bin/backend/controls/panels/Orders', [
});
}
if (typeof entry.customer_no !== 'undefined') {
entry.customer_id_view = entry.customer_no;
}
return entry;
});
......@@ -598,44 +603,14 @@ define('package/quiqqer/order/bin/backend/controls/panels/Orders', [
const orderId = selected[0].hash;
new QUIConfirm({
title: QUILocale.get(lg, 'dialog.order.copy.title'),
text: QUILocale.get(lg, 'dialog.order.copy.text'),
information: QUILocale.get(lg, 'dialog.order.copy.information', {
id: orderId
}),
icon: 'fa fa-copy',
texticon: 'fa fa-copy',
maxHeight: 400,
maxWidth: 600,
autoclose: false,
ok_button: {
text: QUILocale.get('quiqqer/system', 'copy'),
textimage: 'fa fa-copy'
},
events: {
onSubmit: function(Win) {
Win.Loader.show();
Orders.copyOrder(orderId).then(function(newOrderId) {
require([
'package/quiqqer/order/bin/backend/controls/panels/Order',
'utils/Panels'
], function(Order, PanelUtils) {
const Panel = new Order({
orderId: newOrderId,
'#id': newOrderId
});
PanelUtils.openPanelInTasks(Panel);
Win.close();
});
}).then(function() {
Win.Loader.hide();
});
}
}
}).open();
require([
'package/quiqqer/erp/bin/backend/controls/dialogs/CopyErpEntityDialog'
], (CopyErpEntityDialog) => {
new CopyErpEntityDialog({
hash: orderId,
entityPlugin: 'quiqqer/order'
}).open();
});
},
/**
......@@ -1108,8 +1083,8 @@ define('package/quiqqer/order/bin/backend/controls/panels/Orders', [
},
{
header: QUILocale.get(lg, 'grid.customerNo'),
dataIndex: 'customer_id',
dataType: 'integer',
dataIndex: 'customer_id_view',
dataType: 'string',
width: 90,
className: 'clickable'
},
......@@ -1208,21 +1183,33 @@ define('package/quiqqer/order/bin/backend/controls/panels/Orders', [
},
{
header: QUILocale.get(lg, 'grid.hash'),
dataIndex: 'hash',
dataIndex: 'uuid',
dataType: 'string',
width: 280,
className: 'monospace'
},
{
header: QUILocale.get(lg, 'grid.globalProcessId'),
dataIndex: 'globalProcessId',
dataType: 'string',
width: 280,
className: 'monospace clickable'
},
{
header: QUILocale.get('quiqqer/system', 'id'),
dataIndex: 'id',
dataType: 'integer',
width: 80
hidden: true
},
{
dataIndex: 'paymentId',
dataType: 'integer',
hidden: true
},
{
dataIndex: 'customer_id',
dataType: 'string',
hidden: true
}
]);
......@@ -1309,6 +1296,7 @@ define('package/quiqqer/order/bin/backend/controls/panels/Orders', [
rowData = self.$Grid.getDataByRow(data.row);
if (Cell.get('data-index') === 'customer_id' ||
Cell.get('data-index') === 'customer_id_view' ||
Cell.get('data-index') === 'customer_name' ||
Cell.get('data-index') === 'invoice_id' ||
Cell.get('data-index') === 'status') {
......@@ -1415,6 +1403,23 @@ define('package/quiqqer/order/bin/backend/controls/panels/Orders', [
return;
}
if (typeof data !== 'undefined' && data.cell.get('data-index') === 'globalProcessId') {
const rowData = self.$Grid.getDataByRow(data.row);
if (rowData.globalProcessId && rowData.globalProcessId !== '') {
require([
'package/quiqqer/erp/bin/backend/controls/process/ProcessWindow'
], function(ProcessWindow) {
new ProcessWindow({
globalProcessId: rowData.globalProcessId
}).open();
});
return;
}
}
const selected = self.$Grid.getSelectedData();
if (selected.length) {
......
......@@ -58,6 +58,12 @@ define('package/quiqqer/order/bin/backend/controls/panels/order/Address', [
const self = this,
Elm = this.getElm();
function ignoreAutoFill(node)
{
node.role = 'presentation';
node.autocomplete = 'off';
}
this.$Firstname = Elm.getElement('[name="firstname"]');
this.$Lastname = Elm.getElement('[name="lastname"]');
this.$Company = Elm.getElement('[name="company"]');
......@@ -84,6 +90,13 @@ define('package/quiqqer/order/bin/backend/controls/panels/order/Address', [
this.$ZIP.disabled = false;
this.$City.disabled = false;
ignoreAutoFill(this.$Firstname);
ignoreAutoFill(this.$Lastname);
ignoreAutoFill(this.$Company);
ignoreAutoFill(this.$Street);
ignoreAutoFill(this.$ZIP);
ignoreAutoFill(this.$City);
Countries.getCountries().then(function(result) {
new Element('option', {
value: '',
......
......@@ -7,11 +7,12 @@ define('package/quiqqer/order/bin/backend/controls/panels/order/StatusWindow', [
'qui/QUI',
'qui/controls/windows/Confirm',
'package/quiqqer/order/bin/backend/ProcessingStatus',
'package/quiqqer/erp/bin/backend/utils/ERPEntities',
'package/quiqqer/order/bin/backend/Orders',
'Locale',
'Ajax'
], function(QUI, QUIConfirm, ProcessingStatus, Orders, QUILocale, QUIAjax) {
], function(QUI, QUIConfirm, ProcessingStatus, ERPEntities, Orders, QUILocale, QUIAjax) {
'use strict';
const lg = 'quiqqer/order';
......@@ -56,21 +57,35 @@ define('package/quiqqer/order/bin/backend/controls/panels/order/StatusWindow', [
this.Loader.show();
this.getContent().set('html', '');
new Element('p', {
html: QUILocale.get(lg, 'window.status.text', {
orderId: this.getAttribute('orderId')
})
}).inject(this.getContent());
let Select;
const Select = new Element('select', {
styles: {
display: 'block',
margin: '20px auto 0',
width: '80%'
}
}).inject(this.getContent());
return ERPEntities.getEntity(this.getAttribute('orderId'), 'quiqqer/order').then((data) => {
this.setAttributes({
icon: 'fa fa-check',
title: QUILocale.get(lg, 'window.status.title', {
orderId: data.prefixedNumber
})
});
this.refresh();
return ProcessingStatus.getList().then((statusList) => {
new Element('p', {
html: QUILocale.get(lg, 'window.status.text', {
orderId: data.prefixedNumber
})
}).inject(this.getContent());
Select = new Element('select', {
styles: {
display: 'block',
margin: '20px auto 0',
width: '80%'
}
}).inject(this.getContent());
}).then(() => {
return ProcessingStatus.getList();
}).then((statusList) => {
statusList = statusList.data;
new Element('option', {
......
......@@ -18,7 +18,7 @@ define('package/quiqqer/order/bin/backend/controls/settings/Payments', [
return new Class({
Extends: QUIControl,
Type : 'package/quiqqer/order/bin/backend/controls/settings/Payments',
Type: 'package/quiqqer/order/bin/backend/controls/settings/Payments',
Binds: [
'$onImport',
......@@ -28,7 +28,7 @@ define('package/quiqqer/order/bin/backend/controls/settings/Payments', [
initialize: function (options) {
this.parent(options);
this.$Input = null;
this.$Input = null;
this.$Container = null;
this.addEvents({
......@@ -42,7 +42,7 @@ define('package/quiqqer/order/bin/backend/controls/settings/Payments', [
* @return Promise
*/
refresh: function () {
var self = this,
var self = this,
current = QUILocale.getCurrent();
return new Promise(function (resolve) {
......@@ -52,8 +52,8 @@ define('package/quiqqer/order/bin/backend/controls/settings/Payments', [
});
}).then(function (result) {
var payments = result[0],
list = result[1],
data = [];
list = result[1],
data = [];
var i, len, title, paymentData;
......@@ -63,7 +63,7 @@ define('package/quiqqer/order/bin/backend/controls/settings/Payments', [
for (i = 0, len = payments.length; i < len; i++) {
paymentData = payments[i];
title = paymentData.title;
title = paymentData.title;
if (typeOf(title) === 'object' && current in title) {
title = title[current];
......@@ -76,9 +76,9 @@ define('package/quiqqer/order/bin/backend/controls/settings/Payments', [
onChange: onChange
}
}),
id : paymentData.id,
title : title,
type : paymentData.paymentType.title
id: paymentData.id,
title: title,
type: paymentData.paymentType.title
});
}
......@@ -102,50 +102,50 @@ define('package/quiqqer/order/bin/backend/controls/settings/Payments', [
this.$Container = new Element('div', {
styles: {
opacity: 0,
width : '100%'
width: '100%'
}
}).wraps(this.$Input);
var Container = new Element('div', {
styles: {
height : 300,
width : '100%',
height: 300,
width: '100%',
outline: '1px solid red'
}
}).inject(this.$Container);
this.$Grid = new Grid(Container, {
height : 300,
width : self.$Container.getSize().x,
height: 300,
width: self.$Container.getSize().x,
columnModel: [{
header : '&nbsp;',
header: '&nbsp;',
dataIndex: 'status',
dataType : 'QUI',
width : 60
dataType: 'QUI',
width: 60
}, {
header : QUILocale.get('quiqqer/system', 'id'),
header: QUILocale.get('quiqqer/system', 'id'),
dataIndex: 'id',
dataType : 'integer',
width : 60
dataType: 'integer',
width: 60
}, {
header : QUILocale.get('quiqqer/system', 'title'),
header: QUILocale.get('quiqqer/system', 'title'),
dataIndex: 'title',
dataType : 'text',
width : 140
dataType: 'text',
width: 140
}, {
header : QUILocale.get('quiqqer/system', 'type'),
header: QUILocale.get('quiqqer/system', 'type'),
dataIndex: 'type',
dataType : 'text',
width : 140
dataType: 'text',
width: 140
}],
onrefresh : this.refresh
onrefresh: this.refresh
});
this.refresh().then(function () {
var header = self.$Grid.container.getElements('.th'),
el = header[1];
el = header[1];
el.click(); // workaround
el.click(); // workaround
......@@ -166,7 +166,7 @@ define('package/quiqqer/order/bin/backend/controls/settings/Payments', [
* Save the current settings
*/
save: function () {
var data = this.$Grid.getData();
var data = this.$Grid.getData();
var result = {};
for (var i = 0, len = data.length; i < len; i++) {
......@@ -185,7 +185,7 @@ define('package/quiqqer/order/bin/backend/controls/settings/Payments', [
return new Promise(function (resolve, reject) {
QUIAjax.get('package_quiqqer_order_ajax_backend_settings_paymentChangeable_list', resolve, {
'package': 'quiqqer/order',
onError : reject
onError: reject
});
});
},
......@@ -199,8 +199,8 @@ define('package/quiqqer/order/bin/backend/controls/settings/Payments', [
return new Promise(function (resolve, reject) {
QUIAjax.get('package_quiqqer_order_ajax_backend_settings_paymentChangeable_save', resolve, {
'package': 'quiqqer/order',
onError : reject,
data : JSON.encode(data)
onError: reject,
data: JSON.encode(data)
});
});
}
......
......@@ -122,7 +122,7 @@ define('package/quiqqer/order/bin/frontend/Basket', [
const products = basket.products;
// if there are no products yet, merge without query
if (!products.length) {
if (typeof products === 'undefined' || !products.length) {
GlobalBasket.setAttribute('mergeLocalStorage', 1);
GlobalBasket.load().then(function () {
if (QUIQQER_SITE.type !== 'quiqqer/order:types/orderingProcess') {
......@@ -155,6 +155,16 @@ define('package/quiqqer/order/bin/frontend/Basket', [
return;
}
if (QUI.getAttribute('QUIQQER_ORDER_BASKET_MERGE')) {
GlobalBasket.setAttribute(
'mergeLocalStorage',
QUI.getAttribute('QUIQQER_ORDER_BASKET_MERGE')
);
GlobalBasket.load();
return;
}
GlobalBasket.showMergeWindow();
});
} else {
......
......@@ -642,6 +642,8 @@ define('package/quiqqer/order/bin/frontend/controls/OrderProcess', [
* @return {Promise}
*/
next: function() {
this.setAttribute('direction', 'next');
if (this.$enabled === false) {
return Promise.resolve();
}
......@@ -690,6 +692,8 @@ define('package/quiqqer/order/bin/frontend/controls/OrderProcess', [
* @return {Promise}
*/
previous: function() {
this.setAttribute('direction', 'previous');
if (this.$enabled === false) {
return Promise.resolve();
}
......
......@@ -42,14 +42,14 @@ define('package/quiqqer/order/bin/frontend/controls/basket/Button', [
],
options: {
open: 2, // 0 = nothing, 1 = order window, 2 = order process
action: 'openSmallBasket', // openSmallBasket, openOrderProcessUrl, openOrderProcess (qui popup). These options are only used on desktop. Mobile always opens order process page
text: true,
styles: false,
batchPosition: {
right: -16,
top: -10
},
showMiniBasketOnMouseOver: true
showMiniBasketOnMouseOver: false
},
initialize: function(options) {
......@@ -90,7 +90,9 @@ define('package/quiqqer/order/bin/frontend/controls/basket/Button', [
'class': 'quiqqer-order-basketButton button--callToAction',
'html': '<span class="quiqqer-order-basketButton-icon fa fa-spinner fa-spin"></span>' +
'<span class="quiqqer-order-basketButton-text">' + text + '</span>' +
'<span class="quiqqer-order-basketButton-batch">0</span>',
'<span class="quiqqer-order-basketButton-batch">' +
' <span class="fa fa-spin fa-spinner"></span>' +
'</span>',
disabled: true,
'data-qui': 'package/quiqqer/order/bin/frontend/controls/basket/Button'
});
......@@ -131,14 +133,26 @@ define('package/quiqqer/order/bin/frontend/controls/basket/Button', [
this.$Batch = Elm.getElement('.quiqqer-order-basketButton-batch');
Elm.addEvent('click', function() {
if (self.getAttribute('open') === 0) {
// on mobile always go to order process page
if (QUI.getWindowSize().x <= 768) {
Orders.getOrderProcessUrl().then(function(url) {
window.location = url;
});
return;
}
if (self.getAttribute('open') === 2) {
if (self.getAttribute('action') === 'openSmallBasket') {
self.showSmallBasket();
return;
}
if (self.getAttribute('action') === 'openOrderProcessUrl') {
Orders.getOrderProcessUrl().then(function(url) {
window.location = url;
});
return;
}
......
Dieser Diff ist reduziert.
......@@ -5,23 +5,33 @@
define('package/quiqqer/order/bin/frontend/controls/orderProcess/Login', [
'qui/QUI',
'qui/controls/Control'
'qui/controls/Control',
URL_OPT_DIR + 'bin/quiqqer-asset/animejs/animejs/lib/anime.min.js'
], function (QUI, QUIControl) {
"use strict";
], function(QUI, QUIControl, animejs) {
'use strict';
return new Class({
Extends: QUIControl,
Type : 'package/quiqqer/order/bin/frontend/controls/orderProcess/Login',
Type: 'package/quiqqer/order/bin/frontend/controls/orderProcess/Login',
Binds: [
'$onImport'
'$onImport',
'toggle'
],
initialize: function (options) {
initialize: function(options) {
this.parent(options);
this.Nav = null;
this.navEntries = [];
this.Main = null;
this.mainEntries = [];
this.ActiveNavEntry = null;
this.ActiveMainEntry = null;
this.clicked = false;
this.addEvents({
onImport: this.$onImport
});
......@@ -30,24 +40,342 @@ define('package/quiqqer/order/bin/frontend/controls/orderProcess/Login', [
/**
* event: on import
*/
$onImport: function () {
$onImport: function() {
var self = this;
this.getSignUpControl().then(function (Signup) {
this.getSignUpControl().then(function(Signup) {
if (!Signup) {
return;
}
self.getMailRegisterNode(Signup).then(function (MailRegister) {
self.getMailRegisterNode(Signup).then(function(MailRegister) {
MailRegister.set('data-no-blur-check', 1);
});
});
if (QUI.getWindowSize().x < 767) {
this.initTabsForMobile();
return;
}
this.initTabs();
},
// region tabs
/**
* Init clickable tabs functionality (for desktop)
*/
initTabs: function() {
const Elm = this.getElm();
const self = this;
this.Nav = Elm.querySelector('.quiqqer-order-ordering-nobody-tabNav');
this.navEntries = Elm.querySelectorAll('.quiqqer-order-ordering-nobody-tabNav__entry');
this.Main = Elm.querySelector('.quiqqer-order-ordering-nobody-tabs-main__list');
this.mainEntries = Elm.querySelectorAll('.quiqqer-order-ordering-nobody-tabs-main__item');
this.ActiveNavEntry = Elm.querySelector('.quiqqer-order-ordering-nobody-tabNav__entry.active');
this.ActiveMainEntry = Elm.querySelector('.quiqqer-order-ordering-nobody-tabs-main__item.active');
if (!this.navEntries || !this.mainEntries) {
return;
}
const clickEvent = function(event) {
event.stop();
if (self.clicked) {
return;
}
self.clicked = true;
let NavItem = event.target;
if (NavItem.nodeName !== 'LI') {
NavItem = NavItem.getParent('li');
}
let target = NavItem.getElement('a').getAttribute('href');
if (target.indexOf('#') === 0) {
target = target.substring(1);
}
if (!target) {
self.clicked = false;
return;
}
self.toggle(NavItem, target);
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
params.set('open', target);
url.search = params.toString();
history.pushState(null, null, url.toString());
};
this.navEntries.forEach((NavEntry) => {
NavEntry.addEvent('click', clickEvent);
});
},
/**
* Toggle nav and main content
*
* @param NavItem HTMLNode
* @param target string
*/
toggle: function(NavItem, target) {
if (NavItem.hasClass('active')) {
this.clicked = false;
return;
}
const Content = this.getElm().getElement('[id="' + target + '"]');
if (!Content) {
this.clicked = false;
return;
}
const self = this;
this.Main.setStyle('height', this.Main.offsetHeight);
Promise.all([
this.disableNavItem(this.ActiveNavEntry),
this.hideContent(this.ActiveMainEntry)
]).then(function() {
Content.setStyle('display', null);
return Promise.all([
self.enableNavItem(NavItem),
self.showContent(Content),
self.$setHeight(Content.offsetHeight)
]);
}).then(function() {
self.clicked = false;
self.Main.setStyle('height', null);
});
},
/**
* Make item inactive
*
* @param Item HTMLNode
* @return Promise
*/
disableNavItem: function(Item) {
Item.removeClass('active');
return Promise.resolve();
},
/**
* Make nav item active
*
* @param Item HTMLNode
* @return Promise
*/
enableNavItem: function(Item) {
Item.addClass('active');
this.ActiveNavEntry = Item;
return Promise.resolve();
},
/**
* Hide tab content
*
* @param Item HTMLNode
* @return Promise
*/
hideContent: function(Item) {
return new Promise((resolve) => {
this.$slideFadeOut(Item).then(function() {
Item.removeClass('active');
Item.setStyle('display', 'none');
resolve();
});
});
},
/**
* Show tab content
*
* @param Item HTMLNode
* @return Promise
*/
showContent: function(Item) {
return new Promise((resolve) => {
this.$slideFadeIn(Item).then(() => {
Item.style.display = null;
Item.style.opacity = null;
Item.addClass('active');
this.ActiveMainEntry = Item;
resolve();
});
});
},
/**
* Set height of tab content container
*
* @param height integer
* @return Promise
*/
$setHeight: function(height) {
return this.$animate(this.Main, {
height: height
});
},
/**
* Fade out animation (hide)
*
* @param Item HTMLNode
* @return Promise
*/
$slideFadeOut: function(Item) {
return this.$animate(Item, {
opacity: 0,
translateX: -5
});
},
/**
* Fade in animation (show)
*
* @param Item HTMLNode
* @return Promise
*/
$slideFadeIn: function(Item) {
Item.setStyles({
transform: 'translateX(-5px)',
opacity: 0
});
return this.$animate(Item, {
translateX: 0,
opacity: 1
});
},
$animate: function(Target, options) {
return new Promise(function(resolve) {
options = options || {};
options.targets = Target;
options.complete = resolve;
options.duration = options.duration || 250;
options.easing = options.easing || 'easeInQuad';
animejs(options);
});
},
// endregion
// region tabs for mobile
/**
* Initializes the tabs for mobile devices.
*
* Handles the click events on the tabs and the back buttons, and toggles the visibility of the tabs and their content.
*
* @return {void}
*/
initTabsForMobile: function() {
const Elm = this.getElm();
const self = this;
this.Tabs = Elm.querySelector('.quiqqer-order-ordering-nobody__tabs');
this.Nav = Elm.querySelector('.quiqqer-order-ordering-nobody-tabNav');
this.navEntries = Elm.querySelectorAll('.quiqqer-order-ordering-nobody-tabNav__entry');
this.Main = Elm.querySelector('.quiqqer-order-ordering-nobody-tabs-main__list');
this.mainEntries = Elm.querySelectorAll('.quiqqer-order-ordering-nobody-tabs-main__item');
const backBtns = Elm.querySelectorAll('.quiqqer-order-ordering-nobody-tabs-main__btnBack');
/**
* Handles the click event on the tabs for mobile devices.
*
* @param {object} event - The click event object.
* @return {void}
*/
const clickEvent = function(event) {
event.stop();
if (self.clicked) {
return;
}
self.clicked = true;
let NavItem = event.target;
if (NavItem.nodeName !== 'LI') {
NavItem = NavItem.getParent('li');
}
let target = NavItem.getElement('a').getAttribute('href');
if (target.indexOf('#') === 0) {
target = target.substring(1);
}
if (!target) {
self.clicked = false;
return;
}
self.Nav.style.display = 'none';
self.mainEntries.forEach((MainEntry) => {
if (MainEntry.getAttribute('id') === target) {
MainEntry.style.display = 'block';
} else {
MainEntry.style.display = 'none';
}
});
self.clicked = false;
};
/**
* Handles the back button click event on the tabs for mobile devices.
*
* @return {void}
*/
const backClickEvent = function() {
self.mainEntries.forEach((MainEntry) => {
MainEntry.style.display = 'none';
});
self.Nav.style.display = null;
};
this.navEntries.forEach((NavEntry) => {
NavEntry.addEvent('click', clickEvent);
});
backBtns.forEach((Btn) => {
Btn.addEvent('click', backClickEvent);
});
},
// endregion
/**
* @return {Promise|*}
*/
getSignUpControl: function () {
getSignUpControl: function() {
var SignUp = this.getElm().getElement('.quiqqer-fu-registrationSignUp');
if (SignUp.get('data-quiid')) {
......@@ -56,8 +384,8 @@ define('package/quiqqer/order/bin/frontend/controls/orderProcess/Login', [
);
}
return new Promise(function (resolve) {
SignUp.addEvent('load', function () {
return new Promise(function(resolve) {
SignUp.addEvent('load', function() {
resolve(QUI.Controls.getById(SignUp.get('data-quiid')));
});
});
......@@ -67,12 +395,12 @@ define('package/quiqqer/order/bin/frontend/controls/orderProcess/Login', [
* @param Signup
* @return {Promise}
*/
getMailRegisterNode: function (Signup) {
var fetchMailControl = function () {
getMailRegisterNode: function(Signup) {
var fetchMailControl = function() {
var EmailRegister = Signup.getElm().getElement(
'.quiqqer-fu-registrationSignUp-registration-email [name="email"]'
);
if (!EmailRegister) {
return Promise.resolve(false);
}
......@@ -85,8 +413,8 @@ define('package/quiqqer/order/bin/frontend/controls/orderProcess/Login', [
return fetchMailControl();
}
return new Promise(function (resolve) {
Signup.addEvent('onLoaded', function () {
return new Promise(function(resolve) {
Signup.addEvent('onLoaded', function() {
fetchMailControl().then(resolve);
});
});
......
......@@ -168,7 +168,9 @@ window.whenQuiLoaded().then(function() {
require(['package/quiqqer/order/bin/frontend/Basket'], function(Basket) {
Basket.addEvent('onAdd', function() {
getBasketData(Basket).then(function(data) {
window.qTrack('event', 'add_to_cart', data);
if (Basket.isLoaded()) {
window.qTrack('event', 'add_to_cart', data);
}
});
});
......@@ -219,7 +221,9 @@ window.whenQuiLoaded().then(function() {
QUI.addEvent('onQuiqqerOrderProductAdd', function(OrderProcess) {
getOrderData(OrderProcess).then((order) => {
window.qTrack('event', 'add_to_cart', order);
if (OrderProcess.isLoaded()) {
window.qTrack('event', 'add_to_cart', order);
}
});
});
......
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren