@shisyamo4131/air-guard-v2-schemas 1.0.0
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 +15 -0
- package/package.json +44 -0
- package/src/Agreement.js +262 -0
- package/src/ArrangementNotification.js +505 -0
- package/src/Billing.js +159 -0
- package/src/Company.js +176 -0
- package/src/Customer.js +98 -0
- package/src/Employee.js +201 -0
- package/src/Operation.js +779 -0
- package/src/OperationBilling.js +193 -0
- package/src/OperationDetail.js +147 -0
- package/src/OperationResult.js +437 -0
- package/src/OperationResultDetail.js +72 -0
- package/src/Outsourcer.js +46 -0
- package/src/RoundSetting.js +123 -0
- package/src/Site.js +192 -0
- package/src/SiteOperationSchedule.js +503 -0
- package/src/SiteOperationScheduleDetail.js +99 -0
- package/src/SiteOrder.js +62 -0
- package/src/Tax.js +39 -0
- package/src/User.js +41 -0
- package/src/WorkingResult.js +297 -0
- package/src/apis/index.js +9 -0
- package/src/constants/arrangement-notification-status.js +68 -0
- package/src/constants/billing-unit-type.js +15 -0
- package/src/constants/contract-status.js +15 -0
- package/src/constants/day-type.js +44 -0
- package/src/constants/employment-status.js +15 -0
- package/src/constants/gender.js +11 -0
- package/src/constants/index.js +9 -0
- package/src/constants/prefectures.js +56 -0
- package/src/constants/shift-type.js +20 -0
- package/src/constants/site-status.js +15 -0
- package/src/parts/accessorDefinitions.js +109 -0
- package/src/parts/fieldDefinitions.js +642 -0
- package/src/utils/ContextualError.js +49 -0
- package/src/utils/CutoffDate.js +223 -0
- package/src/utils/index.js +48 -0
package/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { default as Agreement } from "./src/Agreement.js";
|
|
2
|
+
export { default as ArrangementNotification } from "./src/ArrangementNotification.js";
|
|
3
|
+
export { default as Company } from "./src/Company.js";
|
|
4
|
+
export { default as Customer, CustomerMinimal } from "./src/Customer.js";
|
|
5
|
+
export { default as Employee } from "./src/Employee.js";
|
|
6
|
+
export { default as OperationBilling } from "./src/OperationBilling.js";
|
|
7
|
+
export { default as OperationResult } from "./src/OperationResult.js";
|
|
8
|
+
export { default as OperationResultDetail } from "./src/OperationResultDetail.js";
|
|
9
|
+
export { default as Outsourcer } from "./src/Outsourcer.js";
|
|
10
|
+
export { default as RoundSetting } from "./src/RoundSetting.js";
|
|
11
|
+
export { default as Site } from "./src/Site.js";
|
|
12
|
+
export { default as SiteOperationSchedule } from "./src/SiteOperationSchedule.js";
|
|
13
|
+
export { default as SiteOperationScheduleDetail } from "./src/SiteOperationScheduleDetail.js";
|
|
14
|
+
export { default as SiteOrder } from "./src/SiteOrder.js";
|
|
15
|
+
export { default as User } from "./src/User.js";
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@shisyamo4131/air-guard-v2-schemas",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Schemas for AirGuard V2",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./index.js",
|
|
9
|
+
"./constants": "./src/constants/index.js",
|
|
10
|
+
"./apis": "./src/apis/index.js",
|
|
11
|
+
"./utils": "./src/utils/index.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"index.js",
|
|
15
|
+
"src/**/*.js",
|
|
16
|
+
"!**/*.test.js",
|
|
17
|
+
"!**/*.spec.js",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"keywords": [
|
|
21
|
+
"airguard",
|
|
22
|
+
"schemas",
|
|
23
|
+
"firestore",
|
|
24
|
+
"models"
|
|
25
|
+
],
|
|
26
|
+
"author": "shisyamo4131",
|
|
27
|
+
"license": "ISC",
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/shisyamo4131/air-guard-v2-schemas.git"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"@shisyamo4131/air-firebase-v2": "^1.0.0"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@holiday-jp/holiday_jp": "^2.5.1"
|
|
43
|
+
}
|
|
44
|
+
}
|
package/src/Agreement.js
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/*****************************************************************************
|
|
2
|
+
* Agreement Model ver 1.0.0
|
|
3
|
+
* @author shisyamo4131
|
|
4
|
+
* ---------------------------------------------------------------------------
|
|
5
|
+
* A class to manage agreement details based on WorkingResult.
|
|
6
|
+
* ---------------------------------------------------------------------------
|
|
7
|
+
* @props {number} unitPriceBase - Base unit price (JPY)
|
|
8
|
+
* @props {number} overtimeUnitPriceBase - Overtime unit price (JPY/hour)
|
|
9
|
+
* @props {number} unitPriceQualified - Qualified unit price (JPY)
|
|
10
|
+
* @props {number} overtimeUnitPriceQualified - Qualified overtime unit price (JPY/hour)
|
|
11
|
+
* @props {string} billingUnitType - Billing unit type
|
|
12
|
+
* @props {boolean} includeBreakInBilling - Whether to include break time in billing if `billingUnitType` is `PER_HOUR`.
|
|
13
|
+
* @props {number} cutoffDate - Cutoff date value from CutoffDate.VALUES
|
|
14
|
+
* - The cutoff date for billing, using values defined in the CutoffDate utility class.
|
|
15
|
+
* ---------------------------------------------------------------------------
|
|
16
|
+
* @getter {Object} prices - Object containing price-related properties (read-only)
|
|
17
|
+
* - Returns an object with all price-related properties for synchronizing details.
|
|
18
|
+
* - Useful for creating `OperationResult` instances from `SiteOperationSchedule`.
|
|
19
|
+
* - Includes: regulationWorkMinutes, unitPriceBase, overtimeUnitPriceBase,
|
|
20
|
+
* unitPriceQualified, overtimeUnitPriceQualified, billingUnitType, includeBreakInBilling
|
|
21
|
+
* ---------------------------------------------------------------------------
|
|
22
|
+
* @inherited - The following properties are inherited from WorkingResult:
|
|
23
|
+
* @props {Date} dateAt - Applicable start date (trigger property)
|
|
24
|
+
* @props {string} dayType - Day type (e.g., `WEEKDAY`, `WEEKEND`, `HOLIDAY`)
|
|
25
|
+
* @props {string} shiftType - Shift type (`DAY`, `NIGHT`)
|
|
26
|
+
* @props {string} startTime - Start time (HH:MM format)
|
|
27
|
+
* @props {boolean} isStartNextDay - Next day start flag
|
|
28
|
+
* - `true` if the actual work starts the day after the placement date `dateAt`
|
|
29
|
+
* @props {string} endTime - End time (HH:MM format)
|
|
30
|
+
* @props {number} breakMinutes - Break time (minutes)
|
|
31
|
+
* @props {number} regulationWorkMinutes - Regulation work minutes
|
|
32
|
+
* - The maximum working time defined by `unitPriceBase` (or `unitPriceQualified`).
|
|
33
|
+
* - Exceeding this time is considered overtime.
|
|
34
|
+
* ---------------------------------------------------------------------------
|
|
35
|
+
* @inherited - The following computed properties are inherited from WorkingResult:
|
|
36
|
+
* @computed {string} key - Unique key combining `date`, `dayType`, and `shiftType` (read-only)
|
|
37
|
+
* - A unique identifier for the working result, combining `date`, `dayType`, and `shiftType`.
|
|
38
|
+
* @computed {string} date - Date string in YYYY-MM-DD format based on `dateAt` (read-only)
|
|
39
|
+
* - Returns a string in the format YYYY-MM-DD based on `dateAt`.
|
|
40
|
+
* @computed {boolean} isSpansNextDay - Flag indicating whether the date spans from start date to end date (read-only)
|
|
41
|
+
* - `true` if `startTime` is later than `endTime`
|
|
42
|
+
* @computed {Date} startAt - Start date and time (Date object) (read-only)
|
|
43
|
+
* - Returns a Date object with `startTime` set based on `dateAt`.
|
|
44
|
+
* - If `isStartNextDay` is true, add 1 day.
|
|
45
|
+
* @computed {Date} endAt - End date and time (Date object) (read-only)
|
|
46
|
+
* - Returns a Date object with `endTime` set based on `dateAt`.
|
|
47
|
+
* - If `isStartNextDay` is true, add 1 day.
|
|
48
|
+
* - If `isSpansNextDay` is true, add 1 day.
|
|
49
|
+
* @computed {number} totalWorkMinutes - Total working time in minutes (excluding break time) (read-only)
|
|
50
|
+
* - Calculated as the difference between `endAt` and `startAt` minus `breakMinutes`
|
|
51
|
+
* - If the difference between `endAt` and `startAt` is negative, returns 0.
|
|
52
|
+
* - If `startAt` or `endAt` is not set, returns 0.
|
|
53
|
+
* @computed {number} regularTimeWorkMinutes - Regular working time in minutes (read-only)
|
|
54
|
+
* - The portion of `totalWorkMinutes` that is considered within the contract's `regulationWorkMinutes`.
|
|
55
|
+
* - If actual working time is less than regulation time (e.g., early leave), it equals `totalWorkMinutes`.
|
|
56
|
+
* - If actual working time exceeds regulation time (overtime), it equals `regulationWorkMinutes`.
|
|
57
|
+
* @computed {number} overtimeWorkMinutes - Overtime work in minutes (read-only)
|
|
58
|
+
* - Calculated as `totalWorkMinutes` minus `regulationWorkMinutes`
|
|
59
|
+
* - Overtime work is not negative; the minimum is 0.
|
|
60
|
+
* ---------------------------------------------------------------------------
|
|
61
|
+
* @inherited - The following getter properties are inherited from WorkingResult:
|
|
62
|
+
* @getter {number} startHour - Start hour (0-23) (read-only)
|
|
63
|
+
* - Extracted from `startTime`.
|
|
64
|
+
* @getter {number} startMinute - Start minute (0-59) (read-only)
|
|
65
|
+
* - Extracted from `startTime`.
|
|
66
|
+
* @getter {number} endHour - End hour (0-23) (read-only)
|
|
67
|
+
* - Extracted from `endTime`.
|
|
68
|
+
* @getter {number} endMinute - End minute (0-59) (read-only)
|
|
69
|
+
* - Extracted from `endTime`.
|
|
70
|
+
* ---------------------------------------------------------------------------
|
|
71
|
+
* @inherited - The following method is inherited from WorkingResult:
|
|
72
|
+
* @method {function} setDateAtCallback - Callback method called when `dateAt` is set
|
|
73
|
+
* - Override this method in subclasses to add custom behavior when `dateAt` changes.
|
|
74
|
+
* - By default, updates `dayType` based on the new `dateAt` value.
|
|
75
|
+
* - @param {Date} v - The new `dateAt` value
|
|
76
|
+
*****************************************************************************/
|
|
77
|
+
import WorkingResult from "./WorkingResult.js";
|
|
78
|
+
import { DAY_TYPE } from "./constants/day-type.js";
|
|
79
|
+
import { SHIFT_TYPE } from "./constants/shift-type.js";
|
|
80
|
+
import {
|
|
81
|
+
BILLING_UNIT_TYPE,
|
|
82
|
+
BILLING_UNIT_TYPE_ARRAY,
|
|
83
|
+
BILLING_UNIT_TYPE_DEFAULT,
|
|
84
|
+
} from "./constants/billing-unit-type.js";
|
|
85
|
+
import { defField } from "./parts/fieldDefinitions.js";
|
|
86
|
+
import CutoffDate from "./utils/CutoffDate.js";
|
|
87
|
+
|
|
88
|
+
const classProps = {
|
|
89
|
+
...WorkingResult.classProps,
|
|
90
|
+
unitPriceBase: defField("price", { label: "基本単価", required: true }),
|
|
91
|
+
overtimeUnitPriceBase: defField("price", {
|
|
92
|
+
label: "時間外単価",
|
|
93
|
+
required: true,
|
|
94
|
+
}),
|
|
95
|
+
unitPriceQualified: defField("price", {
|
|
96
|
+
label: "資格者単価",
|
|
97
|
+
required: true,
|
|
98
|
+
}),
|
|
99
|
+
overtimeUnitPriceQualified: defField("price", {
|
|
100
|
+
label: "資格者時間外単価",
|
|
101
|
+
required: true,
|
|
102
|
+
}),
|
|
103
|
+
billingUnitType: defField("select", {
|
|
104
|
+
default: BILLING_UNIT_TYPE_DEFAULT,
|
|
105
|
+
label: "請求単位",
|
|
106
|
+
required: true,
|
|
107
|
+
component: {
|
|
108
|
+
attrs: {
|
|
109
|
+
items: BILLING_UNIT_TYPE_ARRAY,
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
}),
|
|
113
|
+
includeBreakInBilling: defField("check", {
|
|
114
|
+
label: "請求に休憩時間を含める",
|
|
115
|
+
default: false,
|
|
116
|
+
}),
|
|
117
|
+
cutoffDate: defField("select", {
|
|
118
|
+
label: "締日区分",
|
|
119
|
+
default: CutoffDate.VALUES.END_OF_MONTH,
|
|
120
|
+
required: true,
|
|
121
|
+
component: {
|
|
122
|
+
attrs: {
|
|
123
|
+
items: CutoffDate.OPTIONS,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
}),
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Table headers for displaying agreement details
|
|
131
|
+
*/
|
|
132
|
+
const headers = [
|
|
133
|
+
{
|
|
134
|
+
title: "適用開始日",
|
|
135
|
+
key: "dateAt",
|
|
136
|
+
value: (item) => item.dateAt.toLocaleDateString(),
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
title: "締日",
|
|
140
|
+
key: "cutoffDate",
|
|
141
|
+
value: (item) => {
|
|
142
|
+
return CutoffDate.getDisplayText(item.cutoffDate);
|
|
143
|
+
},
|
|
144
|
+
align: "center",
|
|
145
|
+
sortable: false,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
title: "区分",
|
|
149
|
+
key: "type",
|
|
150
|
+
value: (item) =>
|
|
151
|
+
`${DAY_TYPE[item.dayType]}${SHIFT_TYPE[item.shiftType].title}`,
|
|
152
|
+
align: "center",
|
|
153
|
+
sortable: false,
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
title: "勤務時間",
|
|
157
|
+
key: "time",
|
|
158
|
+
value: (item) => `${item.startTime} ~ ${item.endTime}`,
|
|
159
|
+
align: "center",
|
|
160
|
+
sortable: false,
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
title: "規定実働時間",
|
|
164
|
+
key: "regulationWorkMinutes",
|
|
165
|
+
value: (item) => `${item.regulationWorkMinutes}分`,
|
|
166
|
+
align: "center",
|
|
167
|
+
sortable: false,
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
title: "休憩時間",
|
|
171
|
+
key: "breakMinutes",
|
|
172
|
+
value: (item) => `${item.breakMinutes}分`,
|
|
173
|
+
align: "center",
|
|
174
|
+
sortable: false,
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
title: "残業時間",
|
|
178
|
+
key: "overtimeWorkMinutes",
|
|
179
|
+
value: (item) => `${item.overtimeWorkMinutes}分`,
|
|
180
|
+
align: "center",
|
|
181
|
+
sortable: false,
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
title: "通常",
|
|
185
|
+
align: "center",
|
|
186
|
+
children: [
|
|
187
|
+
{
|
|
188
|
+
title: "単価",
|
|
189
|
+
key: "unitPriceBase",
|
|
190
|
+
value: (item) => item.unitPriceBase.toLocaleString(),
|
|
191
|
+
align: "center",
|
|
192
|
+
sortable: false,
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
title: "時間外",
|
|
196
|
+
key: "overtimeUnitPriceBase",
|
|
197
|
+
value: (item) => item.overtimeUnitPriceBase.toLocaleString(),
|
|
198
|
+
align: "center",
|
|
199
|
+
sortable: false,
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
title: "資格者",
|
|
205
|
+
align: "center",
|
|
206
|
+
children: [
|
|
207
|
+
{
|
|
208
|
+
title: "単価",
|
|
209
|
+
key: "unitPriceQualified",
|
|
210
|
+
value: (item) => item.unitPriceQualified.toLocaleString(),
|
|
211
|
+
align: "center",
|
|
212
|
+
sortable: false,
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
title: "時間外",
|
|
216
|
+
key: "overtimeUnitPriceQualified",
|
|
217
|
+
value: (item) => item.overtimeUnitPriceQualified.toLocaleString(),
|
|
218
|
+
align: "center",
|
|
219
|
+
sortable: false,
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
title: "請求単位",
|
|
225
|
+
key: "billingUnitType",
|
|
226
|
+
value: (item) => BILLING_UNIT_TYPE[item.billingUnitType],
|
|
227
|
+
align: "center",
|
|
228
|
+
sortable: false,
|
|
229
|
+
},
|
|
230
|
+
];
|
|
231
|
+
|
|
232
|
+
export default class Agreement extends WorkingResult {
|
|
233
|
+
static className = "取極め";
|
|
234
|
+
static classProps = classProps;
|
|
235
|
+
static headers = headers;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Returns an object containing price-related properties.
|
|
239
|
+
* This accessor is useful for synchronizing price details when creating `OperationResult` instance
|
|
240
|
+
* from a `SiteOperationSchedule`.
|
|
241
|
+
* - Includes `regulationWorkMinutes`.
|
|
242
|
+
* @returns {Object} An object with price-related properties.
|
|
243
|
+
* @property {number} regulationWorkMinutes - Regulation work minutes
|
|
244
|
+
* @property {number} unitPriceBase - Base unit price
|
|
245
|
+
* @property {number} overtimeUnitPriceBase - Overtime base unit price
|
|
246
|
+
* @property {number} unitPriceQualified - Qualified unit price
|
|
247
|
+
* @property {number} overtimeUnitPriceQualified - Overtime qualified unit price
|
|
248
|
+
* @property {string} billingUnitType - Billing unit type
|
|
249
|
+
* @property {boolean} includeBreakInBilling - Whether to include break time in billing
|
|
250
|
+
*/
|
|
251
|
+
get prices() {
|
|
252
|
+
return {
|
|
253
|
+
regulationWorkMinutes: this.regulationWorkMinutes,
|
|
254
|
+
unitPriceBase: this.unitPriceBase,
|
|
255
|
+
overtimeUnitPriceBase: this.overtimeUnitPriceBase,
|
|
256
|
+
unitPriceQualified: this.unitPriceQualified,
|
|
257
|
+
overtimeUnitPriceQualified: this.overtimeUnitPriceQualified,
|
|
258
|
+
billingUnitType: this.billingUnitType,
|
|
259
|
+
includeBreakInBilling: this.includeBreakInBilling,
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
}
|