shared-ritm 1.2.35 → 1.2.36

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 (44) hide show
  1. package/README.md +103 -103
  2. package/dist/index.css +1 -1
  3. package/dist/shared-ritm.es.js +10 -10
  4. package/dist/shared-ritm.umd.js +2 -2
  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/package.json +1 -1
  8. package/src/App.vue +2461 -2461
  9. package/src/api/services/AuthService.ts +58 -58
  10. package/src/api/services/ControlsService.ts +32 -0
  11. package/src/api/services/GanttService.ts +17 -17
  12. package/src/api/services/MetricsService.ts +101 -101
  13. package/src/api/services/TasksService.ts +137 -137
  14. package/src/api/settings/ApiService.ts +126 -126
  15. package/src/api/types/Api_Controls.ts +12 -0
  16. package/src/api/types/Api_Files.ts +1 -1
  17. package/src/api/types/Api_Projects.ts +55 -55
  18. package/src/api/types/Api_Repairs.ts +93 -93
  19. package/src/common/app-checkbox/AppCheckbox.vue +26 -26
  20. package/src/common/app-date-picker/AppDatePicker.vue +81 -81
  21. package/src/common/app-dialogs/AppConfirmDialog.vue +100 -100
  22. package/src/common/app-dropdown/AppDropdown.vue +31 -31
  23. package/src/common/app-icon/AppIcon.vue +108 -108
  24. package/src/common/app-input-search/AppInputSearch.vue +174 -174
  25. package/src/common/app-layout/AppLayout.vue +84 -84
  26. package/src/common/app-layout/components/AppLayoutHeader.vue +246 -246
  27. package/src/common/app-layout/components/AppLayoutPage.vue +16 -16
  28. package/src/common/app-select/AppSelect.vue +157 -157
  29. package/src/common/app-sidebar/components/SidebarMenuItem.vue +146 -146
  30. package/src/common/app-toggle/AppToggle.vue +23 -23
  31. package/src/common/app-wrapper/AppWrapper.vue +28 -28
  32. package/src/icons/dialogs/RemoveIcon.vue +12 -12
  33. package/src/icons/dialogs/SafetyIcon.vue +12 -12
  34. package/src/icons/header/NotificationIcon.vue +18 -18
  35. package/src/icons/header/PersonIcon.vue +11 -11
  36. package/src/icons/header/SettingIcon.vue +14 -14
  37. package/src/icons/task/attention-icon.vue +13 -13
  38. package/src/icons/task/clock-icon.vue +10 -10
  39. package/src/icons/task/delete-icon.vue +10 -10
  40. package/src/icons/task/fire-icon.vue +16 -16
  41. package/src/main.ts +28 -28
  42. package/src/shared/styles/general.css +96 -96
  43. package/src/utils/confirm.ts +12 -12
  44. package/src/utils/notification.ts +9 -9
