@shisyamo4131/air-guard-v2-schemas 2.3.7-dev.26 → 2.3.7-dev.28
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/Customer.js +50 -36
- package/src/Employee.js +24 -37
package/package.json
CHANGED
package/src/Customer.js
CHANGED
|
@@ -1,39 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
* Customer
|
|
3
|
-
* @
|
|
4
|
-
*
|
|
5
|
-
* @description Customer model.
|
|
6
|
-
*
|
|
1
|
+
/**
|
|
2
|
+
* Customer
|
|
3
|
+
* @version 1.1.1
|
|
4
|
+
* @description This module defines the Customer model for managing customer data.
|
|
7
5
|
* @hasMany Sites - related sites associated with the customer
|
|
8
|
-
*
|
|
9
|
-
* @
|
|
10
|
-
|
|
11
|
-
* @prop {string} nameKana - customer name in kana
|
|
12
|
-
* @prop {string} zipcode - postal code
|
|
13
|
-
* @prop {string} prefCode - prefecture code
|
|
14
|
-
* @prop {string} city - city name
|
|
15
|
-
* @prop {string} address - address details
|
|
16
|
-
* @prop {string} building - building name
|
|
17
|
-
* @prop {object} location - geographical location
|
|
18
|
-
* @prop {string} tel - telephone number
|
|
19
|
-
* @prop {string} fax - fax number
|
|
20
|
-
* @prop {string} contractStatus - contract status
|
|
21
|
-
* @prop {number} paymentMonth - payment site in months
|
|
22
|
-
* @prop {string} paymentDate - payment site date
|
|
23
|
-
* @prop {string} remarks - additional remarks
|
|
24
|
-
*
|
|
25
|
-
* @readonly
|
|
26
|
-
* @prop {string} fullAddress - full address combining prefecture, city, and address (read-only)
|
|
27
|
-
* @prop {string} prefecture - prefecture name derived from `prefCode` (read-only)
|
|
28
|
-
*
|
|
29
|
-
* @static
|
|
30
|
-
* @prop {string} STATUS_ACTIVE - constant for active contract status
|
|
31
|
-
* @prop {string} STATUS_TERMINATED - constant for terminated contract status
|
|
32
|
-
*
|
|
33
|
-
* @method getPaymentDueDateAt
|
|
34
|
-
* @param {Date} baseDate - base date in UTC (JST - 9 hours)
|
|
35
|
-
* @returns {Date} payment due date in UTC (JST - 9 hours)
|
|
36
|
-
*****************************************************************************/
|
|
6
|
+
* @author shisyamo4131
|
|
7
|
+
* @update 2025-12-08 - Changed `paymentMonth` type from direct number to select field.
|
|
8
|
+
*/
|
|
37
9
|
import FireModel from "@shisyamo4131/air-firebase-v2";
|
|
38
10
|
import { defField } from "./parts/fieldDefinitions.js";
|
|
39
11
|
import { defAccessor } from "./parts/accessorDefinitions.js";
|
|
@@ -53,10 +25,23 @@ const classProps = {
|
|
|
53
25
|
tel: defField("tel", { colsDefinition: { cols: 12, sm: 6 } }),
|
|
54
26
|
fax: defField("fax", { colsDefinition: { cols: 12, sm: 6 } }),
|
|
55
27
|
contractStatus: defField("contractStatus", { required: true }),
|
|
56
|
-
paymentMonth: defField("
|
|
28
|
+
paymentMonth: defField("select", {
|
|
57
29
|
default: 1,
|
|
58
30
|
label: "入金サイト(月数)",
|
|
59
31
|
required: true,
|
|
32
|
+
component: {
|
|
33
|
+
attrs: {
|
|
34
|
+
items: [
|
|
35
|
+
{ text: "当月", value: 0 },
|
|
36
|
+
{ text: "翌月", value: 1 },
|
|
37
|
+
{ text: "翌々月", value: 2 },
|
|
38
|
+
{ text: "3ヶ月後", value: 3 },
|
|
39
|
+
{ text: "4ヶ月後", value: 4 },
|
|
40
|
+
{ text: "5ヶ月後", value: 5 },
|
|
41
|
+
{ text: "6ヶ月後", value: 6 },
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
60
45
|
}),
|
|
61
46
|
paymentDate: defField("select", {
|
|
62
47
|
label: "入金サイト(日付)",
|
|
@@ -71,6 +56,35 @@ const classProps = {
|
|
|
71
56
|
remarks: defField("multipleLine", { label: "備考" }),
|
|
72
57
|
};
|
|
73
58
|
|
|
59
|
+
/*****************************************************************************
|
|
60
|
+
* @prop {string} code - customer code
|
|
61
|
+
* @prop {string} name - customer name
|
|
62
|
+
* @prop {string} nameKana - customer name in kana
|
|
63
|
+
* @prop {string} zipcode - postal code
|
|
64
|
+
* @prop {string} prefCode - prefecture code
|
|
65
|
+
* @prop {string} city - city name
|
|
66
|
+
* @prop {string} address - address details
|
|
67
|
+
* @prop {string} building - building name
|
|
68
|
+
* @prop {object} location - geographical location
|
|
69
|
+
* @prop {string} tel - telephone number
|
|
70
|
+
* @prop {string} fax - fax number
|
|
71
|
+
* @prop {string} contractStatus - contract status
|
|
72
|
+
* @prop {number} paymentMonth - payment site in months
|
|
73
|
+
* @prop {string} paymentDate - payment site date
|
|
74
|
+
* @prop {string} remarks - additional remarks
|
|
75
|
+
*
|
|
76
|
+
* @readonly
|
|
77
|
+
* @prop {string} fullAddress - full address combining prefecture, city, and address (read-only)
|
|
78
|
+
* @prop {string} prefecture - prefecture name derived from `prefCode` (read-only)
|
|
79
|
+
*
|
|
80
|
+
* @static
|
|
81
|
+
* @prop {string} STATUS_ACTIVE - constant for active contract status
|
|
82
|
+
* @prop {string} STATUS_TERMINATED - constant for terminated contract status
|
|
83
|
+
*
|
|
84
|
+
* @method getPaymentDueDateAt
|
|
85
|
+
* @param {Date} baseDate - base date in UTC (JST - 9 hours)
|
|
86
|
+
* @returns {Date} payment due date in UTC (JST - 9 hours)
|
|
87
|
+
*****************************************************************************/
|
|
74
88
|
export default class Customer extends FireModel {
|
|
75
89
|
static className = "取引先";
|
|
76
90
|
static collectionPath = "Customers";
|
package/src/Employee.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
import FireModel from "@shisyamo4131/air-firebase-v2";
|
|
7
7
|
import { defField } from "./parts/fieldDefinitions.js";
|
|
8
8
|
import { defAccessor } from "./parts/accessorDefinitions.js";
|
|
9
|
-
import { VALUES } from "./constants/employment-status.js";
|
|
9
|
+
import { VALUES as EMPLOYMENT_STATUS_VALUES } from "./constants/employment-status.js";
|
|
10
|
+
import { VALUES as BLOOD_TYPE_VALUES } from "./constants/blood-type.js";
|
|
10
11
|
|
|
11
12
|
const classProps = {
|
|
12
13
|
code: defField("code", { label: "従業員コード" }),
|
|
@@ -32,16 +33,20 @@ const classProps = {
|
|
|
32
33
|
default: null,
|
|
33
34
|
component: {
|
|
34
35
|
attrs: {
|
|
35
|
-
required: (item) =>
|
|
36
|
-
|
|
36
|
+
required: (item) =>
|
|
37
|
+
item.employmentStatus === EMPLOYMENT_STATUS_VALUES.TERMINATED.value,
|
|
38
|
+
disabled: (item) =>
|
|
39
|
+
item.employmentStatus !== EMPLOYMENT_STATUS_VALUES.TERMINATED.value,
|
|
37
40
|
},
|
|
38
41
|
},
|
|
39
42
|
}),
|
|
40
43
|
reasonOfTermination: defField("reasonOfTermination", {
|
|
41
44
|
component: {
|
|
42
45
|
attrs: {
|
|
43
|
-
required: (item) =>
|
|
44
|
-
|
|
46
|
+
required: (item) =>
|
|
47
|
+
item.employmentStatus === EMPLOYMENT_STATUS_VALUES.TERMINATED.value,
|
|
48
|
+
disabled: (item) =>
|
|
49
|
+
item.employmentStatus !== EMPLOYMENT_STATUS_VALUES.TERMINATED.value,
|
|
45
50
|
},
|
|
46
51
|
},
|
|
47
52
|
}),
|
|
@@ -83,32 +88,6 @@ const classProps = {
|
|
|
83
88
|
|
|
84
89
|
// Security guard related fields
|
|
85
90
|
hasSecurityGuardRegistration: defField("check", { label: "警備員登録" }),
|
|
86
|
-
priorSecurityExperienceYears: defField("number", {
|
|
87
|
-
label: "入社前経験(年)",
|
|
88
|
-
default: 0,
|
|
89
|
-
required: true,
|
|
90
|
-
component: {
|
|
91
|
-
attrs: {
|
|
92
|
-
required: (item) => item.hasSecurityGuardRegistration,
|
|
93
|
-
disabled: (item) => !item.hasSecurityGuardRegistration,
|
|
94
|
-
suffix: "年",
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
}),
|
|
98
|
-
priorSecurityExperienceMonths: defField("number", {
|
|
99
|
-
label: "入社前経験(月)",
|
|
100
|
-
default: 0,
|
|
101
|
-
required: true,
|
|
102
|
-
component: {
|
|
103
|
-
attrs: {
|
|
104
|
-
required: (item) => item.hasSecurityGuardRegistration,
|
|
105
|
-
disabled: (item) => !item.hasSecurityGuardRegistration,
|
|
106
|
-
suffix: "ヶ月",
|
|
107
|
-
min: 0,
|
|
108
|
-
max: 11,
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
}),
|
|
112
91
|
dateOfSecurityGuardRegistration: defField("dateAt", {
|
|
113
92
|
label: "警備員登録日",
|
|
114
93
|
default: null,
|
|
@@ -206,6 +185,15 @@ const classProps = {
|
|
|
206
185
|
* @prop {string} nationality - Nationality.
|
|
207
186
|
* @prop {string} residenceStatus - Residence status.
|
|
208
187
|
* @prop {Date} periodOfStay - Period of stay expiration date.
|
|
188
|
+
* @prop {boolean} hasSecurityGuardRegistration - Has security guard registration.
|
|
189
|
+
* @prop {Date} dateOfSecurityGuardRegistration - Date of security guard registration.
|
|
190
|
+
* @prop {string} bloodType - Blood type.
|
|
191
|
+
* @prop {string} emergencyContactName - Emergency contact name.
|
|
192
|
+
* @prop {string} emergencyContactRelation - Emergency contact relation.
|
|
193
|
+
* @prop {string} emergencyContactRelationDetail - Emergency contact relation detail.
|
|
194
|
+
* @prop {string} emergencyContactAddress - Emergency contact address.
|
|
195
|
+
* @prop {string} emergencyContactPhone - Emergency contact phone number.
|
|
196
|
+
* @prop {string} domicile - Domicile.
|
|
209
197
|
* @prop {string} remarks - Additional remarks.
|
|
210
198
|
*
|
|
211
199
|
* @prop {string} fullName - Full name combining last and first names (read-only)
|
|
@@ -244,8 +232,8 @@ export default class Employee extends FireModel {
|
|
|
244
232
|
{ title: "名前", key: "fullName" },
|
|
245
233
|
];
|
|
246
234
|
|
|
247
|
-
static STATUS_ACTIVE =
|
|
248
|
-
static STATUS_TERMINATED =
|
|
235
|
+
static STATUS_ACTIVE = EMPLOYMENT_STATUS_VALUES.ACTIVE.value;
|
|
236
|
+
static STATUS_TERMINATED = EMPLOYMENT_STATUS_VALUES.TERMINATED.value;
|
|
249
237
|
|
|
250
238
|
_skipToTerminatedCheck = false;
|
|
251
239
|
|
|
@@ -285,11 +273,12 @@ export default class Employee extends FireModel {
|
|
|
285
273
|
|
|
286
274
|
/**
|
|
287
275
|
* 入社日からの勤続年数を計算します。
|
|
276
|
+
* - 退職日が設定されている場合は、退職日までの勤続年数を計算します。
|
|
288
277
|
* @returns {{years: number, months: number}|null} 勤続年数(年数と月数)。dateOfHireが設定されていない場合はnull。
|
|
289
278
|
*/
|
|
290
279
|
get yearsOfService() {
|
|
291
280
|
if (!this.dateOfHire) return null;
|
|
292
|
-
const today = new Date();
|
|
281
|
+
const today = this.dateOfTermination || new Date();
|
|
293
282
|
|
|
294
283
|
let years = today.getUTCFullYear() - this.dateOfHire.getUTCFullYear();
|
|
295
284
|
let months = today.getUTCMonth() - this.dateOfHire.getUTCMonth();
|
|
@@ -360,7 +349,7 @@ export default class Employee extends FireModel {
|
|
|
360
349
|
* @throws {Error} 退職済の場合に必須フィールドが未入力の場合。
|
|
361
350
|
*/
|
|
362
351
|
_validateTerminatedRequiredFields() {
|
|
363
|
-
if (this.employmentStatus ===
|
|
352
|
+
if (this.employmentStatus === EMPLOYMENT_STATUS_VALUES.TERMINATED.value) {
|
|
364
353
|
if (!this.dateOfTermination) {
|
|
365
354
|
throw new Error(
|
|
366
355
|
"[Employee.js] dateOfTermination is required when employmentStatus is 'terminated'."
|
|
@@ -410,8 +399,6 @@ export default class Employee extends FireModel {
|
|
|
410
399
|
);
|
|
411
400
|
}
|
|
412
401
|
} else {
|
|
413
|
-
this.priorSecurityExperienceYears = 0;
|
|
414
|
-
this.priorSecurityExperienceMonths = 0;
|
|
415
402
|
this.dateOfSecurityGuardRegistration = null;
|
|
416
403
|
this.bloodType = BLOOD_TYPE_VALUES.A.value;
|
|
417
404
|
this.emergencyContactName = null;
|