@shisyamo4131/air-guard-v2-schemas 2.3.7-dev.22 → 2.3.7-dev.24
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
package/src/Employee.js
CHANGED
|
@@ -37,6 +37,16 @@ const classProps = {
|
|
|
37
37
|
},
|
|
38
38
|
},
|
|
39
39
|
}),
|
|
40
|
+
reasonOfTermination: defField("reasonOfTermination", {
|
|
41
|
+
component: {
|
|
42
|
+
attrs: {
|
|
43
|
+
required: (item) => item.employmentStatus === VALUES.TERMINATED.value,
|
|
44
|
+
disabled: (item) => item.employmentStatus !== VALUES.TERMINATED.value,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
}),
|
|
48
|
+
|
|
49
|
+
// Foreign related fields
|
|
40
50
|
isForeigner: defField("isForeigner"),
|
|
41
51
|
foreignName: defField("foreignName", {
|
|
42
52
|
component: {
|
|
@@ -70,6 +80,80 @@ const classProps = {
|
|
|
70
80
|
},
|
|
71
81
|
},
|
|
72
82
|
}),
|
|
83
|
+
|
|
84
|
+
// Security guard related fields
|
|
85
|
+
hasSecurityGuardRegistration: defField("check", { label: "警備員登録" }),
|
|
86
|
+
priorSecurityExperienceYears: defField("number", {
|
|
87
|
+
label: "年",
|
|
88
|
+
default: 0,
|
|
89
|
+
component: {
|
|
90
|
+
attrs: {
|
|
91
|
+
required: (item) => item.hasSecurityGuardRegistration,
|
|
92
|
+
disabled: (item) => !item.hasSecurityGuardRegistration,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
}),
|
|
96
|
+
priorSecurityExperienceMonths: defField("number", {
|
|
97
|
+
label: "月",
|
|
98
|
+
default: 0,
|
|
99
|
+
component: {
|
|
100
|
+
attrs: {
|
|
101
|
+
required: (item) => item.hasSecurityGuardRegistration,
|
|
102
|
+
disabled: (item) => !item.hasSecurityGuardRegistration,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
}),
|
|
106
|
+
dateOfSecurityGuardRegistration: defField("dateAt", {
|
|
107
|
+
label: "警備員登録日",
|
|
108
|
+
component: {
|
|
109
|
+
attrs: {
|
|
110
|
+
required: (item) => item.hasSecurityGuardRegistration,
|
|
111
|
+
disabled: (item) => !item.hasSecurityGuardRegistration,
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
}),
|
|
115
|
+
bloodType: defField("bloodType"),
|
|
116
|
+
emergencyContactName: defField("emergencyContactName", {
|
|
117
|
+
component: {
|
|
118
|
+
attrs: {
|
|
119
|
+
required: (item) => item.hasSecurityGuardRegistration,
|
|
120
|
+
disabled: (item) => !item.hasSecurityGuardRegistration,
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
}),
|
|
124
|
+
emergencyContactRelation: defField("emergencyContactRelation", {
|
|
125
|
+
component: {
|
|
126
|
+
attrs: {
|
|
127
|
+
required: (item) => item.hasSecurityGuardRegistration,
|
|
128
|
+
disabled: (item) => !item.hasSecurityGuardRegistration,
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
}),
|
|
132
|
+
emergencyContactRelationDetail: defField("emergencyContactRelationDetail", {
|
|
133
|
+
component: {
|
|
134
|
+
attrs: {
|
|
135
|
+
required: (item) => item.hasSecurityGuardRegistration,
|
|
136
|
+
disabled: (item) => !item.hasSecurityGuardRegistration,
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
}),
|
|
140
|
+
emergencyContactAddress: defField("emergencyContactAddress", {
|
|
141
|
+
component: {
|
|
142
|
+
attrs: {
|
|
143
|
+
required: (item) => item.hasSecurityGuardRegistration,
|
|
144
|
+
disabled: (item) => !item.hasSecurityGuardRegistration,
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
}),
|
|
148
|
+
emergencyContactPhone: defField("emergencyContactPhone", {
|
|
149
|
+
component: {
|
|
150
|
+
attrs: {
|
|
151
|
+
required: (item) => item.hasSecurityGuardRegistration,
|
|
152
|
+
disabled: (item) => !item.hasSecurityGuardRegistration,
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
}),
|
|
156
|
+
|
|
73
157
|
remarks: defField("remarks"),
|
|
74
158
|
};
|
|
75
159
|
|
|
@@ -94,6 +178,7 @@ const classProps = {
|
|
|
94
178
|
* @prop {string} employmentStatus - Employment status.
|
|
95
179
|
* @prop {string} title - Job title.
|
|
96
180
|
* @prop {Date} dateOfTermination - Date of termination.
|
|
181
|
+
* @prop {string} reasonOfTermination - Reason for termination.
|
|
97
182
|
* @prop {boolean} isForeigner - Is the employee a foreigner.
|
|
98
183
|
* @prop {string} foreignName - Foreign name.
|
|
99
184
|
* @prop {string} nationality - Nationality.
|
|
@@ -245,7 +330,10 @@ export default class Employee extends FireModel {
|
|
|
245
330
|
/**
|
|
246
331
|
* 退職済である場合の必須フィールドを検証します。
|
|
247
332
|
* - エラーがある場合は例外をスローします。
|
|
248
|
-
* - `employmentStatus` が `
|
|
333
|
+
* - `employmentStatus` が `terminated` の場合、以下のプロパティを必須とします。
|
|
334
|
+
* - `dateOfTermination`
|
|
335
|
+
* - `reasonOfTermination`
|
|
336
|
+
* - `employmentStatus` が `active` の場合、`dateOfTermination`, `reasonOfTermination` を初期化します。
|
|
249
337
|
* @returns {void}
|
|
250
338
|
* @throws {Error} 退職済の場合に必須フィールドが未入力の場合。
|
|
251
339
|
*/
|
|
@@ -256,8 +344,14 @@ export default class Employee extends FireModel {
|
|
|
256
344
|
"[Employee.js] dateOfTermination is required when employmentStatus is 'terminated'."
|
|
257
345
|
);
|
|
258
346
|
}
|
|
347
|
+
if (!this.reasonOfTermination) {
|
|
348
|
+
throw new Error(
|
|
349
|
+
"[Employee.js] reasonOfTermination is required when employmentStatus is 'terminated'."
|
|
350
|
+
);
|
|
351
|
+
}
|
|
259
352
|
} else {
|
|
260
353
|
this.dateOfTermination = null;
|
|
354
|
+
this.reasonOfTermination = null;
|
|
261
355
|
}
|
|
262
356
|
}
|
|
263
357
|
|
|
@@ -301,6 +395,7 @@ export default class Employee extends FireModel {
|
|
|
301
395
|
/**
|
|
302
396
|
* 現在インスタンスに読み込まれている従業員を退職状態に変更します。
|
|
303
397
|
* @param {Date} dateOfTermination - 退職日(Dateオブジェクト)
|
|
398
|
+
* @param {string} reasonOfTermination - 退職理由
|
|
304
399
|
* @param {Object} options - パラメータオブジェクト
|
|
305
400
|
* @param {Function|null} [options.transaction=null] - Firestore トランザクション関数
|
|
306
401
|
* @param {Function|null} [options.callBack=null] - カスタム処理用コールバック
|
|
@@ -308,7 +403,7 @@ export default class Employee extends FireModel {
|
|
|
308
403
|
* @returns {Promise<DocumentReference>} 更新されたドキュメントの参照
|
|
309
404
|
* @throws {Error} docIdが存在しない場合、または有効なdateOfTerminationが提供されていない場合。
|
|
310
405
|
*/
|
|
311
|
-
async toTerminated(dateOfTermination, options = {}) {
|
|
406
|
+
async toTerminated(dateOfTermination, reasonOfTermination, options = {}) {
|
|
312
407
|
if (!this.docId) {
|
|
313
408
|
throw new Error(
|
|
314
409
|
"[Employee.js] docId is required to terminate an employee."
|
|
@@ -319,14 +414,29 @@ export default class Employee extends FireModel {
|
|
|
319
414
|
"[Employee.js] A valid dateOfTermination is required to terminate an employee."
|
|
320
415
|
);
|
|
321
416
|
}
|
|
417
|
+
if (dateOfTermination < this.dateOfHire) {
|
|
418
|
+
throw new Error(
|
|
419
|
+
"[Employee.js] dateOfTermination cannot be earlier than dateOfHire."
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
if (!reasonOfTermination || typeof reasonOfTermination !== "string") {
|
|
424
|
+
throw new Error(
|
|
425
|
+
"[Employee.js] A valid reasonOfTermination is required to terminate an employee."
|
|
426
|
+
);
|
|
427
|
+
}
|
|
322
428
|
|
|
323
429
|
this.employmentStatus = Employee.STATUS_TERMINATED;
|
|
324
430
|
this.dateOfTermination = dateOfTermination;
|
|
431
|
+
this.reasonOfTermination = reasonOfTermination;
|
|
325
432
|
|
|
326
433
|
this._skipToTerminatedCheck = true;
|
|
327
434
|
|
|
328
435
|
try {
|
|
329
436
|
return await this.update(options);
|
|
437
|
+
} catch (error) {
|
|
438
|
+
this.rollback();
|
|
439
|
+
throw error;
|
|
330
440
|
} finally {
|
|
331
441
|
this._skipToTerminatedCheck = false;
|
|
332
442
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// prettier-ignore
|
|
2
|
+
export const VALUES = Object.freeze({
|
|
3
|
+
A: { title: "A型", value: "A" },
|
|
4
|
+
B: { title: "B型", value: "B" },
|
|
5
|
+
O: { title: "O型", value: "O" },
|
|
6
|
+
AB: { title: "AB型", value: "AB" },
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const OPTIONS = [
|
|
10
|
+
{ title: VALUES.A.title, value: VALUES.A.value },
|
|
11
|
+
{ title: VALUES.B.title, value: VALUES.B.value },
|
|
12
|
+
{ title: VALUES.O.title, value: VALUES.O.value },
|
|
13
|
+
{ title: VALUES.AB.title, value: VALUES.AB.value },
|
|
14
|
+
];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// prettier-ignore
|
|
2
|
+
export const VALUES = Object.freeze({
|
|
3
|
+
PARENT: { title: "親", value: "PARENT" },
|
|
4
|
+
SPOUSE: { title: "配偶者", value: "SPOUSE" },
|
|
5
|
+
CHILD: { title: "子", value: "CHILD" },
|
|
6
|
+
SIBLING: { title: "兄弟姉妹", value: "SIBLING" },
|
|
7
|
+
OTHER: { title: "その他", value: "OTHER" },
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const OPTIONS = [
|
|
11
|
+
{ title: VALUES.PARENT.title, value: VALUES.PARENT.value },
|
|
12
|
+
{ title: VALUES.SPOUSE.title, value: VALUES.SPOUSE.value },
|
|
13
|
+
{ title: VALUES.CHILD.title, value: VALUES.CHILD.value },
|
|
14
|
+
{ title: VALUES.SIBLING.title, value: VALUES.SIBLING.value },
|
|
15
|
+
{ title: VALUES.OTHER.title, value: VALUES.OTHER.value },
|
|
16
|
+
];
|
package/src/constants/index.js
CHANGED
|
@@ -6,6 +6,10 @@ export {
|
|
|
6
6
|
VALUES as BILLING_UNIT_TYPE_VALUES,
|
|
7
7
|
OPTIONS as BILLING_UNIT_TYPE_OPTIONS,
|
|
8
8
|
} from "./billing-unit-type.js";
|
|
9
|
+
export {
|
|
10
|
+
VALUES as BLOOD_TYPE_VALUES,
|
|
11
|
+
OPTIONS as BLOOD_TYPE_OPTIONS,
|
|
12
|
+
} from "./blood-type.js";
|
|
9
13
|
export {
|
|
10
14
|
VALUES as CONTRACT_STATUS_VALUES,
|
|
11
15
|
OPTIONS as CONTRACT_STATUS_OPTIONS,
|
|
@@ -15,6 +19,10 @@ export {
|
|
|
15
19
|
OPTIONS as DAY_TYPE_OPTIONS,
|
|
16
20
|
getDayType,
|
|
17
21
|
} from "./day-type.js";
|
|
22
|
+
export {
|
|
23
|
+
VALUES as EMERGENCY_CONTACT_RELATION_VALUES,
|
|
24
|
+
OPTIONS as EMERGENCY_CONTACT_RELATION_OPTIONS,
|
|
25
|
+
} from "./emergency-contact-relation.js";
|
|
18
26
|
export {
|
|
19
27
|
VALUES as EMPLOYMENT_STATUS_VALUES,
|
|
20
28
|
OPTIONS as EMPLOYMENT_STATUS_OPTIONS,
|
|
@@ -2,6 +2,10 @@ import {
|
|
|
2
2
|
VALUES as ARRANGEMENT_NOTIFICATION_STATUS_VALUES,
|
|
3
3
|
OPTIONS as ARRANGEMENT_NOTIFICATION_STATUS_OPTIONS,
|
|
4
4
|
} from "../constants/arrangement-notification-status.js";
|
|
5
|
+
import {
|
|
6
|
+
VALUES as BLOOD_TYPE_VALUES,
|
|
7
|
+
OPTIONS as BLOOD_TYPE_OPTIONS,
|
|
8
|
+
} from "../constants/blood-type.js";
|
|
5
9
|
import {
|
|
6
10
|
VALUES as CONTRACT_STATUS_VALUES,
|
|
7
11
|
OPTIONS as CONTRACT_STATUS_OPTIONS,
|
|
@@ -10,6 +14,10 @@ import {
|
|
|
10
14
|
OPTIONS as DAY_TYPE_OPTIONS,
|
|
11
15
|
VALUES as DAY_TYPE_VALUES,
|
|
12
16
|
} from "../constants/day-type.js";
|
|
17
|
+
import {
|
|
18
|
+
VALUES as EMERGENCY_CONTACT_RELATION_VALUES,
|
|
19
|
+
OPTIONS as EMERGENCY_CONTACT_RELATION_OPTIONS,
|
|
20
|
+
} from "../constants/emergency-contact-relation.js";
|
|
13
21
|
import {
|
|
14
22
|
VALUES as EMPLOYMENT_STATUS_VALUES,
|
|
15
23
|
OPTIONS as EMPLOYMENT_STATUS_OPTIONS,
|
|
@@ -263,6 +271,33 @@ export const fieldDefinitions = {
|
|
|
263
271
|
},
|
|
264
272
|
},
|
|
265
273
|
},
|
|
274
|
+
emergencyContactAddress: {
|
|
275
|
+
...generalDefinitions.oneLine,
|
|
276
|
+
label: "緊急連絡先住所",
|
|
277
|
+
length: 20,
|
|
278
|
+
},
|
|
279
|
+
emergencyContanctName: {
|
|
280
|
+
...generalDefinitions.oneLine,
|
|
281
|
+
label: "緊急連絡先氏名",
|
|
282
|
+
length: 20,
|
|
283
|
+
},
|
|
284
|
+
emergencyContactRelationDetail: {
|
|
285
|
+
...generalDefinitions.oneLine,
|
|
286
|
+
label: "緊急連絡先続柄詳細",
|
|
287
|
+
length: 20,
|
|
288
|
+
},
|
|
289
|
+
emergencyContactPhone: {
|
|
290
|
+
...generalDefinitions.oneLine,
|
|
291
|
+
label: "緊急連絡先電話番号",
|
|
292
|
+
length: 13,
|
|
293
|
+
component: {
|
|
294
|
+
name: generalDefinitions.oneLine.component.name,
|
|
295
|
+
attrs: {
|
|
296
|
+
counter: true,
|
|
297
|
+
inputType: "tel",
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
},
|
|
266
301
|
fax: {
|
|
267
302
|
...generalDefinitions.oneLine,
|
|
268
303
|
label: "FAX番号",
|
|
@@ -357,6 +392,11 @@ export const fieldDefinitions = {
|
|
|
357
392
|
label: "在留資格",
|
|
358
393
|
length: 10,
|
|
359
394
|
},
|
|
395
|
+
reasonOfTermination: {
|
|
396
|
+
...generalDefinitions.oneLine,
|
|
397
|
+
label: "退職理由",
|
|
398
|
+
length: 20,
|
|
399
|
+
},
|
|
360
400
|
siteId: {
|
|
361
401
|
...generalDefinitions.oneLine,
|
|
362
402
|
label: "現場",
|
|
@@ -452,6 +492,17 @@ export const fieldDefinitions = {
|
|
|
452
492
|
},
|
|
453
493
|
},
|
|
454
494
|
},
|
|
495
|
+
bloodType: {
|
|
496
|
+
...generalDefinitions.select,
|
|
497
|
+
label: "血液型",
|
|
498
|
+
default: BLOOD_TYPE_VALUES.A.value,
|
|
499
|
+
component: {
|
|
500
|
+
name: generalDefinitions.select.component.name,
|
|
501
|
+
attrs: {
|
|
502
|
+
items: BLOOD_TYPE_OPTIONS,
|
|
503
|
+
},
|
|
504
|
+
},
|
|
505
|
+
},
|
|
455
506
|
// contractStatus -> Used in Customer.js and Outsourcer.js
|
|
456
507
|
contractStatus: {
|
|
457
508
|
...generalDefinitions.select,
|
|
@@ -475,6 +526,17 @@ export const fieldDefinitions = {
|
|
|
475
526
|
},
|
|
476
527
|
},
|
|
477
528
|
},
|
|
529
|
+
emergencyContactRelation: {
|
|
530
|
+
...generalDefinitions.select,
|
|
531
|
+
default: EMERGENCY_CONTACT_RELATION_VALUES.PARENT.value,
|
|
532
|
+
label: "緊急連絡先続柄",
|
|
533
|
+
component: {
|
|
534
|
+
name: generalDefinitions.select.component.name,
|
|
535
|
+
attrs: {
|
|
536
|
+
items: EMERGENCY_CONTACT_RELATION_OPTIONS,
|
|
537
|
+
},
|
|
538
|
+
},
|
|
539
|
+
},
|
|
478
540
|
employmentStatus: {
|
|
479
541
|
...generalDefinitions.select,
|
|
480
542
|
default: EMPLOYMENT_STATUS_VALUES.ACTIVE.value,
|