@movalib/movalib-commons 1.68.3 → 1.68.5
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/helpers/Enums.d.ts +1 -0
- package/dist/src/helpers/Enums.js +1 -0
- package/dist/src/models/Event.d.ts +26 -5
- package/dist/src/models/Garage.d.ts +4 -1
- package/dist/src/models/Garage.js +12 -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/helpers/Enums.ts +1 -0
- package/src/models/Event.ts +27 -4
- package/src/models/Garage.ts +15 -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 = {}));
|
|
@@ -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,36 @@ 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
|
+
marginRate: number | null;
|
|
34
|
+
unity: string | null;
|
|
35
|
+
depotId: number | null;
|
|
36
|
+
quantityOrdered: number;
|
|
37
|
+
quantityReceived: number;
|
|
38
|
+
purchaseUnitPriceCents: number | null;
|
|
39
|
+
saleUnitPriceCents: number | null;
|
|
40
|
+
saleVatPercent: number;
|
|
41
|
+
status: OrderState;
|
|
42
|
+
lastReceiptLineId: string | null;
|
|
21
43
|
}
|
|
22
44
|
export default class Event {
|
|
23
45
|
id: string;
|
|
@@ -33,7 +55,7 @@ export default class Event {
|
|
|
33
55
|
prestations?: Prestation[];
|
|
34
56
|
operations?: Operation[];
|
|
35
57
|
products?: Product[];
|
|
36
|
-
orders?:
|
|
58
|
+
orders?: Order[];
|
|
37
59
|
/**
|
|
38
60
|
* Un tableau d'invités, dans notre cas d'usage nous n'aurons qu'un invité de type Client
|
|
39
61
|
*/
|
|
@@ -84,8 +106,7 @@ export default class Event {
|
|
|
84
106
|
quoteFirstSendingTime?: Date;
|
|
85
107
|
lastQuoteCreationDate?: Date;
|
|
86
108
|
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?:
|
|
109
|
+
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
110
|
static getPrestationsList(event: Event): string[];
|
|
89
111
|
static getCurrentQuote(event: Event): Document | null;
|
|
90
112
|
}
|
|
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,6 +68,8 @@ export default class Garage {
|
|
|
67
68
|
reopeningDate?: Date;
|
|
68
69
|
targetMargin?: number;
|
|
69
70
|
onlyBilling?: boolean;
|
|
71
|
+
settings: Settings[];
|
|
70
72
|
newDocumentEditor?: boolean;
|
|
71
|
-
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, 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,
|
|
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);
|
|
72
74
|
}
|
|
75
|
+
export declare function isStockActive(g: Garage): boolean;
|
|
@@ -1,7 +1,9 @@
|
|
|
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,
|
|
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; }
|
|
6
8
|
if (newDocumentEditor === void 0) { newDocumentEditor = false; }
|
|
7
9
|
this.id = id;
|
|
@@ -41,8 +43,17 @@ var Garage = /** @class */ (function () {
|
|
|
41
43
|
this.demoBillingActive = demoBillingActive;
|
|
42
44
|
this.onlyBilling = onlyBilling;
|
|
43
45
|
this.googleReviewUrl = googleReviewUrl;
|
|
46
|
+
this.settings = settings;
|
|
44
47
|
this.newDocumentEditor = newDocumentEditor;
|
|
45
48
|
}
|
|
46
49
|
return Garage;
|
|
47
50
|
}());
|
|
48
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
|
package/src/helpers/Enums.ts
CHANGED
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,37 @@ 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
|
+
marginRate: number | null;
|
|
43
|
+
unity: string | null;
|
|
44
|
+
depotId: number | null;
|
|
45
|
+
quantityOrdered: number;
|
|
46
|
+
quantityReceived: number;
|
|
47
|
+
purchaseUnitPriceCents: number | null;
|
|
48
|
+
saleUnitPriceCents: number | null;
|
|
49
|
+
saleVatPercent: number;
|
|
50
|
+
status: OrderState; // ajustable si besoin
|
|
51
|
+
lastReceiptLineId: string | null;
|
|
29
52
|
}
|
|
30
53
|
export default class Event {
|
|
31
54
|
// Properties
|
|
@@ -42,7 +65,7 @@ export default class Event {
|
|
|
42
65
|
prestations?: Prestation[];
|
|
43
66
|
operations?: Operation[];
|
|
44
67
|
products?: Product[];
|
|
45
|
-
orders?:
|
|
68
|
+
orders?: Order[];
|
|
46
69
|
/**
|
|
47
70
|
* Un tableau d'invités, dans notre cas d'usage nous n'aurons qu'un invité de type Client
|
|
48
71
|
*/
|
|
@@ -126,7 +149,7 @@ export default class Event {
|
|
|
126
149
|
interventionEndTime?: Date,
|
|
127
150
|
quoteLastSendingTime?: Date,
|
|
128
151
|
invoiceSendingDate?: Date,
|
|
129
|
-
orders?:
|
|
152
|
+
orders?: Order[],
|
|
130
153
|
creationDate?: Date,
|
|
131
154
|
updatedDate?: Date,
|
|
132
155
|
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,7 @@ export default class Garage {
|
|
|
73
69
|
reopeningDate?: Date;
|
|
74
70
|
targetMargin?: number;
|
|
75
71
|
onlyBilling?: boolean;
|
|
72
|
+
settings: Settings[];
|
|
76
73
|
newDocumentEditor?: boolean;
|
|
77
74
|
constructor(
|
|
78
75
|
id: string,
|
|
@@ -88,6 +85,7 @@ export default class Garage {
|
|
|
88
85
|
loanerVehicleFastServiceExcluded: boolean,
|
|
89
86
|
fastServiceThreshold: number,
|
|
90
87
|
timezone: string,
|
|
88
|
+
settings: Settings[],
|
|
91
89
|
vehicles?: VehicleGarage[],
|
|
92
90
|
contactEmail?: string,
|
|
93
91
|
logo?: string,
|
|
@@ -111,8 +109,9 @@ export default class Garage {
|
|
|
111
109
|
targetMargin?: number,
|
|
112
110
|
demoBillingActive?: boolean,
|
|
113
111
|
onlyBilling: boolean = false,
|
|
112
|
+
newDocumentEditor: boolean = false,
|
|
114
113
|
googleReviewUrl?:string,
|
|
115
|
-
|
|
114
|
+
|
|
116
115
|
) {
|
|
117
116
|
this.id = id;
|
|
118
117
|
this.adminId = adminId;
|
|
@@ -151,6 +150,15 @@ export default class Garage {
|
|
|
151
150
|
this.demoBillingActive = demoBillingActive;
|
|
152
151
|
this.onlyBilling = onlyBilling;
|
|
153
152
|
this.googleReviewUrl = googleReviewUrl;
|
|
153
|
+
this.settings = settings;
|
|
154
154
|
this.newDocumentEditor = newDocumentEditor;
|
|
155
155
|
}
|
|
156
|
+
|
|
157
|
+
|
|
156
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>> {
|