shared-ritm 1.2.35 → 1.2.37

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.
Files changed (46) hide show
  1. package/README.md +103 -103
  2. package/dist/index.css +1 -1
  3. package/dist/shared-ritm.es.js +1468 -1446
  4. package/dist/shared-ritm.umd.js +7 -7
  5. package/dist/types/api/services/ControlsService.d.ts +11 -0
  6. package/dist/types/api/types/Api_Controls.d.ts +12 -0
  7. package/dist/types/index.d.ts +2 -1
  8. package/package.json +1 -1
  9. package/src/App.vue +2461 -2461
  10. package/src/api/services/AuthService.ts +58 -58
  11. package/src/api/services/ControlsService.ts +32 -0
  12. package/src/api/services/GanttService.ts +17 -17
  13. package/src/api/services/MetricsService.ts +101 -101
  14. package/src/api/services/TasksService.ts +137 -137
  15. package/src/api/settings/ApiService.ts +126 -126
  16. package/src/api/types/Api_Controls.ts +12 -0
  17. package/src/api/types/Api_Files.ts +1 -1
  18. package/src/api/types/Api_Projects.ts +55 -55
  19. package/src/api/types/Api_Repairs.ts +93 -93
  20. package/src/common/app-checkbox/AppCheckbox.vue +26 -26
  21. package/src/common/app-date-picker/AppDatePicker.vue +81 -81
  22. package/src/common/app-dialogs/AppConfirmDialog.vue +100 -100
  23. package/src/common/app-dropdown/AppDropdown.vue +31 -31
  24. package/src/common/app-icon/AppIcon.vue +108 -108
  25. package/src/common/app-input-search/AppInputSearch.vue +174 -174
  26. package/src/common/app-layout/AppLayout.vue +84 -84
  27. package/src/common/app-layout/components/AppLayoutHeader.vue +246 -246
  28. package/src/common/app-layout/components/AppLayoutPage.vue +16 -16
  29. package/src/common/app-select/AppSelect.vue +157 -157
  30. package/src/common/app-sidebar/components/SidebarMenuItem.vue +146 -146
  31. package/src/common/app-toggle/AppToggle.vue +23 -23
  32. package/src/common/app-wrapper/AppWrapper.vue +28 -28
  33. package/src/icons/dialogs/RemoveIcon.vue +12 -12
  34. package/src/icons/dialogs/SafetyIcon.vue +12 -12
  35. package/src/icons/header/NotificationIcon.vue +18 -18
  36. package/src/icons/header/PersonIcon.vue +11 -11
  37. package/src/icons/header/SettingIcon.vue +14 -14
  38. package/src/icons/task/attention-icon.vue +13 -13
  39. package/src/icons/task/clock-icon.vue +10 -10
  40. package/src/icons/task/delete-icon.vue +10 -10
  41. package/src/icons/task/fire-icon.vue +16 -16
  42. package/src/index.ts +66 -64
  43. package/src/main.ts +28 -28
  44. package/src/shared/styles/general.css +96 -96
  45. package/src/utils/confirm.ts +12 -12
  46. package/src/utils/notification.ts +9 -9
