@movalib/movalib-commons 1.2.29 → 1.3.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.
@@ -173,10 +173,12 @@ var AccountValidation = function (_a) {
173
173
  if (smsValidation)
174
174
  newForm.securityCode = (0, Tools_1.validateField)(validationForm.securityCode, function (value) { return value.length === 6; }, "Le code doit contenir 6 chiffres");
175
175
  // Validator pour les CGU
176
- newForm.acceptsTerms = (0, Tools_1.validateField)(validationForm.acceptsTerms, function (value) { return Boolean(value); }, movaAppType == Enums_1.MovaAppType.GARAGE ? 'Vous devez accepter les termes de nos CGU et de nos CGV' : 'Vous devez accepter les termes de nos CGU');
176
+ if (!resetPassword) {
177
+ newForm.acceptsTerms = (0, Tools_1.validateField)(validationForm.acceptsTerms, function (value) { return Boolean(value); }, movaAppType == Enums_1.MovaAppType.GARAGE ? 'Vous devez accepter les termes de nos CGU et de nos CGV' : 'Vous devez accepter les termes de nos CGU');
178
+ }
177
179
  setValidationForm(newForm);
178
180
  return newForm.password.isValid && newForm.confirmation.isValid && (smsValidation ? newForm.securityCode.isValid : true) &&
179
- newForm.acceptsTerms.isValid;
181
+ (resetPassword ? true : newForm.acceptsTerms.isValid);
180
182
  };
181
183
  var handleValidateAccount = function () {
182
184
  if (validateForm()) {
@@ -265,8 +267,9 @@ var AccountValidation = function (_a) {
265
267
  endAdornment: ((0, jsx_runtime_1.jsx)(InputAdornment_1.default, __assign({ position: "end" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, __assign({ edge: "end", onClick: function (e) { return setShowPassword(function (prev) { return !prev; }); } }, { children: showPassword ? (0, jsx_runtime_1.jsx)(VisibilityOff_1.default, {}) : (0, jsx_runtime_1.jsx)(Visibility_1.default, {}) })) }))),
266
268
  } }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", required: true, fullWidth: true, name: "confirmation", label: "Confirmation mot de passe", type: showPassword ? 'text' : 'password', id: "confirmation", onChange: function (e) { return handleInputChange(e); }, value: validationForm.confirmation.value, error: !validationForm.confirmation.isValid, helperText: Boolean(validationForm.confirmation.error) ? validationForm.confirmation.error : "", InputProps: {
267
269
  endAdornment: ((0, jsx_runtime_1.jsx)(InputAdornment_1.default, __assign({ position: "end" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, __assign({ edge: "end", onClick: function (e) { return setShowPassword(function (prev) { return !prev; }); } }, { children: showPassword ? (0, jsx_runtime_1.jsx)(VisibilityOff_1.default, {}) : (0, jsx_runtime_1.jsx)(Visibility_1.default, {}) })) }))),
