@shisyamo4131/air-guard-v2-schemas 1.3.1-dev.6 → 1.3.1-dev.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/OperationResult.js +33 -13
package/package.json
CHANGED
package/src/OperationResult.js
CHANGED
|
@@ -205,12 +205,14 @@ const classProps = {
|
|
|
205
205
|
customClass: OperationResultDetail,
|
|
206
206
|
}),
|
|
207
207
|
isLocked: defField("check", {
|
|
208
|
-
label: "
|
|
208
|
+
label: "実績確定",
|
|
209
209
|
default: false,
|
|
210
210
|
}),
|
|
211
|
-
|
|
212
|
-
/** add */
|
|
213
211
|
agreement: defField("object", { label: "取極め", customClass: Agreement }),
|
|
212
|
+
ignoreEmptyAgreement: defField("check", {
|
|
213
|
+
label: "取極めなしを無視",
|
|
214
|
+
default: false,
|
|
215
|
+
}),
|
|
214
216
|
};
|
|
215
217
|
|
|
216
218
|
export default class OperationResult extends Operation {
|
|
@@ -232,6 +234,7 @@ export default class OperationResult extends Operation {
|
|
|
232
234
|
super.afterInitialize();
|
|
233
235
|
|
|
234
236
|
/** Computed properties */
|
|
237
|
+
let _agreement = this.agreement;
|
|
235
238
|
Object.defineProperties(this, {
|
|
236
239
|
statistics: {
|
|
237
240
|
configurable: true,
|
|
@@ -417,7 +420,17 @@ export default class OperationResult extends Operation {
|
|
|
417
420
|
set(v) {},
|
|
418
421
|
},
|
|
419
422
|
|
|
420
|
-
|
|
423
|
+
agreement: {
|
|
424
|
+
configurable: true,
|
|
425
|
+
enumerable: true,
|
|
426
|
+
get() {
|
|
427
|
+
return _agreement;
|
|
428
|
+
},
|
|
429
|
+
set(v) {
|
|
430
|
+
_agreement = v;
|
|
431
|
+
this.refreshBillingDateAt();
|
|
432
|
+
},
|
|
433
|
+
},
|
|
421
434
|
hasAgreement: {
|
|
422
435
|
configurable: true,
|
|
423
436
|
enumerable: true,
|
|
@@ -431,7 +444,7 @@ export default class OperationResult extends Operation {
|
|
|
431
444
|
enumerable: true,
|
|
432
445
|
get() {
|
|
433
446
|
if (this.hasAgreement) return true;
|
|
434
|
-
return this.
|
|
447
|
+
return this.ignoreEmptyAgreement;
|
|
435
448
|
},
|
|
436
449
|
set(v) {},
|
|
437
450
|
},
|
|
@@ -471,20 +484,22 @@ export default class OperationResult extends Operation {
|
|
|
471
484
|
}
|
|
472
485
|
|
|
473
486
|
/**
|
|
474
|
-
* Override
|
|
475
|
-
*
|
|
487
|
+
* Override create method to validate billingDateAt when ignoreEmptyAgreement is true
|
|
488
|
+
* @param {*} options
|
|
489
|
+
* @returns {Promise<DocumentReference>}
|
|
476
490
|
*/
|
|
477
|
-
async
|
|
478
|
-
|
|
479
|
-
if (this.siteOperationScheduleId) {
|
|
491
|
+
async create(options = {}) {
|
|
492
|
+
if (this.ignoreEmptyAgreement && !this.billingDateAt) {
|
|
480
493
|
throw new Error(
|
|
481
|
-
"
|
|
494
|
+
"[OperationResult] Billing date is required when 'ignoreEmptyAgreement' is true."
|
|
482
495
|
);
|
|
483
496
|
}
|
|
497
|
+
return await super.create(options);
|
|
484
498
|
}
|
|
485
499
|
|
|
486
500
|
/**
|
|
487
501
|
* Override update method to prevent editing if isLocked is true
|
|
502
|
+
* - Also validate billingDateAt when ignoreEmptyAgreement is true
|
|
488
503
|
* @param {*} options
|
|
489
504
|
* @returns {Promise<void>}
|
|
490
505
|
*/
|
|
@@ -494,7 +509,12 @@ export default class OperationResult extends Operation {
|
|
|
494
509
|
"[OperationResult] This OperationResult is locked and cannot be edited."
|
|
495
510
|
);
|
|
496
511
|
}
|
|
497
|
-
|
|
512
|
+
if (this.ignoreEmptyAgreement && !this.billingDateAt) {
|
|
513
|
+
throw new Error(
|
|
514
|
+
"[OperationResult] Billing date is required when 'ignoreEmptyAgreement' is true."
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
return await super.update(options);
|
|
498
518
|
}
|
|
499
519
|
|
|
500
520
|
/**
|
|
@@ -508,6 +528,6 @@ export default class OperationResult extends Operation {
|
|
|
508
528
|
"[OperationResult] This OperationResult is locked and cannot be deleted."
|
|
509
529
|
);
|
|
510
530
|
}
|
|
511
|
-
return super.delete(options);
|
|
531
|
+
return await super.delete(options);
|
|
512
532
|
}
|
|
513
533
|
}
|