@movalib/movalib-commons 1.59.35 → 1.59.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.
@@ -1,117 +1,161 @@
1
- import User from "./User";
2
1
  import { EventState, EventType, OrderPreference } from "../helpers/Enums";
3
- import Prestation from "./Prestation";
2
+ import Address from "./Address";
4
3
  import Customer from "./Customer";
5
- import Vehicle from "./Vehicle";
4
+ import Document from "./Document";
5
+ import Employee from "./Employee";
6
6
  import Operation from "./Operation";
7
+ import Prestation from "./Prestation";
7
8
  import Product from "./Product";
8
9
  import Supplier from "./Supplier";
9
- import Document from "./Document";
10
- import Address from "./Address";
11
- import Employee from "./Employee";
10
+ import User from "./User";
11
+ import Vehicle from "./Vehicle";
12
12
 
13
+ interface order {
14
+ id: string;
15
+ supplier: Supplier;
16
+ orderPreference: string;
17
+ orderType: string;
18
+ orderDate: Date;
19
+ comment: string;
20
+ deliveryDate: Date | null;
21
+ }
13
22
  export default class Event {
23
+ // Properties
24
+ id: string; //UUID
25
+ ownerId: number;
26
+ type: EventType;
27
+ title: string;
28
+ garageName: string;
29
+ garageId: number;
30
+ state: EventState;
31
+ garageAddress?: Address;
32
+ start?: Date;
33
+ end?: Date;
34
+ prestations?: Prestation[];
35
+ operations?: Operation[];
36
+ products?: Product[];
37
+ orders?: order[];
38
+ /**
39
+ * Un tableau d'invités, dans notre cas d'usage nous n'aurons qu'un invité de type Client
40
+ */
41
+ guestsId?: string[];
42
+ guests?: User[];
43
+ customer?: Customer;
44
+ vehicle?: Vehicle;
45
+ vehicleId?: number;
46
+ /**
47
+ * Une liste de ressources affectées à l'événement, dans notre cas il s'agira de un ou plusieurs Techniciens
48
+ */
49
+ resources?: number[];
50
+ notes?: string;
51
+ /**
52
+ * Eventuel numéro de devis rattaché à l'évent
53
+ */
54
+ quoteId?: number;
55
+ orderPreference?: OrderPreference;
56
+ supplier?: Supplier;
57
+ quoteAmount?: number;
58
+ documents?: Document[];
59
+ customerReminders?: number;
60
+ vehicleAvailableNotified?: boolean;
61
+ vehicleAvailableNotificationTime?: Date;
62
+ editable?: boolean;
63
+ vehicleDepositDate?: Date;
64
+ vehicleDepositDateRequest?: Date;
65
+ color?: string;
66
+ interventionEndTime?: Date;
67
+ /** Propriété calculée pas toujours présent, pour savoir si les produits de cet event on été commandé au grossistes */
68
+ hasProductOrdered?: boolean;
14
69
 
15
- // Properties
16
- id: string; //UUID
17
- ownerId: number;
18
- type: EventType;
19
- title: string;
20
- garageName: string;
21
- garageId: number;
22
- state: EventState;
23
- garageAddress?: Address;
24
- start?: Date;
25
- end?: Date;
26
- prestations?: Prestation[];
27
- operations?: Operation[];
28
- products?: Product[];
29
- /**
30
- * Un tableau d'invités, dans notre cas d'usage nous n'aurons qu'un invité de type Client
31
- */
32
- guestsId?: string[];
33
- guests?: User[];
34
- customer?: Customer;
35
- vehicle?: Vehicle;
36
- vehicleId?: number;
37
- /**
38
- * Une liste de ressources affectées à l'événement, dans notre cas il s'agira de un ou plusieurs Techniciens
39
- */
40
- resources?: number[];
41
- notes?: string;
42
- /**
43
- * Eventuel numéro de devis rattaché à l'évent
44
- */
45
- quoteId?: number;
46
- orderPreference?: OrderPreference;
47
- supplier?: Supplier;
48
- quoteAmount?: number;
49
- documents?: Document[];
50
- customerReminders?: number;
51
- vehicleAvailableNotified?: boolean;
52
- vehicleAvailableNotificationTime?:Date
53
- editable?: boolean;
54
- vehicleDepositDate?: Date;
55
- vehicleDepositDateRequest?: Date;
56
- color?: string;
57
- interventionEndTime?: Date;
58
- /** Propriété calculée pas toujours présent, pour savoir si les produits de cet event on été commandé au grossistes */
59
- hasProductOrdered?: boolean;
70
+ /** Eventuels opérateurs associés à l'event */
71
+ employees?: Employee[];
72
+ resourceId?: number;
60
73
 
61
- /** Eventuels opérateurs associés à l'event */
62
- employees?: Employee[];
63
- resourceId?: number;
74
+ /** Quand l'event contient la prestation "Autres" alors ce champs est obligatoire et précise la prestation */
75
+ otherReason?: string;
64
76
 
65
- /** Quand l'event contient la prestation "Autres" alors ce champs est obligatoire et précise la prestation */
66
- otherReason?: string;
77
+ repairOrderNumber?: number;
78
+ orderComment?: string;
79
+ vehicleReceived?: boolean;
80
+ garageVehicleId?: number;
81
+ garageVehicleRequest?: boolean;
82
+ origin?: string;
83
+ quoteLastSendingTime?: Date;
84
+ invoiceSendingDate?: Date;
67
85
 
68
- repairOrderNumber?: number;
69
- orderComment?: string;
70
- vehicleReceived?: boolean;
71
- garageVehicleId?: number;
72
- garageVehicleRequest?: boolean;
73
- origin?: string;
74
- quoteLastSendingTime?: Date;
86
+ constructor(
87
+ id: string,
88
+ ownerId: number,
89
+ type: EventType,
90
+ title: string,
91
+ garageName: string,
92
+ garageId: number,
93
+ color: string,
94
+ state: EventState,
95
+ garageAddress?: Address,
96
+ start?: Date,
97
+ end?: Date,
98
+ prestations?: Prestation[],
99
+ operations?: Operation[],
100
+ products?: Product[],
101
+ guestsId?: string[],
102
+ vehicleId?: number,
103
+ quoteId?: number,
104
+ notes?: string,
105
+ vehicleAvailableNotified?: boolean,
106
+ editable?: boolean,
107
+ resourceId?: number,
108
+ garageVehicleId?: number,
109
+ garageVehicleRequest?: boolean,
110
+ vehicleAvailableNotificationTime?: Date,
111
+ interventionEndTime?: Date,
112
+ quoteLastSendingTime?: Date,
113
+ invoiceSendingDate?: Date,
114
+ orders?: order[]
115
+ ) {
116
+ this.id = id;
117
+ this.notes = notes;
118
+ this.ownerId = ownerId;
119
+ this.type = type;
120
+ this.title = title;
121
+ this.garageName = garageName;
122
+ this.garageAddress = garageAddress;
123
+ this.garageId = garageId;
124
+ this.state = state;
125
+ this.start = start ? new Date(start) : undefined;
126
+ this.end = end ? new Date(end) : undefined;
127
+ this.operations = operations;
128
+ this.prestations = prestations;
129
+ this.products = products;
130
+ this.guestsId = guestsId;
131
+ this.vehicleId = vehicleId;
132
+ this.quoteId = quoteId;
133
+ this.vehicleAvailableNotified = vehicleAvailableNotified;
134
+ this.editable = editable;
135
+ this.resourceId = resourceId;
136
+ this.color = color;
137
+ this.garageVehicleId = garageVehicleId;
138
+ this.garageVehicleRequest = garageVehicleRequest;
139
+ this.vehicleAvailableNotificationTime = vehicleAvailableNotificationTime
140
+ ? new Date(vehicleAvailableNotificationTime)
141
+ : undefined;
142
+ this.interventionEndTime = interventionEndTime
143
+ ? new Date(interventionEndTime)
144
+ : undefined;
145
+ this.quoteLastSendingTime = quoteLastSendingTime
146
+ ? new Date(quoteLastSendingTime)
147
+ : undefined;
148
+ this.invoiceSendingDate = invoiceSendingDate
149
+ ? new Date(invoiceSendingDate)
150
+ : undefined;
151
+ this.orders = orders;
152
+ }
75
153
 
76
- constructor(id: string, ownerId: number, type : EventType, title: string, garageName: string, garageId: number,color: string,
77
- state: EventState, garageAddress?: Address, start?: Date, end?: Date, prestations?: Prestation[], operations?: Operation[], products?: Product[],
78
- guestsId?: string[], vehicleId?: number, quoteId?: number, notes?: string, vehicleAvailableNotified?: boolean, editable?: boolean,
79
- resourceId?: number, garageVehicleId?: number, garageVehicleRequest?: boolean, vehicleAvailableNotificationTime?: Date, interventionEndTime?: Date, quoteLastSendingTime?: Date)
80
- {
81
- this.id = id;
82
- this.notes = notes;
83
- this.ownerId = ownerId;
84
- this.type = type;
85
- this.title = title;
86
- this.garageName = garageName;
87
- this.garageAddress = garageAddress;
88
- this.garageId = garageId;
89
- this.state = state;
90
- this.start = start ? new Date(start) : undefined;
91
- this.end = end ? new Date(end) : undefined;
92
- this.operations = operations;
93
- this.prestations = prestations;
94
- this.products = products;
95
- this.guestsId = guestsId;
96
- this.vehicleId = vehicleId;
97
- this.quoteId = quoteId;
98
- this.vehicleAvailableNotified = vehicleAvailableNotified;
99
- this.editable = editable;
100
- this.resourceId = resourceId;
101
- this.color = color;
102
- this.garageVehicleId = garageVehicleId;
103
- this.garageVehicleRequest = garageVehicleRequest;
104
- this.vehicleAvailableNotificationTime = vehicleAvailableNotificationTime ? new Date(vehicleAvailableNotificationTime) : undefined;
105
- this.interventionEndTime = interventionEndTime ? new Date(interventionEndTime) : undefined;
106
- this.quoteLastSendingTime = quoteLastSendingTime ? new Date(quoteLastSendingTime) : undefined;
154
+ static getPrestationsList(event: Event): string[] {
155
+ if (event && event.prestations) {
156
+ return event.prestations.map((n) => n.name);
107
157
  }
108
158
 
109
- static getPrestationsList(event: Event) : string[] {
110
- if(event && event.prestations) {
111
- console.log(event.prestations.map(n => n.name));
112
- return event.prestations.map(n => n.name);
113
- }
114
-
115
- return [];
116
- }
117
- }
159
+ return [];
160
+ }
161
+ }
@@ -1,31 +1,45 @@
1
- import { OrderPreference, OrderState, PartsApplicationType, ProductType } from "../helpers/Enums";
1
+ import {
2
+ OrderPreference,
3
+ OrderState,
4
+ PartsApplicationType,
5
+ ProductType,
6
+ } from "../helpers/Enums";
2
7
  import Operation from "./Operation";
