shared-ritm 1.2.133 → 1.2.134

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.
@@ -1,13 +1,18 @@
1
1
  import ApiService from '../settings/ApiService';
2
- import { Api_Schedule_Complete_Brigade, Api_Schedule_Config, Api_Schedule_Table_Brigade } from '@/api/types/Api_Schedule';
2
+ import { Api_Schedule_Add_Shift, Api_Schedule_Complete_Brigade, Api_Schedule_Config, Api_Schedule_Edit_Shifts, Api_Schedule_Swap_Shifts, Api_Schedule_Table_Brigade } from '@/api/types/Api_Schedule';
3
3
  declare class ScheduleService extends ApiService {
4
- fetchSchedule(id: string): Promise<any>;
5
4
  fetchScheduleConfig(): Promise<Api_Schedule_Config>;
6
- deleteBrigadesFromSchedule(id: string, brigadeIds: string[]): Promise<{
7
- data: boolean;
8
- status: number;
9
- }>;
5
+ fetchSchedule(id: string): Promise<any>;
6
+ fetchScheduleTable(id: string): Promise<any>;
10
7
  completeBrigadeSchedule(id: string, body: Api_Schedule_Complete_Brigade): Promise<Api_Schedule_Table_Brigade>;
8
+ autocompleteBrigadesSchedule(id: string, body: {
9
+ shifts: string[];
10
+ }): Promise<any>;
11
+ addBrigadeShift(id: string, body: Api_Schedule_Add_Shift): Promise<any>;
12
+ swapBrigadeShifts(id: string, body: Api_Schedule_Swap_Shifts): Promise<any>;
13
+ editBrigadeShifts(id: string, body: Api_Schedule_Edit_Shifts): Promise<any>;
14
+ deleteBrigadeShifts(id: string, shift_ids: string[]): Promise<any>;
15
+ deleteBrigadesFromSchedule(id: string, brigade_ids: string[]): Promise<any>;
11
16
  }
12
17
  export default function useScheduleService(): ScheduleService;
13
18
  export {};
@@ -24,3 +24,17 @@ export type Api_Schedule_Table_Brigade = {
24
24
  task_master: unknown | null;
25
25
  is_deleted: boolean;
26
26
  };
27
+ export type Api_Schedule_Add_Shift = {
28
+ brigade_id: string;
29
+ dates: string[];
30
+ shift_template_id: string;
31
+ };
32
+ export type Api_Schedule_Swap_Shifts = {
33
+ brigade_id: string;
34
+ shifts: string[];
35
+ };
36
+ export type Api_Schedule_Edit_Shifts = {
37
+ brigade_id: string;
38
+ shift_ids: string[];
39
+ shift_template_id: string;
40
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shared-ritm",
3
- "version": "1.2.133",
3
+ "version": "1.2.134",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",
@@ -1,21 +1,24 @@
1
1
  import ApiService from '../settings/ApiService'
2
2
  import {
3
+ Api_Schedule_Add_Shift,
3
4
  Api_Schedule_Complete_Brigade,
4
5
  Api_Schedule_Config,
6
+ Api_Schedule_Edit_Shifts,
7
+ Api_Schedule_Swap_Shifts,
5
8
  Api_Schedule_Table_Brigade,
6
9
  } from '@/api/types/Api_Schedule'
7
10
 
8
11
  class ScheduleService extends ApiService {
9
- public fetchSchedule(id: string): Promise<any> {
10
- return this.get<any>(`schedule/${id}`)
11
- }
12
-
13
12
  public fetchScheduleConfig(): Promise<Api_Schedule_Config> {
14
13
  return this.get<Api_Schedule_Config>('schedule/config')
15
14
  }
16
15
 
17
- public deleteBrigadesFromSchedule(id: string, brigadeIds: string[]): Promise<{ data: boolean; status: number }> {
18
- return this.delete(`schedule/${id}/delete_brigades`, { data: { brigadeIds } })
16
+ public fetchSchedule(id: string): Promise<any> {
17
+ return this.get<any>(`schedule/${id}`)
18
+ }
19
+
20
+ public fetchScheduleTable(id: string): Promise<any> {
21
+ return this.get<any>(`schedule/${id}/get_brigades_table`)
19
22
  }
20
23
 
21
24
  public completeBrigadeSchedule(id: string, body: Api_Schedule_Complete_Brigade): Promise<Api_Schedule_Table_Brigade> {
@@ -24,6 +27,30 @@ class ScheduleService extends ApiService {
24
27
  body,
25
28
  )
26
29
  }
30
+
31
+ public autocompleteBrigadesSchedule(id: string, body: { shifts: string[] }): Promise<any> {
32
+ return this.post(`schedule/${id}/autocomplete`, body)
33
+ }
34
+
35
+ public addBrigadeShift(id: string, body: Api_Schedule_Add_Shift): Promise<any> {
36
+ return this.post(`schedule/${id}/shifts`, body)
37
+ }
38
+
39
+ public swapBrigadeShifts(id: string, body: Api_Schedule_Swap_Shifts): Promise<any> {
40
+ return this.patch(`schedule/${id}/shifts/switch_shift_templates`, body)
41
+ }
42
+
43
+ public editBrigadeShifts(id: string, body: Api_Schedule_Edit_Shifts): Promise<any> {
44
+ return this.patch(`schedule/${id}/shifts`, body)
45
+ }
46
+
47
+ public deleteBrigadeShifts(id: string, shift_ids: string[]): Promise<any> {
48
+ return this.delete(`schedule/${id}/shifts`, { data: { shift_ids } })
49
+ }
50
+
51
+ public deleteBrigadesFromSchedule(id: string, brigade_ids: string[]): Promise<any> {
52
+ return this.patch(`schedule/${id}/delete_brigades`, { brigade_ids })
53
+ }
27
54
  }
28
55
 
29
56
  let api: ScheduleService
@@ -27,3 +27,20 @@ export type Api_Schedule_Table_Brigade = {
27
27
  task_master: unknown | null
28
28
  is_deleted: boolean
29
29
  }
30
+
31
+ export type Api_Schedule_Add_Shift = {
32
+ brigade_id: string
33
+ dates: string[]
34
+ shift_template_id: string
35
+ }
36
+
37
+ export type Api_Schedule_Swap_Shifts = {
38
+ brigade_id: string
39
+ shifts: string[]
40
+ }
41
+
42
+ export type Api_Schedule_Edit_Shifts = {
43
+ brigade_id: string
44
+ shift_ids: string[]
45
+ shift_template_id: string
46
+ }
@@ -39,7 +39,7 @@ import AppInputNew from '@/common/app-input-new/AppInputNew.vue'
39
39
  import { ref, withDefaults, defineEmits, defineProps, defineModel } from 'vue'
40
40
 
41
41
  interface Props {
42
- label: string
42
+ label?: string
43
43
  modelValue?: string
44
44
  rules?: ((val?: string | number | null) => boolean | string)[]
45
45
  disableRuleDates?: string
@@ -50,6 +50,7 @@ interface Props {
50
50
  timeFormat?: string
51
51
  }
52
52
  const props = withDefaults(defineProps<Props>(), {
53
+ label: '',
53
54
  timeFormat: 'HH:mm',
54
55
  rules: () => [],
55
56
  disableRuleDates: undefined,