@@ -1,126 +1,126 @@
1
- import axios, { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios'
2
-
3
- export enum ApiServiceType {
4
- SERVICE_AUTH = 'SERVICE_AUTH',
5
- }
6
-
7
- export type ResponseApi<T> = {
8
- count: number
9
- current_page: number
10
- data: T
11
- per_page: number
12
- total: number
13
- total_pages: number
14
- }
15
-
16
- export default class ApiService {
17
- private axiosInstance: AxiosInstance
18
-
19
- constructor() {
20
- this.axiosInstance = axios.create({
21
- baseURL: process.env.VUE_APP_BACKEND,
22
- headers: {
23
- 'Content-Type': 'application/json',
24
- Accept: 'application/json',
25
- },
26
- })
27
-
28
- this.axiosInstance.interceptors.request.use(
29
- (config: InternalAxiosRequestConfig) => {
30
- const token = this.getToken()
31
- if (token && config.headers) {
32
- config.headers.Authorization = `Bearer ${token}`
33
- }
34
- return config
35
- },
36
- (error: AxiosError) => {
37
- return Promise.reject(error)
38
- },
39
- )
40
-
41
- this.axiosInstance.interceptors.response.use(
42
- (response: AxiosResponse) => {
43
- return response.data
44
- },
45
- (error: AxiosError) => {
46
- if (error.response?.status === 401 || error.response?.status === 403) {
47
- this.logout()
48
- }
49
- return Promise.reject(error)
50
- },
51
- )
52
- }
53
-
54
- private getToken() {
55
- return localStorage.getItem('token')
56
- }
57
-
58
- private removeToken() {
59
- localStorage.removeItem('token')
60
- }
61
-
62
- public logout(): void {
63
- this.removeToken()
64
- window.location.href = '/sign-in'
65
- }
66
-
67
- private handleError(error: AxiosError): void {
68
- if (error.response) {
69
- console.error('API Error:', error.response.status, error.response.data)
70
- } else if (error.request) {
71
- console.error('No response received:', error.request)
72
- } else {
73
- console.error('Error during request setup:', error.message)
74
- }
75
- }
76
-
77
- protected async get<T>(url: string, options?: AxiosRequestConfig) {
78
- try {
79
- const response: AxiosResponse<T> = await this.axiosInstance.get<T>(url, options)
80
- return response?.data ?? (response as unknown as T)
81
- } catch (error) {
82
- const axiosError = error as AxiosError
83
- this.handleError(axiosError)
84
- throw error
85
- }
86
- }
87
-
88
- protected async delete<T>(url: string, options?: AxiosRequestConfig) {
89
- try {
90
- return await this.axiosInstance.delete<T>(url, options)
91
- } catch (error) {
92
- const axiosError = error as AxiosError
93
- this.handleError(axiosError)
94
- throw error
95
- }
96
- }
97
-
98
- protected async post<T1, T2>(url: string, payload: T1, options?: AxiosRequestConfig) {
99
- try {
100
- const response: AxiosResponse<T2> = await this.axiosInstance.post<T1, AxiosResponse<T2>>(url, payload, options)
101
- return response?.data || (response as any)
102
- } catch (error) {
103
- const axiosError = error as AxiosError
104
- this.handleError(axiosError)
105
- throw error
106
- }
107
- }
108
-
109
- // protected patch<T1, T2>(url: string, payload: T1, type: ApiServiceType, options?: AxiosRequestConfig): Promise<T2> {
110
- // return axios
111
- // .patch<T1, AxiosResponse<T2>>(apiServiceUrls[type] + url, payload, options)
112
- // .catch((err: AxiosError) => processError401<T2>(err))
113
- // .then(extractData)
114
- // }
115
- //
116
- protected async put<T1, T2>(url: string, payload: T1, options?: AxiosRequestConfig) {
117
- try {
118
- const response: AxiosResponse<T2> = await this.axiosInstance.put<T1, AxiosResponse<T2>>(url, payload, options)
119
- return response.data
120
- } catch (error) {
121
- const axiosError = error as AxiosError
122
- this.handleError(axiosError)
123
- throw error
124
- }
125
- }
126
- }
1
+ import axios, { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios'
2
+
3
+ export enum ApiServiceType {
4
+ SERVICE_AUTH = 'SERVICE_AUTH',
5
+ }
6
+
7
+ export type ResponseApi<T> = {
8
+ count: number
9
+ current_page: number
10
+ data: T
11
+ per_page: number
12
+ total: number
13
+ total_pages: number
14
+ }
15
+
16
+ export default class ApiService {
17
+ private axiosInstance: AxiosInstance
18
+
19
+ constructor() {
20
+ this.axiosInstance = axios.create({
21
+ baseURL: process.env.VUE_APP_BACKEND,
22
+ headers: {
23
+ 'Content-Type': 'application/json',
24
+ Accept: 'application/json',
25
+ },
26
+ })
27
+
28
+ this.axiosInstance.interceptors.request.use(
29
+ (config: InternalAxiosRequestConfig) => {
30
+ const token = this.getToken()
31
+ if (token && config.headers) {
32
+ config.headers.Authorization = `Bearer ${token}`
33
+ }
34
+ return config
35
+ },
36
+ (error: AxiosError) => {
37
+ return Promise.reject(error)
38
+ },
39
+ )
40
+
41
+ this.axiosInstance.interceptors.response.use(
42
+ (response: AxiosResponse) => {
43
+ return response.data
44
+ },
45
+ (error: AxiosError) => {
46
+ if (error.response?.status === 401 || error.response?.status === 403) {
47
+ this.logout()
48
+ }
49
+ return Promise.reject(error)
50
+ },
51
+ )
52
+ }
53
+
54
+ private getToken() {
55
+ return localStorage.getItem('token')
56
+ }
57
+
58
+ private removeToken() {
59
+ localStorage.removeItem('token')
60
+ }
61
+
62
+ public logout(): void {
63
+ this.removeToken()
64
+ window.location.href = '/sign-in'
65
+ }
66
+
67
+ private handleError(error: AxiosError): void {
68
+ if (error.response) {
69
+ console.error('API Error:', error.response.status, error.response.data)
70
+ } else if (error.request) {
71
+ console.error('No response received:', error.request)
72
+ } else {
73
+ console.error('Error during request setup:', error.message)
74
+ }
75
+ }
76
+
77
+ protected async get<T>(url: string, options?: AxiosRequestConfig) {
78
+ try {
79
+ const response: AxiosResponse<T> = await this.axiosInstance.get<T>(url, options)
80
+ return response?.data ?? (response as unknown as T)
81
+ } catch (error) {
82
+ const axiosError = error as AxiosError
83
+ this.handleError(axiosError)
84
+ throw error
85
+ }
86
+ }
87
+
88
+ protected async delete<T>(url: string, options?: AxiosRequestConfig) {
89
+ try {
90
+ return await this.axiosInstance.delete<T>(url, options)
91
+ } catch (error) {
92
+ const axiosError = error as AxiosError
93
+ this.handleError(axiosError)
94
+ throw error
95
+ }
96
+ }
97
+
98
+ protected async post<T1, T2>(url: string, payload: T1, options?: AxiosRequestConfig) {
99
+ try {
100
+ const response: AxiosResponse<T2> = await this.axiosInstance.post<T1, AxiosResponse<T2>>(url, payload, options)
101
+ return response?.data || (response as any)
102
+ } catch (error) {
103
+ const axiosError = error as AxiosError
104
+ this.handleError(axiosError)
105
+ throw error
106
+ }
107
+ }
108
+
109
+ // protected patch<T1, T2>(url: string, payload: T1, type: ApiServiceType, options?: AxiosRequestConfig): Promise<T2> {
110
+ // return axios
111
+ // .patch<T1, AxiosResponse<T2>>(apiServiceUrls[type] + url, payload, options)
112
+ // .catch((err: AxiosError) => processError401<T2>(err))
113
+ // .then(extractData)
114
+ // }
115
+ //
116
+ protected async put<T1, T2>(url: string, payload: T1, options?: AxiosRequestConfig) {
117
+ try {
118
+ const response: AxiosResponse<T2> = await this.axiosInstance.put<T1, AxiosResponse<T2>>(url, payload, options)
119
+ return response.data
120
+ } catch (error) {
121
+ const axiosError = error as AxiosError
122
+ this.handleError(axiosError)
123
+ throw error
124
+ }
125
+ }
126
+ }
@@ -0,0 +1,12 @@
1
+ export type Api_Controllers_Dto = {
2
+ id: string
3
+ full_name: string
4
+ }
5
+ export type Api_ControlZones_Dto = {
6
+ id: string
7
+ name: string
8
+ inventory_number: string
9
+ uuid: string
10
+ controller_zone: string
11
+ users?: Api_Controllers_Dto[]
12
+ }
@@ -1 +1 @@
1
- export type Api_Files_Responsible_Dto = unknown
1
+ export type Api_Files_Responsible_Dto = unknown
@@ -1,55 +1,55 @@
1
- export type Api_Project_Repair = {
2
- id: string
3
- name: string
4
- start_date: null | string
5
- end_date: null | string
6
- }
7
-
8
- export type Api_Project_Team = {
9
- id: string
10
- name: string
11
- display_name: string
12
- description: string
13
- created_at: string
14
- updated_at: string
15
- pivot: {
16
- project_id: string
17
- team_id: string
18
- }
19
- }
20
-
21
- export type Api_Project_Category = {
22
- code: number
23
- display_name: string
24
- name: string
25
- }
26
-
27
- export type Api_Project_Status = {
28
- id: string
29
- name: string
30
- title: string
31
- description: string
32
- created_at: string | null
33
- updated_at: string | null
34
- deleted_at: string | null
35
- }
36
-
37
- export type Api_Project_Dto = {
38
- id: string
39
- name: string
40
- description: null
41
- image: null
42
- plan_date: string | null
43
- deadline: string | null
44
- fact_start_date: string | null
45
- fact_end_date: string | null
46
- planned_start: string | null
47
- planned_end: string | null
48
- deleted_at: string | null
49
- total_tasks: number
50
- is_archive: boolean
51
- teams: Api_Project_Team[]
52
- status: Api_Project_Status
53
- category: Api_Project_Category
54
- repair: Api_Project_Repair | null
55
- }
1
+ export type Api_Project_Repair = {
2
+ id: string
3
+ name: string
4
+ start_date: null | string
5
+ end_date: null | string
6
+ }
7
+
8
+ export type Api_Project_Team = {
9
+ id: string
10
+ name: string
11
+ display_name: string
12
+ description: string
13
+ created_at: string
14
+ updated_at: string
15
+ pivot: {
16
+ project_id: string
17
+ team_id: string
18
+ }
19
+ }
20
+
21
+ export type Api_Project_Category = {
22
+ code: number
23
+ display_name: string
24
+ name: string
25
+ }
26
+
27
+ export type Api_Project_Status = {
28
+ id: string
29
+ name: string
30
+ title: string
31
+ description: string
32
+ created_at: string | null
33
+ updated_at: string | null
34
+ deleted_at: string | null
35
+ }
36
+
37
+ export type Api_Project_Dto = {
38
+ id: string
39
+ name: string
40
+ description: null
41
+ image: null
42
+ plan_date: string | null
43
+ deadline: string | null
44
+ fact_start_date: string | null
45
+ fact_end_date: string | null
46
+ planned_start: string | null
47
+ planned_end: string | null
48
+ deleted_at: string | null
49
+ total_tasks: number
50
+ is_archive: boolean
51
+ teams: Api_Project_Team[]
52
+ status: Api_Project_Status
53
+ category: Api_Project_Category
54
+ repair: Api_Project_Repair | null
55
+ }
@@ -1,93 +1,93 @@
1
- export type Api_Team = {
2
- id: string
3
- display_name: string
4
- }
5
-
6
- export type Api_Equipment_Short_Dto = {
7
- id: string
8
- name: string
9
- }
10
-
11
- export type Api_Repairs = {
12
- id: string
13
- name: string
14
- }
15
-
16
- export type Api_Projects = {
17
- id: string
18
- name: string
19
- }
20
-
21
- export type OptionFilters = {
22
- teams?: Api_Team[]
23
- equipments?: Api_Equipment_Short_Dto[]
24
- }
25
-
26
- export type Api_Equipment_Full_Dto = {
27
- id: string
28
- model: null | string
29
- name: string
30
- registration_number: string
31
- repair_frequency: number
32
- repair_range: number
33
- }
34
-
35
- export type Api_Task_Video_Source = {
36
- id: string
37
- name: string
38
- work_zones_by_tasks: Array<{
39
- coordinates: { x0: number; x1: number; y0: number; y1: number }
40
- id: string
41
- tasks: unknown[]
42
- title: string
43
- }>
44
- }
45
-
46
- export type Api_Task_Video_Source_Stream = {
47
- id: string
48
- name: string
49
- url: string
50
- width: number
51
- height: number
52
- fps: string
53
- login: string
54
- password: string
55
- comment: unknown
56
- work_zones: unknown[]
57
- video_source: unknown[]
58
- related_video_sources: unknown[]
59
- interactive_zones: unknown
60
- domed: boolean
61
- snapshot_path: string
62
- shapes: unknown[]
63
- }
64
-
65
- export type Api_Create_Repair_With_Equipments = {
66
- name: string
67
- display_name: string
68
- description: string
69
- equipment_id: string
70
- power_output_MWh?: number
71
- cost_per_MWh?: number
72
- category?: string
73
- }
74
-
75
- export type Api_Update_Repair = {
76
- name?: string
77
- display_name?: string
78
- description: string
79
- power_output_MWh?: number
80
- cost_per_MWh?: number
81
- category?: string
82
- }
83
-
84
- export type Api_Repair_Dto = {
85
- id: string
86
- name: string
87
- display_name: string
88
- description: string
89
- start_date: string
90
- end_date: string
91
- projects: Api_Projects[]
92
- equipments: Api_Equipment_Full_Dto[]
93
- }
1
+ export type Api_Team = {
2
+ id: string
3
+ display_name: string
4
+ }
5
+
6
+ export type Api_Equipment_Short_Dto = {
7
+ id: string
8
+ name: string
9
+ }
10
+
11
+ export type Api_Repairs = {
12
+ id: string
13
+ name: string
14
+ }
15
+
16
+ export type Api_Projects = {
17
+ id: string
18
+ name: string
19
+ }
20
+
21
+ export type OptionFilters = {
22
+ teams?: Api_Team[]
23
+ equipments?: Api_Equipment_Short_Dto[]
24
+ }
25
+
26
+ export type Api_Equipment_Full_Dto = {
27
+ id: string
28
+ model: null | string
29
+ name: string
30
+ registration_number: string
31
+ repair_frequency: number
32
+ repair_range: number
33
+ }
34
+
35
+ export type Api_Task_Video_Source = {
36
+ id: string
37
+ name: string
38
+ work_zones_by_tasks: Array<{
39
+ coordinates: { x0: number; x1: number; y0: number; y1: number }
40
+ id: string
41
+ tasks: unknown[]
42
+ title: string
43
+ }>
44
+ }
45
+
46
+ export type Api_Task_Video_Source_Stream = {
47
+ id: string
48
+ name: string
49
+ url: string
50
+ width: number
51
+ height: number
52
+ fps: string
53
+ login: string
54
+ password: string
55
+ comment: unknown
56
+ work_zones: unknown[]
57
+ video_source: unknown[]
58
+ related_video_sources: unknown[]
59
+ interactive_zones: unknown
60
+ domed: boolean
61
+ snapshot_path: string
62
+ shapes: unknown[]
63
+ }
64
+
65
+ export type Api_Create_Repair_With_Equipments = {
66
+ name: string
67
+ display_name: string
68
+ description: string
69
+ equipment_id: string
70
+ power_output_MWh?: number
71
+ cost_per_MWh?: number
72
+ category?: string
73
+ }
74
+
75
+ export type Api_Update_Repair = {
76
+ name?: string
77
+ display_name?: string
78
+ description: string
79
+ power_output_MWh?: number
80
+ cost_per_MWh?: number
81
+ category?: string
82
+ }
83
+
84
+ export type Api_Repair_Dto = {
85
+ id: string
86
+ name: string
87
+ display_name: string
88
+ description: string
89
+ start_date: string
90
+ end_date: string
91
+ projects: Api_Projects[]
92
+ equipments: Api_Equipment_Full_Dto[]
93
+ }
@@ -1,26 +1,26 @@
1
- <template>
2
- <q-checkbox v-model="value" :class="$style['app-checkbox']" />
3
- </template>
4
- <script setup lang="ts">
5
- import { computed } from 'vue'
6
-
7
- interface Props {
8
- modelValue: any
9
- }
10
-
11
- const props = defineProps<Props>()
12
- const emit = defineEmits(['update:modelValue', 'number'])
13
-
14
- const value = computed({
15
- get: () => props.modelValue,
16
- set: (newValue: any) => emit('update:modelValue', newValue),
17
- })
18
- </script>
19
- <style module lang="scss">
20
- .app-checkbox {
21
- :global(.q-checkbox__bg) {
22
- border-radius: 6px;
23
- border-color: white;
24
- }
25
- }
26
- </style>
1
+ <template>
2
+ <q-checkbox v-model="value" :class="$style['app-checkbox']" />
3
+ </template>
4
+ <script setup lang="ts">
5
+ import { computed } from 'vue'
6
+
7
+ interface Props {
8
+ modelValue: any
9
+ }
10
+
11
+ const props = defineProps<Props>()
12
+ const emit = defineEmits(['update:modelValue', 'number'])
13
+
14
+ const value = computed({
15
+ get: () => props.modelValue,
16
+ set: (newValue: any) => emit('update:modelValue', newValue),
17
+ })
18
+ </script>
19
+ <style module lang="scss">
20
+ .app-checkbox {
21
+ :global(.q-checkbox__bg) {
22
+ border-radius: 6px;
23
+ border-color: white;
24
+ }
25
+ }
26
+ </style>