@acorex-platform/module-timesheet-management-client 0.0.54 → 0.0.56
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/fesm2022/{acorex-platform-module-timesheet-management-client-admin-adjust-timesheet-period.command-8lA7h4rI.mjs → acorex-platform-module-timesheet-management-client-admin-adjust-timesheet-period.command-BYDzzIT7.mjs} +3 -3
- package/fesm2022/acorex-platform-module-timesheet-management-client-admin-adjust-timesheet-period.command-BYDzzIT7.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-timesheet-management-client-approve-timesheet-period.command-DlAeGANo.mjs → acorex-platform-module-timesheet-management-client-approve-timesheet-period.command-CbWpfp1p.mjs} +2 -2
- package/fesm2022/acorex-platform-module-timesheet-management-client-approve-timesheet-period.command-CbWpfp1p.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-timesheet-management-client-create-time-entry.command-DS2EVLym.mjs → acorex-platform-module-timesheet-management-client-create-time-entry.command-DQFyQCD9.mjs} +2 -2
- package/fesm2022/acorex-platform-module-timesheet-management-client-create-time-entry.command-DQFyQCD9.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-timesheet-management-client-delete-time-entry.command-5_ItHpnx.mjs → acorex-platform-module-timesheet-management-client-delete-time-entry.command-B1v2woFH.mjs} +2 -2
- package/fesm2022/acorex-platform-module-timesheet-management-client-delete-time-entry.command-B1v2woFH.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-timesheet-management-client-lock-timesheet-period.command-D7V7SWUK.mjs → acorex-platform-module-timesheet-management-client-lock-timesheet-period.command-BlUeTrr-.mjs} +2 -2
- package/fesm2022/acorex-platform-module-timesheet-management-client-lock-timesheet-period.command-BlUeTrr-.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-timesheet-management-client-reject-timesheet-period.command-CONxKPNm.mjs → acorex-platform-module-timesheet-management-client-reject-timesheet-period.command-BgMbKLEo.mjs} +3 -3
- package/fesm2022/acorex-platform-module-timesheet-management-client-reject-timesheet-period.command-BgMbKLEo.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-timesheet-management-client-reopen-timesheet-period.command-DRr_c67L.mjs → acorex-platform-module-timesheet-management-client-reopen-timesheet-period.command-B8FWCCU4.mjs} +2 -2
- package/fesm2022/acorex-platform-module-timesheet-management-client-reopen-timesheet-period.command-B8FWCCU4.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-timesheet-management-client-submit-timesheet-period.command-C2qlQVIC.mjs → acorex-platform-module-timesheet-management-client-submit-timesheet-period.command-DnsUqTIv.mjs} +2 -2
- package/fesm2022/acorex-platform-module-timesheet-management-client-submit-timesheet-period.command-DnsUqTIv.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-timesheet-management-client-update-time-entry.command-Do6s9OrI.mjs → acorex-platform-module-timesheet-management-client-update-time-entry.command-CoIUtLAn.mjs} +2 -2
- package/fesm2022/acorex-platform-module-timesheet-management-client-update-time-entry.command-CoIUtLAn.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client.mjs +18 -18
- package/i18n/en-AU/timesheet-management.json +263 -0
- package/i18n/en-US/timesheet-management.json +263 -0
- package/i18n/fa-IR/timesheet-management.json +263 -0
- package/package.json +1 -1
- package/fesm2022/acorex-platform-module-timesheet-management-client-admin-adjust-timesheet-period.command-8lA7h4rI.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-timesheet-management-client-approve-timesheet-period.command-DlAeGANo.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-timesheet-management-client-create-time-entry.command-DS2EVLym.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-timesheet-management-client-delete-time-entry.command-5_ItHpnx.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-timesheet-management-client-lock-timesheet-period.command-D7V7SWUK.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-timesheet-management-client-reject-timesheet-period.command-CONxKPNm.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-timesheet-management-client-reopen-timesheet-period.command-DRr_c67L.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-timesheet-management-client-submit-timesheet-period.command-C2qlQVIC.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-timesheet-management-client-update-time-entry.command-Do6s9OrI.mjs.map +0 -1
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
{
|
|
2
|
+
"module": {
|
|
3
|
+
"title": "مدیریت تایمشیت",
|
|
4
|
+
"description": "ثبت زمان روی آیتمهای کاری، ارسال دورهها و گزارشهای تایمشیت",
|
|
5
|
+
"menus": {
|
|
6
|
+
"configuration": {
|
|
7
|
+
"title": "پیکربندی تایمشیت"
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"features": {
|
|
12
|
+
"timesheet-entry": {
|
|
13
|
+
"title": "ثبت تایمشیت",
|
|
14
|
+
"description": "ثبت زمان شخصی و آیتمهای کاری"
|
|
15
|
+
},
|
|
16
|
+
"timesheet-approval": {
|
|
17
|
+
"title": "تأیید تایمشیت",
|
|
18
|
+
"description": "ارسال دوره و تأیید مدیر"
|
|
19
|
+
},
|
|
20
|
+
"timesheet-reporting": {
|
|
21
|
+
"title": "گزارش تایمشیت",
|
|
22
|
+
"description": "گزارش تایمشیت و تطبیق با حضور"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"pages": {
|
|
26
|
+
"my-timesheet": {
|
|
27
|
+
"title": "تایمشیت من",
|
|
28
|
+
"empty-period": "دوره تایمشیت باز برای هفته جاری وجود ندارد."
|
|
29
|
+
},
|
|
30
|
+
"approval-inbox": {
|
|
31
|
+
"title": "صندوق تأیید تایمشیت"
|
|
32
|
+
},
|
|
33
|
+
"team-timesheets": {
|
|
34
|
+
"title": "تایمشیت تیم"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"permissions": {
|
|
38
|
+
"group": {
|
|
39
|
+
"title": "مدیریت تایمشیت",
|
|
40
|
+
"description": "مدیریت تایمشیت، آیتمهای کاری و گزارشها"
|
|
41
|
+
},
|
|
42
|
+
"work-item": {
|
|
43
|
+
"management": { "title": "آیتمهای کاری", "description": "مدیریت فهرست آیتمهای کاری" },
|
|
44
|
+
"view": { "title": "مشاهده آیتمهای کاری" },
|
|
45
|
+
"create": { "title": "ایجاد آیتم کاری" },
|
|
46
|
+
"update": { "title": "ویرایش آیتم کاری" },
|
|
47
|
+
"delete": { "title": "حذف آیتم کاری" }
|
|
48
|
+
},
|
|
49
|
+
"timesheet-period": {
|
|
50
|
+
"management": { "title": "دورههای تایمشیت", "description": "مدیریت دورههای تایمشیت" },
|
|
51
|
+
"view": { "title": "مشاهده دورهها" },
|
|
52
|
+
"create": { "title": "ایجاد دوره" },
|
|
53
|
+
"update": { "title": "ویرایش دوره" },
|
|
54
|
+
"delete": { "title": "حذف دوره" },
|
|
55
|
+
"team-view": { "title": "مشاهده تایمشیت تیم" },
|
|
56
|
+
"approve": { "title": "تأیید تایمشیت" },
|
|
57
|
+
"admin-adjust": { "title": "اصلاح تایمشیت قفلشده" }
|
|
58
|
+
},
|
|
59
|
+
"time-entry": {
|
|
60
|
+
"management": { "title": "ثبتهای زمان", "description": "مدیریت ثبتهای زمان" },
|
|
61
|
+
"view": { "title": "مشاهده ثبتها" },
|
|
62
|
+
"create": { "title": "ایجاد ثبت" },
|
|
63
|
+
"update": { "title": "ویرایش ثبت" },
|
|
64
|
+
"delete": { "title": "حذف ثبت" }
|
|
65
|
+
},
|
|
66
|
+
"timesheet-correction": {
|
|
67
|
+
"management": { "title": "اصلاحات تایمشیت" },
|
|
68
|
+
"view": { "title": "مشاهده اصلاحات" },
|
|
69
|
+
"approve": { "title": "تأیید اصلاحات" }
|
|
70
|
+
},
|
|
71
|
+
"timesheet-policy": {
|
|
72
|
+
"management": { "title": "سیاستهای تایمشیت" },
|
|
73
|
+
"view": { "title": "مشاهده سیاستها" }
|
|
74
|
+
},
|
|
75
|
+
"timesheet-report": {
|
|
76
|
+
"view": { "title": "مشاهده گزارشها" },
|
|
77
|
+
"export": { "title": "خروجی گرفتن" }
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"work-items": {
|
|
81
|
+
"entities": {
|
|
82
|
+
"work-item": {
|
|
83
|
+
"title": "آیتم کاری",
|
|
84
|
+
"plural": "آیتمهای کاری",
|
|
85
|
+
"groups": {
|
|
86
|
+
"source": "منبع",
|
|
87
|
+
"assignment": "تخصیص"
|
|
88
|
+
},
|
|
89
|
+
"fields": {
|
|
90
|
+
"code": { "title": "کد" },
|
|
91
|
+
"title": { "title": "عنوان" },
|
|
92
|
+
"source-type": {
|
|
93
|
+
"title": "نوع منبع",
|
|
94
|
+
"options": {
|
|
95
|
+
"internal": "داخلی",
|
|
96
|
+
"jira": "جیرا",
|
|
97
|
+
"task": "وظیفه"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"source-ref": { "title": "مرجع منبع" },
|
|
101
|
+
"is-billable-default": { "title": "قابلصورتحساب پیشفرض" },
|
|
102
|
+
"is-active": { "title": "فعال" },
|
|
103
|
+
"employee-id": { "title": "کارمند" },
|
|
104
|
+
"project-id": { "title": "پروژه" }
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"timesheet-periods": {
|
|
110
|
+
"states": {
|
|
111
|
+
"draft": "پیشنویس",
|
|
112
|
+
"waiting-approval": "ارسالشده",
|
|
113
|
+
"approved": "تأییدشده",
|
|
114
|
+
"rejected": "ردشده",
|
|
115
|
+
"locked": "قفلشده"
|
|
116
|
+
},
|
|
117
|
+
"transitions": {
|
|
118
|
+
"submit": "ارسال",
|
|
119
|
+
"approve": "تأیید",
|
|
120
|
+
"reject": "رد",
|
|
121
|
+
"reopen": "بازگشایی",
|
|
122
|
+
"lock": "قفل"
|
|
123
|
+
},
|
|
124
|
+
"entities": {
|
|
125
|
+
"timesheet-period": {
|
|
126
|
+
"title": "دوره تایمشیت",
|
|
127
|
+
"plural": "دورههای تایمشیت",
|
|
128
|
+
"groups": {
|
|
129
|
+
"period": "دوره",
|
|
130
|
+
"totals": "جمعبندی",
|
|
131
|
+
"approval": "تأیید"
|
|
132
|
+
},
|
|
133
|
+
"fields": {
|
|
134
|
+
"employee-id": { "title": "کارمند" },
|
|
135
|
+
"period-type": {
|
|
136
|
+
"title": "نوع دوره",
|
|
137
|
+
"options": {
|
|
138
|
+
"weekly": "هفتگی",
|
|
139
|
+
"biweekly": "دو هفتهای",
|
|
140
|
+
"monthly": "ماهانه"
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"status": { "title": "وضعیت" },
|
|
144
|
+
"status-id": { "title": "وضعیت" },
|
|
145
|
+
"start-date": { "title": "تاریخ شروع" },
|
|
146
|
+
"end-date": { "title": "تاریخ پایان" },
|
|
147
|
+
"total-seconds": { "title": "مجموع ساعات" },
|
|
148
|
+
"timezone": { "title": "منطقه زمانی" },
|
|
149
|
+
"submitted-at": { "title": "زمان ارسال" },
|
|
150
|
+
"approved-at": { "title": "زمان تأیید" },
|
|
151
|
+
"rejection-reason": { "title": "دلیل رد" }
|
|
152
|
+
},
|
|
153
|
+
"states": {
|
|
154
|
+
"draft": "پیشنویس",
|
|
155
|
+
"waiting-approval": "ارسالشده",
|
|
156
|
+
"approved": "تأییدشده",
|
|
157
|
+
"rejected": "ردشده",
|
|
158
|
+
"locked": "قفلشده"
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"time-entries": {
|
|
164
|
+
"entities": {
|
|
165
|
+
"time-entry": {
|
|
166
|
+
"title": "ثبت زمان",
|
|
167
|
+
"plural": "ثبتهای زمان",
|
|
168
|
+
"groups": {
|
|
169
|
+
"timing": "زمانبندی",
|
|
170
|
+
"details": "جزئیات"
|
|
171
|
+
},
|
|
172
|
+
"fields": {
|
|
173
|
+
"employee-id": { "title": "کارمند" },
|
|
174
|
+
"period-id": { "title": "دوره تایمشیت" },
|
|
175
|
+
"work-item-id": { "title": "آیتم کاری" },
|
|
176
|
+
"project-id": { "title": "پروژه" },
|
|
177
|
+
"started-at": { "title": "شروع" },
|
|
178
|
+
"ended-at": { "title": "پایان" },
|
|
179
|
+
"duration": { "title": "مدت" },
|
|
180
|
+
"duration-seconds": { "title": "مدت (ثانیه)" },
|
|
181
|
+
"description": { "title": "توضیحات" },
|
|
182
|
+
"is-billable": { "title": "قابلصورتحساب" },
|
|
183
|
+
"entry-date": { "title": "تاریخ" },
|
|
184
|
+
"timezone": { "title": "منطقه زمانی" }
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"timesheet-policies": {
|
|
190
|
+
"entities": {
|
|
191
|
+
"timesheet-policy": {
|
|
192
|
+
"title": "سیاست تایمشیت",
|
|
193
|
+
"plural": "سیاستهای تایمشیت",
|
|
194
|
+
"groups": {
|
|
195
|
+
"limits": "محدودیتها",
|
|
196
|
+
"rules": "قوانین"
|
|
197
|
+
},
|
|
198
|
+
"fields": {
|
|
199
|
+
"max-daily-hours": { "title": "حداکثر ساعت روزانه" },
|
|
200
|
+
"max-weekly-hours": { "title": "حداکثر ساعت هفتگی" },
|
|
201
|
+
"require-description": { "title": "الزام توضیحات" },
|
|
202
|
+
"allow-future-dates": { "title": "اجازه تاریخ آینده" },
|
|
203
|
+
"overlap-policy": {
|
|
204
|
+
"title": "سیاست همپوشانی",
|
|
205
|
+
"options": {
|
|
206
|
+
"reject": "رد",
|
|
207
|
+
"warn": "هشدار"
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"period-type-default": {
|
|
211
|
+
"title": "نوع دوره پیشفرض",
|
|
212
|
+
"options": {
|
|
213
|
+
"weekly": "هفتگی",
|
|
214
|
+
"biweekly": "دو هفتهای",
|
|
215
|
+
"monthly": "ماهانه"
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
"is-default": { "title": "سیاست پیشفرض" }
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
"timesheet-corrections": {
|
|
224
|
+
"states": {
|
|
225
|
+
"waiting-approval": "در انتظار",
|
|
226
|
+
"approved": "تأییدشده",
|
|
227
|
+
"rejected": "ردشده"
|
|
228
|
+
},
|
|
229
|
+
"transitions": {
|
|
230
|
+
"submit": "ارسال",
|
|
231
|
+
"approve": "تأیید",
|
|
232
|
+
"reject": "رد",
|
|
233
|
+
"reopen": "بازگشایی"
|
|
234
|
+
},
|
|
235
|
+
"entities": {
|
|
236
|
+
"timesheet-correction": {
|
|
237
|
+
"title": "اصلاح تایمشیت",
|
|
238
|
+
"plural": "اصلاحات تایمشیت",
|
|
239
|
+
"groups": {
|
|
240
|
+
"changes": "تغییرات"
|
|
241
|
+
},
|
|
242
|
+
"fields": {
|
|
243
|
+
"period-id": { "title": "دوره تایمشیت" },
|
|
244
|
+
"requested-by-id": { "title": "درخواستدهنده" },
|
|
245
|
+
"reason": { "title": "دلیل" },
|
|
246
|
+
"status-id": { "title": "وضعیت" },
|
|
247
|
+
"changes": { "title": "تغییرات پیشنهادی" }
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
"commands": {
|
|
253
|
+
"timesheet-period": {
|
|
254
|
+
"not-found": "دوره تایمشیت یافت نشد.",
|
|
255
|
+
"rejection-reason-required": "دلیل رد الزامی است.",
|
|
256
|
+
"adjustment-note-required": "یادداشت تعدیل الزامی است."
|
|
257
|
+
},
|
|
258
|
+
"time-entry": {
|
|
259
|
+
"not-found": "رکورد زمان یافت نشد.",
|
|
260
|
+
"not-found-after-create": "پس از ایجاد، رکورد زمان یافت نشد."
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-timesheet-management-client-admin-adjust-timesheet-period.command-8lA7h4rI.mjs","sources":["../../../../libs/modules/timesheet-management/client/src/lib/features/timesheet-period/commands/admin-adjust-timesheet-period.command.ts"],"sourcesContent":["import { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\nimport { isEmpty } from 'lodash';\nimport { RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport type { AXMTimesheetManagementTimesheetPeriodEntityModel } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport { AXMTimesheetValidationService } from '../timesheet-validation.service';\n\n//#region ---- Types ----\n\nexport interface AdminAdjustTimesheetPeriodInput {\n id: string;\n totalSeconds?: number;\n adjustmentNote: string;\n}\n\n//#endregion\n\n/**\n * Applies an administrative adjustment to an approved or locked timesheet period.\n */\n@Injectable({ providedIn: 'root' })\nexport class AdminAdjustTimesheetPeriodCommand implements AXPCommand<AdminAdjustTimesheetPeriodInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly validationService = inject(AXMTimesheetValidationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: AdminAdjustTimesheetPeriodInput): AXPCommandExecuteResultPromise<void> {\n try {\n if (isEmpty(input.adjustmentNote?.trim())) {\n return { success: false, message: { text: 'An adjustment note is required.' } };\n }\n\n const dataAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timesheetPeriod.name)\n .data<string, AXMTimesheetManagementTimesheetPeriodEntityModel>();\n\n const period = await dataAccessor.byKey(input.id);\n if (!period) {\n return { success: false, message: { text: 'Timesheet period not found.' } };\n }\n\n this.validationService.assertCanAdminAdjust(period);\n\n const updateData: Partial<AXMTimesheetManagementTimesheetPeriodEntityModel> = {\n rejectionReason: input.adjustmentNote.trim(),\n };\n\n if (input.totalSeconds != null) {\n updateData.totalSeconds = input.totalSeconds;\n }\n\n await dataAccessor.update(input.id, updateData);\n\n return { success: true, kind: 'object', data: undefined };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to adjust timesheet period.';\n console.error('[AdminAdjustTimesheetPeriodCommand] Error:', error);\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;AAkBA;AAEA;;AAEG;MAEU,iCAAiC,CAAA;AAD9C,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,iBAAiB,GAAG,MAAM,CAAC,6BAA6B,CAAC;AA0C3E,IAAA;;;IApCC,MAAM,OAAO,CAAC,KAAsC,EAAA;AAClD,QAAA,IAAI;YACF,IAAI,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC,EAAE;AACzC,gBAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,iCAAiC,EAAE,EAAE;YACjF;AAEA,YAAA,MAAM,YAAY,GAAG,IAAI,CAAC;AACvB,iBAAA,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI;AAC3E,iBAAA,IAAI,EAA4D;YAEnE,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YACjD,IAAI,CAAC,MAAM,EAAE;AACX,gBAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,6BAA6B,EAAE,EAAE;YAC7E;AAEA,YAAA,IAAI,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,MAAM,CAAC;AAEnD,YAAA,MAAM,UAAU,GAA8D;AAC5E,gBAAA,eAAe,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,EAAE;aAC7C;AAED,YAAA,IAAI,KAAK,CAAC,YAAY,IAAI,IAAI,EAAE;AAC9B,gBAAA,UAAU,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY;YAC9C;YAEA,MAAM,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,UAAU,CAAC;AAE/C,YAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;QAC3D;QAAE,OAAO,KAAc,EAAE;AACvB,YAAA,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,oCAAoC;AAC7F,YAAA,OAAO,CAAC,KAAK,CAAC,4CAA4C,EAAE,KAAK,CAAC;AAClE,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;QACvD;IACF;8GA3CW,iCAAiC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAjC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iCAAiC,cADpB,MAAM,EAAA,CAAA,CAAA;;2FACnB,iCAAiC,EAAA,UAAA,EAAA,CAAA;kBAD7C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-timesheet-management-client-approve-timesheet-period.command-DlAeGANo.mjs","sources":["../../../../libs/modules/timesheet-management/client/src/lib/features/timesheet-period/commands/approve-timesheet-period.command.ts"],"sourcesContent":["import { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult, AXPSystemStatusType } from '@acorex-platform/framework-shared/core';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\n\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\nimport { RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport type { AXMTimesheetManagementTimesheetPeriodEntityModel } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport { AXMTimesheetValidationService } from '../timesheet-validation.service';\n\n//#region ---- Types ----\n\nexport interface ApproveTimesheetPeriodInput {\n id: string;\n note?: string;\n}\n\n//#endregion\n\n/**\n * Approves a timesheet period that is awaiting approval.\n */\n@Injectable({ providedIn: 'root' })\nexport class ApproveTimesheetPeriodCommand implements AXPCommand<ApproveTimesheetPeriodInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly validationService = inject(AXMTimesheetValidationService);\n private readonly sessionService = inject(AXPSessionService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: ApproveTimesheetPeriodInput): AXPCommandExecuteResultPromise<void> {\n try {\n const dataAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timesheetPeriod.name)\n .data<string, AXMTimesheetManagementTimesheetPeriodEntityModel>();\n\n const period = await dataAccessor.byKey(input.id);\n if (!period) {\n return { success: false, message: { text: 'Timesheet period not found.' } };\n }\n\n this.validationService.assertCanApprove(period);\n\n await dataAccessor.update(input.id, {\n statusId: AXPSystemStatusType.Approved,\n approvedAt: new Date().toISOString(),\n approvedById: this.sessionService.user?.id,\n });\n\n return { success: true, kind: 'object', data: undefined };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to approve timesheet period.';\n console.error('[ApproveTimesheetPeriodCommand] Error:', error);\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;;AAkBA;AAEA;;AAEG;MAEU,6BAA6B,CAAA;AAD1C,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;A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K,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;QACvD;IACF;8GApCW,6BAA6B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA7B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,6BAA6B,cADhB,MAAM,EAAA,CAAA,CAAA;;2FACnB,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBADzC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-timesheet-management-client-create-time-entry.command-DS2EVLym.mjs","sources":["../../../../libs/modules/timesheet-management/client/src/lib/features/time-entry/commands/create-time-entry.command.ts"],"sourcesContent":["import { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\nimport { RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport type { AXMTimesheetManagementTimeEntryEntityModel } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport type { AXMTimesheetManagementTimesheetPeriodEntityModel } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport { AXMTimesheetValidationService } from '../../timesheet-period/timesheet-validation.service';\n\n//#region ---- Types ----\n\nexport type CreateTimeEntryInput = Omit<AXMTimesheetManagementTimeEntryEntityModel, 'id'>;\n\n//#endregion\n\n/**\n * Creates a time entry after validating the parent timesheet period is editable.\n */\n@Injectable({ providedIn: 'root' })\nexport class CreateTimeEntryCommand implements AXPCommand<CreateTimeEntryInput, AXMTimesheetManagementTimeEntryEntityModel> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly validationService = inject(AXMTimesheetValidationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(\n input: CreateTimeEntryInput,\n ): AXPCommandExecuteResultPromise<AXMTimesheetManagementTimeEntryEntityModel> {\n try {\n await this.assertPeriodEditable(input.periodId);\n\n const dataAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timeEntry.name)\n .data<string, AXMTimesheetManagementTimeEntryEntityModel>();\n\n const id = await dataAccessor.create(input);\n const entity = await dataAccessor.byKey(id);\n if (!entity) {\n return { success: false, message: { text: 'Time entry not found after creation.' } };\n }\n\n return { success: true, kind: 'object', data: entity };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to create time entry.';\n console.error('[CreateTimeEntryCommand] Error:', error);\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n\n //#region ---- Private helpers ----\n\n private async assertPeriodEditable(periodId: string): Promise<void> {\n const periodAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timesheetPeriod.name)\n .data<string, AXMTimesheetManagementTimesheetPeriodEntityModel>();\n\n const period = await periodAccessor.byKey(periodId);\n if (!period) {\n throw new Error('Timesheet period not found.');\n }\n this.validationService.assertPeriodAllowsTimeEntryEdits(period);\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;AAcA;AAEA;;AAEG;MAEU,sBAAsB,CAAA;AADnC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,iBAAiB,GAAG,MAAM,CAAC,6BAA6B,CAAC;AA+C3E,IAAA;;;IAzCC,MAAM,OAAO,CACX,KAA2B,EAAA;AAE3B,QAAA,IAAI;YACF,MAAM,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,QAAQ,CAAC;AAE/C,YAAA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CAAC,MAAM,CAAC;IACjE;8GAhDW,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAtB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,sBAAsB,cADT,MAAM,EAAA,CAAA,CAAA;;2FACnB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBADlC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-timesheet-management-client-delete-time-entry.command-5_ItHpnx.mjs","sources":["../../../../libs/modules/timesheet-management/client/src/lib/features/time-entry/commands/delete-time-entry.command.ts"],"sourcesContent":["import { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\nimport { RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport type { AXMTimesheetManagementTimeEntryEntityModel } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport type { AXMTimesheetManagementTimesheetPeriodEntityModel } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport { AXMTimesheetValidationService } from '../../timesheet-period/timesheet-validation.service';\n\n//#region ---- Types ----\n\nexport interface DeleteTimeEntryInput {\n id: string;\n}\n\n//#endregion\n\n/**\n * Deletes a time entry after validating the parent timesheet period is editable.\n */\n@Injectable({ providedIn: 'root' })\nexport class DeleteTimeEntryCommand implements AXPCommand<DeleteTimeEntryInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly validationService = inject(AXMTimesheetValidationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: DeleteTimeEntryInput): AXPCommandExecuteResultPromise<void> {\n try {\n const dataAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timeEntry.name)\n .data<string, AXMTimesheetManagementTimeEntryEntityModel>();\n\n const existing = await dataAccessor.byKey(input.id);\n if (!existing) {\n return { success: false, message: { text: 'Time entry not found.' } };\n }\n\n await this.assertPeriodEditable(existing.periodId);\n await dataAccessor.delete(input.id);\n\n return { success: true, kind: 'object', data: undefined };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to delete time entry.';\n console.error('[DeleteTimeEntryCommand] Error:', error);\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n\n //#region ---- Private helpers ----\n\n private async assertPeriodEditable(periodId: string): Promise<void> {\n const periodAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timesheetPeriod.name)\n .data<string, AXMTimesheetManagementTimesheetPeriodEntityModel>();\n\n const period = await periodAccessor.byKey(periodId);\n if (!period) {\n throw new Error('Timesheet period not found.');\n }\n this.validationService.assertPeriodAllowsTimeEntryEdits(period);\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;AAgBA;AAEA;;AAEG;MAEU,sBAAsB,CAAA;AADnC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,iBAAiB,GAAG,MAAM,CAAC,6BAA6B,CAAC;AA6C3E,IAAA;;;IAvCC,MAAM,OAAO,CAAC,KAA2B,EAAA;AACvC,QAAA,IAAI;AACF,YAAA,MAAM,YAAY,GAAG,IAAI,CAAC;AACvB,iBAAA,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI;AACrE,iBAAA,IAAI,EAAsD;YAE7D,MAAM,QAA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,UAAA,EAAA,CAAA,CAAA;AAAtB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,sBAAsB,cADT,MAAM,EAAA,CAAA,CAAA;;2FACnB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBADlC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-timesheet-management-client-lock-timesheet-period.command-D7V7SWUK.mjs","sources":["../../../../libs/modules/timesheet-management/client/src/lib/features/timesheet-period/commands/lock-timesheet-period.command.ts"],"sourcesContent":["import { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\nimport { AXMTimesheetPeriodLockedStatusId, RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport type { AXMTimesheetManagementTimesheetPeriodEntityModel } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport { AXMTimesheetValidationService } from '../timesheet-validation.service';\n\n//#region ---- Types ----\n\nexport interface LockTimesheetPeriodInput {\n id: string;\n}\n\n//#endregion\n\n/**\n * Locks an approved timesheet period to prevent further edits.\n */\n@Injectable({ providedIn: 'root' })\nexport class LockTimesheetPeriodCommand implements AXPCommand<LockTimesheetPeriodInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly validationService = inject(AXMTimesheetValidationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: LockTimesheetPeriodInput): AXPCommandExecuteResultPromise<void> {\n try {\n const dataAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timesheetPeriod.name)\n .data<string, AXMTimesheetManagementTimesheetPeriodEntityModel>();\n\n const period = await dataAccessor.byKey(input.id);\n if (!period) {\n return { success: false, message: { text: 'Timesheet period not found.' } };\n }\n\n this.validationService.assertCanLock(period);\n\n await dataAccessor.update(input.id, {\n statusId: AXMTimesheetPeriodLockedStatusId,\n lockedAt: new Date().toISOString(),\n });\n\n return { success: true, kind: 'object', data: undefined };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to lock timesheet period.';\n console.error('[LockTimesheetPeriodCommand] Error:', error);\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;AAeA;AAEA;;AAEG;MAEU,0BAA0B,CAAA;AADvC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,iBAAiB,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAiC3E,IAAA;;;IA3BC,MAAM,OAAO,CAAC,KAA+B,EAAA;AAC3C,QAAA,IAAI;AACF,YAAA,MAAM,YAAY,GAAG,IAAI,CAAC;AACvB,iBAAA,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI;AAC3E,iBAAA,IAAI,EAA4D;YAEnE,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YACjD,IAAI,CAAC,MAAM,EAAE;AACX,gBAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,6BAA6B,EAAE,EAAE;YAC7E;AAEA,YAAA,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC,MAAM,CAAC;AAE5C,YAAA,MAAM,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE;AAClC,gBAAA,QAAQ,EAAE,gCAAgC;AAC1C,gBAAA,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;AACnC,aAAA,CAAC;AAEF,YAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;QAC3D;QAAE,OAAO,KAAc,EAAE;AACvB,YAAA,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,kCAAkC;AAC3F,YAAA,OAAO,CAAC,KAAK,CAAC,qCAAqC,EAAE,KAAK,CAAC;AAC3D,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;QACvD;IACF;8GAlCW,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA1B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,0BAA0B,cADb,MAAM,EAAA,CAAA,CAAA;;2FACnB,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBADtC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-timesheet-management-client-reject-timesheet-period.command-CONxKPNm.mjs","sources":["../../../../libs/modules/timesheet-management/client/src/lib/features/timesheet-period/commands/reject-timesheet-period.command.ts"],"sourcesContent":["\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult, AXPSystemStatusType } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\nimport { isEmpty } from 'lodash';\nimport { RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport type { AXMTimesheetManagementTimesheetPeriodEntityModel } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport { AXMTimesheetValidationService } from '../timesheet-validation.service';\n\n//#region ---- Types ----\n\nexport interface RejectTimesheetPeriodInput {\n id: string;\n rejectionReason?: string;\n}\n\n//#endregion\n\n/**\n * Rejects a timesheet period that is awaiting approval.\n */\n@Injectable({ providedIn: 'root' })\nexport class RejectTimesheetPeriodCommand implements AXPCommand<RejectTimesheetPeriodInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly validationService = inject(AXMTimesheetValidationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: RejectTimesheetPeriodInput): AXPCommandExecuteResultPromise<void> {\n try {\n const dataAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timesheetPeriod.name)\n .data<string, AXMTimesheetManagementTimesheetPeriodEntityModel>();\n\n const period = await dataAccessor.byKey(input.id);\n if (!period) {\n return { success: false, message: { text: 'Timesheet period not found.' } };\n }\n\n this.validationService.assertCanReject(period);\n\n if (isEmpty(input.rejectionReason?.trim())) {\n return { success: false, message: { text: 'A rejection reason is required.' } };\n }\n\n await dataAccessor.update(input.id, {\n statusId: AXPSystemStatusType.Rejected,\n rejectedAt: new Date().toISOString(),\n rejectionReason: input.rejectionReason?.trim(),\n });\n\n return { success: true, kind: 'object', data: undefined };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to reject timesheet period.';\n console.error('[RejectTimesheetPeriodCommand] Error:', error);\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;;AAmBA;AAEA;;AAEG;MAEU,4BAA4B,CAAA;AADzC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAA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CAAoC;AAC7F,YAAA,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC;AAC7D,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;QACvD;IACF;8GAvCW,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA5B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,4BAA4B,cADf,MAAM,EAAA,CAAA,CAAA;;2FACnB,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADxC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-timesheet-management-client-reopen-timesheet-period.command-DRr_c67L.mjs","sources":["../../../../libs/modules/timesheet-management/client/src/lib/features/timesheet-period/commands/reopen-timesheet-period.command.ts"],"sourcesContent":["\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult, AXPSystemStatusType } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\nimport { RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport type { AXMTimesheetManagementTimesheetPeriodEntityModel } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport { AXMTimesheetValidationService } from '../timesheet-validation.service';\n\n//#region ---- Types ----\n\nexport interface ReopenTimesheetPeriodInput {\n id: string;\n}\n\n//#endregion\n\n/**\n * Reopens a rejected or approved timesheet period back to draft.\n */\n@Injectable({ providedIn: 'root' })\nexport class ReopenTimesheetPeriodCommand implements AXPCommand<ReopenTimesheetPeriodInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly validationService = inject(AXMTimesheetValidationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: ReopenTimesheetPeriodInput): AXPCommandExecuteResultPromise<void> {\n try {\n const dataAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timesheetPeriod.name)\n .data<string, AXMTimesheetManagementTimesheetPeriodEntityModel>();\n\n const period = await dataAccessor.byKey(input.id);\n if (!period) {\n return { success: false, message: { text: 'Timesheet period not found.' } };\n }\n\n this.validationService.assertCanReopen(period);\n\n await dataAccessor.update(input.id, {\n statusId: AXPSystemStatusType.Draft,\n submittedAt: undefined,\n approvedAt: undefined,\n approvedById: undefined,\n rejectedAt: undefined,\n rejectionReason: undefined,\n lockedAt: undefined,\n });\n\n return { success: true, kind: 'object', data: undefined };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to reopen timesheet period.';\n console.error('[ReopenTimesheetPeriodCommand] Error:', error);\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;AAiBA;AAEA;;AAEG;MAEU,4BAA4B,CAAA;AADzC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,iBAAiB,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAsC3E,IAAA;;;IAhCC,MAAM,OAAO,CAAC,KAAiC,EAAA;AAC7C,QAAA,IAAI;AACF,YAAA,MAAM,YAAY,GAAG,IAAI,CAAC;AACvB,iBAAA,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI;AAC3E,iBAAA,IAAI,EAA4D;YAEnE,MAAM,MAAM,GAAG,MAAM,YAAY,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AA,CAAA,CAAA;;2FACnB,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADxC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-timesheet-management-client-submit-timesheet-period.command-C2qlQVIC.mjs","sources":["../../../../libs/modules/timesheet-management/client/src/lib/features/timesheet-period/commands/submit-timesheet-period.command.ts"],"sourcesContent":["\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult, AXPSystemStatusType } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\nimport { RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport type { AXMTimesheetManagementTimesheetPeriodEntityModel } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport { AXMTimesheetValidationService } from '../timesheet-validation.service';\n\n//#region ---- Types ----\n\nexport interface SubmitTimesheetPeriodInput {\n id: string;\n}\n\n//#endregion\n\n/**\n * Submits a draft timesheet period for approval.\n */\n@Injectable({ providedIn: 'root' })\nexport class SubmitTimesheetPeriodCommand implements AXPCommand<SubmitTimesheetPeriodInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly validationService = inject(AXMTimesheetValidationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: SubmitTimesheetPeriodInput): AXPCommandExecuteResultPromise<void> {\n try {\n const dataAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timesheetPeriod.name)\n .data<string, AXMTimesheetManagementTimesheetPeriodEntityModel>();\n\n const period = await dataAccessor.byKey(input.id);\n if (!period) {\n return { success: false, message: { text: 'Timesheet period not found.' } };\n }\n\n this.validationService.assertCanSubmit(period);\n\n await dataAccessor.update(input.id, {\n statusId: AXPSystemStatusType.WaitingApproval,\n submittedAt: new Date().toISOString(),\n });\n\n return { success: true, kind: 'object', data: undefined };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to submit timesheet period.';\n console.error('[SubmitTimesheetPeriodCommand] Error:', error);\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;AAiBA;AAEA;;AAEG;MAEU,4BAA4B,CAAA;AADzC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,iBAAiB,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAiC3E,IAAA;;;IA3BC,MAAM,OAAO,CAAC,KAAiC,EAAA;AAC7C,QAAA,IAAI;AACF,YAAA,MAAM,YAAY,GAAG,IAAI,CAAC;AACvB,iBAAA,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI;AAC3E,iBAAA,IAAI,EAA4D;YAEnE,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YACjD,IAAI,CAAC,MAAM,EAAE;AACX,gBAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,6BAA6B,EAAE,EAAE;YAC7E;AAEA,YAAA,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,MAAM,CAAC;AAE9C,YAAA,MAAM,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE;gBAClC,QAAQ,EAAE,mBAAmB,CAAC,eAAe;AAC7C,gBAAA,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;AACtC,aAAA,CAAC;AAEF,YAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;QAC3D;QAAE,OAAO,KAAc,EAAE;AACvB,YAAA,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,oCAAoC;AAC7F,YAAA,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC;AAC7D,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;QACvD;IACF;8GAlCW,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA5B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,4BAA4B,cADf,MAAM,EAAA,CAAA,CAAA;;2FACnB,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADxC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-timesheet-management-client-update-time-entry.command-Do6s9OrI.mjs","sources":["../../../../libs/modules/timesheet-management/client/src/lib/features/time-entry/commands/update-time-entry.command.ts"],"sourcesContent":["import { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\nimport { RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport type { AXMTimesheetManagementTimeEntryEntityModel } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport type { AXMTimesheetManagementTimesheetPeriodEntityModel } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport { AXMTimesheetValidationService } from '../../timesheet-period/timesheet-validation.service';\n\n//#region ---- Types ----\n\nexport interface UpdateTimeEntryInput {\n id: string;\n data: Partial<Omit<AXMTimesheetManagementTimeEntryEntityModel, 'id'>>;\n}\n\n//#endregion\n\n/**\n * Updates a time entry after validating the parent timesheet period is editable.\n */\n@Injectable({ providedIn: 'root' })\nexport class UpdateTimeEntryCommand implements AXPCommand<UpdateTimeEntryInput, AXMTimesheetManagementTimeEntryEntityModel> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly validationService = inject(AXMTimesheetValidationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(\n input: UpdateTimeEntryInput,\n ): AXPCommandExecuteResultPromise<AXMTimesheetManagementTimeEntryEntityModel> {\n try {\n const dataAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timeEntry.name)\n .data<string, AXMTimesheetManagementTimeEntryEntityModel>();\n\n const existing = await dataAccessor.byKey(input.id);\n if (!existing) {\n return { success: false, message: { text: 'Time entry not found.' } };\n }\n\n const periodId = input.data.periodId ?? existing.periodId;\n await this.assertPeriodEditable(periodId);\n\n const updated = await dataAccessor.update(input.id, input.data);\n return { success: true, kind: 'object', data: updated };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to update time entry.';\n console.error('[UpdateTimeEntryCommand] Error:', error);\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n\n //#region ---- Private helpers ----\n\n private async assertPeriodEditable(periodId: string): Promise<void> {\n const periodAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timesheetPeriod.name)\n .data<string, AXMTimesheetManagementTimesheetPeriodEntityModel>();\n\n const period = await periodAccessor.byKey(periodId);\n if (!period) {\n throw new Error('Timesheet period not found.');\n }\n this.validationService.assertPeriodAllowsTimeEntryEdits(period);\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;AAiBA;AAEA;;AAEG;MAEU,sBAAsB,CAAA;AADnC,IAAA,WAAA,GAAA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