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 { 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({
|
||||
setup() {
|
||||
return {
|
||||
@@ -98,17 +103,24 @@ export default defineComponent({
|
||||
const currentOrder = this.store[localOrder.orderType];
|
||||
|
||||
if (localOrderBody.rows.length != currentOrder.rows.length) {
|
||||
alert(
|
||||
'Zły format rozkazu! Może pochodzić z przestarzałej wersji lub został źle zapisany.'
|
||||
);
|
||||
console.warn('Zły format zapisanego rozkazu!');
|
||||
alertWrongOrderFormat();
|
||||
return;
|
||||
}
|
||||
|
||||
for (let rowIndex = 0; rowIndex < currentOrder.rows.length; rowIndex++) {
|
||||
const row = currentOrder.rows[rowIndex];
|
||||
|
||||
if (localOrderBody.rows[rowIndex] === undefined) {
|
||||
alertWrongOrderFormat();
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const rowProp in row) {
|
||||
if (localOrderBody.rows[rowIndex][rowProp] === undefined) {
|
||||
alertWrongOrderFormat();
|
||||
continue;
|
||||
}
|
||||
|
||||
(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++) {
|
||||
const row = currentOrder.orderList[rowIndex];
|
||||
|
||||
if (localOrderBody.orderList[rowIndex] === undefined) {
|
||||
alertWrongOrderFormat();
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const rowProp in row) {
|
||||
if (localOrderBody.orderList[rowIndex][rowProp] === undefined) {
|
||||
alertWrongOrderFormat();
|
||||
continue;
|
||||
}
|
||||
|
||||
(currentOrder.orderList[rowIndex] as any)[rowProp] =
|
||||
localOrderBody.orderList[rowIndex][rowProp];
|
||||
}
|
||||
@@ -133,6 +155,8 @@ export default defineComponent({
|
||||
(this.store.orderFooter as any)[key] = localOrderFooter[key];
|
||||
}
|
||||
|
||||
console.log('loading');
|
||||
|
||||
this.store.chosenOrderType = localOrder.orderType;
|
||||
this.store.chosenLocalOrderId = localOrder.id;
|
||||
this.store.orderMode = 'OrderMessage';
|
||||
|
||||
Reference in New Issue
Block a user