project-booster-vue 9.9.0 → 9.10.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-booster-vue",
3
- "version": "9.9.0",
3
+ "version": "9.10.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -184,7 +184,7 @@ export const TemplateSandbox = (args, { argTypes }) => ({
184
184
  <m-notification title="success" type="success" />
185
185
  <m-notification title="warning" type="warning" />
186
186
  <m-notification title="danger" type="danger" />
187
- <m-notification title="appointment" type="appointment" />
187
+ <m-notification title="appointment" is-big />
188
188
  </div>
189
189
  `,
190
190
  }}
@@ -5,7 +5,7 @@
5
5
  class="m-notification"
6
6
  :class="`mc-notification mc-notification--${type} ${closable ? 'mc-notification-closable' : ''} ${
7
7
  floating ? 'mc-notification--floating' : ''
8
- }`"
8
+ } ${isBig ? 'mc-notification--big' : ''}`"
9
9
  role="alert"
10
10
  >
11
11
  <!-- Add wrapper to prevent block formatting context creation and use margin collapse -->
@@ -35,7 +35,7 @@ import { defineComponent } from 'vue';
35
35
  import MLink from '../link/MLink.vue';
36
36
 
37
37
  export const M_NOTIFICATION_VALIDATOR = {
38
- types: ['information', 'success', 'warning', 'danger', 'appointment'],
38
+ types: ['information', 'success', 'warning', 'danger'],
39
39
  };
40
40
 