268
- } }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12, sx: { mt: 2, display: 'flex', justifyContent: 'start' } }, { children: (0, jsx_runtime_1.jsxs)(material_1.FormControl, __assign({ error: !validationForm.acceptsTerms.isValid }, { children: [(0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { name: "acceptsTerms", color: "primary", checked: validationForm.acceptsTerms.value, onChange: function (e, checked) { return handleCheckboxChange(e, checked); }, sx: { pr: 2 } }), label: (0, jsx_runtime_1.jsxs)("span", { children: ["J'accepte ", movaAppType === Enums_1.MovaAppType.GARAGE ? "sans réserve" : '', " les", ' ', (0, jsx_runtime_1.jsx)("a", __assign({ href: movaAppType === Enums_1.MovaAppType.GARAGE ? proCGUPath : CGUPath, target: "_blank", style: { color: theme.palette.primary.main } }, { children: "Conditions G\u00E9n\u00E9rales d'Utilisation" })), movaAppType === Enums_1.MovaAppType.GARAGE &&
269
- (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["\u00A0", (0, jsx_runtime_1.jsx)("br", {}), "et les ", ' ', (0, jsx_runtime_1.jsx)("a", __assign({ href: proCGVPath, target: "_blank", style: { color: theme.palette.primary.main } }, { children: "Conditions G\u00E9n\u00E9rales de Vente" }))] })] }) }), (0, jsx_runtime_1.jsx)(material_1.FormHelperText, { children: validationForm.acceptsTerms.error })] })) }))] })) })), loading &&
270
+ } }) })), !resetPassword &&
271
+ (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12, sx: { mt: 2, display: 'flex', justifyContent: 'start' } }, { children: (0, jsx_runtime_1.jsxs)(material_1.FormControl, __assign({ error: !validationForm.acceptsTerms.isValid }, { children: [(0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { name: "acceptsTerms", color: "primary", checked: validationForm.acceptsTerms.value, onChange: function (e, checked) { return handleCheckboxChange(e, checked); }, sx: { pr: 2 } }), label: (0, jsx_runtime_1.jsxs)("span", { children: ["J'accepte ", movaAppType === Enums_1.MovaAppType.GARAGE ? "sans réserve" : '', " les", ' ', (0, jsx_runtime_1.jsx)("a", __assign({ href: movaAppType === Enums_1.MovaAppType.GARAGE ? proCGUPath : CGUPath, target: "_blank", style: { color: theme.palette.primary.main } }, { children: "Conditions G\u00E9n\u00E9rales d'Utilisation" })), movaAppType === Enums_1.MovaAppType.GARAGE &&
272
+ (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["\u00A0", (0, jsx_runtime_1.jsx)("br", {}), "et les ", ' ', (0, jsx_runtime_1.jsx)("a", __assign({ href: proCGVPath, target: "_blank", style: { color: theme.palette.primary.main } }, { children: "Conditions G\u00E9n\u00E9rales de Vente" }))] })] }) }), (0, jsx_runtime_1.jsx)(material_1.FormHelperText, { children: validationForm.acceptsTerms.error })] })) }))] })) })), loading &&
270
273
  (0, jsx_runtime_1.jsx)(material_1.Box, __assign({ display: "flex", justifyContent: "center", alignItems: "center", minHeight: "100vh" }, { children: (0, jsx_runtime_1.jsx)(material_1.CircularProgress, {}) })), openPhoneNumberInput && (0, jsx_runtime_1.jsx)(ConfirmationDialog_1.default, { open: openPhoneNumberInput, confirmLabel: "Envoyer", closeLabel: "Annuler", onClose: function () { return setOpenPhoneNumberInput(false); }, onConfirm: resendCode, message: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, { children: [(0, jsx_runtime_1.jsx)("b", { children: "Indiquez nous votre num\u00E9ro de t\u00E9l\u00E9phone" }), (0, jsx_runtime_1.jsx)("br", {})] }), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6 }, { children: (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", fullWidth: true, required: true, id: "phoneNumber", label: "N\u00B0 de t\u00E9l\u00E9phone", name: "phoneNumber", autoComplete: "tel", onChange: function (e) { return handleInputChange(e); }, value: validationForm.phoneNumber.value, error: Boolean(validationForm.phoneNumber.error), helperText: validationForm.phoneNumber.error }) }))] }) })] }));
271
274
  };
272
275
  exports.default = AccountValidation;
@@ -2,6 +2,7 @@ import { APIResponse } from "../helpers/ApiHelper";
2
2
  import Employee from "../models/Employee";
3
3
  import Garage from "../models/Garage";
4
4
  export default class GarageService {
5
+ static disableGaragePrestation(garageId: string, prestationId: string): Promise<APIResponse<string>>;
5
6
  static getEmployeeDetails(garageId: string, employeeId: string): Promise<APIResponse<Employee>>;
6
7
  static updateGaragePrestation(garageId: string, prestationId: string, req: any): Promise<APIResponse<string>>;
7
8
  static deleteGarageEmployeePrestationType(garageId: string, employeeId: string, req: any): Promise<APIResponse<string>>;
@@ -5,6 +5,13 @@ var Enums_1 = require("../helpers/Enums");
5
5
  var GarageService = /** @class */ (function () {
6
6
  function GarageService() {
7
7
  }
8
+ GarageService.disableGaragePrestation = function (garageId, prestationId) {
9
+ return (0, ApiHelper_1.request)({
10
+ url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/prestations/").concat(prestationId),
11
+ method: Enums_1.APIMethod.DELETE,
12
+ appType: Enums_1.MovaAppType.GARAGE
13
+ });
14
+ };
8
15
  GarageService.getEmployeeDetails = function (garageId, employeeId) {
9
16
  return (0, ApiHelper_1.request)({
10
17
  url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/employees/").concat(employeeId),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.2.29",
3
+ "version": "1.3.0",
4
4
  "description": "Bibliothèque d'objets communs à l'ensemble des projets React de Movalib",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -198,13 +198,15 @@ const AccountValidation: FunctionComponent<AccountValidationProps> = ({ movaAppT
198
198
  newForm.securityCode = validateField(validationForm.securityCode, value => value.length === 6, "Le code doit contenir 6 chiffres");
199
199
 
200
200
  // Validator pour les CGU
201
- newForm.acceptsTerms = validateField(validationForm.acceptsTerms, value => Boolean(value),
201
+ if(!resetPassword){
202
+ newForm.acceptsTerms = validateField(validationForm.acceptsTerms, value => Boolean(value),
202
203
  movaAppType == MovaAppType.GARAGE ? 'Vous devez accepter les termes de nos CGU et de nos CGV' : 'Vous devez accepter les termes de nos CGU');
204
+ }
203
205
 
204
206
  setValidationForm(newForm);
205
207
 
206
208
  return newForm.password.isValid && newForm.confirmation.isValid && (smsValidation ? newForm.securityCode.isValid : true) &&
207
- newForm.acceptsTerms.isValid;
209
+ (resetPassword ? true : newForm.acceptsTerms.isValid);
208
210
  }
209
211
 
210
212
 
@@ -421,39 +423,41 @@ const AccountValidation: FunctionComponent<AccountValidationProps> = ({ movaAppT
421
423
  }}
422
424
  />
423
425
  </Grid>
424
- <Grid item xs={12} sx={{mt: 2, display:'flex', justifyContent:'start'}} >
425
- <FormControl error={!validationForm.acceptsTerms.isValid} >
426
- <FormControlLabel
427
- control={
428
- <Checkbox
429
- name="acceptsTerms"
430
- color="primary"
431
- checked={validationForm.acceptsTerms.value}
432
- onChange={(e, checked) => handleCheckboxChange(e, checked)}
433
- sx={{pr: 2}}
434
- />
435
- }
436
- label={
437
- <span>
438
- J'accepte {movaAppType === MovaAppType.GARAGE ? "sans réserve" : ''} les{' '}
439
- <a href={movaAppType === MovaAppType.GARAGE ? proCGUPath : CGUPath} target="_blank"
440
- style={{ color:theme.palette.primary.main}}>
441
- Conditions Générales d'Utilisation
442
- </a>
443
- {movaAppType === MovaAppType.GARAGE &&
444
- <>
445
- &nbsp;<br />et les {' '}
446
- <a href={proCGVPath} target="_blank" style={{ color:theme.palette.primary.main}}>
447
- Conditions Générales de Vente
426
+ {!resetPassword &&
427
+ <Grid item xs={12} sx={{mt: 2, display:'flex', justifyContent:'start'}} >
428
+ <FormControl error={!validationForm.acceptsTerms.isValid} >
429
+ <FormControlLabel
430
+ control={
431
+ <Checkbox
432
+ name="acceptsTerms"
433
+ color="primary"
434
+ checked={validationForm.acceptsTerms.value}
435
+ onChange={(e, checked) => handleCheckboxChange(e, checked)}
436
+ sx={{pr: 2}}
437
+ />
438
+ }
439
+ label={
440
+ <span>
441
+ J'accepte {movaAppType === MovaAppType.GARAGE ? "sans réserve" : ''} les{' '}
442
+ <a href={movaAppType === MovaAppType.GARAGE ? proCGUPath : CGUPath} target="_blank"
443
+ style={{ color:theme.palette.primary.main}}>
444
+ Conditions Générales d'Utilisation
448
445
  </a>
449
- </>
446
+ {movaAppType === MovaAppType.GARAGE &&
447
+ <>
448
+ &nbsp;<br />et les {' '}
449
+ <a href={proCGVPath} target="_blank" style={{ color:theme.palette.primary.main}}>
450
+ Conditions Générales de Vente
451
+ </a>
452
+ </>
453
+ }
454
+ </span>
450
455
  }
451
- </span>
452
- }
453
- />
454
- <FormHelperText>{validationForm.acceptsTerms.error}</FormHelperText>
455
- </FormControl>
456
- </Grid>
456
+ />
457
+ <FormHelperText>{validationForm.acceptsTerms.error}</FormHelperText>
458
+ </FormControl>
459
+ </Grid>
460
+ }
457
461
  </Grid>
458
462
  </MovaDialog>}
459
463
 
@@ -5,6 +5,14 @@ import Garage from "../models/Garage";
5
5
 
6
6
  export default class GarageService {
7
7
 
8
+ static disableGaragePrestation(garageId: string, prestationId: string): Promise<APIResponse<string>> {
9
+ return request({
10
+ url: `${API_BASE_URL}/garage/${garageId}/prestations/${prestationId}`,
11
+ method: APIMethod.DELETE,
12
+ appType: MovaAppType.GARAGE
13
+ });
14
+ }
15
+
8
16
  static getEmployeeDetails(garageId: string, employeeId: string): Promise<APIResponse<Employee>> {
9
17
  return request({
10
18
  url: `${API_BASE_URL}/garage/${garageId}/employees/${employeeId}`,