Compare commits
3 Commits
769b35cef2
...
7e58077dd0
| Author | SHA1 | Date | |
|---|---|---|---|
| 7e58077dd0 | |||
| 643c698de2 | |||
| 755bcd6503 |
366
package-lock.json
generated
366
package-lock.json
generated
@ -8,11 +8,13 @@
|
||||
"name": "golscontros-frontend-v1",
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
"@mapbox/mapbox-gl-draw": "^1.5.1",
|
||||
"@primeuix/themes": "^1.2.5",
|
||||
"@primevue/auto-import-resolver": "^4.4.1",
|
||||
"@tailwindcss/vite": "^4.1.16",
|
||||
"@vueuse/core": "^14.0.0",
|
||||
"axios": "^1.13.2",
|
||||
"mapbox-gl": "^3.15.0",
|
||||
"pinia": "^3.0.4",
|
||||
"primeicons": "^7.0.0",
|
||||
"primevue": "^4.4.1",
|
||||
@ -537,6 +539,102 @@
|
||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||
}
|
||||
},
|
||||
"node_modules/@mapbox/geojson-area": {
|
||||
"version": "0.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@mapbox/geojson-area/-/geojson-area-0.2.2.tgz",
|
||||
"integrity": "sha512-bBqqFn1kIbLBfn7Yq1PzzwVkPYQr9lVUeT8Dhd0NL5n76PBuXzOcuLV7GOSbEB1ia8qWxH4COCvFpziEu/yReA==",
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"wgs84": "0.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@mapbox/geojson-normalize": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@mapbox/geojson-normalize/-/geojson-normalize-0.0.1.tgz",
|
||||
"integrity": "sha512-82V7YHcle8lhgIGqEWwtXYN5cy0QM/OHq3ypGhQTbvHR57DF0vMHMjjVSQKFfVXBe/yWCBZTyOuzvK7DFFnx5Q==",
|
||||
"license": "ISC",
|
||||
"bin": {
|
||||
"geojson-normalize": "geojson-normalize"
|
||||
}
|
||||
},
|
||||
"node_modules/@mapbox/jsonlint-lines-primitives": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@mapbox/jsonlint-lines-primitives/-/jsonlint-lines-primitives-2.0.2.tgz",
|
||||
"integrity": "sha512-rY0o9A5ECsTQRVhv7tL/OyDpGAoUB4tTvLiW1DSzQGq4bvTPhNw1VpSNjDJc5GFZ2XuyOtSWSVN05qOtcD71qQ==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/@mapbox/mapbox-gl-draw": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-draw/-/mapbox-gl-draw-1.5.1.tgz",
|
||||
"integrity": "sha512-DnR/oarZVoIrVHssAn+mtpuGzYH+ebORoPjow46zTBNPod/HQnvIZGtL6hIb5BVWxxH49RC9D20ipxiO9WDRxA==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@mapbox/geojson-area": "^0.2.2",
|
||||
"@mapbox/geojson-normalize": "^0.0.1",
|
||||
"@mapbox/point-geometry": "^1.1.0",
|
||||
"@turf/projection": "^7.2.0",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"nanoid": "^5.0.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.0.0 || >=20.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@mapbox/mapbox-gl-draw/node_modules/nanoid": {
|
||||
"version": "5.1.7",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.1.7.tgz",
|
||||
"integrity": "sha512-ua3NDgISf6jdwezAheMOk4mbE1LXjm1DfMUDMuJf4AqxLFK3ccGpgWizwa5YV7Yz9EpXwEaWoRXSb/BnV0t5dQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"nanoid": "bin/nanoid.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18 || >=20"
|
||||
}
|
||||
},
|
||||
"node_modules/@mapbox/mapbox-gl-supported": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-supported/-/mapbox-gl-supported-3.0.0.tgz",
|
||||
"integrity": "sha512-2XghOwu16ZwPJLOFVuIOaLbN0iKMn867evzXFyf0P22dqugezfJwLmdanAgU25ITvz1TvOfVP4jsDImlDJzcWg==",
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/@mapbox/point-geometry": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@mapbox/point-geometry/-/point-geometry-1.1.0.tgz",
|
||||
"integrity": "sha512-YGcBz1cg4ATXDCM/71L9xveh4dynfGmcLDqufR+nQQy3fKwsAZsWd/x4621/6uJaeB9mwOHE6hPeDgXz9uViUQ==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/@mapbox/tiny-sdf": {
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@mapbox/tiny-sdf/-/tiny-sdf-2.0.7.tgz",
|
||||
"integrity": "sha512-25gQLQMcpivjOSA40g3gO6qgiFPDpWRoMfd+G/GoppPIeP6JDaMMkMrEJnMZhKyyS6iKwVt5YKu02vCUyJM3Ug==",
|
||||
"license": "BSD-2-Clause"
|
||||
},
|
||||
"node_modules/@mapbox/unitbezier": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@mapbox/unitbezier/-/unitbezier-0.0.1.tgz",
|
||||
"integrity": "sha512-nMkuDXFv60aBr9soUG5q+GvZYL+2KZHVvsqFCzqnkGEf46U2fvmytHaEVc1/YZbiLn8X+eR3QzX1+dwDO1lxlw==",
|
||||
"license": "BSD-2-Clause"
|
||||
},
|
||||
"node_modules/@mapbox/vector-tile": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@mapbox/vector-tile/-/vector-tile-2.0.4.tgz",
|
||||
"integrity": "sha512-AkOLcbgGTdXScosBWwmmD7cDlvOjkg/DetGva26pIRiZPdeJYjYKarIlb4uxVzi6bwHO6EWH82eZ5Nuv4T5DUg==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"@mapbox/point-geometry": "~1.1.0",
|
||||
"@types/geojson": "^7946.0.16",
|
||||
"pbf": "^4.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@primeuix/styled": {
|
||||
"version": "0.7.4",
|
||||
"resolved": "https://registry.npmjs.org/@primeuix/styled/-/styled-0.7.4.tgz",
|
||||
@ -1176,12 +1274,84 @@
|
||||
"vite": "^5.2.0 || ^6 || ^7"
|
||||
}
|
||||
},
|
||||
"node_modules/@turf/clone": {
|
||||
"version": "7.3.4",
|
||||
"resolved": "https://registry.npmjs.org/@turf/clone/-/clone-7.3.4.tgz",
|
||||
"integrity": "sha512-pwQ+RyQw986uu7IulY/18NRAebwZZScb084bvVqVkTrllwLSv4oVBqUxmUMiwtp+PNdiRGRFOvNyZqtRsiD+Jw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@turf/helpers": "7.3.4",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.8.1"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/turf"
|
||||
}
|
||||
},
|
||||
"node_modules/@turf/helpers": {
|
||||
"version": "7.3.4",
|
||||
"resolved": "https://registry.npmjs.org/@turf/helpers/-/helpers-7.3.4.tgz",
|
||||
"integrity": "sha512-U/S5qyqgx3WTvg4twaH0WxF3EixoTCfDsmk98g1E3/5e2YKp7JKYZdz0vivsS5/UZLJeZDEElOSFH4pUgp+l7g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.8.1"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/turf"
|
||||
}
|
||||
},
|
||||
"node_modules/@turf/meta": {
|
||||
"version": "7.3.4",
|
||||
"resolved": "https://registry.npmjs.org/@turf/meta/-/meta-7.3.4.tgz",
|
||||
"integrity": "sha512-tlmw9/Hs1p2n0uoHVm1w3ugw1I6L8jv9YZrcdQa4SH5FX5UY0ATrKeIvfA55FlL//PGuYppJp+eyg/0eb4goqw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@turf/helpers": "7.3.4",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.8.1"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/turf"
|
||||
}
|
||||
},
|
||||
"node_modules/@turf/projection": {
|
||||
"version": "7.3.4",
|
||||
"resolved": "https://registry.npmjs.org/@turf/projection/-/projection-7.3.4.tgz",
|
||||
"integrity": "sha512-p91zOaLmzoBHzU/2H6Ot1tOhTmAom85n1P7I4Oo0V9xU8hmJXWfNnomLFf/6rnkKDIFZkncLQIBz4iIecZ61sA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@turf/clone": "7.3.4",
|
||||
"@turf/helpers": "7.3.4",
|
||||
"@turf/meta": "7.3.4",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.8.1"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/turf"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/estree": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
|
||||
"integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/geojson": {
|
||||
"version": "7946.0.16",
|
||||
"resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.16.tgz",
|
||||
"integrity": "sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/geojson-vt": {
|
||||
"version": "3.2.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/geojson-vt/-/geojson-vt-3.2.5.tgz",
|
||||
"integrity": "sha512-qDO7wqtprzlpe8FfQ//ClPV9xiuoh2nkIgiouIptON9w5jvD/fA4szvP9GBlDVdJ5dldAl0kX/sy3URbWwLx0g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/geojson": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "24.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.0.tgz",
|
||||
@ -1192,6 +1362,21 @@
|
||||
"undici-types": "~7.16.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/pbf": {
|
||||
"version": "3.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/pbf/-/pbf-3.0.5.tgz",
|
||||
"integrity": "sha512-j3pOPiEcWZ34R6a6mN07mUkM4o4Lwf6hPNt8eilOeZhTFbxFXmKhvXl9Y28jotFPaI1bpPDJsbCprUoNke6OrA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/supercluster": {
|
||||
"version": "7.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/supercluster/-/supercluster-7.1.3.tgz",
|
||||
"integrity": "sha512-Z0pOY34GDFl3Q6hUFYf3HkTwKEE02e7QgtJppBt+beEAxnyOpJua+voGFvxINBHa06GwLFFym7gRPY2SiKIfIA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/geojson": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/web-bluetooth": {
|
||||
"version": "0.0.21",
|
||||
"resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.21.tgz",
|
||||
@ -1505,6 +1690,12 @@
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/cheap-ruler": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/cheap-ruler/-/cheap-ruler-4.0.0.tgz",
|
||||
"integrity": "sha512-0BJa8f4t141BYKQyn9NSQt1PguFQXMXwZiA5shfoaBYHAb2fFk2RAX+tiWMoQU+Agtzt3mdt0JtuyshAXqZ+Vw==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/chokidar": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz",
|
||||
@ -1553,6 +1744,12 @@
|
||||
"url": "https://github.com/sponsors/mesqueeb"
|
||||
}
|
||||
},
|
||||
"node_modules/csscolorparser": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/csscolorparser/-/csscolorparser-1.0.3.tgz",
|
||||
"integrity": "sha512-umPSgYwZkdFoUrH5hIq5kf0wPSXiro51nPw0j2K/c83KflkPSTBGMz6NJvMB+07VlL0y7VPo6QJcDjcgKTTm3w==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/csstype": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
|
||||
@ -1608,6 +1805,12 @@
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/earcut": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/earcut/-/earcut-3.0.2.tgz",
|
||||
"integrity": "sha512-X7hshQbLyMJ/3RPhyObLARM2sNxxmRALLKx1+NVFFnQ9gKzmCrxm9+uLIAdBcvc8FNLpctqlQ2V6AE92Ol9UDQ==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/enhanced-resolve": {
|
||||
"version": "5.18.3",
|
||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.18.3.tgz",
|
||||
@ -1731,6 +1934,12 @@
|
||||
"integrity": "sha512-VO5fQUzZtI6C+vx4w/4BWJpg3s/5l+6pRQEHzFRM8WFi4XffSP1Z+4qi7GbjWbvRQEbdIco5mIMq+zX4rPuLrw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/fdir": {
|
||||
"version": "6.5.0",
|
||||
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
|
||||
@ -1807,6 +2016,12 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/geojson-vt": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/geojson-vt/-/geojson-vt-4.0.2.tgz",
|
||||
"integrity": "sha512-AV9ROqlNqoZEIJGfm1ncNjEXfkz2hdFlZf0qkVfmkwdKa8vj7H16YUOT81rJw1rdFhyEDlN2Tds91p/glzbl5A==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/get-intrinsic": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
||||
@ -1844,6 +2059,12 @@
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/gl-matrix": {
|
||||
"version": "3.4.4",
|
||||
"resolved": "https://registry.npmjs.org/gl-matrix/-/gl-matrix-3.4.4.tgz",
|
||||
"integrity": "sha512-latSnyDNt/8zYUB6VIJ6PCh2jBjJX6gnDsoCZ7LyW7GkqrD51EWwa9qCoGixj8YqBtETQK/xY7OmpTF8xz1DdQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/gopd": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
|
||||
@ -1862,6 +2083,12 @@
|
||||
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/grid-index": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/grid-index/-/grid-index-1.1.0.tgz",
|
||||
"integrity": "sha512-HZRwumpOGUrHyxO5bqKZL0B0GlUpwtCAzZ42sgxUPniu33R1LSFH5yrIcBCHjkctCAh3mtWKcKd9J4vDDdeVHA==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/has-symbols": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
|
||||
@ -1928,6 +2155,12 @@
|
||||
"jiti": "lib/jiti-cli.mjs"
|
||||
}
|
||||
},
|
||||
"node_modules/kdbush": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/kdbush/-/kdbush-4.0.2.tgz",
|
||||
"integrity": "sha512-WbCVYJ27Sz8zi9Q7Q0xHC+05iwkm3Znipc2XTlrnJbsHMYktW4hPhXUE8Ys1engBrvffoSCqbil1JQAa7clRpA==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/lightningcss": {
|
||||
"version": "1.30.2",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.30.2.tgz",
|
||||
@ -2203,6 +2436,55 @@
|
||||
"@jridgewell/sourcemap-codec": "^1.5.5"
|
||||
}
|
||||
},
|
||||
"node_modules/mapbox-gl": {
|
||||
"version": "3.20.0",
|
||||
"resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-3.20.0.tgz",
|
||||
"integrity": "sha512-+rVQkf6ymUlAEJiQBZy0OiamJvQN4Uk15mRHI98PRUSmRS40GOoLJyEZEG39LEUtvmzc7qGh+4ygZfJ//O5VnQ==",
|
||||
"license": "SEE LICENSE IN LICENSE.txt",
|
||||
"workspaces": [
|
||||
"src/style-spec",
|
||||
"test/build/vite",
|
||||
"test/build/webpack",
|
||||
"test/build/typings"
|
||||
],
|
||||
"dependencies": {
|
||||
"@mapbox/jsonlint-lines-primitives": "^2.0.2",
|
||||
"@mapbox/mapbox-gl-supported": "^3.0.0",
|
||||
"@mapbox/point-geometry": "^1.1.0",
|
||||
"@mapbox/tiny-sdf": "^2.0.6",
|
||||
"@mapbox/unitbezier": "^0.0.1",
|
||||
"@mapbox/vector-tile": "^2.0.4",
|
||||
"@types/geojson": "^7946.0.16",
|
||||
"@types/geojson-vt": "^3.2.5",
|
||||
"@types/pbf": "^3.0.5",
|
||||
"@types/supercluster": "^7.1.3",
|
||||
"cheap-ruler": "^4.0.0",
|
||||
"csscolorparser": "~1.0.3",
|
||||
"earcut": "^3.0.1",
|
||||
"geojson-vt": "^4.0.2",
|
||||
"gl-matrix": "^3.4.4",
|
||||
"grid-index": "^1.1.0",
|
||||
"kdbush": "^4.0.2",
|
||||
"martinez-polygon-clipping": "^0.8.1",
|
||||
"murmurhash-js": "^1.0.0",
|
||||
"pbf": "^4.0.1",
|
||||
"potpack": "^2.0.0",
|
||||
"quickselect": "^3.0.0",
|
||||
"supercluster": "^8.0.1",
|
||||
"tinyqueue": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/martinez-polygon-clipping": {
|
||||
"version": "0.8.1",
|
||||
"resolved": "https://registry.npmjs.org/martinez-polygon-clipping/-/martinez-polygon-clipping-0.8.1.tgz",
|
||||
"integrity": "sha512-9PLLMzMPI6ihHox4Ns6LpVBLpRc7sbhULybZ/wyaY8sY3ECNe2+hxm1hA2/9bEEpRrdpjoeduBuZLg2aq1cSIQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"robust-predicates": "^2.0.4",
|
||||
"splaytree": "^0.1.4",
|
||||
"tinyqueue": "3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/math-intrinsics": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
||||
@ -2281,6 +2563,12 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/murmurhash-js": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/murmurhash-js/-/murmurhash-js-1.0.0.tgz",
|
||||
"integrity": "sha512-TvmkNhkv8yct0SVBSy+o8wYzXjE4Zz3PCesbfs8HiCXXdcTuocApFv11UWlNFWKYsP2okqrhb7JNlSm9InBhIw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/nanoid": {
|
||||
"version": "3.3.11",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",
|
||||
@ -2312,6 +2600,18 @@
|
||||
"integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/pbf": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/pbf/-/pbf-4.0.1.tgz",
|
||||
"integrity": "sha512-SuLdBvS42z33m8ejRbInMapQe8n0D3vN/Xd5fmWM3tufNgRQFBpaW2YVJxQZV4iPNqb0vEFvssMEo5w9c6BTIA==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"resolve-protobuf-schema": "^2.1.0"
|
||||
},
|
||||
"bin": {
|
||||
"pbf": "bin/pbf"
|
||||
}
|
||||
},
|
||||
"node_modules/perfect-debounce": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/perfect-debounce/-/perfect-debounce-1.0.0.tgz",
|
||||
@ -2405,6 +2705,12 @@
|
||||
"node": "^10 || ^12 || >=14"
|
||||
}
|
||||
},
|
||||
"node_modules/potpack": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/potpack/-/potpack-2.1.0.tgz",
|
||||
"integrity": "sha512-pcaShQc1Shq0y+E7GqJqvZj8DTthWV1KeHGdi0Z6IAin2Oi3JnLCOfwnCo84qc+HAp52wT9nK9H7FAJp5a44GQ==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/primeicons": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/primeicons/-/primeicons-7.0.0.tgz",
|
||||
@ -2427,6 +2733,12 @@
|
||||
"node": ">=12.11.0"
|
||||
}
|
||||
},
|
||||
"node_modules/protocol-buffers-schema": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz",
|
||||
"integrity": "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/proxy-from-env": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
||||
@ -2449,6 +2761,12 @@
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/quickselect": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/quickselect/-/quickselect-3.0.0.tgz",
|
||||
"integrity": "sha512-XdjUArbK4Bm5fLLvlm5KpTFOiOThgfWWI4axAZDWg4E/0mKdZyI9tNEfds27qCi1ze/vwTR16kvmmGhRra3c2g==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/readdirp": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz",
|
||||
@ -2462,12 +2780,27 @@
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/resolve-protobuf-schema": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve-protobuf-schema/-/resolve-protobuf-schema-2.1.0.tgz",
|
||||
"integrity": "sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"protocol-buffers-schema": "^3.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/rfdc": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz",
|
||||
"integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/robust-predicates": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-2.0.4.tgz",
|
||||
"integrity": "sha512-l4NwboJM74Ilm4VKfbAtFeGq7aEjWL+5kVFcmgFA2MrdnQWx9iE/tUGvxY5HyMI7o/WpSIUFLbC5fbeaHgSCYg==",
|
||||
"license": "Unlicense"
|
||||
},
|
||||
"node_modules/rollup": {
|
||||
"version": "4.52.5",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.52.5.tgz",
|
||||
@ -2527,6 +2860,21 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/splaytree": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/splaytree/-/splaytree-0.1.4.tgz",
|
||||
"integrity": "sha512-D50hKrjZgBzqD3FT2Ek53f2dcDLAQT8SSGrzj3vidNH5ISRgceeGVJ2dQIthKOuayqFXfFjXheHNo4bbt9LhRQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/supercluster": {
|
||||
"version": "8.0.1",
|
||||
"resolved": "https://registry.npmjs.org/supercluster/-/supercluster-8.0.1.tgz",
|
||||
"integrity": "sha512-IiOea5kJ9iqzD2t7QJq/cREyLHTtSmUT6gQsweojg9WH2sYJqZK9SswTu6jrscO6D1G5v5vYZ9ru/eq85lXeZQ==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"kdbush": "^4.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/superjson": {
|
||||
"version": "2.2.5",
|
||||
"resolved": "https://registry.npmjs.org/superjson/-/superjson-2.2.5.tgz",
|
||||
@ -2583,6 +2931,18 @@
|
||||
"url": "https://github.com/sponsors/SuperchupuDev"
|
||||
}
|
||||
},
|
||||
"node_modules/tinyqueue": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/tinyqueue/-/tinyqueue-3.0.0.tgz",
|
||||
"integrity": "sha512-gRa9gwYU3ECmQYv3lslts5hxuIa90veaEcxDYuu3QGOIAEM2mOZkVHp48ANJuu1CURtRdHKUBY5Lm1tHV+sD4g==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/tslib": {
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||
"license": "0BSD"
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.9.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
|
||||
@ -2815,6 +3175,12 @@
|
||||
"resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.6.2.tgz",
|
||||
"integrity": "sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/wgs84": {
|
||||
"version": "0.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wgs84/-/wgs84-0.0.0.tgz",
|
||||
"integrity": "sha512-ANHlY4Rb5kHw40D0NJ6moaVfOCMrp9Gpd1R/AIQYg2ko4/jzcJ+TVXYYF6kXJqQwITvEZP4yEthjM7U6rYlljQ==",
|
||||
"license": "BSD-2-Clause"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,11 +9,13 @@
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mapbox/mapbox-gl-draw": "^1.5.1",
|
||||
"@primeuix/themes": "^1.2.5",
|
||||
"@primevue/auto-import-resolver": "^4.4.1",
|
||||
"@tailwindcss/vite": "^4.1.16",
|
||||
"@vueuse/core": "^14.0.0",
|
||||
"axios": "^1.13.2",
|
||||
"mapbox-gl": "^3.15.0",
|
||||
"pinia": "^3.0.4",
|
||||
"primeicons": "^7.0.0",
|
||||
"primevue": "^4.4.1",
|
||||
|
||||
@ -68,7 +68,19 @@ const menuItems = ref<MenuItem[]>([
|
||||
icon: 'pi pi-book',
|
||||
to: '/catalog/document-concepts',
|
||||
permission: 'document_concepts.index'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Ubicaciones',
|
||||
icon: 'pi pi-map-marker',
|
||||
to: '/catalog/locations',
|
||||
permission: [
|
||||
'locations.index',
|
||||
'locations.show',
|
||||
'locations.store',
|
||||
'locations.update',
|
||||
'locations.destroy',
|
||||
],
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
834
src/modules/catalog/components/locations/LocationForm.vue
Normal file
834
src/modules/catalog/components/locations/LocationForm.vue
Normal file
@ -0,0 +1,834 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||
import mapboxgl from 'mapbox-gl';
|
||||
import MapboxDraw from '@mapbox/mapbox-gl-draw';
|
||||
import 'mapbox-gl/dist/mapbox-gl.css';
|
||||
import '@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css';
|
||||
import type { Feature, GeoJsonProperties, Polygon, Position } from 'geojson';
|
||||
|
||||
import Card from 'primevue/card';
|
||||
import InputText from 'primevue/inputtext';
|
||||
import Button from 'primevue/button';
|
||||
import Textarea from 'primevue/textarea';
|
||||
|
||||
import type { LocationCreateRequest, LocationFormErrors, LocationGeofenceGeoJSON } from '../../types/locations.interfaces';
|
||||
|
||||
type GeofenceFeature = Feature<Polygon, GeoJsonProperties>;
|
||||
|
||||
type FormData = {
|
||||
name: string;
|
||||
description: string;
|
||||
address: string;
|
||||
city: string;
|
||||
state: string;
|
||||
country: string;
|
||||
zip_code: string;
|
||||
latitude: string;
|
||||
longitude: string;
|
||||
geofence_radius_m: string;
|
||||
geofence: GeofenceFeature | null;
|
||||
};
|
||||
|
||||
const props = defineProps<{
|
||||
initialData?: Partial<LocationCreateRequest> & {
|
||||
name?: string;
|
||||
description?: string | null;
|
||||
address?: string | null;
|
||||
city?: string | null;
|
||||
state?: string | null;
|
||||
country?: string | null;
|
||||
zip_code?: string | null;
|
||||
coordinates?: string | null;
|
||||
geofence?: LocationCreateRequest['geofence'] | string | null;
|
||||
};
|
||||
formErrors?: LocationFormErrors;
|
||||
isEditing?: boolean;
|
||||
loading?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'submit', payload: LocationCreateRequest): void;
|
||||
(e: 'cancel'): void;
|
||||
}>();
|
||||
|
||||
const mapToken = import.meta.env.VITE_MAPBOX_TOKEN as string | undefined;
|
||||
const mapContainer = ref<HTMLElement | null>(null);
|
||||
const mapRef = ref<any>(null);
|
||||
const markerRef = ref<any>(null);
|
||||
const drawRef = ref<MapboxDraw | null>(null);
|
||||
const mapReady = ref(false);
|
||||
|
||||
const form = ref<FormData>({
|
||||
name: props.initialData?.name ?? '',
|
||||
description: props.initialData?.description ?? '',
|
||||
address: props.initialData?.address ?? '',
|
||||
city: props.initialData?.city ?? '',
|
||||
state: props.initialData?.state ?? '',
|
||||
country: props.initialData?.country ?? '',
|
||||
zip_code: props.initialData?.zip_code ?? '',
|
||||
latitude: '18.039300',
|
||||
longitude: '-92.579000',
|
||||
geofence_radius_m: '75',
|
||||
geofence: null,
|
||||
});
|
||||
|
||||
const geocodingSearch = ref('');
|
||||
const geocodingLoading = ref(false);
|
||||
const errorMessage = ref('');
|
||||
const geofenceEditedWithDraw = ref(false);
|
||||
const radiusTouched = ref(false);
|
||||
const applyingProgrammaticGeofence = ref(false);
|
||||
|
||||
const canInitializeMap = computed(() => !!mapToken && !!mapContainer.value);
|
||||
|
||||
const toRadians = (value: number) => (value * Math.PI) / 180;
|
||||
const toDegrees = (value: number) => (value * 180) / Math.PI;
|
||||
|
||||
const distanceInMeters = (lat1: number, lng1: number, lat2: number, lng2: number): number => {
|
||||
const earthRadius = 6378137;
|
||||
const dLat = toRadians(lat2 - lat1);
|
||||
const dLng = toRadians(lng2 - lng1);
|
||||
const a =
|
||||
Math.sin(dLat / 2) * Math.sin(dLat / 2) +
|
||||
Math.cos(toRadians(lat1)) * Math.cos(toRadians(lat2)) * Math.sin(dLng / 2) * Math.sin(dLng / 2);
|
||||
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
||||
return earthRadius * c;
|
||||
};
|
||||
|
||||
const hexToBytes = (hex: string): Uint8Array | null => {
|
||||
if (hex.length % 2 !== 0) return null;
|
||||
if (!/^[0-9a-fA-F]+$/.test(hex)) return null;
|
||||
|
||||
const bytes = new Uint8Array(hex.length / 2);
|
||||
for (let i = 0; i < hex.length; i += 2) {
|
||||
bytes[i / 2] = Number.parseInt(hex.slice(i, i + 2), 16);
|
||||
}
|
||||
|
||||
return bytes;
|
||||
};
|
||||
|
||||
const parseHexEwkbPoint = (value: string): { lat: number; lng: number } | null => {
|
||||
const bytes = hexToBytes(value.trim());
|
||||
if (!bytes || bytes.length < 1 + 4 + 16) return null;
|
||||
|
||||
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
||||
const littleEndian = view.getUint8(0) === 1;
|
||||
|
||||
const typeWithFlags = view.getUint32(1, littleEndian);
|
||||
const hasSrid = (typeWithFlags & 0x20000000) !== 0;
|
||||
const geometryType = typeWithFlags & 0x0fffffff;
|
||||
if (geometryType !== 1) return null;
|
||||
|
||||
let offset = 1 + 4;
|
||||
if (hasSrid) {
|
||||
if (bytes.length < offset + 4 + 16) return null;
|
||||
offset += 4;
|
||||
}
|
||||
|
||||
if (bytes.length < offset + 16) return null;
|
||||
const lng = view.getFloat64(offset, littleEndian);
|
||||
const lat = view.getFloat64(offset + 8, littleEndian);
|
||||
|
||||
if (Number.isNaN(lat) || Number.isNaN(lng)) return null;
|
||||
if (lat < -90 || lat > 90 || lng < -180 || lng > 180) return null;
|
||||
return { lat, lng };
|
||||
};
|
||||
|
||||
const parseCoordinates = (value?: string | null): { lat: number; lng: number } | null => {
|
||||
if (!value) return null;
|
||||
const normalized = value.trim();
|
||||
|
||||
const match = normalized.match(/POINT\s*\(\s*([-\d.]+)\s+([-\d.]+)\s*\)/i);
|
||||
if (match) {
|
||||
const lng = Number(match[1]);
|
||||
const lat = Number(match[2]);
|
||||
if (Number.isNaN(lat) || Number.isNaN(lng)) return null;
|
||||
return { lat, lng };
|
||||
}
|
||||
|
||||
return parseHexEwkbPoint(normalized);
|
||||
};
|
||||
|
||||
const cloneGeofenceFeature = (feature: GeofenceFeature): GeofenceFeature => {
|
||||
return JSON.parse(JSON.stringify(feature)) as GeofenceFeature;
|
||||
};
|
||||
|
||||
const normalizeRing = (ring: Position[]): Position[] => {
|
||||
if (ring.length < 3) return ring;
|
||||
|
||||
const first = ring[0];
|
||||
const last = ring[ring.length - 1];
|
||||
if (!first || !last) {
|
||||
return ring;
|
||||
}
|
||||
|
||||
const firstLng = Number(first[0]);
|
||||
const firstLat = Number(first[1]);
|
||||
const lastLng = Number(last[0]);
|
||||
const lastLat = Number(last[1]);
|
||||
if ([firstLng, firstLat, lastLng, lastLat].some((value) => Number.isNaN(value))) {
|
||||
return ring;
|
||||
}
|
||||
|
||||
if (firstLng === lastLng && firstLat === lastLat) {
|
||||
return ring;
|
||||
}
|
||||
|
||||
return [...ring, [firstLng, firstLat]];
|
||||
};
|
||||
|
||||
const coerceGeofenceFeature = (value: unknown): GeofenceFeature | null => {
|
||||
if (!value) return null;
|
||||
|
||||
if (typeof value === 'string') {
|
||||
const trimmed = value.trim();
|
||||
if (!trimmed) return null;
|
||||
|
||||
if (trimmed.startsWith('{')) {
|
||||
try {
|
||||
return coerceGeofenceFeature(JSON.parse(trimmed));
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
const wkt = trimmed.replace(/^SRID=\d+;/i, '');
|
||||
const polygonMatch = wkt.match(/POLYGON\s*\(\((.+)\)\)/i);
|
||||
if (!polygonMatch) return null;
|
||||
|
||||
const polygonContent = polygonMatch[1];
|
||||
if (!polygonContent) return null;
|
||||
|
||||
const ring = polygonContent
|
||||
.split(',')
|
||||
.map((pair) => pair.trim().split(/\s+/).map(Number))
|
||||
.filter((coords) => coords.length >= 2 && !Number.isNaN(coords[0]) && !Number.isNaN(coords[1]))
|
||||
.map((coords) => [coords[0], coords[1]] as Position);
|
||||
|
||||
if (ring.length < 3) return null;
|
||||
|
||||
return {
|
||||
type: 'Feature',
|
||||
geometry: {
|
||||
type: 'Polygon',
|
||||
coordinates: [normalizeRing(ring)],
|
||||
},
|
||||
properties: {},
|
||||
};
|
||||
}
|
||||
|
||||
if (typeof value !== 'object') return null;
|
||||
|
||||
const maybeFeature = value as Partial<GeofenceFeature>;
|
||||
if (maybeFeature.type === 'Feature' && maybeFeature.geometry?.type === 'Polygon' && maybeFeature.geometry.coordinates) {
|
||||
return {
|
||||
type: 'Feature',
|
||||
geometry: {
|
||||
type: 'Polygon',
|
||||
coordinates: [normalizeRing(maybeFeature.geometry.coordinates[0] ?? [])],
|
||||
},
|
||||
properties: maybeFeature.properties ?? {},
|
||||
};
|
||||
}
|
||||
|
||||
const maybePolygon = value as Partial<LocationGeofenceGeoJSON>;
|
||||
if (maybePolygon.type === 'Polygon' && maybePolygon.coordinates) {
|
||||
return {
|
||||
type: 'Feature',
|
||||
geometry: {
|
||||
type: 'Polygon',
|
||||
coordinates: [normalizeRing(maybePolygon.coordinates[0] ?? [])],
|
||||
},
|
||||
properties: {},
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
const updateLatLng = (lat: number, lng: number) => {
|
||||
form.value.latitude = lat.toFixed(6);
|
||||
form.value.longitude = lng.toFixed(6);
|
||||
};
|
||||
|
||||
const getCurrentLatLng = (): { lat: number; lng: number } | null => {
|
||||
const lat = Number(form.value.latitude);
|
||||
const lng = Number(form.value.longitude);
|
||||
if (Number.isNaN(lat) || Number.isNaN(lng)) return null;
|
||||
if (lat < -90 || lat > 90 || lng < -180 || lng > 180) return null;
|
||||
return { lat, lng };
|
||||
};
|
||||
|
||||
const createCirclePolygonFeature = (lat: number, lng: number, radiusMeters: number, segments = 48): GeofenceFeature => {
|
||||
const earthRadius = 6378137;
|
||||
const angularDistance = radiusMeters / earthRadius;
|
||||
const latRad = toRadians(lat);
|
||||
const lngRad = toRadians(lng);
|
||||
const points: Position[] = [];
|
||||
|
||||
for (let i = 0; i <= segments; i += 1) {
|
||||
const bearing = (2 * Math.PI * i) / segments;
|
||||
const destLat = Math.asin(
|
||||
Math.sin(latRad) * Math.cos(angularDistance) +
|
||||
Math.cos(latRad) * Math.sin(angularDistance) * Math.cos(bearing)
|
||||
);
|
||||
const destLng =
|
||||
lngRad +
|
||||
Math.atan2(
|
||||
Math.sin(bearing) * Math.sin(angularDistance) * Math.cos(latRad),
|
||||
Math.cos(angularDistance) - Math.sin(latRad) * Math.sin(destLat)
|
||||
);
|
||||
|
||||
points.push([toDegrees(destLng), toDegrees(destLat)]);
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Feature',
|
||||
geometry: {
|
||||
type: 'Polygon',
|
||||
coordinates: [normalizeRing(points)],
|
||||
},
|
||||
properties: {},
|
||||
};
|
||||
};
|
||||
|
||||
const fitMapToGeofence = (feature: GeofenceFeature) => {
|
||||
if (!mapRef.value) return;
|
||||
const ring = feature.geometry.coordinates[0];
|
||||
if (!ring || ring.length === 0) return;
|
||||
|
||||
const bounds = new mapboxgl.LngLatBounds(ring[0] as [number, number], ring[0] as [number, number]);
|
||||
for (const position of ring) {
|
||||
bounds.extend(position as [number, number]);
|
||||
}
|
||||
|
||||
mapRef.value.fitBounds(bounds, {
|
||||
padding: 40,
|
||||
duration: 0,
|
||||
maxZoom: 15,
|
||||
});
|
||||
};
|
||||
|
||||
const updateRadiusFromGeofence = (feature: GeofenceFeature | null) => {
|
||||
if (!feature) return;
|
||||
|
||||
const center = getCurrentLatLng();
|
||||
if (!center) return;
|
||||
|
||||
const ring = feature.geometry.coordinates[0];
|
||||
if (!ring || ring.length === 0 || !ring[0]) return;
|
||||
|
||||
const firstPoint = ring[0];
|
||||
const lng = Number(firstPoint[0]);
|
||||
const lat = Number(firstPoint[1]);
|
||||
if (Number.isNaN(lat) || Number.isNaN(lng)) return;
|
||||
|
||||
const radius = distanceInMeters(center.lat, center.lng, lat, lng);
|
||||
if (!Number.isNaN(radius) && radius >= 0) {
|
||||
form.value.geofence_radius_m = Math.round(radius).toString();
|
||||
}
|
||||
};
|
||||
|
||||
const setDrawGeofence = (feature: GeofenceFeature | null) => {
|
||||
if (!drawRef.value) return;
|
||||
|
||||
applyingProgrammaticGeofence.value = true;
|
||||
try {
|
||||
drawRef.value.deleteAll();
|
||||
if (!feature) {
|
||||
form.value.geofence = null;
|
||||
return;
|
||||
}
|
||||
|
||||
const added = drawRef.value.add(cloneGeofenceFeature(feature));
|
||||
const featureId = Array.isArray(added) ? added[0] : added;
|
||||
const savedFeature = featureId ? (drawRef.value.get(featureId) as GeofenceFeature | undefined) : undefined;
|
||||
form.value.geofence = savedFeature ? cloneGeofenceFeature(savedFeature) : cloneGeofenceFeature(feature);
|
||||
} finally {
|
||||
applyingProgrammaticGeofence.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const previewGeofenceFromRadius = () => {
|
||||
const current = getCurrentLatLng();
|
||||
if (!current) return;
|
||||
|
||||
const parsedRadius = Number(form.value.geofence_radius_m);
|
||||
if (Number.isNaN(parsedRadius) || parsedRadius < 0) return;
|
||||
|
||||
if (parsedRadius === 0) {
|
||||
form.value.geofence = null;
|
||||
if (drawRef.value) {
|
||||
setDrawGeofence(null);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const generated = createCirclePolygonFeature(current.lat, current.lng, parsedRadius);
|
||||
form.value.geofence = generated;
|
||||
|
||||
if (drawRef.value) {
|
||||
setDrawGeofence(generated);
|
||||
}
|
||||
};
|
||||
|
||||
const syncGeofenceFromDraw = () => {
|
||||
if (!drawRef.value) return;
|
||||
|
||||
const drawData = drawRef.value.getAll();
|
||||
const polygonFeatures = drawData.features.filter((feature: any): feature is GeofenceFeature => {
|
||||
return feature.geometry.type === 'Polygon';
|
||||
});
|
||||
|
||||
if (polygonFeatures.length === 0) {
|
||||
form.value.geofence = null;
|
||||
return;
|
||||
}
|
||||
|
||||
const latest = polygonFeatures[polygonFeatures.length - 1];
|
||||
if (!latest) {
|
||||
form.value.geofence = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (polygonFeatures.length > 1) {
|
||||
setDrawGeofence(latest);
|
||||
} else {
|
||||
form.value.geofence = cloneGeofenceFeature(latest);
|
||||
}
|
||||
|
||||
updateRadiusFromGeofence(form.value.geofence);
|
||||
};
|
||||
|
||||
const applyInitialGeofence = (value: unknown) => {
|
||||
const parsed = coerceGeofenceFeature(value);
|
||||
form.value.geofence = parsed ? cloneGeofenceFeature(parsed) : null;
|
||||
geofenceEditedWithDraw.value = false;
|
||||
radiusTouched.value = false;
|
||||
|
||||
if (drawRef.value) {
|
||||
setDrawGeofence(form.value.geofence);
|
||||
}
|
||||
|
||||
if (form.value.geofence) {
|
||||
fitMapToGeofence(form.value.geofence);
|
||||
updateRadiusFromGeofence(form.value.geofence);
|
||||
}
|
||||
};
|
||||
|
||||
const buildPostgisPayload = (): LocationCreateRequest | null => {
|
||||
const current = getCurrentLatLng();
|
||||
if (!current) {
|
||||
errorMessage.value = 'Las coordenadas no son válidas.';
|
||||
return null;
|
||||
}
|
||||
|
||||
errorMessage.value = '';
|
||||
|
||||
const parsedRadius = Number(form.value.geofence_radius_m);
|
||||
let geofencePolygon: LocationGeofenceGeoJSON | null = null;
|
||||
const hasExistingGeofence = !!form.value.geofence;
|
||||
|
||||
if (geofenceEditedWithDraw.value && form.value.geofence) {
|
||||
geofencePolygon = form.value.geofence.geometry;
|
||||
} else if (hasExistingGeofence && !radiusTouched.value && form.value.geofence) {
|
||||
geofencePolygon = form.value.geofence.geometry;
|
||||
} else {
|
||||
if (Number.isNaN(parsedRadius) || parsedRadius < 0) {
|
||||
errorMessage.value = 'El radio de geocerca debe ser un número válido.';
|
||||
return null;
|
||||
}
|
||||
|
||||
if (parsedRadius > 0) {
|
||||
const generated = createCirclePolygonFeature(current.lat, current.lng, parsedRadius);
|
||||
geofencePolygon = generated.geometry;
|
||||
form.value.geofence = generated;
|
||||
geofenceEditedWithDraw.value = false;
|
||||
|
||||
if (drawRef.value) {
|
||||
setDrawGeofence(generated);
|
||||
}
|
||||
} else {
|
||||
geofencePolygon = null;
|
||||
form.value.geofence = null;
|
||||
geofenceEditedWithDraw.value = false;
|
||||
if (drawRef.value) {
|
||||
drawRef.value.deleteAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
name: form.value.name.trim(),
|
||||
description: form.value.description?.trim() || null,
|
||||
address: form.value.address.trim(),
|
||||
city: form.value.city.trim() || null,
|
||||
state: form.value.state.trim() || null,
|
||||
country: form.value.country.trim() || null,
|
||||
zip_code: form.value.zip_code.trim() || null,
|
||||
coordinates: `SRID=4326;POINT(${current.lng} ${current.lat})`,
|
||||
geofence: geofencePolygon,
|
||||
};
|
||||
};
|
||||
|
||||
const syncMarkerWithInputs = () => {
|
||||
if (!mapRef.value || !markerRef.value) return;
|
||||
const current = getCurrentLatLng();
|
||||
if (!current) return;
|
||||
|
||||
markerRef.value.setLngLat([current.lng, current.lat]);
|
||||
mapRef.value.flyTo({ center: [current.lng, current.lat], zoom: 14 });
|
||||
};
|
||||
|
||||
const reverseGeocode = async (lat: number, lng: number) => {
|
||||
if (!mapToken) return;
|
||||
try {
|
||||
const response = await fetch(
|
||||
`https://api.mapbox.com/geocoding/v5/mapbox.places/${lng},${lat}.json?language=es&limit=1&access_token=${mapToken}`
|
||||
);
|
||||
if (!response.ok) return;
|
||||
|
||||
const data = await response.json();
|
||||
const first = data?.features?.[0];
|
||||
if (!first) return;
|
||||
|
||||
form.value.address = first.place_name || form.value.address;
|
||||
const context = Array.isArray(first.context) ? first.context : [];
|
||||
for (const item of context) {
|
||||
if (item.id?.startsWith('place')) form.value.city = item.text || form.value.city;
|
||||
if (item.id?.startsWith('region')) form.value.state = item.text || form.value.state;
|
||||
if (item.id?.startsWith('country')) form.value.country = item.text || form.value.country;
|
||||
if (item.id?.startsWith('postcode')) form.value.zip_code = item.text || form.value.zip_code;
|
||||
}
|
||||
} catch {
|
||||
// Ignore reverse geocoding errors to avoid blocking form flow.
|
||||
}
|
||||
};
|
||||
|
||||
const searchAddress = async () => {
|
||||
if (!mapToken || !geocodingSearch.value.trim() || !mapRef.value || !markerRef.value) return;
|
||||
geocodingLoading.value = true;
|
||||
try {
|
||||
const query = encodeURIComponent(geocodingSearch.value.trim());
|
||||
const response = await fetch(
|
||||
`https://api.mapbox.com/geocoding/v5/mapbox.places/${query}.json?language=es&limit=1&access_token=${mapToken}`
|
||||
);
|
||||
if (!response.ok) return;
|
||||
|
||||
const data = await response.json();
|
||||
const first = data?.features?.[0];
|
||||
if (!first?.center) return;
|
||||
|
||||
const [lng, lat] = first.center;
|
||||
updateLatLng(lat, lng);
|
||||
markerRef.value.setLngLat([lng, lat]);
|
||||
mapRef.value.flyTo({ center: [lng, lat], zoom: 15 });
|
||||
await reverseGeocode(lat, lng);
|
||||
} finally {
|
||||
geocodingLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const initializeMap = () => {
|
||||
if (!canInitializeMap.value || mapRef.value) return;
|
||||
|
||||
mapboxgl.accessToken = mapToken!;
|
||||
const current = getCurrentLatLng() ?? { lat: 18.0393, lng: -92.579 };
|
||||
|
||||
mapRef.value = new mapboxgl.Map({
|
||||
container: mapContainer.value!,
|
||||
style: 'mapbox://styles/mapbox/streets-v12',
|
||||
center: [current.lng, current.lat],
|
||||
zoom: 8,
|
||||
});
|
||||
|
||||
mapRef.value.addControl(new mapboxgl.NavigationControl(), 'top-right');
|
||||
drawRef.value = new MapboxDraw({
|
||||
displayControlsDefault: false,
|
||||
controls: {
|
||||
polygon: true,
|
||||
trash: true,
|
||||
},
|
||||
});
|
||||
mapRef.value.addControl(drawRef.value, 'top-left');
|
||||
|
||||
markerRef.value = new mapboxgl.Marker({ draggable: true })
|
||||
.setLngLat([current.lng, current.lat])
|
||||
.addTo(mapRef.value);
|
||||
|
||||
markerRef.value.on('dragend', () => {
|
||||
const lngLat = markerRef.value!.getLngLat();
|
||||
updateLatLng(lngLat.lat, lngLat.lng);
|
||||
reverseGeocode(lngLat.lat, lngLat.lng);
|
||||
});
|
||||
|
||||
mapRef.value.on('click', (event: any) => {
|
||||
const drawMode = drawRef.value?.getMode();
|
||||
if (drawMode === 'draw_polygon' || drawMode === 'direct_select') {
|
||||
return;
|
||||
}
|
||||
|
||||
markerRef.value?.setLngLat(event.lngLat);
|
||||
updateLatLng(event.lngLat.lat, event.lngLat.lng);
|
||||
reverseGeocode(event.lngLat.lat, event.lngLat.lng);
|
||||
});
|
||||
|
||||
mapRef.value.on('draw.create', () => {
|
||||
if (applyingProgrammaticGeofence.value) return;
|
||||
geofenceEditedWithDraw.value = true;
|
||||
radiusTouched.value = false;
|
||||
syncGeofenceFromDraw();
|
||||
});
|
||||
|
||||
mapRef.value.on('draw.update', () => {
|
||||
if (applyingProgrammaticGeofence.value) return;
|
||||
geofenceEditedWithDraw.value = true;
|
||||
radiusTouched.value = false;
|
||||
syncGeofenceFromDraw();
|
||||
});
|
||||
|
||||
mapRef.value.on('draw.delete', () => {
|
||||
if (applyingProgrammaticGeofence.value) return;
|
||||
form.value.geofence = null;
|
||||
geofenceEditedWithDraw.value = false;
|
||||
});
|
||||
|
||||
mapRef.value.on('load', () => {
|
||||
mapReady.value = true;
|
||||
if (form.value.geofence) {
|
||||
setDrawGeofence(form.value.geofence);
|
||||
fitMapToGeofence(form.value.geofence);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const submitForm = () => {
|
||||
const payload = buildPostgisPayload();
|
||||
if (!payload) return;
|
||||
emit('submit', payload);
|
||||
};
|
||||
|
||||
const cancelForm = () => emit('cancel');
|
||||
|
||||
watch(
|
||||
() => props.initialData,
|
||||
(newData: typeof props.initialData) => {
|
||||
if (!newData) {
|
||||
form.value.geofence = null;
|
||||
geofenceEditedWithDraw.value = false;
|
||||
radiusTouched.value = false;
|
||||
if (drawRef.value) {
|
||||
drawRef.value.deleteAll();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
form.value.name = newData.name ?? '';
|
||||
form.value.description = newData.description ?? '';
|
||||
form.value.address = newData.address ?? '';
|
||||
form.value.city = newData.city ?? '';
|
||||
form.value.state = newData.state ?? '';
|
||||
form.value.country = newData.country ?? '';
|
||||
form.value.zip_code = newData.zip_code ?? '';
|
||||
radiusTouched.value = false;
|
||||
|
||||
const parsed = parseCoordinates(newData.coordinates ?? null);
|
||||
if (parsed) {
|
||||
updateLatLng(parsed.lat, parsed.lng);
|
||||
syncMarkerWithInputs();
|
||||
}
|
||||
|
||||
applyInitialGeofence(newData.geofence ?? null);
|
||||
},
|
||||
{ immediate: true, deep: true }
|
||||
);
|
||||
|
||||
const onRadiusInput = () => {
|
||||
radiusTouched.value = true;
|
||||
geofenceEditedWithDraw.value = false;
|
||||
previewGeofenceFromRadius();
|
||||
};
|
||||
|
||||
watch(
|
||||
() => [form.value.latitude, form.value.longitude],
|
||||
() => {
|
||||
syncMarkerWithInputs();
|
||||
|
||||
if (radiusTouched.value && !geofenceEditedWithDraw.value) {
|
||||
previewGeofenceFromRadius();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
initializeMap();
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
drawRef.value = null;
|
||||
if (mapRef.value) {
|
||||
mapRef.value.remove();
|
||||
mapRef.value = null;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex flex-col lg:flex-row gap-4 h-[calc(100vh-15rem)] overflow-hidden min-h-0">
|
||||
<div class="w-full lg:w-[25%] shrink-0 overflow-y-auto min-h-0">
|
||||
<Card>
|
||||
<template #content>
|
||||
<form class="space-y-2" @submit.prevent="submitForm">
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-gray-500 uppercase mb-1">Nombre de la Ubicación</label>
|
||||
<InputText v-model="form.name" class="w-full" placeholder="Ej. Centro Logístico Norte" />
|
||||
<small v-if="props.formErrors?.name" class="text-red-500">{{ props.formErrors.name[0] }}</small>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-gray-500 uppercase mb-1">Descripción</label>
|
||||
<Textarea v-model="form.description" rows="2" class="w-full" placeholder="Detalles operativos" />
|
||||
<small v-if="props.formErrors?.description" class="text-red-500">{{ props.formErrors.description[0] }}</small>
|
||||
</div>
|
||||
|
||||
<Card>
|
||||
<template #title>Dirección</template>
|
||||
<template #content>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-2">
|
||||
<div class="md:col-span-2">
|
||||
<label class="block text-xs font-semibold mb-1">Calle y Número</label>
|
||||
<Textarea v-model="form.address" rows="2" class="w-full" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold mb-1">Ciudad</label>
|
||||
<InputText v-model="form.city" class="w-full" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold mb-1">Estado</label>
|
||||
<InputText v-model="form.state" class="w-full" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold mb-1">País</label>
|
||||
<InputText v-model="form.country" class="w-full" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold mb-1">C.P.</label>
|
||||
<InputText v-model="form.zip_code" class="w-full" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<template #title>Geolocalización</template>
|
||||
<template #content>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-2">
|
||||
<div>
|
||||
<label class="block text-xs font-semibold mb-1">Latitud</label>
|
||||
<InputText v-model="form.latitude" class="w-full" placeholder="19.432600" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold mb-1">Longitud</label>
|
||||
<InputText v-model="form.longitude" class="w-full" placeholder="-99.133200" />
|
||||
</div>
|
||||
<div class="md:col-span-2">
|
||||
<label class="block text-xs font-semibold mb-1">Radio geocerca (metros)</label>
|
||||
<InputText v-model="form.geofence_radius_m" class="w-full" placeholder="75" @input="onRadiusInput" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</Card>
|
||||
|
||||
<div v-if="errorMessage" class="p-3 bg-red-50 border border-red-200 text-red-700 rounded-md text-sm">
|
||||
{{ errorMessage }}
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end gap-2">
|
||||
<Button type="button" text severity="secondary" label="Cancelar" @click="cancelForm" />
|
||||
<Button type="submit" :loading="props.loading" label="Guardar Ubicación" icon="pi pi-check" />
|
||||
</div>
|
||||
</form>
|
||||
</template>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
<div class="w-full lg:flex-1 min-w-0 min-h-0 flex flex-col">
|
||||
<Card class="h-full flex flex-col">
|
||||
<template #title>Mapa</template>
|
||||
<template #content>
|
||||
<div class="flex flex-col gap-3 h-full">
|
||||
<div class="flex gap-2">
|
||||
<InputText
|
||||
v-model="geocodingSearch"
|
||||
class="w-full"
|
||||
placeholder="Buscar dirección o referencia"
|
||||
@keyup.enter="searchAddress"
|
||||
/>
|
||||
<Button
|
||||
icon="pi pi-search"
|
||||
label="Buscar"
|
||||
:loading="geocodingLoading"
|
||||
@click="searchAddress"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div id="map" ref="mapContainer" class="w-full flex-1 min-h-80 lg:min-h-0 rounded-md border border-surface-200" />
|
||||
|
||||
<small v-if="!mapToken" class="text-amber-600">
|
||||
Define VITE_MAPBOX_TOKEN para habilitar el mapa.
|
||||
</small>
|
||||
<small v-else-if="mapReady" class="text-surface-500">
|
||||
Haz clic o arrastra el marcador para actualizar coordenadas y dirección.
|
||||
</small>
|
||||
</div>
|
||||
</template>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* Make the map Card grow and its content area fill remaining height */
|
||||
.lg\:flex-1 :deep(.p-card) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
.lg\:flex-1 :deep(.p-card-body),
|
||||
.lg\:flex-1 :deep(.p-card-content) {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
}
|
||||
.lg\:flex-1 :deep(.p-card-content > div) {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* Align Mapbox Draw controls with PrimeVue visual language */
|
||||
:deep(.mapboxgl-ctrl-group) {
|
||||
border: 1px solid var(--p-content-border-color, #d6d9de);
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 1px 4px rgb(15 23 42 / 12%);
|
||||
}
|
||||
|
||||
:deep(.mapboxgl-ctrl-group button) {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
background-color: var(--p-content-background, #ffffff);
|
||||
}
|
||||
|
||||
:deep(.mapboxgl-ctrl-group button:hover) {
|
||||
background-color: var(--p-surface-100, #f1f5f9);
|
||||
}
|
||||
|
||||
:deep(.mapboxgl-ctrl-group button:focus-visible) {
|
||||
outline: 2px solid var(--p-primary-color, #3b82f6);
|
||||
outline-offset: -2px;
|
||||
}
|
||||
</style>
|
||||
|
||||
410
src/modules/catalog/components/locations/Locations.vue
Normal file
410
src/modules/catalog/components/locations/Locations.vue
Normal file
@ -0,0 +1,410 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue';
|
||||
|
||||
import Card from 'primevue/card';
|
||||
import Button from 'primevue/button';
|
||||
import DataTable from 'primevue/datatable';
|
||||
import Column from 'primevue/column';
|
||||
import InputText from 'primevue/inputtext';
|
||||
import Paginator from 'primevue/paginator';
|
||||
import { useConfirm } from 'primevue/useconfirm';
|
||||
import { useToast } from 'primevue/usetoast';
|
||||
|
||||
import { locationServices } from '../../services/location.services';
|
||||
import type { Location, LocationCreateRequest, LocationFormErrors, LocationPaginatedResponse } from '../../types/locations.interfaces';
|
||||
import LocationForm from './LocationForm.vue';
|
||||
import { useAuth } from '@/modules/auth/composables/useAuth';
|
||||
|
||||
const locations = ref<Location[]>([]);
|
||||
const pagination = ref({
|
||||
first: 0,
|
||||
rows: 5,
|
||||
total: 0,
|
||||
page: 1,
|
||||
lastPage: 1,
|
||||
});
|
||||
const loading = ref(false);
|
||||
const submitting = ref(false);
|
||||
|
||||
const searchName = ref('');
|
||||
const searchCity = ref('');
|
||||
const searchState = ref('');
|
||||
const searchCountry = ref('');
|
||||
|
||||
const showFormDialog = ref(false);
|
||||
const isEditMode = ref(false);
|
||||
const currentLocation = ref<Location | null>(null);
|
||||
const formErrors = ref<LocationFormErrors>({});
|
||||
|
||||
const confirm = useConfirm();
|
||||
const toast = useToast();
|
||||
const { hasPermission } = useAuth();
|
||||
|
||||
const canViewLocations = computed(() =>
|
||||
hasPermission([
|
||||
'locations.index',
|
||||
'locations.show',
|
||||
'locations.store',
|
||||
'locations.update',
|
||||
'locations.destroy',
|
||||
])
|
||||
);
|
||||
const canCreateLocation = computed(() => hasPermission('locations.store'));
|
||||
const canUpdateLocation = computed(() => hasPermission('locations.update'));
|
||||
const canDeleteLocation = computed(() => hasPermission('locations.destroy'));
|
||||
|
||||
const handleCreateClick = () => {
|
||||
if (!canCreateLocation.value) {
|
||||
toast.add({ severity: 'warn', summary: 'Sin permisos', detail: 'No puedes crear ubicaciones.', life: 4000 });
|
||||
return;
|
||||
}
|
||||
|
||||
isEditMode.value = false;
|
||||
currentLocation.value = null;
|
||||
formErrors.value = {};
|
||||
showFormDialog.value = true;
|
||||
};
|
||||
|
||||
const handleEditClick = async (location: Location) => {
|
||||
if (!canUpdateLocation.value) {
|
||||
toast.add({ severity: 'warn', summary: 'Sin permisos', detail: 'No puedes actualizar ubicaciones.', life: 4000 });
|
||||
return;
|
||||
}
|
||||
|
||||
isEditMode.value = true;
|
||||
formErrors.value = {};
|
||||
|
||||
try {
|
||||
const response = await locationServices.getLocationById(location.id);
|
||||
currentLocation.value = response.data;
|
||||
showFormDialog.value = true;
|
||||
} catch (e) {
|
||||
toast.add({ severity: 'error', summary: 'Error', detail: 'No se pudo cargar la ubicación', life: 3000 });
|
||||
}
|
||||
};
|
||||
|
||||
const closeFormDialog = () => {
|
||||
showFormDialog.value = false;
|
||||
isEditMode.value = false;
|
||||
currentLocation.value = null;
|
||||
formErrors.value = {};
|
||||
};
|
||||
|
||||
const handleFormSubmit = async (payload: LocationCreateRequest) => {
|
||||
formErrors.value = {};
|
||||
submitting.value = true;
|
||||
|
||||
try {
|
||||
if (isEditMode.value && currentLocation.value) {
|
||||
await locationServices.updateLocation(currentLocation.value.id, payload, 'patch');
|
||||
toast.add({ severity: 'success', summary: 'Ubicación actualizada', detail: 'La ubicación se actualizó correctamente.', life: 3000 });
|
||||
} else {
|
||||
await locationServices.createLocation(payload);
|
||||
toast.add({ severity: 'success', summary: 'Ubicación creada', detail: 'La ubicación se registró correctamente.', life: 3000 });
|
||||
}
|
||||
|
||||
closeFormDialog();
|
||||
fetchLocations(pagination.value.page);
|
||||
} catch (e: any) {
|
||||
if (e?.response?.data?.errors) {
|
||||
formErrors.value = e.response.data.errors;
|
||||
}
|
||||
|
||||
toast.add({
|
||||
severity: 'error',
|
||||
summary: 'Error',
|
||||
detail: e?.response?.data?.message || 'No se pudo guardar la ubicación.',
|
||||
life: 3500,
|
||||
});
|
||||
} finally {
|
||||
submitting.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const handleDelete = (locationId: number) => {
|
||||
if (!canDeleteLocation.value) {
|
||||
toast.add({ severity: 'warn', summary: 'Sin permisos', detail: 'No puedes eliminar ubicaciones.', life: 4000 });
|
||||
return;
|
||||
}
|
||||
|
||||
confirm.require({
|
||||
message: '¿Seguro que deseas eliminar esta ubicación?',
|
||||
header: 'Confirmar eliminación',
|
||||
icon: 'pi pi-exclamation-triangle',
|
||||
acceptLabel: 'Sí, eliminar',
|
||||
rejectLabel: 'Cancelar',
|
||||
accept: async () => {
|
||||
try {
|
||||
await locationServices.deleteLocation(locationId);
|
||||
toast.add({ severity: 'success', summary: 'Eliminado', detail: 'Ubicación eliminada correctamente', life: 3000 });
|
||||
fetchLocations(pagination.value.page);
|
||||
} catch (e) {
|
||||
toast.add({ severity: 'error', summary: 'Error', detail: 'No se pudo eliminar la ubicación', life: 3000 });
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const fetchLocations = async (page = 1) => {
|
||||
if (!canViewLocations.value) {
|
||||
locations.value = [];
|
||||
pagination.value = {
|
||||
...pagination.value,
|
||||
page: 1,
|
||||
total: 0,
|
||||
first: 0,
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
||||
pagination.value.page = page;
|
||||
loading.value = true;
|
||||
|
||||
try {
|
||||
const name = searchName.value || undefined;
|
||||
const city = searchCity.value || undefined;
|
||||
const state = searchState.value || undefined;
|
||||
const country = searchCountry.value || undefined;
|
||||
|
||||
const response = await locationServices.getLocations(true, name, city, state, country);
|
||||
const paginated = response as LocationPaginatedResponse;
|
||||
|
||||
locations.value = paginated.data;
|
||||
pagination.value.total = paginated.total;
|
||||
pagination.value.page = paginated.current_page;
|
||||
pagination.value.lastPage = paginated.last_page;
|
||||
pagination.value.first = (paginated.current_page - 1) * paginated.per_page;
|
||||
pagination.value.rows = paginated.per_page;
|
||||
} catch (e) {
|
||||
toast.add({ severity: 'error', summary: 'Error', detail: 'No se pudieron cargar las ubicaciones.', life: 3000 });
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
watch(
|
||||
() => canViewLocations.value,
|
||||
(allowed) => {
|
||||
if (allowed) {
|
||||
fetchLocations();
|
||||
} else {
|
||||
locations.value = [];
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
const clearFilters = () => {
|
||||
searchName.value = '';
|
||||
searchCity.value = '';
|
||||
searchState.value = '';
|
||||
searchCountry.value = '';
|
||||
fetchLocations(1);
|
||||
};
|
||||
|
||||
const onFilter = () => {
|
||||
fetchLocations(1);
|
||||
};
|
||||
|
||||
const onPageChange = (event: any) => {
|
||||
const newPage = Math.floor(event.first / event.rows) + 1;
|
||||
fetchLocations(newPage);
|
||||
};
|
||||
|
||||
const hexToBytes = (hex: string): Uint8Array | null => {
|
||||
const normalized = hex.trim();
|
||||
if (normalized.length % 2 !== 0) return null;
|
||||
if (!/^[0-9a-fA-F]+$/.test(normalized)) return null;
|
||||
|
||||
const bytes = new Uint8Array(normalized.length / 2);
|
||||
for (let i = 0; i < normalized.length; i += 2) {
|
||||
bytes[i / 2] = Number.parseInt(normalized.slice(i, i + 2), 16);
|
||||
}
|
||||
|
||||
return bytes;
|
||||
};
|
||||
|
||||
const parseHexEwkbPoint = (value: string): { lat: number; lng: number } | null => {
|
||||
const bytes = hexToBytes(value);
|
||||
if (!bytes || bytes.length < 1 + 4 + 16) return null;
|
||||
|
||||
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
||||
const littleEndian = view.getUint8(0) === 1;
|
||||
|
||||
const typeWithFlags = view.getUint32(1, littleEndian);
|
||||
const hasSrid = (typeWithFlags & 0x20000000) !== 0;
|
||||
const geometryType = typeWithFlags & 0x0fffffff;
|
||||
if (geometryType !== 1) return null;
|
||||
|
||||
let offset = 1 + 4;
|
||||
if (hasSrid) {
|
||||
if (bytes.length < offset + 4 + 16) return null;
|
||||
offset += 4;
|
||||
}
|
||||
|
||||
if (bytes.length < offset + 16) return null;
|
||||
const lng = view.getFloat64(offset, littleEndian);
|
||||
const lat = view.getFloat64(offset + 8, littleEndian);
|
||||
if (Number.isNaN(lat) || Number.isNaN(lng)) return null;
|
||||
return { lat, lng };
|
||||
};
|
||||
|
||||
const parseCoordinates = (value?: string | null): { lat: number; lng: number } | null => {
|
||||
if (!value) return null;
|
||||
|
||||
const normalized = value.trim();
|
||||
const wkt = normalized.replace(/^SRID=\d+;/i, '');
|
||||
const match = wkt.match(/POINT\s*\(\s*([-\d.]+)\s+([-\d.]+)\s*\)/i);
|
||||
if (match) {
|
||||
const lng = Number(match[1]);
|
||||
const lat = Number(match[2]);
|
||||
if (Number.isNaN(lat) || Number.isNaN(lng)) return null;
|
||||
return { lat, lng };
|
||||
}
|
||||
|
||||
return parseHexEwkbPoint(normalized);
|
||||
};
|
||||
|
||||
const formatCoordinates = (value?: string | null): string => {
|
||||
const point = parseCoordinates(value);
|
||||
if (!point) return value || '-';
|
||||
|
||||
return `Lat ${point.lat.toFixed(6)}, Lng ${point.lng.toFixed(6)}`;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="space-y-6">
|
||||
<!-- Form view -->
|
||||
<template v-if="showFormDialog">
|
||||
<div class="flex items-center gap-3 mb-6">
|
||||
<Button icon="pi pi-arrow-left" text rounded @click="closeFormDialog" />
|
||||
<div>
|
||||
<h2 class="text-3xl font-black text-surface-900 dark:text-white tracking-tight">
|
||||
{{ isEditMode ? 'Editar Ubicación' : 'Nueva Ubicación' }}
|
||||
</h2>
|
||||
<p class="text-gray-500 dark:text-gray-400 text-sm mt-1">Administra los datos y la geolocalización de la ubicación.</p>
|
||||
</div>
|
||||
</div>
|
||||
<LocationForm
|
||||
:initialData="currentLocation || undefined"
|
||||
:formErrors="formErrors"
|
||||
:isEditing="isEditMode"
|
||||
:loading="submitting"
|
||||
@submit="handleFormSubmit"
|
||||
@cancel="closeFormDialog"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<!-- List view -->
|
||||
<template v-else>
|
||||
<div class="flex flex-col md:flex-row justify-between items-start md:items-center mb-8 gap-4">
|
||||
<div>
|
||||
<h2 class="text-3xl font-black text-surface-900 dark:text-white tracking-tight">Gestión de Ubicaciones</h2>
|
||||
<p class="text-gray-500 dark:text-gray-400 text-sm mt-1">Administra las ubicaciones operativas del sistema.</p>
|
||||
</div>
|
||||
<Button
|
||||
v-if="canCreateLocation"
|
||||
label="Nueva Ubicación"
|
||||
icon="pi pi-plus"
|
||||
@click="handleCreateClick"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Card v-if="canViewLocations">
|
||||
<template #content>
|
||||
<div class="grid grid-cols-1 md:grid-cols-5 gap-4 items-end">
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-gray-500 dark:text-gray-400 uppercase mb-2">Nombre</label>
|
||||
<InputText v-model="searchName" placeholder="Ej. Bodega Norte" class="w-full" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-gray-500 dark:text-gray-400 uppercase mb-2">Ciudad</label>
|
||||
<InputText v-model="searchCity" placeholder="Ej. Monterrey" class="w-full" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-gray-500 dark:text-gray-400 uppercase mb-2">Estado</label>
|
||||
<InputText v-model="searchState" placeholder="Ej. Nuevo León" class="w-full" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-gray-500 dark:text-gray-400 uppercase mb-2">País</label>
|
||||
<InputText v-model="searchCountry" placeholder="Ej. México" class="w-full" />
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<Button icon="pi pi-search" text rounded @click="onFilter" />
|
||||
<Button icon="pi pi-times" text rounded severity="secondary" label="Limpiar" @click="clearFilters" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</Card>
|
||||
|
||||
<Card v-if="canViewLocations">
|
||||
<template #content>
|
||||
<DataTable :value="locations" :loading="loading" stripedRows responsiveLayout="scroll" class="p-datatable-sm">
|
||||
<Column field="name" header="Nombre" style="min-width: 180px" />
|
||||
<Column field="address" header="Dirección" style="min-width: 220px" />
|
||||
<Column field="city" header="Ciudad" style="min-width: 140px" />
|
||||
<Column field="state" header="Estado" style="min-width: 140px" />
|
||||
<Column field="country" header="País" style="min-width: 120px" />
|
||||
<Column field="zip_code" header="CP" style="min-width: 100px" />
|
||||
<Column header="Coordenadas" style="min-width: 220px">
|
||||
<template #body="{ data }">
|
||||
<span class="font-mono text-xs">
|
||||
{{ formatCoordinates(data.coordinates) }}
|
||||
</span>
|
||||
</template>
|
||||
</Column>
|
||||
<Column field="geofence" header="Geocerca" style="min-width: 180px">
|
||||
<template #body="{ data }">
|
||||
<span class="text-xs">{{ data.geofence ? 'Definida' : 'Sin definir' }}</span>
|
||||
</template>
|
||||
</Column>
|
||||
<Column field="created_at" header="Fecha de Registro" style="min-width: 120px">
|
||||
<template #body="{ data }">
|
||||
<span class="text-sm">{{ new Date(data.created_at).toLocaleDateString('es-MX') }}</span>
|
||||
</template>
|
||||
</Column>
|
||||
<Column header="Acciones" headerStyle="text-align: right" bodyStyle="text-align: right" style="min-width: 130px">
|
||||
<template #body="{ data }">
|
||||
<div class="flex items-center justify-end gap-2">
|
||||
<Button
|
||||
v-if="canUpdateLocation"
|
||||
icon="pi pi-pencil"
|
||||
text
|
||||
rounded
|
||||
size="small"
|
||||
@click="handleEditClick(data)"
|
||||
/>
|
||||
<Button
|
||||
v-if="canDeleteLocation"
|
||||
icon="pi pi-trash"
|
||||
text
|
||||
rounded
|
||||
size="small"
|
||||
severity="danger"
|
||||
@click="handleDelete(data.id)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</Column>
|
||||
</DataTable>
|
||||
<div class="mt-4">
|
||||
<Paginator :first="pagination.first" :rows="pagination.rows" :totalRecords="pagination.total" :rowsPerPageOptions="[5, 10, 20, 50]" @page="onPageChange" />
|
||||
</div>
|
||||
</template>
|
||||
</Card>
|
||||
|
||||
<Card v-else>
|
||||
<template #content>
|
||||
<div class="text-center py-10 text-surface-500 dark:text-surface-400">
|
||||
<i class="pi pi-lock text-4xl mb-3"></i>
|
||||
<p>No tienes permisos para visualizar este módulo.</p>
|
||||
</div>
|
||||
</template>
|
||||
</Card>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<ConfirmDialog />
|
||||
<Toast />
|
||||
</template>
|
||||
@ -32,6 +32,9 @@ const pagination = ref({
|
||||
const loading = ref(false);
|
||||
const loadingSupplier = ref(false);
|
||||
|
||||
const selectedType = ref(null);
|
||||
const searchName = ref('');
|
||||
|
||||
// Modal state and form fields
|
||||
const showModal = ref(false);
|
||||
const isEditMode = ref(false);
|
||||
@ -139,10 +142,6 @@ const supplierTypes = [
|
||||
{ label: 'Ambos', value: 'Ambos' },
|
||||
];
|
||||
|
||||
const selectedType = ref(null);
|
||||
const searchName = ref('');
|
||||
|
||||
|
||||
const clearFilters = () => {
|
||||
searchName.value = '';
|
||||
selectedType.value = null;
|
||||
|
||||
81
src/modules/catalog/services/location.services.ts
Normal file
81
src/modules/catalog/services/location.services.ts
Normal file
@ -0,0 +1,81 @@
|
||||
import api from '../../../services/api';
|
||||
import type {
|
||||
LocationCreateRequest,
|
||||
LocationCreateResponse,
|
||||
LocationDeleteResponse,
|
||||
LocationListResponse,
|
||||
LocationPaginatedResponse,
|
||||
LocationUpdateRequest,
|
||||
LocationUpdateResponse,
|
||||
} from '../types/locations.interfaces';
|
||||
|
||||
const locationServices = {
|
||||
async getLocations(
|
||||
paginated?: boolean,
|
||||
name?: string,
|
||||
city?: string,
|
||||
state?: string,
|
||||
country?: string
|
||||
): Promise<LocationPaginatedResponse | LocationListResponse> {
|
||||
try {
|
||||
const params: any = {};
|
||||
if (paginated === false) params.paginated = false;
|
||||
if (name) params.name = name;
|
||||
if (city) params.city = city;
|
||||
if (state) params.state = state;
|
||||
if (country) params.country = country;
|
||||
|
||||
const response = await api.get('/api/locations', { params });
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error('Error fetching locations:', error);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
|
||||
async getLocationById(locationId: number): Promise<LocationCreateResponse> {
|
||||
try {
|
||||
const response = await api.get(`/api/locations/${locationId}`);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error(`Error fetching location with ID ${locationId}:`, error);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
|
||||
async createLocation(data: LocationCreateRequest): Promise<LocationCreateResponse> {
|
||||
try {
|
||||
const response = await api.post('/api/locations', data);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error('Error creating location:', error);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
|
||||
async updateLocation(
|
||||
locationId: number,
|
||||
data: LocationUpdateRequest,
|
||||
method: 'patch' | 'put' = 'patch'
|
||||
): Promise<LocationUpdateResponse> {
|
||||
try {
|
||||
const response = await api[method](`/api/locations/${locationId}`, data);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error(`Error updating location with ID ${locationId}:`, error);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
|
||||
async deleteLocation(locationId: number): Promise<LocationDeleteResponse> {
|
||||
try {
|
||||
const response = await api.delete(`/api/locations/${locationId}`);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error(`Error deleting location with ID ${locationId}:`, error);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export { locationServices };
|
||||
83
src/modules/catalog/types/locations.interfaces.ts
Normal file
83
src/modules/catalog/types/locations.interfaces.ts
Normal file
@ -0,0 +1,83 @@
|
||||
import type { Polygon } from 'geojson';
|
||||
|
||||
export type LocationGeofenceGeoJSON = Polygon;
|
||||
|
||||
export interface LocationFormErrors {
|
||||
name?: string[];
|
||||
description?: string[];
|
||||
address?: string[];
|
||||
city?: string[];
|
||||
state?: string[];
|
||||
country?: string[];
|
||||
zip_code?: string[];
|
||||
coordinates?: string[];
|
||||
geofence?: string[];
|
||||
}
|
||||
|
||||
export interface Location {
|
||||
id: number;
|
||||
name: string;
|
||||
description: string | null;
|
||||
address: string | null;
|
||||
city: string | null;
|
||||
state: string | null;
|
||||
country: string | null;
|
||||
zip_code: string | null;
|
||||
coordinates: string | null;
|
||||
geofence: LocationGeofenceGeoJSON | null;
|
||||
tenant_id: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
deleted_at: string | null;
|
||||
}
|
||||
|
||||
export interface LocationPaginationLink {
|
||||
url: string | null;
|
||||
label: string;
|
||||
active: boolean;
|
||||
}
|
||||
|
||||
export interface LocationPaginatedResponse {
|
||||
current_page: number;
|
||||
data: Location[];
|
||||
first_page_url: string;
|
||||
from: number;
|
||||
last_page: number;
|
||||
last_page_url: string;
|
||||
links: LocationPaginationLink[];
|
||||
next_page_url: string | null;
|
||||
path: string;
|
||||
per_page: number;
|
||||
prev_page_url: string | null;
|
||||
to: number;
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface LocationListResponse {
|
||||
data: Location[];
|
||||
}
|
||||
|
||||
export interface LocationCreateRequest {
|
||||
name: string;
|
||||
description?: string | null;
|
||||
address?: string | null;
|
||||
city?: string | null;
|
||||
state?: string | null;
|
||||
country?: string | null;
|
||||
zip_code?: string | null;
|
||||
coordinates?: string | null;
|
||||
geofence?: LocationGeofenceGeoJSON | null;
|
||||
}
|
||||
|
||||
export type LocationUpdateRequest = Partial<LocationCreateRequest>;
|
||||
|
||||
export interface LocationCreateResponse {
|
||||
data: Location;
|
||||
}
|
||||
|
||||
export type LocationUpdateResponse = LocationCreateResponse;
|
||||
|
||||
export interface LocationDeleteResponse {
|
||||
message: string;
|
||||
data: null;
|
||||
}
|
||||
@ -31,6 +31,7 @@ import Departments from '../modules/rh/components/departments/Departments.vue';
|
||||
import Companies from '../modules/catalog/components/companies/Companies.vue';
|
||||
import '../modules/catalog/components/suppliers/Suppliers.vue';
|
||||
import Suppliers from '../modules/catalog/components/suppliers/Suppliers.vue';
|
||||
import Locations from '../modules/catalog/components/locations/Locations.vue';
|
||||
import Purchases from '../modules/purchases/components/Purchases.vue';
|
||||
import PurchaseDetails from '../modules/purchases/components/PurchaseDetails.vue';
|
||||
import PurchaseForm from '../modules/purchases/components/PurchaseForm.vue';
|
||||
@ -195,6 +196,15 @@ const routes: RouteRecordRaw[] = [
|
||||
requiresAuth: true
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'locations',
|
||||
name: 'Locations',
|
||||
component: Locations,
|
||||
meta: {
|
||||
title: 'Ubicaciones',
|
||||
requiresAuth: true
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'model-documents',
|
||||
name: 'ModelDocuments',
|
||||
|
||||
32
src/types/mapbox-gl-draw.d.ts
vendored
Normal file
32
src/types/mapbox-gl-draw.d.ts
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
declare module '@mapbox/mapbox-gl-draw' {
|
||||
import type { FeatureCollection, Polygon } from 'geojson';
|
||||
|
||||
type DrawMode = 'simple_select' | 'direct_select' | 'draw_polygon' | string;
|
||||
|
||||
interface DrawControls {
|
||||
point?: boolean;
|
||||
line_string?: boolean;
|
||||
polygon?: boolean;
|
||||
trash?: boolean;
|
||||
combine_features?: boolean;
|
||||
uncombine_features?: boolean;
|
||||
}
|
||||
|
||||
interface DrawOptions {
|
||||
displayControlsDefault?: boolean;
|
||||
controls?: DrawControls;
|
||||
defaultMode?: DrawMode;
|
||||
}
|
||||
|
||||
export default class MapboxDraw {
|
||||
constructor(options?: DrawOptions);
|
||||
add(feature: GeoJSON.Feature): string[] | string;
|
||||
get(id: string): GeoJSON.Feature | undefined;
|
||||
getAll(): FeatureCollection;
|
||||
delete(id: string): void;
|
||||
deleteAll(): void;
|
||||
getMode(): DrawMode;
|
||||
}
|
||||
|
||||
export type DrawPolygonFeature = GeoJSON.Feature<Polygon>;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user