@shisyamo4131/air-guard-v2-schemas 2.3.7-dev.7 → 2.3.7
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 +2 -0
- package/package.json +1 -1
- package/src/Agreement.js +6 -16
- package/src/Certification.js +49 -0
- package/src/Company.js +27 -1
- package/src/Customer.js +53 -41
- package/src/Employee.js +417 -58
- package/src/OperationBilling.js +28 -14
- package/src/OperationResult.js +28 -9
- package/src/Site.js +46 -9
- package/src/SiteOperationSchedule.js +25 -5
- package/src/System.js +43 -0
- package/src/apis/index.js +4 -0
- package/src/constants/blood-type.js +14 -0
- package/src/constants/certification-type.js +34 -0
- package/src/constants/emergency-contact-relation.js +16 -0
- package/src/constants/index.js +16 -0
- package/src/constants/payment-month.js +21 -0
- package/src/parts/accessorDefinitions.js +13 -27
- package/src/parts/fieldDefinitions.js +147 -3
- package/src/utils/CutoffDate.js +14 -14
package/src/OperationResult.js
CHANGED
|
@@ -542,13 +542,19 @@ export default class OperationResult extends Operation {
|
|
|
542
542
|
|
|
543
543
|
/**
|
|
544
544
|
* Synchronize customerId and apply (re-apply) agreement from siteId
|
|
545
|
+
* @param {Object} [args.transaction] - Firestore transaction.
|
|
546
|
+
* @param {Function} [args.callBack] - Callback function.
|
|
547
|
+
* @param {string} [args.prefix] - Path prefix.
|
|
545
548
|
* @returns {Promise<void>}
|
|
546
549
|
* @throws {Error} If the specified siteId does not exist
|
|
547
550
|
*/
|
|
548
|
-
async _syncCustomerIdAndApplyAgreement() {
|
|
551
|
+
async _syncCustomerIdAndApplyAgreement(args = {}) {
|
|
549
552
|
if (!this.siteId) return;
|
|
550
553
|
const siteInstance = new Site();
|
|
551
|
-
const siteExists = await siteInstance.fetch({
|
|
554
|
+
const siteExists = await siteInstance.fetch({
|
|
555
|
+
...args,
|
|
556
|
+
docId: this.siteId,
|
|
557
|
+
});
|
|
552
558
|
if (!siteExists) {
|
|
553
559
|
throw new Error(
|
|
554
560
|
`[OperationResult] The specified siteId (${this.siteId}) does not exist.`
|
|
@@ -560,10 +566,16 @@ export default class OperationResult extends Operation {
|
|
|
560
566
|
|
|
561
567
|
/**
|
|
562
568
|
* Override beforeCreate to sync customerId
|
|
569
|
+
* @param {Object} args - Creation options.
|
|
570
|
+
* @param {string} [args.docId] - Document ID to use (optional).
|
|
571
|
+
* @param {boolean} [args.useAutonumber=true] - Whether to use auto-numbering.
|
|
572
|
+
* @param {Object} [args.transaction] - Firestore transaction.
|
|
573
|
+
* @param {Function} [args.callBack] - Callback function.
|
|
574
|
+
* @param {string} [args.prefix] - Path prefix.
|
|
563
575
|
* @returns {Promise<void>}
|
|
564
576
|
*/
|
|
565
|
-
async beforeCreate() {
|
|
566
|
-
await super.beforeCreate();
|
|
577
|
+
async beforeCreate(args = {}) {
|
|
578
|
+
await super.beforeCreate(args);
|
|
567
579
|
|
|
568
580
|
// Sync customerId and apply agreement
|
|
569
581
|
await this._syncCustomerIdAndApplyAgreement();
|
|
@@ -571,10 +583,14 @@ export default class OperationResult extends Operation {
|
|
|
571
583
|
|
|
572
584
|
/**
|
|
573
585
|
* Override beforeUpdate to sync customerId and apply agreement if key changed
|
|
586
|
+
* @param {Object} args - Creation options.
|
|
587
|
+
* @param {Object} [args.transaction] - Firestore transaction.
|
|
588
|
+
* @param {Function} [args.callBack] - Callback function.
|
|
589
|
+
* @param {string} [args.prefix] - Path prefix.
|
|
574
590
|
* @returns {Promise<void>}
|
|
575
591
|
*/
|
|
576
|
-
async beforeUpdate() {
|
|
577
|
-
await super.beforeUpdate();
|
|
592
|
+
async beforeUpdate(args = {}) {
|
|
593
|
+
await super.beforeUpdate(args);
|
|
578
594
|
|
|
579
595
|
// Prevent editing if isLocked is true
|
|
580
596
|
if (this.isLocked) {
|
|
@@ -590,12 +606,15 @@ export default class OperationResult extends Operation {
|
|
|
590
606
|
|
|
591
607
|
/**
|
|
592
608
|
* Override beforeDelete to prevent deletion if isLocked is true
|
|
609
|
+
* @param {Object} args - Creation options.
|
|
610
|
+
* @param {Object} [args.transaction] - Firestore transaction.
|
|
611
|
+
* @param {Function} [args.callBack] - Callback function.
|
|
612
|
+
* @param {string} [args.prefix] - Path prefix.
|
|
593
613
|
* @returns {Promise<void>}
|
|
594
614
|
* @throws {Error} If isLocked is true
|
|
595
615
|
*/
|
|
596
|
-
async beforeDelete() {
|
|
597
|
-
await super.beforeDelete();
|
|
598
|
-
|
|
616
|
+
async beforeDelete(args = {}) {
|
|
617
|
+
await super.beforeDelete(args);
|
|
599
618
|
// Prevent deletion if isLocked is true
|
|
600
619
|
if (this.isLocked) {
|
|
601
620
|
throw new Error(
|
package/src/Site.js
CHANGED
|
@@ -5,26 +5,32 @@
|
|
|
5
5
|
* @update 2025-11-20 version 0.2.0-bata
|
|
6
6
|
* - Prevent changing customer reference on update.
|
|
7
7
|
* - Move `customer` property to the top of classProps for better visibility.
|
|
8
|
+
*
|
|
9
|
+
* NOTE: `customer` プロパティについて
|
|
10
|
+
* 自身の従属先データを持たせる場合に `XxxxxMinimal` クラスを使用するが、アプリ側でオブジェクト選択を行う場合に
|
|
11
|
+
* `Xxxxx` クラスにするのか `XxxxxMinimal` クラスにするのかを判断できないため、docId を持たせて
|
|
12
|
+
* `beforeCreate` フックでオブジェクトを取得するようにする。
|
|
13
|
+
* 尚、取引先は変更できない仕様。
|
|
8
14
|
*/
|
|
9
15
|
import { default as FireModel } from "@shisyamo4131/air-firebase-v2";
|
|
10
16
|
import { defField } from "./parts/fieldDefinitions.js";
|
|
11
17
|
import { defAccessor } from "./parts/accessorDefinitions.js";
|
|
12
|
-
import
|
|
13
|
-
import { fetchDocsApi } from "./apis/index.js";
|
|
18
|
+
import Customer from "./Customer.js";
|
|
14
19
|
import Agreement from "./Agreement.js";
|
|
15
20
|
import { VALUES } from "./constants/site-status.js";
|
|
16
21
|
|
|
17
22
|
const classProps = {
|
|
18
|
-
|
|
23
|
+
customerId: defField("customerId", {
|
|
19
24
|
required: true,
|
|
20
|
-
customClass: CustomerMinimal,
|
|
21
25
|
component: {
|
|
22
26
|
attrs: {
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
disabled: ({ editMode }) => {
|
|
28
|
+
return editMode !== "CREATE";
|
|
29
|
+
},
|
|
25
30
|
},
|
|
26
31
|
},
|
|
27
32
|
}),
|
|
33
|
+
customer: defField("customer", { hidden: true, customClass: Customer }),
|
|
28
34
|
code: defField("code", { label: "現場コード" }),
|
|
29
35
|
name: defField("name", {
|
|
30
36
|
label: "現場名",
|
|
@@ -115,15 +121,46 @@ export default class Site extends FireModel {
|
|
|
115
121
|
{ title: "取引先名", key: "customer.name", value: "customer.name" },
|
|
116
122
|
];
|
|
117
123
|
|
|
124
|
+
static STATUS = VALUES;
|
|
118
125
|
static STATUS_ACTIVE = VALUES.ACTIVE.value;
|
|
119
126
|
static STATUS_TERMINATED = VALUES.TERMINATED.value;
|
|
120
127
|
|
|
128
|
+
/**
|
|
129
|
+
* Overrides to fetch and set the customer object before creation.
|
|
130
|
+
* @param {Object} args - Creation options.
|
|
131
|
+
* @param {string} [args.docId] - Document ID to use (optional).
|
|
132
|
+
* @param {boolean} [args.useAutonumber=true] - Whether to use auto-numbering.
|
|
133
|
+
* @param {Object} [args.transaction] - Firestore transaction.
|
|
134
|
+
* @param {Function} [args.callBack] - Callback function.
|
|
135
|
+
* @param {string} [args.prefix] - Path prefix.
|
|
136
|
+
* @returns {Promise<void>}
|
|
137
|
+
*/
|
|
138
|
+
async beforeCreate(args = {}) {
|
|
139
|
+
await super.beforeCreate(args);
|
|
140
|
+
if (!this.customerId) return;
|
|
141
|
+
const customerInstance = new Customer();
|
|
142
|
+
const isExist = await customerInstance.fetch({
|
|
143
|
+
...args,
|
|
144
|
+
docId: this.customerId,
|
|
145
|
+
});
|
|
146
|
+
if (!isExist) {
|
|
147
|
+
return Promise.reject(
|
|
148
|
+
new Error("Invalid customerId: Customer does not exist.")
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
this.customer = customerInstance;
|
|
152
|
+
}
|
|
153
|
+
|
|
121
154
|
/**
|
|
122
155
|
* Override beforeUpdate to prevent changing customer reference.
|
|
156
|
+
* @param {Object} args - Creation options.
|
|
157
|
+
* @param {Object} [args.transaction] - Firestore transaction.
|
|
158
|
+
* @param {Function} [args.callBack] - Callback function.
|
|
159
|
+
* @param {string} [args.prefix] - Path prefix.
|
|
123
160
|
* @returns {Promise<void>}
|
|
124
161
|
*/
|
|
125
|
-
async beforeUpdate() {
|
|
126
|
-
await super.beforeUpdate();
|
|
162
|
+
async beforeUpdate(args = {}) {
|
|
163
|
+
await super.beforeUpdate(args);
|
|
127
164
|
if (this.customer.docId !== this._beforeData.customer.docId) {
|
|
128
165
|
return Promise.reject(
|
|
129
166
|
new Error("Not allowed to change customer reference.")
|
|
@@ -135,7 +172,7 @@ export default class Site extends FireModel {
|
|
|
135
172
|
super.afterInitialize(item);
|
|
136
173
|
|
|
137
174
|
Object.defineProperties(this, {
|
|
138
|
-
customerId: defAccessor("customerId"),
|
|
175
|
+
// customerId: defAccessor("customerId"),
|
|
139
176
|
fullAddress: defAccessor("fullAddress"),
|
|
140
177
|
prefecture: defAccessor("prefecture"),
|
|
141
178
|
});
|
|
@@ -385,27 +385,35 @@ export default class SiteOperationSchedule extends Operation {
|
|
|
385
385
|
/**
|
|
386
386
|
* Override `beforeUpdate`.
|
|
387
387
|
* - Prevents updates if an associated OperationResult exists.
|
|
388
|
+
* @param {Object} args - Creation options.
|
|
389
|
+
* @param {Object} [args.transaction] - Firestore transaction.
|
|
390
|
+
* @param {Function} [args.callBack] - Callback function.
|
|
391
|
+
* @param {string} [args.prefix] - Path prefix.
|
|
388
392
|
*/
|
|
389
|
-
async beforeUpdate() {
|
|
393
|
+
async beforeUpdate(args = {}) {
|
|
390
394
|
if (this._beforeData.operationResultId) {
|
|
391
395
|
throw new Error(
|
|
392
396
|
`Could not update this document. The OperationResult based on this document already exists. OperationResultId: ${this._beforeData.operationResultId}`
|
|
393
397
|
);
|
|
394
398
|
}
|
|
395
|
-
await super.beforeUpdate();
|
|
399
|
+
await super.beforeUpdate(args);
|
|
396
400
|
}
|
|
397
401
|
|
|
398
402
|
/**
|
|
399
403
|
* Override `beforeDelete`.
|
|
400
404
|
* - Prevents deletions if an associated OperationResult exists.
|
|
405
|
+
* @param {Object} args - Creation options.
|
|
406
|
+
* @param {Object} [args.transaction] - Firestore transaction.
|
|
407
|
+
* @param {Function} [args.callBack] - Callback function.
|
|
408
|
+
* @param {string} [args.prefix] - Path prefix.
|
|
401
409
|
*/
|
|
402
|
-
async beforeDelete() {
|
|
410
|
+
async beforeDelete(args = {}) {
|
|
403
411
|
if (this._beforeData.operationResultId) {
|
|
404
412
|
throw new Error(
|
|
405
413
|
`Could not delete this document. The OperationResult based on this document already exists. OperationResultId: ${this._beforeData.operationResultId}`
|
|
406
414
|
);
|
|
407
415
|
}
|
|
408
|
-
await super.beforeDelete();
|
|
416
|
+
await super.beforeDelete(args);
|
|
409
417
|
}
|
|
410
418
|
|
|
411
419
|
/**
|
|
@@ -587,7 +595,13 @@ export default class SiteOperationSchedule extends Operation {
|
|
|
587
595
|
// 加えて重複も除外する。
|
|
588
596
|
const targetDates = dates
|
|
589
597
|
.map((date) => {
|
|
590
|
-
if (date instanceof Date)
|
|
598
|
+
if (date instanceof Date) {
|
|
599
|
+
const jstDate = new Date(date.getTime() + 9 * 60 * 60 * 1000);
|
|
600
|
+
const year = jstDate.getUTCFullYear();
|
|
601
|
+
const month = String(jstDate.getUTCMonth() + 1).padStart(2, "0");
|
|
602
|
+
const day = String(jstDate.getUTCDate()).padStart(2, "0");
|
|
603
|
+
return `${year}-${month}-${day}`;
|
|
604
|
+
}
|
|
591
605
|
return date;
|
|
592
606
|
})
|
|
593
607
|
.filter((date) => date !== this.date)
|
|
@@ -602,6 +616,12 @@ export default class SiteOperationSchedule extends Operation {
|
|
|
602
616
|
instance.docId = "";
|
|
603
617
|
instance.dateAt = new Date(date);
|
|
604
618
|
instance.operationResultId = null;
|
|
619
|
+
|
|
620
|
+
// 2025-12-23 追加
|
|
621
|
+
// 複製元が既に配置通知を出している可能性があるため、`hasNotification` を false に更新
|
|
622
|
+
instance.employees.forEach((emp) => (emp.hasNotification = false));
|
|
623
|
+
instance.outsourcers.forEach((out) => (out.hasNotification = false));
|
|
624
|
+
|
|
605
625
|
return instance;
|
|
606
626
|
});
|
|
607
627
|
|
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/apis/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// 2025-12-08
|
|
2
|
+
// アプリ側で `useFetchXxxx` コンポーザブルを使用した API 連携を行う為
|
|
3
|
+
// このファイルは不要。
|
|
4
|
+
// 各種関数に依存しているファイルの存在がないことを確認の上、削除予定。
|
|
1
5
|
export function fetchDocsApi(constructor) {
|
|
2
6
|
const instance = new constructor();
|
|
3
7
|
return async (search) => await instance.fetchDocs({ constraints: search });
|
|
@@ -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,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file src/constants/certification-type.js
|
|
3
|
+
* @description 警備業務資格の種別定義
|
|
4
|
+
*
|
|
5
|
+
* 警備業法に基づく4号区分:
|
|
6
|
+
* - 1号警備業務:施設警備業務
|
|
7
|
+
* - 2号警備業務:交通誘導警備業務、雑踏警備業務
|
|
8
|
+
* - 3号警備業務:貴重品運搬警備業務、核燃料物質等危険物運搬警備業務
|
|
9
|
+
* - 4号警備業務:身辺警備業務
|
|
10
|
+
*
|
|
11
|
+
* 実務上の考慮事項:
|
|
12
|
+
* - 現場ごとに必要な資格タイプが異なる
|
|
13
|
+
* - 1級保有者は2級の業務も対応可能(包括関係)
|
|
14
|
+
* - ユーザビリティを考慮し、タイプ単位で管理
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// prettier-ignore
|
|
18
|
+
export const VALUES = Object.freeze({
|
|
19
|
+
FACILITY: { title: "施設警備", value: "FACILITY" }, // 1号
|
|
20
|
+
TRAFFIC: { title: "交通誘導警備", value: "TRAFFIC" }, // 2号
|
|
21
|
+
CROWD: { title: "雑踏警備", value: "CROWD" }, // 2号
|
|
22
|
+
VALUABLES: { title: "貴重品運搬警備", value: "VALUABLES" }, // 3号
|
|
23
|
+
BODYGUARD: { title: "身辺警備", value: "BODYGUARD" }, // 4号
|
|
24
|
+
OTHER: { title: "その他", value: "OTHER" },
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const OPTIONS = [
|
|
28
|
+
{ title: VALUES.FACILITY.title, value: VALUES.FACILITY.value },
|
|
29
|
+
{ title: VALUES.TRAFFIC.title, value: VALUES.TRAFFIC.value },
|
|
30
|
+
{ title: VALUES.CROWD.title, value: VALUES.CROWD.value },
|
|
31
|
+
{ title: VALUES.VALUABLES.title, value: VALUES.VALUABLES.value },
|
|
32
|
+
{ title: VALUES.BODYGUARD.title, value: VALUES.BODYGUARD.value },
|
|
33
|
+
{ title: VALUES.OTHER.title, value: VALUES.OTHER.value },
|
|
34
|
+
];
|
|
@@ -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,14 @@ 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";
|
|
13
|
+
export {
|
|
14
|
+
VALUES as CERTIFICATION_TYPE_VALUES,
|
|
15
|
+
OPTIONS as CERTIFICATION_TYPE_OPTIONS,
|
|
16
|
+
} from "./certification-type.js";
|
|
9
17
|
export {
|
|
10
18
|
VALUES as CONTRACT_STATUS_VALUES,
|
|
11
19
|
OPTIONS as CONTRACT_STATUS_OPTIONS,
|
|
@@ -15,6 +23,10 @@ export {
|
|
|
15
23
|
OPTIONS as DAY_TYPE_OPTIONS,
|
|
16
24
|
getDayType,
|
|
17
25
|
} from "./day-type.js";
|
|
26
|
+
export {
|
|
27
|
+
VALUES as EMERGENCY_CONTACT_RELATION_VALUES,
|
|
28
|
+
OPTIONS as EMERGENCY_CONTACT_RELATION_OPTIONS,
|
|
29
|
+
} from "./emergency-contact-relation.js";
|
|
18
30
|
export {
|
|
19
31
|
VALUES as EMPLOYMENT_STATUS_VALUES,
|
|
20
32
|
OPTIONS as EMPLOYMENT_STATUS_OPTIONS,
|
|
@@ -23,6 +35,10 @@ export {
|
|
|
23
35
|
VALUES as GENDER_VALUES,
|
|
24
36
|
OPTIONS as GENDER_OPTIONS,
|
|
25
37
|
} from "./gender.js";
|
|
38
|
+
export {
|
|
39
|
+
VALUES as PAYMENT_MONTH_VALUES,
|
|
40
|
+
OPTIONS as PAYMENT_MONTH_OPTIONS,
|
|
41
|
+
} from "./payment-month.js";
|
|
26
42
|
export {
|
|
27
43
|
VALUES as PREFECTURES_VALUES,
|
|
28
44
|
OPTIONS as PREFECTURES_OPTIONS,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// prettier-ignore
|
|
2
|
+
|
|
3
|
+
export const VALUES = Object.freeze({
|
|
4
|
+
0: { value: 0, title: "当月" },
|
|
5
|
+
1: { value: 1, title: "翌月" },
|
|
6
|
+
2: { value: 2, title: "翌々月" },
|
|
7
|
+
3: { value: 3, title: "3ヶ月後" },
|
|
8
|
+
4: { value: 4, title: "4ヶ月後" },
|
|
9
|
+
5: { value: 5, title: "5ヶ月後" },
|
|
10
|
+
6: { value: 6, title: "6ヶ月後" },
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const OPTIONS = [
|
|
14
|
+
{ title: VALUES[0].title, value: VALUES[0].value },
|
|
15
|
+
{ title: VALUES[1].title, value: VALUES[1].value },
|
|
16
|
+
{ title: VALUES[2].title, value: VALUES[2].value },
|
|
17
|
+
{ title: VALUES[3].title, value: VALUES[3].value },
|
|
18
|
+
{ title: VALUES[4].title, value: VALUES[4].value },
|
|
19
|
+
{ title: VALUES[5].title, value: VALUES[5].value },
|
|
20
|
+
{ title: VALUES[6].title, value: VALUES[6].value },
|
|
21
|
+
];
|
|
@@ -10,17 +10,15 @@ import { OPTIONS } from "../constants/prefectures.js";
|
|
|
10
10
|
* @type {Object.<string, AccessorImplementation>}
|
|
11
11
|
*/
|
|
12
12
|
const accessorImplementations = {
|
|
13
|
+
// 2025-12-08 削除可能
|
|
14
|
+
// `defAccessor("customerId")` で使用されていなければ削除。
|
|
13
15
|
customerId: {
|
|
14
|
-
enumerable: true,
|
|
15
16
|
get() {
|
|
16
17
|
return this?.customer?.docId;
|
|
17
18
|
},
|
|
18
|
-
set(
|
|
19
|
-
// No-op setter for read-only access
|
|
20
|
-
},
|
|
19
|
+
set() {},
|
|
21
20
|
},
|
|
22
21
|
fullAddress: {
|
|
23
|
-
enumerable: true,
|
|
24
22
|
get() {
|
|
25
23
|
// 同じオブジェクトに 'prefecture' アクセサが定義されていることを前提とします
|
|
26
24
|
const prefecture = this.prefecture || "";
|
|
@@ -28,53 +26,41 @@ const accessorImplementations = {
|
|
|
28
26
|
const address = this.address || "";
|
|
29
27
|
return `${prefecture}${city}${address}`;
|
|
30
28
|
},
|
|
31
|
-
set(
|
|
32
|
-
// No-op setter for read-only access
|
|
33
|
-
},
|
|
29
|
+
set() {},
|
|
34
30
|
},
|
|
35
31
|
fullName: {
|
|
36
|
-
enumerable: true,
|
|
37
32
|
get() {
|
|
38
33
|
if (!this.lastName || !this.firstName) return "";
|
|
39
34
|
return `${this.lastName} ${this.firstName}`;
|
|
40
35
|
},
|
|
41
|
-
set(
|
|
42
|
-
|
|
36
|
+
set() {},
|
|
37
|
+
},
|
|
38
|
+
fullNameKana: {
|
|
39
|
+
get() {
|
|
40
|
+
if (!this.lastNameKana || !this.firstNameKana) return "";
|
|
41
|
+
return `${this.lastNameKana} ${this.firstNameKana}`;
|
|
43
42
|
},
|
|
43
|
+
set() {},
|
|
44
44
|
},
|
|
45
45
|
prefecture: {
|
|
46
|
-
enumerable: true,
|
|
47
46
|
get() {
|
|
48
|
-
// if (!this.hasOwnProperty("prefCode")) {
|
|
49
|
-
// console.warn(
|
|
50
|
-
// "[アクセサ: prefecture] このオブジェクトに prefCode が定義されていません。"
|
|
51
|
-
// );
|
|
52
|
-
// return "";
|
|
53
|
-
// }
|
|
54
|
-
|
|
55
47
|
if (!this.prefCode) return ""; // No warning if prefCode is falsy but present
|
|
56
|
-
|
|
57
48
|
const result = OPTIONS.find(({ value }) => value === this.prefCode);
|
|
58
|
-
|
|
59
49
|
if (!result) {
|
|
60
50
|
console.warn(
|
|
61
51
|
`[アクセサ: prefecture] prefCode '${this.prefCode}' は OPTIONS に見つかりません。`
|
|
62
52
|
);
|
|
63
53
|
return "";
|
|
64
54
|
}
|
|
65
|
-
|
|
66
55
|
if (!result.hasOwnProperty("title")) {
|
|
67
56
|
console.warn(
|
|
68
57
|
`[アクセサ: prefecture] OPTIONS の prefCode '${this.prefCode}' に title が定義されていません。`
|
|
69
58
|
);
|
|
70
59
|
return "";
|
|
71
60
|
}
|
|
72
|
-
|
|
73
61
|
return result.title;
|
|
74
62
|
},
|
|
75
|
-
set(
|
|
76
|
-
// No-op setter for read-only access
|
|
77
|
-
},
|
|
63
|
+
set() {},
|
|
78
64
|
},
|
|
79
65
|
};
|
|
80
66
|
|
|
@@ -90,7 +76,7 @@ const accessorImplementations = {
|
|
|
90
76
|
*/
|
|
91
77
|
export const defAccessor = (
|
|
92
78
|
key,
|
|
93
|
-
{ configurable =
|
|
79
|
+
{ configurable = true, enumerable = true } = {}
|
|
94
80
|
) => {
|
|
95
81
|
const implementation = accessorImplementations[key];
|
|
96
82
|
if (!implementation) {
|