@shisyamo4131/air-guard-v2-schemas 2.4.2-dev.8 → 2.4.2-dev.80
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 +12 -0
- package/package.json +45 -47
- package/src/Agreement.js +17 -24
- package/src/AgreementV2.js +185 -0
- package/src/ArrangementNotification.js +16 -8
- package/src/Billing.js +5 -34
- package/src/Company.js +162 -25
- package/src/Customer.js +39 -59
- package/src/Employee.js +591 -297
- package/src/FcmToken.js +73 -0
- package/src/Insurance.js +409 -0
- package/src/Notification.js +95 -0
- package/src/NotificationRecipient.js +68 -0
- package/src/Operation.js +272 -280
- package/src/OperationBilling.js +126 -192
- package/src/OperationDetail.js +115 -85
- package/src/OperationResult.js +257 -254
- package/src/OperationResultDetail.js +65 -56
- package/src/Site.js +160 -137
- package/src/SiteOperationSchedule.js +187 -247
- package/src/SiteOperationScheduleDetail.js +75 -65
- package/src/SiteOrder.js +18 -29
- package/src/User.js +44 -47
- package/src/WorkTimeBase.js +205 -0
- package/src/WorkingResult.js +83 -255
- package/src/constants/day-type.js +20 -12
- package/src/constants/index.js +4 -0
- package/src/constants/insurance-status.js +15 -0
- package/src/constants/shift-type.js +5 -2
- package/src/errorDefinitions.js +173 -0
- package/src/parts/fieldDefinitions/array.js +50 -0
- package/src/parts/fieldDefinitions/check.js +53 -0
- package/src/parts/fieldDefinitions/code.js +8 -0
- package/src/parts/fieldDefinitions/constants.js +9 -0
- package/src/parts/fieldDefinitions/dateAt.js +63 -0
- package/src/parts/fieldDefinitions/dateTimeAt.js +8 -0
- package/src/parts/fieldDefinitions/defaultDefinition.js +118 -0
- package/src/parts/fieldDefinitions/multipleLine.js +16 -0
- package/src/parts/fieldDefinitions/number.js +69 -0
- package/src/parts/fieldDefinitions/object.js +38 -0
- package/src/parts/fieldDefinitions/oneLine.js +409 -0
- package/src/parts/fieldDefinitions/radio.js +8 -0
- package/src/parts/fieldDefinitions/select.js +267 -0
- package/src/parts/fieldDefinitions/time.js +8 -0
- package/src/parts/fieldDefinitions.js +46 -669
- package/src/utils/CutoffDate.js +11 -15
- package/src/utils/index.js +44 -8
package/src/Company.js
CHANGED
|
@@ -1,29 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
* Company
|
|
3
|
-
* @
|
|
1
|
+
/*****************************************************************************
|
|
2
|
+
* @class Company
|
|
3
|
+
* @extends FireModel
|
|
4
4
|
* @author shisyamo4131
|
|
5
|
-
*
|
|
6
|
-
* @
|
|
7
|
-
* @
|
|
8
|
-
* @
|
|
9
|
-
* @
|
|
10
|
-
* @
|
|
11
|
-
|
|
5
|
+
*
|
|
6
|
+
* @property {string} companyName - 会社名
|
|
7
|
+
* @property {string} companyNameKana - 会社名(カナ)
|
|
8
|
+
* @property {string} zipcode - 郵便番号
|
|
9
|
+
* @property {string} prefCode - 都道府県コード
|
|
10
|
+
* @property {string} city - 市区町村
|
|
11
|
+
* @property {string} address - 住所
|
|
12
|
+
* @property {string} building - 建物名
|
|
13
|
+
* @property {string} tel - 電話番号
|
|
14
|
+
* @property {string} fax - FAX番号
|
|
15
|
+
* @property {string} bankName - 銀行名
|
|
16
|
+
* @property {string} branchName - 支店名
|
|
17
|
+
* @property {string} accountType - 口座種別(普通、当座)
|
|
18
|
+
* @property {string} accountNumber - 口座番号
|
|
19
|
+
* @property {string} accountHolder - 口座名義
|
|
20
|
+
* @property {AgreementV2[]} agreementsV2 - 会社の既定取極めの配列(バージョン2)
|
|
21
|
+
* @property {SiteOrder[]} siteOrder - 配置管理のサイト・勤務区分ペアの表示順を管理する配列
|
|
22
|
+
* @property {SiteOrder[]} scheduleOrder - サイト・勤務区分ペアの表示順を管理する配列(スケジュール用)
|
|
23
|
+
* @property {object} location - 会社の位置情報
|
|
24
|
+
* @property {number} minuteInterval - 時刻選択間隔(分)
|
|
25
|
+
* @property {string} roundSetting - 端数処理設定
|
|
26
|
+
* @property {string} firstDayOfWeek - 週の始まり
|
|
27
|
+
* @property {string} stripeCustomerId - Stripe顧客ID
|
|
28
|
+
* @property {object} subscription - サブスクリプション情報
|
|
29
|
+
* @property {boolean} maintenanceMode - メンテナンスモードフラグ
|
|
30
|
+
* @property {string} maintenanceReason - メンテナンス理由
|
|
31
|
+
* @property {Date} maintenanceStartAt - メンテナンス開始日時
|
|
32
|
+
* @property {string} maintenanceStartedBy - メンテナンス開始者
|
|
33
|
+
*
|
|
34
|
+
* @deprecated `agreements` is deprecated. Use `agreementsV2` instead.
|
|
35
|
+
*****************************************************************************/
|
|
12
36
|
import FireModel from "@shisyamo4131/air-firebase-v2";
|
|
13
37
|
import { defField } from "./parts/fieldDefinitions.js";
|
|
14
38
|
import { defAccessor } from "./parts/accessorDefinitions.js";
|
|
15
|
-
import Agreement from "./Agreement.js";
|
|
39
|
+
// import Agreement from "./Agreement.js";
|
|
40
|
+
import AgreementV2 from "./AgreementV2.js";
|
|
16
41
|
import SiteOrder from "./SiteOrder.js";
|
|
17
42
|
import RoundSetting from "./RoundSetting.js";
|
|
18
43
|
import { GeocodableMixin } from "./mixins/GeocodableMixin.js";
|
|
19
44
|
import { DAY_OF_WEEK_OPTIONS, DAY_OF_WEEK_VALUES } from "./constants/index.js";
|
|
20
45
|
|
|
21
46
|
const classProps = {
|
|
22
|
-
companyName: defField("
|
|
23
|
-
companyNameKana: defField("
|
|
24
|
-
label: "会社名(カナ)",
|
|
25
|
-
required: true,
|
|
26
|
-
}),
|
|
47
|
+
companyName: defField("companyName", { required: true }),
|
|
48
|
+
companyNameKana: defField("companyNameKana", { required: true }),
|
|
27
49
|
|
|
28
50
|
/**
|
|
29
51
|
* これ以降のフィールドは管理者アカウント作成時に未入力状態で作成されるため required は未定義(false)とする
|
|
@@ -49,18 +71,33 @@ const classProps = {
|
|
|
49
71
|
accountNumber: defField("oneLine", { label: "口座番号", length: 7 }),
|
|
50
72
|
accountHolder: defField("oneLine", { label: "口座名義", length: 50 }),
|
|
51
73
|
|
|
52
|
-
/**
|
|
53
|
-
|
|
74
|
+
/**
|
|
75
|
+
* 会社既定の取極め
|
|
76
|
+
* @deprecated `agreements` is deprecated. Use `agreementsV2` instead.
|
|
77
|
+
*/
|
|
78
|
+
// agreements: defField("array", {
|
|
79
|
+
// label: "既定の取極め",
|
|
80
|
+
// customClass: Agreement,
|
|
81
|
+
// }),
|
|
82
|
+
agreementsV2: defField("array", {
|
|
54
83
|
label: "既定の取極め",
|
|
55
|
-
customClass:
|
|
84
|
+
customClass: AgreementV2,
|
|
56
85
|
}),
|
|
57
86
|
|
|
58
87
|
/**
|
|
59
|
-
*
|
|
88
|
+
* Property to manage the display order of site-shift type pairs for arrangement management.
|
|
60
89
|
* Format: { siteId, shiftType }
|
|
90
|
+
* NOTE: `key` is a unique identifier combined from siteId and shiftType.
|
|
61
91
|
*/
|
|
62
92
|
siteOrder: defField("array", { customClass: SiteOrder, hidden: true }),
|
|
63
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Property to manage the display order of site-shift type pairs for site-operation-schedule.
|
|
96
|
+
* Format: { siteId, shiftType, key }
|
|
97
|
+
* NOTE: `key` is a unique identifier combined from siteId and shiftType.
|
|
98
|
+
*/
|
|
99
|
+
scheduleOrder: defField("array", { customClass: SiteOrder, hidden: true }),
|
|
100
|
+
|
|
64
101
|
/** Geolocation */
|
|
65
102
|
location: defField("location", { hidden: true }),
|
|
66
103
|
|
|
@@ -203,7 +240,7 @@ export default class Company extends GeocodableMixin(FireModel) {
|
|
|
203
240
|
const newOrder = new SiteOrder({ siteId, shiftType });
|
|
204
241
|
if (this.some((order) => order.key === newOrder.key)) {
|
|
205
242
|
throw new Error(
|
|
206
|
-
`SiteOrder with key ${newOrder.key} already exists
|
|
243
|
+
`SiteOrder with key ${newOrder.key} already exists.`,
|
|
207
244
|
);
|
|
208
245
|
}
|
|
209
246
|
index === -1 ? this.push(newOrder) : this.splice(index, 0, newOrder);
|
|
@@ -250,16 +287,104 @@ export default class Company extends GeocodableMixin(FireModel) {
|
|
|
250
287
|
if (typeof arg === "string") {
|
|
251
288
|
key = arg;
|
|
252
289
|
} else if (typeof arg === "object" && arg.siteId && arg.shiftType) {
|
|
253
|
-
key = `${arg.siteId}
|
|
290
|
+
key = `${arg.siteId}_${arg.shiftType}`;
|
|
254
291
|
} else {
|
|
255
292
|
throw new Error(
|
|
256
|
-
"Invalid argument for remove. Must be a string key or an object with siteId and shiftType."
|
|
293
|
+
"Invalid argument for remove. Must be a string key or an object with siteId and shiftType.",
|
|
257
294
|
);
|
|
258
295
|
}
|
|
259
296
|
|
|
260
297
|
const index = this.findIndex((order) => order.key === key);
|
|
261
298
|
if (index === -1) {
|
|
262
|
-
throw new Error(`
|
|
299
|
+
throw new Error(`ScheduleOrder with key ${key} does not exist.`);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
this.splice(index, 1);
|
|
303
|
+
},
|
|
304
|
+
writable: false,
|
|
305
|
+
enumerable: false,
|
|
306
|
+
configurable: true,
|
|
307
|
+
},
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
/*************************************************************************
|
|
311
|
+
* CUSTOM METHODS FOR scheduleOrder ARRAY
|
|
312
|
+
* Note: These methods modify the scheduleOrder array directly.
|
|
313
|
+
* The Company instance itself is not updated by these methods.
|
|
314
|
+
* Use the provided public methods to interact with scheduleOrder.
|
|
315
|
+
*************************************************************************/
|
|
316
|
+
Object.defineProperties(this.scheduleOrder, {
|
|
317
|
+
/**
|
|
318
|
+
* Inserts a new ScheduleOrder into the `scheduleOrder` array.
|
|
319
|
+
* @param {Object} params - The parameters for the ScheduleOrder.
|
|
320
|
+
* @param {string} params.siteId - The ID of the site.
|
|
321
|
+
* @param {string} params.shiftType - The shift type associated with the site.
|
|
322
|
+
* @param {number} [index=-1] - The position to insert the new ScheduleOrder. Defaults to the end.
|
|
323
|
+
* @returns {ScheduleOrder} The newly created ScheduleOrder instance.
|
|
324
|
+
* @throws {Error} If a ScheduleOrder with the same key already exists.
|
|
325
|
+
*/
|
|
326
|
+
add: {
|
|
327
|
+
value: function ({ siteId, shiftType }, index = -1) {
|
|
328
|
+
const newOrder = new ScheduleOrder({ siteId, shiftType });
|
|
329
|
+
if (this.some((order) => order.key === newOrder.key)) {
|
|
330
|
+
throw new Error(
|
|
331
|
+
`ScheduleOrder with key ${newOrder.key} already exists.`,
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
index === -1 ? this.push(newOrder) : this.splice(index, 0, newOrder);
|
|
335
|
+
return newOrder;
|
|
336
|
+
},
|
|
337
|
+
writable: false,
|
|
338
|
+
enumerable: false,
|
|
339
|
+
configurable: true,
|
|
340
|
+
},
|
|
341
|
+
/**
|
|
342
|
+
* Changes the order of a ScheduleOrder in the scheduleOrder array.
|
|
343
|
+
* Note: Company instance does not be updated by this method.
|
|
344
|
+
* @param {number} oldIndex - The current index of the ScheduleOrder.
|
|
345
|
+
* @param {number} newIndex - The new index to move the ScheduleOrder to.
|
|
346
|
+
* @returns {void}
|
|
347
|
+
* @throws {Error} If oldIndex or newIndex are out of bounds.
|
|
348
|
+
*/
|
|
349
|
+
change: {
|
|
350
|
+
value: function (oldIndex, newIndex) {
|
|
351
|
+
const length = this.length;
|
|
352
|
+
if (oldIndex < 0 || oldIndex >= length) {
|
|
353
|
+
throw new Error("Invalid oldIndex for site order change.");
|
|
354
|
+
}
|
|
355
|
+
if (newIndex < 0 || newIndex >= length) {
|
|
356
|
+
throw new Error("Invalid newIndex for site order change.");
|
|
357
|
+
}
|
|
358
|
+
const [movedOrder] = this.splice(oldIndex, 1);
|
|
359
|
+
this.splice(newIndex, 0, movedOrder);
|
|
360
|
+
},
|
|
361
|
+
writable: false,
|
|
362
|
+
enumerable: false,
|
|
363
|
+
configurable: true,
|
|
364
|
+
},
|
|
365
|
+
/**
|
|
366
|
+
* Removes a ScheduleOrder from the scheduleOrder array.
|
|
367
|
+
* Note: Company instance does not be updated by this method.
|
|
368
|
+
* @param {string|Object} arg - The key or {siteId, shiftType} of the ScheduleOrder to remove.
|
|
369
|
+
* @returns {void}
|
|
370
|
+
* @throws {Error} If the ScheduleOrder does not exist or if the argument is invalid.
|
|
371
|
+
*/
|
|
372
|
+
remove: {
|
|
373
|
+
value: function (arg) {
|
|
374
|
+
let key = "";
|
|
375
|
+
if (typeof arg === "string") {
|
|
376
|
+
key = arg;
|
|
377
|
+
} else if (typeof arg === "object" && arg.siteId && arg.shiftType) {
|
|
378
|
+
key = `${arg.siteId}_${arg.shiftType}`;
|
|
379
|
+
} else {
|
|
380
|
+
throw new Error(
|
|
381
|
+
"Invalid argument for remove. Must be a string key or an object with siteId and shiftType.",
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
const index = this.findIndex((order) => order.key === key);
|
|
386
|
+
if (index === -1) {
|
|
387
|
+
throw new Error(`ScheduleOrder with key ${key} does not exist.`);
|
|
263
388
|
}
|
|
264
389
|
|
|
265
390
|
this.splice(index, 1);
|
|
@@ -272,6 +397,18 @@ export default class Company extends GeocodableMixin(FireModel) {
|
|
|
272
397
|
}
|
|
273
398
|
|
|
274
399
|
/***************************************************************************
|
|
275
|
-
*
|
|
400
|
+
* FOR DEPRECATED PROPERTIES
|
|
276
401
|
***************************************************************************/
|
|
402
|
+
get agreements() {
|
|
403
|
+
console.warn(
|
|
404
|
+
"Warning: `agreements` is deprecated. Use `agreementsV2` instead.",
|
|
405
|
+
);
|
|
406
|
+
return [];
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
set agreements(newValue) {
|
|
410
|
+
console.warn(
|
|
411
|
+
"Warning: `agreements` is deprecated. Use `agreementsV2` instead.",
|
|
412
|
+
);
|
|
413
|
+
}
|
|
277
414
|
}
|
package/src/Customer.js
CHANGED
|
@@ -1,24 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
* Customer
|
|
3
|
-
* @
|
|
4
|
-
* @description This module defines the Customer model for managing customer data.
|
|
5
|
-
* @hasMany Sites - related sites associated with the customer
|
|
1
|
+
/*****************************************************************************
|
|
2
|
+
* @class Customer
|
|
3
|
+
* @extends FireModel
|
|
6
4
|
* @author shisyamo4131
|
|
7
|
-
*
|
|
8
|
-
|
|
5
|
+
*
|
|
6
|
+
* @property {string} code - customer code
|
|
7
|
+
* @property {string} name - customer name
|
|
8
|
+
* @property {string} branchName - 支店名などの会社名の補足情報
|
|
9
|
+
* @property {string} abbreviation - 会社名略称
|
|
10
|
+
* @property {string} nameKana - customer name in kana
|
|
11
|
+
* @property {string} zipcode - postal code
|
|
12
|
+
* @property {string} prefCode - prefecture code
|
|
13
|
+
* @property {string} city - city name
|
|
14
|
+
* @property {string} address - address details
|
|
15
|
+
* @property {string} building - building name
|
|
16
|
+
* @property {object} location - geographical location
|
|
17
|
+
* @property {string} tel - telephone number
|
|
18
|
+
* @property {string} fax - fax number
|
|
19
|
+
* @property {string} contractStatus - contract status
|
|
20
|
+
* @property {number} paymentMonth - payment site in months
|
|
21
|
+
* @property {string} paymentDate - payment site date
|
|
22
|
+
* @property {string} remarks - additional remarks
|
|
23
|
+
*
|
|
24
|
+
* @readonly
|
|
25
|
+
* @property {string} fullAddress - full address combining prefecture, city, and address (read-only)
|
|
26
|
+
* @property {string} prefecture - prefecture name derived from `prefCode` (read-only)
|
|
27
|
+
*
|
|
28
|
+
* @static
|
|
29
|
+
* @property {object} STATUS - constant mapping for contract statuses
|
|
30
|
+
* @property {string} STATUS_ACTIVE - constant for active contract status
|
|
31
|
+
* @property {string} STATUS_TERMINATED - constant for terminated contract status
|
|
32
|
+
*
|
|
33
|
+
* @method getPaymentDueDateAt
|
|
34
|
+
*****************************************************************************/
|
|
9
35
|
import FireModel from "@shisyamo4131/air-firebase-v2";
|
|
10
36
|
import { defField } from "./parts/fieldDefinitions.js";
|
|
11
37
|
import { defAccessor } from "./parts/accessorDefinitions.js";
|
|
12
38
|
import CutoffDate from "./utils/CutoffDate.js";
|
|
13
|
-
import {
|
|
14
|
-
CONTRACT_STATUS_VALUES,
|
|
15
|
-
PAYMENT_MONTH_OPTIONS,
|
|
16
|
-
} from "./constants/index.js";
|
|
39
|
+
import { CONTRACT_STATUS_VALUES } from "./constants/index.js";
|
|
17
40
|
import { GeocodableMixin } from "./mixins/GeocodableMixin.js";
|
|
18
41
|
|
|
19
42
|
const classProps = {
|
|
20
43
|
code: defField("code", { label: "取引先コード" }),
|
|
21
44
|
name: defField("name", { label: "取引先名", required: true }),
|
|
45
|
+
branchName: defField("branchName", { required: false }),
|
|
46
|
+
abbreviation: defField("abbreviation", { required: true }),
|
|
22
47
|
nameKana: defField("nameKana", { label: "取引先名(カナ)", required: true }),
|
|
23
48
|
zipcode: defField("zipcode", { required: true }),
|
|
24
49
|
prefCode: defField("prefCode", { required: true }),
|
|
@@ -30,58 +55,13 @@ const classProps = {
|
|
|
30
55
|
fax: defField("fax", { colsDefinition: { cols: 12, sm: 6 } }),
|
|
31
56
|
contractStatus: defField("contractStatus", { required: true }),
|
|
32
57
|
cutoffDate: defField("cutoffDate", { required: true }),
|
|
33
|
-
paymentMonth: defField("
|
|
34
|
-
|
|
35
|
-
label: "入金サイト(月数)",
|
|
36
|
-
required: true,
|
|
37
|
-
component: {
|
|
38
|
-
attrs: {
|
|
39
|
-
items: PAYMENT_MONTH_OPTIONS,
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
}),
|
|
43
|
-
paymentDate: defField("select", {
|
|
44
|
-
label: "入金サイト(日付)",
|
|
45
|
-
default: CutoffDate.VALUES[0].value,
|
|
46
|
-
required: true,
|
|
47
|
-
component: {
|
|
48
|
-
attrs: {
|
|
49
|
-
items: CutoffDate.OPTIONS,
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
}),
|
|
58
|
+
paymentMonth: defField("paymentMonth", { required: true }),
|
|
59
|
+
paymentDate: defField("paymentDate", { required: true }),
|
|
53
60
|
remarks: defField("multipleLine", { label: "備考" }),
|
|
54
61
|
};
|
|
55
62
|
|
|
56
63
|
/*****************************************************************************
|
|
57
|
-
*
|
|
58
|
-
* @prop {string} name - customer name
|
|
59
|
-
* @prop {string} nameKana - customer name in kana
|
|
60
|
-
* @prop {string} zipcode - postal code
|
|
61
|
-
* @prop {string} prefCode - prefecture code
|
|
62
|
-
* @prop {string} city - city name
|
|
63
|
-
* @prop {string} address - address details
|
|
64
|
-
* @prop {string} building - building name
|
|
65
|
-
* @prop {object} location - geographical location
|
|
66
|
-
* @prop {string} tel - telephone number
|
|
67
|
-
* @prop {string} fax - fax number
|
|
68
|
-
* @prop {string} contractStatus - contract status
|
|
69
|
-
* @prop {number} paymentMonth - payment site in months
|
|
70
|
-
* @prop {string} paymentDate - payment site date
|
|
71
|
-
* @prop {string} remarks - additional remarks
|
|
72
|
-
*
|
|
73
|
-
* @readonly
|
|
74
|
-
* @prop {string} fullAddress - full address combining prefecture, city, and address (read-only)
|
|
75
|
-
* @prop {string} prefecture - prefecture name derived from `prefCode` (read-only)
|
|
76
|
-
*
|
|
77
|
-
* @static
|
|
78
|
-
* @prop {object} STATUS - constant mapping for contract statuses
|
|
79
|
-
* @prop {string} STATUS_ACTIVE - constant for active contract status
|
|
80
|
-
* @prop {string} STATUS_TERMINATED - constant for terminated contract status
|
|
81
|
-
*
|
|
82
|
-
* @method getPaymentDueDateAt
|
|
83
|
-
* @param {Date} baseDate - base date in UTC (JST - 9 hours)
|
|
84
|
-
* @returns {Date} payment due date in UTC (JST - 9 hours)
|
|
64
|
+
* CUSTOMER
|
|
85
65
|
*****************************************************************************/
|
|
86
66
|
export default class Customer extends GeocodableMixin(FireModel) {
|
|
87
67
|
static className = "取引先";
|