3
8
  import Supplier from "./Supplier";
4
9
 
5
10
  export default class Product {
11
+ // Properties
12
+ id: string; //UUID
13
+ name: string;
14
+ code: string;
15
+ type: ProductType;
16
+ order?: String;
17
+ orderPreference?: OrderPreference;
18
+ originReferences?: string[];
19
+ // Eventuelle opération associée au produit
20
+ operation?: Operation;
21
+ // Eventuel statut commande associé au produit
22
+ orderState?: OrderState;
23
+ // Eventuel fournisseur du produit
24
+ supplier?: Supplier;
25
+ // Eventuelle application du produit (avant, arrière)
26
+ application?: PartsApplicationType;
6
27
 
7
- // Properties
8
- id: string; //UUID
9
- name: string;
10
- code:string;
11
- type: ProductType;
12
- orderPreference?: OrderPreference;
13
- originReferences?: string[];
14
- // Eventuelle opération associée au produit
15
- operation?: Operation;
16
- // Eventuel statut commande associé au produit
17
- orderState?: OrderState;
18
- // Eventuel fournisseur du produit
19
- supplier?: Supplier;
20
- // Eventuelle application du produit (avant, arrière)
21
- application?: PartsApplicationType;
22
-
23
- constructor(id:string, code: string, name:string, type: ProductType, orderPreference: OrderPreference, originReferences: string[]) {
24
- this.id = id;
25
- this.name = name;
26
- this.code = code;
27
- this.type = type;
28
- this.orderPreference = orderPreference;
29
- this.originReferences = originReferences;
30
- }
31
- }
28
+ constructor(
29
+ id: string,
30
+ code: string,
31
+ name: string,
32
+ type: ProductType,
33
+ orderPreference: OrderPreference,
34
+ originReferences: string[],
35
+ order?: string
36
+ ) {
37
+ this.id = id;
38
+ this.name = name;
39
+ this.code = code;
40
+ this.type = type;
41
+ this.orderPreference = orderPreference;
42
+ this.originReferences = originReferences;
43
+ this.order = order;
44
+ }
45
+ }