feat: Completed migration from moment to luxon
This commit is contained in:
11
angular.json
11
angular.json
@@ -23,7 +23,8 @@
|
|||||||
},
|
},
|
||||||
"index": "src/index.html",
|
"index": "src/index.html",
|
||||||
"polyfills": [
|
"polyfills": [
|
||||||
"zone.js"
|
"zone.js",
|
||||||
|
"@angular/localize/init"
|
||||||
],
|
],
|
||||||
"tsConfig": "tsconfig.app.json",
|
"tsConfig": "tsconfig.app.json",
|
||||||
"inlineStyleLanguage": "scss",
|
"inlineStyleLanguage": "scss",
|
||||||
@@ -107,7 +108,7 @@
|
|||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"servePath": "/ipwa/",
|
"servePath": "/ipwa/",
|
||||||
"open": true
|
"open": false
|
||||||
},
|
},
|
||||||
"defaultConfiguration": "development"
|
"defaultConfiguration": "development"
|
||||||
},
|
},
|
||||||
@@ -122,7 +123,8 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"polyfills": [
|
"polyfills": [
|
||||||
"zone.js",
|
"zone.js",
|
||||||
"zone.js/testing"
|
"zone.js/testing",
|
||||||
|
"@angular/localize/init"
|
||||||
],
|
],
|
||||||
"tsConfig": "tsconfig.spec.json",
|
"tsConfig": "tsconfig.spec.json",
|
||||||
"inlineStyleLanguage": "scss",
|
"inlineStyleLanguage": "scss",
|
||||||
@@ -137,6 +139,9 @@
|
|||||||
"scripts": []
|
"scripts": []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"i18n": {
|
||||||
|
"sourceLocale": "pl"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
218
package-lock.json
generated
218
package-lock.json
generated
@@ -17,14 +17,13 @@
|
|||||||
"@angular/core": "^20.0.2",
|
"@angular/core": "^20.0.2",
|
||||||
"@angular/forms": "^20.0.2",
|
"@angular/forms": "^20.0.2",
|
||||||
"@angular/material": "^20.0.2",
|
"@angular/material": "^20.0.2",
|
||||||
"@angular/material-moment-adapter": "^20.0.2",
|
"@angular/material-luxon-adapter": "^20.0.2",
|
||||||
"@angular/platform-browser": "^20.0.2",
|
"@angular/platform-browser": "^20.0.2",
|
||||||
"@angular/platform-browser-dynamic": "^20.0.2",
|
"@angular/platform-browser-dynamic": "^20.0.2",
|
||||||
"@angular/router": "^20.0.2",
|
"@angular/router": "^20.0.2",
|
||||||
"@angular/service-worker": "^20.0.2",
|
"@angular/service-worker": "^20.0.2",
|
||||||
"luxon": "^3.6.1",
|
"luxon": "^3.6.1",
|
||||||
"marked": "^12.0.1",
|
"marked": "^12.0.1",
|
||||||
"moment": "^2.29.4",
|
|
||||||
"rxjs": "~7.5.0",
|
"rxjs": "~7.5.0",
|
||||||
"tslib": "^2.3.0",
|
"tslib": "^2.3.0",
|
||||||
"zone.js": "~0.15.1"
|
"zone.js": "~0.15.1"
|
||||||
@@ -32,6 +31,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular/build": "^20.0.1",
|
"@angular/build": "^20.0.1",
|
||||||
"@angular/compiler-cli": "^20.0.2",
|
"@angular/compiler-cli": "^20.0.2",
|
||||||
|
"@angular/localize": "^20.0.2",
|
||||||
"@types/jasmine": "~4.3.0",
|
"@types/jasmine": "~4.3.0",
|
||||||
"@types/luxon": "^3.6.2",
|
"@types/luxon": "^3.6.2",
|
||||||
"jasmine-core": "~4.5.0",
|
"jasmine-core": "~4.5.0",
|
||||||
@@ -934,6 +934,159 @@
|
|||||||
"rxjs": "^6.5.3 || ^7.4.0"
|
"rxjs": "^6.5.3 || ^7.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@angular/localize": {
|
||||||
|
"version": "20.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@angular/localize/-/localize-20.0.2.tgz",
|
||||||
|
"integrity": "sha512-k872tsni1WhrxZNEreCrPatcs35le1LZiLYXg6iGvDmwr8K125DiI2cC6l0dSoD6b3qwP2g+BtRT5lR8V6ROrg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/core": "7.27.4",
|
||||||
|
"@types/babel__core": "7.20.5",
|
||||||
|
"tinyglobby": "^0.2.12",
|
||||||
|
"yargs": "^18.0.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"localize-extract": "tools/bundles/src/extract/cli.js",
|
||||||
|
"localize-migrate": "tools/bundles/src/migrate/cli.js",
|
||||||
|
"localize-translate": "tools/bundles/src/translate/cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || ^22.12.0 || >=24.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@angular/compiler": "20.0.2",
|
||||||
|
"@angular/compiler-cli": "20.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@angular/localize/node_modules/ansi-regex": {
|
||||||
|
"version": "6.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz",
|
||||||
|
"integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/chalk/ansi-regex?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@angular/localize/node_modules/ansi-styles": {
|
||||||
|
"version": "6.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz",
|
||||||
|
"integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@angular/localize/node_modules/cliui": {
|
||||||
|
"version": "9.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/cliui/-/cliui-9.0.1.tgz",
|
||||||
|
"integrity": "sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"string-width": "^7.2.0",
|
||||||
|
"strip-ansi": "^7.1.0",
|
||||||
|
"wrap-ansi": "^9.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@angular/localize/node_modules/emoji-regex": {
|
||||||
|
"version": "10.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.4.0.tgz",
|
||||||
|
"integrity": "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/@angular/localize/node_modules/string-width": {
|
||||||
|
"version": "7.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz",
|
||||||
|
"integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"emoji-regex": "^10.3.0",
|
||||||
|
"get-east-asian-width": "^1.0.0",
|
||||||
|
"strip-ansi": "^7.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@angular/localize/node_modules/strip-ansi": {
|
||||||
|
"version": "7.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz",
|
||||||
|
"integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"ansi-regex": "^6.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/chalk/strip-ansi?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@angular/localize/node_modules/wrap-ansi": {
|
||||||
|
"version": "9.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.0.tgz",
|
||||||
|
"integrity": "sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"ansi-styles": "^6.2.1",
|
||||||
|
"string-width": "^7.0.0",
|
||||||
|
"strip-ansi": "^7.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@angular/localize/node_modules/yargs": {
|
||||||
|
"version": "18.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/yargs/-/yargs-18.0.0.tgz",
|
||||||
|
"integrity": "sha512-4UEqdc2RYGHZc7Doyqkrqiln3p9X2DZVxaGbwhn2pi7MrRagKaOcIKe8L3OxYcbhXLgLFUS3zAYuQjKBQgmuNg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"cliui": "^9.0.1",
|
||||||
|
"escalade": "^3.1.1",
|
||||||
|
"get-caller-file": "^2.0.5",
|
||||||
|
"string-width": "^7.2.0",
|
||||||
|
"y18n": "^5.0.5",
|
||||||
|
"yargs-parser": "^22.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || ^22.12.0 || >=23"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@angular/localize/node_modules/yargs-parser": {
|
||||||
|
"version": "22.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz",
|
||||||
|
"integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "ISC",
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || ^22.12.0 || >=23"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@angular/material": {
|
"node_modules/@angular/material": {
|
||||||
"version": "20.0.2",
|
"version": "20.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@angular/material/-/material-20.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@angular/material/-/material-20.0.2.tgz",
|
||||||
@@ -951,10 +1104,10 @@
|
|||||||
"rxjs": "^6.5.3 || ^7.4.0"
|
"rxjs": "^6.5.3 || ^7.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@angular/material-moment-adapter": {
|
"node_modules/@angular/material-luxon-adapter": {
|
||||||
"version": "20.0.2",
|
"version": "20.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@angular/material-moment-adapter/-/material-moment-adapter-20.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@angular/material-luxon-adapter/-/material-luxon-adapter-20.0.2.tgz",
|
||||||
"integrity": "sha512-EwpvAjoS18qV+31eNq3VffKOiLjo3X/OaoST+caf1opGxXLzgLol1OYZcBUo/lkPMPjmCriVzdT4rt5CiKJfMA==",
|
"integrity": "sha512-39poLZpr8tSygAcl5J6tDPzc1jh6+kdvojXR67iQl4fxW923lM8SyEBletHPrIQuA+Hds5g+gaFEBet7CWfWxw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.3.0"
|
"tslib": "^2.3.0"
|
||||||
@@ -962,7 +1115,7 @@
|
|||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@angular/core": "^20.0.0 || ^21.0.0",
|
"@angular/core": "^20.0.0 || ^21.0.0",
|
||||||
"@angular/material": "20.0.2",
|
"@angular/material": "20.0.2",
|
||||||
"moment": "^2.18.1"
|
"luxon": "^3.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@angular/platform-browser": {
|
"node_modules/@angular/platform-browser": {
|
||||||
@@ -3845,6 +3998,51 @@
|
|||||||
"node": "^18.17.0 || >=20.5.0"
|
"node": "^18.17.0 || >=20.5.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/babel__core": {
|
||||||
|
"version": "7.20.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",
|
||||||
|
"integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/parser": "^7.20.7",
|
||||||
|
"@babel/types": "^7.20.7",
|
||||||
|
"@types/babel__generator": "*",
|
||||||
|
"@types/babel__template": "*",
|
||||||
|
"@types/babel__traverse": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@types/babel__generator": {
|
||||||
|
"version": "7.27.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz",
|
||||||
|
"integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/types": "^7.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@types/babel__template": {
|
||||||
|
"version": "7.4.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz",
|
||||||
|
"integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/parser": "^7.1.0",
|
||||||
|
"@babel/types": "^7.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@types/babel__traverse": {
|
||||||
|
"version": "7.20.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.7.tgz",
|
||||||
|
"integrity": "sha512-dkO5fhS7+/oos4ciWxyEyjWe48zmG6wbCheo/G2ZnHx4fs3EU6YC6UM8rk56gAjNJ9P3MTH2jo5jb92/K6wbng==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/types": "^7.20.7"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/cors": {
|
"node_modules/@types/cors": {
|
||||||
"version": "2.8.17",
|
"version": "2.8.17",
|
||||||
"resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.17.tgz",
|
"resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.17.tgz",
|
||||||
@@ -6826,14 +7024,6 @@
|
|||||||
"mkdirp": "bin/cmd.js"
|
"mkdirp": "bin/cmd.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/moment": {
|
|
||||||
"version": "2.29.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
|
|
||||||
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==",
|
|
||||||
"engines": {
|
|
||||||
"node": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/mrmime": {
|
"node_modules/mrmime": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz",
|
||||||
|
|||||||
@@ -20,14 +20,13 @@
|
|||||||
"@angular/core": "^20.0.2",
|
"@angular/core": "^20.0.2",
|
||||||
"@angular/forms": "^20.0.2",
|
"@angular/forms": "^20.0.2",
|
||||||
"@angular/material": "^20.0.2",
|
"@angular/material": "^20.0.2",
|
||||||
"@angular/material-moment-adapter": "^20.0.2",
|
"@angular/material-luxon-adapter": "^20.0.2",
|
||||||
"@angular/platform-browser": "^20.0.2",
|
"@angular/platform-browser": "^20.0.2",
|
||||||
"@angular/platform-browser-dynamic": "^20.0.2",
|
"@angular/platform-browser-dynamic": "^20.0.2",
|
||||||
"@angular/router": "^20.0.2",
|
"@angular/router": "^20.0.2",
|
||||||
"@angular/service-worker": "^20.0.2",
|
"@angular/service-worker": "^20.0.2",
|
||||||
"luxon": "^3.6.1",
|
"luxon": "^3.6.1",
|
||||||
"marked": "^12.0.1",
|
"marked": "^12.0.1",
|
||||||
"moment": "^2.29.4",
|
|
||||||
"rxjs": "~7.5.0",
|
"rxjs": "~7.5.0",
|
||||||
"tslib": "^2.3.0",
|
"tslib": "^2.3.0",
|
||||||
"zone.js": "~0.15.1"
|
"zone.js": "~0.15.1"
|
||||||
@@ -35,6 +34,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular/build": "^20.0.1",
|
"@angular/build": "^20.0.1",
|
||||||
"@angular/compiler-cli": "^20.0.2",
|
"@angular/compiler-cli": "^20.0.2",
|
||||||
|
"@angular/localize": "^20.0.2",
|
||||||
"@types/jasmine": "~4.3.0",
|
"@types/jasmine": "~4.3.0",
|
||||||
"@types/luxon": "^3.6.2",
|
"@types/luxon": "^3.6.2",
|
||||||
"jasmine-core": "~4.5.0",
|
"jasmine-core": "~4.5.0",
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
@if (data.type == 'edit') {
|
@if (data.type == 'edit') {
|
||||||
<span>Data rejestracji:<br>{{regDate?.format('DD.MM.YYYY')}}</span>
|
<span>Data rejestracji:<br>{{regDate?.toFormat('D')}}</span>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ import { UserDeleteComponent } from '../user-delete/user-delete.component';
|
|||||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||||
import { UserResetComponent } from '../user-reset/user-reset.component';
|
import { UserResetComponent } from '../user-reset/user-reset.component';
|
||||||
import { catchError, throwError } from 'rxjs';
|
import { catchError, throwError } from 'rxjs';
|
||||||
import { Moment } from 'moment';
|
import { DateTime } from 'luxon';
|
||||||
import moment from 'moment';
|
|
||||||
|
|
||||||
export namespace UserEditComponent {
|
export namespace UserEditComponent {
|
||||||
export type InputData = {type: "new" | "edit", id?: string, groups: Group[]}
|
export type InputData = {type: "new" | "edit", id?: string, groups: Group[]}
|
||||||
@@ -36,7 +35,7 @@ export class UserEditComponent {
|
|||||||
})
|
})
|
||||||
groups: Group[]
|
groups: Group[]
|
||||||
id?: string
|
id?: string
|
||||||
regDate?: Moment;
|
regDate?: DateTime;
|
||||||
constructor (
|
constructor (
|
||||||
public dialogRef: MatDialogRef<UserEditComponent>,
|
public dialogRef: MatDialogRef<UserEditComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA) public data: UserEditComponent.InputData,
|
@Inject(MAT_DIALOG_DATA) public data: UserEditComponent.InputData,
|
||||||
@@ -49,7 +48,7 @@ export class UserEditComponent {
|
|||||||
if (data.type == "edit") {
|
if (data.type == "edit") {
|
||||||
this.id = data.id
|
this.id = data.id
|
||||||
this.acu.accs.getUser(data.id!).subscribe((r) => {
|
this.acu.accs.getUser(data.id!).subscribe((r) => {
|
||||||
this.regDate = moment(r.regDate)
|
this.regDate = DateTime.fromISO(r.regDate)
|
||||||
var flags: Array<number> = []
|
var flags: Array<number> = []
|
||||||
if (r.admin) {
|
if (r.admin) {
|
||||||
if ((r.admin & 1) == 1) flags.push(1)
|
if ((r.admin & 1) == 1) flags.push(1)
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Moment } from 'moment';
|
|
||||||
import { environment } from 'src/environments/environment';
|
import { environment } from 'src/environments/environment';
|
||||||
import { Menu } from '../types/menu';
|
import { Menu } from '../types/menu';
|
||||||
import { Status } from '../types/status';
|
import { Status } from '../types/status';
|
||||||
import { Group } from '../types/group';
|
import { Group } from '../types/group';
|
||||||
import { map, of } from 'rxjs';
|
import { map } from 'rxjs';
|
||||||
import { Notification } from '../types/notification';
|
import { Notification } from '../types/notification';
|
||||||
import { News } from '../types/news';
|
import { News } from '../types/news';
|
||||||
import { AKey } from '../types/key';
|
import { AKey } from '../types/key';
|
||||||
import moment from 'moment';
|
|
||||||
import { IUSettings } from './settings/settings.component';
|
import { IUSettings } from './settings/settings.component';
|
||||||
import User from '../types/user';
|
import User from '../types/user';
|
||||||
|
import { DateTime } from 'luxon';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -22,10 +21,10 @@ export class AdminCommService {
|
|||||||
|
|
||||||
//#region Menu
|
//#region Menu
|
||||||
menu = {
|
menu = {
|
||||||
getMenu: (start?: Moment | null, end?: Moment | null) => {
|
getMenu: (start?: DateTime | null, end?: DateTime | null) => {
|
||||||
if (start && end) {
|
if (start && end) {
|
||||||
const body = {start: start.toString(), end: end.toString()}
|
const body = {start: start.toString(), end: end.toString()}
|
||||||
return this.http.get<Menu[]>(environment.apiEndpoint+"/admin/menu", {withCredentials: true, params: body})
|
return this.http.get<(Omit<Menu, "day"> & {day: string})[]>(environment.apiEndpoint+"/admin/menu", {withCredentials: true, params: body})
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
},
|
},
|
||||||
@@ -59,7 +58,7 @@ export class AdminCommService {
|
|||||||
return this.putMenu(id, {dayTitle: content})
|
return this.putMenu(id, {dayTitle: content})
|
||||||
},
|
},
|
||||||
|
|
||||||
print: (start?: Moment | null, end?: Moment | null) => {
|
print: (start?: DateTime | null, end?: DateTime | null) => {
|
||||||
if (start && end) {
|
if (start && end) {
|
||||||
const body = {start: start.toString(), end: end.toString()}
|
const body = {start: start.toString(), end: end.toString()}
|
||||||
return this.http.get(environment.apiEndpoint+"/admin/menu/print", {withCredentials: true, params: body, responseType: "text"})
|
return this.http.get(environment.apiEndpoint+"/admin/menu/print", {withCredentials: true, params: body, responseType: "text"})
|
||||||
@@ -67,15 +66,15 @@ export class AdminCommService {
|
|||||||
return
|
return
|
||||||
},
|
},
|
||||||
|
|
||||||
stat: (day: Moment, m: "ob" | "kol") => {
|
stat: (day: DateTime, m: "ob" | "kol") => {
|
||||||
return this.http.get<{y: number, n: number}>(environment.apiEndpoint+`/admin/menu/${day.toISOString()}/votes/${m}`, {withCredentials: true})
|
return this.http.get<{y: number, n: number}>(environment.apiEndpoint+`/admin/menu/${day.toISO()}/votes/${m}`, {withCredentials: true})
|
||||||
},
|
},
|
||||||
new: {
|
new: {
|
||||||
single: (day: Moment) => {
|
single: (day: DateTime) => {
|
||||||
return this.http.post<Status>(environment.apiEndpoint+`/admin/menu/${day.toISOString()}`, null, {withCredentials: true})
|
return this.http.post<Status>(environment.apiEndpoint+`/admin/menu/${day.toISO()}`, null, {withCredentials: true})
|
||||||
},
|
},
|
||||||
range: (start: Moment, count: number) => {
|
range: (start: DateTime, count: number) => {
|
||||||
return this.http.post<Status>(environment.apiEndpoint+`/admin/menu/${start.toISOString()}/${count}/`, null, {withCredentials: true})
|
return this.http.post<Status>(environment.apiEndpoint+`/admin/menu/${start.toISO()}/${count}/`, null, {withCredentials: true})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
rm: (id: string) => {
|
rm: (id: string) => {
|
||||||
@@ -144,7 +143,7 @@ export class AdminCommService {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getUser: (id: string) => {
|
getUser: (id: string) => {
|
||||||
return this.http.get<Omit<User, "pass"> & {lockout: boolean}>(environment.apiEndpoint+`/admin/accs/${id}`, {withCredentials: true})
|
return this.http.get<Omit<User, "pass" | "regDate"> & {lockout: boolean, regDate: string}>(environment.apiEndpoint+`/admin/accs/${id}`, {withCredentials: true})
|
||||||
},
|
},
|
||||||
|
|
||||||
clearLockout: (id: string) => {
|
clearLockout: (id: string) => {
|
||||||
@@ -185,7 +184,10 @@ export class AdminCommService {
|
|||||||
},
|
},
|
||||||
outbox: {
|
outbox: {
|
||||||
getSent: () => {
|
getSent: () => {
|
||||||
return this.http.get<{_id: string, sentDate: moment.Moment, title: string}[]>(environment.apiEndpoint+"/admin/notif/outbox", {withCredentials: true})
|
return this.http.get<{_id: string, sentDate: string, title: string}[]>(environment.apiEndpoint+"/admin/notif/outbox", {withCredentials: true}).pipe(map(v => v.map(i => ({
|
||||||
|
...i,
|
||||||
|
sentDate: DateTime.fromISO(i.sentDate)
|
||||||
|
}))))
|
||||||
},
|
},
|
||||||
getBody: (id: string) => {
|
getBody: (id: string) => {
|
||||||
return this.http.get(environment.apiEndpoint+`/admin/notif/outbox/${id}/message`, {withCredentials: true, responseType: "text"})
|
return this.http.get(environment.apiEndpoint+`/admin/notif/outbox/${id}/message`, {withCredentials: true, responseType: "text"})
|
||||||
@@ -199,11 +201,12 @@ export class AdminCommService {
|
|||||||
//#region Keys
|
//#region Keys
|
||||||
keys = {
|
keys = {
|
||||||
getKeys: () => {
|
getKeys: () => {
|
||||||
return this.http.get<AKey[]>(environment.apiEndpoint+`/admin/keys`, {withCredentials: true}).pipe(map((v) => {
|
return this.http.get<(Omit<AKey, "borrow" | "tb"> & {borrow: string, tb?: string})[]>(environment.apiEndpoint+`/admin/keys`, {withCredentials: true}).pipe(map((v) => {
|
||||||
return v.map((r) => {
|
return v.map((r) => {
|
||||||
r.borrow = moment(r.borrow)
|
let newkey: any = {...r}
|
||||||
if (r.tb) r.tb = moment(r.tb)
|
newkey.borrow = DateTime.fromISO(r.borrow!)
|
||||||
return r
|
if (newkey.tb) newkey.tb = DateTime.fromISO(r.tb!)
|
||||||
|
return newkey as AKey
|
||||||
})
|
})
|
||||||
}))
|
}))
|
||||||
},
|
},
|
||||||
@@ -217,7 +220,7 @@ export class AdminCommService {
|
|||||||
},
|
},
|
||||||
|
|
||||||
returnKey: (id: string) => {
|
returnKey: (id: string) => {
|
||||||
return this.putKeys(id, {tb: moment.utc()})
|
return this.putKeys(id, {tb: DateTime.now()})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,8 +233,8 @@ export class AdminCommService {
|
|||||||
getConfig: () => {
|
getConfig: () => {
|
||||||
return this.http.get<{rooms: string[], things: string[]}>(environment.apiEndpoint+`/admin/clean/config`, {withCredentials: true})
|
return this.http.get<{rooms: string[], things: string[]}>(environment.apiEndpoint+`/admin/clean/config`, {withCredentials: true})
|
||||||
},
|
},
|
||||||
getClean: (date: moment.Moment, room: string) => {
|
getClean: (date: string, room: string) => {
|
||||||
return this.http.get<{_id: string, date: string, grade: number, gradeDate: string, notes: {label: string, weight: number}[], room: string, tips: string} | null>(environment.apiEndpoint+`/admin/clean/${date.toISOString()}/${room}`, {withCredentials: true})
|
return this.http.get<{_id: string, date: string, grade: number, gradeDate: string, notes: {label: string, weight: number}[], room: string, tips: string} | null>(environment.apiEndpoint+`/admin/clean/${date}/${room}`, {withCredentials: true})
|
||||||
},
|
},
|
||||||
postClean: (obj: Object) => {
|
postClean: (obj: Object) => {
|
||||||
return this.http.post<Status>(environment.apiEndpoint+`/admin/clean/`, obj, {withCredentials: true})
|
return this.http.post<Status>(environment.apiEndpoint+`/admin/clean/`, obj, {withCredentials: true})
|
||||||
@@ -240,8 +243,8 @@ export class AdminCommService {
|
|||||||
return this.http.delete<Status>(environment.apiEndpoint+`/admin/clean/${id}`, {withCredentials: true})
|
return this.http.delete<Status>(environment.apiEndpoint+`/admin/clean/${id}`, {withCredentials: true})
|
||||||
},
|
},
|
||||||
summary: {
|
summary: {
|
||||||
getSummary: (start: moment.Moment, end: moment.Moment) => {
|
getSummary: (start: DateTime, end: DateTime) => {
|
||||||
return this.http.get<{room: string, avg: number}[]>(environment.apiEndpoint+`/admin/clean/summary/${start.toISOString()}/${end.toISOString()}`, {withCredentials: true})
|
return this.http.get<{room: string, avg: number}[]>(environment.apiEndpoint+`/admin/clean/summary/${start.toISO()}/${end.toISO()}`, {withCredentials: true})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
attendence: {
|
attendence: {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<app-date-selector [(date)]="date" [filter]="filter" (dateChange)="downloadData()"></app-date-selector>
|
<app-date-selector [(date)]="date" [filter]="filter" (dateChange)="downloadData()"></app-date-selector>
|
||||||
<app-room-chooser [rooms]="rooms" (room)="roomNumber($event)"/>
|
<app-room-chooser [rooms]="rooms" (room)="roomNumber($event)"/>
|
||||||
<form [formGroup]="form">
|
<form [formGroup]="form">
|
||||||
<p>Czystość pokoju {{room}} na dzień {{date.format("dddd")}}</p>
|
<p>Czystość pokoju {{room}} na {{_date.toFormat("cccc, D")}}</p>
|
||||||
<p>Ocena: {{grade}}</p>
|
<p>Ocena: {{grade}}</p>
|
||||||
<div id="buttons">
|
<div id="buttons">
|
||||||
<button mat-mini-fab (click)="downloadData()" color="accent"><mat-icon>cancel</mat-icon></button>
|
<button mat-mini-fab (click)="downloadData()" color="accent"><mat-icon>cancel</mat-icon></button>
|
||||||
|
|||||||
@@ -4,20 +4,20 @@ import { GradesComponent } from './grades.component';
|
|||||||
import { AdminCommService } from '../admin-comm.service';
|
import { AdminCommService } from '../admin-comm.service';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||||
import * as moment from 'moment';
|
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
import { MatInputModule } from '@angular/material/input';
|
import { MatInputModule } from '@angular/material/input';
|
||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
|
import { DateTime } from 'luxon';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-date-selector", template: '',
|
selector: "app-date-selector", template: '',
|
||||||
standalone: false
|
standalone: false
|
||||||
})
|
})
|
||||||
class DateSelectorStub {
|
class DateSelectorStub {
|
||||||
@Input() date: moment.Moment = moment.utc().startOf('day');
|
@Input() date: string = DateTime.now().toISODate();
|
||||||
@Output() dateChange = new EventEmitter<moment.Moment>();
|
@Output() dateChange = new EventEmitter<moment.Moment>();
|
||||||
@Input() filter: (date: moment.Moment | null) => boolean = () => true
|
@Input() filter: (date: moment.Moment | null) => boolean = () => true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||||
import { AdminCommService } from '../admin-comm.service';
|
import { AdminCommService } from '../admin-comm.service';
|
||||||
import moment from 'moment';
|
|
||||||
import { FormArray, FormBuilder } from '@angular/forms';
|
import { FormArray, FormBuilder } from '@angular/forms';
|
||||||
import { weekendFilter } from 'src/app/fd.da';
|
import { weekendFilter } from 'src/app/fd.da';
|
||||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||||
@@ -8,6 +7,7 @@ import { ToolbarService } from '../toolbar/toolbar.service';
|
|||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { AttendenceComponent } from './attendence/attendence.component';
|
import { AttendenceComponent } from './attendence/attendence.component';
|
||||||
|
import { DateTime } from 'luxon';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-grades',
|
selector: 'app-grades',
|
||||||
@@ -18,9 +18,15 @@ import { AttendenceComponent } from './attendence/attendence.component';
|
|||||||
export class GradesComponent implements OnInit, OnDestroy {
|
export class GradesComponent implements OnInit, OnDestroy {
|
||||||
rooms!: string[]
|
rooms!: string[]
|
||||||
room: string = "0";
|
room: string = "0";
|
||||||
date: moment.Moment;
|
protected _date: DateTime;
|
||||||
|
public get date(): string {
|
||||||
|
return this._date.toISODate()!;
|
||||||
|
}
|
||||||
|
public set date(value: string) {
|
||||||
|
this._date = DateTime.fromISO(value);
|
||||||
|
}
|
||||||
grade: number = 6
|
grade: number = 6
|
||||||
gradeDate?: moment.Moment;
|
gradeDate?: DateTime;
|
||||||
id?: string
|
id?: string
|
||||||
filter = weekendFilter
|
filter = weekendFilter
|
||||||
|
|
||||||
@@ -46,8 +52,8 @@ export class GradesComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor(private ac: AdminCommService, private fb: FormBuilder, private sb: MatSnackBar, private toolbar: ToolbarService, private router: Router, private route: ActivatedRoute, private dialog: MatDialog) {
|
constructor(private ac: AdminCommService, private fb: FormBuilder, private sb: MatSnackBar, private toolbar: ToolbarService, private router: Router, private route: ActivatedRoute, private dialog: MatDialog) {
|
||||||
this.date = moment.utc().startOf('day')
|
this._date = DateTime.now()
|
||||||
if (!this.filter(this.date)) this.date.isoWeekday(8);
|
// if (!this.filter(this.date)) this.date.isoWeekday(8);
|
||||||
this.toolbar.comp = this
|
this.toolbar.comp = this
|
||||||
this.toolbar.menu = [
|
this.toolbar.menu = [
|
||||||
{ title: "Pokoje do sprawdzenia", check: true, fn: "attendenceSummary", icon: "overview"},
|
{ title: "Pokoje do sprawdzenia", check: true, fn: "attendenceSummary", icon: "overview"},
|
||||||
@@ -95,7 +101,7 @@ export class GradesComponent implements OnInit, OnDestroy {
|
|||||||
this.ac.clean.getClean(this.date, this.room).subscribe((v) => {
|
this.ac.clean.getClean(this.date, this.room).subscribe((v) => {
|
||||||
if (v) {
|
if (v) {
|
||||||
this.notes = v.notes
|
this.notes = v.notes
|
||||||
this.gradeDate = moment(v.gradeDate)
|
this.gradeDate = DateTime.fromISO(v.gradeDate)
|
||||||
this.grade = v.grade
|
this.grade = v.grade
|
||||||
this.id = v._id
|
this.id = v._id
|
||||||
this.form.get("tips")?.setValue(v.tips)
|
this.form.get("tips")?.setValue(v.tips)
|
||||||
@@ -140,7 +146,7 @@ export class GradesComponent implements OnInit, OnDestroy {
|
|||||||
this.calculate()
|
this.calculate()
|
||||||
var obj = {
|
var obj = {
|
||||||
grade: this.grade,
|
grade: this.grade,
|
||||||
date: this.date.toDate(),
|
date: this.date,
|
||||||
room: this.room,
|
room: this.room,
|
||||||
notes: this.notes,
|
notes: this.notes,
|
||||||
tips: this.form.get("tips")?.value
|
tips: this.form.get("tips")?.value
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
|||||||
import { ToolbarService } from '../../toolbar/toolbar.service';
|
import { ToolbarService } from '../../toolbar/toolbar.service';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { AdminCommService } from '../../admin-comm.service';
|
import { AdminCommService } from '../../admin-comm.service';
|
||||||
import * as moment from 'moment';
|
|
||||||
import { MatTableDataSource } from '@angular/material/table';
|
import { MatTableDataSource } from '@angular/material/table';
|
||||||
import { FormBuilder } from '@angular/forms';
|
import { FormBuilder } from '@angular/forms';
|
||||||
import { MatSort } from '@angular/material/sort';
|
import { MatSort } from '@angular/material/sort';
|
||||||
|
import { DateTime } from 'luxon';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-summary',
|
selector: 'app-summary',
|
||||||
@@ -19,8 +19,8 @@ export class SummaryComponent implements OnInit, OnDestroy {
|
|||||||
collumns = ['room', 'avg']
|
collumns = ['room', 'avg']
|
||||||
|
|
||||||
dateSelector = this.fb.group({
|
dateSelector = this.fb.group({
|
||||||
start: this.fb.control(moment.utc().startOf('day')),
|
start: this.fb.control(DateTime.utc().startOf('day')),
|
||||||
end: this.fb.control(moment.utc().endOf('day'))
|
end: this.fb.control(DateTime.utc().endOf('day'))
|
||||||
})
|
})
|
||||||
|
|
||||||
@ViewChild(MatSort, {static: false}) set content(sort: MatSort) {
|
@ViewChild(MatSort, {static: false}) set content(sort: MatSort) {
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core';
|
import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core';
|
||||||
import { MatPaginator } from '@angular/material/paginator';
|
import { MatPaginator } from '@angular/material/paginator';
|
||||||
import { MatTableDataSource } from '@angular/material/table';
|
import { MatTableDataSource } from '@angular/material/table';
|
||||||
import * as moment from 'moment';
|
|
||||||
import { AKey } from 'src/app/types/key';
|
import { AKey } from 'src/app/types/key';
|
||||||
import { AdminCommService } from '../admin-comm.service';
|
import { AdminCommService } from '../admin-comm.service';
|
||||||
import { FormControl } from '@angular/forms';
|
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { NewKeyComponent } from './new-key/new-key.component';
|
import { NewKeyComponent } from './new-key/new-key.component';
|
||||||
import { catchError, throwError } from 'rxjs';
|
import { catchError, throwError } from 'rxjs';
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ import { MenuUploadComponent } from '../menu-upload/menu-upload.component';
|
|||||||
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
|
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
|
||||||
import { FDSelection, weekendFilter } from 'src/app/fd.da';
|
import { FDSelection, weekendFilter } from 'src/app/fd.da';
|
||||||
import { FormControl, FormGroup } from '@angular/forms';
|
import { FormControl, FormGroup } from '@angular/forms';
|
||||||
import { Moment } from 'moment';
|
|
||||||
import { MAT_DATE_RANGE_SELECTION_STRATEGY } from '@angular/material/datepicker';
|
import { MAT_DATE_RANGE_SELECTION_STRATEGY } from '@angular/material/datepicker';
|
||||||
import * as moment from 'moment';
|
import { DateTime } from 'luxon';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-menu-add',
|
selector: 'app-menu-add',
|
||||||
@@ -20,11 +19,11 @@ export class MenuAddComponent {
|
|||||||
type: string | undefined;
|
type: string | undefined;
|
||||||
filter = weekendFilter
|
filter = weekendFilter
|
||||||
|
|
||||||
day: Moment = moment.utc();
|
day: string = DateTime.now().toISODate();
|
||||||
|
|
||||||
range = new FormGroup({
|
range = new FormGroup({
|
||||||
start: new FormControl<Moment|null>(null),
|
start: new FormControl<DateTime|null>(null),
|
||||||
end: new FormControl<Moment|null>(null),
|
end: new FormControl<DateTime|null>(null),
|
||||||
})
|
})
|
||||||
|
|
||||||
constructor (public dialogRef: MatDialogRef<MenuAddComponent>, private dialog: MatDialog) { }
|
constructor (public dialogRef: MatDialogRef<MenuAddComponent>, private dialog: MatDialog) { }
|
||||||
@@ -32,10 +31,10 @@ export class MenuAddComponent {
|
|||||||
submit() {
|
submit() {
|
||||||
switch (this.type) {
|
switch (this.type) {
|
||||||
case "day":
|
case "day":
|
||||||
this.dialogRef.close({type: "day", value: this.day.utc().startOf('day')})
|
this.dialogRef.close({type: "day", value: this.day})
|
||||||
break;
|
break;
|
||||||
case "week":
|
case "week":
|
||||||
this.dialogRef.close({type: "week", value: {start: this.range.value.start?.utc().hours(24), count: 5}})
|
this.dialogRef.close({type: "week", value: {start: this.range.value.start?.toISODate(), count: 5}})
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -19,8 +19,8 @@
|
|||||||
<div matColumnDef="day">
|
<div matColumnDef="day">
|
||||||
<th mat-header-cell *matHeaderCellDef>Dzień</th>
|
<th mat-header-cell *matHeaderCellDef>Dzień</th>
|
||||||
<td mat-cell *matCellDef="let element">
|
<td mat-cell *matCellDef="let element">
|
||||||
<span>{{element.day.format('DD.MM.YYYY')}}r.</span>
|
<span>{{element.day.toFormat('dd.LL.yyyy')}}r.</span>
|
||||||
<p>{{element.day.format('dddd')}}</p>
|
<p>{{element.day.toFormat('cccc') | titlecase }}</p>
|
||||||
<app-field-editor category="Nazwa" [(word)]="element.dayTitle" (wordChange)="editTitle(element._id)"/><br><hr>
|
<app-field-editor category="Nazwa" [(word)]="element.dayTitle" (wordChange)="editTitle(element._id)"/><br><hr>
|
||||||
<button (click)="remove(element._id)">Usuń dzień</button>
|
<button (click)="remove(element._id)">Usuń dzień</button>
|
||||||
</td>
|
</td>
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
<th mat-header-cell *matHeaderCellDef>Kolacja</th>
|
<th mat-header-cell *matHeaderCellDef>Kolacja</th>
|
||||||
<td mat-cell *matCellDef="let element">
|
<td mat-cell *matCellDef="let element">
|
||||||
<div>
|
<div>
|
||||||
@switch (element.day.isoWeekday()) {
|
@switch (element.day.weekday) {
|
||||||
@default {
|
@default {
|
||||||
<div>
|
<div>
|
||||||
<ul class="non-editable">
|
<ul class="non-editable">
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { FormControl, FormGroup } from '@angular/forms';
|
import { FormControl, FormGroup } from '@angular/forms';
|
||||||
import { MAT_DATE_RANGE_SELECTION_STRATEGY } from '@angular/material/datepicker';
|
import { MAT_DATE_RANGE_SELECTION_STRATEGY } from '@angular/material/datepicker';
|
||||||
import { Moment } from 'moment';
|
|
||||||
import { FDSelection } from 'src/app/fd.da';
|
import { FDSelection } from 'src/app/fd.da';
|
||||||
import { Menu } from 'src/app/types/menu';
|
import { Menu } from 'src/app/types/menu';
|
||||||
import { AdminCommService } from '../admin-comm.service';
|
import { AdminCommService } from '../admin-comm.service';
|
||||||
import { MatTableDataSource } from '@angular/material/table';
|
import { MatTableDataSource } from '@angular/material/table';
|
||||||
import * as moment from 'moment';
|
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { MenuUploadComponent } from './menu-upload/menu-upload.component';
|
import { MenuUploadComponent } from './menu-upload/menu-upload.component';
|
||||||
import { Status } from 'src/app/types/status';
|
import { Status } from 'src/app/types/status';
|
||||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||||
import { MenuAddComponent } from './menu-add/menu-add.component';
|
import { MenuAddComponent } from './menu-add/menu-add.component';
|
||||||
import { LocalStorageService } from 'src/app/services/local-storage.service';
|
import { LocalStorageService } from 'src/app/services/local-storage.service';
|
||||||
|
import { DateTime } from 'luxon';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-menu-new',
|
selector: 'app-menu-new',
|
||||||
@@ -27,17 +26,13 @@ export class MenuNewComponent {
|
|||||||
dcols: string[] = ['day', 'sn', 'ob', 'kol']
|
dcols: string[] = ['day', 'sn', 'ob', 'kol']
|
||||||
dataSource: MatTableDataSource<Menu> = new MatTableDataSource<Menu>()
|
dataSource: MatTableDataSource<Menu> = new MatTableDataSource<Menu>()
|
||||||
range = new FormGroup({
|
range = new FormGroup({
|
||||||
start: new FormControl<Moment|null>(null),
|
start: new FormControl<DateTime|null>(null),
|
||||||
end: new FormControl<Moment|null>(null),
|
end: new FormControl<DateTime|null>(null),
|
||||||
})
|
})
|
||||||
loading = false
|
loading = false
|
||||||
public options: any;
|
public options: any;
|
||||||
|
|
||||||
constructor (private ac: AdminCommService, private dialog: MatDialog, private sb: MatSnackBar, readonly ls: LocalStorageService) {
|
constructor (private ac: AdminCommService, private dialog: MatDialog, private sb: MatSnackBar, readonly ls: LocalStorageService) { }
|
||||||
moment.updateLocale('pl', {
|
|
||||||
weekdays: ["Niedziela", "Poniedziałek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota"]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
print() {
|
print() {
|
||||||
this.ac.menu.print(this.range.value.start, this.range.value.end)?.subscribe((r) => {
|
this.ac.menu.print(this.range.value.start, this.range.value.end)?.subscribe((r) => {
|
||||||
@@ -80,7 +75,7 @@ export class MenuNewComponent {
|
|||||||
this.dataSource.data = data.map((v) => {
|
this.dataSource.data = data.map((v) => {
|
||||||
let newMenu: Menu = {
|
let newMenu: Menu = {
|
||||||
...v,
|
...v,
|
||||||
day: moment.utc(v.day)
|
day: DateTime.fromISO(v.day)
|
||||||
}
|
}
|
||||||
return newMenu
|
return newMenu
|
||||||
})
|
})
|
||||||
@@ -117,7 +112,7 @@ export class MenuNewComponent {
|
|||||||
this.ac.menu.editTitle(id, this.dataSource.data.find(v => v._id == id)?.dayTitle).subscribe(s => this.refreshIfGood(s))
|
this.ac.menu.editTitle(id, this.dataSource.data.find(v => v._id == id)?.dayTitle).subscribe(s => this.refreshIfGood(s))
|
||||||
}
|
}
|
||||||
|
|
||||||
getStat(day: moment.Moment, m: "ob" | "kol") {
|
getStat(day: DateTime, m: "ob" | "kol") {
|
||||||
this.ac.menu.stat(day, m).subscribe((s) => this.sb.open(`${s.y} / ${s.y+s.n} = ${((s.y/(s.y+s.n))*100).toFixed(2)}%`, "Zamknij", {duration: 2500}))
|
this.ac.menu.stat(day, m).subscribe((s) => this.sb.open(`${s.y} / ${s.y+s.n} = ${((s.y/(s.y+s.n))*100).toFixed(2)}%`, "Zamknij", {duration: 2500}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<mat-card-title>
|
<mat-card-title>
|
||||||
{{item.title}}
|
{{item.title}}
|
||||||
</mat-card-title>
|
</mat-card-title>
|
||||||
<mat-card-subtitle>{{item.sentDate.format('[Wysłano] dddd DD MMMM YYYYr. o HH:mm')}}</mat-card-subtitle>
|
<mat-card-subtitle>Wysłano {{item.sentDate.toFormat("cccc dd LLLL yyyyr. 'o' HH:mm")}}</mat-card-subtitle>
|
||||||
</mat-card-title-group>
|
</mat-card-title-group>
|
||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { MessageComponent } from './message.component';
|
import { MessageComponent } from './message.component';
|
||||||
import { AdminCommService } from 'src/app/admin-view/admin-comm.service';
|
import { AdminCommService } from 'src/app/admin-view/admin-comm.service';
|
||||||
import { MatCardModule } from '@angular/material/card';
|
import { MatCardModule } from '@angular/material/card';
|
||||||
import moment from 'moment';
|
import { DateTime } from 'luxon';
|
||||||
|
|
||||||
describe('MessageComponent', () => {
|
describe('MessageComponent', () => {
|
||||||
let component: MessageComponent;
|
let component: MessageComponent;
|
||||||
@@ -26,7 +25,7 @@ describe('MessageComponent', () => {
|
|||||||
|
|
||||||
fixture = TestBed.createComponent(MessageComponent);
|
fixture = TestBed.createComponent(MessageComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
component.item = {_id: "test", sentDate: moment(), title: "Test"}
|
component.item = {_id: "test", sentDate: DateTime.now(), title: "Test"}
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
|
import { DateTime } from 'luxon';
|
||||||
import { AdminCommService } from 'src/app/admin-view/admin-comm.service';
|
import { AdminCommService } from 'src/app/admin-view/admin-comm.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -8,7 +9,7 @@ import { AdminCommService } from 'src/app/admin-view/admin-comm.service';
|
|||||||
standalone: false
|
standalone: false
|
||||||
})
|
})
|
||||||
export class MessageComponent {
|
export class MessageComponent {
|
||||||
@Input() item!: {_id: string, sentDate: moment.Moment, title: string}
|
@Input() item!: {_id: string, sentDate: DateTime, title: string}
|
||||||
body?: string
|
body?: string
|
||||||
rcpts?: {_id: string, uname: string, room?: string, fname?: string, surname?: string}[]
|
rcpts?: {_id: string, uname: string, room?: string, fname?: string, surname?: string}[]
|
||||||
loading: boolean = false
|
loading: boolean = false
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
import { AdminCommService } from '../../admin-comm.service';
|
import { AdminCommService } from '../../admin-comm.service';
|
||||||
import { Router, ActivatedRoute } from '@angular/router';
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
import { ToolbarService } from '../../toolbar/toolbar.service';
|
import { ToolbarService } from '../../toolbar/toolbar.service';
|
||||||
import moment from 'moment';
|
import { DateTime } from 'luxon';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-outbox',
|
selector: 'app-outbox',
|
||||||
@@ -14,7 +14,7 @@ export class OutboxComponent implements OnInit {
|
|||||||
|
|
||||||
messages!: {
|
messages!: {
|
||||||
_id: string;
|
_id: string;
|
||||||
sentDate: moment.Moment;
|
sentDate: DateTime;
|
||||||
title: string;
|
title: string;
|
||||||
}[]
|
}[]
|
||||||
|
|
||||||
@@ -31,12 +31,7 @@ export class OutboxComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.acs.notif.outbox.getSent().subscribe((v) => {
|
this.acs.notif.outbox.getSent().subscribe((v) => {
|
||||||
this.messages = v.map(i => {
|
this.messages = v
|
||||||
return {
|
|
||||||
...i,
|
|
||||||
sentDate: moment(i.sentDate)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { UpdatesService } from '../../services/updates.service';
|
import { UpdatesService } from '../../services/updates.service';
|
||||||
import { Menu } from '../../types/menu';
|
import { Menu } from '../../types/menu';
|
||||||
import * as moment from 'moment';
|
|
||||||
import { MatBottomSheet } from '@angular/material/bottom-sheet';
|
import { MatBottomSheet } from '@angular/material/bottom-sheet';
|
||||||
import { AllergensComponent } from './allergens/allergens.component';
|
import { AllergensComponent } from './allergens/allergens.component';
|
||||||
import { weekendFilter } from "../../fd.da";
|
import { weekendFilter } from "../../fd.da";
|
||||||
import { LocalStorageService } from 'src/app/services/local-storage.service';
|
import { LocalStorageService } from 'src/app/services/local-storage.service';
|
||||||
|
import { DateTime } from 'luxon';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-menu',
|
selector: 'app-menu',
|
||||||
@@ -14,31 +14,29 @@ import { LocalStorageService } from 'src/app/services/local-storage.service';
|
|||||||
standalone: false
|
standalone: false
|
||||||
})
|
})
|
||||||
export class MenuComponent {
|
export class MenuComponent {
|
||||||
constructor(private uc:UpdatesService, readonly bs: MatBottomSheet, readonly ls: LocalStorageService) {
|
constructor(private uc: UpdatesService, readonly bs: MatBottomSheet, readonly ls: LocalStorageService) {
|
||||||
this.day = moment.utc()
|
this._day = DateTime.now().toISODate()
|
||||||
}
|
}
|
||||||
loading = true
|
loading = true
|
||||||
|
|
||||||
public filter = weekendFilter
|
public filter = weekendFilter
|
||||||
|
|
||||||
private _day!: moment.Moment;
|
private _day: string;
|
||||||
public get day(): moment.Moment {
|
public get day(): string {
|
||||||
return this._day;
|
return this._day;
|
||||||
}
|
}
|
||||||
public set day(value: moment.Moment) {
|
public set day(value: string) {
|
||||||
// if (value.isAfter(moment.utc("19:15:00", "HH:mm:ss"))) value.add(1, "day")
|
this._day = value;
|
||||||
if (!this.filter(value)) value.isoWeekday(8);
|
|
||||||
this._day = moment.utc(value).startOf('day');
|
|
||||||
this.updateMenu()
|
this.updateMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
menu?: Menu;
|
menu?: Menu;
|
||||||
get getsn() {return (this.menu && this.checkIfAnyProperty(this.menu.sn)) ? this.menu.sn : null}
|
get getsn() { return (this.menu && this.checkIfAnyProperty(this.menu.sn)) ? this.menu.sn : null }
|
||||||
get getob() {return (this.menu && this.checkIfAnyProperty(this.menu.ob)) ? this.menu.ob : null}
|
get getob() { return (this.menu && this.checkIfAnyProperty(this.menu.ob)) ? this.menu.ob : null }
|
||||||
get getkol() {return (this.menu && this.menu.kol) ? this.menu.kol : null}
|
get getkol() { return (this.menu && this.menu.kol) ? this.menu.kol : null }
|
||||||
get gettitle() {return (this.menu && this.menu.dayTitle && this.menu.dayTitle != "") ? this.menu.dayTitle : null}
|
get gettitle() { return (this.menu && this.menu.dayTitle && this.menu.dayTitle != "") ? this.menu.dayTitle : null }
|
||||||
|
|
||||||
private checkIfAnyProperty(obj: { [x: string]: string | string[];}) {
|
private checkIfAnyProperty(obj: { [x: string]: string | string[]; }) {
|
||||||
for (let i in obj) {
|
for (let i in obj) {
|
||||||
if (Array.isArray(obj[i])) {
|
if (Array.isArray(obj[i])) {
|
||||||
if (obj[i].length > 0) return true
|
if (obj[i].length > 0) return true
|
||||||
@@ -50,7 +48,7 @@ export class MenuComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
capitalize(str: string) {
|
capitalize(str: string) {
|
||||||
return str.charAt(0).toUpperCase()+str.substring(1)
|
return str.charAt(0).toUpperCase() + str.substring(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
updateMenu(silent?: boolean) {
|
updateMenu(silent?: boolean) {
|
||||||
@@ -60,7 +58,6 @@ export class MenuComponent {
|
|||||||
this.loading = false
|
this.loading = false
|
||||||
this.menu = m
|
this.menu = m
|
||||||
console.log(m);
|
console.log(m);
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +73,7 @@ export class MenuComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
vote(type: "ob" | "kol", vote: "-" | "+" | "n") {
|
vote(type: "ob" | "kol", vote: "-" | "+" | "n") {
|
||||||
this.uc.postVote(this.menu!.day, type, vote).subscribe((data) => {
|
this.uc.postVote(this.menu!.day.toISO()!, type, vote).subscribe((data) => {
|
||||||
this.updateMenu(true)
|
this.updateMenu(true)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<p>
|
<p>
|
||||||
{{data.message.body}}
|
{{data.message.body}}
|
||||||
</p>
|
</p>
|
||||||
<div>{{data.sentDate.format("[Wysłano] dddd DD MMMM YYYYr. o HH:mm")}}</div>
|
<div>{{date.toFormat("[Wysłano] dddd DD MMMM YYYYr. o HH:mm")}}</div>
|
||||||
</mat-dialog-content>
|
</mat-dialog-content>
|
||||||
<mat-dialog-actions align="end">
|
<mat-dialog-actions align="end">
|
||||||
<button mat-raised-button color="primary" (click)="ack()">Odczytano</button>
|
<button mat-raised-button color="primary" (click)="ack()">Odczytano</button>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Component, Inject } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||||
import moment from 'moment';
|
import { DateTime } from 'luxon';
|
||||||
import { UpdatesService } from 'src/app/services/updates.service';
|
import { UpdatesService } from 'src/app/services/updates.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -11,12 +11,14 @@ import { UpdatesService } from 'src/app/services/updates.service';
|
|||||||
})
|
})
|
||||||
export class NotifDialogComponent {
|
export class NotifDialogComponent {
|
||||||
|
|
||||||
|
date: DateTime
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
@Inject(MAT_DIALOG_DATA) public data: {_id: string, message: {title: string, body: string}, sentDate: moment.Moment},
|
@Inject(MAT_DIALOG_DATA) public data: {_id: string, message: {title: string, body: string}, sentDate: string},
|
||||||
public dialogRef: MatDialogRef<NotifDialogComponent>,
|
public dialogRef: MatDialogRef<NotifDialogComponent>,
|
||||||
private uc: UpdatesService
|
private uc: UpdatesService
|
||||||
) {
|
) {
|
||||||
data.sentDate = moment(data.sentDate)
|
this.date = DateTime.fromISO(data.sentDate)
|
||||||
}
|
}
|
||||||
|
|
||||||
ack () {
|
ack () {
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ import { MatIconModule } from '@angular/material/icon';
|
|||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
import { MatDatepicker } from '@angular/material/datepicker';
|
import { MatDatepicker } from '@angular/material/datepicker';
|
||||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||||
import * as moment from 'moment';
|
import { DateTime } from 'luxon';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-date-selector", template: '',
|
selector: "app-date-selector", template: '',
|
||||||
standalone: false
|
standalone: false
|
||||||
})
|
})
|
||||||
class DateSelectorStub {
|
class DateSelectorStub {
|
||||||
@Input() date: moment.Moment = moment.utc().startOf('day');
|
@Input() date: string = DateTime.now().toISODate();
|
||||||
@Output() dateChange = new EventEmitter<moment.Moment>();
|
@Output() dateChange = new EventEmitter<moment.Moment>();
|
||||||
@Input() filter: (date: moment.Moment | null) => boolean = () => true
|
@Input() filter: (date: moment.Moment | null) => boolean = () => true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import moment from 'moment';
|
import { DateTime } from 'luxon';
|
||||||
import { weekendFilter } from 'src/app/fd.da';
|
import { weekendFilter } from 'src/app/fd.da';
|
||||||
import { UpdatesService } from 'src/app/services/updates.service';
|
import { UpdatesService } from 'src/app/services/updates.service';
|
||||||
import { CleanNote } from 'src/app/types/clean-note';
|
import { CleanNote } from 'src/app/types/clean-note';
|
||||||
@@ -11,22 +11,14 @@ import { CleanNote } from 'src/app/types/clean-note';
|
|||||||
standalone: false
|
standalone: false
|
||||||
})
|
})
|
||||||
export class CleanComponent implements OnInit {
|
export class CleanComponent implements OnInit {
|
||||||
private _day: moment.Moment = moment()
|
protected day: string
|
||||||
public get day(): moment.Moment {
|
|
||||||
return this._day;
|
|
||||||
}
|
|
||||||
public set day(value: moment.Moment) {
|
|
||||||
if (!this.filter(value)) value.isoWeekday(5);
|
|
||||||
this._day = moment.utc(value).startOf('day');
|
|
||||||
this.update()
|
|
||||||
}
|
|
||||||
grade: number | null = null
|
grade: number | null = null
|
||||||
notes: CleanNote[] = []
|
notes: CleanNote[] = []
|
||||||
tips: string = ""
|
tips: string = ""
|
||||||
filter = weekendFilter
|
filter = weekendFilter
|
||||||
|
|
||||||
constructor (private updates: UpdatesService) {
|
constructor (private updates: UpdatesService) {
|
||||||
this.day = moment.utc();
|
this.day = DateTime.now().toISODate()
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component, Inject, LOCALE_ID } from '@angular/core';
|
||||||
import { AppUpdateService } from './services/app-update.service';
|
import { AppUpdateService } from './services/app-update.service';
|
||||||
import { MatIconRegistry } from '@angular/material/icon';
|
import { MatIconRegistry } from '@angular/material/icon';
|
||||||
import * as moment from 'moment';
|
import { Settings } from 'luxon';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
@@ -10,12 +10,9 @@ import * as moment from 'moment';
|
|||||||
standalone: false
|
standalone: false
|
||||||
})
|
})
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
constructor (readonly updates: AppUpdateService, mir: MatIconRegistry) {
|
constructor (readonly updates: AppUpdateService, mir: MatIconRegistry, @Inject(LOCALE_ID) lang: string) {
|
||||||
mir.setDefaultFontSetClass("material-symbols-rounded")
|
mir.setDefaultFontSetClass("material-symbols-rounded")
|
||||||
moment.updateLocale('pl', {
|
Settings.defaultLocale = lang
|
||||||
weekdays: ["Niedziela", "Poniedziałek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota"]
|
|
||||||
})
|
|
||||||
moment.locale('pl')
|
|
||||||
}
|
}
|
||||||
title = 'Internat';
|
title = 'Internat';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,8 @@ import { BrowserModule } from '@angular/platform-browser';
|
|||||||
|
|
||||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
import { MAT_MOMENT_DATE_ADAPTER_OPTIONS, MAT_MOMENT_DATE_FORMATS, MomentDateAdapter } from '@angular/material-moment-adapter';
|
|
||||||
import { MatButtonModule } from "@angular/material/button";
|
import { MatButtonModule } from "@angular/material/button";
|
||||||
import { MatCardModule } from "@angular/material/card";
|
import { MatCardModule } from "@angular/material/card";
|
||||||
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE, MatNativeDateModule } from '@angular/material/core';
|
|
||||||
import { MatDatepickerModule } from "@angular/material/datepicker";
|
import { MatDatepickerModule } from "@angular/material/datepicker";
|
||||||
import { MatDialogModule } from '@angular/material/dialog';
|
import { MatDialogModule } from '@angular/material/dialog';
|
||||||
import { MatIconModule } from "@angular/material/icon";
|
import { MatIconModule } from "@angular/material/icon";
|
||||||
@@ -87,6 +85,7 @@ import { MessageComponent } from './admin-view/notifications/outbox/message/mess
|
|||||||
import { NotifDialogComponent } from './app-view/notif-dialog/notif-dialog.component';
|
import { NotifDialogComponent } from './app-view/notif-dialog/notif-dialog.component';
|
||||||
import { UserSearchComponent } from './commonComponents/user-search/user-search.component';
|
import { UserSearchComponent } from './commonComponents/user-search/user-search.component';
|
||||||
import { StartAdminComponent } from './admin-view/start/start.component';
|
import { StartAdminComponent } from './admin-view/start/start.component';
|
||||||
|
import { provideLuxonDateAdapter } from "@angular/material-luxon-adapter";
|
||||||
|
|
||||||
@NgModule({ declarations: [
|
@NgModule({ declarations: [
|
||||||
AppComponent,
|
AppComponent,
|
||||||
@@ -138,7 +137,9 @@ import { StartAdminComponent } from './admin-view/start/start.component';
|
|||||||
UserSearchComponent,
|
UserSearchComponent,
|
||||||
StartAdminComponent,
|
StartAdminComponent,
|
||||||
],
|
],
|
||||||
bootstrap: [AppComponent], imports: [BrowserModule,
|
bootstrap: [AppComponent],
|
||||||
|
imports: [
|
||||||
|
BrowserModule,
|
||||||
AppRoutingModule,
|
AppRoutingModule,
|
||||||
BrowserAnimationsModule,
|
BrowserAnimationsModule,
|
||||||
MatTabsModule,
|
MatTabsModule,
|
||||||
@@ -146,7 +147,6 @@ import { StartAdminComponent } from './admin-view/start/start.component';
|
|||||||
MatButtonModule,
|
MatButtonModule,
|
||||||
MatIconModule,
|
MatIconModule,
|
||||||
MatDatepickerModule,
|
MatDatepickerModule,
|
||||||
MatNativeDateModule,
|
|
||||||
MatInputModule,
|
MatInputModule,
|
||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
@@ -179,10 +179,7 @@ import { StartAdminComponent } from './admin-view/start/start.component';
|
|||||||
// or after 30 seconds (whichever comes first).
|
// or after 30 seconds (whichever comes first).
|
||||||
registrationStrategy: 'registerWhenStable:30000'
|
registrationStrategy: 'registerWhenStable:30000'
|
||||||
})], providers: [
|
})], providers: [
|
||||||
{ provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE, MAT_DATE_FORMATS, MAT_MOMENT_DATE_ADAPTER_OPTIONS] },
|
provideLuxonDateAdapter(),
|
||||||
{ provide: MAT_DATE_LOCALE, useValue: "pl-PL" },
|
|
||||||
{ provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS },
|
|
||||||
{ provide: MAT_MOMENT_DATE_ADAPTER_OPTIONS, useValue: { useUtc: true } },
|
|
||||||
FDSelection,
|
FDSelection,
|
||||||
provideHttpClient(withInterceptorsFromDi()),
|
provideHttpClient(withInterceptorsFromDi()),
|
||||||
] })
|
] })
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<button mat-icon-button (click)="prevDay()"><mat-icon>chevron_left</mat-icon></button>
|
<button mat-icon-button (click)="prevDay()"><mat-icon>chevron_left</mat-icon></button>
|
||||||
<p (click)="picker.open()">{{date.format('dddd, D.MM')}}</p>
|
<p (click)="picker.open()">{{_date_1.toFormat('cccc, d.LL') | titlecase }}</p>
|
||||||
<mat-form-field style="display: none;">
|
<mat-form-field style="display: none;">
|
||||||
<input #dateinput matInput [matDatepicker]="picker" [formControl]="dateInput" [matDatepickerFilter]="filter">
|
<input #dateinput matInput [matDatepicker]="picker" [formControl]="dateInput" [matDatepickerFilter]="filter">
|
||||||
<mat-datepicker touchUi #picker></mat-datepicker>
|
<mat-datepicker touchUi #picker></mat-datepicker>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
|
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
|
||||||
import { FormControl } from '@angular/forms';
|
import { FormControl } from '@angular/forms';
|
||||||
import moment from 'moment';
|
import { DateFilterFn } from '@angular/material/datepicker';
|
||||||
|
import { DateTime } from 'luxon';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-date-selector',
|
selector: 'app-date-selector',
|
||||||
@@ -9,40 +10,47 @@ import moment from 'moment';
|
|||||||
standalone: false
|
standalone: false
|
||||||
})
|
})
|
||||||
export class DateSelectorComponent implements OnChanges {
|
export class DateSelectorComponent implements OnChanges {
|
||||||
@Input() date: moment.Moment = moment.utc().startOf('day');
|
protected _date_1: DateTime = DateTime.now();
|
||||||
@Output() dateChange = new EventEmitter<moment.Moment>();
|
protected set _date(value: DateTime) {
|
||||||
@Input() filter: (date: moment.Moment | null) => boolean = () => true
|
this._date_1 = value;
|
||||||
protected dateInput: FormControl<moment.Moment>
|
this.date = value.toISODate()!
|
||||||
|
}
|
||||||
|
@Input()
|
||||||
|
public set date(value: string) {
|
||||||
|
this._date_1 = DateTime.fromISO(value);
|
||||||
|
}
|
||||||
|
@Output() dateChange = new EventEmitter<string>();
|
||||||
|
@Input() filter: DateFilterFn<DateTime | null> = () => true
|
||||||
|
protected dateInput: FormControl<DateTime>
|
||||||
|
|
||||||
constructor () {
|
constructor () {
|
||||||
this.dateInput = new FormControl(this.date, {nonNullable: true});
|
this.dateInput = new FormControl(this._date_1, {nonNullable: true});
|
||||||
this.dateInput.valueChanges.subscribe((v) => {
|
this.dateInput.valueChanges.subscribe((v) => {
|
||||||
v.utc(true).startOf('day')
|
this.dateChange.emit(v.toISODate()!)
|
||||||
this.dateChange.emit(v)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges): void {
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
if (changes['date']) {
|
if (changes['date']) {
|
||||||
this.dateInput.setValue(this.date, {emitEvent: false})
|
this.dateInput.setValue(this._date_1), {emitEvent: false}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
prevDay(): void {
|
prevDay(): void {
|
||||||
let newDay = moment(this.date);
|
let yesterday = this._date_1.minus({day: 1})
|
||||||
if (this.filter(newDay.add({days: -1}))) {
|
if (this.filter(yesterday)) {
|
||||||
this.dateInput.setValue(this.date.add({days: -1}))
|
this.dateInput.setValue(yesterday)
|
||||||
} else {
|
} else {
|
||||||
this.dateInput.setValue(this.date.isoWeekday(-2))
|
this.dateInput.setValue(this._date.set({weekday: 5}).minus({week: 1}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nextDay(): void {
|
nextDay(): void {
|
||||||
let newDay = moment(this.date);
|
let tomorrow = this._date_1.plus({day: 1})
|
||||||
if (this.filter(newDay.add({days: 1}))) {
|
if (this.filter(tomorrow)) {
|
||||||
this.dateInput.setValue(this.date.add({days: 1}))
|
this.dateInput.setValue(tomorrow)
|
||||||
} else {
|
} else {
|
||||||
this.dateInput.setValue(this.date.isoWeekday(8))
|
this.dateInput.setValue(this._date.set({weekday: 1}).plus({week: 1}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,28 @@
|
|||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
import { DateRange, MatDateRangeSelectionStrategy } from "@angular/material/datepicker";
|
import { DateFilterFn, DateRange, MatDateRangeSelectionStrategy } from "@angular/material/datepicker";
|
||||||
import moment from "moment";
|
import { DateTime } from "luxon";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class FDSelection implements MatDateRangeSelectionStrategy<moment.Moment> {
|
export class FDSelection implements MatDateRangeSelectionStrategy<DateTime> {
|
||||||
selectionFinished(date: moment.Moment | null): DateRange<moment.Moment> {
|
selectionFinished(date: DateTime | null): DateRange<DateTime> {
|
||||||
return this._cr(date)
|
return this._cr(date)
|
||||||
}
|
}
|
||||||
createPreview(activeDate: moment.Moment | null): DateRange<moment.Moment> {
|
createPreview(activeDate: DateTime | null): DateRange<DateTime> {
|
||||||
return this._cr(activeDate)
|
return this._cr(activeDate)
|
||||||
}
|
}
|
||||||
|
|
||||||
private _cr(date: moment.Moment | null) {
|
private _cr(date: DateTime | null) {
|
||||||
if (date) {
|
if (date) {
|
||||||
const start = moment(date).startOf('week')
|
const start = date.toUTC().startOf('week')
|
||||||
const end = moment(date).isoWeekday(5).endOf('day')
|
const end = date.toUTC().set({weekday: 5}).endOf('day')
|
||||||
return new DateRange<moment.Moment>(start, end)
|
return new DateRange<DateTime>(start, end)
|
||||||
}
|
}
|
||||||
return new DateRange<moment.Moment>(null, null)
|
return new DateRange<DateTime>(null, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const weekendFilter = (date: moment.Moment | null): boolean => {
|
export const weekendFilter: DateFilterFn<DateTime | null> = (date: DateTime | null): boolean => {
|
||||||
const day = date?.isoWeekday()
|
const day = date?.weekday
|
||||||
return day !== 6 && day !== 7
|
return day !== 6 && day !== 7
|
||||||
}
|
}
|
||||||
@@ -3,11 +3,10 @@ import { HttpClient } from '@angular/common/http'
|
|||||||
import { Menu } from '../types/menu';
|
import { Menu } from '../types/menu';
|
||||||
import { environment } from 'src/environments/environment';
|
import { environment } from 'src/environments/environment';
|
||||||
import { News } from '../types/news';
|
import { News } from '../types/news';
|
||||||
import moment from 'moment';
|
|
||||||
import { map } from 'rxjs';
|
|
||||||
import { UKey } from '../types/key';
|
import { UKey } from '../types/key';
|
||||||
import { CleanNote } from '../types/clean-note';
|
import { CleanNote } from '../types/clean-note';
|
||||||
import { Status } from '../types/status';
|
import { Status } from '../types/status';
|
||||||
|
import { DateTime } from 'luxon';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -27,16 +26,16 @@ export class UpdatesService {
|
|||||||
return this.http.get<{ hash: string; count: number; }>(environment.apiEndpoint+`/app/news/check`, {withCredentials: true})
|
return this.http.get<{ hash: string; count: number; }>(environment.apiEndpoint+`/app/news/check`, {withCredentials: true})
|
||||||
}
|
}
|
||||||
|
|
||||||
getMenu(dom: moment.Moment) {
|
getMenu(dom: string) {
|
||||||
const headers = {
|
const headers = {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
}
|
}
|
||||||
return this.http.get<Menu>(environment.apiEndpoint+`/app/menu/${dom.valueOf()}`, {headers: headers, withCredentials: true})
|
return this.http.get<Menu>(environment.apiEndpoint+`/app/menu/${dom}`, {headers: headers, withCredentials: true})
|
||||||
}
|
}
|
||||||
|
|
||||||
postVote(date: moment.Moment, type: "ob" | "kol", vote: "-" | "+" | "n") {
|
postVote(date: string, type: "ob" | "kol", vote: "-" | "+" | "n") {
|
||||||
return this.http.post(environment.apiEndpoint+`/app/menu/${date.valueOf()}`, {
|
return this.http.post(environment.apiEndpoint+`/app/menu/${date}`, {
|
||||||
doc: moment().toISOString(true),
|
doc: DateTime.now(),
|
||||||
tom: type,
|
tom: type,
|
||||||
vote: vote
|
vote: vote
|
||||||
}, {withCredentials: true})
|
}, {withCredentials: true})
|
||||||
@@ -53,12 +52,12 @@ export class UpdatesService {
|
|||||||
return this.http.get<UKey[]>(environment.apiEndpoint+`/app/keys`, {withCredentials: true})
|
return this.http.get<UKey[]>(environment.apiEndpoint+`/app/keys`, {withCredentials: true})
|
||||||
}
|
}
|
||||||
|
|
||||||
getClean(date: moment.Moment) {
|
getClean(date: string) {
|
||||||
return this.http.get<{grade: number, notes: CleanNote[], tips: string}>(environment.apiEndpoint+`/app/clean/${date.toISOString()}`, {withCredentials: true})
|
return this.http.get<{grade: number, notes: CleanNote[], tips: string}>(environment.apiEndpoint+`/app/clean/${date}`, {withCredentials: true})
|
||||||
}
|
}
|
||||||
|
|
||||||
getNotifCheck() {
|
getNotifCheck() {
|
||||||
return this.http.get<{_id: string, message: {title: string, body: string}, sentDate: moment.Moment}[]>(environment.apiEndpoint+`/app/notif/check`, {withCredentials: true})
|
return this.http.get<{_id: string, message: {title: string, body: string}, sentDate: string}[]>(environment.apiEndpoint+`/app/notif/check`, {withCredentials: true})
|
||||||
}
|
}
|
||||||
|
|
||||||
postInfoAck(id: string) {
|
postInfoAck(id: string) {
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { DateTime } from "luxon";
|
||||||
|
|
||||||
interface UKey {
|
interface UKey {
|
||||||
room: string;
|
room: string;
|
||||||
taken: boolean;
|
taken: boolean;
|
||||||
@@ -6,8 +8,8 @@ interface UKey {
|
|||||||
interface AKey {
|
interface AKey {
|
||||||
room: string;
|
room: string;
|
||||||
whom?: {_id: string, uname: string, room: string};
|
whom?: {_id: string, uname: string, room: string};
|
||||||
borrow?: moment.Moment;
|
borrow: DateTime;
|
||||||
tb?: moment.Moment;
|
tb?: DateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
export { UKey, AKey }
|
export { UKey, AKey }
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import { Moment } from "moment";
|
import { DateTime } from "luxon";
|
||||||
|
|
||||||
export interface Menu {
|
export interface Menu {
|
||||||
_id: string;
|
_id: string;
|
||||||
day: Moment;
|
day: DateTime;
|
||||||
sn: {
|
sn: {
|
||||||
fancy: string[];
|
fancy: string[];
|
||||||
second: string;
|
second: string;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Moment } from "moment";
|
import { DateTime } from "luxon";
|
||||||
|
|
||||||
export default interface User {
|
export default interface User {
|
||||||
_id: string;
|
_id: string;
|
||||||
@@ -10,6 +10,6 @@ export default interface User {
|
|||||||
fname?: string;
|
fname?: string;
|
||||||
surname?: string;
|
surname?: string;
|
||||||
groups: string[];
|
groups: string[];
|
||||||
regDate: Moment;
|
regDate: DateTime;
|
||||||
defaultPage?: string;
|
defaultPage?: string;
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
export const environment = {
|
export const environment = {
|
||||||
apiEndpoint: "http://localhost:12230",
|
apiEndpoint: `http://${window.location.hostname}:12230`,
|
||||||
version: "testing",
|
version: "testing",
|
||||||
production: false
|
production: false
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,7 +3,9 @@
|
|||||||
"extends": "./tsconfig.json",
|
"extends": "./tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./out-tsc/app",
|
"outDir": "./out-tsc/app",
|
||||||
"types": []
|
"types": [
|
||||||
|
"@angular/localize"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"src/main.ts"
|
"src/main.ts"
|
||||||
|
|||||||
Reference in New Issue
Block a user