Compare commits
4 Commits
develop
...
feature/da
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
750fc19d46 | ||
|
|
2796c46625 | ||
|
|
01848b3920 | ||
|
|
a7e099b9db |
29
package-lock.json
generated
29
package-lock.json
generated
@@ -500,7 +500,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@angular/common/-/common-20.3.11.tgz",
|
"resolved": "https://registry.npmjs.org/@angular/common/-/common-20.3.11.tgz",
|
||||||
"integrity": "sha512-zQ8xlyUBS+UDAUKk7z/hhWdTtQU2oc/Dwo7jXpyrYlz9y2X1A6sAZpUigdYpbrBkIaNs3MplJevgMiCm3kmN8g==",
|
"integrity": "sha512-zQ8xlyUBS+UDAUKk7z/hhWdTtQU2oc/Dwo7jXpyrYlz9y2X1A6sAZpUigdYpbrBkIaNs3MplJevgMiCm3kmN8g==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.3.0"
|
"tslib": "^2.3.0"
|
||||||
},
|
},
|
||||||
@@ -517,7 +516,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-20.3.11.tgz",
|
"resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-20.3.11.tgz",
|
||||||
"integrity": "sha512-3O0iMPttD8a4QQQrjVfIjboiZZ17ErkZuqK8BXJBTn2rplpkq1m3kVhgsmzN2OANRR05GF9Ed1dTf8ycTrO1yg==",
|
"integrity": "sha512-3O0iMPttD8a4QQQrjVfIjboiZZ17ErkZuqK8BXJBTn2rplpkq1m3kVhgsmzN2OANRR05GF9Ed1dTf8ycTrO1yg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.3.0"
|
"tslib": "^2.3.0"
|
||||||
},
|
},
|
||||||
@@ -531,7 +529,6 @@
|
|||||||
"integrity": "sha512-u6T8kxj7LzK3btEln6Vd8y7p+O1eNXrLiGwqPuRF/QoyjBrRkTYufZ1I4TvzUxdd0ot6mPDRfdmiD15q//Y+oQ==",
|
"integrity": "sha512-u6T8kxj7LzK3btEln6Vd8y7p+O1eNXrLiGwqPuRF/QoyjBrRkTYufZ1I4TvzUxdd0ot6mPDRfdmiD15q//Y+oQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/core": "7.28.3",
|
"@babel/core": "7.28.3",
|
||||||
"@jridgewell/sourcemap-codec": "^1.4.14",
|
"@jridgewell/sourcemap-codec": "^1.4.14",
|
||||||
@@ -564,7 +561,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@angular/core/-/core-20.3.11.tgz",
|
"resolved": "https://registry.npmjs.org/@angular/core/-/core-20.3.11.tgz",
|
||||||
"integrity": "sha512-tOXlxG0SI9Yy1b/ntGyBahfffDpFg7vAbAt+9riOb5ZZ8GYyyOzg78Lqa/lrdBVEG0PXdDjEa0MV93qCyqwYlg==",
|
"integrity": "sha512-tOXlxG0SI9Yy1b/ntGyBahfffDpFg7vAbAt+9riOb5ZZ8GYyyOzg78Lqa/lrdBVEG0PXdDjEa0MV93qCyqwYlg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.3.0"
|
"tslib": "^2.3.0"
|
||||||
},
|
},
|
||||||
@@ -590,7 +586,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@angular/forms/-/forms-20.3.11.tgz",
|
"resolved": "https://registry.npmjs.org/@angular/forms/-/forms-20.3.11.tgz",
|
||||||
"integrity": "sha512-jXDvW6a9HUzmLmvgPE+hVoZzc6QJBtQ1kYNn/FZDhbtmjRThJtaMW9YfS0Vz/a9KT9cxBf+8O8Q+yspvgsh3fg==",
|
"integrity": "sha512-jXDvW6a9HUzmLmvgPE+hVoZzc6QJBtQ1kYNn/FZDhbtmjRThJtaMW9YfS0Vz/a9KT9cxBf+8O8Q+yspvgsh3fg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.3.0"
|
"tslib": "^2.3.0"
|
||||||
},
|
},
|
||||||
@@ -609,7 +604,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-20.3.11.tgz",
|
"resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-20.3.11.tgz",
|
||||||
"integrity": "sha512-hh+8O8m4QzYYlQr9WGew472P37GF1u64NF3HfHmUKJ0xSqqTOHfpni3utev8upJAFJXBKOUZETgeHu2JRcGavg==",
|
"integrity": "sha512-hh+8O8m4QzYYlQr9WGew472P37GF1u64NF3HfHmUKJ0xSqqTOHfpni3utev8upJAFJXBKOUZETgeHu2JRcGavg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.3.0"
|
"tslib": "^2.3.0"
|
||||||
},
|
},
|
||||||
@@ -632,7 +626,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@angular/router/-/router-20.3.11.tgz",
|
"resolved": "https://registry.npmjs.org/@angular/router/-/router-20.3.11.tgz",
|
||||||
"integrity": "sha512-kuv7Yso7GY3tfRtQN0kW4v2Or4NUEBdjxTz5C8YuAhGDpiKXxDNkXzFliYTVWpJkr3EkTuR9mt9IAc+wxof3Pw==",
|
"integrity": "sha512-kuv7Yso7GY3tfRtQN0kW4v2Or4NUEBdjxTz5C8YuAhGDpiKXxDNkXzFliYTVWpJkr3EkTuR9mt9IAc+wxof3Pw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.3.0"
|
"tslib": "^2.3.0"
|
||||||
},
|
},
|
||||||
@@ -714,7 +707,6 @@
|
|||||||
"integrity": "sha512-yDBHV9kQNcr2/sUr9jghVyz9C3Y5G2zUM2H2lo+9mKv4sFgbA8s8Z9t8D1jiTkGoO/NoIfKMyKWr4s6CN23ZwQ==",
|
"integrity": "sha512-yDBHV9kQNcr2/sUr9jghVyz9C3Y5G2zUM2H2lo+9mKv4sFgbA8s8Z9t8D1jiTkGoO/NoIfKMyKWr4s6CN23ZwQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ampproject/remapping": "^2.2.0",
|
"@ampproject/remapping": "^2.2.0",
|
||||||
"@babel/code-frame": "^7.27.1",
|
"@babel/code-frame": "^7.27.1",
|
||||||
@@ -1656,7 +1648,6 @@
|
|||||||
"integrity": "sha512-nqhDw2ZcAUrKNPwhjinJny903bRhI0rQhiDz1LksjeRxqa36i3l75+4iXbOy0rlDpLJGxqtgoPavQjmmyS5UJw==",
|
"integrity": "sha512-nqhDw2ZcAUrKNPwhjinJny903bRhI0rQhiDz1LksjeRxqa36i3l75+4iXbOy0rlDpLJGxqtgoPavQjmmyS5UJw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@inquirer/checkbox": "^4.2.1",
|
"@inquirer/checkbox": "^4.2.1",
|
||||||
"@inquirer/confirm": "^5.1.14",
|
"@inquirer/confirm": "^5.1.14",
|
||||||
@@ -2516,7 +2507,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-11.1.9.tgz",
|
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-11.1.9.tgz",
|
||||||
"integrity": "sha512-zDntUTReRbAThIfSp3dQZ9kKqI+LjgLp5YZN5c1bgNRDuoeLySAoZg46Bg1a+uV8TMgIRziHocglKGNzr6l+bQ==",
|
"integrity": "sha512-zDntUTReRbAThIfSp3dQZ9kKqI+LjgLp5YZN5c1bgNRDuoeLySAoZg46Bg1a+uV8TMgIRziHocglKGNzr6l+bQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"file-type": "21.1.0",
|
"file-type": "21.1.0",
|
||||||
"iterare": "1.2.1",
|
"iterare": "1.2.1",
|
||||||
@@ -4280,7 +4270,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.13.2.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-1.13.2.tgz",
|
||||||
"integrity": "sha512-VPk9ebNqPcy5lRGuSlKx752IlDatOjT9paPlm8A7yOuW2Fbvp4X3JznJtT4f0GzGLLiWE9W8onz51SqLYwzGaA==",
|
"integrity": "sha512-VPk9ebNqPcy5lRGuSlKx752IlDatOjT9paPlm8A7yOuW2Fbvp4X3JznJtT4f0GzGLLiWE9W8onz51SqLYwzGaA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"follow-redirects": "^1.15.6",
|
"follow-redirects": "^1.15.6",
|
||||||
"form-data": "^4.0.4",
|
"form-data": "^4.0.4",
|
||||||
@@ -4448,7 +4437,6 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"baseline-browser-mapping": "^2.8.25",
|
"baseline-browser-mapping": "^2.8.25",
|
||||||
"caniuse-lite": "^1.0.30001754",
|
"caniuse-lite": "^1.0.30001754",
|
||||||
@@ -5647,7 +5635,6 @@
|
|||||||
"integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==",
|
"integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"accepts": "^2.0.0",
|
"accepts": "^2.0.0",
|
||||||
"body-parser": "^2.2.0",
|
"body-parser": "^2.2.0",
|
||||||
@@ -6903,7 +6890,6 @@
|
|||||||
"integrity": "sha512-j1n1IuTX1VQjIy3tT7cyGbX7nvQOsFLoIqobZv4ttI5axP923gA44zUj6miiA6R5Aoms4sEGVIIcucXUbRI14g==",
|
"integrity": "sha512-j1n1IuTX1VQjIy3tT7cyGbX7nvQOsFLoIqobZv4ttI5axP923gA44zUj6miiA6R5Aoms4sEGVIIcucXUbRI14g==",
|
||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"copy-anything": "^2.0.1",
|
"copy-anything": "^2.0.1",
|
||||||
"parse-node-version": "^1.0.1",
|
"parse-node-version": "^1.0.1",
|
||||||
@@ -7191,7 +7177,6 @@
|
|||||||
"integrity": "sha512-SL0JY3DaxylDuo/MecFeiC+7pedM0zia33zl0vcjgwcq1q1FWWF1To9EIauPbl8GbMCU0R2e0uJ8bZunhYKD2g==",
|
"integrity": "sha512-SL0JY3DaxylDuo/MecFeiC+7pedM0zia33zl0vcjgwcq1q1FWWF1To9EIauPbl8GbMCU0R2e0uJ8bZunhYKD2g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cli-truncate": "^4.0.0",
|
"cli-truncate": "^4.0.0",
|
||||||
"colorette": "^2.0.20",
|
"colorette": "^2.0.20",
|
||||||
@@ -8847,8 +8832,7 @@
|
|||||||
"version": "0.2.2",
|
"version": "0.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz",
|
||||||
"integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==",
|
"integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0"
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/require-directory": {
|
"node_modules/require-directory": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
@@ -8996,7 +8980,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz",
|
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz",
|
||||||
"integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==",
|
"integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.1.0"
|
"tslib": "^2.1.0"
|
||||||
}
|
}
|
||||||
@@ -9033,7 +9016,6 @@
|
|||||||
"integrity": "sha512-9GUyuksjw70uNpb1MTYWsH9MQHOHY6kwfnkafC24+7aOMZn9+rVMBxRbLvw756mrBFbIsFg6Xw9IkR2Fnn3k+Q==",
|
"integrity": "sha512-9GUyuksjw70uNpb1MTYWsH9MQHOHY6kwfnkafC24+7aOMZn9+rVMBxRbLvw756mrBFbIsFg6Xw9IkR2Fnn3k+Q==",
|
||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chokidar": "^4.0.0",
|
"chokidar": "^4.0.0",
|
||||||
"immutable": "^5.0.2",
|
"immutable": "^5.0.2",
|
||||||
@@ -9782,8 +9764,7 @@
|
|||||||
"version": "2.8.1",
|
"version": "2.8.1",
|
||||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||||
"license": "0BSD",
|
"license": "0BSD"
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/tuf-js": {
|
"node_modules/tuf-js": {
|
||||||
"version": "3.1.0",
|
"version": "3.1.0",
|
||||||
@@ -9833,7 +9814,6 @@
|
|||||||
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
"tsserver": "bin/tsserver"
|
"tsserver": "bin/tsserver"
|
||||||
@@ -9994,7 +9974,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/vite/-/vite-7.1.11.tgz",
|
"resolved": "https://registry.npmjs.org/vite/-/vite-7.1.11.tgz",
|
||||||
"integrity": "sha512-uzcxnSDVjAopEUjljkWh8EIrg6tlzrjFUfMcR1EVsRDGwf/ccef0qQPRyOrROwhrTDaApueq+ja+KLPlzR/zdg==",
|
"integrity": "sha512-uzcxnSDVjAopEUjljkWh8EIrg6tlzrjFUfMcR1EVsRDGwf/ccef0qQPRyOrROwhrTDaApueq+ja+KLPlzR/zdg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"esbuild": "^0.25.0",
|
"esbuild": "^0.25.0",
|
||||||
"fdir": "^6.5.0",
|
"fdir": "^6.5.0",
|
||||||
@@ -10382,7 +10361,6 @@
|
|||||||
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
|
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/colinhacks"
|
"url": "https://github.com/sponsors/colinhacks"
|
||||||
}
|
}
|
||||||
@@ -10401,8 +10379,7 @@
|
|||||||
"version": "0.15.1",
|
"version": "0.15.1",
|
||||||
"resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.15.1.tgz",
|
"resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.15.1.tgz",
|
||||||
"integrity": "sha512-XE96n56IQpJM7NAoXswY3XRLcWFW83xe0BiAOeMD7K5k5xecOeul3Qcpx6GqEeeHNkW5DWL5zOyTbEfB4eti8w==",
|
"integrity": "sha512-XE96n56IQpJM7NAoXswY3XRLcWFW83xe0BiAOeMD7K5k5xecOeul3Qcpx6GqEeeHNkW5DWL5zOyTbEfB4eti8w==",
|
||||||
"license": "MIT",
|
"license": "MIT"
|
||||||
"peer": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
<form [formGroup]="createPurchaseOrderForm">
|
|
||||||
<nz-form-item nz-flex>
|
|
||||||
<nz-form-label nzSpan="12" nzRequired>
|
|
||||||
Conditions générales de vente
|
|
||||||
</nz-form-label>
|
|
||||||
|
|
||||||
<nz-form-control nzSpan="12" nzErrorTip="Ce champ est requis">
|
|
||||||
<input nz-input placeholder="Conditions générales de vente" formControlName="purchaseConditions">
|
|
||||||
</nz-form-control>
|
|
||||||
</nz-form-item>
|
|
||||||
|
|
||||||
<div class="overflow-x-auto">
|
|
||||||
<nz-table [nzBordered]="true" class="mx-auto text-center">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th class="text-center">Produit</th>
|
|
||||||
<th class="text-center">Quantité</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody formArrayName="lines">
|
|
||||||
@for (line of lines.controls.slice(); let i = $index; track i) {
|
|
||||||
<tr [formGroupName]="i" class="text-center">
|
|
||||||
<td class="text-center">{{ line.value.name }}</td>
|
|
||||||
<td class="text-center">
|
|
||||||
<nz-input-number
|
|
||||||
formControlName="quantity"
|
|
||||||
[nzMin]="1"
|
|
||||||
[nzStep]="1">
|
|
||||||
</nz-input-number>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</nz-table>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
import { Component } from '@angular/core';
|
|
||||||
import {FormBuilder, FormGroup, FormArray, Validators, ReactiveFormsModule, FormControl} from '@angular/forms';
|
|
||||||
import { GetProductDto } from '../../services/api';
|
|
||||||
import {NzTableComponent} from "ng-zorro-antd/table";
|
|
||||||
import {NzInputNumberComponent} from "ng-zorro-antd/input-number";
|
|
||||||
import {NzColDirective} from "ng-zorro-antd/grid";
|
|
||||||
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
|
||||||
import {NzFormControlComponent, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
|
|
||||||
import {NzInputDirective} from "ng-zorro-antd/input";
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-create-purchaseorder-form',
|
|
||||||
templateUrl: './create-purchaseorder-form.html',
|
|
||||||
styleUrl: './create-purchaseorder-form.css',
|
|
||||||
imports: [
|
|
||||||
ReactiveFormsModule,
|
|
||||||
NzTableComponent,
|
|
||||||
NzInputNumberComponent,
|
|
||||||
NzColDirective,
|
|
||||||
NzFlexDirective,
|
|
||||||
NzFormControlComponent,
|
|
||||||
NzFormItemComponent,
|
|
||||||
NzFormLabelComponent,
|
|
||||||
NzInputDirective,
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export class CreatePurchaseorderForm {
|
|
||||||
createPurchaseOrderForm: FormGroup
|
|
||||||
|
|
||||||
constructor(private fb: FormBuilder) {
|
|
||||||
this.createPurchaseOrderForm = this.fb.group({
|
|
||||||
purchaseConditions: new FormControl<string | null>(null, Validators.required),
|
|
||||||
lines: this.fb.array([])
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
get lines(): FormArray {
|
|
||||||
return this.createPurchaseOrderForm.get('lines') as FormArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ajouter des produits sélectionnés dans le formulaire
|
|
||||||
syncSelectedProducts(selectedProducts: GetProductDto[]) {
|
|
||||||
this.lines.clear();
|
|
||||||
selectedProducts.forEach(p => {
|
|
||||||
this.lines.push(this.fb.group({
|
|
||||||
productId: [p.id],
|
|
||||||
name: [p.name],
|
|
||||||
quantity: [1, [Validators.required, Validators.min(1)]]
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
<form [formGroup]="createQuotationForm">
|
|
||||||
<nz-form-item nz-flex>
|
|
||||||
<nz-form-label nzSpan="12" nzRequired>
|
|
||||||
Message
|
|
||||||
</nz-form-label>
|
|
||||||
|
|
||||||
<nz-form-control nzSpan="12" nzErrorTip="Ce champ est requis">
|
|
||||||
<input nz-input placeholder="Message" formControlName="message">
|
|
||||||
</nz-form-control>
|
|
||||||
</nz-form-item>
|
|
||||||
|
|
||||||
<nz-form-item nz-flex>
|
|
||||||
<nz-form-label nzSpan="12" nzRequired>
|
|
||||||
Conditions générales
|
|
||||||
</nz-form-label>
|
|
||||||
|
|
||||||
<nz-form-control nzSpan="12" nzErrorTip="Ce champ est requis">
|
|
||||||
<input nz-input placeholder="Conditions générales de vente" formControlName="purchaseConditions">
|
|
||||||
</nz-form-control>
|
|
||||||
</nz-form-item>
|
|
||||||
|
|
||||||
<div class="overflow-x-auto">
|
|
||||||
<nz-table [nzBordered]="true" class="mx-auto text-center">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th class="text-center">Produit</th>
|
|
||||||
<th class="text-center">Quantité</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody formArrayName="lines">
|
|
||||||
@for (line of lines.controls.slice(); let i = $index; track i) {
|
|
||||||
<tr [formGroupName]="i" class="text-center">
|
|
||||||
<td class="text-center">{{ line.value.name }}</td>
|
|
||||||
<td class="text-center">
|
|
||||||
<nz-input-number
|
|
||||||
formControlName="quantity"
|
|
||||||
[nzMin]="1"
|
|
||||||
[nzStep]="1">
|
|
||||||
</nz-input-number>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</nz-table>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
import { Component } from '@angular/core';
|
|
||||||
import {
|
|
||||||
FormArray,
|
|
||||||
FormBuilder,
|
|
||||||
FormControl,
|
|
||||||
FormGroup,
|
|
||||||
FormsModule,
|
|
||||||
ReactiveFormsModule,
|
|
||||||
Validators
|
|
||||||
} from "@angular/forms";
|
|
||||||
import {NzColDirective} from "ng-zorro-antd/grid";
|
|
||||||
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
|
||||||
import {NzFormControlComponent, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
|
|
||||||
import {NzInputDirective} from "ng-zorro-antd/input";
|
|
||||||
import {NzInputNumberComponent} from "ng-zorro-antd/input-number";
|
|
||||||
import {NzTableComponent} from "ng-zorro-antd/table";
|
|
||||||
import {GetProductDto} from "../../services/api";
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-create-quotation-form',
|
|
||||||
imports: [
|
|
||||||
FormsModule,
|
|
||||||
NzColDirective,
|
|
||||||
NzFlexDirective,
|
|
||||||
NzFormControlComponent,
|
|
||||||
NzFormItemComponent,
|
|
||||||
NzFormLabelComponent,
|
|
||||||
NzInputDirective,
|
|
||||||
NzInputNumberComponent,
|
|
||||||
NzTableComponent,
|
|
||||||
ReactiveFormsModule
|
|
||||||
],
|
|
||||||
templateUrl: './create-quotation-form.html',
|
|
||||||
styleUrl: './create-quotation-form.css',
|
|
||||||
})
|
|
||||||
export class CreateQuotationForm {
|
|
||||||
createQuotationForm: FormGroup
|
|
||||||
|
|
||||||
constructor(private fb: FormBuilder) {
|
|
||||||
this.createQuotationForm = this.fb.group({
|
|
||||||
message: new FormControl<string>(null, Validators.required),
|
|
||||||
purchaseConditions: new FormControl<string>(null, Validators.required),
|
|
||||||
lines: this.fb.array([])
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
get lines(): FormArray {
|
|
||||||
return this.createQuotationForm.get('lines') as FormArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ajouter des produits sélectionnés dans le formulaire
|
|
||||||
syncSelectedProducts(selectedProducts: GetProductDto[]) {
|
|
||||||
this.lines.clear();
|
|
||||||
selectedProducts.forEach(p => {
|
|
||||||
this.lines.push(this.fb.group({
|
|
||||||
productId: [p.id],
|
|
||||||
name: [p.name],
|
|
||||||
quantity: [1, [Validators.required, Validators.min(1)]]
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -79,12 +79,20 @@ export class DelivererTable implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
const deliverers = updateDelivererComponent.delivererForm.getRawValue();
|
const deliverers = updateDelivererComponent.delivererForm.getRawValue();
|
||||||
await firstValueFrom(this.deliverersService.updateDelivererEndpoint(id, deliverers))
|
await firstValueFrom(this.deliverersService.updateDelivererEndpoint(id, deliverers))
|
||||||
|
|
||||||
this.notificationService.success('Success', 'Transporteur modifié')
|
this.notificationService.success(
|
||||||
|
'Success',
|
||||||
|
'Transporteur modifié'
|
||||||
|
)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.notificationService.error('Erreur', 'Erreur lors de la modification')
|
console.error(e);
|
||||||
|
this.notificationService.error(
|
||||||
|
'Erreur',
|
||||||
|
'Erreur lors de la modification'
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
</nz-form-label>
|
</nz-form-label>
|
||||||
|
|
||||||
<nz-form-control nzSpan="9" nzErrorTip="Ce champ est requis">
|
<nz-form-control nzSpan="9" nzErrorTip="Ce champ est requis">
|
||||||
<nz-select formControlName="delivererId" [nzPlaceHolder]="'Choisir un transporteur'" nzShowSearch [nzFilterOption]="filter">
|
<nz-select formControlName="deliverer" [nzPlaceHolder]="'Choisir un transporteur'" nzShowSearch [nzFilterOption]="filter">
|
||||||
@for (deliverer of deliverers(); track deliverer.id) {
|
@for (deliverer of deliverers(); track deliverer.id) {
|
||||||
<nz-option [nzValue]="deliverer.id" [nzLabel]="deliverer.transporter"></nz-option>
|
<nz-option [nzValue]="deliverer.id" [nzLabel]="deliverer.transporter"></nz-option>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import {Component, effect, inject, input, OnInit, signal} from '@angular/core';
|
import {Component, inject, signal} from '@angular/core';
|
||||||
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from "@angular/forms";
|
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from "@angular/forms";
|
||||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
|
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
|
||||||
import {NzColDirective} from "ng-zorro-antd/grid";
|
import {NzColDirective} from "ng-zorro-antd/grid";
|
||||||
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
||||||
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker";
|
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker";
|
||||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select";
|
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select";
|
||||||
import {DeliverersService, GetDelivererDto, GetDeliveryNoteDto} from "../../services/api";
|
import {DeliverersService, GetDelivererDto} from "../../services/api";
|
||||||
import {NzNotificationService} from "ng-zorro-antd/notification";
|
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||||
import {firstValueFrom} from "rxjs";
|
import {firstValueFrom} from "rxjs";
|
||||||
|
|
||||||
@@ -21,15 +21,14 @@ import {firstValueFrom} from "rxjs";
|
|||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
NzDatePickerComponent,
|
NzDatePickerComponent,
|
||||||
NzSelectComponent,
|
NzSelectComponent,
|
||||||
NzOptionComponent,
|
NzOptionComponent
|
||||||
],
|
],
|
||||||
templateUrl: './deliverery-note-form.html',
|
templateUrl: './deliverery-note-form.html',
|
||||||
styleUrl: './deliverery-note-form.css',
|
styleUrl: './deliverery-note-form.css',
|
||||||
})
|
})
|
||||||
export class DelivereryNoteForm implements OnInit {
|
export class DelivereryNoteForm {
|
||||||
deliveryNoteForm: FormGroup = new FormGroup({
|
deliveryNoteForm: FormGroup = new FormGroup({
|
||||||
trackingNumber: new FormControl<string>(null),
|
deliverer: new FormControl<string>(null,[Validators.required]),
|
||||||
delivererId: new FormControl<number>(null,[Validators.required]),
|
|
||||||
expeditionDate: new FormControl(null,[Validators.required]),
|
expeditionDate: new FormControl(null,[Validators.required]),
|
||||||
estimatedDate: new FormControl(null),
|
estimatedDate: new FormControl(null),
|
||||||
realDeliveryDate: new FormControl(null)
|
realDeliveryDate: new FormControl(null)
|
||||||
@@ -55,20 +54,4 @@ export class DelivereryNoteForm implements OnInit {
|
|||||||
filter(input: string, option: any) {
|
filter(input: string, option: any) {
|
||||||
return option.nzLabel.toLowerCase().includes(input.toLowerCase());
|
return option.nzLabel.toLowerCase().includes(input.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
deliveryNote= input<GetDeliveryNoteDto>();
|
|
||||||
constructor() {
|
|
||||||
effect(() => {
|
|
||||||
if (this.deliveryNote()) {
|
|
||||||
this.deliveryNoteForm.patchValue({
|
|
||||||
trackingNumber: this.deliveryNote().trackingNumber,
|
|
||||||
expeditionDate: this.deliveryNote().expeditionDate,
|
|
||||||
realDeliveryDate: this.deliveryNote().realDeliveryDate,
|
|
||||||
estimatedDate: this.deliveryNote().estimateDeliveryDate,
|
|
||||||
delivererId: this.deliveryNote().delivererId
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<th>Date d'expédition</th>
|
<th>Date d'expédition</th>
|
||||||
<th>Date de livraison estimée</th>
|
<th>Date de livraison estimée</th>
|
||||||
<th>Date de livraison réelle</th>
|
<th>Date de livraison réelle</th>
|
||||||
|
<th>Produits</th>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead >
|
</thead >
|
||||||
@@ -20,24 +21,51 @@
|
|||||||
<td>{{deliveryNote.expeditionDate | date: 'dd/MM/yyyy'}}</td>
|
<td>{{deliveryNote.expeditionDate | date: 'dd/MM/yyyy'}}</td>
|
||||||
<td>{{deliveryNote.estimateDeliveryDate | date: 'dd/MM/yyyy'}}</td>
|
<td>{{deliveryNote.estimateDeliveryDate | date: 'dd/MM/yyyy'}}</td>
|
||||||
<td>{{deliveryNote.realDeliveryDate | date: 'dd/MM/yyyy'}}</td>
|
<td>{{deliveryNote.realDeliveryDate | date: 'dd/MM/yyyy'}}</td>
|
||||||
|
<td>
|
||||||
|
<app-modal-button type="link" name="Voir les produits" size="40%">
|
||||||
|
<div style="max-height: 400px; overflow-y: auto;">
|
||||||
|
<nz-table [nzData]="deliveryNotes()"
|
||||||
|
[nzFrontPagination]="false">
|
||||||
|
<thead>
|
||||||
|
<tr class="text-center">
|
||||||
|
<th>Réference</th>
|
||||||
|
<th>Nom</th>
|
||||||
|
<th>Quantité</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody class="text-center">
|
||||||
|
@for (product of deliveryNote.products; track product.productId) {
|
||||||
|
<tr>
|
||||||
|
<td>{{product.productReference}}</td>
|
||||||
|
<td>{{product.productName}}</td>
|
||||||
|
<td>{{product.quantity}}</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</nz-table>
|
||||||
|
</div>
|
||||||
|
</app-modal-button>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div style="justify-content: center; display: flex">
|
<div style="justify-content: center; display: flex">
|
||||||
<nz-icon nzType="check" nzTheme="outline" (click)="validate(deliveryNote.id)" class="cursor-pointer text-green-700"/>
|
<div>
|
||||||
|
<nz-icon nzType="check" nzTheme="outline" (click)="validate(deliveryNote.id)" class="cursor-pointer text-green-700"/>
|
||||||
|
</div>
|
||||||
<nz-divider nzType="vertical"></nz-divider>
|
<nz-divider nzType="vertical"></nz-divider>
|
||||||
<nz-icon nzType="edit" nzTheme="outline" class="cursor-pointer" (click)="openEditModal(deliveryNote)"></nz-icon>
|
<app-modal-nav nameIcon="edit" name="Modification du bon de livraison" class="cursor-pointer">
|
||||||
|
<app-deliverery-note-form></app-deliverery-note-form>
|
||||||
|
</app-modal-nav>
|
||||||
<nz-divider nzType="vertical"></nz-divider>
|
<nz-divider nzType="vertical"></nz-divider>
|
||||||
<nz-icon nzType="delete" nzTheme="outline" (click)="delete(deliveryNote.id)" class="cursor-pointer text-red-700"/>
|
<div>
|
||||||
|
<nz-icon nzType="delete" nzTheme="outline" (click)="delete(deliveryNote.id)" class="cursor-pointer text-red-700"/>
|
||||||
|
</div>
|
||||||
<nz-divider nzType="vertical"></nz-divider>
|
<nz-divider nzType="vertical"></nz-divider>
|
||||||
<nz-icon nzType="export" nzTheme="outline" (click)="export(deliveryNote.id)" class="cursor-pointer text-green-700"/>
|
<div>
|
||||||
|
<nz-icon nzType="export" nzTheme="outline" (click)="export(deliveryNote.id)" class="cursor-pointer text-green-700"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
</nz-table>
|
</nz-table>
|
||||||
|
|
||||||
<div class="hidden">
|
|
||||||
<app-modal-nav #modalNav nameIcon="edit" [name]="'Modifier un bon de livraison'" (ok)="onModalOk(selectedDeliveryNote.id, deliveryNoteForm, modalNav)" (cancel)="onModalCancel(modalNav)">
|
|
||||||
<app-deliverery-note-form #deliveryNoteForm [deliveryNote]="selectedDeliveryNote"></app-deliverery-note-form>
|
|
||||||
</app-modal-nav>
|
|
||||||
</div>
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import {Component, inject, OnInit, signal, viewChild} from '@angular/core';
|
import {Component, inject, OnInit, signal} from '@angular/core';
|
||||||
import {DatePipe} from "@angular/common";
|
import {DatePipe} from "@angular/common";
|
||||||
|
import {ModalButton} from "../modal-button/modal-button";
|
||||||
import {ModalNav} from "../modal-nav/modal-nav";
|
import {ModalNav} from "../modal-nav/modal-nav";
|
||||||
import {NzDividerComponent} from "ng-zorro-antd/divider";
|
import {NzDividerComponent} from "ng-zorro-antd/divider";
|
||||||
import {NzIconDirective} from "ng-zorro-antd/icon";
|
import {NzIconDirective} from "ng-zorro-antd/icon";
|
||||||
@@ -14,6 +15,7 @@ import {FileService} from "../../services/file.service";
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-deliverery-note-table',
|
selector: 'app-deliverery-note-table',
|
||||||
imports: [
|
imports: [
|
||||||
|
ModalButton,
|
||||||
ModalNav,
|
ModalNav,
|
||||||
NzDividerComponent,
|
NzDividerComponent,
|
||||||
NzIconDirective,
|
NzIconDirective,
|
||||||
@@ -30,7 +32,6 @@ export class DelivereryNoteTable implements OnInit {
|
|||||||
private fileService = inject(FileService);
|
private fileService = inject(FileService);
|
||||||
deliveryNotes = signal<GetDeliveryNoteDto[]>([]);
|
deliveryNotes = signal<GetDeliveryNoteDto[]>([]);
|
||||||
deliveryNotesLoading = signal<boolean>(false);
|
deliveryNotesLoading = signal<boolean>(false);
|
||||||
modal = viewChild.required<ModalNav>('modalNav');
|
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
await this.fetchDeliveryNotes();
|
await this.fetchDeliveryNotes();
|
||||||
@@ -39,7 +40,7 @@ export class DelivereryNoteTable implements OnInit {
|
|||||||
async fetchDeliveryNotes() {
|
async fetchDeliveryNotes() {
|
||||||
this.deliveryNotesLoading.set(true)
|
this.deliveryNotesLoading.set(true)
|
||||||
try {
|
try {
|
||||||
const deliveryNotes = await firstValueFrom(this.deliveryNotesService.getAllDeliveryNoteEndpoint());
|
const deliveryNotes = await firstValueFrom(this.deliveryNotesService.getAllDeliveryNoteEndpoint())
|
||||||
this.deliveryNotes.set(deliveryNotes);
|
this.deliveryNotes.set(deliveryNotes);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.notificationService.error(
|
this.notificationService.error(
|
||||||
@@ -106,6 +107,7 @@ export class DelivereryNoteTable implements OnInit {
|
|||||||
);
|
);
|
||||||
this.fileService.downloadBlob(pdf)
|
this.fileService.downloadBlob(pdf)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
this.notificationService.error(
|
this.notificationService.error(
|
||||||
'Erreur',
|
'Erreur',
|
||||||
'Impossible de générer un PDF'
|
'Impossible de générer un PDF'
|
||||||
@@ -113,64 +115,4 @@ export class DelivereryNoteTable implements OnInit {
|
|||||||
}
|
}
|
||||||
this.deliveryNotesLoading.set(false)
|
this.deliveryNotesLoading.set(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
async edit(id: number, updateDelivereryNoteComponent: DelivereryNoteForm) {
|
|
||||||
if (updateDelivereryNoteComponent.deliveryNoteForm.invalid) {
|
|
||||||
this.notificationService.error('Erreur', 'Formulaire invalide');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const raw = updateDelivereryNoteComponent.deliveryNoteForm.getRawValue();
|
|
||||||
|
|
||||||
// convertit proprement les dates (string OU Date)
|
|
||||||
const toIso = (val: any) => {
|
|
||||||
if (!val) return null;
|
|
||||||
|
|
||||||
// si c’est déjà un string ISO "yyyy-MM-dd", on renvoie tel quel
|
|
||||||
if (typeof val === 'string' && /^\d{4}-\d{2}-\d{2}/.test(val)) {
|
|
||||||
return val.substring(0, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
// sinon on reconstruit une Date
|
|
||||||
const d = new Date(val);
|
|
||||||
if (isNaN(d.getTime())) return null;
|
|
||||||
|
|
||||||
return d.toISOString().substring(0, 10); // yyyy-MM-dd
|
|
||||||
};
|
|
||||||
|
|
||||||
const deliveryNoteDto = {
|
|
||||||
trackingNumber: raw.trackingNumber,
|
|
||||||
delivererId: raw.delivererId,
|
|
||||||
expeditionDate: toIso(raw.expeditionDate),
|
|
||||||
estimatedDate: toIso(raw.estimatedDate),
|
|
||||||
realDeliveryDate: toIso(raw.realDeliveryDate)
|
|
||||||
};
|
|
||||||
|
|
||||||
await firstValueFrom(this.deliveryNotesService.updateDeliveryNoteEndpoint(id, deliveryNoteDto));
|
|
||||||
this.notificationService.success('Success', 'Bon de livraison modifié');
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
this.notificationService.error('Erreur', 'Erreur lors de la modification');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
selectedDeliveryNote: GetDeliveryNoteDto | null = null;
|
|
||||||
openEditModal(deliveryNote: GetDeliveryNoteDto) {
|
|
||||||
this.selectedDeliveryNote = { ...deliveryNote };
|
|
||||||
this.modal().showModal();
|
|
||||||
}
|
|
||||||
|
|
||||||
async onModalOk(id: number, updateDelivereryNoteComponent: DelivereryNoteForm, modal: ModalNav) {
|
|
||||||
if (!this.selectedDeliveryNote) return;
|
|
||||||
|
|
||||||
await this.edit(id, updateDelivereryNoteComponent);
|
|
||||||
updateDelivereryNoteComponent.deliveryNoteForm.reset();
|
|
||||||
modal.isVisible = false;
|
|
||||||
await this.fetchDeliveryNotes();
|
|
||||||
}
|
|
||||||
|
|
||||||
onModalCancel(modal: ModalNav) {
|
|
||||||
modal.isVisible = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,18 +2,40 @@
|
|||||||
<input type="text" placeholder="Rechercher une livraison" class="search-input" (input)="search.set($any($event.target).value)"/>
|
<input type="text" placeholder="Rechercher une livraison" class="search-input" (input)="search.set($any($event.target).value)"/>
|
||||||
|
|
||||||
<div class="livraisons-list">
|
<div class="livraisons-list">
|
||||||
@for (deliveryItem of filteredLivraisons(); track deliveryItem.id) {
|
@for (deliveryItem of filteredDeliveries(); track deliveryItem.id) {
|
||||||
<div class="livraison-card">
|
<div class="livraison-card">
|
||||||
<div class="livraison-info">
|
<div class="livraison-info">
|
||||||
<h3>{{ deliveryItem.client }}</h3>
|
<h3>{{ deliveryItem.delivererTransporter }}</h3>
|
||||||
<p class="mr-5">Date d'expédition: {{ deliveryItem.date }}</p>
|
<p class="mr-5">Date d'expédition: {{ deliveryItem.expeditionDate }}</p>
|
||||||
<p>Produits : {{ deliveryItem.produits }}</p>
|
<p>Produits : {{ deliveryItem.products }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button nz-button nzType="primary" [nzSize]="size" nzShape="round" (click)="validate(deliveryItem.id)">
|
<app-modal-nav name="Valider la livraison" nameIcon="check" (click)="validate(deliveryItem.id)">
|
||||||
<nz-icon nzType="check" />
|
<div style="max-height: 400px; overflow-y: auto;">
|
||||||
Valider
|
<nz-table [nzData]="filteredDeliveries()"
|
||||||
</button>
|
[nzFrontPagination]="false">
|
||||||
|
<thead>
|
||||||
|
<tr class="text-center">
|
||||||
|
<th>Réference</th>
|
||||||
|
<th>Nom</th>
|
||||||
|
<th>Quantité</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody class="text-center">
|
||||||
|
@for (product of deliveryItem.products; track product.productId) {
|
||||||
|
<tr>
|
||||||
|
<td>{{product.productReference}}</td>
|
||||||
|
<td>{{product.productName}}</td>
|
||||||
|
<td>{{product.quantity}}</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</nz-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</app-modal-nav>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,44 +1,78 @@
|
|||||||
import {Component, computed, signal} from '@angular/core';
|
import {Component, computed, inject, OnInit, signal} from '@angular/core';
|
||||||
import {NzButtonComponent, NzButtonSize} from "ng-zorro-antd/button";
|
import {NzButtonComponent, NzButtonSize} from "ng-zorro-antd/button";
|
||||||
import {NzIconDirective} from "ng-zorro-antd/icon";
|
import {NzIconDirective} from "ng-zorro-antd/icon";
|
||||||
|
import {DeliverynotesService, GetDeliveryNoteDto} from "../../services/api";
|
||||||
|
import {firstValueFrom} from "rxjs";
|
||||||
|
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||||
|
import {ModalButton} from "../modal-button/modal-button";
|
||||||
|
import {ModalNav} from "../modal-nav/modal-nav";
|
||||||
|
import {NzTableComponent} from "ng-zorro-antd/table";
|
||||||
|
import {format} from "date-fns";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-delivery-validator',
|
selector: 'app-delivery-validator',
|
||||||
imports: [
|
imports: [
|
||||||
NzButtonComponent,
|
NzButtonComponent,
|
||||||
NzIconDirective
|
NzIconDirective,
|
||||||
|
ModalButton,
|
||||||
|
ModalNav,
|
||||||
|
NzTableComponent
|
||||||
],
|
],
|
||||||
templateUrl: './delivery-validator.html',
|
templateUrl: './delivery-validator.html',
|
||||||
styleUrl: './delivery-validator.css',
|
styleUrl: './delivery-validator.css',
|
||||||
})
|
})
|
||||||
export class DeliveryValidator {
|
export class DeliveryValidator implements OnInit {
|
||||||
|
private deliveriesService = inject(DeliverynotesService);
|
||||||
|
private notificationsService = inject(NzNotificationService);
|
||||||
|
|
||||||
size: NzButtonSize = 'large';
|
size: NzButtonSize = 'large';
|
||||||
search = signal('');
|
search = signal('');
|
||||||
|
|
||||||
livraisons = signal([
|
deliveries = signal<GetDeliveryNoteDto[]>(null);
|
||||||
{ id: 1, client: 'Carrefour', date: '2025-02-03', produits: 12 },
|
|
||||||
{ id: 2, client: 'Intermarché', date: '2025-02-04', produits: 8 },
|
|
||||||
{ id: 3, client: 'Auchan', date: '2025-02-05', produits: 23 },
|
|
||||||
{ id: 1, client: 'Carrefour', date: '2025-02-03', produits: 12 },
|
|
||||||
{ id: 2, client: 'Intermarché', date: '2025-02-04', produits: 8 },
|
|
||||||
{ id: 3, client: 'Auchan', date: '2025-02-05', produits: 23 },
|
|
||||||
{ id: 1, client: 'Carrefour', date: '2025-02-03', produits: 12 },
|
|
||||||
{ id: 2, client: 'Intermarché', date: '2025-02-04', produits: 8 },
|
|
||||||
{ id: 3, client: 'Auchan', date: '2025-02-05', produits: 23 },
|
|
||||||
{ id: 1, client: 'Carrefour', date: '2025-02-03', produits: 12 },
|
|
||||||
{ id: 2, client: 'Intermarché', date: '2025-02-04', produits: 8 },
|
|
||||||
{ id: 3, client: 'Auchan', date: '2025-02-05', produits: 23 }
|
|
||||||
]);
|
|
||||||
|
|
||||||
filteredLivraisons = computed(() => {
|
|
||||||
|
async fetchDeliveries(){
|
||||||
|
try{
|
||||||
|
const deliveries = await firstValueFrom(this.deliveriesService.getAllDeliveryNoteEndpoint());
|
||||||
|
this.deliveries.set(deliveries);
|
||||||
|
}catch(e) {
|
||||||
|
this.notificationsService.error(
|
||||||
|
'Error',
|
||||||
|
'Error fetching deliveries',
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async ngOnInit(){
|
||||||
|
await this.fetchDeliveries();
|
||||||
|
}
|
||||||
|
|
||||||
|
filteredDeliveries = computed(() => {
|
||||||
|
if(this.deliveries() == null){
|
||||||
|
return
|
||||||
|
}
|
||||||
const query = this.search().toLowerCase();
|
const query = this.search().toLowerCase();
|
||||||
return this.livraisons().filter(l =>
|
return this.deliveries().filter(l =>
|
||||||
l.client.toLowerCase().includes(query) ||
|
l.delivererTransporter.toLowerCase().includes(query) ||
|
||||||
l.date.includes(query)
|
l.estimateDeliveryDate.includes(query)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
validate(id: number) {
|
|
||||||
return
|
|
||||||
|
async validate(id) {
|
||||||
|
try{
|
||||||
|
const PatchRealDate = {
|
||||||
|
realDeliveryDate: format(new Date(), 'yyyy-MM-dd')
|
||||||
|
};
|
||||||
|
await firstValueFrom(this.deliveriesService.patchRealDeliveryDateEndpoint(id, PatchRealDate));
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
this.notificationsService.error(
|
||||||
|
'Error',
|
||||||
|
'Error validateing delivery',
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import {NgStyle} from "@angular/common";
|
|||||||
})
|
})
|
||||||
export class InfoCard {
|
export class InfoCard {
|
||||||
icon = input.required<string>()
|
icon = input.required<string>()
|
||||||
value = input.required<string>()
|
value = input.required<number>()
|
||||||
description = input.required<string>()
|
description = input.required<string>()
|
||||||
color = input.required<string>()
|
color = input.required<string>()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
</nz-form-label>
|
</nz-form-label>
|
||||||
|
|
||||||
<nz-form-control nzSpan="12" nzErrorTip="Ce champ est requis">
|
<nz-form-control nzSpan="12" nzErrorTip="Ce champ est requis">
|
||||||
<input nz-input placeholder="Conditions générales de vente" formControlName="purchaseConditions">
|
<input nz-input placeholder="Conditions générales de vente" formControlName="purchaseCondition">
|
||||||
</nz-form-control>
|
</nz-form-control>
|
||||||
</nz-form-item>
|
</nz-form-item>
|
||||||
</form>
|
</form>
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
import {Component, effect, input} from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import {FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators} from "@angular/forms";
|
import {FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators} from "@angular/forms";
|
||||||
import {NzColDirective} from "ng-zorro-antd/grid";
|
import {NzColDirective} from "ng-zorro-antd/grid";
|
||||||
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
||||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
|
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
|
||||||
import {NzInputDirective} from "ng-zorro-antd/input";
|
import {NzInputDirective} from "ng-zorro-antd/input";
|
||||||
import {GetPurchaseOrderDto} from "../../services/api";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-purchase-order-form',
|
selector: 'app-purchase-order-form',
|
||||||
@@ -24,17 +23,6 @@ import {GetPurchaseOrderDto} from "../../services/api";
|
|||||||
})
|
})
|
||||||
export class PurchaseOrderForm {
|
export class PurchaseOrderForm {
|
||||||
purchaseOrderForm: FormGroup = new FormGroup({
|
purchaseOrderForm: FormGroup = new FormGroup({
|
||||||
purchaseConditions: new FormControl<string>(null,[Validators.required])
|
purchaseCondition: new FormControl<string>(null,[Validators.required])
|
||||||
})
|
})
|
||||||
|
|
||||||
purchaseOrder= input<GetPurchaseOrderDto>();
|
|
||||||
constructor() {
|
|
||||||
effect(() => {
|
|
||||||
if (this.purchaseOrder()) {
|
|
||||||
this.purchaseOrderForm.patchValue({
|
|
||||||
purchaseConditions: this.purchaseOrder().purchaseConditions,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="text-center">
|
<tbody class="text-center">
|
||||||
@for (product of purchaseOrder.products; track product.productId) {
|
@for (product of purchaseOrder.getPurchaseProductDto; track product.productId) {
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{product.productName}}</td>
|
<td>{{product.productName}}</td>
|
||||||
<td>{{product.productReferences}}</td>
|
<td>{{product.productReferences}}</td>
|
||||||
@@ -40,9 +40,9 @@
|
|||||||
<td>{{product.quantity}}</td>
|
<td>{{product.quantity}}</td>
|
||||||
<td>
|
<td>
|
||||||
<div style="justify-content: center; display: flex">
|
<div style="justify-content: center; display: flex">
|
||||||
<nz-icon nzType="edit" nzTheme="outline" class="cursor-pointer" (click)="openEditQuantityModal(product)"></nz-icon>
|
<div>
|
||||||
<nz-divider nzType="vertical"></nz-divider>
|
<nz-icon nzType="delete" nzTheme="outline" class="cursor-pointer text-red-700"/>
|
||||||
<nz-icon nzType="delete" nzTheme="outline" class="cursor-pointer text-red-700" (click)="deleteProduct(product.productId, purchaseOrder.id)"/>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -54,30 +54,28 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div style="justify-content: center; display: flex">
|
<div style="justify-content: center; display: flex">
|
||||||
<nz-icon nzType="plus-circle" nzTheme="outline" class="cursor-pointer text-green-700"/>
|
<div>
|
||||||
|
<nz-icon nzType="plus-circle" nzTheme="outline" (click)="delete(purchaseOrder.id)" class="cursor-pointer text-green-700"/>
|
||||||
|
</div>
|
||||||
<nz-divider nzType="vertical"></nz-divider>
|
<nz-divider nzType="vertical"></nz-divider>
|
||||||
<nz-icon nzType="edit" nzTheme="outline" class="cursor-pointer" (click)="openEditModal(purchaseOrder)"></nz-icon>
|
<app-modal-nav nameIcon="edit" name="Modification des conditions de vente" class="cursor-pointer">
|
||||||
|
<app-purchase-order-form></app-purchase-order-form>
|
||||||
|
</app-modal-nav>
|
||||||
<nz-divider nzType="vertical"></nz-divider>
|
<nz-divider nzType="vertical"></nz-divider>
|
||||||
<nz-icon nzType="delete" nzTheme="outline" (click)="delete(purchaseOrder.id)" class="cursor-pointer text-red-700"/>
|
<div>
|
||||||
|
<nz-icon nzType="delete" nzTheme="outline" (click)="delete(purchaseOrder.id)" class="cursor-pointer text-red-700"/>
|
||||||
|
</div>
|
||||||
<nz-divider nzType="vertical"></nz-divider>
|
<nz-divider nzType="vertical"></nz-divider>
|
||||||
<nz-icon nzType="export" nzTheme="outline" (click)="export(purchaseOrder.id)" class="cursor-pointer text-green-700"/>
|
<div>
|
||||||
|
<nz-icon nzType="export" nzTheme="outline" (click)="export(purchaseOrder.id)" class="cursor-pointer text-green-700"/>
|
||||||
|
</div>
|
||||||
<nz-divider nzType="vertical"></nz-divider>
|
<nz-divider nzType="vertical"></nz-divider>
|
||||||
<nz-icon nzType="interaction" nzTheme="outline" (click)="transfer(purchaseOrder)" class="cursor-pointer text-blue-700"/>
|
<div>
|
||||||
|
<nz-icon nzType="interaction" nzTheme="outline" (click)="transfer()" class="cursor-pointer text-blue-700"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
</nz-table>
|
</nz-table>
|
||||||
|
|
||||||
<div class="hidden">
|
|
||||||
<app-modal-nav #modalNav nameIcon="edit" [name]="'Modification des conditions de vente'" (ok)="onModalOk(selectedPurchaseOrder.id, purchaseOrderForm, modalNav)" (cancel)="onModalCancel(modalNav)">
|
|
||||||
<app-purchase-order-form #purchaseOrderForm [purchaseOrder]="selectedPurchaseOrder"></app-purchase-order-form>
|
|
||||||
</app-modal-nav>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="hidden">
|
|
||||||
<app-modal-nav #modalQuantity nameIcon="edit" [name]="'Modification de la quantité'" (ok)="onModalQuantityOk(selectedQuantity.productId, selectedQuantity.purchaseOrderId, quantityForm, modalQuantity)" (cancel)="onModalCancel(modalQuantity)">
|
|
||||||
<app-quantity-form #quantityForm [quantity]="selectedQuantity"></app-quantity-form>
|
|
||||||
</app-modal-nav>
|
|
||||||
</div>
|
|
||||||
@@ -1,24 +1,14 @@
|
|||||||
import {Component, inject, OnInit, signal, viewChild} from '@angular/core';
|
import {Component, inject, OnInit, signal} from '@angular/core';
|
||||||
import {ModalNav} from "../modal-nav/modal-nav";
|
import {ModalNav} from "../modal-nav/modal-nav";
|
||||||
import {NzDividerComponent} from "ng-zorro-antd/divider";
|
import {NzDividerComponent} from "ng-zorro-antd/divider";
|
||||||
import {NzIconDirective} from "ng-zorro-antd/icon";
|
import {NzIconDirective} from "ng-zorro-antd/icon";
|
||||||
import {NzTableComponent} from "ng-zorro-antd/table";
|
import {NzTableComponent} from "ng-zorro-antd/table";
|
||||||
import {PurchaseOrderForm} from "../purchase-order-form/purchase-order-form";
|
import {PurchaseOrderForm} from "../purchase-order-form/purchase-order-form";
|
||||||
import {ModalButton} from "../modal-button/modal-button";
|
import {ModalButton} from "../modal-button/modal-button";
|
||||||
import {
|
import {GetPurchaseOrderDto, PurchaseordersService} from "../../services/api";
|
||||||
CreateDeliveryNoteDto,
|
|
||||||
DeliverynotesService,
|
|
||||||
GetDeliveryNoteDto, GetProductDeliveryDto,
|
|
||||||
GetPurchaseOrderDto,
|
|
||||||
GetPurchaseProductDto,
|
|
||||||
PurchaseordersService,
|
|
||||||
PurchaseproductsService
|
|
||||||
} from "../../services/api";
|
|
||||||
import {NzNotificationService} from "ng-zorro-antd/notification";
|
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||||
import {firstValueFrom} from "rxjs";
|
import {firstValueFrom} from "rxjs";
|
||||||
import {FileService} from "../../services/file.service";
|
import {FileService} from "../../services/file.service";
|
||||||
import {QuantityForm} from "../quantity-form/quantity-form";
|
|
||||||
import {PurchaseOrder} from "../../pages/purchase-order/purchase-order";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-purchase-order-table',
|
selector: 'app-purchase-order-table',
|
||||||
@@ -29,7 +19,6 @@ import {PurchaseOrder} from "../../pages/purchase-order/purchase-order";
|
|||||||
NzTableComponent,
|
NzTableComponent,
|
||||||
PurchaseOrderForm,
|
PurchaseOrderForm,
|
||||||
ModalButton,
|
ModalButton,
|
||||||
QuantityForm,
|
|
||||||
],
|
],
|
||||||
templateUrl: './purchase-order-table.html',
|
templateUrl: './purchase-order-table.html',
|
||||||
styleUrl: './purchase-order-table.css',
|
styleUrl: './purchase-order-table.css',
|
||||||
@@ -38,12 +27,8 @@ export class PurchaseOrderTable implements OnInit {
|
|||||||
private purchaseOrdersService = inject(PurchaseordersService);
|
private purchaseOrdersService = inject(PurchaseordersService);
|
||||||
private notificationService = inject(NzNotificationService);
|
private notificationService = inject(NzNotificationService);
|
||||||
private fileService = inject(FileService);
|
private fileService = inject(FileService);
|
||||||
private purchaseProductService = inject(PurchaseproductsService);
|
|
||||||
private deliveryNoteService = inject(DeliverynotesService);
|
|
||||||
purchaseOrders = signal<GetPurchaseOrderDto[]>([]);
|
purchaseOrders = signal<GetPurchaseOrderDto[]>([]);
|
||||||
purchaseOrdersLoading = signal<boolean>(false);
|
purchaseOrdersLoading = signal<boolean>(false);
|
||||||
modal = viewChild.required<ModalNav>('modalNav');
|
|
||||||
modalQuantity = viewChild.required<ModalNav>('modalQuantity');
|
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
await this.fetchPurchaseOrder();
|
await this.fetchPurchaseOrder();
|
||||||
@@ -90,6 +75,7 @@ export class PurchaseOrderTable implements OnInit {
|
|||||||
);
|
);
|
||||||
this.fileService.downloadBlob(pdf)
|
this.fileService.downloadBlob(pdf)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
this.notificationService.error(
|
this.notificationService.error(
|
||||||
'Erreur',
|
'Erreur',
|
||||||
'Impossible de générer un PDF'
|
'Impossible de générer un PDF'
|
||||||
@@ -98,137 +84,7 @@ export class PurchaseOrderTable implements OnInit {
|
|||||||
this.purchaseOrdersLoading.set(false)
|
this.purchaseOrdersLoading.set(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
async transfer(purchaseOrder: GetPurchaseOrderDto) {
|
transfer() {
|
||||||
this.purchaseOrdersLoading.set(true);
|
return
|
||||||
try {
|
|
||||||
const today = new Date();
|
|
||||||
const date = today.toISOString().split('T')[0]; // yyyy-mm-dd
|
|
||||||
|
|
||||||
const futureDate = new Date(today);
|
|
||||||
futureDate.setMonth(today.getMonth() + 2);
|
|
||||||
const yyyy = futureDate.getFullYear();
|
|
||||||
const mm = (futureDate.getMonth() + 1).toString().padStart(2, '0');
|
|
||||||
const dd = futureDate.getDate().toString().padStart(2, '0');
|
|
||||||
const estimateDate = `${yyyy}-${mm}-${dd}`;
|
|
||||||
|
|
||||||
let trackingValue = 'TRK-';
|
|
||||||
const idStr = purchaseOrder.id?.toString() ?? '';
|
|
||||||
if (idStr.length < 2) trackingValue += '00' + idStr + '-' + date;
|
|
||||||
else if (idStr.length < 3) trackingValue += '0' + idStr + '-' + date;
|
|
||||||
else trackingValue += idStr.substring(0, 3) + date.replace(/-/g, '');
|
|
||||||
|
|
||||||
const productQuantities: Record<number, number> = {};
|
|
||||||
purchaseOrder.products?.forEach(p => {
|
|
||||||
if(p.productId != null && p.quantity != null) {
|
|
||||||
productQuantities[p.productId] = p.quantity;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const deliveryNoteDto: CreateDeliveryNoteDto = {
|
|
||||||
trackingNumber: trackingValue,
|
|
||||||
expeditionDate: date,
|
|
||||||
estimateDeliveryDate: estimateDate,
|
|
||||||
delivererId: 1,
|
|
||||||
productQuantities: productQuantities
|
|
||||||
};
|
|
||||||
|
|
||||||
await firstValueFrom(this.deliveryNoteService.createDeliveryNoteEndpoint(deliveryNoteDto));
|
|
||||||
this.notificationService.success('Succès', 'Bon de livraison créé avec succès');
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
this.notificationService.error('Erreur', 'Erreur lors du transfert');
|
|
||||||
}
|
|
||||||
this.purchaseOrdersLoading.set(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
async edit(id: number, updatePurchaseOrderComponent: PurchaseOrderForm) {
|
|
||||||
if (updatePurchaseOrderComponent.purchaseOrderForm.invalid) {
|
|
||||||
this.notificationService.error(
|
|
||||||
'Erreur',
|
|
||||||
'Erreur d\'écriture dans le formulaire'
|
|
||||||
)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const purchaseOrders = updatePurchaseOrderComponent.purchaseOrderForm.getRawValue();
|
|
||||||
await firstValueFrom(this.purchaseOrdersService.patchPurchaseOrderPurchaseConditionsEndpoint(id, purchaseOrders))
|
|
||||||
|
|
||||||
this.notificationService.success('Success', 'Bon de commande modifié')
|
|
||||||
} catch (e) {
|
|
||||||
this.notificationService.error('Erreur', 'Erreur lors de la modification')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async deleteProduct(productId: number, purchaseOrderId: number) {
|
|
||||||
this.purchaseOrdersLoading.set(true)
|
|
||||||
try {
|
|
||||||
await firstValueFrom(this.purchaseProductService.deletePurchaseProductEndpoint(productId, purchaseOrderId))
|
|
||||||
this.notificationService.success(
|
|
||||||
'Success',
|
|
||||||
'Suppression effectuée'
|
|
||||||
)
|
|
||||||
} catch (e) {
|
|
||||||
this.notificationService.error(
|
|
||||||
'Erreur',
|
|
||||||
'Impossible de supprimer la ligne'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
this.purchaseOrdersLoading.set(false)
|
|
||||||
await this.fetchPurchaseOrder();
|
|
||||||
}
|
|
||||||
|
|
||||||
async editQuantity(productId: number, purchaseOrderId: number, updateQuantityComponent: QuantityForm) {
|
|
||||||
if (updateQuantityComponent.quantityForm.invalid) {
|
|
||||||
this.notificationService.error(
|
|
||||||
'Erreur',
|
|
||||||
'Erreur d\'écriture dans le formulaire'
|
|
||||||
)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const quantity = updateQuantityComponent.quantityForm.getRawValue();
|
|
||||||
await firstValueFrom(this.purchaseProductService.patchPurchaseProductQuantityEndpoint(productId, purchaseOrderId, quantity))
|
|
||||||
|
|
||||||
this.notificationService.success('Success', 'Quantité modifiée')
|
|
||||||
} catch (e) {
|
|
||||||
this.notificationService.error('Erreur', 'Erreur lors de la modification')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
selectedPurchaseOrder: GetPurchaseOrderDto | null = null;
|
|
||||||
openEditModal(purchaseOrder: GetPurchaseOrderDto) {
|
|
||||||
this.selectedPurchaseOrder = { ...purchaseOrder };
|
|
||||||
this.modal().showModal();
|
|
||||||
}
|
|
||||||
|
|
||||||
async onModalOk(id: number, updatePurchaseOrderComponent: PurchaseOrderForm, modal: ModalNav) {
|
|
||||||
if (!this.selectedPurchaseOrder) return;
|
|
||||||
|
|
||||||
await this.edit(id, updatePurchaseOrderComponent);
|
|
||||||
updatePurchaseOrderComponent.purchaseOrderForm.reset();
|
|
||||||
modal.isVisible = false;
|
|
||||||
await this.fetchPurchaseOrder();
|
|
||||||
}
|
|
||||||
|
|
||||||
onModalCancel(modal: ModalNav) {
|
|
||||||
modal.isVisible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
selectedQuantity: GetPurchaseProductDto | null = null;
|
|
||||||
openEditQuantityModal(quantity: GetPurchaseProductDto) {
|
|
||||||
this.selectedQuantity = { ...quantity };
|
|
||||||
this.modalQuantity().showModal();
|
|
||||||
}
|
|
||||||
|
|
||||||
async onModalQuantityOk(productId: number, purchaseOrderId: number, updateQuantityComponent: QuantityForm, modal: ModalNav) {
|
|
||||||
if (!this.selectedQuantity) return;
|
|
||||||
|
|
||||||
await this.editQuantity(productId, purchaseOrderId, updateQuantityComponent);
|
|
||||||
updateQuantityComponent.quantityForm.reset();
|
|
||||||
modal.isVisible = false;
|
|
||||||
await this.fetchPurchaseOrder();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
<form nz-form nzLayout="horizontal" [formGroup]="quantityForm">
|
|
||||||
<nz-form-item nz-flex>
|
|
||||||
<nz-form-label nzSpan="9" nzRequired>
|
|
||||||
Quantité
|
|
||||||
</nz-form-label>
|
|
||||||
|
|
||||||
<nz-form-control nzSpan="12" nzErrorTip="Ce champ est requis">
|
|
||||||
<input nz-input type="number" placeholder="0" formControlName="quantity">
|
|
||||||
</nz-form-control>
|
|
||||||
</nz-form-item>
|
|
||||||
</form>
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
import {Component, effect, input} from '@angular/core';
|
|
||||||
import {FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators} from "@angular/forms";
|
|
||||||
import {NzColDirective} from "ng-zorro-antd/grid";
|
|
||||||
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
|
||||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
|
|
||||||
import {NzInputDirective} from "ng-zorro-antd/input";
|
|
||||||
import {GetDelivererDto, GetPurchaseProductDto} from "../../services/api";
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-quantity-form',
|
|
||||||
imports: [
|
|
||||||
FormsModule,
|
|
||||||
NzColDirective,
|
|
||||||
NzFlexDirective,
|
|
||||||
NzFormControlComponent,
|
|
||||||
NzFormDirective,
|
|
||||||
NzFormItemComponent,
|
|
||||||
NzFormLabelComponent,
|
|
||||||
NzInputDirective,
|
|
||||||
ReactiveFormsModule
|
|
||||||
],
|
|
||||||
templateUrl: './quantity-form.html',
|
|
||||||
styleUrl: './quantity-form.css',
|
|
||||||
})
|
|
||||||
export class QuantityForm {
|
|
||||||
quantityForm: FormGroup = new FormGroup({
|
|
||||||
quantity: new FormControl<number>(null, [Validators.required])
|
|
||||||
})
|
|
||||||
|
|
||||||
quantity= input<GetPurchaseProductDto>();
|
|
||||||
constructor() {
|
|
||||||
effect(() => {
|
|
||||||
if (this.quantity()) {
|
|
||||||
this.quantityForm.patchValue({
|
|
||||||
quantity: this.quantity().quantity
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
<form nz-form nzLayout="horizontal" [formGroup]="quotationForm">
|
<form nz-form nzLayout="horizontal" [formGroup]="QuotationForm">
|
||||||
<nz-form-item nz-flex>
|
<nz-form-item nz-flex>
|
||||||
<nz-form-label nzSpan="9">
|
<nz-form-label nzSpan="9">
|
||||||
Message du devis
|
Message du devis
|
||||||
</nz-form-label>
|
</nz-form-label>
|
||||||
|
|
||||||
<nz-form-control nzSpan="12">
|
<nz-form-control nzSpan="12">
|
||||||
<input nz-input placeholder="Message du devis" formControlName="message">
|
<input nz-input placeholder="Message du devis" formControlName="quotationMessage">
|
||||||
</nz-form-control>
|
</nz-form-control>
|
||||||
</nz-form-item>
|
</nz-form-item>
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
</nz-form-label>
|
</nz-form-label>
|
||||||
|
|
||||||
<nz-form-control nzSpan="12">
|
<nz-form-control nzSpan="12">
|
||||||
<input nz-input placeholder="Conditions de vente" formControlName="conditionsSale">
|
<input nz-input placeholder="Conditions de vente" formControlName="quotationConditionsSale">
|
||||||
</nz-form-control>
|
</nz-form-control>
|
||||||
</nz-form-item>
|
</nz-form-item>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import {Component, effect, input} from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from "@angular/forms";
|
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from "@angular/forms";
|
||||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
|
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
|
||||||
import {NzInputDirective} from "ng-zorro-antd/input";
|
import {NzInputDirective} from "ng-zorro-antd/input";
|
||||||
import {NzColDirective} from "ng-zorro-antd/grid";
|
import {NzColDirective} from "ng-zorro-antd/grid";
|
||||||
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
||||||
import {GetQuotationDto} from "../../services/api";
|
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-quotation-form',
|
selector: 'app-quotation-form',
|
||||||
@@ -22,20 +22,8 @@ import {GetQuotationDto} from "../../services/api";
|
|||||||
styleUrl: './quotation-form.css',
|
styleUrl: './quotation-form.css',
|
||||||
})
|
})
|
||||||
export class QuotationForm {
|
export class QuotationForm {
|
||||||
quotationForm: FormGroup = new FormGroup({
|
QuotationForm: FormGroup = new FormGroup({
|
||||||
message: new FormControl<string>(null, [Validators.required]),
|
quotationMessage: new FormControl<string>(null),
|
||||||
conditionsSale: new FormControl<string>(null, [Validators.required]),
|
quotationConditionsSale: new FormControl<string>(null),
|
||||||
})
|
})
|
||||||
|
|
||||||
quotation= input<GetQuotationDto>();
|
|
||||||
constructor() {
|
|
||||||
effect(() => {
|
|
||||||
if (this.quotation()) {
|
|
||||||
this.quotationForm.patchValue({
|
|
||||||
message: this.quotation().message,
|
|
||||||
conditionsSale: this.quotation().conditionsSale,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,17 +32,15 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="text-center">
|
<tbody class="text-center">
|
||||||
@for (product of quotation.products; track product.productId) {
|
@for (product of quotation.getQuotationProductDto; track product.productId) {
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ product.productReferences }}</td>
|
<td>{{ product.productReferences }}</td>
|
||||||
<td>{{ product.productName }}</td>
|
<td>{{ product.productName }}</td>
|
||||||
<td>Price ???</td>
|
<td>Price ???</td>
|
||||||
<td>{{ product.quantity }}</td>
|
<td>Quantité ???</td>
|
||||||
<td>
|
<td>
|
||||||
<div style="justify-content: center; display: flex">
|
<div style="justify-content: center; display: flex">
|
||||||
<nz-icon nzType="edit" nzTheme="outline" class="cursor-pointer" (click)="openEditQuantityModal(product)"></nz-icon>
|
<nz-icon nzType="delete" nzTheme="outline" class="cursor-pointer text-red-700"/>
|
||||||
<nz-divider nzType="vertical"></nz-divider>
|
|
||||||
<nz-icon nzType="delete" nzTheme="outline" class="cursor-pointer text-red-700" (click)="deleteProduct(product.productId, quotation.id)"/>
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -54,13 +52,21 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div style="justify-content: center; display: flex">
|
<div style="justify-content: center; display: flex">
|
||||||
<nz-icon nzType="plus-circle" nzTheme="outline" class="cursor-pointer text-green-700" />
|
<div>
|
||||||
|
<nz-icon nzType="plus-circle" nzTheme="outline" class="cursor-pointer text-green-700" />
|
||||||
|
</div>
|
||||||
<nz-divider nzType="vertical"></nz-divider>
|
<nz-divider nzType="vertical"></nz-divider>
|
||||||
<nz-icon nzType="edit" nzTheme="outline" class="cursor-pointer" (click)="openEditModal(quotation)"></nz-icon>
|
<app-modal-nav nameIcon="edit" name="Modification du devis" class="cursor-pointer">
|
||||||
|
<app-quotation-form></app-quotation-form>
|
||||||
|
</app-modal-nav>
|
||||||
<nz-divider nzType="vertical"></nz-divider>
|
<nz-divider nzType="vertical"></nz-divider>
|
||||||
<nz-icon nzType="delete" nzTheme="outline" class="cursor-pointer text-red-700" (click)="delete(quotation.id)"/>
|
<div>
|
||||||
|
<nz-icon nzType="delete" nzTheme="outline" class="cursor-pointer text-red-700" (click)="delete(quotation.id)"/>
|
||||||
|
</div>
|
||||||
<nz-divider nzType="vertical"></nz-divider>
|
<nz-divider nzType="vertical"></nz-divider>
|
||||||
<nz-icon nzType="export" (click)="export(quotation.id)" nzTheme="outline" class="cursor-pointer text-green-700"/>
|
<div>
|
||||||
|
<nz-icon nzType="export" (click)="export(quotation.id)" nzTheme="outline" class="cursor-pointer text-green-700"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -68,14 +74,3 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</nz-table>
|
</nz-table>
|
||||||
|
|
||||||
<div class="hidden">
|
|
||||||
<app-modal-nav #modalNav nameIcon="edit" [name]="'Modification du devis'" (ok)="onModalOk(selectedQuotation.id, quotationForm, modalNav)" (cancel)="onModalCancel(modalNav)">
|
|
||||||
<app-quotation-form #quotationForm [quotation]="selectedQuotation"></app-quotation-form>
|
|
||||||
</app-modal-nav>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="hidden">
|
|
||||||
<app-modal-nav #modalQuantity nameIcon="edit" [name]="'Modification de la quantité'" (ok)="onModalQuantityOk(selectedQuantity.productId, selectedQuantity.quotationId, quantityForm, modalQuantity)" (cancel)="onModalCancel(modalQuantity)">
|
|
||||||
<app-quantity-form #quantityForm [quantity]="selectedQuantity"></app-quantity-form>
|
|
||||||
</app-modal-nav>
|
|
||||||
</div>
|
|
||||||
@@ -1,20 +1,14 @@
|
|||||||
import {Component, inject, OnInit, signal, viewChild} from '@angular/core';
|
import {Component, inject, OnInit, signal} from '@angular/core';
|
||||||
import {NzTableComponent} from "ng-zorro-antd/table";
|
import {NzTableComponent} from "ng-zorro-antd/table";
|
||||||
import {ModalButton} from "../modal-button/modal-button";
|
import {ModalButton} from "../modal-button/modal-button";
|
||||||
import {ModalNav} from "../modal-nav/modal-nav";
|
import {ModalNav} from "../modal-nav/modal-nav";
|
||||||
import {NzDividerComponent} from "ng-zorro-antd/divider";
|
import {NzDividerComponent} from "ng-zorro-antd/divider";
|
||||||
import {NzIconDirective} from "ng-zorro-antd/icon";
|
import {NzIconDirective} from "ng-zorro-antd/icon";
|
||||||
import {QuotationForm} from "../quotation-form/quotation-form";
|
import {QuotationForm} from "../quotation-form/quotation-form";
|
||||||
import {
|
import {GetQuotationDto, QuotationsService} from "../../services/api";
|
||||||
GetQuotationDto,
|
|
||||||
GetQuotationProductDto,
|
|
||||||
QuotationproductsService,
|
|
||||||
QuotationsService
|
|
||||||
} from "../../services/api";
|
|
||||||
import {NzNotificationService} from "ng-zorro-antd/notification";
|
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||||
import {firstValueFrom} from "rxjs";
|
import {firstValueFrom} from "rxjs";
|
||||||
import {FileService} from "../../services/file.service";
|
import {FileService} from "../../services/file.service";
|
||||||
import {QuantityForm} from "../quantity-form/quantity-form";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-quotation-table',
|
selector: 'app-quotation-table',
|
||||||
@@ -25,7 +19,6 @@ import {QuantityForm} from "../quantity-form/quantity-form";
|
|||||||
NzIconDirective,
|
NzIconDirective,
|
||||||
NzTableComponent,
|
NzTableComponent,
|
||||||
QuotationForm,
|
QuotationForm,
|
||||||
QuantityForm,
|
|
||||||
],
|
],
|
||||||
templateUrl: './quotation-table.html',
|
templateUrl: './quotation-table.html',
|
||||||
styleUrl: './quotation-table.css',
|
styleUrl: './quotation-table.css',
|
||||||
@@ -34,12 +27,9 @@ import {QuantityForm} from "../quantity-form/quantity-form";
|
|||||||
export class QuotationTable implements OnInit {
|
export class QuotationTable implements OnInit {
|
||||||
private quotationsService = inject(QuotationsService);
|
private quotationsService = inject(QuotationsService);
|
||||||
private notificationService = inject(NzNotificationService);
|
private notificationService = inject(NzNotificationService);
|
||||||
private quotationProductsService = inject(QuotationproductsService)
|
|
||||||
private fileService = inject(FileService);
|
private fileService = inject(FileService);
|
||||||
quotations = signal<GetQuotationDto[]>([]);
|
quotations = signal<GetQuotationDto[]>([]);
|
||||||
quotationsLoading = signal<boolean>(false);
|
quotationsLoading = signal<boolean>(false);
|
||||||
modal = viewChild.required<ModalNav>('modalNav');
|
|
||||||
modalQuantity = viewChild.required<ModalNav>('modalQuantity');
|
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
await this.fetchQuotations();
|
await this.fetchQuotations();
|
||||||
@@ -94,92 +84,5 @@ export class QuotationTable implements OnInit {
|
|||||||
}
|
}
|
||||||
this.quotationsLoading.set(false)
|
this.quotationsLoading.set(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
async edit(id: number, updateQuotationComponent: QuotationForm) {
|
|
||||||
if (updateQuotationComponent.quotationForm.invalid) {
|
|
||||||
this.notificationService.error('Erreur', 'Formulaire invalide');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const quotations = updateQuotationComponent.quotationForm.getRawValue();
|
|
||||||
await firstValueFrom(this.quotationsService.updateQuotationEndpoint(id, quotations));
|
|
||||||
this.notificationService.success('Success', 'Devis modifié')
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e)
|
|
||||||
this.notificationService.error('Erreur', 'Erreur lors de la modification')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async deleteProduct(productId: number, quotationId: number) {
|
|
||||||
this.quotationsLoading.set(true)
|
|
||||||
try {
|
|
||||||
await firstValueFrom(this.quotationProductsService.deleteQuotationProductEndpoint(productId, quotationId))
|
|
||||||
this.notificationService.success(
|
|
||||||
'Success',
|
|
||||||
'Suppression effectuée'
|
|
||||||
)
|
|
||||||
} catch (e) {
|
|
||||||
this.notificationService.error(
|
|
||||||
'Erreur',
|
|
||||||
'Impossible de supprimer la ligne'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
this.quotationsLoading.set(false)
|
|
||||||
await this.fetchQuotations();
|
|
||||||
}
|
|
||||||
|
|
||||||
async editQuantity(productId: number, quotationId: number, updateQuantityComponent: QuantityForm) {
|
|
||||||
if (updateQuantityComponent.quantityForm.invalid) {
|
|
||||||
this.notificationService.error(
|
|
||||||
'Erreur',
|
|
||||||
'Erreur d\'écriture dans le formulaire'
|
|
||||||
)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const quantity = updateQuantityComponent.quantityForm.getRawValue();
|
|
||||||
await firstValueFrom(this.quotationProductsService.patchQuotationProductQuantityEndpoint(productId, quotationId, quantity))
|
|
||||||
|
|
||||||
this.notificationService.success('Success', 'Quantité modifiée')
|
|
||||||
} catch (e) {
|
|
||||||
this.notificationService.error('Erreur', 'Erreur lors de la modification')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
selectedQuotation: GetQuotationDto | null = null;
|
|
||||||
openEditModal(quotation: GetQuotationDto) {
|
|
||||||
this.selectedQuotation = { ...quotation };
|
|
||||||
this.modal().showModal();
|
|
||||||
}
|
|
||||||
|
|
||||||
async onModalOk(id: number, updateQuotationComponent: QuotationForm, modal: ModalNav) {
|
|
||||||
if (!this.selectedQuotation) return;
|
|
||||||
|
|
||||||
await this.edit(id, updateQuotationComponent);
|
|
||||||
updateQuotationComponent.quotationForm.reset();
|
|
||||||
modal.isVisible = false;
|
|
||||||
await this.fetchQuotations();
|
|
||||||
}
|
|
||||||
|
|
||||||
onModalCancel(modal: ModalNav) {
|
|
||||||
modal.isVisible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
selectedQuantity: GetQuotationProductDto | null = null;
|
|
||||||
openEditQuantityModal(quantity: GetQuotationProductDto) {
|
|
||||||
this.selectedQuantity = { ...quantity };
|
|
||||||
this.modalQuantity().showModal();
|
|
||||||
}
|
|
||||||
|
|
||||||
async onModalQuantityOk(productId: number, quotationId: number, updateQuantityComponent: QuantityForm, modal: ModalNav) {
|
|
||||||
if (!this.selectedQuantity) return;
|
|
||||||
|
|
||||||
await this.editQuantity(productId, quotationId, updateQuantityComponent);
|
|
||||||
updateQuantityComponent.quantityForm.reset();
|
|
||||||
modal.isVisible = false;
|
|
||||||
await this.fetchQuotations();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<form nz-form nzLayout="horizontal" [formGroup]="searchForm">
|
<form nz-form nzLayout="horizontal" [formGroup]="searchForm" (ngSubmit)="submitForm()">
|
||||||
<nz-form-item nz-flex>
|
<nz-form-item nz-flex>
|
||||||
<nz-form-control nzSpan="12">
|
<nz-form-control nzSpan="12">
|
||||||
<div class="group">
|
<div class="group">
|
||||||
<nz-icon nzType="search" nzTheme="outline" class="mr-2 text-xl" (click)="OnSearch()"></nz-icon>
|
<nz-icon nzType="search" nzTheme="outline" class="mr-2 text-xl"></nz-icon>
|
||||||
<input class="input" placeholder="Rechercher" formControlName="searchValue" (input)="OnSearch()"/>
|
<input class="input" placeholder="Rechercher" formControlName="searchValue"/>
|
||||||
</div>
|
</div>
|
||||||
</nz-form-control>
|
</nz-form-control>
|
||||||
</nz-form-item>
|
</nz-form-item>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Component, output } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import {NzIconDirective} from "ng-zorro-antd/icon";
|
import {NzIconDirective} from "ng-zorro-antd/icon";
|
||||||
import {NzColDirective} from "ng-zorro-antd/grid";
|
import {NzColDirective} from "ng-zorro-antd/grid";
|
||||||
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
||||||
@@ -24,12 +24,14 @@ export class Search {
|
|||||||
searchValue: new FormControl<string>(null)
|
searchValue: new FormControl<string>(null)
|
||||||
})
|
})
|
||||||
|
|
||||||
searchEvent = output<string>();
|
submitForm() {
|
||||||
|
// Pour annuler si le formulaire est invalide
|
||||||
|
if (this.searchForm.invalid) return;
|
||||||
|
|
||||||
OnSearch(): void {
|
// Pour obtenir la valeur du formulaire
|
||||||
const raw = this.searchForm.controls['searchValue'].value ?? '';
|
console.log(this.searchForm.getRawValue())
|
||||||
const value = String(raw).trim();
|
|
||||||
this.searchEvent.emit(value);
|
|
||||||
|
|
||||||
|
// Pour vider le formulaire
|
||||||
|
this.searchForm.reset()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<nz-table
|
<nz-table
|
||||||
[nzData]="filteredProducts()"
|
[nzData]="products()"
|
||||||
[nzFrontPagination]="false"
|
[nzFrontPagination]="false"
|
||||||
[nzLoading]="productsLoading()"
|
[nzLoading]="productsLoading()"
|
||||||
(nzCurrentPageDataChange)="onCurrentPageDataChange($event)"
|
(nzCurrentPageDataChange)="onCurrentPageDataChange($event)"
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody class="text-center">
|
<tbody class="text-center">
|
||||||
@for (product of filteredProducts(); track product.id) {
|
@for (product of products(); track product.id) {
|
||||||
<tr>
|
<tr>
|
||||||
<td nzWidth="40px">
|
<td nzWidth="40px">
|
||||||
<label
|
<label
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {Component, computed, inject, OnInit, output, signal, viewChild} from '@angular/core';
|
import {Component, inject, OnInit, output, signal, viewChild} from '@angular/core';
|
||||||
import {NzTableComponent, NzThMeasureDirective} from "ng-zorro-antd/table";
|
import {NzTableComponent, NzThMeasureDirective} from "ng-zorro-antd/table";
|
||||||
import {ModalNav} from "../modal-nav/modal-nav";
|
import {ModalNav} from "../modal-nav/modal-nav";
|
||||||
import {NzIconDirective} from "ng-zorro-antd/icon";
|
import {NzIconDirective} from "ng-zorro-antd/icon";
|
||||||
@@ -45,22 +45,6 @@ export class StockTable implements OnInit {
|
|||||||
selectionChange = output<boolean>()
|
selectionChange = output<boolean>()
|
||||||
currentPageData: GetProductDto[] = [];
|
currentPageData: GetProductDto[] = [];
|
||||||
|
|
||||||
private searchQuery = signal<string>('');
|
|
||||||
|
|
||||||
filteredProducts = computed(() => {
|
|
||||||
const q = this.searchQuery().toLowerCase().trim();
|
|
||||||
|
|
||||||
if (!q) return this.products();
|
|
||||||
|
|
||||||
return this.products().filter(s => {
|
|
||||||
const name = (s.name ?? '').toLowerCase();
|
|
||||||
return name.includes(q);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
applySearch(query: string) {
|
|
||||||
this.searchQuery.set(query);
|
|
||||||
}
|
|
||||||
get hasSelection(): boolean {
|
get hasSelection(): boolean {
|
||||||
return this.setOfCheckedId.size > 0;
|
return this.setOfCheckedId.size > 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<nz-table [nzData]="filteredSuppliers()"
|
<nz-table [nzData]="suppliers()"
|
||||||
[nzLoading]="suppliersLoading()"
|
[nzLoading]="suppliersLoading()"
|
||||||
[nzFrontPagination]="false">
|
[nzFrontPagination]="false">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody style="text-align: center">
|
<tbody style="text-align: center">
|
||||||
@for (supplier of filteredSuppliers(); track supplier.id) {
|
@for (supplier of suppliers(); track supplier.id) {
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ supplier.name }}</td>
|
<td>{{ supplier.name }}</td>
|
||||||
<td>{{ supplier.phone }}</td>
|
<td>{{ supplier.phone }}</td>
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
<td>{{ supplier.deliveryDelay }} jours</td>
|
<td>{{ supplier.deliveryDelay }} jours</td>
|
||||||
<td>
|
<td>
|
||||||
<app-modal-button type="link" [name]="'Voir les produits'" size="45%">
|
<app-modal-button type="link" [name]="'Voir les produits'" size="45%">
|
||||||
<nz-table [nzData]="filteredSuppliers()" [nzFrontPagination]="false">
|
<nz-table [nzData]="suppliers()" [nzFrontPagination]="false">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="text-center">
|
<tr class="text-center">
|
||||||
<th>Produit</th>
|
<th>Produit</th>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {Component, computed, inject, OnInit, signal, viewChild} from '@angular/core';
|
import {Component, inject, OnInit, signal, viewChild} from '@angular/core';
|
||||||
import {ModalNav} from "../modal-nav/modal-nav";
|
import {ModalNav} from "../modal-nav/modal-nav";
|
||||||
import {NzDividerComponent} from "ng-zorro-antd/divider";
|
import {NzDividerComponent} from "ng-zorro-antd/divider";
|
||||||
import {NzIconDirective} from "ng-zorro-antd/icon";
|
import {NzIconDirective} from "ng-zorro-antd/icon";
|
||||||
@@ -42,23 +42,6 @@ export class SupplierTable implements OnInit {
|
|||||||
await this.fetchSuppliers();
|
await this.fetchSuppliers();
|
||||||
}
|
}
|
||||||
|
|
||||||
private searchQuery = signal<string>('');
|
|
||||||
|
|
||||||
filteredSuppliers = computed(() => {
|
|
||||||
const q = this.searchQuery().toLowerCase().trim();
|
|
||||||
|
|
||||||
if (!q) return this.suppliers();
|
|
||||||
|
|
||||||
return this.suppliers().filter(s => {
|
|
||||||
const name = (s.name ?? '').toLowerCase();
|
|
||||||
return name.includes(q);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
applySearch(query: string) {
|
|
||||||
this.searchQuery.set(query);
|
|
||||||
}
|
|
||||||
|
|
||||||
async fetchSuppliers() {
|
async fetchSuppliers() {
|
||||||
this.suppliersLoading.set(true);
|
this.suppliersLoading.set(true);
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -105,7 +105,4 @@ export class UserTable implements OnInit {
|
|||||||
onModalCancel(modal: ModalNav) {
|
onModalCancel(modal: ModalNav) {
|
||||||
modal.isVisible = false;
|
modal.isVisible = false;
|
||||||
}
|
}
|
||||||
filterUser(input: string, option: any) {
|
|
||||||
return option.nzLabel.toLowerCase().includes(input.toLowerCase());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
<div class="flex mt-2">
|
<div class="flex mt-2">
|
||||||
|
<app-modal-button type="primary" name="Créer un bon de livraison" size="32%">
|
||||||
|
<app-deliverery-note-form></app-deliverery-note-form>
|
||||||
|
</app-modal-button>
|
||||||
|
|
||||||
<div class="ml-95 w-150">
|
<div class="ml-95 w-150">
|
||||||
<app-search></app-search>
|
<app-search></app-search>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import {Search} from "../../components/search/search";
|
|||||||
selector: 'app-delivery-note',
|
selector: 'app-delivery-note',
|
||||||
imports: [
|
imports: [
|
||||||
DelivereryNoteTable,
|
DelivereryNoteTable,
|
||||||
|
ModalButton,
|
||||||
|
DelivereryNoteForm,
|
||||||
Search
|
Search
|
||||||
],
|
],
|
||||||
templateUrl: './delivery-note.html',
|
templateUrl: './delivery-note.html',
|
||||||
|
|||||||
@@ -1,31 +1,16 @@
|
|||||||
<div class="flex mt-2">
|
<div class="flex mt-2">
|
||||||
@if (hasSelection) {
|
@if (hasSelection) {
|
||||||
<app-modal-button #modalButtonPurchaseOrder
|
<app-modal-button #modalButton type="default" name="Créer un bon de commande" size="35%" class="ml-4">
|
||||||
(click)="openPurchaseOrderForm()"
|
<app-purchase-order-form #purchaseOrderForm></app-purchase-order-form>
|
||||||
(ok)="onModalOk()"
|
|
||||||
(cancel)="onModalCancel()"
|
|
||||||
type="default"
|
|
||||||
name="Créer un bon de commande"
|
|
||||||
size="35%"
|
|
||||||
class="ml-4">
|
|
||||||
<app-create-purchaseorder-form #purchaseOrderForm></app-create-purchaseorder-form>
|
|
||||||
</app-modal-button>
|
</app-modal-button>
|
||||||
|
|
||||||
<app-modal-button #modalButtonQuotation
|
<app-modal-button #modalButton type="default" name="Créer un devis" size="35%" class="ml-4" (click)="test()">
|
||||||
type="default"
|
<app-quotation-form #quotationForm></app-quotation-form>
|
||||||
name="Créer un devis"
|
|
||||||
size="35%"
|
|
||||||
class="ml-4"
|
|
||||||
(click)="openQuotationForm()"
|
|
||||||
(ok)="onModalQuotationOk()"
|
|
||||||
(cancel)="onModalQuotationCancel()">
|
|
||||||
<app-create-quotation-form #quotationForm></app-create-quotation-form>
|
|
||||||
</app-modal-button>
|
</app-modal-button>
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="ml-95 w-150">
|
<div class="ml-95 w-150">
|
||||||
<app-search (searchEvent)="onProductSearch($event)"></app-search>
|
<app-search class="w-full"></app-search>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,11 @@ import {Component, inject, viewChild} from '@angular/core';
|
|||||||
import {StockTable} from "../../components/stock-table/stock-table";
|
import {StockTable} from "../../components/stock-table/stock-table";
|
||||||
import {Search} from "../../components/search/search";
|
import {Search} from "../../components/search/search";
|
||||||
import {ModalButton} from "../../components/modal-button/modal-button";
|
import {ModalButton} from "../../components/modal-button/modal-button";
|
||||||
|
import {PurchaseOrderForm} from "../../components/purchase-order-form/purchase-order-form";
|
||||||
import {QuotationForm} from "../../components/quotation-form/quotation-form";
|
import {QuotationForm} from "../../components/quotation-form/quotation-form";
|
||||||
import {PurchaseordersService, QuotationsService} from "../../services/api";
|
import {ProductsService} from "../../services/api";
|
||||||
import {NzNotificationService} from "ng-zorro-antd/notification";
|
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||||
import {firstValueFrom} from "rxjs";
|
import {firstValueFrom} from "rxjs";
|
||||||
import {CreatePurchaseorderForm} from "../../components/create-purchaseorder-form/create-purchaseorder-form";
|
|
||||||
import {CreateQuotationForm} from "../../components/create-quotation-form/create-quotation-form";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-stock',
|
selector: 'app-stock',
|
||||||
@@ -15,22 +14,55 @@ import {CreateQuotationForm} from "../../components/create-quotation-form/create
|
|||||||
StockTable,
|
StockTable,
|
||||||
Search,
|
Search,
|
||||||
ModalButton,
|
ModalButton,
|
||||||
CreatePurchaseorderForm,
|
PurchaseOrderForm,
|
||||||
CreateQuotationForm,
|
QuotationForm,
|
||||||
],
|
],
|
||||||
templateUrl: './stock.html',
|
templateUrl: './stock.html',
|
||||||
styleUrl: './stock.css',
|
styleUrl: './stock.css',
|
||||||
})
|
})
|
||||||
|
|
||||||
export class Stock {
|
export class Stock {
|
||||||
createPurchaseOrder = viewChild.required<CreatePurchaseorderForm>('purchaseOrderForm');
|
modal = viewChild.required<ModalButton>('modalButton');
|
||||||
createQuotation = viewChild.required<CreateQuotationForm>('quotationForm');
|
createQuotation = viewChild.required<QuotationForm>('quotationForm');
|
||||||
|
createPurchaseOrder = viewChild.required<PurchaseOrderForm>('purchaseOrderForm');
|
||||||
productTable = viewChild.required<StockTable>('stockTable');
|
productTable = viewChild.required<StockTable>('stockTable');
|
||||||
private purchaseordersService = inject(PurchaseordersService)
|
private productsService = inject(ProductsService);
|
||||||
private quotationsService = inject(QuotationsService)
|
|
||||||
private notificationService = inject(NzNotificationService)
|
private notificationService = inject(NzNotificationService)
|
||||||
modalButtonPurchaseOrder = viewChild.required<ModalButton>('modalButtonPurchaseOrder');
|
|
||||||
modalButtonQuotation = viewChild.required<ModalButton>('modalButtonQuotation');
|
// async onModalOk() {
|
||||||
|
// await this.addSupplier()
|
||||||
|
// this.createSupplier().supplierForm.reset();
|
||||||
|
// this.modal().isVisible = false;
|
||||||
|
// await this.supplierTable().fetchSuppliers()
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// onModalCancel() {
|
||||||
|
// this.modal().isVisible = false;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// async addSupplier() {
|
||||||
|
// if (this.createSupplier().supplierForm.invalid)
|
||||||
|
// {
|
||||||
|
// this.notificationService.error(
|
||||||
|
// 'Erreur',
|
||||||
|
// 'Erreur d\'écriture dans le formulaire'
|
||||||
|
// )
|
||||||
|
// }
|
||||||
|
// try {
|
||||||
|
// const suppliers = this.createSupplier().supplierForm.getRawValue();
|
||||||
|
// await firstValueFrom(this.usersService.createSupplierEndpoint(suppliers))
|
||||||
|
//
|
||||||
|
// this.notificationService.success(
|
||||||
|
// 'Success',
|
||||||
|
// 'Fournisseur enregistré'
|
||||||
|
// )
|
||||||
|
// } catch (e) {
|
||||||
|
// this.notificationService.error(
|
||||||
|
// 'Erreur',
|
||||||
|
// 'Erreur d\'enregistrement'
|
||||||
|
// )
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
hasSelection = false;
|
hasSelection = false;
|
||||||
|
|
||||||
@@ -38,101 +70,8 @@ export class Stock {
|
|||||||
this.hasSelection = value;
|
this.hasSelection = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
onProductSearch(query: string) {
|
test(){
|
||||||
this.productTable().applySearch(query);
|
console.log(this.productTable().selectedIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
async addPurchaseOrder() {
|
|
||||||
const form = this.createPurchaseOrder().createPurchaseOrderForm;
|
|
||||||
if (form.invalid) {
|
|
||||||
this.notificationService.error('Erreur', 'Formulaire invalide');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const orderLines = this.createPurchaseOrder().lines.value.map(line => ({
|
|
||||||
productId: line.productId,
|
|
||||||
quantity: line.quantity
|
|
||||||
}));
|
|
||||||
if (orderLines.length === 0) {
|
|
||||||
this.notificationService.error('Erreur', 'Aucun produit sélectionné');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const purchaseOrder = {
|
|
||||||
purchaseConditions: form.get('purchaseConditions')!.value,
|
|
||||||
products: orderLines
|
|
||||||
};
|
|
||||||
try {
|
|
||||||
await firstValueFrom(
|
|
||||||
this.purchaseordersService.createPurchaseOrder(purchaseOrder)
|
|
||||||
);
|
|
||||||
this.notificationService.success('Succès', 'Bon de commande créé');
|
|
||||||
} catch (e) {
|
|
||||||
this.notificationService.error('Erreur', 'Erreur lors de la création du bon de commande.');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
async onModalOk() {
|
|
||||||
await this.addPurchaseOrder();
|
|
||||||
this.createPurchaseOrder().createPurchaseOrderForm.reset();
|
|
||||||
this.modalButtonPurchaseOrder().isVisible = false;
|
|
||||||
await this.productTable().fetchProducts();
|
|
||||||
}
|
|
||||||
|
|
||||||
onModalCancel() {
|
|
||||||
this.modalButtonPurchaseOrder().isVisible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
openPurchaseOrderForm() {
|
|
||||||
const selectedProducts = this.productTable().products().filter(p =>
|
|
||||||
this.productTable().selectedIds.includes(p.id)
|
|
||||||
);
|
|
||||||
this.createPurchaseOrder().syncSelectedProducts(selectedProducts);
|
|
||||||
}
|
|
||||||
|
|
||||||
async addQuotation() {
|
|
||||||
if (this.createQuotation().createQuotationForm.invalid) {
|
|
||||||
this.notificationService.error('Erreur', 'Formulaire invalide');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const orderLines = this.createQuotation().lines.value.map(line => ({
|
|
||||||
productId: line.productId,
|
|
||||||
quantity: line.quantity
|
|
||||||
}));
|
|
||||||
if (orderLines.length === 0) {
|
|
||||||
this.notificationService.error('Erreur', 'Aucun produit sélectionné');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const quotation = {
|
|
||||||
message: this.createQuotation().createQuotationForm.get('message')!.value,
|
|
||||||
purchaseConditions: this.createQuotation().createQuotationForm.get('purchaseConditions')!.value,
|
|
||||||
products: orderLines
|
|
||||||
};
|
|
||||||
try {
|
|
||||||
await firstValueFrom(
|
|
||||||
this.quotationsService.createQuotationEndpoint(quotation)
|
|
||||||
);
|
|
||||||
this.notificationService.success('Succès', 'Devis créé');
|
|
||||||
} catch (e) {
|
|
||||||
this.notificationService.error('Erreur', 'Erreur lors de la création du devis.');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
async onModalQuotationOk() {
|
|
||||||
await this.addQuotation();
|
|
||||||
this.createQuotation().createQuotationForm.reset();
|
|
||||||
this.modalButtonQuotation().isVisible = false;
|
|
||||||
await this.productTable().fetchProducts();
|
|
||||||
}
|
|
||||||
|
|
||||||
onModalQuotationCancel() {
|
|
||||||
this.modalButtonQuotation().isVisible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
openQuotationForm() {
|
|
||||||
const selectedProducts = this.productTable().products().filter(p =>
|
|
||||||
this.productTable().selectedIds.includes(p.id)
|
|
||||||
);
|
|
||||||
this.createQuotation().syncSelectedProducts(selectedProducts);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,9 @@
|
|||||||
|
|
||||||
<app-supplier-form #supplierForm></app-supplier-form>
|
<app-supplier-form #supplierForm></app-supplier-form>
|
||||||
</app-modal-button>
|
</app-modal-button>
|
||||||
|
|
||||||
<div class="ml-95 w-150">
|
<div class="ml-95 w-150">
|
||||||
<app-search (searchEvent)="onSupplierSearch($event)"></app-search>
|
<app-search></app-search>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -36,10 +36,6 @@ export class Supplier {
|
|||||||
this.modal().isVisible = false;
|
this.modal().isVisible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
onSupplierSearch(query: string) {
|
|
||||||
this.supplierTable().applySearch(query);
|
|
||||||
}
|
|
||||||
|
|
||||||
async addSupplier() {
|
async addSupplier() {
|
||||||
if (this.createSupplier().supplierForm.invalid)
|
if (this.createSupplier().supplierForm.invalid)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
type="primary"
|
type="primary"
|
||||||
name="Ajouter un utilisateur"
|
name="Ajouter un utilisateur"
|
||||||
(ok)="onModalOk()"
|
(ok)="onModalOk()"
|
||||||
(cancel)="onModalCancel()"
|
(cancel)="onModalCancel()">
|
||||||
size="35%">
|
|
||||||
|
|
||||||
<app-profil-form #profilForm></app-profil-form>
|
<app-profil-form #profilForm></app-profil-form>
|
||||||
</app-modal-button>
|
</app-modal-button>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<div class="flex gap-17 ml-20">
|
<div class="flex gap-17 ml-20">
|
||||||
<app-info-card color="#f59e0b" icon="inbox" value="15" description="Produits sous le seuil minimal."></app-info-card>
|
<app-info-card color="#f59e0b" icon="inbox" [value]="productsUnderLimitCount()" description="Produits sous le seuil minimal."></app-info-card>
|
||||||
<app-info-card color="#3b82f6" icon="team" value="56" description="Partenaires actifs."></app-info-card>
|
<app-info-card color="#3b82f6" icon="team" [value]="deliversCount()+suppliersCount()" description="Partenaires actifs."></app-info-card>
|
||||||
<app-info-card color="#10b981" icon="truck" value="8" description="Livreurs partenaires."></app-info-card>
|
<app-info-card color="#10b981" icon="truck" [value]=deliversCount() description="Livreurs partenaires."></app-info-card>
|
||||||
<app-info-card color="#ef4444" icon="shop" value="48" description="Fournisseurs travaillant avec nous."></app-info-card>
|
<app-info-card color="#ef4444" icon="shop" [value]="suppliersCount()" description="Fournisseurs partenaires."></app-info-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-10 flex gap-30">
|
<div class="mt-10 flex gap-30">
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
import { Component } from '@angular/core';
|
import {Component, inject, OnInit, signal} from '@angular/core';
|
||||||
import {InfoCard} from "../../components/info-card/info-card";
|
import {InfoCard} from "../../components/info-card/info-card";
|
||||||
import {DeliveryValidator} from "../../components/delivery-validator/delivery-validator";
|
import {DeliveryValidator} from "../../components/delivery-validator/delivery-validator";
|
||||||
import {InfoTable} from "../../components/info-table/info-table";
|
import {InfoTable} from "../../components/info-table/info-table";
|
||||||
|
import {DeliverersService, ProductsService, SuppliersService} from "../../services/api";
|
||||||
|
import {firstValueFrom} from "rxjs";
|
||||||
|
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-welcome',
|
selector: 'app-welcome',
|
||||||
@@ -14,6 +17,55 @@ import {InfoTable} from "../../components/info-table/info-table";
|
|||||||
styleUrl: './welcome.css'
|
styleUrl: './welcome.css'
|
||||||
})
|
})
|
||||||
|
|
||||||
export class Welcome {
|
export class Welcome implements OnInit {
|
||||||
|
private productsService = inject(ProductsService);
|
||||||
|
private deliverersService = inject(DeliverersService);
|
||||||
|
private suppliersService = inject(SuppliersService);
|
||||||
|
private notificationsService = inject(NzNotificationService);
|
||||||
|
|
||||||
|
deliversCount = signal<number>(0);
|
||||||
|
suppliersCount = signal<number>(0);
|
||||||
|
productsUnderLimitCount = signal<number>(0);
|
||||||
|
|
||||||
|
async getDeliverers() {
|
||||||
|
try{
|
||||||
|
const deliverers = await firstValueFrom(this.deliverersService.getAllDelivererEndpoint());
|
||||||
|
this.deliversCount.set(deliverers.length);
|
||||||
|
}catch(e){
|
||||||
|
this.notificationsService.error(
|
||||||
|
'Error',
|
||||||
|
'Error while getting deliverers.',
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async getSuppliers() {
|
||||||
|
try{
|
||||||
|
const suppliers = await firstValueFrom(this.suppliersService.getAllSuppliersEndpoint());
|
||||||
|
this.suppliersCount.set(suppliers.length);
|
||||||
|
}catch(e){
|
||||||
|
this.notificationsService.error(
|
||||||
|
'Error',
|
||||||
|
'Error while getting suppliers.',
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async getProductsUnderLimit(){
|
||||||
|
try{
|
||||||
|
const products = await firstValueFrom(this.productsService.getAllProductsUnderLimitEndpoint());
|
||||||
|
this.productsUnderLimitCount.set(products.length);
|
||||||
|
}catch(e){
|
||||||
|
this.notificationsService.error(
|
||||||
|
'Error',
|
||||||
|
'Error while getting products.',
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async ngOnInit() {
|
||||||
|
await this.getDeliverers();
|
||||||
|
await this.getSuppliers();
|
||||||
|
await this.getProductsUnderLimit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
.gitignore
|
.gitignore
|
||||||
|
.openapi-generator-ignore
|
||||||
README.md
|
README.md
|
||||||
api.base.service.ts
|
api.base.service.ts
|
||||||
api.module.ts
|
api.module.ts
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { CustomHttpParameterCodec } from './encoder';
|
|||||||
import { Configuration } from './configuration';
|
import { Configuration } from './configuration';
|
||||||
|
|
||||||
export class BaseService {
|
export class BaseService {
|
||||||
protected basePath = 'https://localhost:44379';
|
protected basePath = 'http://localhost:5298';
|
||||||
public defaultHeaders = new HttpHeaders();
|
public defaultHeaders = new HttpHeaders();
|
||||||
public configuration: Configuration;
|
public configuration: Configuration;
|
||||||
public encoder: HttpParameterCodec;
|
public encoder: HttpParameterCodec;
|
||||||
|
|||||||
@@ -11,11 +11,11 @@
|
|||||||
|
|
||||||
export interface GetProductDeliveryDto {
|
export interface GetProductDeliveryDto {
|
||||||
productId?: number;
|
productId?: number;
|
||||||
productReference?: string | null;
|
productReference?: number;
|
||||||
productName?: string | null;
|
productName?: string | null;
|
||||||
productDuration?: number;
|
productDuration?: number;
|
||||||
productCaliber?: number;
|
productCaliber?: number;
|
||||||
productApprovalNumber?: string | null;
|
productApprovalNumber?: number;
|
||||||
productWeight?: number;
|
productWeight?: number;
|
||||||
productNec?: number;
|
productNec?: number;
|
||||||
productImage?: string | null;
|
productImage?: string | null;
|
||||||
|
|||||||
Reference in New Issue
Block a user