41
41
  export default defineComponent({
@@ -112,6 +112,13 @@ export default defineComponent({
112
112
  type: Boolean,
113
113
  default: false,
114
114
  },
115
+ /**
116
+ * Indicates whether to use the big variant of the notification
117
+ */
118
+ isBig: {
119
+ type: Boolean,
120
+ default: false,
121
+ },
115
122
  },
116
123
 
117
124
  methods: {
@@ -231,9 +238,7 @@ $responsive-breakpoint: 'm';
231
238
  @import 'pb-variables';
232
239
  @import 'components/c.notification';
233
240
 
234
- .mc-notification--appointment {
235
- @include set-notification-type('success');
236
-
241
+ .mc-notification--big {
237
242
  &.mc-notification .mc-notification__content {
238
243
  display: flex;
239
244
  flex-direction: column;
@@ -6,7 +6,9 @@ import { rest } from 'msw';
6
6
  import { successResolver, internalServerErrorResolver } from '../../../services/api/mocks/commonMock';
7
7
  import {
8
8
  getProjectByIdResolver,
9
- getDoneAppointmentByIdResolver,
9
+ getPastAppointmentByIdResolver,
10
+ getCancelledAppointmentByIdResolver,
11
+ getCancelledAndPastAppointmentByIdResolver,
10
12
  getStoreAppointmentByIdResolver,
11
13
  getVisioAppointmentByIdResolver,
12
14
  } from '../../../services/api/mocks/projectsMock';
@@ -106,16 +108,52 @@ The `PbProjectHub` component to access your project.
106
108
  </Story>
107
109
  </Canvas>
108
110
 
109
- ## Showcase with done appointment
111
+ ## Showcase with appointment in the past
110
112
 
111
113
  <Canvas>
112
114
  <Story
113
- name="Showcase with done appointment"
115
+ name="Showcase with appointment in the past"
114
116
  parameters={{
115
117
  controls: { disable: true },
116
118
  msw: [
117
119
  rest.get('/api/inhabitant-projects/:projectId', getProjectByIdResolver),
118
- rest.get('/api/inhabitant-projects/:projectId/main-appointment', getDoneAppointmentByIdResolver),
120
+ rest.get('/api/inhabitant-projects/:projectId/main-appointment', getPastAppointmentByIdResolver),
121
+ ],
122
+ }}
123
+ height="100vh"
124
+ >
125
+ {TemplateSandbox.bind({})}
126
+ </Story>
127
+ </Canvas>
128
+
129
+ ## Showcase with cancelled appointment
130
+
131
+ <Canvas>
132
+ <Story
133
+ name="Showcase with cancelled appointment"
134
+ parameters={{
135
+ controls: { disable: true },
136
+ msw: [
137
+ rest.get('/api/inhabitant-projects/:projectId', getProjectByIdResolver),
138
+ rest.get('/api/inhabitant-projects/:projectId/main-appointment', getCancelledAppointmentByIdResolver),
139
+ ],
140
+ }}
141
+ height="100vh"
142
+ >
143
+ {TemplateSandbox.bind({})}
144
+ </Story>
145
+ </Canvas>
146
+
147
+ ## Showcase with cancelled appointment in the past
148
+
149
+ <Canvas>
150
+ <Story
151
+ name="Showcase with cancelled appointment in the past"
152
+ parameters={{
153
+ controls: { disable: true },
154
+ msw: [
155
+ rest.get('/api/inhabitant-projects/:projectId', getProjectByIdResolver),
156
+ rest.get('/api/inhabitant-projects/:projectId/main-appointment', getCancelledAndPastAppointmentByIdResolver),
119
157
  ],
120
158
  }}
121
159
  height="100vh"
@@ -63,29 +63,19 @@
63
63
  <div class="pb-project-hub__section-content--loading-label">Chargement...</div>
64
64
  </m-flex>
65
65
  <m-flex
66
- v-else-if="!isLoadingAppointment && !appointmentLoadError && !appointment.isPast"
66
+ v-else-if="!isLoadingAppointment && !appointmentLoadError"
67
67
  direction="column"
68
68
  align-items="center"
69
69
  full-width
70
70
  >
71
71
  <m-notification
72
72
  class="pb-project-hub__appointment-notification"
73
- type="appointment"
74
- :title="appointment.appointmentDate"
75
- :text="
76
- readOnly
77
- ? ''
78
- : appointment.appointmentDate.endsWith('en magasin')
79
- ? 'N’oubliez pas !'
80
- : 'Retrouvez le lien d\'accès à la visio-conférence dans le mail qui vous est envoyé. \n' +
81
- 'N’oubliez pas !'
82
- "
83
- :link-label="
84
- readOnly
85
- ? ''
86
- : 'Ajoutez des plans aux mesures de votre pièce et des photos pour bien préparer le rendez-vous.'
87
- "
73
+ :title="appointmentNotificationTitle"
74
+ :type="appointmentNotificationType"
75
+ :text="appointmentNotificationText"
76
+ :link-label="appointmentNotificationLinkLabel"
88
77
  @link-click="handleAppointmentLinkClick"
78
+ is-big
89
79
  />
90
80
  </m-flex>
91
81
  </m-flex>
@@ -1123,6 +1113,42 @@ export default defineComponent({
1123
1113
  }
1124
1114
  return `Client n° ${this.currentInhabitantId}`;
1125
1115
  },
1116
+
1117
+ appointmentNotificationType() {
1118
+ return this.appointment.isPast ? 'info' : this.appointment.cancelled ? 'warning' : 'success';
1119
+ },
1120
+
1121
+ appointmentNotificationTitle() {
1122
+ const prefix = this.appointment.cancelled ? 'ANNULÉ - RDV' : 'RDV';
1123
+ const appointmentDate = new Date(this.appointment.appointmentDate);
1124
+ const appointmenDateLabel = `${appointmentDate.toLocaleDateString('fr-FR', {
1125
+ weekday: 'long',
1126
+ year: 'numeric',
1127
+ month: 'long',
1128
+ day: 'numeric',
1129
+ })} à ${appointmentDate.toLocaleTimeString('fr-FR', { hour: '2-digit', minute: '2-digit' })}`;
1130
+ const appointmentTypeLabel = (<Record<string, string>>{
1131
+ KITCHEN_IN_STORE: 'en magasin',
1132
+ KITCHEN_REMOTE: 'en visio-conférence',
1133
+ })[this.appointment.appointmentType];
1134
+ return `${prefix} le ${appointmenDateLabel} ${appointmentTypeLabel}`;
1135
+ },
1136
+
1137
+ appointmentNotificationText() {
1138
+ return this.readOnly || (this.appointment.cancelled && !this.appointment.isPast)
1139
+ ? ''
1140
+ : this.appointment.isPast
1141
+ ? 'Date du rendez-vous passée.'
1142
+ : this.appointment.appointmentType === 'KITCHEN_IN_STORE'
1143
+ ? 'N’oubliez pas !'
1144
+ : "Retrouvez le lien d'accès à la visio-conférence dans le mail qui vous est envoyé. \n" + 'N’oubliez pas !';
1145
+ },
1146
+
1147
+ appointmentNotificationLinkLabel() {
1148
+ return this.readOnly || this.appointment.isPast || this.appointment.cancelled
1149
+ ? ''
1150
+ : 'Ajoutez des plans aux mesures de votre pièce et des photos pour bien préparer le rendez-vous.';
1151
+ },
1126
1152
  },
1127
1153
 
1128
1154
  watch: {
@@ -235,21 +235,42 @@
235
235
  "groupId": 188921,
236
236
  "calendarId": 375614,
237
237
  "appointnmentId": 3200901,
238
- "appointmentDate": "RDV le samedi 4 Décembre à 16h00 en magasin",
239
- "isPast": false
238
+ "appointmentDate": "2022-08-23T13:30:00.00Z",
239
+ "isPast": false,
240
+ "appointmentType": "KITCHEN_IN_STORE"
240
241
  },
241
242
  "visioAppointment": {
242
243
  "groupId": 188921,
243
244
  "calendarId": 375614,
244
245
  "appointnmentId": 3200901,
245
- "appointmentDate": "RDV le samedi 4 Décembre à 16h00 en visio-conférence",
246
- "isPast": false
246
+ "appointmentDate": "2022-08-23T13:30:00.00Z",
247
+ "isPast": false,
248
+ "appointmentType": "KITCHEN_REMOTE"
247
249
  },
248
- "doneAppointment": {
250
+ "pastAppointment": {
249
251
  "groupId": 188921,
250
252
  "calendarId": 375614,
251
253
  "appointnmentId": 3200901,
252
- "appointmentDate": "RDV le samedi 4 Décembre à 16h00 en visio-conférence",
253
- "isPast": true
254
+ "appointmentDate": "2022-08-23T13:30:00.00Z",
255
+ "isPast": true,
256
+ "appointmentType": "KITCHEN_REMOTE"
257
+ },
258
+ "cancelledAndPastAppointment": {
259
+ "groupId": 188921,
260
+ "calendarId": 375614,
261
+ "appointnmentId": 3200901,
262
+ "appointmentDate": "2022-08-23T13:30:00.00Z",
263
+ "isPast": true,
264
+ "cancelled": true,
265
+ "appointmentType": "KITCHEN_REMOTE"
266
+ },
267
+ "cancelledAppointment": {
268
+ "groupId": 188921,
269
+ "calendarId": 375614,
270
+ "appointnmentId": 3200901,
271
+ "appointmentDate": "2022-08-23T13:30:00.00Z",
272
+ "isPast": false,
273
+ "cancelled": true,
274
+ "appointmentType": "KITCHEN_REMOTE"
254
275
  }
255
276
  }
@@ -5,7 +5,9 @@ import {
5
5
  projectAttributes,
6
6
  storeAppointment,
7
7
  visioAppointment,
8
- doneAppointment,
8
+ pastAppointment,
9
+ cancelledAppointment,
10
+ cancelledAndPastAppointment,
9
11
  } from './jsons/projects.json';
10
12
 
11
13
  export const getEmptyProjectsResolver = (req: RestRequest, res: ResponseComposition, ctx: RestContext) => {
@@ -72,6 +74,18 @@ export const getVisioAppointmentByIdResolver = (req: RestRequest, res: ResponseC
72
74
  return res(ctx.status(200), ctx.json(visioAppointment));
73
75
  };
74
76
 
75
- export const getDoneAppointmentByIdResolver = (req: RestRequest, res: ResponseComposition, ctx: RestContext) => {
76
- return res(ctx.status(200), ctx.json(doneAppointment));
77
+ export const getPastAppointmentByIdResolver = (req: RestRequest, res: ResponseComposition, ctx: RestContext) => {
78
+ return res(ctx.status(200), ctx.json(pastAppointment));
79
+ };
80
+
81
+ export const getCancelledAppointmentByIdResolver = (req: RestRequest, res: ResponseComposition, ctx: RestContext) => {
82
+ return res(ctx.status(200), ctx.json(cancelledAppointment));
83
+ };
84
+
85
+ export const getCancelledAndPastAppointmentByIdResolver = (
86
+ req: RestRequest,
87
+ res: ResponseComposition,
88
+ ctx: RestContext,
89
+ ) => {
90
+ return res(ctx.status(200), ctx.json(cancelledAndPastAppointment));
77
91
  };