diff --git a/package-lock.json b/package-lock.json index 6331994..cff4cb2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,9 +8,11 @@ "name": "auto", "version": "0.1.0", "dependencies": { + "date-fns": "^4.1.0", "next": "15.1.5", "react": "^19.0.0", "react-dom": "^19.0.0", + "react-select": "^5.10.0", "react-select2": "^4.0.3", "react-select2-wrapper": "^1.0.4-beta6", "select2": "^4.1.0-rc.0" @@ -39,6 +41,137 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@babel/code-frame": { + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", + "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", + "dependencies": { + "@babel/helper-validator-identifier": "^7.25.9", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/generator": { + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.5.tgz", + "integrity": "sha512-2caSP6fN9I7HOe6nqhtft7V4g7/V/gfDsC3Ag4W7kEzzvRGKqiv0pu0HogPiZ3KaVSoNDhUws6IJjDjpfmYIXw==", + "dependencies": { + "@babel/parser": "^7.26.5", + "@babel/types": "^7.26.5", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz", + "integrity": "sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==", + "dependencies": { + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", + "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", + "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.26.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.7.tgz", + "integrity": "sha512-kEvgGGgEjRUutvdVvZhbn/BxVt+5VSpwXz1j3WYXQbXDo8KzFOPNG2GQbdAiNq8g6wn1yKk7C/qrke03a84V+w==", + "dependencies": { + "@babel/types": "^7.26.7" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.26.7", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.7.tgz", + "integrity": "sha512-AOPI3D+a8dXnja+iwsUqGRjr1BbZIe771sXdapOtYI531gSqpi92vXivKcq2asu/DFpdl1ceFAKZyRzK2PCVcQ==", + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/template": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.9.tgz", + "integrity": "sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==", + "dependencies": { + "@babel/code-frame": "^7.25.9", + "@babel/parser": "^7.25.9", + "@babel/types": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.26.7", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.7.tgz", + "integrity": "sha512-1x1sgeyRLC3r5fQOM0/xtQKsYjyxmFjaOrLJNtZ81inNjyJHGIolTULPiSc/2qe1/qfpFLisLQYFnnZl7QoedA==", + "dependencies": { + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.5", + "@babel/parser": "^7.26.7", + "@babel/template": "^7.25.9", + "@babel/types": "^7.26.7", + "debug": "^4.3.1", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse/node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/types": { + "version": "7.26.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.7.tgz", + "integrity": "sha512-t8kDRGrKXyp6+tjUh7hw2RLyclsW4TRoRvRHtSyAX9Bb5ldlFh+90YAYY6awRXrlB4G5G2izNeGySpATlFzmOg==", + "dependencies": { + "@babel/helper-string-parser": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@emnapi/runtime": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.3.1.tgz", @@ -48,6 +181,109 @@ "tslib": "^2.4.0" } }, + "node_modules/@emotion/babel-plugin": { + "version": "11.13.5", + "resolved": "https://registry.npmjs.org/@emotion/babel-plugin/-/babel-plugin-11.13.5.tgz", + "integrity": "sha512-pxHCpT2ex+0q+HH91/zsdHkw/lXd468DIN2zvfvLtPKLLMo6gQj7oLObq8PhkrxOZb/gGCq03S3Z7PDhS8pduQ==", + "dependencies": { + "@babel/helper-module-imports": "^7.16.7", + "@babel/runtime": "^7.18.3", + "@emotion/hash": "^0.9.2", + "@emotion/memoize": "^0.9.0", + "@emotion/serialize": "^1.3.3", + "babel-plugin-macros": "^3.1.0", + "convert-source-map": "^1.5.0", + "escape-string-regexp": "^4.0.0", + "find-root": "^1.1.0", + "source-map": "^0.5.7", + "stylis": "4.2.0" + } + }, + "node_modules/@emotion/cache": { + "version": "11.14.0", + "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.14.0.tgz", + "integrity": "sha512-L/B1lc/TViYk4DcpGxtAVbx0ZyiKM5ktoIyafGkH6zg/tj+mA+NE//aPYKG0k8kCHSHVJrpLpcAlOBEXQ3SavA==", + "dependencies": { + "@emotion/memoize": "^0.9.0", + "@emotion/sheet": "^1.4.0", + "@emotion/utils": "^1.4.2", + "@emotion/weak-memoize": "^0.4.0", + "stylis": "4.2.0" + } + }, + "node_modules/@emotion/hash": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.9.2.tgz", + "integrity": "sha512-MyqliTZGuOm3+5ZRSaaBGP3USLw6+EGykkwZns2EPC5g8jJ4z9OrdZY9apkl3+UP9+sdz76YYkwCKP5gh8iY3g==" + }, + "node_modules/@emotion/memoize": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.9.0.tgz", + "integrity": "sha512-30FAj7/EoJ5mwVPOWhAyCX+FPfMDrVecJAM+Iw9NRoSl4BBAQeqj4cApHHUXOVvIPgLVDsCFoz/hGD+5QQD1GQ==" + }, + "node_modules/@emotion/react": { + "version": "11.14.0", + "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.14.0.tgz", + "integrity": "sha512-O000MLDBDdk/EohJPFUqvnp4qnHeYkVP5B0xEG0D/L7cOKP9kefu2DXn8dj74cQfsEzUqh+sr1RzFqiL1o+PpA==", + "dependencies": { + "@babel/runtime": "^7.18.3", + "@emotion/babel-plugin": "^11.13.5", + "@emotion/cache": "^11.14.0", + "@emotion/serialize": "^1.3.3", + "@emotion/use-insertion-effect-with-fallbacks": "^1.2.0", + "@emotion/utils": "^1.4.2", + "@emotion/weak-memoize": "^0.4.0", + "hoist-non-react-statics": "^3.3.1" + }, + "peerDependencies": { + "react": ">=16.8.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@emotion/serialize": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.3.3.tgz", + "integrity": "sha512-EISGqt7sSNWHGI76hC7x1CksiXPahbxEOrC5RjmFRJTqLyEK9/9hZvBbiYn70dw4wuwMKiEMCUlR6ZXTSWQqxA==", + "dependencies": { + "@emotion/hash": "^0.9.2", + "@emotion/memoize": "^0.9.0", + "@emotion/unitless": "^0.10.0", + "@emotion/utils": "^1.4.2", + "csstype": "^3.0.2" + } + }, + "node_modules/@emotion/sheet": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.4.0.tgz", + "integrity": "sha512-fTBW9/8r2w3dXWYM4HCB1Rdp8NLibOw2+XELH5m5+AkWiL/KqYX6dc0kKYlaYyKjrQ6ds33MCdMPEwgs2z1rqg==" + }, + "node_modules/@emotion/unitless": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.10.0.tgz", + "integrity": "sha512-dFoMUuQA20zvtVTuxZww6OHoJYgrzfKM1t52mVySDJnMSEa08ruEvdYQbhvyu6soU+NeLVd3yKfTfT0NeV6qGg==" + }, + "node_modules/@emotion/use-insertion-effect-with-fallbacks": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@emotion/use-insertion-effect-with-fallbacks/-/use-insertion-effect-with-fallbacks-1.2.0.tgz", + "integrity": "sha512-yJMtVdH59sxi/aVJBpk9FQq+OR8ll5GT8oWd57UpeaKEVGab41JWaCFA7FRLoMLloOZF/c/wsPoe+bfGmRKgDg==", + "peerDependencies": { + "react": ">=16.8.0" + } + }, + "node_modules/@emotion/utils": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.4.2.tgz", + "integrity": "sha512-3vLclRofFziIa3J2wDh9jjbkUz9qk5Vi3IZ/FSTKViB0k+ef0fPV7dYrUIugbgupYDx7v9ud/SjrtEP8Y4xLoA==" + }, + "node_modules/@emotion/weak-memoize": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.4.0.tgz", + "integrity": "sha512-snKqtPW01tN0ui7yu9rGv69aJXr/a/Ywvl11sUjNtEcRc+ng/mQriFL0wLXMef74iHa/EkftbDzU9F8iFbH+zg==" + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz", @@ -167,6 +403,28 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, + "node_modules/@floating-ui/core": { + "version": "1.6.9", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.6.9.tgz", + "integrity": "sha512-uMXCuQ3BItDUbAMhIXw7UPXRfAlOAvZzdK9BWpE60MCn+Svt3aLn9jsPTi/WNGlRUu2uI0v5S7JiIUsbsvh3fw==", + "dependencies": { + "@floating-ui/utils": "^0.2.9" + } + }, + "node_modules/@floating-ui/dom": { + "version": "1.6.13", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.6.13.tgz", + "integrity": "sha512-umqzocjDgNRGTuO7Q8CU32dkHkECqI8ZdMZ5Swb6QAM0t5rnlrN3lGo1hdpscRd3WS8T6DKYK4ephgIH9iRh3w==", + "dependencies": { + "@floating-ui/core": "^1.6.0", + "@floating-ui/utils": "^0.2.9" + } + }, + "node_modules/@floating-ui/utils": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.9.tgz", + "integrity": "sha512-MDWhGtE+eHw5JW7lq4qhc5yRLS11ERl1c7Z6Xd0a58DozHES6EnNNwUWbMiG4J9Cgj053Bhk8zvlhFYKVhULwg==" + }, "node_modules/@humanfs/core": { "version": "0.19.1", "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", @@ -591,7 +849,6 @@ "version": "0.3.8", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", - "dev": true, "dependencies": { "@jridgewell/set-array": "^1.2.1", "@jridgewell/sourcemap-codec": "^1.4.10", @@ -605,7 +862,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", - "dev": true, "engines": { "node": ">=6.0.0" } @@ -614,7 +870,6 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", - "dev": true, "engines": { "node": ">=6.0.0" } @@ -622,14 +877,12 @@ "node_modules/@jridgewell/sourcemap-codec": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", - "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", - "dev": true + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==" }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.25", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", - "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" @@ -875,11 +1128,15 @@ "undici-types": "~6.19.2" } }, + "node_modules/@types/parse-json": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz", + "integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==" + }, "node_modules/@types/react": { "version": "19.0.7", "resolved": "https://registry.npmjs.org/@types/react/-/react-19.0.7.tgz", "integrity": "sha512-MoFsEJKkAtZCrC1r6CM8U22GzhG7u2Wir8ons/aCKH6MBdD1ibV24zOSSkdZVUKqN5i396zG5VKLYZ3yaUZdLA==", - "dev": true, "dependencies": { "csstype": "^3.0.2" } @@ -893,6 +1150,14 @@ "@types/react": "^19.0.0" } }, + "node_modules/@types/react-transition-group": { + "version": "4.4.12", + "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.12.tgz", + "integrity": "sha512-8TV6R3h2j7a91c+1DXdJi3Syo69zzIZbz7Lg5tORM5LEJG7X/E6a1V3drRyBRZq7/utz7A+c4OgYLiLcYGHG6w==", + "peerDependencies": { + "@types/react": "*" + } + }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "8.21.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.21.0.tgz", @@ -1415,6 +1680,20 @@ "node": ">= 0.4" } }, + "node_modules/babel-plugin-macros": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz", + "integrity": "sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==", + "dependencies": { + "@babel/runtime": "^7.12.5", + "cosmiconfig": "^7.0.0", + "resolve": "^1.19.0" + }, + "engines": { + "node": ">=10", + "npm": ">=6" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -1517,7 +1796,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true, "engines": { "node": ">=6" } @@ -1663,6 +1941,11 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, + "node_modules/convert-source-map": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", + "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==" + }, "node_modules/core-js": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", @@ -1670,6 +1953,29 @@ "deprecated": "core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.", "peer": true }, + "node_modules/cosmiconfig": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", + "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", + "dependencies": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/cosmiconfig/node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "engines": { + "node": ">= 6" + } + }, "node_modules/create-react-class": { "version": "15.7.0", "resolved": "https://registry.npmjs.org/create-react-class/-/create-react-class-15.7.0.tgz", @@ -1709,8 +2015,7 @@ "node_modules/csstype": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", - "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", - "dev": true + "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==" }, "node_modules/damerau-levenshtein": { "version": "1.0.8", @@ -1769,11 +2074,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/date-fns": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.1.0.tgz", + "integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/kossnocorp" + } + }, "node_modules/debug": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", - "dev": true, "dependencies": { "ms": "^2.1.3" }, @@ -1859,6 +2172,15 @@ "node": ">=0.10.0" } }, + "node_modules/dom-helpers": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz", + "integrity": "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==", + "dependencies": { + "@babel/runtime": "^7.8.7", + "csstype": "^3.0.2" + } + }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", @@ -1907,6 +2229,19 @@ "node": ">=10.13.0" } }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/error-ex/node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==" + }, "node_modules/es-abstract": { "version": "1.23.9", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.9.tgz", @@ -2074,7 +2409,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true, "engines": { "node": ">=10" }, @@ -2608,6 +2942,11 @@ "node": ">=8" } }, + "node_modules/find-root": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz", + "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==" + }, "node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", @@ -2686,7 +3025,6 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -2973,7 +3311,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "dev": true, "dependencies": { "function-bind": "^1.1.2" }, @@ -2981,6 +3318,14 @@ "node": ">= 0.4" } }, + "node_modules/hoist-non-react-statics": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", + "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==", + "dependencies": { + "react-is": "^16.7.0" + } + }, "node_modules/iconv-lite": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", @@ -3006,7 +3351,6 @@ "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "dev": true, "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" @@ -3150,7 +3494,6 @@ "version": "2.16.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", - "dev": true, "dependencies": { "hasown": "^2.0.2" }, @@ -3525,12 +3868,28 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/json-buffer": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", "dev": true }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" + }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -3625,8 +3984,7 @@ "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "dev": true + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" }, "node_modules/locate-path": { "version": "6.0.0", @@ -3675,6 +4033,11 @@ "node": ">= 0.4" } }, + "node_modules/memoize-one": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-6.0.0.tgz", + "integrity": "sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw==" + }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -3730,8 +4093,7 @@ "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "node_modules/mz": { "version": "2.7.0", @@ -4062,7 +4424,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, "dependencies": { "callsites": "^3.0.0" }, @@ -4070,6 +4431,23 @@ "node": ">=6" } }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -4091,8 +4469,7 @@ "node_modules/path-parse": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, "node_modules/path-scurry": { "version": "1.11.1", @@ -4110,6 +4487,14 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "engines": { + "node": ">=8" + } + }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -4378,6 +4763,26 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, + "node_modules/react-select": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/react-select/-/react-select-5.10.0.tgz", + "integrity": "sha512-k96gw+i6N3ExgDwPIg0lUPmexl1ygPe6u5BdQFNBhkpbwroIgCNXdubtIzHfThYXYYTubwOBafoMnn7ruEP1xA==", + "dependencies": { + "@babel/runtime": "^7.12.0", + "@emotion/cache": "^11.4.0", + "@emotion/react": "^11.8.1", + "@floating-ui/dom": "^1.0.1", + "@types/react-transition-group": "^4.4.0", + "memoize-one": "^6.0.0", + "prop-types": "^15.6.0", + "react-transition-group": "^4.3.0", + "use-isomorphic-layout-effect": "^1.2.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, "node_modules/react-select2": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/react-select2/-/react-select2-4.0.3.tgz", @@ -4456,6 +4861,21 @@ "resolved": "https://registry.npmjs.org/select2/-/select2-4.0.13.tgz", "integrity": "sha512-1JeB87s6oN/TDxQQYCvS5EFoQyvV6eYMZZ0AeA4tdFDYWN3BAGZ8npr17UBFddU0lgAt3H0yjX3X6/ekOj1yjw==" }, + "node_modules/react-transition-group": { + "version": "4.4.5", + "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz", + "integrity": "sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g==", + "dependencies": { + "@babel/runtime": "^7.5.5", + "dom-helpers": "^5.0.1", + "loose-envify": "^1.4.0", + "prop-types": "^15.6.2" + }, + "peerDependencies": { + "react": ">=16.6.0", + "react-dom": ">=16.6.0" + } + }, "node_modules/read-cache": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", @@ -4499,6 +4919,11 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" + }, "node_modules/regexp.prototype.flags": { "version": "1.5.4", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", @@ -4523,7 +4948,6 @@ "version": "1.22.10", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", - "dev": true, "dependencies": { "is-core-module": "^2.16.0", "path-parse": "^1.0.7", @@ -4543,7 +4967,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true, "engines": { "node": ">=4" } @@ -4883,6 +5306,14 @@ "is-arrayish": "^0.3.1" } }, + "node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/source-map-js": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", @@ -5151,6 +5582,11 @@ } } }, + "node_modules/stylis": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.2.0.tgz", + "integrity": "sha512-Orov6g6BB1sDfYgzWfTHDOxamtX1bE/zo104Dh9e6fqJ3PooipYyfJ0pUmrZO2wAvO8YbEyeFrkV91XTsGMSrw==" + }, "node_modules/sucrase": { "version": "3.35.0", "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.0.tgz", @@ -5189,7 +5625,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true, "engines": { "node": ">= 0.4" }, @@ -5497,6 +5932,19 @@ "punycode": "^2.1.0" } }, + "node_modules/use-isomorphic-layout-effect": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/use-isomorphic-layout-effect/-/use-isomorphic-layout-effect-1.2.0.tgz", + "integrity": "sha512-q6ayo8DWoPZT0VdG4u3D3uxcgONP3Mevx2i2b0434cwWBoL+aelL1DzkXI6w3PhTZzUeR2kaVlZn70iCiseP6w==", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/package.json b/package.json index 7d28987..f371475 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,11 @@ "lint": "next lint" }, "dependencies": { + "date-fns": "^4.1.0", "next": "15.1.5", "react": "^19.0.0", "react-dom": "^19.0.0", + "react-select": "^5.10.0", "react-select2": "^4.0.3", "react-select2-wrapper": "^1.0.4-beta6", "select2": "^4.1.0-rc.0" diff --git a/server/src/services/engines.js b/server/src/services/engines.js index 7ad1e4c..39b2f15 100644 --- a/server/src/services/engines.js +++ b/server/src/services/engines.js @@ -22,7 +22,14 @@ export const list = async (params) => { export const create = async (params) => { try { - await sequelize.models.engines.create(params); + const normalizedParams = Object.fromEntries( + Object.entries(params).map(([key, value]) => [ + key, + isNaN(value) ? value : Number(value) + ]) + ); + + await sequelize.models.engines.create(normalizedParams); return true; } catch (error) { console.error('Error creating:', error); diff --git a/server/src/services/trims.js b/server/src/services/trims.js index e0ca247..0304265 100644 --- a/server/src/services/trims.js +++ b/server/src/services/trims.js @@ -22,7 +22,14 @@ export const list = async (params) => { export const create = async (params) => { try { - await sequelize.models.trims.create(params); + const normalizedParams = Object.fromEntries( + Object.entries(params).map(([key, value]) => [ + key, + isNaN(value) ? value : Number(value) + ]) + ); + + await sequelize.models.trims.create(normalizedParams); return true; } catch (error) { console.error('Error creating:', error); diff --git a/src/api/context/BodyType.tsx b/src/api/context/BodyType.tsx index b0ebd15..cca37f9 100644 --- a/src/api/context/BodyType.tsx +++ b/src/api/context/BodyType.tsx @@ -1,21 +1,28 @@ "use client" import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react'; -import { ReactElement } from 'react'; import { list } from "@/api/bodyTypes"; +interface BodyTypeItem { + id: string; + name: string; + country: string; +} + + interface BodyTypeContextType { - bodyType: ReactElement | null; - setBodyType: (content: ReactElement | null) => void; + bodyTypes: BodyTypeItem[] | null; + setBodyTypes: (content: BodyTypeItem[] | null) => void; + fetchData: () => void; } const BodyTypeContext = createContext(undefined); export const BodyTypeProvider = ({ children }: { children: ReactNode }) => { - const [bodyType, setBodyType] = useState(null); + const [bodyTypes, setBodyTypes] = useState(null); const fetchData = async () => { - setBodyType(await list()); + setBodyTypes(await list()); }; useEffect(() => { @@ -23,7 +30,7 @@ export const BodyTypeProvider = ({ children }: { children: ReactNode }) => { }, []); return ( - + {children} ); diff --git a/src/api/context/Car.tsx b/src/api/context/Car.tsx index 072c157..2b9afe2 100644 --- a/src/api/context/Car.tsx +++ b/src/api/context/Car.tsx @@ -1,12 +1,22 @@ "use client" import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react'; -import { ReactElement } from 'react'; import { list } from "@/api/cars"; +interface CarItem { + id: string, + car_models_id: string, + engines_id: string, + trims_id: string, + body_types_id: string, + car_colors_id: string, + transmissions_id: string, +} + interface CarContextType { - car: ReactElement | null; - setCar: (content: ReactElement | null) => void; + car: CarItem[] | null; + setCar: (content: CarItem[] | null) => void; + fetchData: () => void; } const CarContext = createContext(undefined); @@ -23,7 +33,7 @@ export const CarProvider = ({ children }: { children: ReactNode }) => { }, []); return ( - + {children} ); diff --git a/src/api/context/CarBrand.tsx b/src/api/context/CarBrand.tsx index ff143df..bcebe08 100644 --- a/src/api/context/CarBrand.tsx +++ b/src/api/context/CarBrand.tsx @@ -1,21 +1,27 @@ "use client" import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react'; -import { ReactElement } from 'react'; import { list } from "@/api/carBrands"; +interface CarBrandItem { + id: string; + name: string; + country: string; +} + interface CarBrandContextType { - carBrand: ReactElement | null; - setCarBrand: (content: ReactElement | null) => void; + carBrands: CarBrandItem[] | null; + setCarBrands: (content: CarBrandItem[] | null) => void; + fetchData: () => void; } const CarBrandContext = createContext(undefined); export const CarBrandProvider = ({ children }: { children: ReactNode }) => { - const [carBrand, setCarBrand] = useState(null); + const [carBrands, setCarBrands] = useState(null); const fetchData = async () => { - setCarBrand(await list()); + setCarBrands(await list()); }; useEffect(() => { @@ -23,7 +29,7 @@ export const CarBrandProvider = ({ children }: { children: ReactNode }) => { }, []); return ( - + {children} ); diff --git a/src/api/context/CarModel.tsx b/src/api/context/CarModel.tsx index e328c84..c096f17 100644 --- a/src/api/context/CarModel.tsx +++ b/src/api/context/CarModel.tsx @@ -1,12 +1,20 @@ "use client" import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react'; -import { ReactElement } from 'react'; import { list } from "@/api/carModels"; +interface CarModelItem { + id: string; + name: string; + yearStart: string, + yearEnd: string, + car_brands_id: string, +} + interface CarModelContextType { - carModel: ReactElement | null; - setCarModel: (content: ReactElement | null) => void; + carModel: CarModelItem[] | null; + setCarModel: (content: CarModelItem[] | null) => void; + fetchData: () => void; } const CarModelContext = createContext(undefined); @@ -23,7 +31,7 @@ export const CarModelProvider = ({ children }: { children: ReactNode }) => { }, []); return ( - + {children} ); diff --git a/src/api/context/Engine.tsx b/src/api/context/Engine.tsx index b5d6cc7..d8a9a24 100644 --- a/src/api/context/Engine.tsx +++ b/src/api/context/Engine.tsx @@ -1,12 +1,19 @@ "use client" import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react'; -import { ReactElement } from 'react'; import { list } from "@/api/engines"; +interface EngineItem { + id: string, + type: string, + powerHR: string, + volume: string, +} + interface EngineContextType { - engine: ReactElement | null; - setEngine: (content: ReactElement | null) => void; + engine: EngineItem[] | null; + setEngine: (content: EngineItem[] | null) => void; + fetchData: () => void; } const EngineContext = createContext(undefined); @@ -23,7 +30,7 @@ export const EngineProvider = ({ children }: { children: ReactNode }) => { }, []); return ( - + {children} ); diff --git a/src/api/context/Sale.tsx b/src/api/context/Sale.tsx index b17742e..6573fa3 100644 --- a/src/api/context/Sale.tsx +++ b/src/api/context/Sale.tsx @@ -1,12 +1,20 @@ "use client" import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react'; -import { ReactElement } from 'react'; -import { list } from "@/api/sales"; // Assuming your API call for sales is here +import { list } from "@/api/sales"; + +interface SaleItem { + id: string, + date: string, + price: string, + cars_id: string, + customers_id: string, +} interface SaleContextType { - sale: ReactElement | null; - setSale: (content: ReactElement | null) => void; + sale: SaleItem[] | null; + setSale: (content: SaleItem[] | null) => void; + fetchData: () => void; } const SaleContext = createContext(undefined); @@ -23,7 +31,7 @@ export const SaleProvider = ({ children }: { children: ReactNode }) => { }, []); return ( - + {children} ); diff --git a/src/api/context/Transmission.tsx b/src/api/context/Transmission.tsx index a5cb489..5370223 100644 --- a/src/api/context/Transmission.tsx +++ b/src/api/context/Transmission.tsx @@ -1,12 +1,17 @@ "use client" import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react'; -import { ReactElement } from 'react'; import { list } from "@/api/transmissions"; +interface TransmissionItem { + id: string, + type: string, +} + interface TransmissionContextType { - transmission: ReactElement | null; - setTransmission: (content: ReactElement | null) => void; + transmission: TransmissionItem[] | null; + setTransmission: (content: TransmissionItem[] | null) => void; + fetchData: () => void; } const TransmissionContext = createContext(undefined); @@ -23,7 +28,7 @@ export const TransmissionProvider = ({ children }: { children: ReactNode }) => { }, []); return ( - + {children} ); diff --git a/src/api/context/Trim.tsx b/src/api/context/Trim.tsx index 4b38c8b..81fd309 100644 --- a/src/api/context/Trim.tsx +++ b/src/api/context/Trim.tsx @@ -1,12 +1,19 @@ "use client" import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react'; -import { ReactElement } from 'react'; import { list } from "@/api/trims"; +interface TrimItem { + id: string; + name: string, + price: string, + car_models_id: string, +} + interface TrimContextType { - trim: ReactElement | null; - setTrim: (content: ReactElement | null) => void; + trim: TrimItem[] | null; + setTrim: (content: TrimItem[] | null) => void; + fetchData: () => void; } const TrimContext = createContext(undefined); @@ -23,7 +30,7 @@ export const TrimProvider = ({ children }: { children: ReactNode }) => { }, []); return ( - + {children} ); diff --git a/src/components/Button/Button.css b/src/components/Button/Button.css index 1662feb..3827c52 100644 --- a/src/components/Button/Button.css +++ b/src/components/Button/Button.css @@ -2,7 +2,7 @@ background-color: #4CAF50; border: none; color: white; - padding: 15px 32px; + padding: 10px 16px; text-align: center; text-decoration: none; display: inline-block; diff --git a/src/components/Input/InputDate.css b/src/components/Input/InputDate.css new file mode 100644 index 0000000..13d761c --- /dev/null +++ b/src/components/Input/InputDate.css @@ -0,0 +1,6 @@ +input[type=date] { + width: 100%; + padding: 12px 20px; + margin: 8px 0; + box-sizing: border-box; +} \ No newline at end of file diff --git a/src/components/Input/InputDate.tsx b/src/components/Input/InputDate.tsx new file mode 100644 index 0000000..0fe0eac --- /dev/null +++ b/src/components/Input/InputDate.tsx @@ -0,0 +1,13 @@ +import React from 'react'; +import './InputDate.css' +import {format} from "date-fns"; + +export function InputDate({children, value, onChange, name}: any) { + return ( + <> + + + + ); +} diff --git a/src/components/Select/Select.css b/src/components/Select/Select.css deleted file mode 100644 index e69de29..0000000 diff --git a/src/components/Select/Select.tsx b/src/components/Select/Select.tsx index a43f12c..27e92af 100644 --- a/src/components/Select/Select.tsx +++ b/src/components/Select/Select.tsx @@ -1,7 +1,13 @@ import React from 'react'; +import ReactSelect from "react-select"; -export function Select({children, name}: any) { +export function Select({options, placeholder, value, onChange, name}: any) { return ( - <> + <> + + option.value === value)} + onChange={onChange} name={name}/> + ); } diff --git a/src/modals/BodyType.tsx b/src/modals/BodyType.tsx index 56a560e..bdd92ac 100644 --- a/src/modals/BodyType.tsx +++ b/src/modals/BodyType.tsx @@ -1,8 +1,14 @@ import {Input} from "@/components/Input/Input"; import {useState} from "react"; import Button from "@/components/Button/Button"; +import {add, update} from "@/api/bodyTypes"; +import {useModalContext} from "@/components/Modal/ModalContext"; +import {useBodyTypeContext} from "@/api/context/BodyType"; export default function BodyType({ initialData }: any) { + const { setContentModal } = useModalContext(); + const { fetchData } = useBodyTypeContext(); + const [formData, setFormData] = useState({ id: initialData?.id || null, name: initialData?.name || "", @@ -16,10 +22,17 @@ export default function BodyType({ initialData }: any) { }); }; - const handleSubmit = () => { - console.log("Collected Data:", formData); + const handleSubmit = async () => { + if (formData.id === null) { + await add(formData); + } else { + await update(formData); + } + fetchData(); + setContentModal(null); }; + return ( <> Наименование diff --git a/src/modals/Car.tsx b/src/modals/Car.tsx index c848f98..c4f2f51 100644 --- a/src/modals/Car.tsx +++ b/src/modals/Car.tsx @@ -1,25 +1,138 @@ import Button from "@/components/Button/Button"; -import {useState} from "react"; +import React, {useState} from "react"; +import {useCarModelContext} from "@/api/context/CarModel"; +import {useEngineContext} from "@/api/context/Engine"; +import {useTrimContext} from "@/api/context/Trim"; +import {useBodyTypeContext} from "@/api/context/BodyType"; +import {useCarColorContext} from "@/api/context/CarColor"; +import {useTransmissionContext} from "@/api/context/Transmission"; +import {Select} from "@/components/Select/Select"; +import {useModalContext} from "@/components/Modal/ModalContext"; +import {add, update} from "@/api/cars"; +import {useCarContext} from "@/api/context/Car"; export default function Car({ initialData }: any) { + const { carModel } = useCarModelContext(); + const { engine } = useEngineContext(); + const { trim } = useTrimContext(); + const { bodyTypes } = useBodyTypeContext(); + const { carColor } = useCarColorContext(); + const { transmission } = useTransmissionContext(); + const { fetchData } = useCarContext(); + const { setContentModal } = useModalContext(); + + const carModelOptions = carModel?.map((model: any) => ({ + value: model.id, + label: model.name + })) || []; + + const engineOptions = engine?.map((engine: any) => ({ + value: engine.id, + label: engine.type + })) || []; + + const trimOptions = trim?.map((trim: any) => ({ + value: trim.id, + label: trim.name + })) || []; + + const bodyTypesOptions = bodyTypes?.map((bodyType: any) => ({ + value: bodyType.id, + label: bodyType.name + })) || []; + + const carColorOptions = carColor?.map((color: any) => ({ + value: color.id, + label: color.name + })) || []; + + const transmissionOptions = transmission?.map((transmission: any) => ({ + value: transmission.id, + label: transmission.type + })) || []; + const [formData, setFormData] = useState({ id: initialData?.id || null, + car_models_id: initialData?.car_models_id || null, + engines_id: initialData?.engines_id || null, + trims_id: initialData?.trims_id || null, + body_types_id: initialData?.body_types_id || null, + car_colors_id: initialData?.car_colors_id || null, + transmissions_id: initialData?.transmissions_id || null, }); - const handleChange = (e: any) => { - const { name, value } = e.target; - setFormData({ - ...formData, - [name]: value - }); - }; - - const handleSubmit = () => { - console.log("Collected Data:", formData); + const handleSubmit = async () => { + if (formData.id === null) { + await add(formData); + } else { + await update(formData); + } + fetchData(); + setContentModal(null); }; return ( <> + { + const { value } = e; + setFormData({ + ...formData, + engines_id: value + }); + }} name="engines_id"/> + { + const { value } = e; + setFormData({ + ...formData, + body_types_id: value + }); + }} name="body_types_id"/> + { + const { value } = e; + setFormData({ + ...formData, + transmissions_id: value + }); + }} name="transmissions_id"/> ); diff --git a/src/modals/CarBrand.tsx b/src/modals/CarBrand.tsx index 3f55343..999ff26 100644 --- a/src/modals/CarBrand.tsx +++ b/src/modals/CarBrand.tsx @@ -1,8 +1,14 @@ import {Input} from "@/components/Input/Input"; import {useState} from "react"; import Button from "@/components/Button/Button"; +import {useModalContext} from "@/components/Modal/ModalContext"; +import {useCarBrandContext} from "@/api/context/CarBrand"; +import {add, update} from "@/api/carBrands"; export default function CarBrand({ initialData }: any) { + const { setContentModal } = useModalContext(); + const { fetchData } = useCarBrandContext(); + const [formData, setFormData] = useState({ id: initialData?.id || null, name: initialData?.name || "", @@ -17,8 +23,14 @@ export default function CarBrand({ initialData }: any) { }); }; - const handleSubmit = () => { - console.log("Collected Data:", formData); + const handleSubmit = async () => { + if (formData.id === null) { + await add(formData); + } else { + await update(formData); + } + fetchData(); + setContentModal(null); }; return ( diff --git a/src/modals/CarModel.tsx b/src/modals/CarModel.tsx index 998031a..ef3043c 100644 --- a/src/modals/CarModel.tsx +++ b/src/modals/CarModel.tsx @@ -1,11 +1,28 @@ import {Input} from "@/components/Input/Input"; -import {useState} from "react"; +import React, {useState} from "react"; import Button from "@/components/Button/Button"; +import {useCarBrandContext} from "@/api/context/CarBrand"; +import {Select} from "@/components/Select/Select"; +import {add, update} from "@/api/carModels"; +import {useCarModelContext} from "@/api/context/CarModel"; +import {useModalContext} from "@/components/Modal/ModalContext"; export default function CarModel({ initialData }: any) { + const { setContentModal } = useModalContext(); + const { carBrands } = useCarBrandContext(); + const { fetchData } = useCarModelContext(); + + const carBrandOptions = carBrands?.map((brand: any) => ({ + value: brand.id, + label: brand.name + })) || []; + const [formDataCarModel, setFormDataCarModel] = useState({ id: initialData?.id || null, name: initialData?.name || "", + yearStart: initialData?.yearStart || "", + yearEnd: initialData?.yearEnd || "", + car_brands_id: initialData?.car_brands_id || null, }); const handleChange = (e: any) => { @@ -16,13 +33,31 @@ export default function CarModel({ initialData }: any) { }); }; - const handleSubmit = () => { - console.log("Collected Data:", formDataCarModel); + const handleChangeSelect = (e: any) => { + const { value } = e; + setFormDataCarModel({ + ...formDataCarModel, + car_brands_id: value + }); + }; + + const handleSubmit = async () => { + if (formDataCarModel.id === null) { + await add(formDataCarModel); + } else { + await update(formDataCarModel); + } + fetchData(); + setContentModal(null); }; return ( <> Наименование + Год начала + Год окончания + Цена + { + const { value } = e; + setFormData({ + ...formData, + customers_id: value + }); + }} name="customers_id"/> + + ); } diff --git a/src/modals/Transmission.tsx b/src/modals/Transmission.tsx index 7fbfab2..218aaf0 100644 --- a/src/modals/Transmission.tsx +++ b/src/modals/Transmission.tsx @@ -1,8 +1,14 @@ import {Input} from "@/components/Input/Input"; import {useState} from "react"; import Button from "@/components/Button/Button"; +import {add, update} from "@/api/transmissions"; +import {useModalContext} from "@/components/Modal/ModalContext"; +import {useTransmissionContext} from "@/api/context/Transmission"; export default function Transmission({ initialData }: any) { + const { fetchData } = useTransmissionContext(); + const { setContentModal } = useModalContext(); + const [formData, setFormData] = useState({ id: initialData?.id || null, type: initialData?.type || "", @@ -16,8 +22,14 @@ export default function Transmission({ initialData }: any) { }); }; - const handleSubmit = () => { - console.log("Collected Data:", formData); + const handleSubmit = async () => { + if (formData.id === null) { + await add(formData); + } else { + await update(formData); + } + fetchData(); + setContentModal(null); }; return ( diff --git a/src/modals/Trim.tsx b/src/modals/Trim.tsx index f065d86..59d2fe3 100644 --- a/src/modals/Trim.tsx +++ b/src/modals/Trim.tsx @@ -1,12 +1,27 @@ import {Input} from "@/components/Input/Input"; -import {useState} from "react"; +import React, {useState} from "react"; import Button from "@/components/Button/Button"; +import {Select} from "@/components/Select/Select"; +import {useCarModelContext} from "@/api/context/CarModel"; +import {add, update} from "@/api/trims"; +import {useModalContext} from "@/components/Modal/ModalContext"; +import {useTrimContext} from "@/api/context/Trim"; export default function Trim({ initialData }: any) { + const { carModel } = useCarModelContext(); + const { setContentModal } = useModalContext(); + const { fetchData } = useTrimContext(); + + const carModelOptions = carModel?.map((model: any) => ({ + value: model.id, + label: model.name + })) || []; + const [formData, setFormData] = useState({ id: initialData?.id || null, name: initialData?.name || "", - price: initialData?.price || "" + price: initialData?.price || "", + car_models_id: initialData?.car_models_id || null, }); const handleChange = (e: any) => { @@ -17,14 +32,30 @@ export default function Trim({ initialData }: any) { }); }; - const handleSubmit = () => { - console.log("Collected Data:", formData); + const handleChangeSelect = (e: any) => { + const { value } = e; + setFormData({ + ...formData, + car_models_id: value + }); + }; + + const handleSubmit = async () => { + if (formData.id === null) { + await add(formData); + } else { + await update(formData); + } + fetchData(); + setContentModal(null); }; return ( <> Название комплектации Цена +