diff --git a/frontend/app/package-lock.json b/frontend/app/package-lock.json
index cdf7cc4..4ee5892 100644
--- a/frontend/app/package-lock.json
+++ b/frontend/app/package-lock.json
@@ -18,6 +18,7 @@
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
+ "@viandeendirect/api": "file:../gen",
"dayjs": "^1.11.10",
"keycloak-js": "^21.1.1",
"querystring": "^0.2.1",
@@ -30,12 +31,11 @@
"react-router-dom": "^6.23.0",
"react-scripts": "5.0.1",
"typescript": "^5.2.2",
- "viandeendirect_eu": "file:../gen",
"web-vitals": "^2.1.4"
},
"devDependencies": {
"@mui/x-data-grid": "^6.18.1",
- "@openapitools/openapi-generator-cli": "^2.6.0",
+ "@openapitools/openapi-generator-cli": "^2.13.4",
"@types/jest": "^29.5.8",
"@types/node": "^20.9.2",
"@types/react": "^18.2.37",
@@ -45,38 +45,6 @@
"typescript": "^5.2.2"
}
},
- "../gen": {
- "version": "0.0.1",
- "license": "Unlicense",
- "dependencies": {
- "@babel/cli": "^7.0.0",
- "superagent": "^5.3.0"
- },
- "devDependencies": {
- "@babel/core": "^7.0.0",
- "@babel/plugin-proposal-class-properties": "^7.0.0",
- "@babel/plugin-proposal-decorators": "^7.0.0",
- "@babel/plugin-proposal-do-expressions": "^7.0.0",
- "@babel/plugin-proposal-export-default-from": "^7.0.0",
- "@babel/plugin-proposal-export-namespace-from": "^7.0.0",
- "@babel/plugin-proposal-function-bind": "^7.0.0",
- "@babel/plugin-proposal-function-sent": "^7.0.0",
- "@babel/plugin-proposal-json-strings": "^7.0.0",
- "@babel/plugin-proposal-logical-assignment-operators": "^7.0.0",
- "@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0",
- "@babel/plugin-proposal-numeric-separator": "^7.0.0",
- "@babel/plugin-proposal-optional-chaining": "^7.0.0",
- "@babel/plugin-proposal-pipeline-operator": "^7.0.0",
- "@babel/plugin-proposal-throw-expressions": "^7.0.0",
- "@babel/plugin-syntax-dynamic-import": "^7.0.0",
- "@babel/plugin-syntax-import-meta": "^7.0.0",
- "@babel/preset-env": "^7.0.0",
- "@babel/register": "^7.0.0",
- "expect.js": "^0.3.1",
- "mocha": "^8.0.1",
- "sinon": "^7.2.0"
- }
- },
"node_modules/@aashutoshrathi/word-wrap": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz",
@@ -3663,9 +3631,9 @@
"integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg=="
},
"node_modules/@jridgewell/trace-mapping": {
- "version": "0.3.22",
- "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz",
- "integrity": "sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==",
+ "version": "0.3.25",
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz",
+ "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==",
"dependencies": {
"@jridgewell/resolve-uri": "^3.1.0",
"@jridgewell/sourcemap-codec": "^1.4.14"
@@ -4062,14 +4030,13 @@
}
},
"node_modules/@nestjs/axios": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/@nestjs/axios/-/axios-3.0.1.tgz",
- "integrity": "sha512-VlOZhAGDmOoFdsmewn8AyClAdGpKXQQaY1+3PGB+g6ceurGIdTxZgRX3VXc1T6Zs60PedWjg3A82TDOB05mrzQ==",
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/@nestjs/axios/-/axios-3.0.2.tgz",
+ "integrity": "sha512-Z6GuOUdNQjP7FX+OuV2Ybyamse+/e0BFdTWBX5JxpBDKA+YkdLynDgG6HTF04zy6e9zPa19UX0WA2VDoehwhXQ==",
"dev": true,
"peerDependencies": {
"@nestjs/common": "^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0",
"axios": "^1.3.1",
- "reflect-metadata": "^0.1.12",
"rxjs": "^6.0.0 || ^7.0.0"
}
},
@@ -4219,17 +4186,17 @@
}
},
"node_modules/@openapitools/openapi-generator-cli": {
- "version": "2.9.0",
- "resolved": "https://registry.npmjs.org/@openapitools/openapi-generator-cli/-/openapi-generator-cli-2.9.0.tgz",
- "integrity": "sha512-KQpftKeiMoH5aEI/amOVLFGkGeT3DyA7Atj7v7l8xT3O9xnIUpoDmMg0WBTEh+NHxEwEAITQNDzr+JLjkXVaKw==",
+ "version": "2.13.4",
+ "resolved": "https://registry.npmjs.org/@openapitools/openapi-generator-cli/-/openapi-generator-cli-2.13.4.tgz",
+ "integrity": "sha512-4JKyrk55ohQK2FcuZbPdNvxdyXD14jjOIvE8hYjJ+E1cHbRbfXQXbYnjTODFE52Gx8eAxz8C9icuhDYDLn7nww==",
"dev": true,
"hasInstallScript": true,
"dependencies": {
- "@nestjs/axios": "3.0.1",
+ "@nestjs/axios": "3.0.2",
"@nestjs/common": "10.3.0",
"@nestjs/core": "10.3.0",
"@nuxtjs/opencollective": "0.3.2",
- "axios": "1.6.5",
+ "axios": "1.6.8",
"chalk": "4.1.2",
"commander": "8.3.0",
"compare-versions": "4.1.4",
@@ -4237,6 +4204,7 @@
"console.table": "0.10.0",
"fs-extra": "10.1.0",
"glob": "7.2.3",
+ "https-proxy-agent": "7.0.4",
"inquirer": "8.2.6",
"lodash": "4.17.21",
"reflect-metadata": "0.1.13",
@@ -4254,6 +4222,31 @@
"url": "https://opencollective.com/openapi_generator"
}
},
+ "node_modules/@openapitools/openapi-generator-cli/node_modules/agent-base": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz",
+ "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==",
+ "dev": true,
+ "dependencies": {
+ "debug": "^4.3.4"
+ },
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/@openapitools/openapi-generator-cli/node_modules/https-proxy-agent": {
+ "version": "7.0.4",
+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz",
+ "integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==",
+ "dev": true,
+ "dependencies": {
+ "agent-base": "^7.0.2",
+ "debug": "4"
+ },
+ "engines": {
+ "node": ">= 14"
+ }
+ },
"node_modules/@pkgjs/parseargs": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
@@ -5435,6 +5428,10 @@
"resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz",
"integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ=="
},
+ "node_modules/@viandeendirect/api": {
+ "version": "0.1.0",
+ "resolved": "file:../gen"
+ },
"node_modules/@webassemblyjs/ast": {
"version": "1.11.6",
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.6.tgz",
@@ -6083,12 +6080,12 @@
}
},
"node_modules/axios": {
- "version": "1.6.5",
- "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.5.tgz",
- "integrity": "sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==",
+ "version": "1.6.8",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz",
+ "integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==",
"dev": true,
"dependencies": {
- "follow-redirects": "^1.15.4",
+ "follow-redirects": "^1.15.6",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
@@ -9393,9 +9390,9 @@
"integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ=="
},
"node_modules/follow-redirects": {
- "version": "1.15.5",
- "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz",
- "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==",
+ "version": "1.15.6",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
+ "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
"funding": [
{
"type": "individual",
@@ -17222,11 +17219,11 @@
}
},
"node_modules/side-channel": {
- "version": "1.0.5",
- "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.5.tgz",
- "integrity": "sha512-QcgiIWV4WV7qWExbN5llt6frQB/lBven9pqliLXfGPB+K9ZYXxDozp0wLkHS24kWCm+6YXH/f0HhnObZnZOBnQ==",
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz",
+ "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==",
"dependencies": {
- "call-bind": "^1.0.6",
+ "call-bind": "^1.0.7",
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.4",
"object-inspect": "^1.13.1"
@@ -18731,10 +18728,6 @@
"node": ">= 0.8"
}
},
- "node_modules/viandeendirect_eu": {
- "resolved": "../gen",
- "link": true
- },
"node_modules/w3c-hr-time": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz",
diff --git a/frontend/app/package.json b/frontend/app/package.json
index 1226ad5..112760a 100644
--- a/frontend/app/package.json
+++ b/frontend/app/package.json
@@ -13,6 +13,7 @@
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
+ "@viandeendirect/api": "file:../gen",
"dayjs": "^1.11.10",
"keycloak-js": "^21.1.1",
"querystring": "^0.2.1",
@@ -25,16 +26,15 @@
"react-router-dom": "^6.23.0",
"react-scripts": "5.0.1",
"typescript": "^5.2.2",
- "viandeendirect_eu": "file:../gen",
"web-vitals": "^2.1.4"
},
"overrides": {
"typescript": "^5.2.2"
},
"scripts": {
- "generate:api": "rm -Rf ../gen && openapi-generator-cli generate -i ../../openapi/openapi.yml -g javascript -o ../gen --skip-validate-spec",
+ "generate:api": "rm -Rf ../gen && openapi-generator-cli generate -i ../../openapi/openapi.yml -g typescript-fetch -o ../gen --skip-validate-spec --additional-properties=npmName=@viandeendirect/api,npmVersion=0.1.0",
"build:api": "npm install --prefix ../gen && npm run build --prefix ../gen",
- "install:api": "rm -Rf ./node_modules/viandeendirect_eu && npm install ../gen",
+ "install:api": "rm -Rf ./node_modules/@viandeendirect/api && npm install ../gen",
"start": "react-scripts start",
"start:mock-api": "REACT_APP_MOCK_API=true react-scripts start",
"build": "react-scripts build",
@@ -64,7 +64,7 @@
},
"devDependencies": {
"@mui/x-data-grid": "^6.18.1",
- "@openapitools/openapi-generator-cli": "^2.6.0",
+ "@openapitools/openapi-generator-cli": "^2.13.4",
"@types/jest": "^29.5.8",
"@types/node": "^20.9.2",
"@types/react": "^18.2.37",
diff --git a/frontend/app/src/App.js b/frontend/app/src/App.js
index e5955f7..ec6a4fd 100644
--- a/frontend/app/src/App.js
+++ b/frontend/app/src/App.js
@@ -32,7 +32,7 @@ function App() {
-
+
diff --git a/frontend/app/src/api/ApiBuilder.ts b/frontend/app/src/api/ApiBuilder.ts
index b448852..28ffd0c 100644
--- a/frontend/app/src/api/ApiBuilder.ts
+++ b/frontend/app/src/api/ApiBuilder.ts
@@ -1,7 +1,7 @@
-import ApiClient from 'viandeendirect_eu/dist/ApiClient'
-import DefaultApi from 'viandeendirect_eu/dist/api/DefaultApi'
+import { DefaultApi } from '@viandeendirect/api/dist/apis/DefaultApi'
import { MockApi } from './mock/MockApi.ts'
import { UrlService } from '../domains/commons/service/UrlService.ts'
+import { Configuration } from '@viandeendirect/api/dist/runtime'
export class ApiBuilder {
@@ -16,11 +16,11 @@ export class ApiBuilder {
if(process.env.REACT_APP_MOCK_API) {
return new MockApi()
} else {
- let apiClient = ApiClient.instance
- apiClient.authentications['oAuth2ForViandeEnDirect'].accessToken = keycloak.token
- apiClient.basePath = await this.urlService.getBackendUrl()
- var api = new DefaultApi(apiClient)
- return api
+ const configuration = new Configuration({
+ accessToken: keycloak.token,
+ basePath: await this.urlService.getBackendUrl()
+ });
+ return new DefaultApi(configuration)
}
}
@@ -28,9 +28,10 @@ export class ApiBuilder {
if(process.env.REACT_APP_MOCK_API) {
return new MockApi()
} else {
- let apiClient = ApiClient.instance
- apiClient.basePath = await this.urlService.getBackendUrl()
- return new DefaultApi(apiClient)
+ const configuration = new Configuration({
+ basePath: await this.urlService.getBackendUrl()
+ });
+ return new DefaultApi(configuration)
}
}
diff --git a/frontend/app/src/api/mock/MockApiAddresses.ts b/frontend/app/src/api/mock/MockApiAddresses.ts
index 3d035eb..0ed15b5 100644
--- a/frontend/app/src/api/mock/MockApiAddresses.ts
+++ b/frontend/app/src/api/mock/MockApiAddresses.ts
@@ -1,4 +1,4 @@
-import Address from "viandeendirect_eu/dist/model/Address"
+import Address from "@viandeendirect/api/dist/models/Address"
export class MockApiAddresses {
getAddresses(): Array
{
diff --git a/frontend/app/src/api/mock/MockApiCustomers.ts b/frontend/app/src/api/mock/MockApiCustomers.ts
index d564c3d..f051083 100644
--- a/frontend/app/src/api/mock/MockApiCustomers.ts
+++ b/frontend/app/src/api/mock/MockApiCustomers.ts
@@ -1,4 +1,4 @@
-import Customer from "viandeendirect_eu/dist/model/Customer"
+import Customer from "@viandeendirect/api/dist/models/Customer"
export class MockApiCustomers {
diff --git a/frontend/app/src/api/mock/MockApiProducers.ts b/frontend/app/src/api/mock/MockApiProducers.ts
index 7b583ed..ca68ef6 100644
--- a/frontend/app/src/api/mock/MockApiProducers.ts
+++ b/frontend/app/src/api/mock/MockApiProducers.ts
@@ -1,7 +1,7 @@
-import Customer from "viandeendirect_eu/dist/model/Customer"
-import Producer from "viandeendirect_eu/dist/model/Producer"
-import ProducerStatus from "viandeendirect_eu/dist/model/ProducerStatus"
-import Sale from "viandeendirect_eu/dist/model/Sale"
+import Customer from "@viandeendirect/api/dist/models/Customer"
+import Producer from "@viandeendirect/api/dist/models/Producer"
+import ProducerStatus from "@viandeendirect/api/dist/models/ProducerStatus"
+import Sale from "@viandeendirect/api/dist/models/Sale"
export class MockApiProducers {
diff --git a/frontend/app/src/api/mock/MockApiProductions.ts b/frontend/app/src/api/mock/MockApiProductions.ts
index 347856d..b4ae6e1 100644
--- a/frontend/app/src/api/mock/MockApiProductions.ts
+++ b/frontend/app/src/api/mock/MockApiProductions.ts
@@ -1,6 +1,6 @@
-import BeefProduction from "viandeendirect_eu/dist/model/BeefProduction"
-import PackageTemplate from "viandeendirect_eu/dist/model/PackageTemplate"
-import Production from "viandeendirect_eu/dist/model/Production"
+import BeefProduction from "@viandeendirect/api/dist/models/BeefProduction"
+import PackageTemplate from "@viandeendirect/api/dist/models/PackageTemplate"
+import Production from "@viandeendirect/api/dist/models/Production"
export class MockApiProductions {
diff --git a/frontend/app/src/api/mock/MockApiSales.ts b/frontend/app/src/api/mock/MockApiSales.ts
index 8d3d423..c0fb0e8 100644
--- a/frontend/app/src/api/mock/MockApiSales.ts
+++ b/frontend/app/src/api/mock/MockApiSales.ts
@@ -1,6 +1,6 @@
-import Order from "viandeendirect_eu/dist/model/Order";
-import Sale from "viandeendirect_eu/dist/model/Sale";
-import Production from "viandeendirect_eu/dist/model/Production";
+import Order from "@viandeendirect/api/dist/models/Order";
+import Sale from "@viandeendirect/api/dist/models/Sale";
+import Production from "@viandeendirect/api/dist/models/Production";
export class MockApiSales {
diff --git a/frontend/app/src/domains/commons/service/ProducerService.ts b/frontend/app/src/domains/commons/service/ProducerService.ts
index 03d42cc..9ce6bcc 100644
--- a/frontend/app/src/domains/commons/service/ProducerService.ts
+++ b/frontend/app/src/domains/commons/service/ProducerService.ts
@@ -1,5 +1,5 @@
import Keycloak from "keycloak-js"
-import Producer from "viandeendirect_eu/dist/model/Producer.js";
+import Producer from "@viandeendirect/api/dist/models/Producer.js";
import { ApiInvoker } from "../../../api/ApiInvoker.ts";
import { AuthenticationService } from "../../../authentication/service/AuthenticationService.ts";
diff --git a/frontend/app/src/domains/customer/CustomerController.tsx b/frontend/app/src/domains/customer/CustomerController.tsx
index 2e800a3..13dd5d3 100644
--- a/frontend/app/src/domains/customer/CustomerController.tsx
+++ b/frontend/app/src/domains/customer/CustomerController.tsx
@@ -3,7 +3,7 @@ import CustomersList from './views/CustomersList.tsx'
import React from 'react'
import { useKeycloak } from '@react-keycloak/web'
import { ProducerService } from '../commons/service/ProducerService.ts'
-import Producer from 'viandeendirect_eu/dist/model/Producer.js'
+import Producer from '@viandeendirect/api/dist/models/Producer.js'
import AuthenticatedLayout from '../../layouts/producer/AuthenticatedLayout.tsx'
export default function CustomerController() {
diff --git a/frontend/app/src/domains/dashboard/components/DashboardAccount.tsx b/frontend/app/src/domains/dashboard/components/DashboardAccount.tsx
index 0c9abba..9e0292e 100644
--- a/frontend/app/src/domains/dashboard/components/DashboardAccount.tsx
+++ b/frontend/app/src/domains/dashboard/components/DashboardAccount.tsx
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react'
import { Button, Typography } from "@mui/material"
-import Producer from 'viandeendirect_eu/dist/model/Producer.js'
+import Producer from '@viandeendirect/api/dist/models/Producer.js'
import { ApiInvoker } from '../../../api/ApiInvoker.ts'
import { useKeycloak } from '@react-keycloak/web'
import { AuthenticationService } from '../../../authentication/service/AuthenticationService.ts'
diff --git a/frontend/app/src/domains/dashboard/components/DashboardProductions.tsx b/frontend/app/src/domains/dashboard/components/DashboardProductions.tsx
index ca72885..71b8e0f 100644
--- a/frontend/app/src/domains/dashboard/components/DashboardProductions.tsx
+++ b/frontend/app/src/domains/dashboard/components/DashboardProductions.tsx
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react'
import { Button, Typography } from "@mui/material"
-import Producer from 'viandeendirect_eu/dist/model/Producer.js'
+import Producer from '@viandeendirect/api/dist/models/Producer.js'
import { ApiInvoker } from '../../../api/ApiInvoker.ts'
import { useKeycloak } from '@react-keycloak/web'
import { AuthenticationService } from '../../../authentication/service/AuthenticationService.ts'
diff --git a/frontend/app/src/domains/dashboard/components/DashboardSales.tsx b/frontend/app/src/domains/dashboard/components/DashboardSales.tsx
index 51d4fb3..379b770 100644
--- a/frontend/app/src/domains/dashboard/components/DashboardSales.tsx
+++ b/frontend/app/src/domains/dashboard/components/DashboardSales.tsx
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react'
import { Button, Typography } from "@mui/material"
-import Producer from 'viandeendirect_eu/dist/model/Producer.js'
+import Producer from '@viandeendirect/api/dist/models/Producer.js'
import { ApiInvoker } from '../../../api/ApiInvoker.ts'
import { useKeycloak } from '@react-keycloak/web'
import { AuthenticationService } from '../../../authentication/service/AuthenticationService.ts'
diff --git a/frontend/app/src/domains/producer/ProducerController.tsx b/frontend/app/src/domains/producer/ProducerController.tsx
index cbdd469..b57fb72 100644
--- a/frontend/app/src/domains/producer/ProducerController.tsx
+++ b/frontend/app/src/domains/producer/ProducerController.tsx
@@ -5,7 +5,7 @@ import { Button, Link, Typography, CircularProgress } from "@mui/material"
import { ApiInvoker } from '../../api/ApiInvoker.ts';
import { useKeycloak } from '@react-keycloak/web';
-import Producer from 'viandeendirect_eu/dist/model/Producer.js';
+import Producer from '@viandeendirect/api/dist/models/Producer.js';
import { AuthenticationService } from '../../authentication/service/AuthenticationService.ts';
import AuthenticatedLayout from '../../layouts/producer/AuthenticatedLayout.tsx';
import { ProducerService } from '../commons/service/ProducerService.ts';
diff --git a/frontend/app/src/domains/production/components/BeefProductionCard.test.tsx b/frontend/app/src/domains/production/components/BeefProductionCard.test.tsx
index f22b3a1..1c574e3 100644
--- a/frontend/app/src/domains/production/components/BeefProductionCard.test.tsx
+++ b/frontend/app/src/domains/production/components/BeefProductionCard.test.tsx
@@ -2,7 +2,7 @@ import renderer from 'react-test-renderer';
import BeefProductionCard from './BeefProductionCard';
import React from 'react';
import { ReactKeycloakProvider } from '@react-keycloak/web';
-import Production from 'viandeendirect_eu/dist/model/Production';
+import Production from '@viandeendirect/api/dist/models/Production';
jest.mock("@react-keycloak/web", () => ({ useKeycloak: mockUseKeycloak }));
diff --git a/frontend/app/src/domains/production/components/BeefProductionCustomerCard.tsx b/frontend/app/src/domains/production/components/BeefProductionCustomerCard.tsx
index a4f10d1..95cc8f6 100644
--- a/frontend/app/src/domains/production/components/BeefProductionCustomerCard.tsx
+++ b/frontend/app/src/domains/production/components/BeefProductionCustomerCard.tsx
@@ -3,8 +3,8 @@ import { useEffect, useState } from 'react'
import { Typography } from "@mui/material"
-import BeefProduction from 'viandeendirect_eu/dist/model/BeefProduction.js'
-import PackageLot from 'viandeendirect_eu/dist/model/PackageLot.js'
+import BeefProduction from '@viandeendirect/api/dist/models/BeefProduction.js'
+import PackageLot from '@viandeendirect/api/dist/models/PackageLot.js'
import { AnimalTypeUtils } from '../../../enum/AnimalType.ts'
import { ApiInvoker } from '../../../api/ApiInvoker.ts'
import PieChart from '../../commons/components/PieChart.tsx'
diff --git a/frontend/app/src/domains/production/views/beefProduction/BeefProductionCreator.tsx b/frontend/app/src/domains/production/views/beefProduction/BeefProductionCreator.tsx
index 8225700..3674844 100644
--- a/frontend/app/src/domains/production/views/beefProduction/BeefProductionCreator.tsx
+++ b/frontend/app/src/domains/production/views/beefProduction/BeefProductionCreator.tsx
@@ -12,8 +12,8 @@ import {BreedingPropertiesForm, mapBreedingFormDataToBeefProduction as mapBreedi
import SlaughterPropertiesForm, { mapSlaughterFormDataToBeefProduction } from "./forms/SlaughterPropertiesForm.tsx"
import CuttingPropertiesForm, { mapCuttingFormDataToBeefProduction } from "./forms/CuttingPropertiesForm.tsx"
import { BeefProductionService } from "../../service/BeefProductionService.ts"
-import BeefProduction from "viandeendirect_eu/dist/model/BeefProduction.js"
-import PackageLot from "viandeendirect_eu/dist/model/PackageLot.js"
+import BeefProduction from "@viandeendirect/api/dist/models/BeefProduction.js"
+import PackageLot from "@viandeendirect/api/dist/models/PackageLot.js"
import { useNavigate } from "react-router-dom"
export default function BeefProductionCreator() {
diff --git a/frontend/app/src/domains/production/views/beefProduction/BeefProductionView.tsx b/frontend/app/src/domains/production/views/beefProduction/BeefProductionView.tsx
index 50a845f..dcda7e7 100644
--- a/frontend/app/src/domains/production/views/beefProduction/BeefProductionView.tsx
+++ b/frontend/app/src/domains/production/views/beefProduction/BeefProductionView.tsx
@@ -6,7 +6,7 @@ import dayjs from 'dayjs'
import BreedingPropertiesForm, { mapBreedingFormDataToBeefProduction } from './forms/BreedingPropertiesForm.tsx'
import SlaughterPropertiesForm, { mapSlaughterFormDataToBeefProduction } from './forms/SlaughterPropertiesForm.tsx'
import CuttingPropertiesForm, { mapCuttingFormDataToBeefProduction } from './forms/CuttingPropertiesForm.tsx'
-import BeefProduction from "viandeendirect_eu/dist/model/BeefProduction.js"
+import BeefProduction from "@viandeendirect/api/dist/models/BeefProduction.js"
import PackageLotsCreator from '../PackageLotsCreator.tsx'
import { ApiInvoker } from '../../../../api/ApiInvoker.ts'
import { useKeycloak } from '@react-keycloak/web'
diff --git a/frontend/app/src/domains/production/views/beefProduction/forms/BreedingPropertiesForm.tsx b/frontend/app/src/domains/production/views/beefProduction/forms/BreedingPropertiesForm.tsx
index f399b99..99e0b28 100644
--- a/frontend/app/src/domains/production/views/beefProduction/forms/BreedingPropertiesForm.tsx
+++ b/frontend/app/src/domains/production/views/beefProduction/forms/BreedingPropertiesForm.tsx
@@ -3,7 +3,7 @@ import React from "react"
import { Button, ButtonGroup } from "@mui/material"
import { CheckboxElement, DatePickerElement, FormContainer, SelectElement, SubmitHandler, TextFieldElement, useForm } from 'react-hook-form-mui'
-import BeefProduction from "viandeendirect_eu/dist/model/BeefProduction"
+import BeefProduction from "@viandeendirect/api/dist/models/BeefProduction"
import dayjs from "dayjs"
export function BreedingPropertiesForm({
diff --git a/frontend/app/src/domains/production/views/beefProduction/forms/CuttingPropertiesForm.tsx b/frontend/app/src/domains/production/views/beefProduction/forms/CuttingPropertiesForm.tsx
index 1fbf508..f6fcb74 100644
--- a/frontend/app/src/domains/production/views/beefProduction/forms/CuttingPropertiesForm.tsx
+++ b/frontend/app/src/domains/production/views/beefProduction/forms/CuttingPropertiesForm.tsx
@@ -2,7 +2,7 @@ import React from 'react'
import { ButtonGroup, Button } from '@mui/material'
import { FormContainer, DatePickerElement, TextFieldElement, useForm } from 'react-hook-form-mui'
-import BeefProduction from "viandeendirect_eu/dist/model/BeefProduction"
+import BeefProduction from "@viandeendirect/api/dist/models/BeefProduction"
import dayjs from 'dayjs'
export function CuttingPropertiesForm({
diff --git a/frontend/app/src/domains/sale/SaleController.tsx b/frontend/app/src/domains/sale/SaleController.tsx
index 64a3d27..58ffda6 100644
--- a/frontend/app/src/domains/sale/SaleController.tsx
+++ b/frontend/app/src/domains/sale/SaleController.tsx
@@ -4,14 +4,14 @@ import { useState, useEffect } from 'react'
import SalesList from './views/SalesList.tsx'
import SaleForm from './views/SaleForm.tsx'
import OrdersList from './views/OrdersList.tsx'
-import Sale from 'viandeendirect_eu/dist/model/Sale'
-import Order from 'viandeendirect_eu/dist/model/Order'
+import Sale from '@viandeendirect/api/dist/models/Sale'
+import Order from '@viandeendirect/api/dist/models/Order'
import OrderView from './views/OrderView.tsx'
import ProducerOrderForm from './views/ProducerOrderForm.tsx'
import AuthenticatedLayout from '../../layouts/producer/AuthenticatedLayout.tsx'
import { useKeycloak } from '@react-keycloak/web'
import { ProducerService } from '../commons/service/ProducerService.ts'
-import Producer from 'viandeendirect_eu/dist/model/Producer.js'
+import Producer from '@viandeendirect/api/dist/models/Producer.js'
export default function SaleController() {
diff --git a/frontend/app/src/domains/sale/components/CustomerSelector.tsx b/frontend/app/src/domains/sale/components/CustomerSelector.tsx
index 650c5b2..b1d4cd0 100644
--- a/frontend/app/src/domains/sale/components/CustomerSelector.tsx
+++ b/frontend/app/src/domains/sale/components/CustomerSelector.tsx
@@ -3,9 +3,8 @@ import { useState } from 'react'
import { Switch, Button } from "@mui/material"
import { AutocompleteElement, FormContainer, TextFieldElement } from 'react-hook-form-mui'
+import { Customer } from '@viandeendirect/api/dist/models/Customer'
-import Customer from "viandeendirect_eu/dist/model/Customer"
-import User from "viandeendirect_eu/dist/model/User"
export default function CustomerSelector({ customers: customers, callback: callback }) {
@@ -71,8 +70,8 @@ export default function CustomerSelector({ customers: customers, callback: callb
}
function defineNewCustomer(newCustomerFormData: FormData){
- const createdCustomer = new Customer()
- createdCustomer.user = new User()
+ const createdCustomer :Customer = {}
+ createdCustomer.user = {}
createdCustomer.user.lastName = newCustomerFormData['lastName']
createdCustomer.user.firstName = newCustomerFormData['firstName']
createdCustomer.user.email = newCustomerFormData['email']
diff --git a/frontend/app/src/domains/sale/components/OrderSummary.tsx b/frontend/app/src/domains/sale/components/OrderSummary.tsx
index 0eed30e..7e63431 100644
--- a/frontend/app/src/domains/sale/components/OrderSummary.tsx
+++ b/frontend/app/src/domains/sale/components/OrderSummary.tsx
@@ -2,8 +2,8 @@ import React from 'react'
import { Typography } from '@mui/material'
-import OrderItem from 'viandeendirect_eu/dist/model/OrderItem'
-import Order from 'viandeendirect_eu/dist/model/Order'
+import OrderItem from '@viandeendirect/api/dist/models/OrderItem'
+import Order from '@viandeendirect/api/dist/models/Order'
import { OrderStatusUtils } from '../../../enum/OrderStatus.ts'
export default function OrderSummary({ order: order }) {
diff --git a/frontend/app/src/domains/sale/components/PackageSelector.tsx b/frontend/app/src/domains/sale/components/PackageSelector.tsx
index e0b2981..df193ef 100644
--- a/frontend/app/src/domains/sale/components/PackageSelector.tsx
+++ b/frontend/app/src/domains/sale/components/PackageSelector.tsx
@@ -4,8 +4,8 @@ import { Button, Fab } from "@mui/material"
import AddIcon from '@mui/icons-material/Add';
import RemoveIcon from '@mui/icons-material/Remove';
-import OrderItem from "viandeendirect_eu/dist/model/OrderItem"
-import PackageLot from "viandeendirect_eu/dist/model/PackageLot"
+import OrderItem from "@viandeendirect/api/dist/models/OrderItem"
+import PackageLot from "@viandeendirect/api/dist/models/PackageLot"
import PackageLotDescription from '../../production/components/PackageLotDescription.tsx';
import './PackageSelector.css'
diff --git a/frontend/app/src/domains/sale/components/SaleCard.tsx b/frontend/app/src/domains/sale/components/SaleCard.tsx
index a1a665c..b394912 100644
--- a/frontend/app/src/domains/sale/components/SaleCard.tsx
+++ b/frontend/app/src/domains/sale/components/SaleCard.tsx
@@ -5,8 +5,8 @@ import dayjs from 'dayjs'
import SaleCardBeefProduction from './SaleCardBeefProduction.tsx';
import { ApiInvoker } from '../../../api/ApiInvoker.ts';
import { useKeycloak } from '@react-keycloak/web';
-import Order from 'viandeendirect_eu/dist/model/Order'
-import Production from 'viandeendirect_eu/dist/model/Production'
+import Order from '@viandeendirect/api/dist/models/Order'
+import Production from '@viandeendirect/api/dist/models/Production'
import { useNavigate } from 'react-router-dom';
diff --git a/frontend/app/src/domains/sale/components/SaleCardBeefProduction.tsx b/frontend/app/src/domains/sale/components/SaleCardBeefProduction.tsx
index 4f1eaed..38b2932 100644
--- a/frontend/app/src/domains/sale/components/SaleCardBeefProduction.tsx
+++ b/frontend/app/src/domains/sale/components/SaleCardBeefProduction.tsx
@@ -5,7 +5,7 @@ import { Typography } from "@mui/material"
import { ApiInvoker } from '../../../api/ApiInvoker.ts'
import { AnimalTypeUtils } from '../../../enum/AnimalType.ts';
import PieChart from '../../commons/components/PieChart.tsx'
-import Production from 'viandeendirect_eu/dist/model/BeefProduction'
+import Production from '@viandeendirect/api/dist/models/BeefProduction'
import './SaleCard.css'
export default function SaleCardBeefProduction({production: production}) {
diff --git a/frontend/app/src/domains/sale/components/SaleCustomerCard.tsx b/frontend/app/src/domains/sale/components/SaleCustomerCard.tsx
index d50fa3c..b98105f 100644
--- a/frontend/app/src/domains/sale/components/SaleCustomerCard.tsx
+++ b/frontend/app/src/domains/sale/components/SaleCustomerCard.tsx
@@ -3,7 +3,7 @@ import { Button, Card, CardActions, CardContent } from '@mui/material'
import dayjs from 'dayjs'
-import Production from 'viandeendirect_eu/dist/model/Production.js'
+import Production from '@viandeendirect/api/dist/models/Production.js'
import './SaleCustomerCard.css'
import ProductionCustomerCard from '../../production/components/ProductionCustomerCard.tsx';
diff --git a/frontend/app/src/domains/sale/views/CustomerOrderForm.tsx b/frontend/app/src/domains/sale/views/CustomerOrderForm.tsx
index 7088f35..6dd68a4 100644
--- a/frontend/app/src/domains/sale/views/CustomerOrderForm.tsx
+++ b/frontend/app/src/domains/sale/views/CustomerOrderForm.tsx
@@ -7,10 +7,10 @@ import dayjs from 'dayjs'
import { useKeycloak } from '@react-keycloak/web'
import { ApiInvoker } from '../../../api/ApiInvoker.ts'
-import Order from "viandeendirect_eu/dist/model/Order"
-import Customer from "viandeendirect_eu/dist/model/Customer"
-import Production from "viandeendirect_eu/dist/model/Production"
-import PackageLot from "viandeendirect_eu/dist/model/PackageLot"
+import Order from "@viandeendirect/api/dist/models/Order"
+import Customer from "@viandeendirect/api/dist/models/Customer"
+import Production from "@viandeendirect/api/dist/models/Production"
+import PackageLot from "@viandeendirect/api/dist/models/PackageLot"
import PackageSelector from '../components/PackageSelector.tsx'
import { AuthenticationService } from '../../../authentication/service/AuthenticationService.ts'
diff --git a/frontend/app/src/domains/sale/views/OrdersList.tsx b/frontend/app/src/domains/sale/views/OrdersList.tsx
index 0943d2c..3df6d20 100644
--- a/frontend/app/src/domains/sale/views/OrdersList.tsx
+++ b/frontend/app/src/domains/sale/views/OrdersList.tsx
@@ -8,27 +8,34 @@ import dayjs from 'dayjs'
import { useKeycloak } from '@react-keycloak/web'
import { ApiBuilder } from '../../../api/ApiBuilder.ts'
-import Order from "viandeendirect_eu/dist/model/Order.js"
-import Sale from "viandeendirect_eu/dist/model/Sale.js"
+import { Order } from "@viandeendirect/api/dist/models/Order"
+import { Sale } from "@viandeendirect/api/dist/models/Sale"
import { OrderStatus, OrderStatusUtils } from '../../../enum/OrderStatus.ts';
-import { useNavigate } from 'react-router-dom';
+import { useLoaderData, useNavigate } from 'react-router-dom';
+import { DefaultApi } from '@viandeendirect/api/dist/apis/DefaultApi';
+import { Configuration } from '@viandeendirect/api/dist/runtime';
-export default function OrdersList(props) {
+export default function OrdersList() {
- const { keycloak, initialized } = useKeycloak()
const navigate = useNavigate()
- const apiBuilder = new ApiBuilder()
-
+ const loaderData = useLoaderData()
+ const sale = loaderData.sale
+ const orders = loaderData.orders
+
+ /*
const [sale, setSale] = useState({id: props.saleId})
+
const [orders, setOrders] = useState([])
-
+
useEffect(() => {
//TODO : load sale from props.saleId
loadOrders()
}, [keycloak])
+ */
const [abortedOrdersHidden, setAbortedOrdersHidden] = useState(true);
+ /*
function loadOrders() {
apiBuilder.getAuthenticatedApi(keycloak).then(api => {
apiBuilder.invokeAuthenticatedApi(() => {
@@ -43,6 +50,7 @@ export default function OrdersList(props) {
}, keycloak)
})
}
+ */
const columns: GridColDef[] = [
{ field: 'id', headerName: 'Référence', flex: 0.5, disableColumnMenu: true },
@@ -98,3 +106,11 @@ export default function OrdersList(props) {
>
}
+
+export async function loadOrdersListData(saleId, keycloakClient) {
+ const apiBuilder = new ApiBuilder()
+ const api = await apiBuilder.getAuthenticatedApi(keycloakClient)
+ const orders = await api.getSaleOrders({saleId: saleId})
+ const sale = await api.getSale({saleId: saleId})
+ return {orders: orders, sale: sale}
+}
diff --git a/frontend/app/src/domains/sale/views/ProducerOrderForm.tsx b/frontend/app/src/domains/sale/views/ProducerOrderForm.tsx
index 2372867..72a4486 100644
--- a/frontend/app/src/domains/sale/views/ProducerOrderForm.tsx
+++ b/frontend/app/src/domains/sale/views/ProducerOrderForm.tsx
@@ -7,12 +7,12 @@ import dayjs from 'dayjs'
import { useKeycloak } from '@react-keycloak/web'
import { ApiBuilder } from '../../../api/ApiBuilder.ts'
-import Customer from "viandeendirect_eu/dist/model/Customer"
-import OrderItem from "viandeendirect_eu/dist/model/OrderItem"
-import Order from "viandeendirect_eu/dist/model/Order"
-import Production from "viandeendirect_eu/dist/model/Production"
-import PackageLot from "viandeendirect_eu/dist/model/PackageLot"
-import Sale from "viandeendirect_eu/dist/model/Sale"
+import Customer from "@viandeendirect/api/dist/models/Customer"
+import OrderItem from "@viandeendirect/api/dist/models/OrderItem"
+import Order from "@viandeendirect/api/dist/models/Order"
+import Production from "@viandeendirect/api/dist/models/Production"
+import PackageLot from "@viandeendirect/api/dist/models/PackageLot"
+import Sale from "@viandeendirect/api/dist/models/Sale"
import PackageSelector from '../components/PackageSelector.tsx'
import CustomerSelector from '../components/CustomerSelector.tsx'
diff --git a/frontend/app/src/domains/sale/views/SaleForm.tsx b/frontend/app/src/domains/sale/views/SaleForm.tsx
index e59c7a1..c00a67b 100644
--- a/frontend/app/src/domains/sale/views/SaleForm.tsx
+++ b/frontend/app/src/domains/sale/views/SaleForm.tsx
@@ -5,7 +5,7 @@ import { Button, ButtonGroup, Stepper, Step, StepLabel, StepContent, Typography,
import { ApiBuilder } from '../../../api/ApiBuilder.ts'
import { DatePickerElement, TextFieldElement, FormContainer, TimePickerElement } from 'react-hook-form-mui'
-import Sale from 'viandeendirect_eu/dist/model/Sale'
+import Sale from '@viandeendirect/api/dist/models/Sale'
import SaleProductionSelector from '../components/SaleProductionSelector.js'
import 'dayjs/locale/fr';
@@ -28,7 +28,7 @@ export default function SaleForm({producer: producer}) {
const { keycloak, initialized } = useKeycloak()
const navigate = useNavigate()
const [activeStep, setActiveStep] = useState(SELECT_PRODUCTION_STEP)
- const [sale, setSale] = useState(new Sale())
+ const [sale, setSale] = useState({})
const [addresses, setAddresses] = useState([])
const [selectedAddress, setSelectedAddress] = useState(undefined)
const apiBuilder = new ApiBuilder()
diff --git a/frontend/app/src/domains/sale/views/SalesList.tsx b/frontend/app/src/domains/sale/views/SalesList.tsx
index c2d06f3..b20aaf6 100644
--- a/frontend/app/src/domains/sale/views/SalesList.tsx
+++ b/frontend/app/src/domains/sale/views/SalesList.tsx
@@ -4,7 +4,7 @@ import { Typography, Button } from "@mui/material"
import { useKeycloak } from '@react-keycloak/web'
-import Producer from "viandeendirect_eu/dist/model/Producer.js";
+import Producer from "@viandeendirect/api/dist/models/Producer.js";
import SaleCard from '../components/SaleCard.tsx'
import { ApiInvoker } from '../../../api/ApiInvoker.ts'
import { useNavigate } from 'react-router-dom'
diff --git a/frontend/app/src/domains/welcome/Welcome.tsx b/frontend/app/src/domains/welcome/Welcome.tsx
index 490e70e..6a0160e 100644
--- a/frontend/app/src/domains/welcome/Welcome.tsx
+++ b/frontend/app/src/domains/welcome/Welcome.tsx
@@ -3,7 +3,7 @@ import { useEffect, useState } from 'react'
import { AppBar, Box, CssBaseline, Toolbar, Typography } from '@mui/material'
-import Sale from 'viandeendirect_eu/dist/model/Sale.js'
+import Sale from '@viandeendirect/api/dist/models/Sale.js'
import { ApiInvoker } from '../../api/ApiInvoker.ts'
import SaleCustomerCard from '../../domains/sale/components/SaleCustomerCard.tsx'
diff --git a/frontend/app/src/layouts/RouterFactory.tsx b/frontend/app/src/layouts/RouterFactory.tsx
index 3bd4936..6e84c9a 100644
--- a/frontend/app/src/layouts/RouterFactory.tsx
+++ b/frontend/app/src/layouts/RouterFactory.tsx
@@ -9,12 +9,12 @@ export class RouterFactory {
producerRouterFactory: ProducerRouterFactory = new ProducerRouterFactory()
customerRouterFactory: CustomerRouterFactory = new CustomerRouterFactory()
- getRouter() {
+ getRouter(keycloakClient) {
if(process.env.REACT_APP_MODE === 'CUSTOMER') {
- return this.customerRouterFactory.getRouter()
+ return this.customerRouterFactory.getRouter(keycloakClient)
}
if(process.env.REACT_APP_MODE === 'PRODUCER') {
- return this.producerRouterFactory.getRouter()
+ return this.producerRouterFactory.getRouter(keycloakClient)
}
return createBrowserRouter([
{
diff --git a/frontend/app/src/layouts/customer/CustomerLayout.tsx b/frontend/app/src/layouts/customer/CustomerLayout.tsx
index 047c84a..1a88929 100644
--- a/frontend/app/src/layouts/customer/CustomerLayout.tsx
+++ b/frontend/app/src/layouts/customer/CustomerLayout.tsx
@@ -5,9 +5,9 @@ import { useEffect, useState } from 'react'
import { useCookies } from 'react-cookie'
import { useKeycloak } from '@react-keycloak/web'
-import Sale from 'viandeendirect_eu/dist/model/Sale.js'
-import Customer from 'viandeendirect_eu/dist/model/Customer.js'
-import User from 'viandeendirect_eu/dist/model/User.js'
+import { Sale } from '@viandeendirect/api/dist/models/Sale'
+import { Customer } from '@viandeendirect/api/dist/models/Customer'
+import { User } from '@viandeendirect/api/dist/models/User'
import { ApiInvoker } from '../../api/ApiInvoker.ts'
import { AuthenticationService } from '../../authentication/service/AuthenticationService.ts'
@@ -55,33 +55,19 @@ export default function CustomerLayout() {
}
}, [initialized])
- function initCustomer(customer: Customer) {
+ function initCustomer(customer :Customer) {
if (customer) {
setCustomer(customer)
} else {
- const customer = new Customer()
- customer.user = new User()
+ const customer: Customer = {}
+ customer.user = {}
customer.user.lastName = authenticationService.getCurrentUserLastName()
customer.user.firstName = authenticationService.getCurrentUserFirstName()
customer.user.email = authenticationService.getCurrentUserEmail()
setCustomer(customer)
}
}
-/*
- function displayMainContent() {
- if(authenticationService.isAuthenticated() && customer && !customer.id) {
- return setCustomer(newCustomer)}>
- } else if(cookies.pendingOrder ) {
- return setMainContent(WELCOME)} sale={{id: cookies.pendingOrder.sale.id}} >
- }
- switch (mainContent) {
- case WELCOME: return createOrder(sale)}>
- case ORDER_CREATION: return setMainContent(WELCOME)} sale={context} >
- case NOT_AUTHORIZED_FOR_PRODUCER: return
- }
-
- }
- */
+
function createOrder(sale: Sale) {
setContext(sale)
/*setMainContent(ORDER_CREATION)*/
diff --git a/frontend/app/src/layouts/customer/CustomerRouterFactory.tsx b/frontend/app/src/layouts/customer/CustomerRouterFactory.tsx
index 3b479d4..bc638a9 100644
--- a/frontend/app/src/layouts/customer/CustomerRouterFactory.tsx
+++ b/frontend/app/src/layouts/customer/CustomerRouterFactory.tsx
@@ -9,7 +9,7 @@ import NotAuthorizedForProducers from "../../authentication/views/NotAuthorizedF
import Welcome from "../../domains/welcome/Welcome.tsx";
export class CustomerRouterFactory {
- getRouter() {
+ getRouter(keycloakClient) {
return createBrowserRouter([
{
path: "/",
diff --git a/frontend/app/src/layouts/customer/PaymentLayout.tsx b/frontend/app/src/layouts/customer/PaymentLayout.tsx
index 5c40c19..2a40e4d 100644
--- a/frontend/app/src/layouts/customer/PaymentLayout.tsx
+++ b/frontend/app/src/layouts/customer/PaymentLayout.tsx
@@ -8,7 +8,7 @@ import { ApiBuilder } from '../../api/ApiBuilder.ts'
import { AppBar, Box, Button, CircularProgress, CssBaseline, Toolbar, Typography } from '@mui/material'
import OrderSummary from '../../domains/sale/components/OrderSummary.tsx'
-import Order from 'viandeendirect_eu/dist/model/Order.js';
+import Order from '@viandeendirect/api/dist/models/Order.js';
import { AuthenticationService } from '../../authentication/service/AuthenticationService.ts';
diff --git a/frontend/app/src/layouts/producer/AuthenticatedLayout.tsx b/frontend/app/src/layouts/producer/AuthenticatedLayout.tsx
index 6ad3dda..5fa58b1 100644
--- a/frontend/app/src/layouts/producer/AuthenticatedLayout.tsx
+++ b/frontend/app/src/layouts/producer/AuthenticatedLayout.tsx
@@ -6,7 +6,7 @@ import {AppBar, Box, CssBaseline, IconButton, Toolbar, Typography} from '@mui/ma
import {Close, Logout, Menu} from '@mui/icons-material'
-import Producer from 'viandeendirect_eu/dist/model/Producer.js';
+import Producer from '@viandeendirect/api/dist/models/Producer.js';
import SideMenu from './SideMenu.jsx'
import { AuthenticationService } from '../../authentication/service/AuthenticationService.ts';
import { ProducerService } from '../../domains/commons/service/ProducerService.ts';
diff --git a/frontend/app/src/layouts/producer/ProducerRouterFactory.tsx b/frontend/app/src/layouts/producer/ProducerRouterFactory.tsx
index 801fef8..b85781c 100644
--- a/frontend/app/src/layouts/producer/ProducerRouterFactory.tsx
+++ b/frontend/app/src/layouts/producer/ProducerRouterFactory.tsx
@@ -13,12 +13,12 @@ import BeefProductionCreator from "../../domains/production/views/beefProduction
import ProductionsList from "../../domains/production/views/ProductionsList.tsx";
import SalesList from "../../domains/sale/views/SalesList.tsx";
import SaleForm from "../../domains/sale/views/SaleForm.tsx";
-import OrdersList from "../../domains/sale/views/OrdersList.tsx";
+import OrdersList, { loadOrdersListData } from "../../domains/sale/views/OrdersList.tsx";
import OrderView from "../../domains/sale/views/OrderView.tsx";
import ProducerOrderForm from "../../domains/sale/views/ProducerOrderForm.tsx";
export class ProducerRouterFactory {
- getRouter() {
+ getRouter(keycloakClient) {
return createBrowserRouter([
{
path: "/",
@@ -54,7 +54,8 @@ export class ProducerRouterFactory {
},
{
path: '/sale/:saleId/orders',
- element:
+ element: ,
+ loader: async ({params}) => loadOrdersListData(params.saleId, keycloakClient)
},
{
path: '/sale/:saleId/order/:orderId',
diff --git a/openapi/openapi.yml b/openapi/openapi.yml
index c06a313..2b35d25 100644
--- a/openapi/openapi.yml
+++ b/openapi/openapi.yml
@@ -716,10 +716,6 @@ components:
honeyDescription:
description: "type of honney, type of flowers nectar gathered"
type: string
- discriminator:
- propertyName: 'productionType'
- mapping:
- 'HonneyProduction': '#/components/schemas/HonneyProduction'
x-class-extra-annotation: '@jakarta.persistence.Entity @jakarta.persistence.Table(name = "honney_productions")'
OrderItem:
description: ""