@movalib/movalib-commons 1.68.2 → 1.68.4
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/dist/index.d.ts +2 -1
- package/dist/src/components/MovaTableBack/MovaTableBack.d.ts +2 -1
- package/dist/src/components/MovaTableBack/MovaTableBack.js +6 -6
- package/dist/src/components/vehicle/VehicleFullCard.js +0 -1
- package/dist/src/helpers/Enums.d.ts +1 -0
- package/dist/src/helpers/Enums.js +1 -0
- package/dist/src/models/Customer.d.ts +3 -1
- package/dist/src/models/Customer.js +3 -1
- package/dist/src/models/Event.d.ts +25 -5
- package/dist/src/models/Garage.d.ts +5 -1
- package/dist/src/models/Garage.js +14 -1
- package/dist/src/models/Settings.d.ts +10 -0
- package/dist/src/models/Settings.js +17 -0
- package/dist/src/services/GarageService.d.ts +2 -0
- package/dist/src/services/GarageService.js +16 -0
- package/index.ts +3 -1
- package/package.json +1 -1
- package/src/components/MovaTableBack/MovaTableBack.tsx +26 -24
- package/src/components/vehicle/VehicleFullCard.tsx +1 -1
- package/src/helpers/Enums.ts +1 -0
- package/src/models/Customer.ts +7 -2
- package/src/models/Event.ts +26 -4
- package/src/models/Garage.ts +18 -7
- package/src/models/Settings.ts +21 -0
- package/src/services/GarageService.ts +23 -0
package/dist/index.d.ts
CHANGED
|
@@ -35,7 +35,8 @@ export { default as CategoryPrestation } from "./src/models/CategoryPrestation";
|
|
|
35
35
|
export { default as Customer } from "./src/models/Customer";
|
|
36
36
|
export { default as Document } from "./src/models/Document";
|
|
37
37
|
export { default as Employee } from "./src/models/Employee";
|
|
38
|
-
export { default as Event } from "./src/models/Event";
|
|
38
|
+
export { default as Event, } from "./src/models/Event";
|
|
39
|
+
export type { Order, OrderLines } from "./src/models/Event";
|
|
39
40
|
export { default as Garage } from "./src/models/Garage";
|
|
40
41
|
export { default as LoanVehicle } from "./src/models/LoanVehicle";
|
|
41
42
|
export { default as Operation } from "./src/models/Operation";
|
|
@@ -20,6 +20,7 @@ type TMovaTable<T> = {
|
|
|
20
20
|
isClickable?: (data: T) => boolean;
|
|
21
21
|
onRowDoubleClick?: (data: T) => void;
|
|
22
22
|
filterChildren?: React.ReactNode;
|
|
23
|
+
asSearchSection?: boolean;
|
|
23
24
|
};
|
|
24
|
-
export default function MovaTableBack<T>({ useDataHook, displayedColumns, pagination, compact, onRowClick, onRowRightClick, onRowDoubleClick, isClickable, filterChildren, }: TMovaTable<T>): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export default function MovaTableBack<T>({ useDataHook, displayedColumns, pagination, compact, onRowClick, onRowRightClick, onRowDoubleClick, isClickable, filterChildren, asSearchSection }: TMovaTable<T>): import("react/jsx-runtime").JSX.Element;
|
|
25
26
|
export {};
|
|
@@ -20,12 +20,12 @@ var Search_1 = __importDefault(require("@mui/icons-material/Search"));
|
|
|
20
20
|
var material_1 = require("@mui/material");
|
|
21
21
|
var react_1 = require("react");
|
|
22
22
|
function MovaTableBack(_a) {
|
|
23
|
-
var useDataHook = _a.useDataHook, displayedColumns = _a.displayedColumns, pagination = _a.pagination, compact = _a.compact, onRowClick = _a.onRowClick, onRowRightClick = _a.onRowRightClick, onRowDoubleClick = _a.onRowDoubleClick, isClickable = _a.isClickable, filterChildren = _a.filterChildren;
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
23
|
+
var useDataHook = _a.useDataHook, displayedColumns = _a.displayedColumns, pagination = _a.pagination, compact = _a.compact, onRowClick = _a.onRowClick, onRowRightClick = _a.onRowRightClick, onRowDoubleClick = _a.onRowDoubleClick, isClickable = _a.isClickable, filterChildren = _a.filterChildren, _b = _a.asSearchSection, asSearchSection = _b === void 0 ? true : _b;
|
|
24
|
+
var _c = (0, react_1.useState)(0), currentPageIndex = _c[0], setCurrentPageIndex = _c[1];
|
|
25
|
+
var _d = (0, react_1.useState)(25), rowsPerPage = _d[0], setRowsPerPage = _d[1];
|
|
26
|
+
var _e = (0, react_1.useState)(""), search = _e[0], setSearch = _e[1];
|
|
27
27
|
var clickTimeout = (0, react_1.useRef)(null);
|
|
28
|
-
var
|
|
28
|
+
var _f = useDataHook(currentPageIndex, rowsPerPage, search), data = _f.data, totalElements = _f.totalElements, isLoading = _f.isLoading, refresh = _f.refresh;
|
|
29
29
|
var handleDoubleClick = (0, react_1.useCallback)(function (element) {
|
|
30
30
|
if (!onRowDoubleClick)
|
|
31
31
|
return;
|
|
@@ -63,7 +63,7 @@ function MovaTableBack(_a) {
|
|
|
63
63
|
setCurrentPageIndex(0);
|
|
64
64
|
}
|
|
65
65
|
}, 700);
|
|
66
|
-
return ((0, jsx_runtime_1.jsxs)("div", __assign({ style: { height: "100%", display: "flex", flexDirection: "column" } }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ sx: {
|
|
66
|
+
return ((0, jsx_runtime_1.jsxs)("div", __assign({ style: { height: "100%", display: "flex", flexDirection: "column" } }, { children: [asSearchSection && (0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ sx: {
|
|
67
67
|
width: "50%",
|
|
68
68
|
my: 2,
|
|
69
69
|
px: 2,
|
|
@@ -130,6 +130,7 @@ var OrderState;
|
|
|
130
130
|
OrderState["NEW"] = "NEW";
|
|
131
131
|
OrderState["QUOTE_REQUESTED"] = "QUOTE_REQUESTED";
|
|
132
132
|
OrderState["ORDERED"] = "ORDERED";
|
|
133
|
+
OrderState["PARTIALLY_RECEIVED"] = "PARTIALLY_RECEIVED";
|
|
133
134
|
OrderState["DONE"] = "DONE";
|
|
134
135
|
OrderState["CANCELLED"] = "CANCELLED";
|
|
135
136
|
})(OrderState = exports.OrderState || (exports.OrderState = {}));
|
|
@@ -28,8 +28,10 @@ export default class Customer extends User {
|
|
|
28
28
|
billingAddress?: Address;
|
|
29
29
|
siren?: string;
|
|
30
30
|
vatId?: string;
|
|
31
|
+
contactId?: number;
|
|
32
|
+
establishmentId?: number;
|
|
31
33
|
constructor(id: string, roles: Role[] | undefined, firstname: string | undefined, lastname: string | undefined, avatar: string | undefined, addresses: Address[] | undefined, vehicles: Vehicle[], email: string | undefined, turnover: {
|
|
32
34
|
key: string;
|
|
33
35
|
value: number;
|
|
34
|
-
}[], type: CustomerType, companyName: string, companyPhoneNumber: string, billingAddress: Address | undefined, notes: string, siren?: string, vatId?: string);
|
|
36
|
+
}[], type: CustomerType, companyName: string, companyPhoneNumber: string, billingAddress: Address | undefined, notes: string, siren?: string, vatId?: string, contactId?: number, establishmentId?: number);
|
|
35
37
|
}
|
|
@@ -21,7 +21,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
var User_1 = __importDefault(require("./User"));
|
|
22
22
|
var Customer = /** @class */ (function (_super) {
|
|
23
23
|
__extends(Customer, _super);
|
|
24
|
-
function Customer(id, roles, firstname, lastname, avatar, addresses, vehicles, email, turnover, type, companyName, companyPhoneNumber, billingAddress, notes, siren, vatId) {
|
|
24
|
+
function Customer(id, roles, firstname, lastname, avatar, addresses, vehicles, email, turnover, type, companyName, companyPhoneNumber, billingAddress, notes, siren, vatId, contactId, establishmentId) {
|
|
25
25
|
if (roles === void 0) { roles = []; }
|
|
26
26
|
if (firstname === void 0) { firstname = ""; }
|
|
27
27
|
if (lastname === void 0) { lastname = ""; }
|
|
@@ -41,6 +41,8 @@ var Customer = /** @class */ (function (_super) {
|
|
|
41
41
|
_this.billingAddress = billingAddress;
|
|
42
42
|
_this.siren = siren;
|
|
43
43
|
_this.vatId = vatId;
|
|
44
|
+
_this.contactId = contactId;
|
|
45
|
+
_this.establishmentId = establishmentId;
|
|
44
46
|
return _this;
|
|
45
47
|
}
|
|
46
48
|
return Customer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventState, EventType, OrderPreference } from "../helpers/Enums";
|
|
1
|
+
import { EventState, EventType, OrderPreference, OrderState } from "../helpers/Enums";
|
|
2
2
|
import Address from "./Address";
|
|
3
3
|
import Customer from "./Customer";
|
|
4
4
|
import Document from "./Document";
|
|
@@ -10,14 +10,35 @@ import Product from "./Product";
|
|
|
10
10
|
import Supplier from "./Supplier";
|
|
11
11
|
import User from "./User";
|
|
12
12
|
import Vehicle from "./Vehicle";
|
|
13
|
-
interface
|
|
13
|
+
export interface Order {
|
|
14
14
|
id: string;
|
|
15
15
|
supplier: Supplier;
|
|
16
16
|
orderPreference: string;
|
|
17
17
|
orderType: string;
|
|
18
18
|
orderDate: Date;
|
|
19
|
+
number: string | null;
|
|
19
20
|
comment: string;
|
|
20
21
|
deliveryDate: Date | null;
|
|
22
|
+
orderState: OrderState;
|
|
23
|
+
lines: OrderLines[];
|
|
24
|
+
}
|
|
25
|
+
export interface OrderLines {
|
|
26
|
+
id: string;
|
|
27
|
+
genericId: string;
|
|
28
|
+
catalogEntryId: string | null;
|
|
29
|
+
catalogId: string | null;
|
|
30
|
+
reference: string | null;
|
|
31
|
+
supplierReference: string;
|
|
32
|
+
name: string;
|
|
33
|
+
unity: string | null;
|
|
34
|
+
depotId: number | null;
|
|
35
|
+
quantityOrdered: number;
|
|
36
|
+
quantityReceived: number;
|
|
37
|
+
purchaseUnitPriceCents: number | null;
|
|
38
|
+
saleUnitPriceCents: number | null;
|
|
39
|
+
saleVatPercent: number;
|
|
40
|
+
status: OrderState;
|
|
41
|
+
lastReceiptLineId: string | null;
|
|
21
42
|
}
|
|
22
43
|
export default class Event {
|
|
23
44
|
id: string;
|
|
@@ -33,7 +54,7 @@ export default class Event {
|
|
|
33
54
|
prestations?: Prestation[];
|
|
34
55
|
operations?: Operation[];
|
|
35
56
|
products?: Product[];
|
|
36
|
-
orders?:
|
|
57
|
+
orders?: Order[];
|
|
37
58
|
/**
|
|
38
59
|
* Un tableau d'invités, dans notre cas d'usage nous n'aurons qu'un invité de type Client
|
|
39
60
|
*/
|
|
@@ -84,8 +105,7 @@ export default class Event {
|
|
|
84
105
|
quoteFirstSendingTime?: Date;
|
|
85
106
|
lastQuoteCreationDate?: Date;
|
|
86
107
|
urgent?: boolean;
|
|
87
|
-
constructor(id: string, ownerId: number, type: EventType, title: string, garageName: string, garageId: number, color: string, state: EventState, garageAddress?: Address, start?: Date, end?: Date, prestations?: Prestation[], operations?: Operation[], products?: Product[], guestsId?: string[], vehicleId?: number, quoteId?: number, notes?: string, vehicleAvailableNotified?: boolean, editable?: boolean, resourceId?: number, garageVehicleId?: number, garageVehicleRequest?: boolean, vehicleAvailableNotificationTime?: Date, interventionEndTime?: Date, quoteLastSendingTime?: Date, invoiceSendingDate?: Date, orders?:
|
|
108
|
+
constructor(id: string, ownerId: number, type: EventType, title: string, garageName: string, garageId: number, color: string, state: EventState, garageAddress?: Address, start?: Date, end?: Date, prestations?: Prestation[], operations?: Operation[], products?: Product[], guestsId?: string[], vehicleId?: number, quoteId?: number, notes?: string, vehicleAvailableNotified?: boolean, editable?: boolean, resourceId?: number, garageVehicleId?: number, garageVehicleRequest?: boolean, vehicleAvailableNotificationTime?: Date, interventionEndTime?: Date, quoteLastSendingTime?: Date, invoiceSendingDate?: Date, orders?: Order[], creationDate?: Date, updatedDate?: Date, lastQuoteCreationDate?: Date, quoteFirstSendingTime?: Date, urgent?: boolean, garageVehicleBookings?: LoanVehicle[]);
|
|
88
109
|
static getPrestationsList(event: Event): string[];
|
|
89
110
|
static getCurrentQuote(event: Event): Document | null;
|
|
90
111
|
}
|
|
91
|
-
export {};
|
|
@@ -9,6 +9,7 @@ import Subscription from "./Subscription";
|
|
|
9
9
|
import Supplier from "./Supplier";
|
|
10
10
|
import User from "./User";
|
|
11
11
|
import VehicleGarage from "./VehicleGarage";
|
|
12
|
+
import Settings from "./Settings";
|
|
12
13
|
export default class Garage {
|
|
13
14
|
id: string;
|
|
14
15
|
adminId: string;
|
|
@@ -67,5 +68,8 @@ export default class Garage {
|
|
|
67
68
|
reopeningDate?: Date;
|
|
68
69
|
targetMargin?: number;
|
|
69
70
|
onlyBilling?: boolean;
|
|
70
|
-
|
|
71
|
+
settings: Settings[];
|
|
72
|
+
newDocumentEditor?: boolean;
|
|
73
|
+
constructor(id: string, adminId: string, name: string, address: Address, workforce: number, prestations: Prestation[], schedules: Schedule[], contactPhone: string, prestationCategories: CategoryPrestation[], dayPeriodFastServiceExcluded: boolean, loanerVehicleFastServiceExcluded: boolean, fastServiceThreshold: number, timezone: string, settings: Settings[], vehicles?: VehicleGarage[], contactEmail?: string, logo?: string, suppliers?: Supplier[], documents?: Document[], subscriptions?: Subscription[], loanerVehicleActive?: boolean, loanerVehicleRequestActive?: boolean, customStyle?: string, subscription?: Subscription, partialWorkforce?: number, mailCustomization?: boolean, billingActive?: boolean, billingToken?: string, billingSimulationActive?: boolean, appId?: number, establishmentRegistrationNumber?: string, companyRegistrationNumber?: string, quoteRequestStart?: Date, reopeningDate?: Date, targetMargin?: number, demoBillingActive?: boolean, onlyBilling?: boolean, newDocumentEditor?: boolean, googleReviewUrl?: string);
|
|
71
74
|
}
|
|
75
|
+
export declare function isStockActive(g: Garage): boolean;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isStockActive = void 0;
|
|
4
|
+
var Settings_1 = require("./Settings");
|
|
3
5
|
var Garage = /** @class */ (function () {
|
|
4
|
-
function Garage(id, adminId, name, address, workforce, prestations, schedules, contactPhone, prestationCategories, dayPeriodFastServiceExcluded, loanerVehicleFastServiceExcluded, fastServiceThreshold, timezone, vehicles, contactEmail, logo, suppliers, documents, subscriptions, loanerVehicleActive, loanerVehicleRequestActive, customStyle, subscription, partialWorkforce, mailCustomization, billingActive, billingToken, billingSimulationActive, appId, establishmentRegistrationNumber, companyRegistrationNumber, quoteRequestStart, reopeningDate, targetMargin, demoBillingActive, onlyBilling, googleReviewUrl) {
|
|
6
|
+
function Garage(id, adminId, name, address, workforce, prestations, schedules, contactPhone, prestationCategories, dayPeriodFastServiceExcluded, loanerVehicleFastServiceExcluded, fastServiceThreshold, timezone, settings, vehicles, contactEmail, logo, suppliers, documents, subscriptions, loanerVehicleActive, loanerVehicleRequestActive, customStyle, subscription, partialWorkforce, mailCustomization, billingActive, billingToken, billingSimulationActive, appId, establishmentRegistrationNumber, companyRegistrationNumber, quoteRequestStart, reopeningDate, targetMargin, demoBillingActive, onlyBilling, newDocumentEditor, googleReviewUrl) {
|
|
5
7
|
if (onlyBilling === void 0) { onlyBilling = false; }
|
|
8
|
+
if (newDocumentEditor === void 0) { newDocumentEditor = false; }
|
|
6
9
|
this.id = id;
|
|
7
10
|
this.adminId = adminId;
|
|
8
11
|
this.name = name;
|
|
@@ -40,7 +43,17 @@ var Garage = /** @class */ (function () {
|
|
|
40
43
|
this.demoBillingActive = demoBillingActive;
|
|
41
44
|
this.onlyBilling = onlyBilling;
|
|
42
45
|
this.googleReviewUrl = googleReviewUrl;
|
|
46
|
+
this.settings = settings;
|
|
47
|
+
this.newDocumentEditor = newDocumentEditor;
|
|
43
48
|
}
|
|
44
49
|
return Garage;
|
|
45
50
|
}());
|
|
46
51
|
exports.default = Garage;
|
|
52
|
+
function isStockActive(g) {
|
|
53
|
+
var _a, _b;
|
|
54
|
+
if (!g || !g.settings) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
return (_b = (_a = g.settings.find(function (s) { return s.code === Settings_1.SettingsEnumCode.STOCK_MODULE_ENABLED; })) === null || _a === void 0 ? void 0 : _a.valueBoolean) !== null && _b !== void 0 ? _b : false;
|
|
58
|
+
}
|
|
59
|
+
exports.isStockActive = isStockActive;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare enum SettingsEnumCode {
|
|
2
|
+
STOCK_MODULE_ENABLED = "STOCK_MODULE_ENABLED"
|
|
3
|
+
}
|
|
4
|
+
export default class Settings {
|
|
5
|
+
code: SettingsEnumCode;
|
|
6
|
+
valueBoolean?: boolean;
|
|
7
|
+
valueText?: string;
|
|
8
|
+
valueNumber?: number;
|
|
9
|
+
constructor(code: SettingsEnumCode, valueBoolean?: boolean, valueText?: string, valueNumber?: number);
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SettingsEnumCode = void 0;
|
|
4
|
+
var SettingsEnumCode;
|
|
5
|
+
(function (SettingsEnumCode) {
|
|
6
|
+
SettingsEnumCode["STOCK_MODULE_ENABLED"] = "STOCK_MODULE_ENABLED";
|
|
7
|
+
})(SettingsEnumCode = exports.SettingsEnumCode || (exports.SettingsEnumCode = {}));
|
|
8
|
+
var Settings = /** @class */ (function () {
|
|
9
|
+
function Settings(code, valueBoolean, valueText, valueNumber) {
|
|
10
|
+
this.code = code;
|
|
11
|
+
this.valueBoolean = valueBoolean;
|
|
12
|
+
this.valueText = valueText;
|
|
13
|
+
this.valueNumber = valueNumber;
|
|
14
|
+
}
|
|
15
|
+
return Settings;
|
|
16
|
+
}());
|
|
17
|
+
exports.default = Settings;
|
|
@@ -4,10 +4,12 @@ import Garage from "../models/Garage";
|
|
|
4
4
|
import Operation from "../models/Operation";
|
|
5
5
|
import Product from "../models/Product";
|
|
6
6
|
import { AddCustomerVehicleParams, DeleteCustomerVehicleParams } from "./GarageService.types";
|
|
7
|
+
import { SettingsEnumCode } from "../models/Settings";
|
|
7
8
|
export default class GarageService {
|
|
8
9
|
static toogleUrgentQuote(garageId: string, quoteId: string): Promise<APIResponse<string>>;
|
|
9
10
|
static updatePaymentAuthorization(garageId: string, req: any): Promise<APIResponse<string>>;
|
|
10
11
|
static toogleGaragePaymentAuthorization(garageId: string): Promise<APIResponse<string>>;
|
|
12
|
+
static toogleGarageSetting(garageId: string, code: SettingsEnumCode, nexValue: any): Promise<APIResponse<string>>;
|
|
11
13
|
static toogleGarageSimulationDemoBilling(garageId: string): Promise<APIResponse<string>>;
|
|
12
14
|
static toogleEventVehicleReceived(garageId: string, eventId: string): Promise<APIResponse<string>>;
|
|
13
15
|
static setOrderedEvent(garageId: string, eventId: string, req: any): Promise<APIResponse<string>>;
|
|
@@ -38,6 +38,22 @@ var GarageService = /** @class */ (function () {
|
|
|
38
38
|
appType: Enums_1.MovaAppType.GARAGE,
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
|
+
GarageService.toogleGarageSetting = function (garageId, code, nexValue) {
|
|
42
|
+
if (nexValue === true) {
|
|
43
|
+
return (0, ApiHelper_1.request)({
|
|
44
|
+
url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/settings/").concat(code, "/enable"),
|
|
45
|
+
method: Enums_1.APIMethod.PATCH,
|
|
46
|
+
appType: Enums_1.MovaAppType.GARAGE,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
return (0, ApiHelper_1.request)({
|
|
51
|
+
url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/settings/").concat(code, "/disable"),
|
|
52
|
+
method: Enums_1.APIMethod.PATCH,
|
|
53
|
+
appType: Enums_1.MovaAppType.GARAGE,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
};
|
|
41
57
|
GarageService.toogleGarageSimulationDemoBilling = function (garageId) {
|
|
42
58
|
return (0, ApiHelper_1.request)({
|
|
43
59
|
url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/demo-billing/toggle"),
|
package/index.ts
CHANGED
|
@@ -49,7 +49,9 @@ export { default as CategoryPrestation } from "./src/models/CategoryPrestation";
|
|
|
49
49
|
export { default as Customer } from "./src/models/Customer";
|
|
50
50
|
export { default as Document } from "./src/models/Document";
|
|
51
51
|
export { default as Employee } from "./src/models/Employee";
|
|
52
|
-
export { default as Event
|
|
52
|
+
export { default as Event, } from "./src/models/Event";
|
|
53
|
+
export type {Order, OrderLines} from "./src/models/Event";
|
|
54
|
+
|
|
53
55
|
export { default as Garage } from "./src/models/Garage";
|
|
54
56
|
export { default as LoanVehicle } from "./src/models/LoanVehicle";
|
|
55
57
|
export { default as Operation } from "./src/models/Operation";
|
package/package.json
CHANGED
|
@@ -49,6 +49,7 @@ type TMovaTable<T> = {
|
|
|
49
49
|
isClickable?: (data: T) => boolean;
|
|
50
50
|
onRowDoubleClick?: (data: T) => void;
|
|
51
51
|
filterChildren?: React.ReactNode;
|
|
52
|
+
asSearchSection?: boolean;
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
export default function MovaTableBack<T>({
|
|
@@ -61,6 +62,7 @@ export default function MovaTableBack<T>({
|
|
|
61
62
|
onRowDoubleClick,
|
|
62
63
|
isClickable,
|
|
63
64
|
filterChildren,
|
|
65
|
+
asSearchSection = true
|
|
64
66
|
}: TMovaTable<T>) {
|
|
65
67
|
const [currentPageIndex, setCurrentPageIndex] = useState<number>(0);
|
|
66
68
|
const [rowsPerPage, setRowsPerPage] = useState<number>(25);
|
|
@@ -128,35 +130,35 @@ export default function MovaTableBack<T>({
|
|
|
128
130
|
|
|
129
131
|
return (
|
|
130
132
|
<div style={{ height: "100%", display: "flex", flexDirection: "column" }}>
|
|
131
|
-
<Box
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
133
|
+
{asSearchSection && <Box
|
|
134
|
+
sx={{
|
|
135
|
+
width: "50%",
|
|
136
|
+
my: 2,
|
|
137
|
+
px: 2,
|
|
138
|
+
display: "flex",
|
|
139
|
+
gap: 2,
|
|
140
|
+
}}
|
|
139
141
|
>
|
|
140
142
|
<TextField
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
143
|
+
size="small"
|
|
144
|
+
type="search"
|
|
145
|
+
onChange={handleSearchChange}
|
|
146
|
+
inputProps={{
|
|
147
|
+
startAdornment: (
|
|
148
|
+
<InputAdornment position="start">
|
|
149
|
+
<SearchIcon/>
|
|
150
|
+
</InputAdornment>
|
|
151
|
+
),
|
|
152
|
+
}}
|
|
153
|
+
sx={{width: "100%"}}
|
|
154
|
+
placeholder="Rechercher"
|
|
153
155
|
/>
|
|
154
156
|
{refresh && (
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
157
|
+
<Button size="small" onClick={refresh} variant="contained">
|
|
158
|
+
<Refresh/>
|
|
159
|
+
</Button>
|
|
158
160
|
)}
|
|
159
|
-
</Box>
|
|
161
|
+
</Box>}
|
|
160
162
|
{filterChildren && filterChildren}
|
|
161
163
|
<TableContainer sx={{ height: "100%" }} component={Paper}>
|
|
162
164
|
<Table
|
|
@@ -70,6 +70,7 @@ const initialUserFormState = {
|
|
|
70
70
|
tireHeight: { value: "", isValid: true },
|
|
71
71
|
tireDiameter: { value: "", isValid: true },
|
|
72
72
|
tireSpeedIndex: { value: "", isValid: true },
|
|
73
|
+
|
|
73
74
|
lastInspectionDate: { value: null, isValid: true },
|
|
74
75
|
lastMaintenanceDate: { value: null, isValid: true },
|
|
75
76
|
tireBrand: { value: "", isValid: true },
|
|
@@ -262,7 +263,6 @@ const VehicleFullCard: FC<VehicleFullCardProps> = ({
|
|
|
262
263
|
};
|
|
263
264
|
|
|
264
265
|
const handleChange = (fieldName: string, fieldValue: string): void => {
|
|
265
|
-
console.log(fieldName, fieldValue);
|
|
266
266
|
const newField: MovaFormField = {
|
|
267
267
|
[fieldName]: { value: fieldValue, isValid: true },
|
|
268
268
|
};
|
package/src/helpers/Enums.ts
CHANGED
package/src/models/Customer.ts
CHANGED
|
@@ -30,7 +30,8 @@ export default class Customer extends User {
|
|
|
30
30
|
billingAddress?: Address;
|
|
31
31
|
siren?: string;
|
|
32
32
|
vatId?: string;
|
|
33
|
-
|
|
33
|
+
contactId?: number;
|
|
34
|
+
establishmentId?: number;
|
|
34
35
|
constructor(
|
|
35
36
|
id: string,
|
|
36
37
|
roles: Role[] = [],
|
|
@@ -47,7 +48,9 @@ export default class Customer extends User {
|
|
|
47
48
|
billingAddress: Address | undefined = undefined,
|
|
48
49
|
notes: string,
|
|
49
50
|
siren: string = "",
|
|
50
|
-
vatId: string = ""
|
|
51
|
+
vatId: string = "",
|
|
52
|
+
contactId?: number,
|
|
53
|
+
establishmentId?: number
|
|
51
54
|
) {
|
|
52
55
|
super(id, roles, firstname, lastname, avatar, email);
|
|
53
56
|
|
|
@@ -60,5 +63,7 @@ export default class Customer extends User {
|
|
|
60
63
|
this.billingAddress = billingAddress;
|
|
61
64
|
this.siren = siren;
|
|
62
65
|
this.vatId = vatId;
|
|
66
|
+
this.contactId = contactId;
|
|
67
|
+
this.establishmentId = establishmentId;
|
|
63
68
|
}
|
|
64
69
|
}
|
package/src/models/Event.ts
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
DocumentType,
|
|
4
4
|
EventState,
|
|
5
5
|
EventType,
|
|
6
|
-
OrderPreference,
|
|
6
|
+
OrderPreference, OrderState,
|
|
7
7
|
QuoteState,
|
|
8
8
|
} from "../helpers/Enums";
|
|
9
9
|
import Address from "./Address";
|
|
@@ -18,14 +18,36 @@ import Supplier from "./Supplier";
|
|
|
18
18
|
import User from "./User";
|
|
19
19
|
import Vehicle from "./Vehicle";
|
|
20
20
|
|
|
21
|
-
interface
|
|
21
|
+
export interface Order {
|
|
22
22
|
id: string;
|
|
23
23
|
supplier: Supplier;
|
|
24
24
|
orderPreference: string;
|
|
25
25
|
orderType: string;
|
|
26
26
|
orderDate: Date;
|
|
27
|
+
number: string | null;
|
|
27
28
|
comment: string;
|
|
28
29
|
deliveryDate: Date | null;
|
|
30
|
+
orderState: OrderState;
|
|
31
|
+
lines: OrderLines[]
|
|
32
|
+
}
|
|
33
|
+
export interface OrderLines {
|
|
34
|
+
id: string;
|
|
35
|
+
genericId: string;
|
|
36
|
+
|
|
37
|
+
catalogEntryId: string | null;
|
|
38
|
+
catalogId: string | null;
|
|
39
|
+
reference: string | null;
|
|
40
|
+
supplierReference: string;
|
|
41
|
+
name: string;
|
|
42
|
+
unity: string | null;
|
|
43
|
+
depotId: number | null;
|
|
44
|
+
quantityOrdered: number;
|
|
45
|
+
quantityReceived: number;
|
|
46
|
+
purchaseUnitPriceCents: number | null;
|
|
47
|
+
saleUnitPriceCents: number | null;
|
|
48
|
+
saleVatPercent: number;
|
|
49
|
+
status: OrderState; // ajustable si besoin
|
|
50
|
+
lastReceiptLineId: string | null;
|
|
29
51
|
}
|
|
30
52
|
export default class Event {
|
|
31
53
|
// Properties
|
|
@@ -42,7 +64,7 @@ export default class Event {
|
|
|
42
64
|
prestations?: Prestation[];
|
|
43
65
|
operations?: Operation[];
|
|
44
66
|
products?: Product[];
|
|
45
|
-
orders?:
|
|
67
|
+
orders?: Order[];
|
|
46
68
|
/**
|
|
47
69
|
* Un tableau d'invités, dans notre cas d'usage nous n'aurons qu'un invité de type Client
|
|
48
70
|
*/
|
|
@@ -126,7 +148,7 @@ export default class Event {
|
|
|
126
148
|
interventionEndTime?: Date,
|
|
127
149
|
quoteLastSendingTime?: Date,
|
|
128
150
|
invoiceSendingDate?: Date,
|
|
129
|
-
orders?:
|
|
151
|
+
orders?: Order[],
|
|
130
152
|
creationDate?: Date,
|
|
131
153
|
updatedDate?: Date,
|
|
132
154
|
lastQuoteCreationDate?: Date,
|
package/src/models/Garage.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
OrderPreference,
|
|
3
|
-
RegistrationState,
|
|
4
|
-
SlotAlgorithm,
|
|
5
|
-
SubscriptionPaymentInterval,
|
|
6
|
-
} from "../helpers/Enums";
|
|
1
|
+
import {OrderPreference, RegistrationState, SlotAlgorithm, SubscriptionPaymentInterval,} from "../helpers/Enums";
|
|
7
2
|
import Address from "./Address";
|
|
8
3
|
import CategoryPrestation from "./CategoryPrestation";
|
|
9
4
|
import Document from "./Document";
|
|
@@ -14,6 +9,7 @@ import Subscription from "./Subscription";
|
|
|
14
9
|
import Supplier from "./Supplier";
|
|
15
10
|
import User from "./User";
|
|
16
11
|
import VehicleGarage from "./VehicleGarage";
|
|
12
|
+
import Settings, {SettingsEnumCode} from "./Settings";
|
|
17
13
|
|
|
18
14
|
export default class Garage {
|
|
19
15
|
id: string;
|
|
@@ -73,6 +69,8 @@ export default class Garage {
|
|
|
73
69
|
reopeningDate?: Date;
|
|
74
70
|
targetMargin?: number;
|
|
75
71
|
onlyBilling?: boolean;
|
|
72
|
+
settings: Settings[];
|
|
73
|
+
newDocumentEditor?: boolean;
|
|
76
74
|
constructor(
|
|
77
75
|
id: string,
|
|
78
76
|
adminId: string,
|
|
@@ -87,6 +85,7 @@ export default class Garage {
|
|
|
87
85
|
loanerVehicleFastServiceExcluded: boolean,
|
|
88
86
|
fastServiceThreshold: number,
|
|
89
87
|
timezone: string,
|
|
88
|
+
settings: Settings[],
|
|
90
89
|
vehicles?: VehicleGarage[],
|
|
91
90
|
contactEmail?: string,
|
|
92
91
|
logo?: string,
|
|
@@ -110,7 +109,9 @@ export default class Garage {
|
|
|
110
109
|
targetMargin?: number,
|
|
111
110
|
demoBillingActive?: boolean,
|
|
112
111
|
onlyBilling: boolean = false,
|
|
113
|
-
|
|
112
|
+
newDocumentEditor: boolean = false,
|
|
113
|
+
googleReviewUrl?:string,
|
|
114
|
+
|
|
114
115
|
) {
|
|
115
116
|
this.id = id;
|
|
116
117
|
this.adminId = adminId;
|
|
@@ -149,5 +150,15 @@ export default class Garage {
|
|
|
149
150
|
this.demoBillingActive = demoBillingActive;
|
|
150
151
|
this.onlyBilling = onlyBilling;
|
|
151
152
|
this.googleReviewUrl = googleReviewUrl;
|
|
153
|
+
this.settings = settings;
|
|
154
|
+
this.newDocumentEditor = newDocumentEditor;
|
|
152
155
|
}
|
|
156
|
+
|
|
157
|
+
|
|
153
158
|
}
|
|
159
|
+
export function isStockActive (g: Garage): boolean {
|
|
160
|
+
if (!g || !g.settings) {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
return g.settings.find((s) => s.code === SettingsEnumCode.STOCK_MODULE_ENABLED)?.valueBoolean ?? false
|
|
164
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export enum SettingsEnumCode {
|
|
2
|
+
STOCK_MODULE_ENABLED = "STOCK_MODULE_ENABLED"
|
|
3
|
+
}
|
|
4
|
+
export default class Settings {
|
|
5
|
+
|
|
6
|
+
code: SettingsEnumCode;
|
|
7
|
+
valueBoolean?:boolean;
|
|
8
|
+
valueText?:string;
|
|
9
|
+
valueNumber?:number;
|
|
10
|
+
constructor(
|
|
11
|
+
code: SettingsEnumCode,
|
|
12
|
+
valueBoolean?:boolean,
|
|
13
|
+
valueText?:string,
|
|
14
|
+
valueNumber?:number
|
|
15
|
+
) {
|
|
16
|
+
this.code = code;
|
|
17
|
+
this.valueBoolean = valueBoolean;
|
|
18
|
+
this.valueText = valueText;
|
|
19
|
+
this.valueNumber = valueNumber;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
AddCustomerVehicleParams,
|
|
9
9
|
DeleteCustomerVehicleParams,
|
|
10
10
|
} from "./GarageService.types";
|
|
11
|
+
import {SettingsEnumCode} from "../models/Settings";
|
|
11
12
|
|
|
12
13
|
export default class GarageService {
|
|
13
14
|
static toogleUrgentQuote(
|
|
@@ -43,6 +44,28 @@ export default class GarageService {
|
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
static toogleGarageSetting(
|
|
48
|
+
garageId: string,
|
|
49
|
+
code: SettingsEnumCode,
|
|
50
|
+
nexValue: any
|
|
51
|
+
): Promise<APIResponse<string>> {
|
|
52
|
+
if (nexValue === true) {
|
|
53
|
+
return request({
|
|
54
|
+
url: `${API_BASE_URL}/garage/${garageId}/settings/${code}/enable`,
|
|
55
|
+
method: APIMethod.PATCH,
|
|
56
|
+
appType: MovaAppType.GARAGE,
|
|
57
|
+
});
|
|
58
|
+
} else {
|
|
59
|
+
return request({
|
|
60
|
+
url: `${API_BASE_URL}/garage/${garageId}/settings/${code}/disable`,
|
|
61
|
+
method: APIMethod.PATCH,
|
|
62
|
+
appType: MovaAppType.GARAGE,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
46
69
|
static toogleGarageSimulationDemoBilling(
|
|
47
70
|
garageId: string
|
|
48
71
|
): Promise<APIResponse<string>> {
|