mirror of
https://github.com/Spythere/genera-tor.git
synced 2026-05-03 13:38:12 +00:00
chore: order compatibility warnings
This commit is contained in:
@@ -2,6 +2,11 @@ import { defineComponent } from 'vue';
|
|||||||
import { useStore } from '../store/store';
|
import { useStore } from '../store/store';
|
||||||
import { LocalStorageOrder } from '../types/orderTypes';
|
import { LocalStorageOrder } from '../types/orderTypes';
|
||||||
|
|
||||||
|
function alertWrongOrderFormat() {
|
||||||
|
alert('Wystąpił błąd podczas przetwarzania rozkazu! Informacje mogą być niepoprawne!');
|
||||||
|
console.warn('Zły format zapisanego rozkazu!');
|
||||||
|
}
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
setup() {
|
setup() {
|
||||||
return {
|
return {
|
||||||
@@ -98,17 +103,24 @@ export default defineComponent({
|
|||||||
const currentOrder = this.store[localOrder.orderType];
|
const currentOrder = this.store[localOrder.orderType];
|
||||||
|
|
||||||
if (localOrderBody.rows.length != currentOrder.rows.length) {
|
if (localOrderBody.rows.length != currentOrder.rows.length) {
|
||||||
alert(
|
alertWrongOrderFormat();
|
||||||
'Zły format rozkazu! Może pochodzić z przestarzałej wersji lub został źle zapisany.'
|
|
||||||
);
|
|
||||||
console.warn('Zły format zapisanego rozkazu!');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let rowIndex = 0; rowIndex < currentOrder.rows.length; rowIndex++) {
|
for (let rowIndex = 0; rowIndex < currentOrder.rows.length; rowIndex++) {
|
||||||
const row = currentOrder.rows[rowIndex];
|
const row = currentOrder.rows[rowIndex];
|
||||||
|
|
||||||
|
if (localOrderBody.rows[rowIndex] === undefined) {
|
||||||
|
alertWrongOrderFormat();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (const rowProp in row) {
|
for (const rowProp in row) {
|
||||||
|
if (localOrderBody.rows[rowIndex][rowProp] === undefined) {
|
||||||
|
alertWrongOrderFormat();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
(currentOrder.rows[rowIndex] as any)[rowProp] = localOrderBody.rows[rowIndex][rowProp];
|
(currentOrder.rows[rowIndex] as any)[rowProp] = localOrderBody.rows[rowIndex][rowProp];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -120,7 +132,17 @@ export default defineComponent({
|
|||||||
for (let rowIndex = 0; rowIndex < currentOrder.orderList.length; rowIndex++) {
|
for (let rowIndex = 0; rowIndex < currentOrder.orderList.length; rowIndex++) {
|
||||||
const row = currentOrder.orderList[rowIndex];
|
const row = currentOrder.orderList[rowIndex];
|
||||||
|
|
||||||
|
if (localOrderBody.orderList[rowIndex] === undefined) {
|
||||||
|
alertWrongOrderFormat();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (const rowProp in row) {
|
for (const rowProp in row) {
|
||||||
|
if (localOrderBody.orderList[rowIndex][rowProp] === undefined) {
|
||||||
|
alertWrongOrderFormat();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
(currentOrder.orderList[rowIndex] as any)[rowProp] =
|
(currentOrder.orderList[rowIndex] as any)[rowProp] =
|
||||||
localOrderBody.orderList[rowIndex][rowProp];
|
localOrderBody.orderList[rowIndex][rowProp];
|
||||||
}
|
}
|
||||||
@@ -133,6 +155,8 @@ export default defineComponent({
|
|||||||
(this.store.orderFooter as any)[key] = localOrderFooter[key];
|
(this.store.orderFooter as any)[key] = localOrderFooter[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('loading');
|
||||||
|
|
||||||
this.store.chosenOrderType = localOrder.orderType;
|
this.store.chosenOrderType = localOrder.orderType;
|
||||||
this.store.chosenLocalOrderId = localOrder.id;
|
this.store.chosenLocalOrderId = localOrder.id;
|
||||||
this.store.orderMode = 'OrderMessage';
|
this.store.orderMode = 'OrderMessage';
|
||||||
|
|||||||
Reference in New Issue
Block a user