@shisyamo4131/air-guard-v2-schemas 2.3.7-dev.43 → 2.3.7-dev.45
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/Agreement.js +6 -16
- package/src/Customer.js +11 -15
- package/src/constants/index.js +4 -0
- package/src/constants/payment-month.js +21 -0
- package/src/parts/fieldDefinitions.js +12 -0
- package/src/utils/CutoffDate.js +14 -14
package/package.json
CHANGED
package/src/Agreement.js
CHANGED
|
@@ -76,11 +76,10 @@
|
|
|
76
76
|
*****************************************************************************/
|
|
77
77
|
import WorkingResult from "./WorkingResult.js";
|
|
78
78
|
import {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
} from "./constants/
|
|
79
|
+
BILLING_UNIT_TYPE_VALUES,
|
|
80
|
+
BILLING_UNIT_TYPE_OPTIONS,
|
|
81
|
+
} from "./constants/index.js";
|
|
82
82
|
import { defField } from "./parts/fieldDefinitions.js";
|
|
83
|
-
import CutoffDate from "./utils/CutoffDate.js";
|
|
84
83
|
|
|
85
84
|
const classProps = {
|
|
86
85
|
...WorkingResult.classProps,
|
|
@@ -98,7 +97,7 @@ const classProps = {
|
|
|
98
97
|
required: true,
|
|
99
98
|
}),
|
|
100
99
|
billingUnitType: defField("select", {
|
|
101
|
-
default:
|
|
100
|
+
default: BILLING_UNIT_TYPE_VALUES.PER_DAY.value,
|
|
102
101
|
label: "請求単位",
|
|
103
102
|
required: true,
|
|
104
103
|
component: {
|
|
@@ -111,23 +110,14 @@ const classProps = {
|
|
|
111
110
|
label: "請求に休憩時間を含める",
|
|
112
111
|
default: false,
|
|
113
112
|
}),
|
|
114
|
-
cutoffDate: defField("
|
|
115
|
-
label: "締日区分",
|
|
116
|
-
default: CutoffDate.VALUES.END_OF_MONTH,
|
|
117
|
-
required: true,
|
|
118
|
-
component: {
|
|
119
|
-
attrs: {
|
|
120
|
-
items: CutoffDate.OPTIONS,
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
}),
|
|
113
|
+
cutoffDate: defField("cutoffDate", { required: true }),
|
|
124
114
|
};
|
|
125
115
|
|
|
126
116
|
export default class Agreement extends WorkingResult {
|
|
127
117
|
static className = "取極め";
|
|
128
118
|
static classProps = classProps;
|
|
129
119
|
|
|
130
|
-
static BILLING_UNIT_TYPE =
|
|
120
|
+
static BILLING_UNIT_TYPE = BILLING_UNIT_TYPE_VALUES;
|
|
131
121
|
|
|
132
122
|
/**
|
|
133
123
|
* Returns an object containing price-related properties.
|
package/src/Customer.js
CHANGED
|
@@ -9,8 +9,11 @@
|
|
|
9
9
|
import FireModel from "@shisyamo4131/air-firebase-v2";
|
|
10
10
|
import { defField } from "./parts/fieldDefinitions.js";
|
|
11
11
|
import { defAccessor } from "./parts/accessorDefinitions.js";
|
|
12
|
-
import { VALUES } from "./constants/contract-status.js";
|
|
13
12
|
import CutoffDate from "./utils/CutoffDate.js";
|
|
13
|
+
import {
|
|
14
|
+
CONTRACT_STATUS_VALUES,
|
|
15
|
+
PAYMENT_MONTH_OPTIONS,
|
|
16
|
+
} from "./constants/index.js";
|
|
14
17
|
|
|
15
18
|
const classProps = {
|
|
16
19
|
code: defField("code", { label: "取引先コード" }),
|
|
@@ -25,27 +28,20 @@ const classProps = {
|
|
|
25
28
|
tel: defField("tel", { colsDefinition: { cols: 12, sm: 6 } }),
|
|
26
29
|
fax: defField("fax", { colsDefinition: { cols: 12, sm: 6 } }),
|
|
27
30
|
contractStatus: defField("contractStatus", { required: true }),
|
|
31
|
+
cutoffDate: defField("cutoffDate", { required: true }),
|
|
28
32
|
paymentMonth: defField("select", {
|
|
29
33
|
default: 1,
|
|
30
34
|
label: "入金サイト(月数)",
|
|
31
35
|
required: true,
|
|
32
36
|
component: {
|
|
33
37
|
attrs: {
|
|
34
|
-
items:
|
|
35
|
-
{ title: "当月", value: 0 },
|
|
36
|
-
{ title: "翌月", value: 1 },
|
|
37
|
-
{ title: "翌々月", value: 2 },
|
|
38
|
-
{ title: "3ヶ月後", value: 3 },
|
|
39
|
-
{ title: "4ヶ月後", value: 4 },
|
|
40
|
-
{ title: "5ヶ月後", value: 5 },
|
|
41
|
-
{ title: "6ヶ月後", value: 6 },
|
|
42
|
-
],
|
|
38
|
+
items: PAYMENT_MONTH_OPTIONS,
|
|
43
39
|
},
|
|
44
40
|
},
|
|
45
41
|
}),
|
|
46
42
|
paymentDate: defField("select", {
|
|
47
43
|
label: "入金サイト(日付)",
|
|
48
|
-
default: CutoffDate.VALUES.
|
|
44
|
+
default: CutoffDate.VALUES[0].value,
|
|
49
45
|
required: true,
|
|
50
46
|
component: {
|
|
51
47
|
attrs: {
|
|
@@ -108,9 +104,9 @@ export default class Customer extends FireModel {
|
|
|
108
104
|
{ key: "fullAddress", title: "所在地" },
|
|
109
105
|
];
|
|
110
106
|
|
|
111
|
-
static STATUS =
|
|
112
|
-
static STATUS_ACTIVE =
|
|
113
|
-
static STATUS_TERMINATED =
|
|
107
|
+
static STATUS = CONTRACT_STATUS_VALUES;
|
|
108
|
+
static STATUS_ACTIVE = CONTRACT_STATUS_VALUES.ACTIVE.value;
|
|
109
|
+
static STATUS_TERMINATED = CONTRACT_STATUS_VALUES.TERMINATED.value;
|
|
114
110
|
|
|
115
111
|
afterInitialize(item = {}) {
|
|
116
112
|
super.afterInitialize(item);
|
|
@@ -139,7 +135,7 @@ export default class Customer extends FireModel {
|
|
|
139
135
|
const finalMonth = targetMonth % 12;
|
|
140
136
|
|
|
141
137
|
let dueDate;
|
|
142
|
-
if (this.paymentDate === CutoffDate.VALUES.
|
|
138
|
+
if (this.paymentDate === CutoffDate.VALUES[0].value) {
|
|
143
139
|
// 月末の場合
|
|
144
140
|
dueDate = new Date(Date.UTC(targetYear, finalMonth + 1, 0));
|
|
145
141
|
} else {
|
package/src/constants/index.js
CHANGED
|
@@ -35,6 +35,10 @@ export {
|
|
|
35
35
|
VALUES as GENDER_VALUES,
|
|
36
36
|
OPTIONS as GENDER_OPTIONS,
|
|
37
37
|
} from "./gender.js";
|
|
38
|
+
export {
|
|
39
|
+
VALUES as PAYMENT_MONTH_VALUES,
|
|
40
|
+
OPTIONS as PAYMENT_MONTH_OPTIONS,
|
|
41
|
+
} from "./payment-month.js";
|
|
38
42
|
export {
|
|
39
43
|
VALUES as PREFECTURES_VALUES,
|
|
40
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
|
+
];
|
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
VALUES as SITE_STATUS_VALUES,
|
|
40
40
|
OPTIONS as SITE_STATUS_OPTIONS,
|
|
41
41
|
} from "../constants/site-status.js";
|
|
42
|
+
import CutoffDate from "../utils/CutoffDate.js";
|
|
42
43
|
|
|
43
44
|
export const DEFAULT_WORKING_MINUTES = 480;
|
|
44
45
|
export const DEFAULT_BREAK_MINUTES = 60;
|
|
@@ -537,6 +538,17 @@ export const fieldDefinitions = {
|
|
|
537
538
|
},
|
|
538
539
|
},
|
|
539
540
|
},
|
|
541
|
+
cutoffDate: {
|
|
542
|
+
...generalDefinitions.select,
|
|
543
|
+
default: CutoffDate.VALUES[0].value,
|
|
544
|
+
label: "締日",
|
|
545
|
+
component: {
|
|
546
|
+
name: generalDefinitions.select.component.name,
|
|
547
|
+
attrs: {
|
|
548
|
+
items: CutoffDate.OPTIONS,
|
|
549
|
+
},
|
|
550
|
+
},
|
|
551
|
+
},
|
|
540
552
|
dayType: {
|
|
541
553
|
...generalDefinitions.select,
|
|
542
554
|
default: DAY_TYPE_VALUES.WEEKDAY.value,
|
package/src/utils/CutoffDate.js
CHANGED
|
@@ -22,24 +22,24 @@ export default class CutoffDate {
|
|
|
22
22
|
* Cutoff date constant values
|
|
23
23
|
*/
|
|
24
24
|
static VALUES = Object.freeze({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
5: { value: 5, title: "5日" },
|
|
26
|
+
10: { value: 10, title: "10日" },
|
|
27
|
+
15: { value: 15, title: "15日" },
|
|
28
|
+
20: { value: 20, title: "20日" },
|
|
29
|
+
25: { value: 25, title: "25日" },
|
|
30
|
+
0: { value: 0, title: "月末" },
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Options for selection components
|
|
35
35
|
*/
|
|
36
36
|
static OPTIONS = [
|
|
37
|
-
{ title: "5日", value: CutoffDate.VALUES.
|
|
38
|
-
{ title: "10日", value: CutoffDate.VALUES.
|
|
39
|
-
{ title: "15日", value: CutoffDate.VALUES.
|
|
40
|
-
{ title: "20日", value: CutoffDate.VALUES.
|
|
41
|
-
{ title: "25日", value: CutoffDate.VALUES.
|
|
42
|
-
{ title: "月末", value: CutoffDate.VALUES.
|
|
37
|
+
{ title: "5日", value: CutoffDate.VALUES[5].value },
|
|
38
|
+
{ title: "10日", value: CutoffDate.VALUES[10].value },
|
|
39
|
+
{ title: "15日", value: CutoffDate.VALUES[15].value },
|
|
40
|
+
{ title: "20日", value: CutoffDate.VALUES[20].value },
|
|
41
|
+
{ title: "25日", value: CutoffDate.VALUES[25].value },
|
|
42
|
+
{ title: "月末", value: CutoffDate.VALUES[0].value },
|
|
43
43
|
];
|
|
44
44
|
|
|
45
45
|
/**
|
|
@@ -50,11 +50,11 @@ export default class CutoffDate {
|
|
|
50
50
|
* @returns {number} Actual cutoff day
|
|
51
51
|
* @example
|
|
52
52
|
* // Get cutoff day for February 2024 with month-end setting
|
|
53
|
-
* const cutoffDay = CutoffDate.calculateActualCutoffDay(2024, 1, CutoffDate.VALUES.
|
|
53
|
+
* const cutoffDay = CutoffDate.calculateActualCutoffDay(2024, 1, CutoffDate.VALUES[0].value);
|
|
54
54
|
* // Returns 29 (leap year)
|
|
55
55
|
*/
|
|
56
56
|
static calculateActualCutoffDay(year, month, cutoffDateValue) {
|
|
57
|
-
if (cutoffDateValue === CutoffDate.VALUES.
|
|
57
|
+
if (cutoffDateValue === CutoffDate.VALUES[0].value) {
|
|
58
58
|
// Get last day of the month using UTC
|
|
59
59
|
return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
|
|
60
60
|
}
|