From 1d0f0faf0d55214ba8c96d58ed4ee1bb96a22c37 Mon Sep 17 00:00:00 2001 From: Raed BOUAFIF Date: Wed, 12 Jun 2024 16:01:27 +0100 Subject: [PATCH 01/13] version before pull from dev final v1 --- src/app/(dashboard)/consultation-reservations/page.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/app/(dashboard)/consultation-reservations/page.jsx b/src/app/(dashboard)/consultation-reservations/page.jsx index 323eda8..64ce3ee 100644 --- a/src/app/(dashboard)/consultation-reservations/page.jsx +++ b/src/app/(dashboard)/consultation-reservations/page.jsx @@ -173,7 +173,6 @@ const Reservation = () => { setSelectedEtage(etage_id) setSelectedZone(null) setSelectedZone(null) - } } -- GitLab From c2f4f864dacadd3442c71468aea29c8a880b7c9d Mon Sep 17 00:00:00 2001 From: Baligh ZOGHLAMI Date: Tue, 18 Jun 2024 12:12:22 +0100 Subject: [PATCH 02/13] user enhancement --- package-lock.json | 328 ++++++++++++++++++-- package.json | 3 +- src/app/(dashboard)/privilege/page.jsx | 32 -- src/app/(dashboard)/role/CreateRoleForm.jsx | 2 +- src/app/(dashboard)/role/UpdateRoleForm.jsx | 2 +- src/app/(dashboard)/user/CreateUserForm.jsx | 104 +++++-- src/app/(dashboard)/user/UpdateUserForm.jsx | 102 ++++-- src/app/(dashboard)/user/UserTableRow.jsx | 2 +- src/app/(dashboard)/user/page.jsx | 6 +- src/app/lib/StringHelper.js | 1 + src/app/lib/fetchRequest.js | 14 +- 11 files changed, 450 insertions(+), 146 deletions(-) create mode 100644 src/app/lib/StringHelper.js diff --git a/package-lock.json b/package-lock.json index 617d640..583ab6c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,8 @@ "js-cookie": "^3.0.5", "next": "14.2.3", "react": "^18", - "react-dom": "^18" + "react-dom": "^18", + "react-select": "^5.8.0" }, "devDependencies": { "@svgr/webpack": "^8.1.0", @@ -51,7 +52,6 @@ "version": "7.24.2", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.2.tgz", "integrity": "sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ==", - "dev": true, "dependencies": { "@babel/highlight": "^7.24.2", "picocolors": "^1.0.0" @@ -317,7 +317,6 @@ "version": "7.24.3", "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.24.3.tgz", "integrity": "sha512-viKb0F9f2s0BCS22QSF308z/+1YWKV/76mwt61NBzS5izMzDPwdq1pTrzf+Li3npBWX9KdQbkeCt1jSAM7lZqg==", - "dev": true, "dependencies": { "@babel/types": "^7.24.0" }, @@ -439,7 +438,6 @@ "version": "7.24.1", "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.1.tgz", "integrity": "sha512-2ofRCjnnA9y+wk8b9IAREroeUP02KHp431N2mhKniy2yKIDKpbrHv9eXwm8cBeWQYcJmzv5qKCu65P47eCF7CQ==", - "dev": true, "engines": { "node": ">=6.9.0" } @@ -448,7 +446,6 @@ "version": "7.24.5", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.5.tgz", "integrity": "sha512-3q93SSKX2TWCG30M2G2kwaKeTYgEUp5Snjuj8qm729SObL6nbtUldAi37qbxkD5gg3xnBio+f9nqpSepGZMvxA==", - "dev": true, "engines": { "node": ">=6.9.0" } @@ -494,7 +491,6 @@ "version": "7.24.5", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.5.tgz", "integrity": "sha512-8lLmua6AVh/8SLJRRVD6V8p73Hir9w5mJrhE+IPpILG31KKlI9iz5zmBYKcWPS59qSfgP9RaSBQSHHE81WKuEw==", - "dev": true, "dependencies": { "@babel/helper-validator-identifier": "^7.24.5", "chalk": "^2.4.2", @@ -509,7 +505,6 @@ "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, "dependencies": { "color-convert": "^1.9.0" }, @@ -521,7 +516,6 @@ "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", @@ -535,7 +529,6 @@ "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, "dependencies": { "color-name": "1.1.3" } @@ -543,14 +536,12 @@ "node_modules/@babel/highlight/node_modules/color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" }, "node_modules/@babel/highlight/node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, "engines": { "node": ">=0.8.0" } @@ -559,7 +550,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, "engines": { "node": ">=4" } @@ -568,7 +558,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, "dependencies": { "has-flag": "^3.0.0" }, @@ -1974,7 +1963,6 @@ "version": "7.24.5", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.5.tgz", "integrity": "sha512-Nms86NXrsaeU9vbBJKni6gXiEXZ4CVpYVzEjDH9Sb8vmZ3UljyA1GSOJl/6LGPO8EHLuSF9H+IxNXHPX8QHJ4g==", - "dev": true, "dependencies": { "regenerator-runtime": "^0.14.0" }, @@ -2030,7 +2018,6 @@ "version": "7.24.5", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.5.tgz", "integrity": "sha512-6mQNsaLeXTw0nxYUYu+NSa4Hx4BlF1x1x8/PMFbiR+GBSr+2DkECc69b8hgy2frEodNcvPffeH8YfWd3LI6jhQ==", - "dev": true, "dependencies": { "@babel/helper-string-parser": "^7.24.1", "@babel/helper-validator-identifier": "^7.24.5", @@ -2040,6 +2027,114 @@ "node": ">=6.9.0" } }, + "node_modules/@emotion/babel-plugin": { + "version": "11.11.0", + "resolved": "https://registry.npmjs.org/@emotion/babel-plugin/-/babel-plugin-11.11.0.tgz", + "integrity": "sha512-m4HEDZleaaCH+XgDDsPF15Ht6wTLsgDTeR3WYj9Q/k76JtWhrJjcP4+/XlG8LGT/Rol9qUfOIztXeA84ATpqPQ==", + "dependencies": { + "@babel/helper-module-imports": "^7.16.7", + "@babel/runtime": "^7.18.3", + "@emotion/hash": "^0.9.1", + "@emotion/memoize": "^0.8.1", + "@emotion/serialize": "^1.1.2", + "babel-plugin-macros": "^3.1.0", + "convert-source-map": "^1.5.0", + "escape-string-regexp": "^4.0.0", + "find-root": "^1.1.0", + "source-map": "^0.5.7", + "stylis": "4.2.0" + } + }, + "node_modules/@emotion/babel-plugin/node_modules/convert-source-map": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", + "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==" + }, + "node_modules/@emotion/cache": { + "version": "11.11.0", + "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.11.0.tgz", + "integrity": "sha512-P34z9ssTCBi3e9EI1ZsWpNHcfY1r09ZO0rZbRO2ob3ZQMnFI35jB536qoXbkdesr5EUhYi22anuEJuyxifaqAQ==", + "dependencies": { + "@emotion/memoize": "^0.8.1", + "@emotion/sheet": "^1.2.2", + "@emotion/utils": "^1.2.1", + "@emotion/weak-memoize": "^0.3.1", + "stylis": "4.2.0" + } + }, + "node_modules/@emotion/hash": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.9.1.tgz", + "integrity": "sha512-gJB6HLm5rYwSLI6PQa+X1t5CFGrv1J1TWG+sOyMCeKz2ojaj6Fnl/rZEspogG+cvqbt4AE/2eIyD2QfLKTBNlQ==" + }, + "node_modules/@emotion/memoize": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.8.1.tgz", + "integrity": "sha512-W2P2c/VRW1/1tLox0mVUalvnWXxavmv/Oum2aPsRcoDJuob75FC3Y8FbpfLwUegRcxINtGUMPq0tFCvYNTBXNA==" + }, + "node_modules/@emotion/react": { + "version": "11.11.4", + "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.11.4.tgz", + "integrity": "sha512-t8AjMlF0gHpvvxk5mAtCqR4vmxiGHCeJBaQO6gncUSdklELOgtwjerNY2yuJNfwnc6vi16U/+uMF+afIawJ9iw==", + "dependencies": { + "@babel/runtime": "^7.18.3", + "@emotion/babel-plugin": "^11.11.0", + "@emotion/cache": "^11.11.0", + "@emotion/serialize": "^1.1.3", + "@emotion/use-insertion-effect-with-fallbacks": "^1.0.1", + "@emotion/utils": "^1.2.1", + "@emotion/weak-memoize": "^0.3.1", + "hoist-non-react-statics": "^3.3.1" + }, + "peerDependencies": { + "react": ">=16.8.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@emotion/serialize": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.1.4.tgz", + "integrity": "sha512-RIN04MBT8g+FnDwgvIUi8czvr1LU1alUMI05LekWB5DGyTm8cCBMCRpq3GqaiyEDRptEXOyXnvZ58GZYu4kBxQ==", + "dependencies": { + "@emotion/hash": "^0.9.1", + "@emotion/memoize": "^0.8.1", + "@emotion/unitless": "^0.8.1", + "@emotion/utils": "^1.2.1", + "csstype": "^3.0.2" + } + }, + "node_modules/@emotion/sheet": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.2.2.tgz", + "integrity": "sha512-0QBtGvaqtWi+nx6doRwDdBIzhNdZrXUppvTM4dtZZWEGTXL/XE/yJxLMGlDT1Gt+UHH5IX1n+jkXyytE/av7OA==" + }, + "node_modules/@emotion/unitless": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.8.1.tgz", + "integrity": "sha512-KOEGMu6dmJZtpadb476IsZBclKvILjopjUii3V+7MnXIQCYh8W3NgNcgwo21n9LXZX6EDIKvqfjYxXebDwxKmQ==" + }, + "node_modules/@emotion/use-insertion-effect-with-fallbacks": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@emotion/use-insertion-effect-with-fallbacks/-/use-insertion-effect-with-fallbacks-1.0.1.tgz", + "integrity": "sha512-jT/qyKZ9rzLErtrjGgdkMBn2OP8wl0G3sQlBb3YPryvKHsjvINUhVaPFfP+fpBcOkmrVOVEEHQFJ7nbj2TH2gw==", + "peerDependencies": { + "react": ">=16.8.0" + } + }, + "node_modules/@emotion/utils": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.2.1.tgz", + "integrity": "sha512-Y2tGf3I+XVnajdItskUCn6LX+VUDmP6lTL4fcqsXAv43dnlbZiuW4MWQW38rW/BVWSE7Q/7+XQocmpnRYILUmg==" + }, + "node_modules/@emotion/weak-memoize": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.3.1.tgz", + "integrity": "sha512-EsBwpc7hBUJWAsNPBmJy4hxWx12v6bshQsldrVmjxJoc3isbxhOrF2IcCpaXxfvq03NwkI7sbsOLXbYuqF/8Ww==" + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -2096,6 +2191,28 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/@floating-ui/core": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.6.2.tgz", + "integrity": "sha512-+2XpQV9LLZeanU4ZevzRnGFg2neDeKHgFLjP6YLW+tly0IvrhqT4u8enLGjLH3qeh85g19xY5rsAusfwTdn5lg==", + "dependencies": { + "@floating-ui/utils": "^0.2.0" + } + }, + "node_modules/@floating-ui/dom": { + "version": "1.6.5", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.6.5.tgz", + "integrity": "sha512-Nsdud2X65Dz+1RHjAIP0t8z5e2ff/IRbei6BqFrl1urT8sDVzM1HMQ+R0XcU5ceRfyO3I6ayeqIfh+6Wb8LGTw==", + "dependencies": { + "@floating-ui/core": "^1.0.0", + "@floating-ui/utils": "^0.2.0" + } + }, + "node_modules/@floating-ui/utils": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.2.tgz", + "integrity": "sha512-J4yDIIthosAsRZ5CPYP/jQvUAQtlZTTD/4suA08/FEnlxqW3sKS9iAhgsa9VYLZ6vDHn/ixJgIqRQPotoBjxIw==" + }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.14", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", @@ -2703,6 +2820,33 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, + "node_modules/@types/parse-json": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz", + "integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==" + }, + "node_modules/@types/prop-types": { + "version": "15.7.12", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.12.tgz", + "integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==" + }, + "node_modules/@types/react": { + "version": "18.3.3", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.3.tgz", + "integrity": "sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw==", + "dependencies": { + "@types/prop-types": "*", + "csstype": "^3.0.2" + } + }, + "node_modules/@types/react-transition-group": { + "version": "4.4.10", + "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.10.tgz", + "integrity": "sha512-hT/+s0VQs2ojCX823m60m5f0sL5idt9SO6Tj6Dg+rdphGPIeJbJ6CxvBYkgkGKrYeDjvIpKTR38UzmtHJOGW3Q==", + "dependencies": { + "@types/react": "*" + } + }, "node_modules/@typescript-eslint/parser": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.2.0.tgz", @@ -3139,6 +3283,43 @@ "dequal": "^2.0.3" } }, + "node_modules/babel-plugin-macros": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz", + "integrity": "sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==", + "dependencies": { + "@babel/runtime": "^7.12.5", + "cosmiconfig": "^7.0.0", + "resolve": "^1.19.0" + }, + "engines": { + "node": ">=10", + "npm": ">=6" + } + }, + "node_modules/babel-plugin-macros/node_modules/cosmiconfig": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", + "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", + "dependencies": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/babel-plugin-macros/node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "engines": { + "node": ">= 6" + } + }, "node_modules/babel-plugin-polyfill-corejs2": { "version": "0.4.11", "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.11.tgz", @@ -3296,7 +3477,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true, "engines": { "node": ">=6" } @@ -3568,6 +3748,11 @@ "integrity": "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==", "dev": true }, + "node_modules/csstype": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", + "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==" + }, "node_modules/damerau-levenshtein": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz", @@ -3734,6 +3919,15 @@ "node": ">=6.0.0" } }, + "node_modules/dom-helpers": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz", + "integrity": "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==", + "dependencies": { + "@babel/runtime": "^7.8.7", + "csstype": "^3.0.2" + } + }, "node_modules/dom-serializer": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", @@ -3844,7 +4038,6 @@ "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, "dependencies": { "is-arrayish": "^0.2.1" } @@ -4020,7 +4213,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true, "engines": { "node": ">=10" }, @@ -4515,6 +4707,11 @@ "node": ">=8" } }, + "node_modules/find-root": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz", + "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==" + }, "node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", @@ -4894,6 +5091,14 @@ "node": ">= 0.4" } }, + "node_modules/hoist-non-react-statics": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", + "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==", + "dependencies": { + "react-is": "^16.7.0" + } + }, "node_modules/ignore": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", @@ -4907,7 +5112,6 @@ "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "dev": true, "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" @@ -4977,8 +5181,7 @@ "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", - "dev": true + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==" }, "node_modules/is-async-function": { "version": "2.0.0", @@ -5428,8 +5631,7 @@ "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" }, "node_modules/json-schema-traverse": { "version": "0.4.1", @@ -5584,6 +5786,11 @@ "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==", "dev": true }, + "node_modules/memoize-one": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-6.0.0.tgz", + "integrity": "sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw==" + }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -5976,7 +6183,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, "dependencies": { "callsites": "^3.0.0" }, @@ -5988,7 +6194,6 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", - "dev": true, "dependencies": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", @@ -6052,7 +6257,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true, "engines": { "node": ">=8" } @@ -6252,7 +6456,6 @@ "version": "15.8.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", - "dev": true, "dependencies": { "loose-envify": "^1.4.0", "object-assign": "^4.1.1", @@ -6313,8 +6516,42 @@ "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", - "dev": true + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" + }, + "node_modules/react-select": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/react-select/-/react-select-5.8.0.tgz", + "integrity": "sha512-TfjLDo58XrhP6VG5M/Mi56Us0Yt8X7xD6cDybC7yoRMUNm7BGO7qk8J0TLQOua/prb8vUOtsfnXZwfm30HGsAA==", + "dependencies": { + "@babel/runtime": "^7.12.0", + "@emotion/cache": "^11.4.0", + "@emotion/react": "^11.8.1", + "@floating-ui/dom": "^1.0.1", + "@types/react-transition-group": "^4.4.0", + "memoize-one": "^6.0.0", + "prop-types": "^15.6.0", + "react-transition-group": "^4.3.0", + "use-isomorphic-layout-effect": "^1.1.2" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" + } + }, + "node_modules/react-transition-group": { + "version": "4.4.5", + "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz", + "integrity": "sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g==", + "dependencies": { + "@babel/runtime": "^7.5.5", + "dom-helpers": "^5.0.1", + "loose-envify": "^1.4.0", + "prop-types": "^15.6.2" + }, + "peerDependencies": { + "react": ">=16.6.0", + "react-dom": ">=16.6.0" + } }, "node_modules/read-cache": { "version": "1.0.0", @@ -6377,8 +6614,7 @@ "node_modules/regenerator-runtime": { "version": "0.14.1", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", - "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", - "dev": true + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" }, "node_modules/regenerator-transform": { "version": "0.15.2", @@ -6465,7 +6701,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true, "engines": { "node": ">=4" } @@ -6699,6 +6934,14 @@ "tslib": "^2.0.3" } }, + "node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/source-map-js": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", @@ -6916,6 +7159,11 @@ } } }, + "node_modules/stylis": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.2.0.tgz", + "integrity": "sha512-Orov6g6BB1sDfYgzWfTHDOxamtX1bE/zo104Dh9e6fqJ3PooipYyfJ0pUmrZO2wAvO8YbEyeFrkV91XTsGMSrw==" + }, "node_modules/sucrase": { "version": "3.35.0", "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.0.tgz", @@ -7074,7 +7322,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", - "dev": true, "engines": { "node": ">=4" } @@ -7329,6 +7576,19 @@ "punycode": "^2.1.0" } }, + "node_modules/use-isomorphic-layout-effect": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/use-isomorphic-layout-effect/-/use-isomorphic-layout-effect-1.1.2.tgz", + "integrity": "sha512-49L8yCO3iGT/ZF9QttjwLF/ZD9Iwto5LnH5LmEdk/6cFmXddqi2ulF0edxTwjj+7mqvpVVGQWvbXZdn32wRSHA==", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/package.json b/package.json index b38ca7e..7cf3ab1 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "js-cookie": "^3.0.5", "next": "14.2.3", "react": "^18", - "react-dom": "^18" + "react-dom": "^18", + "react-select": "^5.8.0" }, "devDependencies": { "@svgr/webpack": "^8.1.0", diff --git a/src/app/(dashboard)/privilege/page.jsx b/src/app/(dashboard)/privilege/page.jsx index 86fc118..3cea73f 100644 --- a/src/app/(dashboard)/privilege/page.jsx +++ b/src/app/(dashboard)/privilege/page.jsx @@ -41,38 +41,6 @@ const Privilege = () => { {privileges.map((element) => { return })} - {privileges.map((element) => { - return - })} - {privileges.map((element) => { - return - })} - {privileges.map((element) => { - return - })} - {privileges.map((element) => { - return - })} - {privileges.map((element) => { - return - })} - {privileges.map((element) => { - return - })} - - {privileges.map((element) => { - return - })} - {privileges.map((element) => { - return - })} - {privileges.map((element) => { - return - })} - {privileges.map((element) => { - return - })} - }} diff --git a/src/app/(dashboard)/role/CreateRoleForm.jsx b/src/app/(dashboard)/role/CreateRoleForm.jsx index 223840e..3ba4a85 100644 --- a/src/app/(dashboard)/role/CreateRoleForm.jsx +++ b/src/app/(dashboard)/role/CreateRoleForm.jsx @@ -135,7 +135,7 @@ const CreateRoleForm = ({ appendRole, setIsOpen }) => { {!isLoading && "Créer" || } - :
} + :
} ) diff --git a/src/app/(dashboard)/role/UpdateRoleForm.jsx b/src/app/(dashboard)/role/UpdateRoleForm.jsx index 685b2ed..4b35ead 100644 --- a/src/app/(dashboard)/role/UpdateRoleForm.jsx +++ b/src/app/(dashboard)/role/UpdateRoleForm.jsx @@ -134,7 +134,7 @@ const UpdateRoleForm = ({ setRoleToUpdate, setRoles, roles, privileges: rolePriv {!loadingStatus && "Modifier" || } - :
} + :
} ) diff --git a/src/app/(dashboard)/user/CreateUserForm.jsx b/src/app/(dashboard)/user/CreateUserForm.jsx index 90b1799..bb631dd 100644 --- a/src/app/(dashboard)/user/CreateUserForm.jsx +++ b/src/app/(dashboard)/user/CreateUserForm.jsx @@ -4,8 +4,8 @@ import fetchRequest from '../../lib/fetchRequest' import { useNotification } from '@/context/NotificationContext' import CancelIcon from "@/static/image/svg/cancel.svg" import { EMAIL_REGEX } from '../../lib/constants' - - +import { removeWhiteSpace } from '@/app/lib/StringHelper' +import Select from "react-select"; function generateRandomPassword() { @@ -71,13 +71,19 @@ const CreateUserForm = ({ setIsOpen, appendUser }) => { getRoles() getProjects() }, []) + + const [errors, setErrors] = useState({ first_name: "", last_name: "", email: "", role: "" }) + const [userData, setUserData] = useState({ email: "", password: generateRandomPassword(), first_name: "", last_name: "" }) const handleFieldChange = (event) => { setUserData({ ...userData, [event.target.name]: event.target.value }) setErrors({ ...errors, [event.target.name]: "" }) } - const [errors, setErrors] = useState({ first_name: "", last_name: "", email: "", role: "" }) - const [userData, setUserData] = useState({ email: "", password: generateRandomPassword(), first_name: "", last_name: "" }) - + useEffect(() => { + setUserData({ + ...userData, email: (userData.last_name || userData.first_name) ? removeWhiteSpace(userData.first_name + "." + userData.last_name + "@teamwillgroup.com") : "" + }) + setErrors({ ...errors, email: "" }) + }, [userData.first_name, userData.last_name]) const isValidFields = () => { const localErrors = { first_name: "", last_name: "", email: "", role: "" } if (userData.first_name === "") localErrors.first_name = "Le prénom doit être spécifier." @@ -147,10 +153,8 @@ const CreateUserForm = ({ setIsOpen, appendUser }) => { setSelectedRole(event.target.value) else setSelectedRole(null) } - const handleProjectChange = (event) => { - if (event.target.value) - setSelectedProject([event.target.value]) - else setSelectedProject([]) + const handleProjectChange = (selectedOptions) => { + setSelectedProject(selectedOptions.map((element) => element.value)) } return (
@@ -171,19 +175,72 @@ const CreateUserForm = ({ setIsOpen, appendUser }) => {
- - + +

{errors.email}

- + +
+
+
+ +
+
+ {projects.length !== 0 ? +
+ @@ -201,27 +258,6 @@ const CreateUserForm = ({ setIsOpen, appendUser }) => {
}
-
-
- -
-
- {projects.length !== 0 ? -
- -
- :
-

Pas encore des projets

-
} -
-
return ( ); }; diff --git a/src/app/ui/SideBar.jsx b/src/app/ui/SideBar.jsx index ea86517..6c3d331 100644 --- a/src/app/ui/SideBar.jsx +++ b/src/app/ui/SideBar.jsx @@ -65,85 +65,83 @@ const SideBar = () => { link: "/assign_zone_project" , icon: }, - { + { label: "Consulter les réservations", link: "/consultation-reservations" , icon: }, ] return ( -
- +
    + {AdminLinks.map((element, index) => { + return + })} +
+ + +
  • + +
  • +
    ); } diff --git a/src/app/ui/SideBarLink.jsx b/src/app/ui/SideBarLink.jsx index 33595a7..ca8d176 100644 --- a/src/app/ui/SideBarLink.jsx +++ b/src/app/ui/SideBarLink.jsx @@ -4,17 +4,26 @@ import { usePathname } from 'next/navigation' import React from 'react' const SideBarLink = ({ link, label }) => { const pathname = usePathname() - if (pathname && pathname.includes(link)) + const hideSideBar = () => { + const target = document.querySelector(".burger") + const sideBar = document.getElementById("sideBar") + if (target && sideBar) { + target.classList.replace("active", "notActive") + sideBar.classList.replace("active", "notActive") + } + console.log(target, sideBar); + } + if (pathname && pathname === link) return ( -
    +
    - {label} + {label} -
    +
    ) - return
    + return
    - {label} + {label}
    } -- GitLab From 56043bce5040c199be869394f26d22779cdb8849 Mon Sep 17 00:00:00 2001 From: Baligh ZOGHLAMI Date: Tue, 18 Jun 2024 14:34:05 +0100 Subject: [PATCH 04/13] reservation UI dropdown autoselected in the current date --- src/app/(dashboard)/reservation/ZoneUI.jsx | 2 +- src/app/(dashboard)/reservation/page.jsx | 23 +++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/app/(dashboard)/reservation/ZoneUI.jsx b/src/app/(dashboard)/reservation/ZoneUI.jsx index 48ae7d1..4228c50 100644 --- a/src/app/(dashboard)/reservation/ZoneUI.jsx +++ b/src/app/(dashboard)/reservation/ZoneUI.jsx @@ -4,7 +4,7 @@ import TableUI from './TableUI' const ZoneUI = ({ id, tables, nom }) => { return (
    -

    {nom}

    +

    Zone {nom}

    {tables.map((table) => { return diff --git a/src/app/(dashboard)/reservation/page.jsx b/src/app/(dashboard)/reservation/page.jsx index e899e40..e4ba0d5 100644 --- a/src/app/(dashboard)/reservation/page.jsx +++ b/src/app/(dashboard)/reservation/page.jsx @@ -1,6 +1,6 @@ 'use client' -import React, { useEffect, useState, useMemo } from 'react' +import React, { useEffect, useState, useMemo, useRef } from 'react' import ZoneUI from './ZoneUI' import fetchRequest from '@/app/lib/fetchRequest' import Loader from '@/components/Loader/Loader' @@ -232,8 +232,7 @@ const Reservation = () => { const handleChangeDate = (event) => { if (event.target.value) { const dateSelected = JSON.parse(event.target.value); - console.log("weekMonthly", dateSelected.weekMonthly); - console.log("day", dateSelected.day); + setDate({ day: dateSelected.day, week: dateSelected.weekMonthly, date: dateSelected.date }) } else { @@ -247,6 +246,13 @@ const Reservation = () => { const allPlaces = projectsData?.map((project) => project.zones.map((zone) => zone.places.map((place) => ({ ...place, project_name: project.project_name, project_id: project.project_id })))).flat(2) || [] const hasPlace = bookedPlaces?.find((p) => p.id_user === authenticatedUserData?.sessionData?.user_id) + const dateRef = useRef(null) + useEffect(() => { + if (dateRef.current && currentDateData?.date) { + dateRef.current.value = JSON.stringify(currentDateData) + setDate({ day: currentDateData.day, week: currentDateData.weekMonthly, date: currentDateData.date }) + } + }, [dateRef.current, currentDateData?.date]) if (isLoadingSelectsData) return
    @@ -262,14 +268,13 @@ const Reservation = () => { return (
    - {filteredDatesData.map((date, index) => ( ))} - + }
    @@ -311,11 +316,11 @@ const Reservation = () => { })} {floors.filter((element) => concernedFloors.includes(element.id)).length === 0 &&
    -

    Un exemple d'un message à l'utilisateur

    +

    Vous êtes en télétravail aujourd'hui.

    } -
    - + + :
    -- GitLab From 78d088c36953bbb2f430a4dd2e8c44770d4f26d3 Mon Sep 17 00:00:00 2001 From: Baligh ZOGHLAMI Date: Tue, 18 Jun 2024 15:03:09 +0100 Subject: [PATCH 05/13] fix reservation UI --- src/app/(dashboard)/reservation/TableUI.jsx | 2 +- src/app/(dashboard)/reservation/ZoneUI.jsx | 6 +++--- src/app/(dashboard)/reservation/page.jsx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/(dashboard)/reservation/TableUI.jsx b/src/app/(dashboard)/reservation/TableUI.jsx index 8c77ad5..bf4e5e6 100644 --- a/src/app/(dashboard)/reservation/TableUI.jsx +++ b/src/app/(dashboard)/reservation/TableUI.jsx @@ -1,7 +1,7 @@ import React from 'react' import PlaceUI from './PlaceUI'; -const TableUI = ({ id, numero, places }) => { +const TableUI = ({ places }) => { function groupConsecutive(arr) { arr = arr.sort((a, b) => a.id - b.id) diff --git a/src/app/(dashboard)/reservation/ZoneUI.jsx b/src/app/(dashboard)/reservation/ZoneUI.jsx index 4228c50..42538fd 100644 --- a/src/app/(dashboard)/reservation/ZoneUI.jsx +++ b/src/app/(dashboard)/reservation/ZoneUI.jsx @@ -3,9 +3,9 @@ import TableUI from './TableUI' const ZoneUI = ({ id, tables, nom }) => { return ( -
    -

    Zone {nom}

    -
    +
    +

    Zone {nom}

    +
    {tables.map((table) => { return })} diff --git a/src/app/(dashboard)/reservation/page.jsx b/src/app/(dashboard)/reservation/page.jsx index e4ba0d5..2ab35c3 100644 --- a/src/app/(dashboard)/reservation/page.jsx +++ b/src/app/(dashboard)/reservation/page.jsx @@ -42,7 +42,7 @@ const Reservation = () => { const processUserLocation = () => { const companyLatitude = 36.8402141; // Example: Company's latitude const companyLongitude = 10.2432573; // Example: Company's longitude - const allowedRadius = 400; // Example: Radius in meters + const allowedRadius = 300; // Example: Radius in meters function getDistanceFromLatLonInMeters(lat1, lon1, lat2, lon2) { -- GitLab From fac775df8cc72d9a8b42be27fbad4f521f972a4b Mon Sep 17 00:00:00 2001 From: Baligh ZOGHLAMI Date: Tue, 18 Jun 2024 15:12:55 +0100 Subject: [PATCH 06/13] fix presence button conditions --- src/app/(dashboard)/reservation/PlaceUI.jsx | 1 - src/app/(dashboard)/reservation/page.jsx | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/app/(dashboard)/reservation/PlaceUI.jsx b/src/app/(dashboard)/reservation/PlaceUI.jsx index 976bc4b..43d2f8f 100644 --- a/src/app/(dashboard)/reservation/PlaceUI.jsx +++ b/src/app/(dashboard)/reservation/PlaceUI.jsx @@ -12,7 +12,6 @@ const PlaceUI = ({ id }) => { const place = allPlaces?.find((place) => place.id === id) const bookedPlace = bookedPlaces?.find((bookedPlace) => bookedPlace.id_place === id) - console.log(hasPlace); const handleBooking = (event) => { event.stopPropagation() if (hasPlace && hasPlace.presence) return; diff --git a/src/app/(dashboard)/reservation/page.jsx b/src/app/(dashboard)/reservation/page.jsx index 2ab35c3..a10267f 100644 --- a/src/app/(dashboard)/reservation/page.jsx +++ b/src/app/(dashboard)/reservation/page.jsx @@ -271,7 +271,7 @@ const Reservation = () => { {(filteredDatesData && filteredDatesData.length) && } @@ -302,7 +302,7 @@ const Reservation = () => { ? <> - {(floors.filter((element) => concernedFloors.includes(element.id))?.length > 0 && hasPlace && currentDate && currentDate === date?.date) &&
    + {(floors.filter((element) => concernedFloors.includes(element.id))?.length > 0 && hasPlace && !hasPlace.presence && currentDate && currentDate === date?.date) &&
    }
    -- GitLab From cefe157de7520ebfaaa4a42406805a3de2f924df Mon Sep 17 00:00:00 2001 From: Baligh ZOGHLAMI Date: Tue, 18 Jun 2024 15:46:44 +0100 Subject: [PATCH 07/13] add loader ,optimize reload and fix login submit function --- src/app/auth/login/page.jsx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/app/auth/login/page.jsx b/src/app/auth/login/page.jsx index 1bacbee..2bdb9a0 100644 --- a/src/app/auth/login/page.jsx +++ b/src/app/auth/login/page.jsx @@ -4,11 +4,15 @@ import { useState } from 'react'; import Link from 'next/link'; import Cookies from 'js-cookie'; import { createSession } from "@/app/lib/session"; +import { useRouter } from 'next/navigation' +import Loader from '@/components/Loader/Loader'; const LoginPage = () => { const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); const [messages, setMessages] = useState(''); + const [isLoading, setIsLoading] = useState(false) + const router = useRouter(); const handleSubmit = (event) => { event.preventDefault(); @@ -21,6 +25,7 @@ const LoginPage = () => { const login = async (event) => { event.preventDefault(); try { + setIsLoading(true) const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/login/`, { method: 'POST', headers: { @@ -29,11 +34,13 @@ const LoginPage = () => { body: JSON.stringify({ username, password }), }); const data = await response.json(); - if (data.non_field_errors) { - setMessages(data.non_field_errors[0]); + console.log(data) + setIsLoading(false) + if (data.detail?.non_field_errors) { + setMessages("Email ou mot de passe incorrect. Veuillez réessayer."); } else { await createSession(data); - window.location.href = '/reservation'; + router.push('/'); } } catch (error) { setMessages('An error occurred'); @@ -83,10 +90,11 @@ const LoginPage = () => {

    )}
    -- GitLab From 989db0a8d406e5f9c42393f684a370f6e2e8c6c5 Mon Sep 17 00:00:00 2001 From: Baligh ZOGHLAMI Date: Tue, 18 Jun 2024 16:10:32 +0100 Subject: [PATCH 08/13] fix loader in reservation UI --- src/app/(dashboard)/reservation/page.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/(dashboard)/reservation/page.jsx b/src/app/(dashboard)/reservation/page.jsx index a10267f..e77c657 100644 --- a/src/app/(dashboard)/reservation/page.jsx +++ b/src/app/(dashboard)/reservation/page.jsx @@ -12,7 +12,7 @@ import { decrypt } from '@/app/lib/session'; export const ReservationContext = React.createContext() const Reservation = () => { - const [isLoadingData, setIsLoadingData] = useState(false) + const [isLoadingData, setIsLoadingData] = useState(true) const { toggleNotification } = useNotification() const [date, setDate] = useState({ day: null, week: null }) const [isLoadingSelectsData, setIsLoadingSelectsData] = useState(true) @@ -314,7 +314,7 @@ const Reservation = () => { })}
    })} - {floors.filter((element) => concernedFloors.includes(element.id)).length === 0 + {!isLoadingData && floors.filter((element) => concernedFloors.includes(element.id)).length === 0 &&

    Vous êtes en télétravail aujourd'hui.

    } -- GitLab From 9382d0070c30c11b31b30929d0d7f8a48219323a Mon Sep 17 00:00:00 2001 From: Raed BOUAFIF Date: Wed, 19 Jun 2024 09:51:56 +0100 Subject: [PATCH 09/13] version fixing pages place/table/zone/etage --- src/app/(dashboard)/place/CreateNewPlace.jsx | 108 ------- src/app/(dashboard)/place/RowPlace.jsx | 13 +- src/app/(dashboard)/place/page.jsx | 293 +++++++++++++++++-- 3 files changed, 273 insertions(+), 141 deletions(-) delete mode 100644 src/app/(dashboard)/place/CreateNewPlace.jsx diff --git a/src/app/(dashboard)/place/CreateNewPlace.jsx b/src/app/(dashboard)/place/CreateNewPlace.jsx deleted file mode 100644 index 0d9a017..0000000 --- a/src/app/(dashboard)/place/CreateNewPlace.jsx +++ /dev/null @@ -1,108 +0,0 @@ -"use client" -import React, { useState, useEffect, useRef } from 'react' -import fetchRequest from '../../lib/fetchRequest' -import Loader from '@/components/Loader/Loader' -import { Island_Moments } from 'next/font/google' -import { useNotification } from '@/context/NotificationContext' - - -const CreateNewPlace = ({ placesState, tables }) => { - const [error, setError] = useState(null) - const [isLoadingAction, setIsLoadingAction] = useState(false) - const [numPlace, setNumPlace] = useState(null) - const [selectedTable, setSelectedTable] = useState(null) - - const inputRef = useRef(null) - const selectRef = useRef(null) - - const { toggleNotification } = useNotification() - - - const handleSubmit = async (event) => { - event.preventDefault() - setIsLoadingAction(true) - const { data, errors, isSuccess } = await fetchRequest("/zoaning/places/", { - method: "POST", - body: JSON.stringify({ numero: numPlace, id_table: selectedTable }) - }) - if (isSuccess) { - setIsLoadingAction(false) - placesState((prevPlaceState) => [...prevPlaceState, { ...data, id_table: tables.find(table => table.id === data.id_table) }]); - inputRef.current.value = "" - selectRef.current.value = "" - setNumPlace(null) - setSelectedTable(null) - toggleNotification({ - visible: true, - message: "La table a été créer avec succès.", - type: "success" - }) - } else { - setIsLoadingAction(false) - if (errors.type === "ValidationError") { - if (errors.detail.non_field_errors) { - toggleNotification({ - type: "warning", - message: "Le numéro de la table saisie déjà existe.", - visible: true, - }) - } - } else { - toggleNotification({ - type: "error", - message: "Une erreur s'est produite lors de la création de la table.", - visible: true, - }) - } - console.log(errors) - } - } - - // Handle the name of zone change - const handleChangeZone = (event) => { - setError("") - setNumPlace(event.target.value) - } - - const handleChangeEtage = (event) => { - setError("") - setSelectedTable(event.target.value) - } - - console.log(selectedTable) - console.log(numPlace) - - - - return ( -
    -

    Ajout d'une place

    -
    -
    - - -
    -
    - - -
    -
    -

    -
    - -
    -
    - ) -} - - -export default CreateNewPlace \ No newline at end of file diff --git a/src/app/(dashboard)/place/RowPlace.jsx b/src/app/(dashboard)/place/RowPlace.jsx index 3d22e48..32ffc3f 100644 --- a/src/app/(dashboard)/place/RowPlace.jsx +++ b/src/app/(dashboard)/place/RowPlace.jsx @@ -12,7 +12,8 @@ import ConfirmationModal from "@/app/ui/ConfirmationModal"; -const RowPlace = ({ id, numero, table, placesState, tables }) => { +const RowPlace = ({ id, numero, table, placesState, tables, filteredPlacesState }) => { + console.log(table) //states const [isUpdating, setIsUpdating] = useState(false) const [numPlace, setNumPlace] = useState(numero) @@ -41,7 +42,6 @@ const RowPlace = ({ id, numero, table, placesState, tables }) => { }) setLoadingStatus(false) if (isSuccess) { - console.log(data) if (data.message === "NO_CHANGES") { toggleNotification({ visible: true, @@ -51,8 +51,8 @@ const RowPlace = ({ id, numero, table, placesState, tables }) => { setIsUpdating(false) return } - console.log(data.data) placesState((prevPlacesState) => prevPlacesState.map((element) => element.id === id ? { ...data.data, id_table: tables.find(table => table.id === data.data.id_table) } : element)) + filteredPlacesState((prevPlacesState) => prevPlacesState.map((element) => element.id === id ? { ...data.data, id_table: tables.find(table => table.id === data.data.id_table) } : element)) setIsUpdating(false) toggleNotification({ visible: true, @@ -96,13 +96,14 @@ const RowPlace = ({ id, numero, table, placesState, tables }) => { } console.log(errors) } - + } const handleDelete = async () => { const { isSuccess, errors, status } = await fetchRequest(`/zoaning/places/${id}/`, { method: "DELETE" }) if (isSuccess) { placesState((prevPlacesState) => prevPlacesState.filter((element) => element.id !== id)) + filteredPlacesState((prevPlacesState) => prevPlacesState.filter((element) => element.id !== id)) toggleNotification({ visible: true, message: "La place a été supprimée avec succès", @@ -179,12 +180,12 @@ const RowPlace = ({ id, numero, table, placesState, tables }) => { setNumPlace(event.target.value)} defaultValue={numero} type='text' className='disabled:bg-white border-0 rounded-md px-2 enabled:drop-shadow border-none enabled:bg-gray-100 duration-100 h-10 outline-none' /> - + + + {(etages && etages?.length) && + etages.map((etage, index) => ( + + )) + } + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    +

    +
    + +
    +
    -

    List des Places

    +

    Liste des Places

    @@ -91,16 +330,16 @@ const Place = () => { { handleSearchingPlace(e) }} id="simple-search" class=" text-gray-900 text-sm block w-full ps-10 p-2.5 rounded-md px-3 duration-150 delay-75 focus:ring ring-offset-1 ring-sushi-200 border h-10 border-neutral-300 outline-none " placeholder="Chercher des places..." required />
    - {isArray(places) && places?.length !== 0 && isArray(tables) && tables?.length !== 0 ? -
    - - + {isArray(filteredPlaces) && filteredPlaces?.length != 0 && isArray(tables) && tables?.length != 0 ? +
    +
    + - + - {places?.map((element) => { - return + {filteredPlaces?.map((element) => { + return })}
    PlacePlace-Zone-EtageTable-Zone-Etage Action
    -- GitLab From 936122d37d5b06df3f4bc60782b0c45823f9afaa Mon Sep 17 00:00:00 2001 From: Oussama El Benney Date: Wed, 19 Jun 2024 15:25:13 +0100 Subject: [PATCH 10/13] fixed design issues - fix language to fr --- .../consultation-reservations/PlaceUI.jsx | 6 +-- .../consultation-reservations/ZoneUI.jsx | 2 +- .../(dashboard)/planning/PlanningTable.jsx | 31 ++++++++++- src/app/(dashboard)/planning/page.jsx | 52 +++++++++++-------- .../planning/type-presence/EntityForm.jsx | 2 +- .../planning/type-presence/page.jsx | 2 +- src/app/(dashboard)/projects/ProjectForm.jsx | 6 +-- src/app/(dashboard)/projects/page.jsx | 7 ++- 8 files changed, 73 insertions(+), 35 deletions(-) diff --git a/src/app/(dashboard)/consultation-reservations/PlaceUI.jsx b/src/app/(dashboard)/consultation-reservations/PlaceUI.jsx index f60e74f..0f8bedf 100644 --- a/src/app/(dashboard)/consultation-reservations/PlaceUI.jsx +++ b/src/app/(dashboard)/consultation-reservations/PlaceUI.jsx @@ -38,11 +38,11 @@ const PlaceUI = ({ id, isTop }) => { )} {showTooltip && bookedPlace && (
    -

    First Name: {bookedPlace.first_name}

    -

    Last Name: {bookedPlace.last_name}

    +

    Nom: {bookedPlace.first_name}

    +

    Prénom: {bookedPlace.last_name}

    Role: {bookedPlace.role}

    Presence: {bookedPlace.presence}

    -

    Created At: {new Date(bookedPlace.created_at).toLocaleString()}

    +

    Crée à: {new Date(bookedPlace.created_at).toLocaleString()}

    )}
    diff --git a/src/app/(dashboard)/consultation-reservations/ZoneUI.jsx b/src/app/(dashboard)/consultation-reservations/ZoneUI.jsx index 48ae7d1..cd378c1 100644 --- a/src/app/(dashboard)/consultation-reservations/ZoneUI.jsx +++ b/src/app/(dashboard)/consultation-reservations/ZoneUI.jsx @@ -4,7 +4,7 @@ import TableUI from './TableUI' const ZoneUI = ({ id, tables, nom }) => { return (
    -

    {nom}

    +

    Zone {nom}

    {tables.map((table) => { return diff --git a/src/app/(dashboard)/planning/PlanningTable.jsx b/src/app/(dashboard)/planning/PlanningTable.jsx index 2bf1d00..34228d7 100644 --- a/src/app/(dashboard)/planning/PlanningTable.jsx +++ b/src/app/(dashboard)/planning/PlanningTable.jsx @@ -2,14 +2,41 @@ import React, {useEffect, useState} from 'react'; import fetchRequest from "@/app/lib/fetchRequest"; import {useNotification} from "@/context/NotificationContext"; -const PlanningTable = ({ data, typePresences, onTypePresenceChange }) => { +const PlanningTable = ({ data, typePresences, onTypePresenceChange, selectedProject }) => { // fetch type presence const [errors, setErrors] = useState(); const [loading, setLoading] = useState(false); const {toggleNotification} = useNotification() + const [selectedPresence, setSelectedPresence] = useState(''); + + const handleRadioChange = (e) => { + const newPresence = e.target.value; + setSelectedPresence(newPresence); + data.forEach((row, rowIndex) => { + row.days.forEach((day, dayIndex) => { + onTypePresenceChange(rowIndex, dayIndex, newPresence); + }); + }); + }; return ( -
    +
    +
    + Réglez Tout sur : + {typePresences.map((typePresence) => ( + + ))} +
    diff --git a/src/app/(dashboard)/planning/page.jsx b/src/app/(dashboard)/planning/page.jsx index b9bdd26..f6dc6d3 100644 --- a/src/app/(dashboard)/planning/page.jsx +++ b/src/app/(dashboard)/planning/page.jsx @@ -9,11 +9,11 @@ import ConfirmationModal from "@/app/ui/ConfirmationModal"; const PlanningPage = () => { const blankData = { planning_data: [ - { week: 1, days: [{}, {}, {}, {}, {}] }, - { week: 2, days: [{}, {}, {}, {}, {}] }, - { week: 3, days: [{}, {}, {}, {}, {}] }, - { week: 4, days: [{}, {}, {}, {}, {}] }, - { week: 5, days: [{}, {}, {}, {}, {}] }, + { week: 1, days: [{"id": 2, "nom": "Teletravail"}, {"id": 2, "nom": "Teletravail"}, {"id": 2, "nom": "Teletravail"}, {"id": 2, "nom": "Teletravail"}, {"id": 2, "nom": "Teletravail"}] }, + { week: 2, days: [{"id": 2, "nom": "Teletravail"}, {"id": 2, "nom": "Teletravail"}, {"id": 2, "nom": "Teletravail"}, {"id": 2, "nom": "Teletravail"}, {"id": 2, "nom": "Teletravail"}] }, + { week: 3, days: [{"id": 2, "nom": "Teletravail"}, {"id": 2, "nom": "Teletravail"}, {"id": 2, "nom": "Teletravail"}, {"id": 2, "nom": "Teletravail"}, {"id": 2, "nom": "Teletravail"}] }, + { week: 4, days: [{"id": 2, "nom": "Teletravail"}, {"id": 2, "nom": "Teletravail"}, {"id": 2, "nom": "Teletravail"}, {"id": 2, "nom": "Teletravail"}, {"id": 2, "nom": "Teletravail"}] }, + { week: 5, days: [{"id": 2, "nom": "Teletravail"}, {"id": 2, "nom": "Teletravail"}, {"id": 2, "nom": "Teletravail"}, {"id": 2, "nom": "Teletravail"}, {"id": 2, "nom": "Teletravail"}] }, ] } const [projects, setProjects] = useState([]); @@ -99,7 +99,17 @@ const PlanningPage = () => { if (!selectedProject) { toggleNotification({ visible: true, - message: 'Please select a project', + message: 'Veuillez sélectionner un projet', + type: 'error' + }); + return; + } + // verify if planing data has an empty value + const emptyValue = planningData.planning_data.some(week => week.days.some(day => day.nom === '')); + if (emptyValue) { + toggleNotification({ + visible: true, + message: 'Veuillez remplir toutes les valeurs de planification', type: 'error' }); return; @@ -115,7 +125,7 @@ const PlanningPage = () => { if (isSuccess) { toggleNotification({ visible: true, - message: 'Planning data saved successfully', + message: 'Données de planification enregistrées avec succès', type: 'success' }); fetchPlanningData() @@ -123,14 +133,12 @@ const PlanningPage = () => { setErrors(errors); toggleNotification({ visible: true, - message: 'Failed to save planning data', + message: 'Échec de lenregistrement des données de planification', type: 'error' }); } }; - - const handleUpdate = async () => { setLoading(true); const requestBody = {id_project: selectedProject, planning_data: planningData.planning_data}; @@ -142,14 +150,14 @@ const PlanningPage = () => { if (isSuccess) { toggleNotification({ visible: true, - message: 'Planning data updated successfully', + message: 'Données de planification mises à jour avec succès', type: 'success' }); } else { setErrors(errors); toggleNotification({ visible: true, - message: 'Failed to update planning data', + message: 'Échec de la mise à jour des données de planification', type: 'error' }); } @@ -166,14 +174,14 @@ const PlanningPage = () => { setPlanningData(blankData); toggleNotification({ visible: true, - message: 'Planning data deleted successfully', + message: 'Données de planification supprimées avec succès', type: 'success' }); } else { setErrors(errors); toggleNotification({ visible: true, - message: 'Failed to delete planning data', + message: 'Échec de la suppression des données de planification', type: 'error' }); } @@ -195,14 +203,14 @@ const PlanningPage = () => { onChange={handleProjectChange} className="mt-4 block w-full px-3 py-2 bg-white border border-gray-300 rounded-md" > - + {projects.map((project) => ( ))} -
    +
    + onTypePresenceChange={handleTypePresenceChange} selectedProject={selectedProject} />
    {/* crud buttons*/}
    @@ -211,22 +219,22 @@ const PlanningPage = () => { setSelectedProject(''); setPlanningData(blankData); }} - >Cancel + >Annuler {planningData.id ? <> : + >Enregistrer }
    @@ -234,7 +242,7 @@ const PlanningPage = () => { isOpen={isModalOpen} onClose={() => setModalOpen(false)} onConfirm={handleConfirmDelete} - message={`Are you sure you want to delete this planning data?`} + message={`Etes-vous sûr de vouloir supprimer ces données de planification ?`} />
    ); diff --git a/src/app/(dashboard)/planning/type-presence/EntityForm.jsx b/src/app/(dashboard)/planning/type-presence/EntityForm.jsx index 83f4dfc..408e3a4 100644 --- a/src/app/(dashboard)/planning/type-presence/EntityForm.jsx +++ b/src/app/(dashboard)/planning/type-presence/EntityForm.jsx @@ -68,7 +68,7 @@ const EntityForm = ({ entity, id, onSaved, onCancel }) => { className="px-3 py-2 bg-sushi-500 text-white rounded-md" disabled={isLoading} > - {isLoading ? 'Saving...' : id ? 'Update' : 'Create'} + {isLoading ? 'Enregistrement...' : id ? 'Mettre à jour' : 'Créer'} diff --git a/src/app/(dashboard)/planning/type-presence/page.jsx b/src/app/(dashboard)/planning/type-presence/page.jsx index 697ba16..e3902ba 100644 --- a/src/app/(dashboard)/planning/type-presence/page.jsx +++ b/src/app/(dashboard)/planning/type-presence/page.jsx @@ -39,7 +39,7 @@ const ManagePage = () => {

    Gérer Les Entités

    -

    Type Presence

    +

    Type de Presence

    +
    setSearchQuery(e.target.value)} - placeholder="Type to search users..." + placeholder="Tapez pour rechercher des utilisateurs..." className="mt-1 block w-full px-3 py-2 bg-white border border-chicago-300 rounded-md" /> {userSuggestions.length > 0 && ( @@ -179,7 +179,7 @@ const ProjectForm = ({ onAddProject, onEditProject, editingProject, setEditingPr {errors.userIds &&

    {errors.userIds}

    }
    {/* cancel*/} {editingProject && ( diff --git a/src/app/(dashboard)/projects/page.jsx b/src/app/(dashboard)/projects/page.jsx index d15db9d..230000e 100644 --- a/src/app/(dashboard)/projects/page.jsx +++ b/src/app/(dashboard)/projects/page.jsx @@ -84,6 +84,7 @@ const Projects = () => { setErrors(errors); } setLoading(false); + setIsFormOpen(false) }; const handleEditProject = async (id, updatedProject) => { @@ -167,7 +168,7 @@ const Projects = () => { className={`text-sm md:text-base p-2 ${isFormOpen ? 'bg-chicago-300' : 'bg-sushi-500'} text-white rounded-md`} onClick={toggleForm} > - {isFormOpen ? 'Cancel' : 'Add Project'} + {isFormOpen ? 'Annuler' : 'Ajouter un projet'}
    @@ -175,7 +176,7 @@ const Projects = () => { @@ -217,6 +218,8 @@ const Projects = () => { onHandlePageUrl={handlePageChange} /> + +
    -- GitLab From 759b3f173071886714ab9913192917ef6b781c07 Mon Sep 17 00:00:00 2001 From: Raed BOUAFIF Date: Wed, 19 Jun 2024 15:29:02 +0100 Subject: [PATCH 11/13] version fixed corrections place-table-zone --- src/app/(dashboard)/place/page.jsx | 29 +-- src/app/(dashboard)/table/CreateNewTable.jsx | 106 -------- src/app/(dashboard)/table/RowTable.jsx | 6 +- src/app/(dashboard)/table/page.jsx | 174 +++++++++++-- src/app/(dashboard)/zone/CreateNewZone.jsx | 108 --------- src/app/(dashboard)/zone/RowZone.jsx | 2 +- src/app/(dashboard)/zone/page.jsx | 111 ++++++++- src/static/image/svg/no-data-ill.svg | 243 +++++++++++++++++++ 8 files changed, 523 insertions(+), 256 deletions(-) delete mode 100644 src/app/(dashboard)/table/CreateNewTable.jsx delete mode 100644 src/app/(dashboard)/zone/CreateNewZone.jsx create mode 100644 src/static/image/svg/no-data-ill.svg diff --git a/src/app/(dashboard)/place/page.jsx b/src/app/(dashboard)/place/page.jsx index 5b7d4ed..68f65d6 100644 --- a/src/app/(dashboard)/place/page.jsx +++ b/src/app/(dashboard)/place/page.jsx @@ -86,6 +86,8 @@ const Place = () => { setZones(zones) } else { setTables([]) + setEtages([]) + setZones([]) } } catch (error) { console.log(error) @@ -269,7 +271,7 @@ const Place = () => { return (
    -
    +
    {!isLoadingData ? <> @@ -289,7 +291,7 @@ const Place = () => {
    - {(zones && zones?.length) && zones.map((zone, index) => ( @@ -300,7 +302,7 @@ const Place = () => {
    - {(tables && tables.length) && tables.map((table, index) => ( @@ -311,17 +313,16 @@ const Place = () => {
    - + +
    +
    +
    -
    -

    -
    -
    -
    +

    Liste des Places

    @@ -331,9 +332,9 @@ const Place = () => {
    {isArray(filteredPlaces) && filteredPlaces?.length != 0 && isArray(tables) && tables?.length != 0 ? -
    -
    - +
    +
    + diff --git a/src/app/(dashboard)/table/CreateNewTable.jsx b/src/app/(dashboard)/table/CreateNewTable.jsx deleted file mode 100644 index 50c0f90..0000000 --- a/src/app/(dashboard)/table/CreateNewTable.jsx +++ /dev/null @@ -1,106 +0,0 @@ -"use client" -import React, { useState, useEffect, useRef } from 'react' -import fetchRequest from '../../lib/fetchRequest' -import Loader from '@/components/Loader/Loader' -import { Island_Moments } from 'next/font/google' -import { useNotification } from '@/context/NotificationContext' - - -const CreateNewTable = ({ tablesState, zones }) => { - const [error, setError] = useState(null) - const [isLoadingAction, setIsLoadingAction] = useState(false) - const [numeroTable, setNumeroTable] = useState(null) - const [selectedZone, setSelectedZone] = useState(null) - - const inputRef = useRef(null) - const selectRef = useRef(null) - - const { toggleNotification } = useNotification() - - - const handleSubmit = async (event) => { - event.preventDefault() - setIsLoadingAction(true) - const { data, errors, isSuccess } = await fetchRequest("/zoaning/tables/", { - method: "POST", - body: JSON.stringify({ numero: numeroTable, id_zone: selectedZone }) - }) - if (isSuccess) { - setIsLoadingAction(false) - tablesState((prevTableState) => [...prevTableState, { ...data, id_zone: zones.find(zone => zone.id === data.id_zone) }]); - inputRef.current.value = "" - selectRef.current.value = "" - setNumeroTable(null) - setSelectedZone(null) - toggleNotification({ - visible: true, - message: "La table a été créer avec succès.", - type: "success" - }) - } else { - setIsLoadingAction(false) - if (errors.type === "ValidationError") { - if (errors.detail.non_field_errors) { - toggleNotification({ - type: "warning", - message: "Le numéro de la table saisie déjà existe.", - visible: true, - }) - } - } else { - toggleNotification({ - type: "error", - message: "Une erreur s'est produite lors de la création de la table.", - visible: true, - }) - } - console.log(errors) - } - } - - // Handle the name of zone change - const handleChangeTable = (event) => { - setError("") - setNumeroTable(event.target.value) - } - - const handleChangeZone = (event) => { - setError("") - setSelectedZone(event.target.value) - } - - - - - return ( - -

    Ajout d'une table

    -
    -
    - - -
    -
    - - -
    -
    -

    -
    - -
    - - ) -} - - -export default CreateNewTable \ No newline at end of file diff --git a/src/app/(dashboard)/table/RowTable.jsx b/src/app/(dashboard)/table/RowTable.jsx index 7e16dd2..30acd78 100644 --- a/src/app/(dashboard)/table/RowTable.jsx +++ b/src/app/(dashboard)/table/RowTable.jsx @@ -12,7 +12,7 @@ import ConfirmationModal from "@/app/ui/ConfirmationModal"; -const RowZone = ({ id, numero, zone, tablesState, zones }) => { +const RowZone = ({ id, numero, zone, tablesState, zones, filteredPlacesState }) => { //states const [isUpdating, setIsUpdating] = useState(false) @@ -52,6 +52,7 @@ const RowZone = ({ id, numero, zone, tablesState, zones }) => { return } tablesState((prevTableState) => prevTableState.map((element) => element.id === id ? { ...data.data, id_zone: zones.find(zone => zone.id === data.data.id_zone) } : element)) + filteredPlacesState((prevTableState) => prevTableState.map((element) => element.id === id ? { ...data.data, id_zone: zones.find(zone => zone.id === data.data.id_zone) } : element)) setIsUpdating(false) toggleNotification({ visible: true, @@ -102,6 +103,7 @@ const RowZone = ({ id, numero, zone, tablesState, zones }) => { const { isSuccess, errors, status } = await fetchRequest(`/zoaning/tables/${id}/`, { method: "DELETE" }) if (isSuccess) { tablesState((prevTableState) => prevTableState.filter((element) => element.id !== id)) + filteredPlacesState((prevTableState) => prevTableState.filter((element) => element.id !== id)) toggleNotification({ visible: true, message: "La table a été supprimée avec succès", @@ -178,7 +180,7 @@ const RowZone = ({ id, numero, zone, tablesState, zones }) => { - - diff --git a/src/app/(dashboard)/projects/ProjectList.jsx b/src/app/(dashboard)/projects/ProjectList.jsx index c311a3b..67721cf 100644 --- a/src/app/(dashboard)/projects/ProjectList.jsx +++ b/src/app/(dashboard)/projects/ProjectList.jsx @@ -1,5 +1,7 @@ import ConfirmationModal from "@/app/ui/ConfirmationModal"; -import { useState } from "react"; +import React, { useState } from "react"; +import EditIcon from "@/static/image/svg/edit.svg"; +import DeleteIcon from "@/static/image/svg/delete.svg"; @@ -38,15 +40,15 @@ const ProjectList = ({ projects, onEdit, onDelete, onHandlePageUrl }) => { -- GitLab
    Place Table-Zone-Etage Action
    setTableNum(event.target.value)} defaultValue={numero} type='text' className='disabled:bg-white border-0 rounded-md px-2 enabled:drop-shadow border-none enabled:bg-gray-100 duration-100 h-10 outline-none' /> + + + {(etages && etages?.length) && + etages.map((etage, index) => ( + + )) + } + + +
    + + +
    +
    + + +
    +
    + +
    + + +

    List des Tables

    @@ -77,17 +222,16 @@ const Table = () => { { handleSearchingTable(e) }} id="simple-search" class=" text-gray-900 text-sm block w-full ps-10 p-2.5 rounded-md px-3 duration-150 delay-75 focus:ring ring-offset-1 ring-sushi-200 border h-10 border-neutral-300 outline-none " placeholder="Chercher des tables..." required />
    - - {isArray(tables) && tables?.length !== 0 && isArray(zones) && zones?.length !== 0 ? -
    - + {isArray(filteredTables) && filteredTables?.length !== 0 && isArray(zones) && zones?.length !== 0 ? +
    +
    - + - {tables?.map((element) => { - return + {filteredTables?.map((element) => { + return })}
    TableZone-EtageZone-Etage Action
    diff --git a/src/app/(dashboard)/zone/CreateNewZone.jsx b/src/app/(dashboard)/zone/CreateNewZone.jsx deleted file mode 100644 index ccd197d..0000000 --- a/src/app/(dashboard)/zone/CreateNewZone.jsx +++ /dev/null @@ -1,108 +0,0 @@ -"use client" -import React, { useState, useEffect, useRef } from 'react' -import fetchRequest from '../../lib/fetchRequest' -import Loader from '@/components/Loader/Loader' -import { Island_Moments } from 'next/font/google' -import { useNotification } from '@/context/NotificationContext' - - -const CreateNewZone = ({ zoneState, etages }) => { - const [error, setError] = useState(null) - const [isLoadingAction, setIsLoadingAction] = useState(false) - const [nomZone, setNomZone] = useState(null) - const [selectedEtage, setSelectedEtage] = useState(null) - - const inputRef = useRef(null) - const selectRef = useRef(null) - - const { toggleNotification } = useNotification() - - - const handleSubmit = async (event) => { - event.preventDefault() - setIsLoadingAction(true) - const { data, errors, isSuccess } = await fetchRequest("/zoaning/zones/", { - method: "POST", - body: JSON.stringify({ nom: nomZone, id_etage: selectedEtage }) - }) - if (isSuccess) { - setIsLoadingAction(false) - zoneState((prevZoneValue) => [...prevZoneValue, { ...data, id_etage: etages.find(etage => etage.id === data.id_etage) }]); - inputRef.current.value = "" - selectRef.current.value = "" - setNomZone(null) - setSelectedEtage(null) - toggleNotification({ - visible: true, - message: "La zone a été créer avec succès.", - type: "success" - }) - } else { - setIsLoadingAction(false) - if (errors.type === "ValidationError") { - if (errors.detail.non_field_errors) { - toggleNotification({ - type: "warning", - message: "Le nom de la zone saisie déjà existe.", - visible: true, - }) - } - } else { - toggleNotification({ - type: "error", - message: "Une erreur s'est produite lors de la création de la zone.", - visible: true, - }) - } - console.log(errors) - } - } - - // Handle the name of zone change - const handleChangeZone = (event) => { - setError("") - setNomZone(event.target.value) - } - - const handleChangeEtage = (event) => { - setError("") - setSelectedEtage(event.target.value) - } - - console.log(selectedEtage) - console.log(nomZone) - - - - return ( -
    -

    Ajout d'une zone

    -
    -
    - - -
    -
    - - -
    -
    -

    -
    - -
    -
    - ) -} - - -export default CreateNewZone \ No newline at end of file diff --git a/src/app/(dashboard)/zone/RowZone.jsx b/src/app/(dashboard)/zone/RowZone.jsx index bb1be7d..eac3a4c 100644 --- a/src/app/(dashboard)/zone/RowZone.jsx +++ b/src/app/(dashboard)/zone/RowZone.jsx @@ -179,7 +179,7 @@ const RowZone = ({ id, nom, etage, zonesState, etages }) => {
    setZoneName(event.target.value)} defaultValue={nom} type='text' className='disabled:bg-white border-0 rounded-md px-2 enabled:drop-shadow border-none enabled:bg-gray-100 duration-100 h-10 outline-none' /> + + +
    + + +
    +
    + +
    + + +

    List des Zones

    {isArray(zones) && zones?.length !== 0 && isArray(etages) && etages?.length !== 0 ? -
    - +
    +
    - + - {zones?.map((element) => { + {(selectedEtage) ? + zones?.filter(zone => zone.id_etage.id == selectedEtage).map((element) => {return }) + : + zones?.map((element) => { return })}
    ZoneEtageEtage Action
    diff --git a/src/static/image/svg/no-data-ill.svg b/src/static/image/svg/no-data-ill.svg new file mode 100644 index 0000000..992a01c --- /dev/null +++ b/src/static/image/svg/no-data-ill.svg @@ -0,0 +1,243 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- GitLab From c66de95eb2790d0dae7cc6ac410777111f8a8213 Mon Sep 17 00:00:00 2001 From: Oussama El Benney Date: Wed, 19 Jun 2024 15:58:58 +0100 Subject: [PATCH 12/13] fixed consulattion des reservation --- package-lock.json | 14 ++++++------- .../consultation-reservations/ZoneUI.jsx | 8 +++---- .../consultation-reservations/page.jsx | 21 +++++++++++++------ 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index 583ab6c..4c126e3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3401,11 +3401,11 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -4697,9 +4697,9 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dependencies": { "to-regex-range": "^5.0.1" }, diff --git a/src/app/(dashboard)/consultation-reservations/ZoneUI.jsx b/src/app/(dashboard)/consultation-reservations/ZoneUI.jsx index cd378c1..3ea1b5c 100644 --- a/src/app/(dashboard)/consultation-reservations/ZoneUI.jsx +++ b/src/app/(dashboard)/consultation-reservations/ZoneUI.jsx @@ -3,10 +3,10 @@ import TableUI from './TableUI' const ZoneUI = ({ id, tables, nom }) => { return ( -
    -

    Zone {nom}

    -
    - {tables.map((table) => { +
    +

    Zone {nom}

    +
    + {tables.map((table) => { return })}
    diff --git a/src/app/(dashboard)/consultation-reservations/page.jsx b/src/app/(dashboard)/consultation-reservations/page.jsx index dad6282..8ac1cab 100644 --- a/src/app/(dashboard)/consultation-reservations/page.jsx +++ b/src/app/(dashboard)/consultation-reservations/page.jsx @@ -1,6 +1,6 @@ 'use client' -import React, { useEffect, useState } from 'react' +import React, { useEffect, useState, useRef } from 'react' import ZoneUI from './ZoneUI' import fetchRequest from '@/app/lib/fetchRequest' import Loader from '@/components/Loader/Loader' @@ -187,6 +187,16 @@ const Reservation = () => { const concernedZones = projectsData?.map((element) => element.zones.map((zone) => zone.id)).flatMap((element) => element) || [] const concernedFloors = floors?.filter((element) => element.zones.map((zone) => zone.id).some((element) => concernedZones.includes(element))).map(element => element.id) || [] const allPlaces = projectsData?.map((project) => project.zones.map((zone) => zone.places.map((place) => ({ ...place, project_name: project.project_name, project_id: project.project_id })))).flat(2) || [] + + const dateRef = useRef(null) + useEffect(() => { + if (dateRef.current && currentDateData?.date) { + dateRef.current.value = JSON.stringify(currentDateData) + setDate({ day: currentDateData.day, week: currentDateData.weekMonthly, date: currentDateData.date }) + } + }, [dateRef.current, currentDateData?.date]) + + if (isLoadingSelectsData) return
    @@ -203,14 +213,13 @@ const Reservation = () => { return (
    - {filteredDatesData?.map((date, index) => ( ))} - + }