@shisyamo4131/air-guard-v2-schemas 2.3.7-dev.2 → 2.3.7-dev.20
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/index.js +1 -0
- package/package.json +1 -1
- package/src/Company.js +27 -1
- package/src/Employee.js +129 -48
- package/src/Operation.js +60 -20
- package/src/OperationBilling.js +23 -14
- package/src/OperationResult.js +15 -8
- package/src/SiteOperationSchedule.js +21 -16
- package/src/System.js +43 -0
- package/src/WorkingResult.js +31 -17
- package/src/parts/accessorDefinitions.js +11 -27
- package/src/parts/fieldDefinitions.js +49 -1
package/index.js
CHANGED
|
@@ -14,4 +14,5 @@ export { default as Site } from "./src/Site.js";
|
|
|
14
14
|
export { default as SiteOperationSchedule } from "./src/SiteOperationSchedule.js";
|
|
15
15
|
export { default as SiteOperationScheduleDetail } from "./src/SiteOperationScheduleDetail.js";
|
|
16
16
|
export { default as SiteOrder } from "./src/SiteOrder.js";
|
|
17
|
+
export { default as System } from "./src/System.js";
|
|
17
18
|
export { default as User } from "./src/User.js";
|
package/package.json
CHANGED
package/src/Company.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Company Model
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.4.0
|
|
4
4
|
* @author shisyamo4131
|
|
5
|
+
* @update 2025-12-02 Add maintenance information properties.
|
|
6
|
+
* @update 2025-12-01 Add Stripe integration fields (stripeCustomerId, subscription).
|
|
5
7
|
* @update 2025-11-27 Add bank information fields for billing.
|
|
6
8
|
* @update 2025-11-23 Set `usePrefix` to false.
|
|
7
9
|
*/
|
|
@@ -92,6 +94,30 @@ const classProps = {
|
|
|
92
94
|
},
|
|
93
95
|
},
|
|
94
96
|
}),
|
|
97
|
+
|
|
98
|
+
/** Stripe連携フィールド */
|
|
99
|
+
stripeCustomerId: defField("oneLine", {
|
|
100
|
+
label: "Stripe顧客ID",
|
|
101
|
+
hidden: true,
|
|
102
|
+
length: 100,
|
|
103
|
+
}),
|
|
104
|
+
|
|
105
|
+
subscription: defField("object", {
|
|
106
|
+
label: "サブスクリプション情報",
|
|
107
|
+
hidden: true,
|
|
108
|
+
default: () => ({
|
|
109
|
+
id: null,
|
|
110
|
+
status: null,
|
|
111
|
+
currentPeriodEnd: null,
|
|
112
|
+
employeeLimit: 10,
|
|
113
|
+
}),
|
|
114
|
+
}),
|
|
115
|
+
|
|
116
|
+
/** メンテナンス情報 */
|
|
117
|
+
maintenanceMode: defField("check", { default: false, hidden: true }),
|
|
118
|
+
maintenanceReason: defField("oneLine", { default: null, hidden: true }),
|
|
119
|
+
maintenanceStartAt: defField("dateAt", { default: null, hidden: true }),
|
|
120
|
+
maintenanceStartedBy: defField("oneLine", { default: null, hidden: true }),
|
|
95
121
|
};
|
|
96
122
|
|
|
97
123
|
export default class Company extends FireModel {
|
package/src/Employee.js
CHANGED
|
@@ -15,22 +15,25 @@ const classProps = {
|
|
|
15
15
|
lastNameKana: defField("lastNameKana", { required: true }),
|
|
16
16
|
firstNameKana: defField("firstNameKana", { required: true }),
|
|
17
17
|
displayName: defField("displayName", { required: true }),
|
|
18
|
-
title: defField("oneLine", { label: "肩書", required: true }),
|
|
19
18
|
gender: defField("gender", { required: true }),
|
|
20
|
-
dateOfBirth: defField("
|
|
19
|
+
dateOfBirth: defField("dateOfBirth", { required: true }),
|
|
21
20
|
zipcode: defField("zipcode", { required: true }),
|
|
22
21
|
prefCode: defField("prefCode", { required: true }),
|
|
23
22
|
city: defField("city", { required: true }),
|
|
24
23
|
address: defField("address", { required: true }),
|
|
25
24
|
building: defField("building"),
|
|
26
|
-
location: defField("location", { hidden: true }),
|
|
27
|
-
|
|
25
|
+
location: defField("location", { hidden: true }),
|
|
26
|
+
mobile: defField("mobile", { required: true }),
|
|
27
|
+
email: defField("email", { required: false }),
|
|
28
|
+
dateOfHire: defField("dateOfHire", { required: true }),
|
|
28
29
|
employmentStatus: defField("employmentStatus", { required: true }),
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
title: defField("title"),
|
|
31
|
+
dateOfTermination: defField("dateOfTermination", {
|
|
32
|
+
default: null,
|
|
31
33
|
component: {
|
|
32
34
|
attrs: {
|
|
33
|
-
required: (item) => item.employmentStatus ===
|
|
35
|
+
required: (item) => item.employmentStatus === VALUES.TERMINATED.value,
|
|
36
|
+
disabled: (item) => item.employmentStatus !== VALUES.TERMINATED.value,
|
|
34
37
|
},
|
|
35
38
|
},
|
|
36
39
|
}),
|
|
@@ -39,6 +42,7 @@ const classProps = {
|
|
|
39
42
|
component: {
|
|
40
43
|
attrs: {
|
|
41
44
|
required: (item) => item.isForeigner,
|
|
45
|
+
disabled: (item) => !item.isForeigner,
|
|
42
46
|
},
|
|
43
47
|
},
|
|
44
48
|
}),
|
|
@@ -46,61 +50,67 @@ const classProps = {
|
|
|
46
50
|
component: {
|
|
47
51
|
attrs: {
|
|
48
52
|
required: (item) => item.isForeigner,
|
|
53
|
+
disabled: (item) => !item.isForeigner,
|
|
49
54
|
},
|
|
50
55
|
},
|
|
51
56
|
}),
|
|
52
|
-
residenceStatus: {
|
|
53
|
-
type: String,
|
|
54
|
-
default: null,
|
|
55
|
-
label: "在留資格",
|
|
56
|
-
required: undefined,
|
|
57
|
+
residenceStatus: defField("residenceStatus", {
|
|
57
58
|
component: {
|
|
58
|
-
name: "air-text-field",
|
|
59
59
|
attrs: {
|
|
60
60
|
required: (item) => item.isForeigner,
|
|
61
|
+
disabled: (item) => !item.isForeigner,
|
|
61
62
|
},
|
|
62
63
|
},
|
|
63
|
-
},
|
|
64
|
-
periodOfStay: defField("
|
|
65
|
-
label: "在留期間満了日",
|
|
64
|
+
}),
|
|
65
|
+
periodOfStay: defField("periodOfStay", {
|
|
66
66
|
component: {
|
|
67
67
|
attrs: {
|
|
68
68
|
required: (item) => item.isForeigner,
|
|
69
|
+
disabled: (item) => !item.isForeigner,
|
|
69
70
|
},
|
|
70
71
|
},
|
|
71
72
|
}),
|
|
72
|
-
remarks: defField("
|
|
73
|
+
remarks: defField("remarks"),
|
|
73
74
|
};
|
|
74
75
|
|
|
75
76
|
/*****************************************************************************
|
|
76
|
-
* Employee
|
|
77
|
-
* @
|
|
78
|
-
* @
|
|
79
|
-
* @
|
|
80
|
-
* @
|
|
81
|
-
* @
|
|
82
|
-
* @
|
|
83
|
-
* @
|
|
84
|
-
* @
|
|
85
|
-
* @
|
|
86
|
-
* @
|
|
87
|
-
* @
|
|
88
|
-
* @
|
|
89
|
-
* @
|
|
90
|
-
* @
|
|
91
|
-
* @
|
|
92
|
-
* @
|
|
93
|
-
* @
|
|
94
|
-
* @
|
|
95
|
-
* @
|
|
96
|
-
* @
|
|
97
|
-
* @
|
|
98
|
-
* @
|
|
99
|
-
* @
|
|
100
|
-
* @
|
|
101
|
-
* @
|
|
102
|
-
*
|
|
103
|
-
* @
|
|
77
|
+
* @prop {string} code - Employee code.
|
|
78
|
+
* @prop {string} lastName - Last name.
|
|
79
|
+
* @prop {string} firstName - First name.
|
|
80
|
+
* @prop {string} lastNameKana - Last name in Kana.
|
|
81
|
+
* @prop {string} firstNameKana - First name in Kana.
|
|
82
|
+
* @prop {string} displayName - Display name.
|
|
83
|
+
* @prop {string} gender - Gender.
|
|
84
|
+
* @prop {Date} dateOfBirth - Date of birth.
|
|
85
|
+
* @prop {string} zipcode - Postal code.
|
|
86
|
+
* @prop {string} prefCode - Prefecture code.
|
|
87
|
+
* @prop {string} city - City name.
|
|
88
|
+
* @prop {string} address - Address details.
|
|
89
|
+
* @prop {string} building - Building name.
|
|
90
|
+
* @prop {object} location - Geographical location.
|
|
91
|
+
* @prop {string} mobile - Mobile phone number.
|
|
92
|
+
* @prop {string} email - Email address.
|
|
93
|
+
* @prop {Date} dateOfHire - Date of hire.
|
|
94
|
+
* @prop {string} employmentStatus - Employment status.
|
|
95
|
+
* @prop {string} title - Job title.
|
|
96
|
+
* @prop {Date} dateOfTermination - Date of termination.
|
|
97
|
+
* @prop {boolean} isForeigner - Is the employee a foreigner.
|
|
98
|
+
* @prop {string} foreignName - Foreign name.
|
|
99
|
+
* @prop {string} nationality - Nationality.
|
|
100
|
+
* @prop {string} residenceStatus - Residence status.
|
|
101
|
+
* @prop {Date} periodOfStay - Period of stay expiration date.
|
|
102
|
+
* @prop {string} remarks - Additional remarks.
|
|
103
|
+
*
|
|
104
|
+
* @prop {string} fullName - Full name combining last and first names (read-only)
|
|
105
|
+
* @prop {string} fullNameKana - Full name in Kana combining last and first names (read-only)
|
|
106
|
+
* @prop {string} fullAddress - Full address combining prefecture, city, and address (read-only)
|
|
107
|
+
* @prop {string} prefecture - Prefecture name derived from `prefCode` (read-only)
|
|
108
|
+
* @prop {number} age - Age calculated from `dateOfBirth` (read-only)
|
|
109
|
+
* @prop {number} yearsOfService - Years of service calculated from `dateOfHire` (read-only)
|
|
110
|
+
*
|
|
111
|
+
* @static
|
|
112
|
+
* @prop {string} STATUS_ACTIVE - constant for active employment status
|
|
113
|
+
* @prop {string} STATUS_TERMINATED - constant for terminated employment status
|
|
104
114
|
*****************************************************************************/
|
|
105
115
|
export default class Employee extends FireModel {
|
|
106
116
|
static className = "従業員";
|
|
@@ -109,6 +119,7 @@ export default class Employee extends FireModel {
|
|
|
109
119
|
static logicalDelete = true;
|
|
110
120
|
static classProps = classProps;
|
|
111
121
|
static tokenFields = [
|
|
122
|
+
"code",
|
|
112
123
|
"lastName",
|
|
113
124
|
"firstName",
|
|
114
125
|
"lastNameKana",
|
|
@@ -129,14 +140,50 @@ export default class Employee extends FireModel {
|
|
|
129
140
|
super.afterInitialize(item);
|
|
130
141
|
Object.defineProperties(this, {
|
|
131
142
|
fullName: defAccessor("fullName"),
|
|
143
|
+
fullNameKana: defAccessor("fullNameKana"),
|
|
132
144
|
fullAddress: defAccessor("fullAddress"),
|
|
133
145
|
prefecture: defAccessor("prefecture"),
|
|
146
|
+
age: {
|
|
147
|
+
enumerable: true,
|
|
148
|
+
configurable: true,
|
|
149
|
+
get() {
|
|
150
|
+
if (!this.dateOfBirth) return null;
|
|
151
|
+
const today = new Date();
|
|
152
|
+
let age = today.getUTCFullYear() - this.dateOfBirth.getUTCFullYear();
|
|
153
|
+
const m = today.getUTCMonth() - this.dateOfBirth.getUTCMonth();
|
|
154
|
+
const d = today.getUTCDate() - this.dateOfBirth.getUTCDate();
|
|
155
|
+
if (m < 0 || (m === 0 && d < 0)) age--;
|
|
156
|
+
return age;
|
|
157
|
+
},
|
|
158
|
+
set() {},
|
|
159
|
+
},
|
|
160
|
+
yearsOfService: {
|
|
161
|
+
enumerable: true,
|
|
162
|
+
configurable: true,
|
|
163
|
+
get() {
|
|
164
|
+
if (!this.dateOfHire) return null;
|
|
165
|
+
const today = new Date();
|
|
166
|
+
let years = today.getUTCFullYear() - this.dateOfHire.getUTCFullYear();
|
|
167
|
+
const m = today.getUTCMonth() - this.dateOfHire.getUTCMonth();
|
|
168
|
+
const d = today.getUTCDate() - this.dateOfHire.getUTCDate();
|
|
169
|
+
if (m < 0 || (m === 0 && d < 0)) years--;
|
|
170
|
+
return years;
|
|
171
|
+
},
|
|
172
|
+
set() {},
|
|
173
|
+
},
|
|
134
174
|
});
|
|
135
175
|
}
|
|
136
176
|
|
|
137
177
|
/**
|
|
138
178
|
* 外国籍の場合の必須フィールドを検証します。
|
|
139
|
-
* エラーがある場合は例外をスローします。
|
|
179
|
+
* - エラーがある場合は例外をスローします。
|
|
180
|
+
* - `isForeigner` が false の場合、以下のプロパティを初期化します。
|
|
181
|
+
* - `foreignName`
|
|
182
|
+
* - `nationality`
|
|
183
|
+
* - `residenceStatus`
|
|
184
|
+
* - `periodOfStay`
|
|
185
|
+
* @returns {void}
|
|
186
|
+
* @throws {Error} 外国籍の場合に必須フィールドが未入力の場合。
|
|
140
187
|
*/
|
|
141
188
|
_validateForeignerRequiredFields() {
|
|
142
189
|
if (this.isForeigner) {
|
|
@@ -160,20 +207,31 @@ export default class Employee extends FireModel {
|
|
|
160
207
|
"[Employee.js] periodOfStay is required when isForeigner is true."
|
|
161
208
|
);
|
|
162
209
|
}
|
|
210
|
+
} else {
|
|
211
|
+
// 外国籍でない場合、関連フィールドを初期化
|
|
212
|
+
this.foreignName = null;
|
|
213
|
+
this.nationality = null;
|
|
214
|
+
this.residenceStatus = null;
|
|
215
|
+
this.periodOfStay = null;
|
|
163
216
|
}
|
|
164
217
|
}
|
|
165
218
|
|
|
166
219
|
/**
|
|
167
220
|
* 退職済である場合の必須フィールドを検証します。
|
|
168
|
-
* エラーがある場合は例外をスローします。
|
|
221
|
+
* - エラーがある場合は例外をスローします。
|
|
222
|
+
* - `employmentStatus` が `active` の場合、`dateOfTermination` を初期化します。
|
|
223
|
+
* @returns {void}
|
|
224
|
+
* @throws {Error} 退職済の場合に必須フィールドが未入力の場合。
|
|
169
225
|
*/
|
|
170
226
|
_validateTerminatedRequiredFields() {
|
|
171
|
-
if (this.employmentStatus ===
|
|
227
|
+
if (this.employmentStatus === VALUES.TERMINATED.value) {
|
|
172
228
|
if (!this.dateOfTermination) {
|
|
173
229
|
throw new Error(
|
|
174
230
|
"[Employee.js] dateOfTermination is required when employmentStatus is 'terminated'."
|
|
175
231
|
);
|
|
176
232
|
}
|
|
233
|
+
} else {
|
|
234
|
+
this.dateOfTermination = null;
|
|
177
235
|
}
|
|
178
236
|
}
|
|
179
237
|
|
|
@@ -195,7 +253,30 @@ export default class Employee extends FireModel {
|
|
|
195
253
|
*/
|
|
196
254
|
async beforeUpdate() {
|
|
197
255
|
await super.beforeUpdate();
|
|
256
|
+
if (this.employmentStatus !== this._beforeData.employmentStatus) {
|
|
257
|
+
throw new Error(
|
|
258
|
+
"[Employee.js] employmentStatus cannot be changed via update. Use toTerminated() method to change status to terminated."
|
|
259
|
+
);
|
|
260
|
+
}
|
|
198
261
|
this._validateForeignerRequiredFields();
|
|
199
262
|
this._validateTerminatedRequiredFields();
|
|
200
263
|
}
|
|
264
|
+
|
|
265
|
+
async toTerminated(dateOfTermination) {
|
|
266
|
+
if (!this.docId) {
|
|
267
|
+
throw new Error(
|
|
268
|
+
"[Employee.js] docId is required to terminate an employee."
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
if (!dateOfTermination || !(dateOfTermination instanceof Date)) {
|
|
272
|
+
throw new Error(
|
|
273
|
+
"[Employee.js] A valid dateOfTermination is required to terminate an employee."
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
this.employmentStatus = Employee.STATUS_TERMINATED;
|
|
278
|
+
this.dateOfTermination = dateOfTermination;
|
|
279
|
+
|
|
280
|
+
await FireModel.prototype.update.call(this);
|
|
281
|
+
}
|
|
201
282
|
}
|
package/src/Operation.js
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
* Operation Model ver 1.0.0
|
|
3
3
|
* @author shisyamo4131
|
|
4
4
|
* ---------------------------------------------------------------------------
|
|
5
|
-
* - Base class of SiteOperationSchedule based on WorkingResult.
|
|
6
|
-
* - `dateAt` property indicates the date of operation (placement date)
|
|
7
|
-
* used for billing purposes.
|
|
5
|
+
* - Base class of SiteOperationSchedule and OperationResult based on WorkingResult.
|
|
6
|
+
* - `dateAt` property indicates the date of operation (placement date) used for billing purposes.
|
|
8
7
|
* Actual working day may differ from this date.
|
|
9
8
|
* - `siteId`, `dateAt`, `shiftType`, and `regulationWorkMinutes` are
|
|
10
9
|
* automatically synchronized to all assigned employees and outsourcers
|
|
@@ -12,27 +11,51 @@
|
|
|
12
11
|
* - `startTime`, `endTime`, and `breakMinutes` are NOT synchronized here.
|
|
13
12
|
* They should be synchronized at `SiteOperationSchedule` level instead.
|
|
14
13
|
* ---------------------------------------------------------------------------
|
|
15
|
-
* @prop {string} siteId
|
|
14
|
+
* @prop {string} siteId
|
|
15
|
+
* - Site document ID (trigger property)
|
|
16
16
|
* - Automatically synchronizes to all `employees` and `outsourcers` when changed.
|
|
17
|
-
*
|
|
18
|
-
* @prop {
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* @prop {
|
|
17
|
+
*
|
|
18
|
+
* @prop {number} requiredPersonnel
|
|
19
|
+
* - Required number of personnel
|
|
20
|
+
*
|
|
21
|
+
* @prop {boolean} qualificationRequired
|
|
22
|
+
* - Qualification required flag
|
|
23
|
+
*
|
|
24
|
+
* @prop {string} workDescription
|
|
25
|
+
* - Work description
|
|
26
|
+
*
|
|
27
|
+
* @prop {string} remarks
|
|
28
|
+
* - Remarks
|
|
29
|
+
*
|
|
30
|
+
* @prop {Array<OperationDetail>} employees
|
|
31
|
+
* - Assigned employees
|
|
22
32
|
* - Array of `OperationDetail` instances representing assigned employees
|
|
23
|
-
*
|
|
33
|
+
*
|
|
34
|
+
* @prop {Array<OperationDetail>} outsourcers
|
|
35
|
+
* - Assigned outsourcers
|
|
24
36
|
* - Array of `OperationDetail` instances representing assigned outsourcers
|
|
25
|
-
*
|
|
26
|
-
* @
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* @
|
|
30
|
-
*
|
|
37
|
+
*
|
|
38
|
+
* @prop {Array<string>} employeeIds - Array of employee IDs from `employees` (read-only)
|
|
39
|
+
* - Array of employee IDs from `employees` (read-only)
|
|
40
|
+
*
|
|
41
|
+
* @prop {Array<string>} outsourcerIds
|
|
42
|
+
* - Array of outsourcer IDs from `outsourcers` (read-only)
|
|
43
|
+
*
|
|
44
|
+
* @prop {number} employeesCount
|
|
45
|
+
* - Count of assigned employees (read-only)
|
|
46
|
+
*
|
|
47
|
+
* @prop {number} outsourcersCount
|
|
48
|
+
* - Count of assigned outsourcers (sum of amounts) (read-only)
|
|
49
|
+
*
|
|
50
|
+
* @prop {boolean} isPersonnelShortage
|
|
51
|
+
* - Indicates if there is a shortage of personnel (read-only)
|
|
31
52
|
* - `true` if the sum of `employeesCount` and `outsourcersCount` is less than `requiredPersonnel`
|
|
32
|
-
*
|
|
53
|
+
*
|
|
54
|
+
* @prop {Array<OperationDetail>} workers
|
|
55
|
+
* - Combined array of `employees` and `outsourcers`
|
|
33
56
|
* - Getter: Returns concatenated array of employees and outsourcers
|
|
34
57
|
* - Setter: Splits array into employees and outsourcers based on `isEmployee` property
|
|
35
|
-
*
|
|
58
|
+
*
|
|
36
59
|
* @getter {string} groupKey - Combines `siteId`, `shiftType`, and `date` to indicate operation grouping (read-only)
|
|
37
60
|
* @getter {boolean} isEmployeesChanged - Indicates whether the employees have changed (read-only)
|
|
38
61
|
* - Returns true if the employee IDs have changed compared to `_beforeData`
|
|
@@ -46,6 +69,8 @@
|
|
|
46
69
|
* - Workers whose `startTime`, `isStartNextDay`, `endTime`, `breakMinutes`, `isQualified`, or `isOjt` have changed
|
|
47
70
|
* ---------------------------------------------------------------------------
|
|
48
71
|
* @inherited - The following properties are inherited from WorkingResult:
|
|
72
|
+
* @prop {string} key - Unique key combining `siteId`, `date`, `dayType`, and `shiftType` (override/read-only)
|
|
73
|
+
* - A unique identifier for the working result, combining `siteId`, `date`, `dayType`, and `shiftType`.
|
|
49
74
|
* @prop {Date} dateAt - Date of operation (placement date) (trigger property)
|
|
50
75
|
* - Automatically synchronizes to all `employees` and `outsourcers` when changed.
|
|
51
76
|
* @prop {string} dayType - Day type (e.g., `WEEKDAY`, `WEEKEND`, `HOLIDAY`)
|
|
@@ -87,6 +112,8 @@
|
|
|
87
112
|
* - Extracted from `endTime`.
|
|
88
113
|
* @getter {number} endMinute - End minute (0-59) (read-only)
|
|
89
114
|
* - Extracted from `endTime`.
|
|
115
|
+
* @getter {boolean} isKeyChanged - Flag indicating whether the key has changed compared to previous data (read-only)
|
|
116
|
+
* - Compares the current `key` with the `key` in `_beforeData`.
|
|
90
117
|
* ---------------------------------------------------------------------------
|
|
91
118
|
* @method {function} addWorker - Adds a new worker (employee or outsourcer)
|
|
92
119
|
* - @param {Object} options - Options for adding a worker
|
|
@@ -234,6 +261,21 @@ export default class Operation extends WorkingResult {
|
|
|
234
261
|
afterInitialize(item = {}) {
|
|
235
262
|
super.afterInitialize(item);
|
|
236
263
|
|
|
264
|
+
/**
|
|
265
|
+
* Override `key` computed property
|
|
266
|
+
* - `key`: Combines `siteId`, `date`, `dayType`, and `shiftType`.
|
|
267
|
+
*/
|
|
268
|
+
Object.defineProperties(this, {
|
|
269
|
+
key: {
|
|
270
|
+
configurable: true,
|
|
271
|
+
enumberable: true,
|
|
272
|
+
get() {
|
|
273
|
+
return `${this.siteId}-${this.date}-${this.dayType}-${this.shiftType}`;
|
|
274
|
+
},
|
|
275
|
+
set() {},
|
|
276
|
+
},
|
|
277
|
+
});
|
|
278
|
+
|
|
237
279
|
/***********************************************************
|
|
238
280
|
* TRIGGERS FOR SYNCRONIZATION TO EMPLOYEES AND OUTSOURCERS
|
|
239
281
|
* ---------------------------------------------------------
|
|
@@ -581,8 +623,6 @@ export default class Operation extends WorkingResult {
|
|
|
581
623
|
enumerable: false,
|
|
582
624
|
},
|
|
583
625
|
});
|
|
584
|
-
/** Remove unnecessary properties */
|
|
585
|
-
delete this.key; // From workingResult.js
|
|
586
626
|
}
|
|
587
627
|
|
|
588
628
|
/***************************************************************************
|
package/src/OperationBilling.js
CHANGED
|
@@ -181,7 +181,6 @@
|
|
|
181
181
|
* @method delete - Override delete method to allow deletion even when isLocked is true
|
|
182
182
|
*****************************************************************************/
|
|
183
183
|
import OperationResult from "./OperationResult.js";
|
|
184
|
-
import Operation from "./Operation.js";
|
|
185
184
|
|
|
186
185
|
export default class OperationBilling extends OperationResult {
|
|
187
186
|
static className = "稼働請求";
|
|
@@ -192,28 +191,38 @@ export default class OperationBilling extends OperationResult {
|
|
|
192
191
|
{ title: "売上金額", key: "salesAmount", value: "salesAmount" },
|
|
193
192
|
];
|
|
194
193
|
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
/**
|
|
195
|
+
* Override beforeUpdate to skip `isLocked` check and sync customerId and apply agreement if key changed
|
|
196
|
+
* @returns {Promise<void>}
|
|
197
|
+
*/
|
|
198
|
+
async beforeUpdate() {
|
|
199
|
+
// Sync customerId and apply agreement if key changed
|
|
200
|
+
if (this.key === this._beforeData.key) return;
|
|
201
|
+
await this._syncCustomerIdAndApplyAgreement();
|
|
197
202
|
}
|
|
198
203
|
|
|
199
204
|
/**
|
|
200
|
-
* Override
|
|
201
|
-
* @
|
|
202
|
-
* @returns {Promise<void>}
|
|
205
|
+
* Override create method to disallow creation of OperationBilling instances
|
|
206
|
+
* @returns
|
|
203
207
|
*/
|
|
204
|
-
async
|
|
205
|
-
|
|
206
|
-
|
|
208
|
+
async create() {
|
|
209
|
+
return Promise.reject(
|
|
210
|
+
new Error(
|
|
211
|
+
"[OperationBilling.js] Creation of OperationBilling is not implemented."
|
|
212
|
+
)
|
|
213
|
+
);
|
|
207
214
|
}
|
|
208
215
|
|
|
209
216
|
/**
|
|
210
|
-
* Override delete method to
|
|
211
|
-
* @param {*} options
|
|
217
|
+
* Override delete method to disallow deletion of OperationBilling instances
|
|
212
218
|
* @returns {Promise<void>}
|
|
213
219
|
*/
|
|
214
|
-
async delete(
|
|
215
|
-
|
|
216
|
-
|
|
220
|
+
async delete() {
|
|
221
|
+
return Promise.reject(
|
|
222
|
+
new Error(
|
|
223
|
+
"[OperationBilling.js] Deletion of OperationBilling is not implemented."
|
|
224
|
+
)
|
|
225
|
+
);
|
|
217
226
|
}
|
|
218
227
|
|
|
219
228
|
/**
|
package/src/OperationResult.js
CHANGED
|
@@ -10,8 +10,12 @@
|
|
|
10
10
|
* - Automatically updates `billingDateAt` based on `dateAt` and `cutoffDate`.
|
|
11
11
|
* - Introduces a lock mechanism (`isLocked`) to prevent edits when necessary.
|
|
12
12
|
*
|
|
13
|
+
* @prop {string} key - Unique key combining `siteId`, `date`, `dayType`, and `shiftType` (override/read-only)
|
|
14
|
+
* - A unique identifier for the working result, combining `siteId`, `date`, `dayType`, and `shiftType`.
|
|
15
|
+
*
|
|
13
16
|
* @prop {string} siteId - Site document ID (trigger property)
|
|
14
17
|
* - Automatically synchronizes to all `employees` and `outsourcers` when changed.
|
|
18
|
+
*
|
|
15
19
|
* @prop {Date} dateAt - Date of operation (placement date) (trigger property)
|
|
16
20
|
* - Automatically synchronizes to all `employees` and `outsourcers` when changed.
|
|
17
21
|
* - Used to determine `dayType`.
|
|
@@ -128,6 +132,8 @@
|
|
|
128
132
|
* - Extracted from `endTime`.
|
|
129
133
|
* @getter {number} endMinute - End minute (0-59) (read-only)
|
|
130
134
|
* - Extracted from `endTime`.
|
|
135
|
+
* @getter {boolean} isKeyChanged - Flag indicating whether the key has changed compared to previous data (read-only)
|
|
136
|
+
* - Compares the current `key` with the `key` in `_beforeData`.
|
|
131
137
|
*
|
|
132
138
|
* @method refreshBillingDateAt - Refresh billingDateAt based on dateAt and cutoffDate
|
|
133
139
|
* - Updates `billingDateAt` based on the current `dateAt` and `cutoffDate` values.
|
|
@@ -535,11 +541,11 @@ export default class OperationResult extends Operation {
|
|
|
535
541
|
}
|
|
536
542
|
|
|
537
543
|
/**
|
|
538
|
-
* Synchronize customerId from siteId
|
|
544
|
+
* Synchronize customerId and apply (re-apply) agreement from siteId
|
|
539
545
|
* @returns {Promise<void>}
|
|
540
546
|
* @throws {Error} If the specified siteId does not exist
|
|
541
547
|
*/
|
|
542
|
-
async
|
|
548
|
+
async _syncCustomerIdAndApplyAgreement() {
|
|
543
549
|
if (!this.siteId) return;
|
|
544
550
|
const siteInstance = new Site();
|
|
545
551
|
const siteExists = await siteInstance.fetch({ docId: this.siteId });
|
|
@@ -549,6 +555,7 @@ export default class OperationResult extends Operation {
|
|
|
549
555
|
);
|
|
550
556
|
}
|
|
551
557
|
this.customerId = siteInstance.customerId;
|
|
558
|
+
this.agreement = siteInstance.getAgreement(this);
|
|
552
559
|
}
|
|
553
560
|
|
|
554
561
|
/**
|
|
@@ -558,12 +565,12 @@ export default class OperationResult extends Operation {
|
|
|
558
565
|
async beforeCreate() {
|
|
559
566
|
await super.beforeCreate();
|
|
560
567
|
|
|
561
|
-
// Sync customerId
|
|
562
|
-
await this.
|
|
568
|
+
// Sync customerId and apply agreement
|
|
569
|
+
await this._syncCustomerIdAndApplyAgreement();
|
|
563
570
|
}
|
|
564
571
|
|
|
565
572
|
/**
|
|
566
|
-
* Override beforeUpdate to sync customerId if
|
|
573
|
+
* Override beforeUpdate to sync customerId and apply agreement if key changed
|
|
567
574
|
* @returns {Promise<void>}
|
|
568
575
|
*/
|
|
569
576
|
async beforeUpdate() {
|
|
@@ -576,9 +583,9 @@ export default class OperationResult extends Operation {
|
|
|
576
583
|
);
|
|
577
584
|
}
|
|
578
585
|
|
|
579
|
-
// Sync customerId if
|
|
580
|
-
if (this.
|
|
581
|
-
await this.
|
|
586
|
+
// Sync customerId and apply agreement if key changed
|
|
587
|
+
if (this.key === this._beforeData.key) return;
|
|
588
|
+
await this._syncCustomerIdAndApplyAgreement();
|
|
582
589
|
}
|
|
583
590
|
|
|
584
591
|
/**
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/*****************************************************************************
|
|
2
2
|
* SiteOperationSchedule Model ver 1.1.0
|
|
3
|
-
* @version 1.1.
|
|
3
|
+
* @version 1.1.1
|
|
4
4
|
* @author shisyamo4131
|
|
5
5
|
*
|
|
6
|
+
* @update 2025-11-28 v1.1.1 - Removed the `agreement` parameter from `syncToOperationResult` method.
|
|
6
7
|
* @update 2025-11-22 v1.1.0 - Moved `duplicate`, `notify`, `syncToOperationResult`,
|
|
7
8
|
* and `toEvent` methods from client side code.
|
|
8
9
|
*
|
|
@@ -17,6 +18,9 @@
|
|
|
17
18
|
* `siteId`, `dateAt`, `shiftType`, and `regulationWorkMinutes` are synchronized
|
|
18
19
|
* in the parent `Operation` class.
|
|
19
20
|
*
|
|
21
|
+
* @prop {string} key - Unique key combining `siteId`, `date`, `dayType`, and `shiftType` (override/read-only)
|
|
22
|
+
* - A unique identifier for the working result, combining `siteId`, `date`, `dayType`, and `shiftType`.
|
|
23
|
+
*
|
|
20
24
|
* @prop {string|null} operationResultId - Associated OperationResult document ID
|
|
21
25
|
* - If an OperationResult has been created based on this schedule, this property
|
|
22
26
|
* holds the ID of that OperationResult document.
|
|
@@ -149,6 +153,9 @@
|
|
|
149
153
|
* @getter {number} endMinute - End minute (0-59) (read-only)
|
|
150
154
|
* - Extracted from `endTime`.
|
|
151
155
|
*
|
|
156
|
+
* @getter {boolean} isKeyChanged - Flag indicating whether the key has changed compared to previous data (read-only)
|
|
157
|
+
* - Compares the current `key` with the `key` in `_beforeData`.
|
|
158
|
+
*
|
|
152
159
|
* @method duplicate - Duplicates the SiteOperationSchedule for specified dates
|
|
153
160
|
* - Creates new SiteOperationSchedule documents for each specified date,
|
|
154
161
|
* excluding the original date and avoiding duplicates.
|
|
@@ -161,7 +168,8 @@
|
|
|
161
168
|
* @method syncToOperationResult - Creates an OperationResult document based on the current SiteOperationSchedule
|
|
162
169
|
* - The OperationResult document ID will be the same as the SiteOperationSchedule document ID.
|
|
163
170
|
* - Sets the `operationResultId` property of the SiteOperationSchedule to the created OperationResult document ID.
|
|
164
|
-
* -
|
|
171
|
+
* - If an OperationResult already exists, it will be overwritten.
|
|
172
|
+
* - [UPDATE 2025-11-28] Removed the `agreement` parameter. The agreement is now fetched internally.
|
|
165
173
|
*
|
|
166
174
|
* @method toEvent - Converts the SiteOperationSchedule instance to a VCalendar event object
|
|
167
175
|
* - Returns an object with properties required for displaying events in Vuetify's VCalendar component.
|
|
@@ -673,9 +681,14 @@ export default class SiteOperationSchedule extends Operation {
|
|
|
673
681
|
* 既に存在する場合は上書きされます。
|
|
674
682
|
* - 現場稼働予定ドキュメントの `operationResultId` プロパティに
|
|
675
683
|
* 作成された稼働実績ドキュメントの ID が設定されます。(当該ドキュメント ID と同一)
|
|
676
|
-
* @param {Object}
|
|
684
|
+
* @param {Object} notifications - 配置通知オブジェクトのマップ。
|
|
685
|
+
* - キー: 配置通知の一意キー(`notificationKey` プロパティ)
|
|
686
|
+
* - 値: 配置通知ドキュメントオブジェクト
|
|
687
|
+
* @returns {Promise<void>}
|
|
688
|
+
*
|
|
689
|
+
* @update 2025-11-28 - Removed the `agreement` parameter.
|
|
677
690
|
*/
|
|
678
|
-
async syncToOperationResult(
|
|
691
|
+
async syncToOperationResult(notifications = {}) {
|
|
679
692
|
if (!this.docId) {
|
|
680
693
|
throw new Error(
|
|
681
694
|
"不正な処理です。作成前の現場稼働予定から稼働実績を作成することはできません。"
|
|
@@ -689,18 +702,12 @@ export default class SiteOperationSchedule extends Operation {
|
|
|
689
702
|
return this[prop].map((w) => {
|
|
690
703
|
const notification = notifications[w.notificationKey];
|
|
691
704
|
if (!notification) return w;
|
|
692
|
-
const {
|
|
693
|
-
actualStartTime: startTime,
|
|
694
|
-
actualEndTime: endTime,
|
|
695
|
-
actualBreakMinutes: breakMinutes,
|
|
696
|
-
actualIsStartNextDay: isStartNextDay,
|
|
697
|
-
} = notification;
|
|
698
705
|
return new SiteOperationScheduleDetail({
|
|
699
706
|
...w.toObject(),
|
|
700
|
-
startTime,
|
|
701
|
-
endTime,
|
|
702
|
-
breakMinutes,
|
|
703
|
-
isStartNextDay,
|
|
707
|
+
startTime: notification.actualStartTime,
|
|
708
|
+
endTime: notification.actualEndTime,
|
|
709
|
+
breakMinutes: notification.actualBreakMinutes,
|
|
710
|
+
isStartNextDay: notification.actualIsStartNextDay,
|
|
704
711
|
});
|
|
705
712
|
});
|
|
706
713
|
};
|
|
@@ -712,10 +719,8 @@ export default class SiteOperationSchedule extends Operation {
|
|
|
712
719
|
...this.toObject(),
|
|
713
720
|
employees,
|
|
714
721
|
outsourcers,
|
|
715
|
-
agreement: agreement || null,
|
|
716
722
|
siteOperationScheduleId: this.docId,
|
|
717
723
|
});
|
|
718
|
-
operationResult.refreshBillingDateAt();
|
|
719
724
|
await this.constructor.runTransaction(async (transaction) => {
|
|
720
725
|
const docRef = await operationResult.create({
|
|
721
726
|
docId: this.docId,
|
package/src/System.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System.js
|
|
3
|
+
* @version 1.0.0
|
|
4
|
+
* @description System model
|
|
5
|
+
* @author shisyamo4131
|
|
6
|
+
*/
|
|
7
|
+
import FireModel from "@shisyamo4131/air-firebase-v2";
|
|
8
|
+
import { defField } from "./parts/fieldDefinitions.js";
|
|
9
|
+
|
|
10
|
+
const classProps = {
|
|
11
|
+
isMaintenance: defField("check", { default: false, hidden: true }),
|
|
12
|
+
updatedAt: defField("dateAt", { default: null, hidden: true }),
|
|
13
|
+
lastMaintenanceBy: defField("oneLine", {
|
|
14
|
+
default: "admin-sdk",
|
|
15
|
+
hidden: true,
|
|
16
|
+
}),
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @prop {boolean} isMaintenance - maintenance mode flag
|
|
21
|
+
* @prop {Date} updatedAt - last updated timestamp
|
|
22
|
+
* @prop {string} lastMaintenanceBy - identifier of the last maintainer
|
|
23
|
+
*/
|
|
24
|
+
export default class System extends FireModel {
|
|
25
|
+
static className = "System";
|
|
26
|
+
static collectionPath = "System";
|
|
27
|
+
static usePrefix = false;
|
|
28
|
+
static useAutonumber = false;
|
|
29
|
+
static logicalDelete = false;
|
|
30
|
+
static classProps = classProps;
|
|
31
|
+
|
|
32
|
+
async create() {
|
|
33
|
+
return Promise.reject(new Error("[System.js] Not implemented."));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async update() {
|
|
37
|
+
return Promise.reject(new Error("[System.js] Not implemented."));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async delete() {
|
|
41
|
+
return Promise.reject(new Error("[System.js] Not implemented."));
|
|
42
|
+
}
|
|
43
|
+
}
|
package/src/WorkingResult.js
CHANGED
|
@@ -7,40 +7,41 @@
|
|
|
7
7
|
* - `dateAt` is defined as a trigger property. When it is set, `dayType` is automatically updated.
|
|
8
8
|
* - Subclasses can override `setDateAtCallback` to add custom behavior when `dateAt` changes.
|
|
9
9
|
* ---------------------------------------------------------------------------
|
|
10
|
-
* @
|
|
11
|
-
* @
|
|
12
|
-
* @
|
|
13
|
-
* @
|
|
14
|
-
* @
|
|
10
|
+
* @prop {Date} dateAt - Applicable start date (trigger property)
|
|
11
|
+
* @prop {string} dayType - Day type (e.g., `WEEKDAY`, `WEEKEND`, `HOLIDAY`)
|
|
12
|
+
* @prop {string} shiftType - Shift type (`DAY`, `NIGHT`)
|
|
13
|
+
* @prop {string} startTime - Start time (HH:MM format)
|
|
14
|
+
* @prop {boolean} isStartNextDay - Next day start flag
|
|
15
15
|
* - `true` if the actual work starts the day after the placement date `dateAt`
|
|
16
|
-
* @
|
|
17
|
-
* @
|
|
18
|
-
* @
|
|
16
|
+
* @prop {string} endTime - End time (HH:MM format)
|
|
17
|
+
* @prop {number} breakMinutes - Break time (minutes)
|
|
18
|
+
* @prop {number} regulationWorkMinutes - Regulation work minutes
|
|
19
19
|
* - The maximum working time defined by `unitPriceBase` (or `unitPriceQualified`).
|
|
20
20
|
* - Exceeding this time is considered overtime.
|
|
21
|
-
*
|
|
22
|
-
* @computed
|
|
21
|
+
*
|
|
22
|
+
* @computed
|
|
23
|
+
* @prop {string} key - Unique key combining `date`, `dayType`, and `shiftType` (read-only)
|
|
23
24
|
* - A unique identifier for the working result, combining `date`, `dayType`, and `shiftType`.
|
|
24
|
-
* @
|
|
25
|
+
* @prop {string} date - Date string in YYYY-MM-DD format based on `dateAt` (read-only)
|
|
25
26
|
* - Returns a string in the format YYYY-MM-DD based on `dateAt`.
|
|
26
|
-
* @
|
|
27
|
+
* @prop {boolean} isSpansNextDay - Flag indicating whether the date spans from start date to end date (read-only)
|
|
27
28
|
* - `true` if `startTime` is later than `endTime`
|
|
28
|
-
* @
|
|
29
|
+
* @prop {Date} startAt - Start date and time (Date object) (read-only)
|
|
29
30
|
* - Returns a Date object with `startTime` set based on `dateAt`.
|
|
30
31
|
* - If `isStartNextDay` is true, add 1 day.
|
|
31
|
-
* @
|
|
32
|
+
* @prop {Date} endAt - End date and time (Date object) (read-only)
|
|
32
33
|
* - Returns a Date object with `endTime` set based on `dateAt`.
|
|
33
34
|
* - If `isStartNextDay` is true, add 1 day.
|
|
34
35
|
* - If `isSpansNextDay` is true, add 1 day.
|
|
35
|
-
* @
|
|
36
|
+
* @prop {number} totalWorkMinutes - Total working time in minutes (excluding break time) (read-only)
|
|
36
37
|
* - Calculated as the difference between `endAt` and `startAt` minus `breakMinutes`
|
|
37
38
|
* - If the difference between `endAt` and `startAt` is negative, returns 0.
|
|
38
39
|
* - If `startAt` or `endAt` is not set, returns 0.
|
|
39
|
-
* @
|
|
40
|
+
* @prop {number} regularTimeWorkMinutes - Regular working time in minutes (read-only)
|
|
40
41
|
* - The portion of `totalWorkMinutes` that is considered within the contract's `regulationWorkMinutes`.
|
|
41
42
|
* - If actual working time is less than regulation time (e.g., early leave), it equals `totalWorkMinutes`.
|
|
42
43
|
* - If actual working time exceeds regulation time (overtime), it equals `regulationWorkMinutes`.
|
|
43
|
-
* @
|
|
44
|
+
* @prop {number} overtimeWorkMinutes - Overtime work in minutes (read-only)
|
|
44
45
|
* - Calculated as `totalWorkMinutes` minus `regulationWorkMinutes`
|
|
45
46
|
* - Overtime work is not negative; the minimum is 0.
|
|
46
47
|
* ---------------------------------------------------------------------------
|
|
@@ -52,6 +53,8 @@
|
|
|
52
53
|
* - Extracted from `endTime`.
|
|
53
54
|
* @getter {number} endMinute - End minute (0-59) (read-only)
|
|
54
55
|
* - Extracted from `endTime`.
|
|
56
|
+
* @getter {boolean} isKeyChanged - Flag indicating whether the key has changed compared to previous data (read-only)
|
|
57
|
+
* - Compares the current `key` with the `key` in `_beforeData`.
|
|
55
58
|
* ---------------------------------------------------------------------------
|
|
56
59
|
* @method {function} setDateAtCallback - Callback method called when `dateAt` is set
|
|
57
60
|
* - Override this method in subclasses to add custom behavior when `dateAt` changes.
|
|
@@ -301,4 +304,15 @@ export default class WorkingResult extends FireModel {
|
|
|
301
304
|
get endMinute() {
|
|
302
305
|
return this.endTime ? Number(this.endTime.split(":")[1]) : 0;
|
|
303
306
|
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Returns whether the key has changed compared to the previous data.
|
|
310
|
+
* - Compares the current `key` with the `key` in `_beforeData`.
|
|
311
|
+
* - Returns `true` if they are different, otherwise `false`.
|
|
312
|
+
*/
|
|
313
|
+
get isKeyChanged() {
|
|
314
|
+
const current = this.key;
|
|
315
|
+
const before = this._beforeData?.key;
|
|
316
|
+
return current !== before;
|
|
317
|
+
}
|
|
304
318
|
}
|
|
@@ -11,16 +11,12 @@ import { OPTIONS } from "../constants/prefectures.js";
|
|
|
11
11
|
*/
|
|
12
12
|
const accessorImplementations = {
|
|
13
13
|
customerId: {
|
|
14
|
-
enumerable: true,
|
|
15
14
|
get() {
|
|
16
15
|
return this?.customer?.docId;
|
|
17
16
|
},
|
|
18
|
-
set(
|
|
19
|
-
// No-op setter for read-only access
|
|
20
|
-
},
|
|
17
|
+
set() {},
|
|
21
18
|
},
|
|
22
19
|
fullAddress: {
|
|
23
|
-
enumerable: true,
|
|
24
20
|
get() {
|
|
25
21
|
// 同じオブジェクトに 'prefecture' アクセサが定義されていることを前提とします
|
|
26
22
|
const prefecture = this.prefecture || "";
|
|
@@ -28,53 +24,41 @@ const accessorImplementations = {
|
|
|
28
24
|
const address = this.address || "";
|
|
29
25
|
return `${prefecture}${city}${address}`;
|
|
30
26
|
},
|
|
31
|
-
set(
|
|
32
|
-
// No-op setter for read-only access
|
|
33
|
-
},
|
|
27
|
+
set() {},
|
|
34
28
|
},
|
|
35
29
|
fullName: {
|
|
36
|
-
enumerable: true,
|
|
37
30
|
get() {
|
|
38
31
|
if (!this.lastName || !this.firstName) return "";
|
|
39
32
|
return `${this.lastName} ${this.firstName}`;
|
|
40
33
|
},
|
|
41
|
-
set(
|
|
42
|
-
|
|
34
|
+
set() {},
|
|
35
|
+
},
|
|
36
|
+
fullNameKana: {
|
|
37
|
+
get() {
|
|
38
|
+
if (!this.lastNameKana || !this.firstNameKana) return "";
|
|
39
|
+
return `${this.lastNameKana} ${this.firstNameKana}`;
|
|
43
40
|
},
|
|
41
|
+
set() {},
|
|
44
42
|
},
|
|
45
43
|
prefecture: {
|
|
46
|
-
enumerable: true,
|
|
47
44
|
get() {
|
|
48
|
-
// if (!this.hasOwnProperty("prefCode")) {
|
|
49
|
-
// console.warn(
|
|
50
|
-
// "[アクセサ: prefecture] このオブジェクトに prefCode が定義されていません。"
|
|
51
|
-
// );
|
|
52
|
-
// return "";
|
|
53
|
-
// }
|
|
54
|
-
|
|
55
45
|
if (!this.prefCode) return ""; // No warning if prefCode is falsy but present
|
|
56
|
-
|
|
57
46
|
const result = OPTIONS.find(({ value }) => value === this.prefCode);
|
|
58
|
-
|
|
59
47
|
if (!result) {
|
|
60
48
|
console.warn(
|
|
61
49
|
`[アクセサ: prefecture] prefCode '${this.prefCode}' は OPTIONS に見つかりません。`
|
|
62
50
|
);
|
|
63
51
|
return "";
|
|
64
52
|
}
|
|
65
|
-
|
|
66
53
|
if (!result.hasOwnProperty("title")) {
|
|
67
54
|
console.warn(
|
|
68
55
|
`[アクセサ: prefecture] OPTIONS の prefCode '${this.prefCode}' に title が定義されていません。`
|
|
69
56
|
);
|
|
70
57
|
return "";
|
|
71
58
|
}
|
|
72
|
-
|
|
73
59
|
return result.title;
|
|
74
60
|
},
|
|
75
|
-
set(
|
|
76
|
-
// No-op setter for read-only access
|
|
77
|
-
},
|
|
61
|
+
set() {},
|
|
78
62
|
},
|
|
79
63
|
};
|
|
80
64
|
|
|
@@ -90,7 +74,7 @@ const accessorImplementations = {
|
|
|
90
74
|
*/
|
|
91
75
|
export const defAccessor = (
|
|
92
76
|
key,
|
|
93
|
-
{ configurable =
|
|
77
|
+
{ configurable = true, enumerable = true } = {}
|
|
94
78
|
) => {
|
|
95
79
|
const implementation = accessorImplementations[key];
|
|
96
80
|
if (!implementation) {
|
|
@@ -147,11 +147,30 @@ export const fieldDefinitions = {
|
|
|
147
147
|
code: generalDefinitions.code,
|
|
148
148
|
/** dateAt */
|
|
149
149
|
dateAt: generalDefinitions.dateAt,
|
|
150
|
+
dateOfBirth: {
|
|
151
|
+
...generalDefinitions.dateAt,
|
|
152
|
+
label: "生年月日",
|
|
153
|
+
},
|
|
154
|
+
dateOfHire: {
|
|
155
|
+
...generalDefinitions.dateAt,
|
|
156
|
+
label: "入社日",
|
|
157
|
+
},
|
|
158
|
+
dateOfTermination: {
|
|
159
|
+
...generalDefinitions.dateAt,
|
|
160
|
+
label: "退職日",
|
|
161
|
+
},
|
|
162
|
+
periodOfStay: {
|
|
163
|
+
...generalDefinitions.dateAt,
|
|
164
|
+
label: "在留期間満了日",
|
|
165
|
+
},
|
|
150
166
|
/** dateTimeAt */
|
|
151
167
|
dateTimeAt: generalDefinitions.dateTimeAt,
|
|
152
168
|
/** multiple-line */
|
|
153
169
|
multipleLine: generalDefinitions.multipleLine,
|
|
154
|
-
|
|
170
|
+
remarks: {
|
|
171
|
+
...generalDefinitions.multipleLine,
|
|
172
|
+
label: "備考",
|
|
173
|
+
},
|
|
155
174
|
/** number */
|
|
156
175
|
number: generalDefinitions.number,
|
|
157
176
|
breakMinutes: {
|
|
@@ -276,6 +295,13 @@ export const fieldDefinitions = {
|
|
|
276
295
|
...generalDefinitions.oneLine,
|
|
277
296
|
label: "本名",
|
|
278
297
|
length: 50,
|
|
298
|
+
component: {
|
|
299
|
+
name: generalDefinitions.oneLine.component.name,
|
|
300
|
+
attrs: {
|
|
301
|
+
hint: "パスポート等の表記をご入力ください。",
|
|
302
|
+
persistentHint: true,
|
|
303
|
+
},
|
|
304
|
+
},
|
|
279
305
|
},
|
|
280
306
|
lastName: {
|
|
281
307
|
...generalDefinitions.oneLine,
|
|
@@ -293,6 +319,18 @@ export const fieldDefinitions = {
|
|
|
293
319
|
},
|
|
294
320
|
},
|
|
295
321
|
},
|
|
322
|
+
mobile: {
|
|
323
|
+
...generalDefinitions.oneLine,
|
|
324
|
+
label: "携帯電話",
|
|
325
|
+
length: 13,
|
|
326
|
+
component: {
|
|
327
|
+
name: generalDefinitions.oneLine.component.name,
|
|
328
|
+
attrs: {
|
|
329
|
+
counter: true,
|
|
330
|
+
inputType: "tel",
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
},
|
|
296
334
|
name: {
|
|
297
335
|
...generalDefinitions.oneLine,
|
|
298
336
|
label: "名前",
|
|
@@ -314,6 +352,11 @@ export const fieldDefinitions = {
|
|
|
314
352
|
label: "国籍",
|
|
315
353
|
length: 50,
|
|
316
354
|
},
|
|
355
|
+
residenceStatus: {
|
|
356
|
+
...generalDefinitions.oneLine,
|
|
357
|
+
label: "在留資格",
|
|
358
|
+
length: 10,
|
|
359
|
+
},
|
|
317
360
|
siteId: {
|
|
318
361
|
...generalDefinitions.oneLine,
|
|
319
362
|
label: "現場",
|
|
@@ -338,6 +381,11 @@ export const fieldDefinitions = {
|
|
|
338
381
|
},
|
|
339
382
|
},
|
|
340
383
|
},
|
|
384
|
+
title: {
|
|
385
|
+
...generalDefinitions.oneLine,
|
|
386
|
+
label: "肩書",
|
|
387
|
+
length: 20,
|
|
388
|
+
},
|
|
341
389
|
workDescription: {
|
|
342
390
|
...generalDefinitions.oneLine,
|
|
343
391
|
label: "作業内容",
|