@shisyamo4131/air-guard-v2-schemas 2.3.7-dev.24 → 2.3.7-dev.26

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": "2.3.7-dev.24",
3
+ "version": "2.3.7-dev.26",
4
4
  "description": "Schemas for AirGuard V2",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/src/Employee.js CHANGED
@@ -84,27 +84,42 @@ const classProps = {
84
84
  // Security guard related fields
85
85
  hasSecurityGuardRegistration: defField("check", { label: "警備員登録" }),
86
86
  priorSecurityExperienceYears: defField("number", {
87
- label: "年",
87
+ label: "入社前経験()",
88
88
  default: 0,
89
+ required: true,
89
90
  component: {
90
91
  attrs: {
91
92
  required: (item) => item.hasSecurityGuardRegistration,
92
93
  disabled: (item) => !item.hasSecurityGuardRegistration,
94
+ suffix: "年",
93
95
  },
94
96
  },
95
97
  }),
96
98
  priorSecurityExperienceMonths: defField("number", {
97
- label: "月",
99
+ label: "入社前経験()",
98
100
  default: 0,
101
+ required: true,
99
102
  component: {
100
103
  attrs: {
101
104
  required: (item) => item.hasSecurityGuardRegistration,
102
105
  disabled: (item) => !item.hasSecurityGuardRegistration,
106
+ suffix: "ヶ月",
107
+ min: 0,
108
+ max: 11,
103
109
  },
104
110
  },
105
111
  }),
106
112
  dateOfSecurityGuardRegistration: defField("dateAt", {
107
113
  label: "警備員登録日",
114
+ default: null,
115
+ component: {
116
+ attrs: {
117
+ required: (item) => item.hasSecurityGuardRegistration,
118
+ disabled: (item) => !item.hasSecurityGuardRegistration,
119
+ },
120
+ },
121
+ }),
122
+ bloodType: defField("bloodType", {
108
123
  component: {
109
124
  attrs: {
110
125
  required: (item) => item.hasSecurityGuardRegistration,
@@ -112,7 +127,6 @@ const classProps = {
112
127
  },
113
128
  },
114
129
  }),
115
- bloodType: defField("bloodType"),
116
130
  emergencyContactName: defField("emergencyContactName", {
117
131
  component: {
118
132
  attrs: {
@@ -153,6 +167,14 @@ const classProps = {
153
167
  },
154
168
  },
155
169
  }),
170
+ domicile: defField("domicile", {
171
+ component: {
172
+ attrs: {
173
+ required: (item) => item.hasSecurityGuardRegistration,
174
+ disabled: (item) => !item.hasSecurityGuardRegistration,
175
+ },
176
+ },
177
+ }),
156
178
 
157
179
  remarks: defField("remarks"),
158
180
  };
@@ -355,6 +377,52 @@ export default class Employee extends FireModel {
355
377
  }
356
378
  }
357
379
 
380
+ _validateSecurityGuardFields() {
381
+ if (this.hasSecurityGuardRegistration) {
382
+ if (!this.dateOfSecurityGuardRegistration) {
383
+ throw new Error(
384
+ "[Employee.js] dateOfSecurityGuardRegistration is required when hasSecurityGuardRegistration is true."
385
+ );
386
+ }
387
+ if (!this.emergencyContactName) {
388
+ throw new Error(
389
+ "[Employee.js] emergencyContactName is required when hasSecurityGuardRegistration is true."
390
+ );
391
+ }
392
+ if (!this.emergencyContactRelationDetail) {
393
+ throw new Error(
394
+ "[Employee.js] emergencyContactRelationDetail is required when hasSecurityGuardRegistration is true."
395
+ );
396
+ }
397
+ if (!this.emergencyContactAddress) {
398
+ throw new Error(
399
+ "[Employee.js] emergencyContactAddress is required when hasSecurityGuardRegistration is true."
400
+ );
401
+ }
402
+ if (!this.emergencyContactPhone) {
403
+ throw new Error(
404
+ "[Employee.js] emergencyContactPhone is required when hasSecurityGuardRegistration is true."
405
+ );
406
+ }
407
+ if (!this.domicile) {
408
+ throw new Error(
409
+ "[Employee.js] domicile is required when hasSecurityGuardRegistration is true."
410
+ );
411
+ }
412
+ } else {
413
+ this.priorSecurityExperienceYears = 0;
414
+ this.priorSecurityExperienceMonths = 0;
415
+ this.dateOfSecurityGuardRegistration = null;
416
+ this.bloodType = BLOOD_TYPE_VALUES.A.value;
417
+ this.emergencyContactName = null;
418
+ this.emergencyContactRelation = null;
419
+ this.emergencyContactRelationDetail = null;
420
+ this.emergencyContactAddress = null;
421
+ this.emergencyContactPhone = null;
422
+ this.domicile = null;
423
+ }
424
+ }
425
+
358
426
  /**
359
427
  * 新しい従業員ドキュメントが作成される前に実行されるフック。
360
428
  * - 親クラスの `beforeCreate` を呼び出します。
@@ -364,6 +432,7 @@ export default class Employee extends FireModel {
364
432
  await super.beforeCreate();
365
433
  this._validateForeignerRequiredFields();
366
434
  this._validateTerminatedRequiredFields();
435
+ this._validateSecurityGuardFields();
367
436
  }
368
437
 
369
438
  /**
@@ -390,6 +459,7 @@ export default class Employee extends FireModel {
390
459
 
391
460
  this._validateForeignerRequiredFields();
392
461
  this._validateTerminatedRequiredFields();
462
+ this._validateSecurityGuardFields();
393
463
  }
394
464
 
395
465
  /**
@@ -260,6 +260,11 @@ export const fieldDefinitions = {
260
260
  label: "表示名",
261
261
  length: 6,
262
262
  },
263
+ domicile: {
264
+ ...generalDefinitions.oneLine,
265
+ label: "本籍地",
266
+ length: 30,
267
+ },
263
268
  email: {
264
269
  ...generalDefinitions.oneLine,
265
270
  label: "email",
@@ -276,7 +281,7 @@ export const fieldDefinitions = {
276
281
  label: "緊急連絡先住所",
277
282
  length: 20,
278
283
  },
279
- emergencyContanctName: {
284
+ emergencyContactName: {
280
285
  ...generalDefinitions.oneLine,
281
286
  label: "緊急連絡先氏名",
282
287
  length: 20,