@shisyamo4131/air-guard-v2-schemas 1.1.0 → 1.2.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shisyamo4131/air-guard-v2-schemas",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Schemas for AirGuard V2",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -8,19 +8,19 @@
8
8
  * - Provides comprehensive billing calculations including statistics, sales amounts, and tax.
9
9
  * - Supports both daily and hourly billing with adjusted quantities.
10
10
  * ---------------------------------------------------------------------------
11
- * @props {string|null} siteOperationScheduleId - Associated SiteOperationSchedule document ID
11
+ * @prop {string|null} siteOperationScheduleId - Associated SiteOperationSchedule document ID
12
12
  * - If this OperationResult was created from a SiteOperationSchedule, this property holds that ID.
13
13
  * - If this property is set, the instance cannot be deleted.
14
- * @props {boolean} useAdjustedQuantity - Flag to indicate if adjusted quantities are used for billing
15
- * @props {number} adjustedQuantityBase - Adjusted quantity for base workers
14
+ * @prop {boolean} useAdjustedQuantity - Flag to indicate if adjusted quantities are used for billing
15
+ * @prop {number} adjustedQuantityBase - Adjusted quantity for base workers
16
16
  * - Quantity used for billing base workers when `useAdjustedQuantity` is true.
17
- * @props {number} adjustedOvertimeBase - Adjusted overtime for base workers
17
+ * @prop {number} adjustedOvertimeBase - Adjusted overtime for base workers
18
18
  * - Overtime used for billing base workers when `useAdjustedQuantity` is true.
19
- * @props {number} adjustedQuantityQualified - Adjusted quantity for qualified workers
19
+ * @prop {number} adjustedQuantityQualified - Adjusted quantity for qualified workers
20
20
  * - Quantity used for billing qualified workers when `useAdjustedQuantity` is true.
21
- * @props {number} adjustedOvertimeQualified - Adjusted overtime for qualified workers
21
+ * @prop {number} adjustedOvertimeQualified - Adjusted overtime for qualified workers
22
22
  * - Overtime used for billing qualified workers when `useAdjustedQuantity` is true.
23
- * @props {Date} billingDateAt - Billing date
23
+ * @prop {Date} billingDateAt - Billing date
24
24
  * ---------------------------------------------------------------------------
25
25
  * @computed {Object} statistics - Statistics of workers (read-only)
26
26
  * - Contains counts and total work minutes for base and qualified workers, including OJT breakdowns.
@@ -40,39 +40,39 @@
40
40
  * - Sum of `salesAmount` and `tax`.
41
41
  * ---------------------------------------------------------------------------
42
42
  * @inherited - The following properties are inherited from Operation:
43
- * @props {string} siteId - Site document ID (trigger property)
43
+ * @prop {string} siteId - Site document ID (trigger property)
44
44
  * - Automatically synchronizes to all `employees` and `outsourcers` when changed.
45
- * @props {number} requiredPersonnel - Required number of personnel
46
- * @props {boolean} qualificationRequired - Qualification required flag
47
- * @props {string} workDescription - Work description
48
- * @props {string} remarks - Remarks
49
- * @props {Array<OperationResultDetail>} employees - Assigned employees
45
+ * @prop {number} requiredPersonnel - Required number of personnel
46
+ * @prop {boolean} qualificationRequired - Qualification required flag
47
+ * @prop {string} workDescription - Work description
48
+ * @prop {string} remarks - Remarks
49
+ * @prop {Array<OperationResultDetail>} employees - Assigned employees
50
50
  * - Array of `OperationResultDetail` instances representing assigned employees
51
- * @props {Array<OperationResultDetail>} outsourcers - Assigned outsourcers
51
+ * @prop {Array<OperationResultDetail>} outsourcers - Assigned outsourcers
52
52
  * - Array of `OperationResultDetail` instances representing assigned outsourcers
53
53
  * ---------------------------------------------------------------------------
54
54
  * @inherited - The following properties are inherited from Agreement (via Operation):
55
- * @props {number} unitPriceBase - Base unit price (JPY)
56
- * @props {number} overtimeUnitPriceBase - Overtime unit price (JPY/hour)
57
- * @props {number} unitPriceQualified - Qualified unit price (JPY)
58
- * @props {number} overtimeUnitPriceQualified - Qualified overtime unit price (JPY/hour)
59
- * @props {string} billingUnitType - Billing unit type
60
- * @props {boolean} includeBreakInBilling - Whether to include break time in billing if `billingUnitType` is `PER_HOUR`.
61
- * @props {number} cutoffDate - Cutoff date value from CutoffDate.VALUES
55
+ * @prop {number} unitPriceBase - Base unit price (JPY)
56
+ * @prop {number} overtimeUnitPriceBase - Overtime unit price (JPY/hour)
57
+ * @prop {number} unitPriceQualified - Qualified unit price (JPY)
58
+ * @prop {number} overtimeUnitPriceQualified - Qualified overtime unit price (JPY/hour)
59
+ * @prop {string} billingUnitType - Billing unit type
60
+ * @prop {boolean} includeBreakInBilling - Whether to include break time in billing if `billingUnitType` is `PER_HOUR`.
61
+ * @prop {number} cutoffDate - Cutoff date value from CutoffDate.VALUES
62
62
  * - The cutoff date for billing, using values defined in the CutoffDate utility class.
