From 388fc57404a8881d27f37957e4b63aedb046431c Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 23 Nov 2023 13:28:15 +0100 Subject: [PATCH 01/12] refs #6274 proxy created --- README.md | 20 +- config.js | 4 - js/main.js | 7 +- package-lock.json | 916 +++++++++++++++++++++++++++++++++++++++++++++- package.json | 10 +- proxy.js | 17 + 6 files changed, 958 insertions(+), 16 deletions(-) create mode 100644 proxy.js diff --git a/README.md b/README.md index 5a34c8f..7f1f153 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,16 @@ -# Time control for workers +# Worker Time Control -Launch application in development environment. -``` -$ php -S 0.0.0.0:9090 -t . -``` +Worker Time Control is a project developed by Verdnatura Levante SL, designed to manage time-related functionalities. This application helps in efficient time tracking and management for workers. + +## Installation + +1. Clone the repository: + + git clone https://gitea.verdnatura.es/verdnatura/worker-time-control +3. Install dependencies using npm: + + npm install + +## Usage + + npm start diff --git a/config.js b/config.js index b3b50d2..0c0f7da 100644 --- a/config.js +++ b/config.js @@ -2,7 +2,3 @@ var process = { env: {NODE_ENV: 'development'} }; - -var config = { - urlBase: 'http://localhost:8080' -}; diff --git a/js/main.js b/js/main.js index a5704d5..9aed537 100644 --- a/js/main.js +++ b/js/main.js @@ -1,5 +1,3 @@ -var urlBase = config.urlBase; - function confirmReset() { $(".confirm").removeClass('confirmKO'); $(".txtConfirm").empty(); @@ -25,10 +23,9 @@ $.ajaxPrefilter(function(xhr) { } Object.assign(xhr, { - url: `${urlBase}/workerTimeControl/${xhr.urlPath}`, + url: `api/WorkerTimeControls/${xhr.urlPath}`, headers: { - 'version': '1', - 'aplicacion': 'workerTimeControl' + //Authorization : token }, timeout: 1000, contentType: 'application/json; charset=utf-8', diff --git a/package-lock.json b/package-lock.json index c9acfc1..ff71a06 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,22 +10,936 @@ "license": "GPL-3.0", "dependencies": { "fastclick": "^1.0.6", - "jquery": "^3.7.0" + "jquery": "^3.7.0", + "sweetalert2": "^11.6.13" + }, + "devDependencies": { + "express": "^4.18.2", + "http-proxy-middleware": "^2.0.6" }, "engines": { "node": ">=14", "npm": ">=8" } }, + "node_modules/@types/http-proxy": { + "version": "1.17.13", + "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.13.tgz", + "integrity": "sha512-GkhdWcMNiR5QSQRYnJ+/oXzu0+7JJEPC8vkWXK351BkhjraZF+1W13CUYARUvX9+NqIU2n6YHA4iwywsc/M6Sw==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/node": { + "version": "20.8.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.10.tgz", + "integrity": "sha512-TlgT8JntpcbmKUFzjhsyhGfP2fsiz1Mv56im6enJ905xG1DAYesxJaeSbGqQmAw8OWPdhyJGhGSQGKRNJ45u9w==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dev": true, + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", + "dev": true + }, + "node_modules/body-parser": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", + "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "dev": true, + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.1", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz", + "integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.1", + "set-function-length": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dev": true, + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", + "dev": true + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/define-data-property": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", + "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "dev": true, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "dev": true + }, + "node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "dev": true + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "dev": true + }, + "node_modules/express": { + "version": "4.18.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", + "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "dev": true, + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.1", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.5.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.11.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + } + }, "node_modules/fastclick": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/fastclick/-/fastclick-1.0.6.tgz", "integrity": "sha1-FhYlsnsaWAZAWTa9qaLBkm0Gvmo=" }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/finalhandler": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", + "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "dev": true, + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", + "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/function-bind": { + "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" + } + }, + "node_modules/get-intrinsic": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz", + "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", + "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dev": true, + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/http-proxy": { + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", + "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", + "dev": true, + "dependencies": { + "eventemitter3": "^4.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/http-proxy-middleware": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.6.tgz", + "integrity": "sha512-ya/UeJ6HVBYxrgYotAZo1KvPWlgB48kUJLDePFeneHsVujFaW5WNj2NgWCAE//B1Dl02BIfYlpNgBy8Kf8Rjmw==", + "dev": true, + "dependencies": { + "@types/http-proxy": "^1.17.8", + "http-proxy": "^1.18.1", + "is-glob": "^4.0.1", + "is-plain-obj": "^3.0.0", + "micromatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "@types/express": "^4.17.13" + }, + "peerDependenciesMeta": { + "@types/express": { + "optional": true + } + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-plain-obj": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-3.0.0.tgz", + "integrity": "sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/jquery": { "version": "3.7.0", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.0.tgz", "integrity": "sha512-umpJ0/k8X0MvD1ds0P9SfowREz2LenHsQaxSohMZ5OMNEU2r0tf8pdeEFTHMFxWVxKNyU9rTtK3CWzUCTKJUeQ==" + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==", + "dev": true + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true, + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-inspect": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dev": true, + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==", + "dev": true + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dev": true, + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "dev": true, + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", + "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "dev": true, + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", + "dev": true + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "node_modules/send": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "dev": true, + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/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 + }, + "node_modules/serve-static": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "dev": true, + "dependencies": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/set-function-length": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz", + "integrity": "sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.1", + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "dev": true + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/sweetalert2": { + "version": "11.10.1", + "resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.10.1.tgz", + "integrity": "sha512-qu145oBuFfjYr5yZW9OSdG6YmRxDf8CnkgT/sXMfrXGe+asFy2imC2vlaLQ/L/naZ/JZna1MPAY56G4qYM0VUQ==", + "funding": { + "type": "individual", + "url": "https://github.com/sponsors/limonte" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "dev": true, + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dev": true, + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "dev": true, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "dev": true, + "engines": { + "node": ">= 0.8" + } } } } diff --git a/package.json b/package.json index 65f6a57..f7d2f98 100644 --- a/package.json +++ b/package.json @@ -8,12 +8,20 @@ "type": "git", "url": "https://gitea.verdnatura.es/verdnatura/worker-time-control" }, + "scripts": { + "start": "node proxy.js" + }, "engines": { "node": ">=14", "npm": ">=8" }, "dependencies": { "fastclick": "^1.0.6", - "jquery": "^3.7.0" + "jquery": "^3.7.0", + "sweetalert2": "^11.6.13" + }, + "devDependencies": { + "express": "^4.18.2", + "http-proxy-middleware": "^2.0.6" } } diff --git a/proxy.js b/proxy.js new file mode 100644 index 0000000..defde31 --- /dev/null +++ b/proxy.js @@ -0,0 +1,17 @@ +const express = require('express'); +const { createProxyMiddleware } = require('http-proxy-middleware'); + +const app = express(); + +const apiProxy = createProxyMiddleware('/api', { + target: 'http://localhost:3000', + changeOrigin: true, +}); + +app.use('/api', apiProxy); +app.use('/', express.static(__dirname)); + +const port = 4000; +app.listen(port, () => { + console.log(`Server running on port: ${port}`); +}); -- 2.40.1 From 4566368d101083d823484ba211be71d004fdbf0e Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 28 Nov 2023 14:50:11 +0100 Subject: [PATCH 02/12] refs #6274 login modal, salix requests & proxy --- index.html | 1 + js/clockIn.js | 18 ++++++++++++------ js/index.js | 39 ++++++++++++++++++++++++++++++++++----- js/main.js | 10 +++------- js/sweetalert2.js | 6 ++++++ package-lock.json | 12 +----------- package.json | 3 +-- 7 files changed, 58 insertions(+), 31 deletions(-) create mode 100644 js/sweetalert2.js diff --git a/index.html b/index.html index a06904e..e62c44a 100644 --- a/index.html +++ b/index.html @@ -88,6 +88,7 @@ and open the template in the editor.