@@ -1,58 +1,58 @@
1
- import ApiService from '@/api/settings/ApiService'
2
-
3
- export type LoginPayload = {
4
- email: string
5
- password: string
6
- }
7
-
8
- export type LoginResponse = {
9
- token: string
10
- user: any
11
- }
12
-
13
- export type ChangePasswordPayload = {
14
- password: string
15
- password_confirmation: string
16
- }
17
-
18
- export type ChangePasswordResponse = any
19
- export type ConfigResponse = any
20
-
21
- class AuthService extends ApiService {
22
- public login(email: string, password: string) {
23
- return this.post<LoginPayload, LoginResponse>(`/login`, {
24
- email,
25
- password,
26
- })
27
- }
28
-
29
- public loginPhoto(photo: any) {
30
- return this.post<any, LoginResponse>(`/login/from_photo`, { photo })
31
- }
32
-
33
- public logout() {
34
- return this.post<null, LoginResponse>(`/logout`, null)
35
- }
36
-
37
- public userInfo() {
38
- return this.get<any>(`/users/auth`)
39
- }
40
-
41
- public configs() {
42
- return this.get<ConfigResponse>(`/configs`)
43
- }
44
-
45
- public changePassword(id: string, password: string, password_confirmation: string) {
46
- return this.put<ChangePasswordPayload, ChangePasswordResponse>(`/users/${id}/password`, {
47
- password,
48
- password_confirmation,
49
- })
50
- }
51
- }
52
-
53
- let api: AuthService
54
-
55
- export default function useAuthService() {
56
- if (!api) api = new AuthService()
57
- return api
58
- }
1
+ import ApiService from '@/api/settings/ApiService'
2
+
3
+ export type LoginPayload = {
4
+ email: string
5
+ password: string
6
+ }
7
+
8
+ export type LoginResponse = {
9
+ token: string
10
+ user: any
11
+ }
12
+
13
+ export type ChangePasswordPayload = {
14
+ password: string
15
+ password_confirmation: string
16
+ }
17
+
18
+ export type ChangePasswordResponse = any
19
+ export type ConfigResponse = any
20
+
21
+ class AuthService extends ApiService {
22
+ public login(email: string, password: string) {
23
+ return this.post<LoginPayload, LoginResponse>(`/login`, {
24
+ email,
25
+ password,
26
+ })
27
+ }
28
+
29
+ public loginPhoto(photo: any) {
30
+ return this.post<any, LoginResponse>(`/login/from_photo`, { photo })
31
+ }
32
+
33
+ public logout() {
34
+ return this.post<null, LoginResponse>(`/logout`, null)
35
+ }
36
+
37
+ public userInfo() {
38
+ return this.get<any>(`/users/auth`)
39
+ }
40
+
41
+ public configs() {
42
+ return this.get<ConfigResponse>(`/configs`)
43
+ }
44
+
45
+ public changePassword(id: string, password: string, password_confirmation: string) {
46
+ return this.put<ChangePasswordPayload, ChangePasswordResponse>(`/users/${id}/password`, {
47
+ password,
48
+ password_confirmation,
49
+ })
50
+ }
51
+ }
52
+
53
+ let api: AuthService
54
+
55
+ export default function useAuthService() {
56
+ if (!api) api = new AuthService()
57
+ return api
58
+ }
@@ -0,0 +1,32 @@
1
+ import ApiService, { ResponseApi } from '@/api/settings/ApiService'
2
+
3
+ import { Api_ControlZones_Dto } from '@/api/types/Api_Controls'
4
+
5
+ class ControlsService extends ApiService {
6
+ public async fetchProjectById(id: string): Promise<ResponseApi<Api_ControlZones_Dto>> {
7
+ return this.get(`/projects/${id}`)
8
+ }
9
+
10
+ public createProject(params: any): Promise<ResponseApi<any>> {
11
+ return this.post<any, ResponseApi<any>>('/projects', params)
12
+ }
13
+
14
+ public editProject(id: string, params: any): Promise<ResponseApi<any>> {
15
+ return this.put<any, ResponseApi<any>>(`/projects/${id}`, params)
16
+ }
17
+
18
+ public fetchProjects(params: any): Promise<ResponseApi<Api_ControlZones_Dto[]>> {
19
+ return this.get(`/search/projects`, { params })
20
+ }
21
+
22
+ public deleteProject(id: string): Promise<any> {
23
+ return this.delete<ResponseApi<any>>(`/projects/${id}`)
24
+ }
25
+ }
26
+
27
+ let api: ControlsService
28
+
29
+ export default function useControlsService() {
30
+ if (!api) api = new ControlsService()
31
+ return api
32
+ }
@@ -1,17 +1,17 @@
1
- import ApiService from '@/api/settings/ApiService'
2
-
3
- class GanttService extends ApiService {
4
- public async fetchCriticalPathTasks(params: string): Promise<any> {
5
- return await this.get(`gantt/get_list_task_on_critical_path?${params}`)
6
- }
7
- public async fetchGanttList(params: string): Promise<any> {
8
- return await this.get(`/list/tasks/search?${params}&gantt=1`)
9
- }
10
- }
11
-
12
- let api: GanttService
13
-
14
- export default function useGanttService() {
15
- if (!api) api = new GanttService()
16
- return api
17
- }
1
+ import ApiService from '@/api/settings/ApiService'
2
+
3
+ class GanttService extends ApiService {
4
+ public async fetchCriticalPathTasks(params: string): Promise<any> {
5
+ return await this.get(`gantt/get_list_task_on_critical_path?${params}`)
6
+ }
7
+ public async fetchGanttList(params: string): Promise<any> {
8
+ return await this.get(`/list/tasks/search?${params}&gantt=1`)
9
+ }
10
+ }
11
+
12
+ let api: GanttService
13
+
14
+ export default function useGanttService() {
15
+ if (!api) api = new GanttService()
16
+ return api
17
+ }
@@ -1,101 +1,101 @@
1
- import ApiService, { ResponseApi } from '@/api/settings/ApiService'
2
-
3
- class MetricsService extends ApiService {
4
- public async fetchPieProjects(queryString: string): Promise<ResponseApi<any>> {
5
- return await this.get('repairs/pie/projects' + '?' + queryString)
6
- }
7
-
8
- public async fetchPieTasks(queryString: string): Promise<ResponseApi<any>> {
9
- return await this.get('repairs/pie/tasks' + '?' + queryString)
10
- }
11
-
12
- public async fetchPiePersonnel(queryString: string): Promise<ResponseApi<any>> {
13
- return await this.get('repairs/metrics/get_list_position' + '?' + queryString)
14
- }
15
-
16
- public async fetchPersonnelData(queryString: string): Promise<ResponseApi<any>> {
17
- return await this.get('repairs/metrics/list_position_intersection_group_by_status' + '?' + queryString)
18
- }
19
-
20
- public async fetchPersonnelInfo(params: string): Promise<ResponseApi<any>> {
21
- return await this.get(`repairs/metrics/list_position_intersection_details?${params}`)
22
- }
23
-
24
- public async fetchPiePersonnelInfo(params: string): Promise<any> {
25
- return await this.get(`repairs/metrics/get_list_user_by_position?${params}`)
26
- }
27
-
28
- public async fetchPieCriticalPath(queryString: string): Promise<any[]> {
29
- return await this.get('repairs/metrics/get_critical_path_group_by_status' + '?' + queryString)
30
- }
31
-
32
- public async fetchPieCriticalPathInfo(params: string): Promise<any> {
33
- return await this.get(`repairs/metrics/get_list_task_critical_path_by_status?${params}`)
34
- }
35
-
36
- public async fetchPieTmc(queryString: string): Promise<ResponseApi<any>> {
37
- return await this.get('repairs/metrics/get_list_instrument_type' + '?' + queryString)
38
- }
39
-
40
- public async fetchPieTmcInfo(params: string): Promise<any> {
41
- return await this.get(`repairs/metrics/get_list_warehouse_by_instrument_type?${params}`)
42
- }
43
-
44
- public async fetchPieUntimelyClosedTask(queryString: string): Promise<any[]> {
45
- return await this.get('repairs/metrics/get_list_comment_type' + '?' + queryString)
46
- }
47
-
48
- public async fetchPieUntimelyClosedTaskInfo(params: string): Promise<any> {
49
- return await this.get(`repairs/metrics/get_list_task_by_comment_type?${params}`)
50
- }
51
-
52
- public async fetchPieAdditionalTasks(queryString: string): Promise<any[]> {
53
- return await this.get('repairs/metrics/get_list_task_after_plan_fixate_group_by_status' + '?' + queryString)
54
- }
55
-
56
- public async fetchPieAdditionalTasksInfo(params: string): Promise<any> {
57
- return await this.get(`repairs/metrics/get_list_task_after_plan_fixate_by_status?${params}`)
58
- }
59
-
60
- public async fetchPersonnel(queryString: string): Promise<any[]> {
61
- return await this.get('repairs/statistic/personnel' + '?' + queryString)
62
- }
63
-
64
- public async fetchPieExpired(queryString: string): Promise<any[]> {
65
- return await this.get('repairs/metrics/get_list_task_expired_group_by_status' + '?' + queryString)
66
- }
67
-
68
- public async fetchPieExpiredInfo(params: string): Promise<any> {
69
- return await this.get(`repairs/metrics/get_list_task_expired?${params}`)
70
- }
71
-
72
- public async fetchEconomicsPerformance(params: string): Promise<any> {
73
- return await this.get(`repairs/metrics/get_economic_performance?${params}`)
74
- }
75
-
76
- public async fetchEconomicsInfo(params: string): Promise<any> {
77
- return await this.get(`repairs/metrics/get_list_task_economic_performance?${params}`)
78
- }
79
- public async fetchQualityMetrics(params: string): Promise<any> {
80
- return await this.get(`repairs/metrics/get_quality_metrics?${params}`)
81
- }
82
-
83
- public async fetchQualityInfo(params: string): Promise<any> {
84
- return await this.get(`repairs/metrics/get_list_task_by_quality?${params}`)
85
- }
86
-
87
- public async fetchPieWorkZone(queryString: string): Promise<ResponseApi<any>> {
88
- return await this.get('repairs/metrics/get_list_work_zone_instrument' + '?' + queryString)
89
- }
90
-
91
- public async fetchWorkZoneInfo(queryString: string): Promise<ResponseApi<any>> {
92
- return await this.get('repairs/metrics/get_list_work_zone_instrument_by_status' + '?' + queryString)
93
- }
94
- }
95
-
96
- let api: MetricsService
97
-
98
- export default function useMetricsService() {
99
- if (!api) api = new MetricsService()
100
- return api
101
- }
1
+ import ApiService, { ResponseApi } from '@/api/settings/ApiService'
2
+
3
+ class MetricsService extends ApiService {
4
+ public async fetchPieProjects(queryString: string): Promise<ResponseApi<any>> {
5
+ return await this.get('repairs/pie/projects' + '?' + queryString)
6
+ }
7
+
8
+ public async fetchPieTasks(queryString: string): Promise<ResponseApi<any>> {
9
+ return await this.get('repairs/pie/tasks' + '?' + queryString)
10
+ }
11
+
12
+ public async fetchPiePersonnel(queryString: string): Promise<ResponseApi<any>> {
13
+ return await this.get('repairs/metrics/get_list_position' + '?' + queryString)
14
+ }
15
+
16
+ public async fetchPersonnelData(queryString: string): Promise<ResponseApi<any>> {
17
+ return await this.get('repairs/metrics/list_position_intersection_group_by_status' + '?' + queryString)
18
+ }
19
+
20
+ public async fetchPersonnelInfo(params: string): Promise<ResponseApi<any>> {
21
+ return await this.get(`repairs/metrics/list_position_intersection_details?${params}`)
22
+ }
23
+
24
+ public async fetchPiePersonnelInfo(params: string): Promise<any> {
25
+ return await this.get(`repairs/metrics/get_list_user_by_position?${params}`)
26
+ }
27
+
28
+ public async fetchPieCriticalPath(queryString: string): Promise<any[]> {
29
+ return await this.get('repairs/metrics/get_critical_path_group_by_status' + '?' + queryString)
30
+ }
31
+
32
+ public async fetchPieCriticalPathInfo(params: string): Promise<any> {
33
+ return await this.get(`repairs/metrics/get_list_task_critical_path_by_status?${params}`)
34
+ }
35
+
36
+ public async fetchPieTmc(queryString: string): Promise<ResponseApi<any>> {
37
+ return await this.get('repairs/metrics/get_list_instrument_type' + '?' + queryString)
38
+ }
39
+
40
+ public async fetchPieTmcInfo(params: string): Promise<any> {
41
+ return await this.get(`repairs/metrics/get_list_warehouse_by_instrument_type?${params}`)
42
+ }
43
+
44
+ public async fetchPieUntimelyClosedTask(queryString: string): Promise<any[]> {
45
+ return await this.get('repairs/metrics/get_list_comment_type' + '?' + queryString)
46
+ }
47
+
48
+ public async fetchPieUntimelyClosedTaskInfo(params: string): Promise<any> {
49
+ return await this.get(`repairs/metrics/get_list_task_by_comment_type?${params}`)
50
+ }
51
+
52
+ public async fetchPieAdditionalTasks(queryString: string): Promise<any[]> {
53
+ return await this.get('repairs/metrics/get_list_task_after_plan_fixate_group_by_status' + '?' + queryString)
54
+ }
55
+
56
+ public async fetchPieAdditionalTasksInfo(params: string): Promise<any> {
57
+ return await this.get(`repairs/metrics/get_list_task_after_plan_fixate_by_status?${params}`)
58
+ }
59
+
60
+ public async fetchPersonnel(queryString: string): Promise<any[]> {
61
+ return await this.get('repairs/statistic/personnel' + '?' + queryString)
62
+ }
63
+
64
+ public async fetchPieExpired(queryString: string): Promise<any[]> {
65
+ return await this.get('repairs/metrics/get_list_task_expired_group_by_status' + '?' + queryString)
66
+ }
67
+
68
+ public async fetchPieExpiredInfo(params: string): Promise<any> {
69
+ return await this.get(`repairs/metrics/get_list_task_expired?${params}`)
70
+ }
71
+
72
+ public async fetchEconomicsPerformance(params: string): Promise<any> {
73
+ return await this.get(`repairs/metrics/get_economic_performance?${params}`)
74
+ }
75
+
76
+ public async fetchEconomicsInfo(params: string): Promise<any> {
77
+ return await this.get(`repairs/metrics/get_list_task_economic_performance?${params}`)
78
+ }
79
+ public async fetchQualityMetrics(params: string): Promise<any> {
80
+ return await this.get(`repairs/metrics/get_quality_metrics?${params}`)
81
+ }
82
+
83
+ public async fetchQualityInfo(params: string): Promise<any> {
84
+ return await this.get(`repairs/metrics/get_list_task_by_quality?${params}`)
85
+ }
86
+
87
+ public async fetchPieWorkZone(queryString: string): Promise<ResponseApi<any>> {
88
+ return await this.get('repairs/metrics/get_list_work_zone_instrument' + '?' + queryString)
89
+ }
90
+
91
+ public async fetchWorkZoneInfo(queryString: string): Promise<ResponseApi<any>> {
92
+ return await this.get('repairs/metrics/get_list_work_zone_instrument_by_status' + '?' + queryString)
93
+ }
94
+ }
95
+
96
+ let api: MetricsService
97
+
98
+ export default function useMetricsService() {
99
+ if (!api) api = new MetricsService()
100
+ return api
101
+ }
@@ -1,137 +1,137 @@
1
- import ApiService, { ResponseApi } from '@/api/settings/ApiService'
2
- import {
3
- Api_Task_Close_Reason,
4
- Api_Task_Instrument_Dto,
5
- Api_Task_Instrument_From_Warehouse,
6
- Api_Task_Module_Instrument_Condition,
7
- Api_Tasks_Dto,
8
- Api_Tasks_Task_Dto,
9
- } from '@/api/types/Api_Tasks'
10
- import { Api_Equipment_Full_Dto, Api_Task_Video_Source, Api_Task_Video_Source_Stream } from '@/api/types/Api_Repairs'
11
-
12
- class TasksService extends ApiService {
13
- public async fetchTaskById(id: string): Promise<ResponseApi<Api_Tasks_Task_Dto>> {
14
- return await this.get(`/tasks/${id}`)
15
- }
16
-
17
- public async fetchTasksList(params: any): Promise<ResponseApi<Api_Tasks_Dto[]>> {
18
- return await this.get('/list/tasks/search', { params })
19
- }
20
-
21
- public async fetchSubtasksList(id: string): Promise<ResponseApi<Api_Tasks_Dto[]>> {
22
- return await this.get(`/task/${id}/subtasks/list`)
23
- }
24
-
25
- public async fetchTaskBranch(id: string): Promise<ResponseApi<any>> {
26
- return await this.get(`/get_list_task_branch?task_id=${id}`)
27
- }
28
-
29
- public async fetchInstrumentsList(params: any): Promise<ResponseApi<any[]>> {
30
- return await this.get('admin/instruments', { params })
31
- }
32
-
33
- public async fetchInstrumentTypeListWithPreparedWarehouse(params: {
34
- page: number
35
- per_page: number
36
- 'filterList[taskId]'?: string | undefined
37
- search?: string
38
- }): Promise<Api_Task_Instrument_From_Warehouse[]> {
39
- return await this.get('/instrument_type/get_instrument_type_list_with_prepared_warehouse', { params })
40
- }
41
-
42
- public async fetchInstrumentsEquivalentList(params: any): Promise<ResponseApi<Api_Task_Instrument_Dto[]>> {
43
- return await this.get('tasks/instrument/list', { params })
44
- }
45
-
46
- public async fetchDiffInstruments(params: any): Promise<ResponseApi<Api_Task_Module_Instrument_Condition>> {
47
- return await this.get(`tasks/${params.taskId}/fill/module`, { params })
48
- }
49
-
50
- public async replaceInstruments(payload: any): Promise<ResponseApi<any>> {
51
- return await this.post(`/instruments/equivalent/attach`, payload)
52
- }
53
-
54
- public async fetchTaskUsagePersonal(params: any): Promise<ResponseApi<unknown[]>> {
55
- return await this.get(`tasks/${params.taskId}/usage/users`, { params })
56
- }
57
-
58
- public async fetchTaskUsageInstrument(params: any): Promise<ResponseApi<unknown[]>> {
59
- return await this.get(`tasks/${params.taskId}/usage/instruments`, { params })
60
- }
61
-
62
- public fetchEquipment(params: any): Promise<ResponseApi<Api_Equipment_Full_Dto[]>> {
63
- return this.get('repairs/equipment/list', { params })
64
- }
65
-
66
- public fetchTaskVideoSources(params: any): Promise<ResponseApi<Api_Task_Video_Source[]>> {
67
- return this.get('work_zone/get_list_video_source', { params })
68
- }
69
-
70
- public fetchTaskVideoSourcesStream(params: any): Promise<ResponseApi<Api_Task_Video_Source_Stream[]>> {
71
- return this.get('horizon/video-source', { params })
72
- }
73
-
74
- public createWorkZone(payload: any): Promise<unknown> {
75
- return this.post('admin/work-zones', payload)
76
- }
77
-
78
- public async createTask(payload: any): Promise<ResponseApi<any>> {
79
- return await this.post(`tasks`, payload)
80
- }
81
-
82
- public async editTask(payload: any): Promise<ResponseApi<any>> {
83
- return await this.put(`tasks/${payload.taskId}`, payload.data)
84
- }
85
-
86
- public async mergeTask(payload: { name: string; tasks_id: string[] }): Promise<ResponseApi<any>> {
87
- return await this.post(`tasks/merge`, payload)
88
- }
89
-
90
- public async deleteTask(id: string): Promise<any> {
91
- return await this.delete(`tasks/${id}`)
92
- }
93
-
94
- public async changeStatus(payload: { taskId: string; data: unknown }): Promise<unknown> {
95
- const { taskId, data } = payload
96
- return await this.put(`task/${taskId}/change-status`, data)
97
- }
98
-
99
- public async uploadComment(payload: unknown): Promise<unknown> {
100
- return await this.post('comments', payload)
101
- }
102
-
103
- public async deleteComment(commentId: string): Promise<unknown> {
104
- return await this.delete(`comments/${commentId}`)
105
- }
106
-
107
- public async editComment(payload: { commentId: string; data: unknown }): Promise<unknown> {
108
- const { commentId, data } = payload
109
- return await this.put(`comments/${commentId}`, data)
110
- }
111
-
112
- public async saveMetrics(payload: unknown): Promise<unknown> {
113
- return await this.put('/update_quality_metrics', payload)
114
- }
115
-
116
- public async checkReasonForStatus(payload: { task_Id: string; data: unknown }): Promise<Api_Task_Close_Reason> {
117
- return await this.post('/tasks/check_reason_for_task', payload)
118
- }
119
-
120
- public async verifyTaskStatus(payload: { task_id: string; data: unknown }): Promise<unknown> {
121
- const { task_id, data } = payload
122
- return await this.get(`/task/${task_id}/change-status/verification`, {
123
- params: data,
124
- })
125
- }
126
-
127
- public async checkBranchBeforeCloseTask(payload: { task_Id: string }): Promise<unknown> {
128
- return await this.post(`/check_branch_before_close_task`, payload)
129
- }
130
- }
131
-
132
- let api: TasksService
133
-
134
- export default function useTasksService() {
135
- if (!api) api = new TasksService()
136
- return api
137
- }
1
+ import ApiService, { ResponseApi } from '@/api/settings/ApiService'
2
+ import {
3
+ Api_Task_Close_Reason,
4
+ Api_Task_Instrument_Dto,
5
+ Api_Task_Instrument_From_Warehouse,
6
+ Api_Task_Module_Instrument_Condition,
7
+ Api_Tasks_Dto,
8
+ Api_Tasks_Task_Dto,
9
+ } from '@/api/types/Api_Tasks'
10
+ import { Api_Equipment_Full_Dto, Api_Task_Video_Source, Api_Task_Video_Source_Stream } from '@/api/types/Api_Repairs'
11
+
12
+ class TasksService extends ApiService {
13
+ public async fetchTaskById(id: string): Promise<ResponseApi<Api_Tasks_Task_Dto>> {
14
+ return await this.get(`/tasks/${id}`)
15
+ }
16
+
17
+ public async fetchTasksList(params: any): Promise<ResponseApi<Api_Tasks_Dto[]>> {
18
+ return await this.get('/list/tasks/search', { params })
19
+ }
20
+
21
+ public async fetchSubtasksList(id: string): Promise<ResponseApi<Api_Tasks_Dto[]>> {
22
+ return await this.get(`/task/${id}/subtasks/list`)
23
+ }
24
+
25
+ public async fetchTaskBranch(id: string): Promise<ResponseApi<any>> {
26
+ return await this.get(`/get_list_task_branch?task_id=${id}`)
27
+ }
28
+
29
+ public async fetchInstrumentsList(params: any): Promise<ResponseApi<any[]>> {
30
+ return await this.get('admin/instruments', { params })
31
+ }
32
+
33
+ public async fetchInstrumentTypeListWithPreparedWarehouse(params: {
34
+ page: number
35
+ per_page: number
36
+ 'filterList[taskId]'?: string | undefined
37
+ search?: string
38
+ }): Promise<Api_Task_Instrument_From_Warehouse[]> {
39
+ return await this.get('/instrument_type/get_instrument_type_list_with_prepared_warehouse', { params })
40
+ }
41
+
42
+ public async fetchInstrumentsEquivalentList(params: any): Promise<ResponseApi<Api_Task_Instrument_Dto[]>> {
43
+ return await this.get('tasks/instrument/list', { params })
44
+ }
45
+
46
+ public async fetchDiffInstruments(params: any): Promise<ResponseApi<Api_Task_Module_Instrument_Condition>> {
47
+ return await this.get(`tasks/${params.taskId}/fill/module`, { params })
48
+ }
49
+
50
+ public async replaceInstruments(payload: any): Promise<ResponseApi<any>> {
51
+ return await this.post(`/instruments/equivalent/attach`, payload)
52
+ }
53
+
54
+ public async fetchTaskUsagePersonal(params: any): Promise<ResponseApi<unknown[]>> {
55
+ return await this.get(`tasks/${params.taskId}/usage/users`, { params })
56
+ }
57
+
58
+ public async fetchTaskUsageInstrument(params: any): Promise<ResponseApi<unknown[]>> {
59
+ return await this.get(`tasks/${params.taskId}/usage/instruments`, { params })
60
+ }
61
+
62
+ public fetchEquipment(params: any): Promise<ResponseApi<Api_Equipment_Full_Dto[]>> {
63
+ return this.get('repairs/equipment/list', { params })
64
+ }
65
+
66
+ public fetchTaskVideoSources(params: any): Promise<ResponseApi<Api_Task_Video_Source[]>> {
67
+ return this.get('work_zone/get_list_video_source', { params })
68
+ }
69
+
70
+ public fetchTaskVideoSourcesStream(params: any): Promise<ResponseApi<Api_Task_Video_Source_Stream[]>> {
71
+ return this.get('horizon/video-source', { params })
72
+ }
73
+
74
+ public createWorkZone(payload: any): Promise<unknown> {
75
+ return this.post('admin/work-zones', payload)
76
+ }
77
+
78
+ public async createTask(payload: any): Promise<ResponseApi<any>> {
79
+ return await this.post(`tasks`, payload)
80
+ }
81
+
82
+ public async editTask(payload: any): Promise<ResponseApi<any>> {
83
+ return await this.put(`tasks/${payload.taskId}`, payload.data)
84
+ }
85
+
86
+ public async mergeTask(payload: { name: string; tasks_id: string[] }): Promise<ResponseApi<any>> {
87
+ return await this.post(`tasks/merge`, payload)
88
+ }
89
+
90
+ public async deleteTask(id: string): Promise<any> {
91
+ return await this.delete(`tasks/${id}`)
92
+ }
93
+
94
+ public async changeStatus(payload: { taskId: string; data: unknown }): Promise<unknown> {
95
+ const { taskId, data } = payload
96
+ return await this.put(`task/${taskId}/change-status`, data)
97
+ }
98
+
99
+ public async uploadComment(payload: unknown): Promise<unknown> {
100
+ return await this.post('comments', payload)
101
+ }
102
+
103
+ public async deleteComment(commentId: string): Promise<unknown> {
104
+ return await this.delete(`comments/${commentId}`)
105
+ }
106
+
107
+ public async editComment(payload: { commentId: string; data: unknown }): Promise<unknown> {
108
+ const { commentId, data } = payload
109
+ return await this.put(`comments/${commentId}`, data)
110
+ }
111
+
112
+ public async saveMetrics(payload: unknown): Promise<unknown> {
113
+ return await this.put('/update_quality_metrics', payload)
114
+ }
115
+
116
+ public async checkReasonForStatus(payload: { task_Id: string; data: unknown }): Promise<Api_Task_Close_Reason> {
117
+ return await this.post('/tasks/check_reason_for_task', payload)
118
+ }
119
+
120
+ public async verifyTaskStatus(payload: { task_id: string; data: unknown }): Promise<unknown> {
121
+ const { task_id, data } = payload
122
+ return await this.get(`/task/${task_id}/change-status/verification`, {
123
+ params: data,
124
+ })
125
+ }
126
+
127
+ public async checkBranchBeforeCloseTask(payload: { task_Id: string }): Promise<unknown> {
128
+ return await this.post(`/check_branch_before_close_task`, payload)
129
+ }
130
+ }
131
+
132
+ let api: TasksService
133
+
134
+ export default function useTasksService() {
135
+ if (!api) api = new TasksService()
136
+ return api
137
+ }