63
63
  * ---------------------------------------------------------------------------
64
64
  * @inherited - The following properties are inherited from WorkingResult (via Operation):
65
- * @props {Date} dateAt - Date of operation (placement date) (trigger property)
65
+ * @prop {Date} dateAt - Date of operation (placement date) (trigger property)
66
66
  * - Automatically synchronizes to all `employees` and `outsourcers` when changed.
67
- * @props {string} dayType - Day type (e.g., `WEEKDAY`, `WEEKEND`, `HOLIDAY`)
68
- * @props {string} shiftType - `DAY` or `NIGHT` (trigger property)
67
+ * @prop {string} dayType - Day type (e.g., `WEEKDAY`, `WEEKEND`, `HOLIDAY`)
68
+ * @prop {string} shiftType - `DAY` or `NIGHT` (trigger property)
69
69
  * - Automatically synchronizes to all `employees` and `outsourcers` when changed.
70
- * @props {string} startTime - Start time (HH:MM format)
71
- * @props {boolean} isStartNextDay - Next day start flag
70
+ * @prop {string} startTime - Start time (HH:MM format)
71
+ * @prop {boolean} isStartNextDay - Next day start flag
72
72
  * - `true` if the actual work starts the day after the placement date `dateAt`
73
- * @props {string} endTime - End time (HH:MM format)
74
- * @props {number} breakMinutes - Break time (minutes)
75
- * @props {number} regulationWorkMinutes - Regulation work minutes (trigger property)
73
+ * @prop {string} endTime - End time (HH:MM format)
74
+ * @prop {number} breakMinutes - Break time (minutes)
75
+ * @prop {number} regulationWorkMinutes - Regulation work minutes (trigger property)
76
76
  * - Indicates the maximum working time treated as regular working hours.
77
77
  * - Automatically synchronizes to all `employees` and `outsourcers` when changed.
78
78
  * ---------------------------------------------------------------------------
@@ -188,18 +188,6 @@ import CutoffDate from "./utils/CutoffDate.js";
188
188
  const classProps = {
189
189
  ...Operation.classProps,
190
190
  ...Agreement.classProps,
191
- // Override Agreement's `cutoffDate` field to be hidden.
192
- cutoffDate: defField("select", {
193
- label: "締日区分",
194
- default: CutoffDate.VALUES.END_OF_MONTH,
195
- required: true,
196
- hidden: true,
197
- component: {
198
- attrs: {
199
- items: CutoffDate.OPTIONS,
200
- },
201
- },
202
- }),
203
191
  siteOperationScheduleId: defField("oneLine", { hidden: true }),
204
192
  useAdjustedQuantity: defField("check", {
205
193
  label: "調整数量を使用",
@@ -247,7 +235,25 @@ export default class OperationResult extends Operation {
247
235
  super.afterInitialize();
248
236
 
249
237
  /** Computed properties */
238
+ let _cutoffDate = this.cutoffDate;
250
239
  Object.defineProperties(this, {
240
+ cutoffDate: {
241
+ configurable: true,
242
+ enumerable: true,
243
+ get() {
244
+ return _cutoffDate;
245
+ },
246
+ set(v) {
247
+ _cutoffDate = v;
248
+ // Update billingDateAt when cutoffDate changes
249
+ if (this.dateAt) {
250
+ this.billingDateAt = CutoffDate.getBillingDateAt(
251
+ this.dateAt,
252
+ this.cutoffDate
253
+ );
254
+ }
255
+ },
256
+ },
251
257
  statistics: {
252
258
  configurable: true,
253
259
  enumerable: true,
@@ -423,6 +429,12 @@ export default class OperationResult extends Operation {
423
429
  });
424
430
  }
425
431
 
432
+ setDateAtCallback(v) {
433
+ super.setDateAtCallback(v);
434
+ if (!this.cutoffDate) return;
435
+ this.billingDateAt = CutoffDate.getBillingDateAt(v, this.cutoffDate);
436
+ }
437
+
426
438
  /**
427
439
  * Override `beforeDelete`.
428
440
  * - Prevents deletion if the instance has `siteOperationScheduleId`.