+ diff --git a/js/clockIn.js b/js/clockIn.js index bb33d19..532dd11 100644 --- a/js/clockIn.js +++ b/js/clockIn.js @@ -1,7 +1,7 @@ var userData = ""; $(document).ready(function () { - userData = $.parseJSON(localStorage.getItem("userData")); + userData = JSON.parse(localStorage.getItem("userData")); FastClick.attach(document.body); setView(); setEvents(); @@ -43,9 +43,14 @@ function setView() { } function fichar(direction) { + const data = { + workerFk: userData['userFk'], + direction + } + $.post({ - urlPath: 'clockIn', - jsonData: [userData['userFk'], direction], + urlPath: 'WorkerTimeControls/clockIn', + jsonData: data, processData: false, success: function (msg) { if (msg[0].error){ @@ -81,9 +86,10 @@ function setView() { } function getInfo() { - $.post({ - urlPath: 'getClockIn', - jsonData: [userData['userFk']], + const queryString = $.param({ workerFk: userData['userFk'] }); + + $.get({ + urlPath: `WorkerTimeControls/getClockIn?${queryString}`, processData: false, success: function (data) { $('.footer').show(); diff --git a/js/index.js b/js/index.js index 577cbaa..fa902b6 100644 --- a/js/index.js +++ b/js/index.js @@ -1,5 +1,7 @@ var pin = ""; var datoUsuario = ""; +var user = ""; +var pass = ""; $(document).ready(function () { FastClick.attach(document.body); @@ -9,9 +11,25 @@ $(document).ready(function () { function setEvents() { const heartEl = document.querySelector('body > h1 > span'); heartEl.addEventListener('click', function() { - const key = prompt('Introduce la clave'); - if (key === null) return - localStorage.setItem('vnKey', key); + Swal.fire({ + title: 'Iniciar sesión', + html: + '' + + '', + confirmButtonText: 'Login', + showCloseButton: true, + showCancelButton: false, + }).then(async (result) => { + if(result.isConfirmed) { + const user =$('#user').val(); + const pass = $('#pass').val(); + signIn(user,pass); + } + }); + + let token; + if (token === null) return + localStorage.setItem('token', token); }); $(".btnnum").on("click", function () { @@ -36,8 +54,8 @@ function setEvents() { function login() { $.post({ - urlPath: 'login', - jsonData: [pin], + urlPath: 'WorkerTimeControls/login', + jsonData: {pin}, processData: false, success: function (data) { localStorage.setItem("userData", JSON.stringify(data)); @@ -48,5 +66,16 @@ function login() { pin = ""; } }); +} +function signIn(user, password) { + $.post({ + urlPath: 'vnUsers/sign-in', + jsonData: {user, password}, + processData: false, + success: function (data) { + localStorage.setItem("token", data.token); + localStorage.setItem("ttl", data.ttl); + }, + }) } \ No newline at end of file diff --git a/js/main.js b/js/main.js index 9aed537..e2aae1f 100644 --- a/js/main.js +++ b/js/main.js @@ -16,16 +16,12 @@ function printError(msg){ $.ajaxPrefilter(function(xhr) { var orgErrorHandler = xhr.error; - - var key = localStorage.getItem('vnKey'); - if (key) { - xhr.jsonData.push(key) - } + var token = localStorage.getItem('token') Object.assign(xhr, { - url: `api/WorkerTimeControls/${xhr.urlPath}`, + url: `api/${xhr.urlPath}`, headers: { - //Authorization : token + Authorization : token }, timeout: 1000, contentType: 'application/json; charset=utf-8', diff --git a/js/sweetalert2.js b/js/sweetalert2.js new file mode 100644 index 0000000..721fa2a --- /dev/null +++ b/js/sweetalert2.js @@ -0,0 +1,6 @@ +/*! +* sweetalert2 v11.10.1 +* Released under the MIT License. +*/ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Sweetalert2=e()}(this,(function(){"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,o=new Array(e);no?1:n .").concat(C[e]));case"checkbox":return t.querySelector(".".concat(C.popup," > .").concat(C.checkbox," input"));case"radio":return t.querySelector(".".concat(C.popup," > .").concat(C.radio," input:checked"))||t.querySelector(".".concat(C.popup," > .").concat(C.radio," input:first-child"));case"range":return t.querySelector(".".concat(C.popup," > .").concat(C.range," input"));default:return t.querySelector(".".concat(C.popup," > .").concat(C.input))}},it=function(t){if(t.focus(),"file"!==t.type){var e=t.value;t.value="",t.value=e}},rt=function(t,e,n){t&&e&&("string"==typeof e&&(e=e.split(/\s+/).filter(Boolean)),e.forEach((function(e){Array.isArray(t)?t.forEach((function(t){n?t.classList.add(e):t.classList.remove(e)})):n?t.classList.add(e):t.classList.remove(e)})))},at=function(t,e){rt(t,e,!0)},ct=function(t,e){rt(t,e,!1)},ut=function(t,e){for(var n=Array.from(t.children),o=0;o1&&void 0!==arguments[1]?arguments[1]:"flex";t&&(t.style.display=e)},dt=function(t){t&&(t.style.display="none")},ft=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"block";t&&new MutationObserver((function(){mt(t,t.innerHTML,e)})).observe(t,{childList:!0,subtree:!0})},pt=function(t,e,n,o){var i=t.querySelector(e);i&&(i.style[n]=o)},mt=function(t,e){e?lt(t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"flex"):dt(t)},ht=function(t){return!(!t||!(t.offsetWidth||t.offsetHeight||t.getClientRects().length))},vt=function(t){return!!(t.scrollHeight>t.clientHeight)},gt=function(t){var e=window.getComputedStyle(t),n=parseFloat(e.getPropertyValue("animation-duration")||"0"),o=parseFloat(e.getPropertyValue("transition-duration")||"0");return n>0||o>0},bt=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=$();n&&ht(n)&&(e&&(n.style.transition="none",n.style.width="100%"),setTimeout((function(){n.style.transition="width ".concat(t/1e3,"s linear"),n.style.width="0%"}),10))},yt=function(){return"undefined"==typeof window||"undefined"==typeof document},wt='\n
\n \n
    \n
    \n \n

    \n
    \n \n \n
    \n \n \n
    \n \n
    \n \n \n
    \n
    \n
    \n \n \n \n
    \n
    \n
    \n
    \n
    \n
    \n').replace(/(^|\n)\s*/g,""),Ct=function(){b.currentInstance.resetValidationMessage()},At=function(t){var e,n=!!(e=M())&&(e.remove(),ct([document.documentElement,document.body],[C["no-backdrop"],C["toast-shown"],C["has-column"]]),!0);if(yt())P("SweetAlert2 requires document to initialize");else{var o=document.createElement("div");o.className=C.container,n&&at(o,C["no-transition"]),tt(o,wt);var i,r,a,c,u,s,l,d,f,p="string"==typeof(i=t.target)?document.querySelector(i):i;p.appendChild(o),function(t){var e=D();e.setAttribute("role",t.toast?"alert":"dialog"),e.setAttribute("aria-live",t.toast?"polite":"assertive"),t.toast||e.setAttribute("aria-modal","true")}(t),function(t){"rtl"===window.getComputedStyle(t).direction&&at(M(),C.rtl)}(p),r=D(),a=ut(r,C.input),c=ut(r,C.file),u=r.querySelector(".".concat(C.range," input")),s=r.querySelector(".".concat(C.range," output")),l=ut(r,C.select),d=r.querySelector(".".concat(C.checkbox," input")),f=ut(r,C.textarea),a.oninput=Ct,c.onchange=Ct,l.onchange=Ct,d.onchange=Ct,f.oninput=Ct,u.oninput=function(){Ct(),s.value=u.value},u.onchange=function(){Ct(),s.value=u.value}}},kt=function(e,n){e instanceof HTMLElement?n.appendChild(e):"object"===t(e)?Et(e,n):e&&tt(n,e)},Et=function(t,e){t.jquery?Bt(e,t):tt(e,t.toString())},Bt=function(t,e){if(t.textContent="",0 in e)for(var n=0;n in e;n++)t.appendChild(e[n].cloneNode(!0));else t.appendChild(e.cloneNode(!0))},Pt=function(){if(yt())return!1;var t=document.createElement("div");return void 0!==t.style.webkitAnimation?"webkitAnimationEnd":void 0!==t.style.animation&&"animationend"}(),Tt=function(t,e){var n=Y(),o=K();n&&o&&(e.showConfirmButton||e.showDenyButton||e.showCancelButton?lt(n):dt(n),nt(n,e,"actions"),function(t,e,n){var o=U(),i=W(),r=z();if(!o||!i||!r)return;xt(o,"confirm",n),xt(i,"deny",n),xt(r,"cancel",n),function(t,e,n,o){if(!o.buttonsStyling)return void ct([t,e,n],C.styled);at([t,e,n],C.styled),o.confirmButtonColor&&(t.style.backgroundColor=o.confirmButtonColor,at(t,C["default-outline"]));o.denyButtonColor&&(e.style.backgroundColor=o.denyButtonColor,at(e,C["default-outline"]));o.cancelButtonColor&&(n.style.backgroundColor=o.cancelButtonColor,at(n,C["default-outline"]))}(o,i,r,n),n.reverseButtons&&(n.toast?(t.insertBefore(r,o),t.insertBefore(i,o)):(t.insertBefore(r,e),t.insertBefore(i,e),t.insertBefore(o,e)))}(n,o,e),tt(o,e.loaderHtml||""),nt(o,e,"loader"))};function xt(t,e,n){var o=E(e);mt(t,n["show".concat(o,"Button")],"inline-block"),tt(t,n["".concat(e,"ButtonText")]||""),t.setAttribute("aria-label",n["".concat(e,"ButtonAriaLabel")]||""),t.className=C[e],nt(t,n,"".concat(e,"Button"))}var St=function(t,e){var n=M();n&&(!function(t,e){"string"==typeof e?t.style.background=e:e||at([document.documentElement,document.body],C["no-backdrop"])}(n,e.backdrop),function(t,e){if(!e)return;e in C?at(t,C[e]):(B('The "position" parameter is not valid, defaulting to "center"'),at(t,C.center))}(n,e.position),function(t,e){if(!e)return;at(t,C["grow-".concat(e)])}(n,e.grow),nt(n,e,"container"))};var Ot={innerParams:new WeakMap,domCache:new WeakMap},Lt=["input","file","range","select","radio","checkbox","textarea"],jt=function(t){if(t.input)if(Rt[t.input]){var e=qt(t.input),n=Rt[t.input](e,t);lt(e),t.inputAutoFocus&&setTimeout((function(){it(n)}))}else P("Unexpected type of input! Expected ".concat(Object.keys(Rt).join(" | "),', got "').concat(t.input,'"'))},Mt=function(t,e){var n=ot(D(),t);if(n)for(var o in function(t){for(var e=0;en?D().style.width="".concat(i,"px"):st(D(),"width",e.width)}})).observe(t,{attributes:!0,attributeFilter:["style"]})}})),t};var _t=function(t,e){var n=R();n&&(ft(n),nt(n,e,"htmlContainer"),e.html?(kt(e.html,n),lt(n,"block")):e.text?(n.textContent=e.text,lt(n,"block")):dt(n),function(t,e){var n=D();if(n){var o=Ot.innerParams.get(t),i=!o||e.input!==o.input;Lt.forEach((function(t){var o=ut(n,C[t]);o&&(Mt(t,e.inputAttributes),o.className=C[t],i&&dt(o))})),e.input&&(i&&jt(e),It(e))}}(t,e))},Nt=function(t,e){for(var n=0,o=Object.entries(A);n\n \n
    \n
    \n',n=n.replace(/ style=".*?"/g,"");else if("error"===e.icon)o='\n \n \n \n \n';else if(e.icon){o=Wt({question:"?",warning:"!",info:"i"}[e.icon])}n.trim()!==o.trim()&&tt(t,o)}},zt=function(t,e){if(e.iconColor){t.style.color=e.iconColor,t.style.borderColor=e.iconColor;for(var n=0,o=[".swal2-success-line-tip",".swal2-success-line-long",".swal2-x-mark-line-left",".swal2-x-mark-line-right"];n').concat(t,"")},Kt=function(t,e){var n=e.showClass||{};t.className="".concat(C.popup," ").concat(ht(t)?n.popup:""),e.toast?(at([document.documentElement,document.body],C["toast-shown"]),at(t,C.toast)):at(t,C.modal),nt(t,e,"popup"),"string"==typeof e.customClass&&at(t,e.customClass),e.icon&&at(t,C["icon-".concat(e.icon)])},Yt=function(t){var e=document.createElement("li");return at(e,C["progress-step"]),tt(e,t),e},Zt=function(t){var e=document.createElement("li");return at(e,C["progress-step-line"]),t.progressStepsDistance&&st(e,"width",t.progressStepsDistance),e},$t=function(t,e){!function(t,e){var n=M(),o=D();if(n&&o){if(e.toast){st(n,"width",e.width),o.style.width="100%";var i=K();i&&o.insertBefore(i,q())}else st(o,"width",e.width);st(o,"padding",e.padding),e.color&&(o.style.color=e.color),e.background&&(o.style.background=e.background),dt(F()),Kt(o,e)}}(0,e),St(0,e),function(t,e){var n=N();if(n){var o=e.progressSteps,i=e.currentProgressStep;o&&0!==o.length&&void 0!==i?(lt(n),n.textContent="",i>=o.length&&B("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),o.forEach((function(t,r){var a=Yt(t);if(n.appendChild(a),r===i&&at(a,C["active-progress-step"]),r!==o.length-1){var c=Zt(e);n.appendChild(c)}}))):dt(n)}}(0,e),function(t,e){var n=Ot.innerParams.get(t),o=q();if(o){if(n&&e.icon===n.icon)return Ut(o,e),void Nt(o,e);if(e.icon||e.iconHtml){if(e.icon&&-1===Object.keys(A).indexOf(e.icon))return P('Unknown icon! Expected "success", "error", "warning", "info" or "question", got "'.concat(e.icon,'"')),void dt(o);lt(o),Ut(o,e),Nt(o,e),at(o,e.showClass&&e.showClass.icon)}else dt(o)}}(t,e),function(t,e){var n=_();n&&(e.imageUrl?(lt(n,""),n.setAttribute("src",e.imageUrl),n.setAttribute("alt",e.imageAlt||""),st(n,"width",e.imageWidth),st(n,"height",e.imageHeight),n.className=C.image,nt(n,e,"image")):dt(n))}(0,e),function(t,e){var n=V();n&&(ft(n),mt(n,e.title||e.titleText,"block"),e.title&&kt(e.title,n),e.titleText&&(n.innerText=e.titleText),nt(n,e,"title"))}(0,e),function(t,e){var n=J();n&&(tt(n,e.closeButtonHtml||""),nt(n,e,"closeButton"),mt(n,e.showCloseButton),n.setAttribute("aria-label",e.closeButtonAriaLabel||""))}(0,e),_t(t,e),Tt(0,e),function(t,e){var n=Z();n&&(ft(n),mt(n,e.footer,"block"),e.footer&&kt(e.footer,n),nt(n,e,"footer"))}(0,e);var n=D();"function"==typeof e.didRender&&n&&e.didRender(n)},Jt=function(){var t;return null===(t=U())||void 0===t?void 0:t.click()},Xt=Object.freeze({cancel:"cancel",backdrop:"backdrop",close:"close",esc:"esc",timer:"timer"}),Gt=function(t){t.keydownTarget&&t.keydownHandlerAdded&&(t.keydownTarget.removeEventListener("keydown",t.keydownHandler,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!1)},Qt=function(t,e){var n,o=X();if(o.length)return(t+=e)===o.length?t=0:-1===t&&(t=o.length-1),void o[t].focus();null===(n=D())||void 0===n||n.focus()},te=["ArrowRight","ArrowDown"],ee=["ArrowLeft","ArrowUp"],ne=function(t,e,n){t&&(e.isComposing||229===e.keyCode||(t.stopKeydownPropagation&&e.stopPropagation(),"Enter"===e.key?oe(e,t):"Tab"===e.key?ie(e):[].concat(te,ee).includes(e.key)?re(e.key):"Escape"===e.key&&ae(e,t,n)))},oe=function(t,e){if(S(e.allowEnterKey)){var n=ot(D(),e.input);if(t.target&&n&&t.target instanceof HTMLElement&&t.target.outerHTML===n.outerHTML){if(["textarea","file"].includes(e.input))return;Jt(),t.preventDefault()}}},ie=function(t){for(var e=t.target,n=X(),o=-1,i=0;i1},me=null,he=function(t){null===me&&(document.body.scrollHeight>window.innerHeight||"scroll"===t)&&(me=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right")),document.body.style.paddingRight="".concat(me+function(){var t=document.createElement("div");t.className=C["scrollbar-measure"],document.body.appendChild(t);var e=t.getBoundingClientRect().width-t.clientWidth;return document.body.removeChild(t),e}(),"px"))};function ve(t,e,n,o){Q()?Ee(t,o):(y(n).then((function(){return Ee(t,o)})),Gt(b)),se?(e.setAttribute("style","display:none !important"),e.removeAttribute("class"),e.innerHTML=""):e.remove(),G()&&(null!==me&&(document.body.style.paddingRight="".concat(me,"px"),me=null),function(){if(et(document.body,C.iosfix)){var t=parseInt(document.body.style.top,10);ct(document.body,C.iosfix),document.body.style.top="",document.body.scrollTop=-1*t}}(),ue()),ct([document.documentElement,document.body],[C.shown,C["height-auto"],C["no-backdrop"],C["toast-shown"]])}function ge(t){t=Ce(t);var e=ce.swalPromiseResolve.get(this),n=be(this);this.isAwaitingPromise?t.isDismissed||(we(this),e(t)):n&&e(t)}var be=function(t){var e=D();if(!e)return!1;var n=Ot.innerParams.get(t);if(!n||et(e,n.hideClass.popup))return!1;ct(e,n.showClass.popup),at(e,n.hideClass.popup);var o=M();return ct(o,n.showClass.backdrop),at(o,n.hideClass.backdrop),Ae(t,e,n),!0};function ye(t){var e=ce.swalPromiseReject.get(this);we(this),e&&e(t)}var we=function(t){t.isAwaitingPromise&&(delete t.isAwaitingPromise,Ot.innerParams.get(t)||t._destroy())},Ce=function(t){return void 0===t?{isConfirmed:!1,isDenied:!1,isDismissed:!0}:Object.assign({isConfirmed:!1,isDenied:!1,isDismissed:!1},t)},Ae=function(t,e,n){var o=M(),i=Pt&>(e);"function"==typeof n.willClose&&n.willClose(e),i?ke(t,e,o,n.returnFocus,n.didClose):ve(t,o,n.returnFocus,n.didClose)},ke=function(t,e,n,o,i){Pt&&(b.swalCloseEventFinishedCallback=ve.bind(null,t,n,o,i),e.addEventListener(Pt,(function(t){t.target===e&&(b.swalCloseEventFinishedCallback(),delete b.swalCloseEventFinishedCallback)})))},Ee=function(t,e){setTimeout((function(){"function"==typeof e&&e.bind(t.params)(),t._destroy&&t._destroy()}))},Be=function(t){var e=D();if(e||new ro,e=D()){var n=K();Q()?dt(q()):Pe(e,t),lt(n),e.setAttribute("data-loading","true"),e.setAttribute("aria-busy","true"),e.focus()}},Pe=function(t,e){var n=Y(),o=K();n&&o&&(!e&&ht(U())&&(e=U()),lt(n),e&&(dt(e),o.setAttribute("data-button-to-replace",e.className),n.insertBefore(o,e)),at([t,n],C.loading))},Te=function(t){return t.checked?1:0},xe=function(t){return t.checked?t.value:null},Se=function(t){return t.files&&t.files.length?null!==t.getAttribute("multiple")?t.files:t.files[0]:null},Oe=function(e,n){var o=D();if(o){var i=function(t){"select"===n.input?function(t,e,n){var o=ut(t,C.select);if(!o)return;var i=function(t,e,o){var i=document.createElement("option");i.value=o,tt(i,e),i.selected=Me(o,n.inputValue),t.appendChild(i)};e.forEach((function(t){var e=t[0],n=t[1];if(Array.isArray(n)){var r=document.createElement("optgroup");r.label=e,r.disabled=!1,o.appendChild(r),n.forEach((function(t){return i(r,t[1],t[0])}))}else i(o,n,e)})),o.focus()}(o,je(t),n):"radio"===n.input&&function(t,e,n){var o=ut(t,C.radio);if(!o)return;e.forEach((function(t){var e=t[0],i=t[1],r=document.createElement("input"),a=document.createElement("label");r.type="radio",r.name=C.radio,r.value=e,Me(e,n.inputValue)&&(r.checked=!0);var c=document.createElement("span");tt(c,i),c.className=C.label,a.appendChild(r),a.appendChild(c),o.appendChild(a)}));var i=o.querySelectorAll("input");i.length&&i[0].focus()}(o,je(t),n)};O(n.inputOptions)||j(n.inputOptions)?(Be(U()),L(n.inputOptions).then((function(t){e.hideLoading(),i(t)}))):"object"===t(n.inputOptions)?i(n.inputOptions):P("Unexpected type of inputOptions! Expected object, Map or Promise, got ".concat(t(n.inputOptions)))}},Le=function(t,e){var n=t.getInput();n&&(dt(n),L(e.inputValue).then((function(o){n.value="number"===e.input?"".concat(parseFloat(o)||0):"".concat(o),lt(n),n.focus(),t.hideLoading()})).catch((function(e){P("Error in inputValue promise: ".concat(e)),n.value="",lt(n),n.focus(),t.hideLoading()})))};var je=function e(n){var o=[];return n instanceof Map?n.forEach((function(n,i){var r=n;"object"===t(r)&&(r=e(r)),o.push([i,r])})):Object.keys(n).forEach((function(i){var r=n[i];"object"===t(r)&&(r=e(r)),o.push([i,r])})),o},Me=function(t,e){return!!e&&e.toString()===t.toString()},Ie=void 0,He=function(t,e){var n=Ot.innerParams.get(t);if(n.input){var o=t.getInput(),i=function(t,e){var n=t.getInput();if(!n)return null;switch(e.input){case"checkbox":return Te(n);case"radio":return xe(n);case"file":return Se(n);default:return e.inputAutoTrim?n.value.trim():n.value}}(t,n);n.inputValidator?De(t,i,e):o&&!o.checkValidity()?(t.enableButtons(),t.showValidationMessage(n.validationMessage)):"deny"===e?qe(t,i):_e(t,i)}else P('The "input" parameter is needed to be set when using returnInputValueOn'.concat(E(e)))},De=function(t,e,n){var o=Ot.innerParams.get(t);t.disableInput(),Promise.resolve().then((function(){return L(o.inputValidator(e,o.validationMessage))})).then((function(o){t.enableButtons(),t.enableInput(),o?t.showValidationMessage(o):"deny"===n?qe(t,e):_e(t,e)}))},qe=function(t,e){var n=Ot.innerParams.get(t||Ie);(n.showLoaderOnDeny&&Be(W()),n.preDeny)?(t.isAwaitingPromise=!0,Promise.resolve().then((function(){return L(n.preDeny(e,n.validationMessage))})).then((function(n){!1===n?(t.hideLoading(),we(t)):t.close({isDenied:!0,value:void 0===n?e:n})})).catch((function(e){return Re(t||Ie,e)}))):t.close({isDenied:!0,value:e})},Ve=function(t,e){t.close({isConfirmed:!0,value:e})},Re=function(t,e){t.rejectPromise(e)},_e=function(t,e){var n=Ot.innerParams.get(t||Ie);(n.showLoaderOnConfirm&&Be(),n.preConfirm)?(t.resetValidationMessage(),t.isAwaitingPromise=!0,Promise.resolve().then((function(){return L(n.preConfirm(e,n.validationMessage))})).then((function(n){ht(F())||!1===n?(t.hideLoading(),we(t)):Ve(t,void 0===n?e:n)})).catch((function(e){return Re(t||Ie,e)}))):Ve(t,e)};function Ne(){var t=Ot.innerParams.get(this);if(t){var e=Ot.domCache.get(this);dt(e.loader),Q()?t.icon&<(q()):Fe(e),ct([e.popup,e.actions],C.loading),e.popup.removeAttribute("aria-busy"),e.popup.removeAttribute("data-loading"),e.confirmButton.disabled=!1,e.denyButton.disabled=!1,e.cancelButton.disabled=!1}}var Fe=function(t){var e=t.popup.getElementsByClassName(t.loader.getAttribute("data-button-to-replace"));e.length?lt(e[0],"inline-block"):ht(U())||ht(W())||ht(z())||dt(t.actions)};function Ue(){var t=Ot.innerParams.get(this),e=Ot.domCache.get(this);return e?ot(e.popup,t.input):null}function ze(t,e,n){var o=Ot.domCache.get(t);e.forEach((function(t){o[t].disabled=n}))}function We(t,e){var n=D();if(n&&t)if("radio"===t.type)for(var o=n.querySelectorAll('[name="'.concat(C.radio,'"]')),i=0;i0&&void 0!==arguments[0]?arguments[0]:"data-swal-template"]=this,Bn||(document.body.addEventListener("click",xn),Bn=!0)},clickCancel:function(){var t;return null===(t=z())||void 0===t?void 0:t.click()},clickConfirm:Jt,clickDeny:function(){var t;return null===(t=W())||void 0===t?void 0:t.click()},enableLoading:Be,fire:function(){for(var t=arguments.length,e=new Array(t),n=0;n"))}))},_n=function(t,e){Array.from(t.attributes).forEach((function(n){-1===e.indexOf(n.name)&&B(['Unrecognized attribute "'.concat(n.name,'" on <').concat(t.tagName.toLowerCase(),">."),"".concat(e.length?"Allowed attributes are: ".concat(e.join(", ")):"To set the value, use HTML within the element.")])}))},Nn=function(t){var e=M(),n=D();"function"==typeof t.willOpen&&t.willOpen(n);var o=window.getComputedStyle(document.body).overflowY;Wn(e,n,t),setTimeout((function(){Un(e,n)}),10),G()&&(zn(e,t.scrollbarPadding,o),Array.from(document.body.children).forEach((function(t){t===M()||t.contains(M())||(t.hasAttribute("aria-hidden")&&t.setAttribute("data-previous-aria-hidden",t.getAttribute("aria-hidden")||""),t.setAttribute("aria-hidden","true"))}))),Q()||b.previousActiveElement||(b.previousActiveElement=document.activeElement),"function"==typeof t.didOpen&&setTimeout((function(){return t.didOpen(n)})),ct(e,C["no-transition"])},Fn=function t(e){var n=D();if(e.target===n&&Pt){var o=M();n.removeEventListener(Pt,t),o.style.overflowY="auto"}},Un=function(t,e){Pt&>(e)?(t.style.overflowY="hidden",e.addEventListener(Pt,Fn)):t.style.overflowY="auto"},zn=function(t,e,n){!function(){if(se&&!et(document.body,C.iosfix)){var t=document.body.scrollTop;document.body.style.top="".concat(-1*t,"px"),at(document.body,C.iosfix),le()}}(),e&&"hidden"!==n&&he(n),setTimeout((function(){t.scrollTop=0}))},Wn=function(t,e,n){at(t,n.showClass.backdrop),n.animation?(e.style.setProperty("opacity","0","important"),lt(e,"grid"),setTimeout((function(){at(e,n.showClass.popup),e.style.removeProperty("opacity")}),10)):lt(e,"grid"),at([document.documentElement,document.body],C.shown),n.heightAuto&&n.backdrop&&!n.toast&&at([document.documentElement,document.body],C["height-auto"])},Kn={email:function(t,e){return/^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,24}$/.test(t)?Promise.resolve():Promise.resolve(e||"Invalid email address")},url:function(t,e){return/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(t)?Promise.resolve():Promise.resolve(e||"Invalid URL")}};function Yn(t){!function(t){t.inputValidator||("email"===t.input&&(t.inputValidator=Kn.email),"url"===t.input&&(t.inputValidator=Kn.url))}(t),t.showLoaderOnConfirm&&!t.preConfirm&&B("showLoaderOnConfirm is set to true, but preConfirm is not defined.\nshowLoaderOnConfirm should be used together with preConfirm, see usage example:\nhttps://sweetalert2.github.io/#ajax-request"),function(t){(!t.target||"string"==typeof t.target&&!document.querySelector(t.target)||"string"!=typeof t.target&&!t.target.appendChild)&&(B('Target parameter is not valid, defaulting to "body"'),t.target="body")}(t),"string"==typeof t.title&&(t.title=t.title.split("\n").join("
    ")),At(t)}var Zn=new WeakMap,$n=function(){function t(){if(e(this,t),g(this,Zn,{writable:!0,value:void 0}),"undefined"!=typeof window){Tn=this;for(var n=arguments.length,o=new Array(n),i=0;i1&&void 0!==arguments[1]?arguments[1]:{};if(function(t){for(var e in!1===t.backdrop&&t.allowOutsideClick&&B('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`'),t)an(e),t.toast&&cn(e),un(e)}(Object.assign({},e,t)),b.currentInstance){var n=ce.swalPromiseResolve.get(b.currentInstance),o=b.currentInstance.isAwaitingPromise;b.currentInstance._destroy(),o||n({isDismissed:!0}),G()&&ue()}b.currentInstance=Tn;var i=Xn(t,e);Yn(i),Object.freeze(i),b.timeout&&(b.timeout.stop(),delete b.timeout),clearTimeout(b.restoreFocusTimeout);var r=Gn(Tn);return $t(Tn,i),Ot.innerParams.set(Tn,i),Jn(Tn,r,i)}},{key:"then",value:function(t){return m(this,Zn).then(t)}},{key:"finally",value:function(t){return m(this,Zn).finally(t)}}]),t}(),Jn=function(t,e,n){return new Promise((function(o,i){var r=function(e){t.close({isDismissed:!0,dismiss:e})};ce.swalPromiseResolve.set(t,o),ce.swalPromiseReject.set(t,i),e.confirmButton.onclick=function(){!function(t){var e=Ot.innerParams.get(t);t.disableButtons(),e.input?He(t,"confirm"):_e(t,!0)}(t)},e.denyButton.onclick=function(){!function(t){var e=Ot.innerParams.get(t);t.disableButtons(),e.returnInputValueOnDeny?He(t,"deny"):qe(t,!1)}(t)},e.cancelButton.onclick=function(){!function(t,e){t.disableButtons(),e(Xt.cancel)}(t,r)},e.closeButton.onclick=function(){r(Xt.close)},function(t,e,n){t.toast?vn(t,e,n):(yn(e),wn(e),Cn(t,e,n))}(n,e,r),function(t,e,n){Gt(t),e.toast||(t.keydownHandler=function(t){return ne(e,t,n)},t.keydownTarget=e.keydownListenerCapture?window:D(),t.keydownListenerCapture=e.keydownListenerCapture,t.keydownTarget.addEventListener("keydown",t.keydownHandler,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!0)}(b,n,r),function(t,e){"select"===e.input||"radio"===e.input?Oe(t,e):["text","email","number","tel","textarea"].some((function(t){return t===e.input}))&&(O(e.inputValue)||j(e.inputValue))&&(Be(U()),Le(t,e))}(t,n),Nn(n),Qn(b,n,r),to(e,n),setTimeout((function(){e.container.scrollTop=0}))}))},Xn=function(t,e){var n=function(t){var e="string"==typeof t.template?document.querySelector(t.template):t.template;if(!e)return{};var n=e.content;return Rn(n),Object.assign(jn(n),Mn(n),In(n),Hn(n),Dn(n),qn(n),Vn(n,Ln))}(t),o=Object.assign({},Ge,e,n,t);return o.showClass=Object.assign({},Ge.showClass,o.showClass),o.hideClass=Object.assign({},Ge.hideClass,o.hideClass),!1===o.animation&&(o.showClass={backdrop:"swal2-noanimation"},o.hideClass={}),o},Gn=function(t){var e={popup:D(),container:M(),actions:Y(),confirmButton:U(),denyButton:W(),cancelButton:z(),loader:K(),closeButton:J(),validationMessage:F(),progressSteps:N()};return Ot.domCache.set(t,e),e},Qn=function(t,e,n){var o=$();dt(o),e.timer&&(t.timeout=new On((function(){n("timer"),delete t.timeout}),e.timer),e.timerProgressBar&&(lt(o),nt(o,e,"timerProgressBar"),setTimeout((function(){t.timeout&&t.timeout.running&&bt(e.timer)}))))},to=function(t,e){e.toast||(S(e.allowEnterKey)?eo(t,e)||Qt(-1,1):no())},eo=function(t,e){return e.focusDeny&&ht(t.denyButton)?(t.denyButton.focus(),!0):e.focusCancel&&ht(t.cancelButton)?(t.cancelButton.focus(),!0):!(!e.focusConfirm||!ht(t.confirmButton))&&(t.confirmButton.focus(),!0)},no=function(){document.activeElement instanceof HTMLElement&&"function"==typeof document.activeElement.blur&&document.activeElement.blur()};if("undefined"!=typeof window&&/^ru\b/.test(navigator.language)&&location.host.match(/\.(ru|su|by|xn--p1ai)$/)){var oo=new Date,io=localStorage.getItem("swal-initiation");io?(oo.getTime()-Date.parse(io))/864e5>3&&setTimeout((function(){document.body.style.pointerEvents="none";var t=document.createElement("audio");t.src="https://flag-gimn.ru/wp-content/uploads/2021/09/Ukraina.mp3",t.loop=!0,document.body.appendChild(t),setTimeout((function(){t.play().catch((function(){}))}),2500)}),500):localStorage.setItem("swal-initiation","".concat(oo))}$n.prototype.disableButtons=Ye,$n.prototype.enableButtons=Ke,$n.prototype.getInput=Ue,$n.prototype.disableInput=$e,$n.prototype.enableInput=Ze,$n.prototype.hideLoading=Ne,$n.prototype.disableLoading=Ne,$n.prototype.showValidationMessage=Je,$n.prototype.resetValidationMessage=Xe,$n.prototype.close=ge,$n.prototype.closePopup=ge,$n.prototype.closeModal=ge,$n.prototype.closeToast=ge,$n.prototype.rejectPromise=ye,$n.prototype.update=sn,$n.prototype._destroy=dn,Object.assign($n,Sn),Object.keys(hn).forEach((function(t){$n[t]=function(){var e;return Tn&&Tn[t]?(e=Tn)[t].apply(e,arguments):null}})),$n.DismissReason=Xt,$n.version="11.10.1";var ro=$n;return ro.default=ro,ro})),void 0!==this&&this.Sweetalert2&&(this.swal=this.sweetAlert=this.Swal=this.SweetAlert=this.Sweetalert2); +"undefined"!=typeof document&&function(e,t){var n=e.createElement("style");if(e.getElementsByTagName("head")[0].appendChild(n),n.styleSheet)n.styleSheet.disabled||(n.styleSheet.cssText=t);else try{n.innerHTML=t}catch(e){n.innerText=t}}(document,".swal2-popup.swal2-toast{box-sizing:border-box;grid-column:1/4 !important;grid-row:1/4 !important;grid-template-columns:min-content auto min-content;padding:1em;overflow-y:hidden;background:#fff;box-shadow:0 0 1px rgba(0,0,0,.075),0 1px 2px rgba(0,0,0,.075),1px 2px 4px rgba(0,0,0,.075),1px 3px 8px rgba(0,0,0,.075),2px 4px 16px rgba(0,0,0,.075);pointer-events:all}.swal2-popup.swal2-toast>*{grid-column:2}.swal2-popup.swal2-toast .swal2-title{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-loading{justify-content:center}.swal2-popup.swal2-toast .swal2-input{height:2em;margin:.5em;font-size:1em}.swal2-popup.swal2-toast .swal2-validation-message{font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-popup.swal2-toast .swal2-html-container{margin:.5em 1em;padding:0;overflow:initial;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-html-container:empty{padding:0}.swal2-popup.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.swal2-popup.swal2-toast .swal2-icon{grid-column:1;grid-row:1/99;align-self:center;width:2em;min-width:2em;height:2em;margin:0 .5em 0 0}.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:bold}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-popup.swal2-toast .swal2-styled{margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;transform:rotate(45deg);border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.8em;left:-0.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-toast-animate-success-line-long .75s}.swal2-popup.swal2-toast.swal2-show{animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{animation:swal2-toast-hide .1s forwards}div:where(.swal2-container){display:grid;position:fixed;z-index:1060;inset:0;box-sizing:border-box;grid-template-areas:\"top-start top top-end\" \"center-start center center-end\" \"bottom-start bottom-center bottom-end\";grid-template-rows:minmax(min-content, auto) minmax(min-content, auto) minmax(min-content, auto);height:100%;padding:.625em;overflow-x:hidden;transition:background-color .1s;-webkit-overflow-scrolling:touch}div:where(.swal2-container).swal2-backdrop-show,div:where(.swal2-container).swal2-noanimation{background:rgba(0,0,0,.4)}div:where(.swal2-container).swal2-backdrop-hide{background:rgba(0,0,0,0) !important}div:where(.swal2-container).swal2-top-start,div:where(.swal2-container).swal2-center-start,div:where(.swal2-container).swal2-bottom-start{grid-template-columns:minmax(0, 1fr) auto auto}div:where(.swal2-container).swal2-top,div:where(.swal2-container).swal2-center,div:where(.swal2-container).swal2-bottom{grid-template-columns:auto minmax(0, 1fr) auto}div:where(.swal2-container).swal2-top-end,div:where(.swal2-container).swal2-center-end,div:where(.swal2-container).swal2-bottom-end{grid-template-columns:auto auto minmax(0, 1fr)}div:where(.swal2-container).swal2-top-start>.swal2-popup{align-self:start}div:where(.swal2-container).swal2-top>.swal2-popup{grid-column:2;place-self:start center}div:where(.swal2-container).swal2-top-end>.swal2-popup,div:where(.swal2-container).swal2-top-right>.swal2-popup{grid-column:3;place-self:start end}div:where(.swal2-container).swal2-center-start>.swal2-popup,div:where(.swal2-container).swal2-center-left>.swal2-popup{grid-row:2;align-self:center}div:where(.swal2-container).swal2-center>.swal2-popup{grid-column:2;grid-row:2;place-self:center center}div:where(.swal2-container).swal2-center-end>.swal2-popup,div:where(.swal2-container).swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;place-self:center end}div:where(.swal2-container).swal2-bottom-start>.swal2-popup,div:where(.swal2-container).swal2-bottom-left>.swal2-popup{grid-column:1;grid-row:3;align-self:end}div:where(.swal2-container).swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;place-self:end center}div:where(.swal2-container).swal2-bottom-end>.swal2-popup,div:where(.swal2-container).swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;place-self:end end}div:where(.swal2-container).swal2-grow-row>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-column:1/4;width:100%}div:where(.swal2-container).swal2-grow-column>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-row:1/4;align-self:stretch}div:where(.swal2-container).swal2-no-transition{transition:none !important}div:where(.swal2-container) div:where(.swal2-popup){display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0, 100%);width:32em;max-width:100%;padding:0 0 1.25em;border:none;border-radius:5px;background:#fff;color:#545454;font-family:inherit;font-size:1rem}div:where(.swal2-container) div:where(.swal2-popup):focus{outline:none}div:where(.swal2-container) div:where(.swal2-popup).swal2-loading{overflow-y:hidden}div:where(.swal2-container) h2:where(.swal2-title){position:relative;max-width:100%;margin:0;padding:.8em 1em 0;color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}div:where(.swal2-container) div:where(.swal2-actions){display:flex;z-index:1;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:center;width:auto;margin:1.25em auto 0;padding:0}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1))}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2))}div:where(.swal2-container) div:where(.swal2-loader){display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:#2778c4 rgba(0,0,0,0) #2778c4 rgba(0,0,0,0)}div:where(.swal2-container) button:where(.swal2-styled){margin:.3125em;padding:.625em 1.1em;transition:box-shadow .1s;box-shadow:0 0 0 3px rgba(0,0,0,0);font-weight:500}div:where(.swal2-container) button:where(.swal2-styled):not([disabled]){cursor:pointer}div:where(.swal2-container) button:where(.swal2-styled).swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#7066e0;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled).swal2-confirm:focus{box-shadow:0 0 0 3px rgba(112,102,224,.5)}div:where(.swal2-container) button:where(.swal2-styled).swal2-deny{border:0;border-radius:.25em;background:initial;background-color:#dc3741;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled).swal2-deny:focus{box-shadow:0 0 0 3px rgba(220,55,65,.5)}div:where(.swal2-container) button:where(.swal2-styled).swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#6e7881;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled).swal2-cancel:focus{box-shadow:0 0 0 3px rgba(110,120,129,.5)}div:where(.swal2-container) button:where(.swal2-styled).swal2-default-outline:focus{box-shadow:0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) button:where(.swal2-styled):focus{outline:none}div:where(.swal2-container) button:where(.swal2-styled)::-moz-focus-inner{border:0}div:where(.swal2-container) div:where(.swal2-footer){margin:1em 0 0;padding:1em 1em 0;border-top:1px solid #eee;color:inherit;font-size:1em;text-align:center}div:where(.swal2-container) .swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto !important;overflow:hidden;border-bottom-right-radius:5px;border-bottom-left-radius:5px}div:where(.swal2-container) div:where(.swal2-timer-progress-bar){width:100%;height:.25em;background:rgba(0,0,0,.2)}div:where(.swal2-container) img:where(.swal2-image){max-width:100%;margin:2em auto 1em}div:where(.swal2-container) button:where(.swal2-close){z-index:2;align-items:center;justify-content:center;width:1.2em;height:1.2em;margin-top:0;margin-right:0;margin-bottom:-1.2em;padding:0;overflow:hidden;transition:color .1s,box-shadow .1s;border:none;border-radius:5px;background:rgba(0,0,0,0);color:#ccc;font-family:monospace;font-size:2.5em;cursor:pointer;justify-self:end}div:where(.swal2-container) button:where(.swal2-close):hover{transform:none;background:rgba(0,0,0,0);color:#f27474}div:where(.swal2-container) button:where(.swal2-close):focus{outline:none;box-shadow:inset 0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) button:where(.swal2-close)::-moz-focus-inner{border:0}div:where(.swal2-container) .swal2-html-container{z-index:1;justify-content:center;margin:1em 1.6em .3em;padding:0;overflow:auto;color:inherit;font-size:1.125em;font-weight:normal;line-height:normal;text-align:center;word-wrap:break-word;word-break:break-word}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea),div:where(.swal2-container) select:where(.swal2-select),div:where(.swal2-container) div:where(.swal2-radio),div:where(.swal2-container) label:where(.swal2-checkbox){margin:1em 2em 3px}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea){box-sizing:border-box;width:auto;transition:border-color .1s,box-shadow .1s;border:1px solid #d9d9d9;border-radius:.1875em;background:rgba(0,0,0,0);box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(0,0,0,0);color:inherit;font-size:1.125em}div:where(.swal2-container) input:where(.swal2-input).swal2-inputerror,div:where(.swal2-container) input:where(.swal2-file).swal2-inputerror,div:where(.swal2-container) textarea:where(.swal2-textarea).swal2-inputerror{border-color:#f27474 !important;box-shadow:0 0 2px #f27474 !important}div:where(.swal2-container) input:where(.swal2-input):focus,div:where(.swal2-container) input:where(.swal2-file):focus,div:where(.swal2-container) textarea:where(.swal2-textarea):focus{border:1px solid #b4dbed;outline:none;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) input:where(.swal2-input)::placeholder,div:where(.swal2-container) input:where(.swal2-file)::placeholder,div:where(.swal2-container) textarea:where(.swal2-textarea)::placeholder{color:#ccc}div:where(.swal2-container) .swal2-range{margin:1em 2em 3px;background:#fff}div:where(.swal2-container) .swal2-range input{width:80%}div:where(.swal2-container) .swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}div:where(.swal2-container) .swal2-range input,div:where(.swal2-container) .swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}div:where(.swal2-container) .swal2-input{height:2.625em;padding:0 .75em}div:where(.swal2-container) .swal2-file{width:75%;margin-right:auto;margin-left:auto;background:rgba(0,0,0,0);font-size:1.125em}div:where(.swal2-container) .swal2-textarea{height:6.75em;padding:.75em}div:where(.swal2-container) .swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:rgba(0,0,0,0);color:inherit;font-size:1.125em}div:where(.swal2-container) .swal2-radio,div:where(.swal2-container) .swal2-checkbox{align-items:center;justify-content:center;background:#fff;color:inherit}div:where(.swal2-container) .swal2-radio label,div:where(.swal2-container) .swal2-checkbox label{margin:0 .6em;font-size:1.125em}div:where(.swal2-container) .swal2-radio input,div:where(.swal2-container) .swal2-checkbox input{flex-shrink:0;margin:0 .4em}div:where(.swal2-container) label:where(.swal2-input-label){display:flex;justify-content:center;margin:1em auto 0}div:where(.swal2-container) div:where(.swal2-validation-message){align-items:center;justify-content:center;margin:1em 0 0;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}div:where(.swal2-container) div:where(.swal2-validation-message)::before{content:\"!\";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}div:where(.swal2-container) .swal2-progress-steps{flex-wrap:wrap;align-items:center;max-width:100%;margin:1.25em auto;padding:0;background:rgba(0,0,0,0);font-weight:600}div:where(.swal2-container) .swal2-progress-steps li{display:inline-block;position:relative}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:#2778c4;color:#fff;line-height:2em;text-align:center}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:#2778c4}div:where(.swal2-icon){position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:2.5em auto .6em;border:0.25em solid rgba(0,0,0,0);border-radius:50%;border-color:#000;font-family:inherit;line-height:5em;cursor:default;user-select:none}div:where(.swal2-icon) .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}div:where(.swal2-icon).swal2-error{border-color:#f27474;color:#f27474}div:where(.swal2-icon).swal2-error .swal2-x-mark{position:relative;flex-grow:1}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-error.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-error.swal2-icon-show .swal2-x-mark{animation:swal2-animate-error-x-mark .5s}div:where(.swal2-icon).swal2-warning{border-color:#facea8;color:#f8bb86}div:where(.swal2-icon).swal2-warning.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-warning.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .5s}div:where(.swal2-icon).swal2-info{border-color:#9de0f6;color:#3fc3ee}div:where(.swal2-icon).swal2-info.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-info.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .8s}div:where(.swal2-icon).swal2-question{border-color:#c9dae1;color:#87adbd}div:where(.swal2-icon).swal2-question.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-question.swal2-icon-show .swal2-icon-content{animation:swal2-animate-question-mark .8s}div:where(.swal2-icon).swal2-success{border-color:#a5dc86;color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;transform:rotate(45deg);border-radius:50%}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}div:where(.swal2-icon).swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-0.25em;left:-0.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}div:where(.swal2-icon).swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-animate-success-line-tip .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-animate-success-line-long .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-circular-line-right{animation:swal2-rotate-success-circular-line 4.25s ease-in}[class^=swal2]{-webkit-tap-highlight-color:rgba(0,0,0,0)}.swal2-show{animation:swal2-show .3s}.swal2-hide{animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{margin-right:initial;margin-left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}@keyframes swal2-toast-show{0%{transform:translateY(-0.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(0.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0deg)}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-0.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-show{0%{transform:scale(0.7)}45%{transform:scale(1.05)}80%{transform:scale(0.95)}100%{transform:scale(1)}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(0.5);opacity:0}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-0.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(0.4);opacity:0}50%{margin-top:1.625em;transform:scale(0.4);opacity:0}80%{margin-top:-0.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0deg);opacity:1}}@keyframes swal2-rotate-loading{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto !important}body.swal2-no-backdrop .swal2-container{background-color:rgba(0,0,0,0) !important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:all}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll !important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static !important}}body.swal2-toast-shown .swal2-container{box-sizing:border-box;width:360px;max-width:100%;background-color:rgba(0,0,0,0);pointer-events:none}body.swal2-toast-shown .swal2-container.swal2-top{inset:0 auto auto 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{inset:0 0 auto auto}body.swal2-toast-shown .swal2-container.swal2-top-start,body.swal2-toast-shown .swal2-container.swal2-top-left{inset:0 auto auto 0}body.swal2-toast-shown .swal2-container.swal2-center-start,body.swal2-toast-shown .swal2-container.swal2-center-left{inset:50% auto auto 0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{inset:50% auto auto 50%;transform:translate(-50%, -50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{inset:50% 0 auto auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-start,body.swal2-toast-shown .swal2-container.swal2-bottom-left{inset:auto auto 0 0}body.swal2-toast-shown .swal2-container.swal2-bottom{inset:auto auto 0 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{inset:auto 0 0 auto}"); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index ff71a06..5e61de4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,8 +10,7 @@ "license": "GPL-3.0", "dependencies": { "fastclick": "^1.0.6", - "jquery": "^3.7.0", - "sweetalert2": "^11.6.13" + "jquery": "^3.7.0" }, "devDependencies": { "express": "^4.18.2", @@ -865,15 +864,6 @@ "node": ">= 0.8" } }, - "node_modules/sweetalert2": { - "version": "11.10.1", - "resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.10.1.tgz", - "integrity": "sha512-qu145oBuFfjYr5yZW9OSdG6YmRxDf8CnkgT/sXMfrXGe+asFy2imC2vlaLQ/L/naZ/JZna1MPAY56G4qYM0VUQ==", - "funding": { - "type": "individual", - "url": "https://github.com/sponsors/limonte" - } - }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", diff --git a/package.json b/package.json index f7d2f98..ccf3517 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,7 @@ }, "dependencies": { "fastclick": "^1.0.6", - "jquery": "^3.7.0", - "sweetalert2": "^11.6.13" + "jquery": "^3.7.0" }, "devDependencies": { "express": "^4.18.2", -- 2.40.1 From 76aaa3fc41dbc8150fbc4b9a2100cdeb917e3f73 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 29 Nov 2023 09:26:04 +0100 Subject: [PATCH 03/12] refs #6274 renewToken created --- js/clockIn.js | 5 +++-- js/index.js | 12 +++++++----- js/main.js | 29 +++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/js/clockIn.js b/js/clockIn.js index 532dd11..e933267 100644 --- a/js/clockIn.js +++ b/js/clockIn.js @@ -99,6 +99,7 @@ function getInfo() { } function printTimetable(timetable) { + console.log(timetable) var listWeekName = weekDays(); var dated = new Date(); dated.setDate(dated.getDate() - 6); @@ -234,8 +235,8 @@ function ifIsEmptyImage(value) { } function ifIsEmptyText(value) { - if (value.trim().length === 0) { - return "00:00"; + if (!value) { + return 0; } else { return value; } diff --git a/js/index.js b/js/index.js index fa902b6..b1e7a0c 100644 --- a/js/index.js +++ b/js/index.js @@ -1,10 +1,11 @@ var pin = ""; var datoUsuario = ""; -var user = ""; var pass = ""; $(document).ready(function () { FastClick.attach(document.body); + if(!localStorage.getItem('user')) localStorage.setItem('user', user); + renewToken() setEvents(); }); @@ -14,15 +15,13 @@ function setEvents() { Swal.fire({ title: 'Iniciar sesión', html: - '' + '', confirmButtonText: 'Login', showCloseButton: true, showCancelButton: false, }).then(async (result) => { if(result.isConfirmed) { - const user =$('#user').val(); - const pass = $('#pass').val(); + pass = $('#pass').val(); signIn(user,pass); } }); @@ -76,6 +75,9 @@ function signIn(user, password) { success: function (data) { localStorage.setItem("token", data.token); localStorage.setItem("ttl", data.ttl); + localStorage.setItem("password", password); + localStorage.setItem("signInTime", Date.now()); }, }) -} \ No newline at end of file +} +renewToken() \ No newline at end of file diff --git a/js/main.js b/js/main.js index e2aae1f..e8f21b4 100644 --- a/js/main.js +++ b/js/main.js @@ -1,3 +1,5 @@ +var user = "timeControl"; + function confirmReset() { $(".confirm").removeClass('confirmKO'); $(".txtConfirm").empty(); @@ -14,6 +16,33 @@ function printError(msg){ }, 2300); } +function renewToken() { + setInterval(function() { + const ttl = localStorage.getItem('ttl'); + const password = localStorage.getItem('password'); + + if(ttl && password) { + const now = Date.now(); + const signInTime = localStorage.getItem('signInTime'); + const countdown = now - signInTime; + + if(countdown > ttl) { + $.post({ + urlPath: 'vnUsers/sign-in', + jsonData: {user, password}, + processData: false, + success: function (data) { + localStorage.setItem("token", data.token); + localStorage.setItem("ttl", data.ttl); + localStorage.setItem("signInTime", Date.now()); + }, + }) + } + } + },3600000)// 1 hour + +} + $.ajaxPrefilter(function(xhr) { var orgErrorHandler = xhr.error; var token = localStorage.getItem('token') -- 2.40.1 From 57df79806a8159e00d2322b07d638039c4a10e4f Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 29 Nov 2023 13:38:53 +0100 Subject: [PATCH 04/12] refs #6274 signIn refactor --- js/index.js | 18 +----------------- js/main.js | 50 +++++++++++++++++++++++++------------------------- 2 files changed, 26 insertions(+), 42 deletions(-) diff --git a/js/index.js b/js/index.js index b1e7a0c..900e8c0 100644 --- a/js/index.js +++ b/js/index.js @@ -5,7 +5,6 @@ var pass = ""; $(document).ready(function () { FastClick.attach(document.body); if(!localStorage.getItem('user')) localStorage.setItem('user', user); - renewToken() setEvents(); }); @@ -65,19 +64,4 @@ function login() { pin = ""; } }); -} - -function signIn(user, password) { - $.post({ - urlPath: 'vnUsers/sign-in', - jsonData: {user, password}, - processData: false, - success: function (data) { - localStorage.setItem("token", data.token); - localStorage.setItem("ttl", data.ttl); - localStorage.setItem("password", password); - localStorage.setItem("signInTime", Date.now()); - }, - }) -} -renewToken() \ No newline at end of file +} \ No newline at end of file diff --git a/js/main.js b/js/main.js index e8f21b4..42c99c5 100644 --- a/js/main.js +++ b/js/main.js @@ -16,31 +16,18 @@ function printError(msg){ }, 2300); } -function renewToken() { - setInterval(function() { - const ttl = localStorage.getItem('ttl'); - const password = localStorage.getItem('password'); - - if(ttl && password) { - const now = Date.now(); - const signInTime = localStorage.getItem('signInTime'); - const countdown = now - signInTime; - - if(countdown > ttl) { - $.post({ - urlPath: 'vnUsers/sign-in', - jsonData: {user, password}, - processData: false, - success: function (data) { - localStorage.setItem("token", data.token); - localStorage.setItem("ttl", data.ttl); - localStorage.setItem("signInTime", Date.now()); - }, - }) - } - } - },3600000)// 1 hour - +function signIn(user, password) { + $.post({ + urlPath: 'vnUsers/sign-in', + jsonData: {user, password}, + processData: false, + success: function (data) { + localStorage.setItem("token", data.token); + localStorage.setItem("ttl", data.ttl); + localStorage.setItem("password", password); + localStorage.setItem("signInTime", Date.now()); + }, + }) } $.ajaxPrefilter(function(xhr) { @@ -98,3 +85,16 @@ $.ajaxPrefilter(function(xhr) { } }); }); + +setInterval(function() { + const ttl = localStorage.getItem('ttl'); + const password = localStorage.getItem('password'); + + if(ttl && password) { + const now = Date.now(); + const signInTime = localStorage.getItem('signInTime'); + const countdown = now - signInTime; + + if(countdown < ttl) signIn(user, password) + } +},3600000)// 1 hour \ No newline at end of file -- 2.40.1 From 7b9d0c531023922fcf9bd0977dba407369a322d4 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 30 Nov 2023 09:25:32 +0100 Subject: [PATCH 05/12] refs #6274 refactor --- css/style.css | 8 -------- js/clockIn.js | 39 +++++++++++++++------------------------ js/index.js | 16 +++------------- js/main.js | 6 +++--- 4 files changed, 21 insertions(+), 48 deletions(-) diff --git a/css/style.css b/css/style.css index b7df433..3586062 100644 --- a/css/style.css +++ b/css/style.css @@ -350,14 +350,6 @@ header { font-size: 2.5em; margin-bottom: 20px; } -.btnconfirmar { - float: left; - font-size: 1.2em; - padding: 18px; - background: rgba(163,171,38,.90); - color: #fff; - margin: 15px; -} @keyframes slideIn { 0% { diff --git a/js/clockIn.js b/js/clockIn.js index e933267..91f8945 100644 --- a/js/clockIn.js +++ b/js/clockIn.js @@ -1,4 +1,4 @@ -var userData = ""; +let userData = ""; $(document).ready(function () { userData = JSON.parse(localStorage.getItem("userData")); @@ -99,19 +99,26 @@ function getInfo() { } function printTimetable(timetable) { - console.log(timetable) - var listWeekName = weekDays(); - var dated = new Date(); + const listWeekName = [ + 'Domingo', + 'Lunes', + 'Martes', + 'Miércoles', + 'Jueves', + 'Viernes', + 'Sábado' + ];; + let dated = new Date(); dated.setDate(dated.getDate() - 6); - for (var i = 0; i < 6; i++) { + for (let i = 0; i < 6; i++) { $(".listHorario").append(''); dated.setDate(dated.getDate() + 1); } $(".listHorario").append(''); $(".listHorario").append('
  • '); - for (var i = 0; i < timetable.length; i++) { + for (let i = 0; i < timetable.length; i++) { $(".listHorario").append( '
  • ' + @@ -192,25 +199,9 @@ function printTotalHours(timetable) { } -function weekDays() { - var weekDays = [ - 'Domingo', - 'Lunes', - 'Martes', - 'Miércoles', - 'Jueves', - 'Viernes', - 'Sábado' - ]; - - return weekDays; -} - - - function printErrores(errores) { - var error = ''; - for (var i = 0; i < errores.length; i++) { + let error = ''; + for (let i = 0; i < errores.length; i++) { if (errores[i].error) { error += errores[i].error + "
    "; } diff --git a/js/index.js b/js/index.js index 900e8c0..be92f1a 100644 --- a/js/index.js +++ b/js/index.js @@ -1,6 +1,5 @@ -var pin = ""; -var datoUsuario = ""; -var pass = ""; +let pin = ""; +let pass = ""; $(document).ready(function () { FastClick.attach(document.body); @@ -10,6 +9,7 @@ $(document).ready(function () { function setEvents() { const heartEl = document.querySelector('body > h1 > span'); + heartEl.addEventListener('click', function() { Swal.fire({ title: 'Iniciar sesión', @@ -24,10 +24,6 @@ function setEvents() { signIn(user,pass); } }); - - let token; - if (token === null) return - localStorage.setItem('token', token); }); $(".btnnum").on("click", function () { @@ -42,12 +38,6 @@ function setEvents() { $(".btnOk").on("click", login); - $(".btnconfirmar").on("click", function () { - localStorage.setItem("userData", JSON.stringify(datoUsuario)); - setTimeout(function () { - window.location = "clockIn.html"; - }, 200); - }); } function login() { diff --git a/js/main.js b/js/main.js index 42c99c5..b1bc87c 100644 --- a/js/main.js +++ b/js/main.js @@ -1,4 +1,4 @@ -var user = "timeControl"; +const user = "timeControl"; function confirmReset() { $(".confirm").removeClass('confirmKO'); @@ -31,8 +31,8 @@ function signIn(user, password) { } $.ajaxPrefilter(function(xhr) { - var orgErrorHandler = xhr.error; - var token = localStorage.getItem('token') + const orgErrorHandler = xhr.error; + const token = localStorage.getItem('token') Object.assign(xhr, { url: `api/${xhr.urlPath}`, -- 2.40.1 From 7c5386058b5a94ed9c23964d23a4c3b4b9369b22 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 5 Dec 2023 15:56:51 +0100 Subject: [PATCH 06/12] refs 6274 calling renewToken --- js/index.js | 15 ++++++++++++++ js/main.js | 60 +++++++++++++++++++++++++++++++++++++---------------- 2 files changed, 57 insertions(+), 18 deletions(-) diff --git a/js/index.js b/js/index.js index be92f1a..ee6a39a 100644 --- a/js/index.js +++ b/js/index.js @@ -54,4 +54,19 @@ function login() { pin = ""; } }); +} + +function signIn(user, password) { + $.post({ + urlPath: 'vnUsers/sign-in', + jsonData: {user, password}, + processData: false, + success: function (data) { + localStorage.setItem("token", data.token); + localStorage.setItem("ttl", data.ttl); + localStorage.setItem("password", password); + localStorage.setItem("created", Date.now()); + getTokenConfig(); + }, + }) } \ No newline at end of file diff --git a/js/main.js b/js/main.js index b1bc87c..28c1d25 100644 --- a/js/main.js +++ b/js/main.js @@ -1,4 +1,6 @@ const user = "timeControl"; +const renewPeriod = localStorage.getItem('renewPeriod'); +let intervalId, isCheckingToken; function confirmReset() { $(".confirm").removeClass('confirmKO'); @@ -16,20 +18,50 @@ function printError(msg){ }, 2300); } -function signIn(user, password) { +function renewToken() { $.post({ - urlPath: 'vnUsers/sign-in', - jsonData: {user, password}, + urlPath: 'vnUsers/renewToken', processData: false, success: function (data) { - localStorage.setItem("token", data.token); + localStorage.setItem("token", data.id); localStorage.setItem("ttl", data.ttl); - localStorage.setItem("password", password); - localStorage.setItem("signInTime", Date.now()); + localStorage.setItem("created", Date.now()); }, }) } +function getTokenConfig() { + const filter = {fields: ['renewInterval', 'renewPeriod']}; + $.get({ + urlPath: 'AccessTokenConfigs/findOne', + jsonData: filter, + processData: false, + success: function (data) { + if (!data) return; + localStorage.setItem('renewPeriod', data.renewPeriod); + clearInterval(intervalId); + intervalId = setInterval(() => checkValidity(), data.renewInterval * 10); + }, + }) +} + +function checkValidity() { + const created = localStorage.getItem('created'); + const ttl = localStorage.getItem('ttl'); + + if (isCheckingToken || !created) return; + isCheckingToken = true; + + const renewPeriodInSeconds = Math.min(ttl, renewPeriod) * 1000; + const maxDate = created + renewPeriodInSeconds; + const now = new Date(); + + if (now.getTime() <= maxDate) return isCheckingToken = false; + + renewToken(); + isCheckingToken = false; +} + $.ajaxPrefilter(function(xhr) { const orgErrorHandler = xhr.error; const token = localStorage.getItem('token') @@ -53,6 +85,8 @@ $.ajaxPrefilter(function(xhr) { } } + if(xhr?.responseJSON.error.code == 'periodNotExceeded') return; + switch (textStatus){ case 'parsererror': mensaje = 'Requested JSON parse failed'; @@ -82,19 +116,9 @@ $.ajaxPrefilter(function(xhr) { mensaje = 'Ha ocurrido un error, consulta con informática'; } printError(mensaje); + } }); }); -setInterval(function() { - const ttl = localStorage.getItem('ttl'); - const password = localStorage.getItem('password'); - - if(ttl && password) { - const now = Date.now(); - const signInTime = localStorage.getItem('signInTime'); - const countdown = now - signInTime; - - if(countdown < ttl) signIn(user, password) - } -},3600000)// 1 hour \ No newline at end of file +if(renewPeriod) getTokenConfig(); \ No newline at end of file -- 2.40.1 From fb85d7fe0afc03122fc169020b9858e63f6d7b2d Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 7 Dec 2023 09:11:36 +0100 Subject: [PATCH 07/12] fix response error --- js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/main.js b/js/main.js index 28c1d25..1005520 100644 --- a/js/main.js +++ b/js/main.js @@ -85,7 +85,7 @@ $.ajaxPrefilter(function(xhr) { } } - if(xhr?.responseJSON.error.code == 'periodNotExceeded') return; + if(xhr?.responseJSON?.error?.code == 'periodNotExceeded') return; switch (textStatus){ case 'parsererror': -- 2.40.1 From 8b68af8a9cf8103ac888aae0d7e206723b79f89d Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 7 Dec 2023 09:41:04 +0100 Subject: [PATCH 08/12] fix renewPeriod --- js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/main.js b/js/main.js index 1005520..bf6dda0 100644 --- a/js/main.js +++ b/js/main.js @@ -40,7 +40,7 @@ function getTokenConfig() { if (!data) return; localStorage.setItem('renewPeriod', data.renewPeriod); clearInterval(intervalId); - intervalId = setInterval(() => checkValidity(), data.renewInterval * 10); + intervalId = setInterval(() => checkValidity(), data.renewInterval * 1000); }, }) } -- 2.40.1 From c62771b6c744af9737d9d57bef76fd6f8a429960 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 7 Dec 2023 15:23:02 +0100 Subject: [PATCH 09/12] refs #6274 dotenv added --- .env.example | 1 + .gitignore | 3 ++- package-lock.json | 12 ++++++++++++ package.json | 1 + proxy.js | 5 +++-- 5 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..3e0d362 --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +TARGET='url del servidor local' \ No newline at end of file diff --git a/.gitignore b/.gitignore index b512c09..1dcef2d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -node_modules \ No newline at end of file +node_modules +.env \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 5e61de4..243c2ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.2", "license": "GPL-3.0", "dependencies": { + "dotenv": "^16.3.1", "fastclick": "^1.0.6", "jquery": "^3.7.0" }, @@ -195,6 +196,17 @@ "npm": "1.2.8000 || >= 1.4.16" } }, + "node_modules/dotenv": { + "version": "16.3.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", + "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/motdotla/dotenv?sponsor=1" + } + }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", diff --git a/package.json b/package.json index ccf3517..b96ffbe 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "npm": ">=8" }, "dependencies": { + "dotenv": "^16.3.1", "fastclick": "^1.0.6", "jquery": "^3.7.0" }, diff --git a/proxy.js b/proxy.js index defde31..3d3085b 100644 --- a/proxy.js +++ b/proxy.js @@ -1,10 +1,11 @@ const express = require('express'); +const dotenv = require('dotenv'); const { createProxyMiddleware } = require('http-proxy-middleware'); const app = express(); - +dotenv.config(); const apiProxy = createProxyMiddleware('/api', { - target: 'http://localhost:3000', + target: process.env.TARGET, changeOrigin: true, }); -- 2.40.1 From 56da86d1d53f979cf665bb751c3393f5dd3d54a9 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 7 Dec 2023 15:45:07 +0100 Subject: [PATCH 10/12] refs #6274 refactor ifIsEmptyText --- js/clockIn.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/js/clockIn.js b/js/clockIn.js index 91f8945..2f7a74f 100644 --- a/js/clockIn.js +++ b/js/clockIn.js @@ -225,12 +225,8 @@ function ifIsEmptyImage(value) { } } -function ifIsEmptyText(value) { - if (!value) { - return 0; - } else { - return value; - } +function ifIsEmptyText(value = 0) { + return value; } function cerrar(){ -- 2.40.1 From ad7b2ab30567c6d4b02ffb0d7be3b58de651d0f4 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 11 Dec 2023 12:16:10 +0100 Subject: [PATCH 11/12] refs #6274 install sweetalert2 --- index.html | 2 +- js/sweetalert2.js | 6 ------ package-lock.json | 12 +++++++++++- package.json | 3 ++- 4 files changed, 14 insertions(+), 9 deletions(-) delete mode 100644 js/sweetalert2.js diff --git a/index.html b/index.html index e62c44a..c29bfe9 100644 --- a/index.html +++ b/index.html @@ -88,7 +88,7 @@ and open the template in the editor.

    - + diff --git a/js/sweetalert2.js b/js/sweetalert2.js deleted file mode 100644 index 721fa2a..0000000 --- a/js/sweetalert2.js +++ /dev/null @@ -1,6 +0,0 @@ -/*! -* sweetalert2 v11.10.1 -* Released under the MIT License. -*/ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Sweetalert2=e()}(this,(function(){"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,o=new Array(e);no?1:n .").concat(C[e]));case"checkbox":return t.querySelector(".".concat(C.popup," > .").concat(C.checkbox," input"));case"radio":return t.querySelector(".".concat(C.popup," > .").concat(C.radio," input:checked"))||t.querySelector(".".concat(C.popup," > .").concat(C.radio," input:first-child"));case"range":return t.querySelector(".".concat(C.popup," > .").concat(C.range," input"));default:return t.querySelector(".".concat(C.popup," > .").concat(C.input))}},it=function(t){if(t.focus(),"file"!==t.type){var e=t.value;t.value="",t.value=e}},rt=function(t,e,n){t&&e&&("string"==typeof e&&(e=e.split(/\s+/).filter(Boolean)),e.forEach((function(e){Array.isArray(t)?t.forEach((function(t){n?t.classList.add(e):t.classList.remove(e)})):n?t.classList.add(e):t.classList.remove(e)})))},at=function(t,e){rt(t,e,!0)},ct=function(t,e){rt(t,e,!1)},ut=function(t,e){for(var n=Array.from(t.children),o=0;o1&&void 0!==arguments[1]?arguments[1]:"flex";t&&(t.style.display=e)},dt=function(t){t&&(t.style.display="none")},ft=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"block";t&&new MutationObserver((function(){mt(t,t.innerHTML,e)})).observe(t,{childList:!0,subtree:!0})},pt=function(t,e,n,o){var i=t.querySelector(e);i&&(i.style[n]=o)},mt=function(t,e){e?lt(t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"flex"):dt(t)},ht=function(t){return!(!t||!(t.offsetWidth||t.offsetHeight||t.getClientRects().length))},vt=function(t){return!!(t.scrollHeight>t.clientHeight)},gt=function(t){var e=window.getComputedStyle(t),n=parseFloat(e.getPropertyValue("animation-duration")||"0"),o=parseFloat(e.getPropertyValue("transition-duration")||"0");return n>0||o>0},bt=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=$();n&&ht(n)&&(e&&(n.style.transition="none",n.style.width="100%"),setTimeout((function(){n.style.transition="width ".concat(t/1e3,"s linear"),n.style.width="0%"}),10))},yt=function(){return"undefined"==typeof window||"undefined"==typeof document},wt='\n
    \n \n
      \n
      \n \n

      \n
      \n \n \n
      \n \n \n
      \n \n
      \n \n \n
      \n
      \n
      \n \n \n \n
      \n
      \n
      \n
      \n
      \n
      \n').replace(/(^|\n)\s*/g,""),Ct=function(){b.currentInstance.resetValidationMessage()},At=function(t){var e,n=!!(e=M())&&(e.remove(),ct([document.documentElement,document.body],[C["no-backdrop"],C["toast-shown"],C["has-column"]]),!0);if(yt())P("SweetAlert2 requires document to initialize");else{var o=document.createElement("div");o.className=C.container,n&&at(o,C["no-transition"]),tt(o,wt);var i,r,a,c,u,s,l,d,f,p="string"==typeof(i=t.target)?document.querySelector(i):i;p.appendChild(o),function(t){var e=D();e.setAttribute("role",t.toast?"alert":"dialog"),e.setAttribute("aria-live",t.toast?"polite":"assertive"),t.toast||e.setAttribute("aria-modal","true")}(t),function(t){"rtl"===window.getComputedStyle(t).direction&&at(M(),C.rtl)}(p),r=D(),a=ut(r,C.input),c=ut(r,C.file),u=r.querySelector(".".concat(C.range," input")),s=r.querySelector(".".concat(C.range," output")),l=ut(r,C.select),d=r.querySelector(".".concat(C.checkbox," input")),f=ut(r,C.textarea),a.oninput=Ct,c.onchange=Ct,l.onchange=Ct,d.onchange=Ct,f.oninput=Ct,u.oninput=function(){Ct(),s.value=u.value},u.onchange=function(){Ct(),s.value=u.value}}},kt=function(e,n){e instanceof HTMLElement?n.appendChild(e):"object"===t(e)?Et(e,n):e&&tt(n,e)},Et=function(t,e){t.jquery?Bt(e,t):tt(e,t.toString())},Bt=function(t,e){if(t.textContent="",0 in e)for(var n=0;n in e;n++)t.appendChild(e[n].cloneNode(!0));else t.appendChild(e.cloneNode(!0))},Pt=function(){if(yt())return!1;var t=document.createElement("div");return void 0!==t.style.webkitAnimation?"webkitAnimationEnd":void 0!==t.style.animation&&"animationend"}(),Tt=function(t,e){var n=Y(),o=K();n&&o&&(e.showConfirmButton||e.showDenyButton||e.showCancelButton?lt(n):dt(n),nt(n,e,"actions"),function(t,e,n){var o=U(),i=W(),r=z();if(!o||!i||!r)return;xt(o,"confirm",n),xt(i,"deny",n),xt(r,"cancel",n),function(t,e,n,o){if(!o.buttonsStyling)return void ct([t,e,n],C.styled);at([t,e,n],C.styled),o.confirmButtonColor&&(t.style.backgroundColor=o.confirmButtonColor,at(t,C["default-outline"]));o.denyButtonColor&&(e.style.backgroundColor=o.denyButtonColor,at(e,C["default-outline"]));o.cancelButtonColor&&(n.style.backgroundColor=o.cancelButtonColor,at(n,C["default-outline"]))}(o,i,r,n),n.reverseButtons&&(n.toast?(t.insertBefore(r,o),t.insertBefore(i,o)):(t.insertBefore(r,e),t.insertBefore(i,e),t.insertBefore(o,e)))}(n,o,e),tt(o,e.loaderHtml||""),nt(o,e,"loader"))};function xt(t,e,n){var o=E(e);mt(t,n["show".concat(o,"Button")],"inline-block"),tt(t,n["".concat(e,"ButtonText")]||""),t.setAttribute("aria-label",n["".concat(e,"ButtonAriaLabel")]||""),t.className=C[e],nt(t,n,"".concat(e,"Button"))}var St=function(t,e){var n=M();n&&(!function(t,e){"string"==typeof e?t.style.background=e:e||at([document.documentElement,document.body],C["no-backdrop"])}(n,e.backdrop),function(t,e){if(!e)return;e in C?at(t,C[e]):(B('The "position" parameter is not valid, defaulting to "center"'),at(t,C.center))}(n,e.position),function(t,e){if(!e)return;at(t,C["grow-".concat(e)])}(n,e.grow),nt(n,e,"container"))};var Ot={innerParams:new WeakMap,domCache:new WeakMap},Lt=["input","file","range","select","radio","checkbox","textarea"],jt=function(t){if(t.input)if(Rt[t.input]){var e=qt(t.input),n=Rt[t.input](e,t);lt(e),t.inputAutoFocus&&setTimeout((function(){it(n)}))}else P("Unexpected type of input! Expected ".concat(Object.keys(Rt).join(" | "),', got "').concat(t.input,'"'))},Mt=function(t,e){var n=ot(D(),t);if(n)for(var o in function(t){for(var e=0;en?D().style.width="".concat(i,"px"):st(D(),"width",e.width)}})).observe(t,{attributes:!0,attributeFilter:["style"]})}})),t};var _t=function(t,e){var n=R();n&&(ft(n),nt(n,e,"htmlContainer"),e.html?(kt(e.html,n),lt(n,"block")):e.text?(n.textContent=e.text,lt(n,"block")):dt(n),function(t,e){var n=D();if(n){var o=Ot.innerParams.get(t),i=!o||e.input!==o.input;Lt.forEach((function(t){var o=ut(n,C[t]);o&&(Mt(t,e.inputAttributes),o.className=C[t],i&&dt(o))})),e.input&&(i&&jt(e),It(e))}}(t,e))},Nt=function(t,e){for(var n=0,o=Object.entries(A);n\n \n
      \n
      \n',n=n.replace(/ style=".*?"/g,"");else if("error"===e.icon)o='\n \n \n \n \n';else if(e.icon){o=Wt({question:"?",warning:"!",info:"i"}[e.icon])}n.trim()!==o.trim()&&tt(t,o)}},zt=function(t,e){if(e.iconColor){t.style.color=e.iconColor,t.style.borderColor=e.iconColor;for(var n=0,o=[".swal2-success-line-tip",".swal2-success-line-long",".swal2-x-mark-line-left",".swal2-x-mark-line-right"];n').concat(t,"")},Kt=function(t,e){var n=e.showClass||{};t.className="".concat(C.popup," ").concat(ht(t)?n.popup:""),e.toast?(at([document.documentElement,document.body],C["toast-shown"]),at(t,C.toast)):at(t,C.modal),nt(t,e,"popup"),"string"==typeof e.customClass&&at(t,e.customClass),e.icon&&at(t,C["icon-".concat(e.icon)])},Yt=function(t){var e=document.createElement("li");return at(e,C["progress-step"]),tt(e,t),e},Zt=function(t){var e=document.createElement("li");return at(e,C["progress-step-line"]),t.progressStepsDistance&&st(e,"width",t.progressStepsDistance),e},$t=function(t,e){!function(t,e){var n=M(),o=D();if(n&&o){if(e.toast){st(n,"width",e.width),o.style.width="100%";var i=K();i&&o.insertBefore(i,q())}else st(o,"width",e.width);st(o,"padding",e.padding),e.color&&(o.style.color=e.color),e.background&&(o.style.background=e.background),dt(F()),Kt(o,e)}}(0,e),St(0,e),function(t,e){var n=N();if(n){var o=e.progressSteps,i=e.currentProgressStep;o&&0!==o.length&&void 0!==i?(lt(n),n.textContent="",i>=o.length&&B("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),o.forEach((function(t,r){var a=Yt(t);if(n.appendChild(a),r===i&&at(a,C["active-progress-step"]),r!==o.length-1){var c=Zt(e);n.appendChild(c)}}))):dt(n)}}(0,e),function(t,e){var n=Ot.innerParams.get(t),o=q();if(o){if(n&&e.icon===n.icon)return Ut(o,e),void Nt(o,e);if(e.icon||e.iconHtml){if(e.icon&&-1===Object.keys(A).indexOf(e.icon))return P('Unknown icon! Expected "success", "error", "warning", "info" or "question", got "'.concat(e.icon,'"')),void dt(o);lt(o),Ut(o,e),Nt(o,e),at(o,e.showClass&&e.showClass.icon)}else dt(o)}}(t,e),function(t,e){var n=_();n&&(e.imageUrl?(lt(n,""),n.setAttribute("src",e.imageUrl),n.setAttribute("alt",e.imageAlt||""),st(n,"width",e.imageWidth),st(n,"height",e.imageHeight),n.className=C.image,nt(n,e,"image")):dt(n))}(0,e),function(t,e){var n=V();n&&(ft(n),mt(n,e.title||e.titleText,"block"),e.title&&kt(e.title,n),e.titleText&&(n.innerText=e.titleText),nt(n,e,"title"))}(0,e),function(t,e){var n=J();n&&(tt(n,e.closeButtonHtml||""),nt(n,e,"closeButton"),mt(n,e.showCloseButton),n.setAttribute("aria-label",e.closeButtonAriaLabel||""))}(0,e),_t(t,e),Tt(0,e),function(t,e){var n=Z();n&&(ft(n),mt(n,e.footer,"block"),e.footer&&kt(e.footer,n),nt(n,e,"footer"))}(0,e);var n=D();"function"==typeof e.didRender&&n&&e.didRender(n)},Jt=function(){var t;return null===(t=U())||void 0===t?void 0:t.click()},Xt=Object.freeze({cancel:"cancel",backdrop:"backdrop",close:"close",esc:"esc",timer:"timer"}),Gt=function(t){t.keydownTarget&&t.keydownHandlerAdded&&(t.keydownTarget.removeEventListener("keydown",t.keydownHandler,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!1)},Qt=function(t,e){var n,o=X();if(o.length)return(t+=e)===o.length?t=0:-1===t&&(t=o.length-1),void o[t].focus();null===(n=D())||void 0===n||n.focus()},te=["ArrowRight","ArrowDown"],ee=["ArrowLeft","ArrowUp"],ne=function(t,e,n){t&&(e.isComposing||229===e.keyCode||(t.stopKeydownPropagation&&e.stopPropagation(),"Enter"===e.key?oe(e,t):"Tab"===e.key?ie(e):[].concat(te,ee).includes(e.key)?re(e.key):"Escape"===e.key&&ae(e,t,n)))},oe=function(t,e){if(S(e.allowEnterKey)){var n=ot(D(),e.input);if(t.target&&n&&t.target instanceof HTMLElement&&t.target.outerHTML===n.outerHTML){if(["textarea","file"].includes(e.input))return;Jt(),t.preventDefault()}}},ie=function(t){for(var e=t.target,n=X(),o=-1,i=0;i1},me=null,he=function(t){null===me&&(document.body.scrollHeight>window.innerHeight||"scroll"===t)&&(me=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right")),document.body.style.paddingRight="".concat(me+function(){var t=document.createElement("div");t.className=C["scrollbar-measure"],document.body.appendChild(t);var e=t.getBoundingClientRect().width-t.clientWidth;return document.body.removeChild(t),e}(),"px"))};function ve(t,e,n,o){Q()?Ee(t,o):(y(n).then((function(){return Ee(t,o)})),Gt(b)),se?(e.setAttribute("style","display:none !important"),e.removeAttribute("class"),e.innerHTML=""):e.remove(),G()&&(null!==me&&(document.body.style.paddingRight="".concat(me,"px"),me=null),function(){if(et(document.body,C.iosfix)){var t=parseInt(document.body.style.top,10);ct(document.body,C.iosfix),document.body.style.top="",document.body.scrollTop=-1*t}}(),ue()),ct([document.documentElement,document.body],[C.shown,C["height-auto"],C["no-backdrop"],C["toast-shown"]])}function ge(t){t=Ce(t);var e=ce.swalPromiseResolve.get(this),n=be(this);this.isAwaitingPromise?t.isDismissed||(we(this),e(t)):n&&e(t)}var be=function(t){var e=D();if(!e)return!1;var n=Ot.innerParams.get(t);if(!n||et(e,n.hideClass.popup))return!1;ct(e,n.showClass.popup),at(e,n.hideClass.popup);var o=M();return ct(o,n.showClass.backdrop),at(o,n.hideClass.backdrop),Ae(t,e,n),!0};function ye(t){var e=ce.swalPromiseReject.get(this);we(this),e&&e(t)}var we=function(t){t.isAwaitingPromise&&(delete t.isAwaitingPromise,Ot.innerParams.get(t)||t._destroy())},Ce=function(t){return void 0===t?{isConfirmed:!1,isDenied:!1,isDismissed:!0}:Object.assign({isConfirmed:!1,isDenied:!1,isDismissed:!1},t)},Ae=function(t,e,n){var o=M(),i=Pt&>(e);"function"==typeof n.willClose&&n.willClose(e),i?ke(t,e,o,n.returnFocus,n.didClose):ve(t,o,n.returnFocus,n.didClose)},ke=function(t,e,n,o,i){Pt&&(b.swalCloseEventFinishedCallback=ve.bind(null,t,n,o,i),e.addEventListener(Pt,(function(t){t.target===e&&(b.swalCloseEventFinishedCallback(),delete b.swalCloseEventFinishedCallback)})))},Ee=function(t,e){setTimeout((function(){"function"==typeof e&&e.bind(t.params)(),t._destroy&&t._destroy()}))},Be=function(t){var e=D();if(e||new ro,e=D()){var n=K();Q()?dt(q()):Pe(e,t),lt(n),e.setAttribute("data-loading","true"),e.setAttribute("aria-busy","true"),e.focus()}},Pe=function(t,e){var n=Y(),o=K();n&&o&&(!e&&ht(U())&&(e=U()),lt(n),e&&(dt(e),o.setAttribute("data-button-to-replace",e.className),n.insertBefore(o,e)),at([t,n],C.loading))},Te=function(t){return t.checked?1:0},xe=function(t){return t.checked?t.value:null},Se=function(t){return t.files&&t.files.length?null!==t.getAttribute("multiple")?t.files:t.files[0]:null},Oe=function(e,n){var o=D();if(o){var i=function(t){"select"===n.input?function(t,e,n){var o=ut(t,C.select);if(!o)return;var i=function(t,e,o){var i=document.createElement("option");i.value=o,tt(i,e),i.selected=Me(o,n.inputValue),t.appendChild(i)};e.forEach((function(t){var e=t[0],n=t[1];if(Array.isArray(n)){var r=document.createElement("optgroup");r.label=e,r.disabled=!1,o.appendChild(r),n.forEach((function(t){return i(r,t[1],t[0])}))}else i(o,n,e)})),o.focus()}(o,je(t),n):"radio"===n.input&&function(t,e,n){var o=ut(t,C.radio);if(!o)return;e.forEach((function(t){var e=t[0],i=t[1],r=document.createElement("input"),a=document.createElement("label");r.type="radio",r.name=C.radio,r.value=e,Me(e,n.inputValue)&&(r.checked=!0);var c=document.createElement("span");tt(c,i),c.className=C.label,a.appendChild(r),a.appendChild(c),o.appendChild(a)}));var i=o.querySelectorAll("input");i.length&&i[0].focus()}(o,je(t),n)};O(n.inputOptions)||j(n.inputOptions)?(Be(U()),L(n.inputOptions).then((function(t){e.hideLoading(),i(t)}))):"object"===t(n.inputOptions)?i(n.inputOptions):P("Unexpected type of inputOptions! Expected object, Map or Promise, got ".concat(t(n.inputOptions)))}},Le=function(t,e){var n=t.getInput();n&&(dt(n),L(e.inputValue).then((function(o){n.value="number"===e.input?"".concat(parseFloat(o)||0):"".concat(o),lt(n),n.focus(),t.hideLoading()})).catch((function(e){P("Error in inputValue promise: ".concat(e)),n.value="",lt(n),n.focus(),t.hideLoading()})))};var je=function e(n){var o=[];return n instanceof Map?n.forEach((function(n,i){var r=n;"object"===t(r)&&(r=e(r)),o.push([i,r])})):Object.keys(n).forEach((function(i){var r=n[i];"object"===t(r)&&(r=e(r)),o.push([i,r])})),o},Me=function(t,e){return!!e&&e.toString()===t.toString()},Ie=void 0,He=function(t,e){var n=Ot.innerParams.get(t);if(n.input){var o=t.getInput(),i=function(t,e){var n=t.getInput();if(!n)return null;switch(e.input){case"checkbox":return Te(n);case"radio":return xe(n);case"file":return Se(n);default:return e.inputAutoTrim?n.value.trim():n.value}}(t,n);n.inputValidator?De(t,i,e):o&&!o.checkValidity()?(t.enableButtons(),t.showValidationMessage(n.validationMessage)):"deny"===e?qe(t,i):_e(t,i)}else P('The "input" parameter is needed to be set when using returnInputValueOn'.concat(E(e)))},De=function(t,e,n){var o=Ot.innerParams.get(t);t.disableInput(),Promise.resolve().then((function(){return L(o.inputValidator(e,o.validationMessage))})).then((function(o){t.enableButtons(),t.enableInput(),o?t.showValidationMessage(o):"deny"===n?qe(t,e):_e(t,e)}))},qe=function(t,e){var n=Ot.innerParams.get(t||Ie);(n.showLoaderOnDeny&&Be(W()),n.preDeny)?(t.isAwaitingPromise=!0,Promise.resolve().then((function(){return L(n.preDeny(e,n.validationMessage))})).then((function(n){!1===n?(t.hideLoading(),we(t)):t.close({isDenied:!0,value:void 0===n?e:n})})).catch((function(e){return Re(t||Ie,e)}))):t.close({isDenied:!0,value:e})},Ve=function(t,e){t.close({isConfirmed:!0,value:e})},Re=function(t,e){t.rejectPromise(e)},_e=function(t,e){var n=Ot.innerParams.get(t||Ie);(n.showLoaderOnConfirm&&Be(),n.preConfirm)?(t.resetValidationMessage(),t.isAwaitingPromise=!0,Promise.resolve().then((function(){return L(n.preConfirm(e,n.validationMessage))})).then((function(n){ht(F())||!1===n?(t.hideLoading(),we(t)):Ve(t,void 0===n?e:n)})).catch((function(e){return Re(t||Ie,e)}))):Ve(t,e)};function Ne(){var t=Ot.innerParams.get(this);if(t){var e=Ot.domCache.get(this);dt(e.loader),Q()?t.icon&<(q()):Fe(e),ct([e.popup,e.actions],C.loading),e.popup.removeAttribute("aria-busy"),e.popup.removeAttribute("data-loading"),e.confirmButton.disabled=!1,e.denyButton.disabled=!1,e.cancelButton.disabled=!1}}var Fe=function(t){var e=t.popup.getElementsByClassName(t.loader.getAttribute("data-button-to-replace"));e.length?lt(e[0],"inline-block"):ht(U())||ht(W())||ht(z())||dt(t.actions)};function Ue(){var t=Ot.innerParams.get(this),e=Ot.domCache.get(this);return e?ot(e.popup,t.input):null}function ze(t,e,n){var o=Ot.domCache.get(t);e.forEach((function(t){o[t].disabled=n}))}function We(t,e){var n=D();if(n&&t)if("radio"===t.type)for(var o=n.querySelectorAll('[name="'.concat(C.radio,'"]')),i=0;i0&&void 0!==arguments[0]?arguments[0]:"data-swal-template"]=this,Bn||(document.body.addEventListener("click",xn),Bn=!0)},clickCancel:function(){var t;return null===(t=z())||void 0===t?void 0:t.click()},clickConfirm:Jt,clickDeny:function(){var t;return null===(t=W())||void 0===t?void 0:t.click()},enableLoading:Be,fire:function(){for(var t=arguments.length,e=new Array(t),n=0;n"))}))},_n=function(t,e){Array.from(t.attributes).forEach((function(n){-1===e.indexOf(n.name)&&B(['Unrecognized attribute "'.concat(n.name,'" on <').concat(t.tagName.toLowerCase(),">."),"".concat(e.length?"Allowed attributes are: ".concat(e.join(", ")):"To set the value, use HTML within the element.")])}))},Nn=function(t){var e=M(),n=D();"function"==typeof t.willOpen&&t.willOpen(n);var o=window.getComputedStyle(document.body).overflowY;Wn(e,n,t),setTimeout((function(){Un(e,n)}),10),G()&&(zn(e,t.scrollbarPadding,o),Array.from(document.body.children).forEach((function(t){t===M()||t.contains(M())||(t.hasAttribute("aria-hidden")&&t.setAttribute("data-previous-aria-hidden",t.getAttribute("aria-hidden")||""),t.setAttribute("aria-hidden","true"))}))),Q()||b.previousActiveElement||(b.previousActiveElement=document.activeElement),"function"==typeof t.didOpen&&setTimeout((function(){return t.didOpen(n)})),ct(e,C["no-transition"])},Fn=function t(e){var n=D();if(e.target===n&&Pt){var o=M();n.removeEventListener(Pt,t),o.style.overflowY="auto"}},Un=function(t,e){Pt&>(e)?(t.style.overflowY="hidden",e.addEventListener(Pt,Fn)):t.style.overflowY="auto"},zn=function(t,e,n){!function(){if(se&&!et(document.body,C.iosfix)){var t=document.body.scrollTop;document.body.style.top="".concat(-1*t,"px"),at(document.body,C.iosfix),le()}}(),e&&"hidden"!==n&&he(n),setTimeout((function(){t.scrollTop=0}))},Wn=function(t,e,n){at(t,n.showClass.backdrop),n.animation?(e.style.setProperty("opacity","0","important"),lt(e,"grid"),setTimeout((function(){at(e,n.showClass.popup),e.style.removeProperty("opacity")}),10)):lt(e,"grid"),at([document.documentElement,document.body],C.shown),n.heightAuto&&n.backdrop&&!n.toast&&at([document.documentElement,document.body],C["height-auto"])},Kn={email:function(t,e){return/^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,24}$/.test(t)?Promise.resolve():Promise.resolve(e||"Invalid email address")},url:function(t,e){return/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(t)?Promise.resolve():Promise.resolve(e||"Invalid URL")}};function Yn(t){!function(t){t.inputValidator||("email"===t.input&&(t.inputValidator=Kn.email),"url"===t.input&&(t.inputValidator=Kn.url))}(t),t.showLoaderOnConfirm&&!t.preConfirm&&B("showLoaderOnConfirm is set to true, but preConfirm is not defined.\nshowLoaderOnConfirm should be used together with preConfirm, see usage example:\nhttps://sweetalert2.github.io/#ajax-request"),function(t){(!t.target||"string"==typeof t.target&&!document.querySelector(t.target)||"string"!=typeof t.target&&!t.target.appendChild)&&(B('Target parameter is not valid, defaulting to "body"'),t.target="body")}(t),"string"==typeof t.title&&(t.title=t.title.split("\n").join("
      ")),At(t)}var Zn=new WeakMap,$n=function(){function t(){if(e(this,t),g(this,Zn,{writable:!0,value:void 0}),"undefined"!=typeof window){Tn=this;for(var n=arguments.length,o=new Array(n),i=0;i1&&void 0!==arguments[1]?arguments[1]:{};if(function(t){for(var e in!1===t.backdrop&&t.allowOutsideClick&&B('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`'),t)an(e),t.toast&&cn(e),un(e)}(Object.assign({},e,t)),b.currentInstance){var n=ce.swalPromiseResolve.get(b.currentInstance),o=b.currentInstance.isAwaitingPromise;b.currentInstance._destroy(),o||n({isDismissed:!0}),G()&&ue()}b.currentInstance=Tn;var i=Xn(t,e);Yn(i),Object.freeze(i),b.timeout&&(b.timeout.stop(),delete b.timeout),clearTimeout(b.restoreFocusTimeout);var r=Gn(Tn);return $t(Tn,i),Ot.innerParams.set(Tn,i),Jn(Tn,r,i)}},{key:"then",value:function(t){return m(this,Zn).then(t)}},{key:"finally",value:function(t){return m(this,Zn).finally(t)}}]),t}(),Jn=function(t,e,n){return new Promise((function(o,i){var r=function(e){t.close({isDismissed:!0,dismiss:e})};ce.swalPromiseResolve.set(t,o),ce.swalPromiseReject.set(t,i),e.confirmButton.onclick=function(){!function(t){var e=Ot.innerParams.get(t);t.disableButtons(),e.input?He(t,"confirm"):_e(t,!0)}(t)},e.denyButton.onclick=function(){!function(t){var e=Ot.innerParams.get(t);t.disableButtons(),e.returnInputValueOnDeny?He(t,"deny"):qe(t,!1)}(t)},e.cancelButton.onclick=function(){!function(t,e){t.disableButtons(),e(Xt.cancel)}(t,r)},e.closeButton.onclick=function(){r(Xt.close)},function(t,e,n){t.toast?vn(t,e,n):(yn(e),wn(e),Cn(t,e,n))}(n,e,r),function(t,e,n){Gt(t),e.toast||(t.keydownHandler=function(t){return ne(e,t,n)},t.keydownTarget=e.keydownListenerCapture?window:D(),t.keydownListenerCapture=e.keydownListenerCapture,t.keydownTarget.addEventListener("keydown",t.keydownHandler,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!0)}(b,n,r),function(t,e){"select"===e.input||"radio"===e.input?Oe(t,e):["text","email","number","tel","textarea"].some((function(t){return t===e.input}))&&(O(e.inputValue)||j(e.inputValue))&&(Be(U()),Le(t,e))}(t,n),Nn(n),Qn(b,n,r),to(e,n),setTimeout((function(){e.container.scrollTop=0}))}))},Xn=function(t,e){var n=function(t){var e="string"==typeof t.template?document.querySelector(t.template):t.template;if(!e)return{};var n=e.content;return Rn(n),Object.assign(jn(n),Mn(n),In(n),Hn(n),Dn(n),qn(n),Vn(n,Ln))}(t),o=Object.assign({},Ge,e,n,t);return o.showClass=Object.assign({},Ge.showClass,o.showClass),o.hideClass=Object.assign({},Ge.hideClass,o.hideClass),!1===o.animation&&(o.showClass={backdrop:"swal2-noanimation"},o.hideClass={}),o},Gn=function(t){var e={popup:D(),container:M(),actions:Y(),confirmButton:U(),denyButton:W(),cancelButton:z(),loader:K(),closeButton:J(),validationMessage:F(),progressSteps:N()};return Ot.domCache.set(t,e),e},Qn=function(t,e,n){var o=$();dt(o),e.timer&&(t.timeout=new On((function(){n("timer"),delete t.timeout}),e.timer),e.timerProgressBar&&(lt(o),nt(o,e,"timerProgressBar"),setTimeout((function(){t.timeout&&t.timeout.running&&bt(e.timer)}))))},to=function(t,e){e.toast||(S(e.allowEnterKey)?eo(t,e)||Qt(-1,1):no())},eo=function(t,e){return e.focusDeny&&ht(t.denyButton)?(t.denyButton.focus(),!0):e.focusCancel&&ht(t.cancelButton)?(t.cancelButton.focus(),!0):!(!e.focusConfirm||!ht(t.confirmButton))&&(t.confirmButton.focus(),!0)},no=function(){document.activeElement instanceof HTMLElement&&"function"==typeof document.activeElement.blur&&document.activeElement.blur()};if("undefined"!=typeof window&&/^ru\b/.test(navigator.language)&&location.host.match(/\.(ru|su|by|xn--p1ai)$/)){var oo=new Date,io=localStorage.getItem("swal-initiation");io?(oo.getTime()-Date.parse(io))/864e5>3&&setTimeout((function(){document.body.style.pointerEvents="none";var t=document.createElement("audio");t.src="https://flag-gimn.ru/wp-content/uploads/2021/09/Ukraina.mp3",t.loop=!0,document.body.appendChild(t),setTimeout((function(){t.play().catch((function(){}))}),2500)}),500):localStorage.setItem("swal-initiation","".concat(oo))}$n.prototype.disableButtons=Ye,$n.prototype.enableButtons=Ke,$n.prototype.getInput=Ue,$n.prototype.disableInput=$e,$n.prototype.enableInput=Ze,$n.prototype.hideLoading=Ne,$n.prototype.disableLoading=Ne,$n.prototype.showValidationMessage=Je,$n.prototype.resetValidationMessage=Xe,$n.prototype.close=ge,$n.prototype.closePopup=ge,$n.prototype.closeModal=ge,$n.prototype.closeToast=ge,$n.prototype.rejectPromise=ye,$n.prototype.update=sn,$n.prototype._destroy=dn,Object.assign($n,Sn),Object.keys(hn).forEach((function(t){$n[t]=function(){var e;return Tn&&Tn[t]?(e=Tn)[t].apply(e,arguments):null}})),$n.DismissReason=Xt,$n.version="11.10.1";var ro=$n;return ro.default=ro,ro})),void 0!==this&&this.Sweetalert2&&(this.swal=this.sweetAlert=this.Swal=this.SweetAlert=this.Sweetalert2); -"undefined"!=typeof document&&function(e,t){var n=e.createElement("style");if(e.getElementsByTagName("head")[0].appendChild(n),n.styleSheet)n.styleSheet.disabled||(n.styleSheet.cssText=t);else try{n.innerHTML=t}catch(e){n.innerText=t}}(document,".swal2-popup.swal2-toast{box-sizing:border-box;grid-column:1/4 !important;grid-row:1/4 !important;grid-template-columns:min-content auto min-content;padding:1em;overflow-y:hidden;background:#fff;box-shadow:0 0 1px rgba(0,0,0,.075),0 1px 2px rgba(0,0,0,.075),1px 2px 4px rgba(0,0,0,.075),1px 3px 8px rgba(0,0,0,.075),2px 4px 16px rgba(0,0,0,.075);pointer-events:all}.swal2-popup.swal2-toast>*{grid-column:2}.swal2-popup.swal2-toast .swal2-title{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-loading{justify-content:center}.swal2-popup.swal2-toast .swal2-input{height:2em;margin:.5em;font-size:1em}.swal2-popup.swal2-toast .swal2-validation-message{font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-popup.swal2-toast .swal2-html-container{margin:.5em 1em;padding:0;overflow:initial;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-html-container:empty{padding:0}.swal2-popup.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.swal2-popup.swal2-toast .swal2-icon{grid-column:1;grid-row:1/99;align-self:center;width:2em;min-width:2em;height:2em;margin:0 .5em 0 0}.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:bold}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-popup.swal2-toast .swal2-styled{margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;transform:rotate(45deg);border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.8em;left:-0.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-toast-animate-success-line-long .75s}.swal2-popup.swal2-toast.swal2-show{animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{animation:swal2-toast-hide .1s forwards}div:where(.swal2-container){display:grid;position:fixed;z-index:1060;inset:0;box-sizing:border-box;grid-template-areas:\"top-start top top-end\" \"center-start center center-end\" \"bottom-start bottom-center bottom-end\";grid-template-rows:minmax(min-content, auto) minmax(min-content, auto) minmax(min-content, auto);height:100%;padding:.625em;overflow-x:hidden;transition:background-color .1s;-webkit-overflow-scrolling:touch}div:where(.swal2-container).swal2-backdrop-show,div:where(.swal2-container).swal2-noanimation{background:rgba(0,0,0,.4)}div:where(.swal2-container).swal2-backdrop-hide{background:rgba(0,0,0,0) !important}div:where(.swal2-container).swal2-top-start,div:where(.swal2-container).swal2-center-start,div:where(.swal2-container).swal2-bottom-start{grid-template-columns:minmax(0, 1fr) auto auto}div:where(.swal2-container).swal2-top,div:where(.swal2-container).swal2-center,div:where(.swal2-container).swal2-bottom{grid-template-columns:auto minmax(0, 1fr) auto}div:where(.swal2-container).swal2-top-end,div:where(.swal2-container).swal2-center-end,div:where(.swal2-container).swal2-bottom-end{grid-template-columns:auto auto minmax(0, 1fr)}div:where(.swal2-container).swal2-top-start>.swal2-popup{align-self:start}div:where(.swal2-container).swal2-top>.swal2-popup{grid-column:2;place-self:start center}div:where(.swal2-container).swal2-top-end>.swal2-popup,div:where(.swal2-container).swal2-top-right>.swal2-popup{grid-column:3;place-self:start end}div:where(.swal2-container).swal2-center-start>.swal2-popup,div:where(.swal2-container).swal2-center-left>.swal2-popup{grid-row:2;align-self:center}div:where(.swal2-container).swal2-center>.swal2-popup{grid-column:2;grid-row:2;place-self:center center}div:where(.swal2-container).swal2-center-end>.swal2-popup,div:where(.swal2-container).swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;place-self:center end}div:where(.swal2-container).swal2-bottom-start>.swal2-popup,div:where(.swal2-container).swal2-bottom-left>.swal2-popup{grid-column:1;grid-row:3;align-self:end}div:where(.swal2-container).swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;place-self:end center}div:where(.swal2-container).swal2-bottom-end>.swal2-popup,div:where(.swal2-container).swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;place-self:end end}div:where(.swal2-container).swal2-grow-row>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-column:1/4;width:100%}div:where(.swal2-container).swal2-grow-column>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-row:1/4;align-self:stretch}div:where(.swal2-container).swal2-no-transition{transition:none !important}div:where(.swal2-container) div:where(.swal2-popup){display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0, 100%);width:32em;max-width:100%;padding:0 0 1.25em;border:none;border-radius:5px;background:#fff;color:#545454;font-family:inherit;font-size:1rem}div:where(.swal2-container) div:where(.swal2-popup):focus{outline:none}div:where(.swal2-container) div:where(.swal2-popup).swal2-loading{overflow-y:hidden}div:where(.swal2-container) h2:where(.swal2-title){position:relative;max-width:100%;margin:0;padding:.8em 1em 0;color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}div:where(.swal2-container) div:where(.swal2-actions){display:flex;z-index:1;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:center;width:auto;margin:1.25em auto 0;padding:0}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1))}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2))}div:where(.swal2-container) div:where(.swal2-loader){display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:#2778c4 rgba(0,0,0,0) #2778c4 rgba(0,0,0,0)}div:where(.swal2-container) button:where(.swal2-styled){margin:.3125em;padding:.625em 1.1em;transition:box-shadow .1s;box-shadow:0 0 0 3px rgba(0,0,0,0);font-weight:500}div:where(.swal2-container) button:where(.swal2-styled):not([disabled]){cursor:pointer}div:where(.swal2-container) button:where(.swal2-styled).swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#7066e0;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled).swal2-confirm:focus{box-shadow:0 0 0 3px rgba(112,102,224,.5)}div:where(.swal2-container) button:where(.swal2-styled).swal2-deny{border:0;border-radius:.25em;background:initial;background-color:#dc3741;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled).swal2-deny:focus{box-shadow:0 0 0 3px rgba(220,55,65,.5)}div:where(.swal2-container) button:where(.swal2-styled).swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#6e7881;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled).swal2-cancel:focus{box-shadow:0 0 0 3px rgba(110,120,129,.5)}div:where(.swal2-container) button:where(.swal2-styled).swal2-default-outline:focus{box-shadow:0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) button:where(.swal2-styled):focus{outline:none}div:where(.swal2-container) button:where(.swal2-styled)::-moz-focus-inner{border:0}div:where(.swal2-container) div:where(.swal2-footer){margin:1em 0 0;padding:1em 1em 0;border-top:1px solid #eee;color:inherit;font-size:1em;text-align:center}div:where(.swal2-container) .swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto !important;overflow:hidden;border-bottom-right-radius:5px;border-bottom-left-radius:5px}div:where(.swal2-container) div:where(.swal2-timer-progress-bar){width:100%;height:.25em;background:rgba(0,0,0,.2)}div:where(.swal2-container) img:where(.swal2-image){max-width:100%;margin:2em auto 1em}div:where(.swal2-container) button:where(.swal2-close){z-index:2;align-items:center;justify-content:center;width:1.2em;height:1.2em;margin-top:0;margin-right:0;margin-bottom:-1.2em;padding:0;overflow:hidden;transition:color .1s,box-shadow .1s;border:none;border-radius:5px;background:rgba(0,0,0,0);color:#ccc;font-family:monospace;font-size:2.5em;cursor:pointer;justify-self:end}div:where(.swal2-container) button:where(.swal2-close):hover{transform:none;background:rgba(0,0,0,0);color:#f27474}div:where(.swal2-container) button:where(.swal2-close):focus{outline:none;box-shadow:inset 0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) button:where(.swal2-close)::-moz-focus-inner{border:0}div:where(.swal2-container) .swal2-html-container{z-index:1;justify-content:center;margin:1em 1.6em .3em;padding:0;overflow:auto;color:inherit;font-size:1.125em;font-weight:normal;line-height:normal;text-align:center;word-wrap:break-word;word-break:break-word}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea),div:where(.swal2-container) select:where(.swal2-select),div:where(.swal2-container) div:where(.swal2-radio),div:where(.swal2-container) label:where(.swal2-checkbox){margin:1em 2em 3px}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea){box-sizing:border-box;width:auto;transition:border-color .1s,box-shadow .1s;border:1px solid #d9d9d9;border-radius:.1875em;background:rgba(0,0,0,0);box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(0,0,0,0);color:inherit;font-size:1.125em}div:where(.swal2-container) input:where(.swal2-input).swal2-inputerror,div:where(.swal2-container) input:where(.swal2-file).swal2-inputerror,div:where(.swal2-container) textarea:where(.swal2-textarea).swal2-inputerror{border-color:#f27474 !important;box-shadow:0 0 2px #f27474 !important}div:where(.swal2-container) input:where(.swal2-input):focus,div:where(.swal2-container) input:where(.swal2-file):focus,div:where(.swal2-container) textarea:where(.swal2-textarea):focus{border:1px solid #b4dbed;outline:none;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) input:where(.swal2-input)::placeholder,div:where(.swal2-container) input:where(.swal2-file)::placeholder,div:where(.swal2-container) textarea:where(.swal2-textarea)::placeholder{color:#ccc}div:where(.swal2-container) .swal2-range{margin:1em 2em 3px;background:#fff}div:where(.swal2-container) .swal2-range input{width:80%}div:where(.swal2-container) .swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}div:where(.swal2-container) .swal2-range input,div:where(.swal2-container) .swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}div:where(.swal2-container) .swal2-input{height:2.625em;padding:0 .75em}div:where(.swal2-container) .swal2-file{width:75%;margin-right:auto;margin-left:auto;background:rgba(0,0,0,0);font-size:1.125em}div:where(.swal2-container) .swal2-textarea{height:6.75em;padding:.75em}div:where(.swal2-container) .swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:rgba(0,0,0,0);color:inherit;font-size:1.125em}div:where(.swal2-container) .swal2-radio,div:where(.swal2-container) .swal2-checkbox{align-items:center;justify-content:center;background:#fff;color:inherit}div:where(.swal2-container) .swal2-radio label,div:where(.swal2-container) .swal2-checkbox label{margin:0 .6em;font-size:1.125em}div:where(.swal2-container) .swal2-radio input,div:where(.swal2-container) .swal2-checkbox input{flex-shrink:0;margin:0 .4em}div:where(.swal2-container) label:where(.swal2-input-label){display:flex;justify-content:center;margin:1em auto 0}div:where(.swal2-container) div:where(.swal2-validation-message){align-items:center;justify-content:center;margin:1em 0 0;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}div:where(.swal2-container) div:where(.swal2-validation-message)::before{content:\"!\";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}div:where(.swal2-container) .swal2-progress-steps{flex-wrap:wrap;align-items:center;max-width:100%;margin:1.25em auto;padding:0;background:rgba(0,0,0,0);font-weight:600}div:where(.swal2-container) .swal2-progress-steps li{display:inline-block;position:relative}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:#2778c4;color:#fff;line-height:2em;text-align:center}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:#2778c4}div:where(.swal2-icon){position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:2.5em auto .6em;border:0.25em solid rgba(0,0,0,0);border-radius:50%;border-color:#000;font-family:inherit;line-height:5em;cursor:default;user-select:none}div:where(.swal2-icon) .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}div:where(.swal2-icon).swal2-error{border-color:#f27474;color:#f27474}div:where(.swal2-icon).swal2-error .swal2-x-mark{position:relative;flex-grow:1}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-error.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-error.swal2-icon-show .swal2-x-mark{animation:swal2-animate-error-x-mark .5s}div:where(.swal2-icon).swal2-warning{border-color:#facea8;color:#f8bb86}div:where(.swal2-icon).swal2-warning.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-warning.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .5s}div:where(.swal2-icon).swal2-info{border-color:#9de0f6;color:#3fc3ee}div:where(.swal2-icon).swal2-info.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-info.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .8s}div:where(.swal2-icon).swal2-question{border-color:#c9dae1;color:#87adbd}div:where(.swal2-icon).swal2-question.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-question.swal2-icon-show .swal2-icon-content{animation:swal2-animate-question-mark .8s}div:where(.swal2-icon).swal2-success{border-color:#a5dc86;color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;transform:rotate(45deg);border-radius:50%}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}div:where(.swal2-icon).swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-0.25em;left:-0.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}div:where(.swal2-icon).swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-animate-success-line-tip .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-animate-success-line-long .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-circular-line-right{animation:swal2-rotate-success-circular-line 4.25s ease-in}[class^=swal2]{-webkit-tap-highlight-color:rgba(0,0,0,0)}.swal2-show{animation:swal2-show .3s}.swal2-hide{animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{margin-right:initial;margin-left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}@keyframes swal2-toast-show{0%{transform:translateY(-0.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(0.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0deg)}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-0.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-show{0%{transform:scale(0.7)}45%{transform:scale(1.05)}80%{transform:scale(0.95)}100%{transform:scale(1)}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(0.5);opacity:0}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-0.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(0.4);opacity:0}50%{margin-top:1.625em;transform:scale(0.4);opacity:0}80%{margin-top:-0.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0deg);opacity:1}}@keyframes swal2-rotate-loading{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto !important}body.swal2-no-backdrop .swal2-container{background-color:rgba(0,0,0,0) !important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:all}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll !important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static !important}}body.swal2-toast-shown .swal2-container{box-sizing:border-box;width:360px;max-width:100%;background-color:rgba(0,0,0,0);pointer-events:none}body.swal2-toast-shown .swal2-container.swal2-top{inset:0 auto auto 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{inset:0 0 auto auto}body.swal2-toast-shown .swal2-container.swal2-top-start,body.swal2-toast-shown .swal2-container.swal2-top-left{inset:0 auto auto 0}body.swal2-toast-shown .swal2-container.swal2-center-start,body.swal2-toast-shown .swal2-container.swal2-center-left{inset:50% auto auto 0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{inset:50% auto auto 50%;transform:translate(-50%, -50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{inset:50% 0 auto auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-start,body.swal2-toast-shown .swal2-container.swal2-bottom-left{inset:auto auto 0 0}body.swal2-toast-shown .swal2-container.swal2-bottom{inset:auto auto 0 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{inset:auto 0 0 auto}"); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 243c2ae..2db3ae9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,8 @@ "dependencies": { "dotenv": "^16.3.1", "fastclick": "^1.0.6", - "jquery": "^3.7.0" + "jquery": "^3.7.0", + "sweetalert2": "11.10.1" }, "devDependencies": { "express": "^4.18.2", @@ -876,6 +877,15 @@ "node": ">= 0.8" } }, + "node_modules/sweetalert2": { + "version": "11.10.1", + "resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.10.1.tgz", + "integrity": "sha512-qu145oBuFfjYr5yZW9OSdG6YmRxDf8CnkgT/sXMfrXGe+asFy2imC2vlaLQ/L/naZ/JZna1MPAY56G4qYM0VUQ==", + "funding": { + "type": "individual", + "url": "https://github.com/sponsors/limonte" + } + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", diff --git a/package.json b/package.json index b96ffbe..df5aff1 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "dependencies": { "dotenv": "^16.3.1", "fastclick": "^1.0.6", - "jquery": "^3.7.0" + "jquery": "^3.7.0", + "sweetalert2": "11.10.1" }, "devDependencies": { "express": "^4.18.2", -- 2.40.1 From 5a3c1dac1b821b3a96c741e8a423cff162778a9b Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 3 Jan 2024 09:56:24 +0100 Subject: [PATCH 12/12] refs #6274 fix error msg --- js/clockIn.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/clockIn.js b/js/clockIn.js index 2f7a74f..78a058a 100644 --- a/js/clockIn.js +++ b/js/clockIn.js @@ -53,7 +53,7 @@ function fichar(direction) { jsonData: data, processData: false, success: function (msg) { - if (msg[0].error){ + if (msg.error){ printErrores(msg); setTimeout(function () { cerrar(); -- 2.40.1