Update requests after api changes

This commit is contained in:
adam-skowronek 2022-11-16 22:23:40 +01:00
parent b881d5a056
commit 76218a92ca
17 changed files with 440 additions and 97 deletions

View File

@ -21,6 +21,7 @@
"luxon": "^3.0.4", "luxon": "^3.0.4",
"react": "^18.1.0", "react": "^18.1.0",
"react-big-calendar": "^1.5.0", "react-big-calendar": "^1.5.0",
"react-date-picker": "^9.1.0",
"react-dom": "^18.1.0", "react-dom": "^18.1.0",
"react-hook-form": "^7.31.3", "react-hook-form": "^7.31.3",
"react-modal": "^3.16.1", "react-modal": "^3.16.1",
@ -29,6 +30,7 @@
"react-scripts": "5.0.1", "react-scripts": "5.0.1",
"react-select": "^5.3.2", "react-select": "^5.3.2",
"typescript": "^4.6.4", "typescript": "^4.6.4",
"use-local-storage-state": "^18.1.1",
"web-vitals": "^2.1.4" "web-vitals": "^2.1.4"
}, },
"devDependencies": { "devDependencies": {
@ -3887,6 +3889,14 @@
"@types/react": "*" "@types/react": "*"
} }
}, },
"node_modules/@types/react-calendar": {
"version": "3.9.0",
"resolved": "https://registry.npmjs.org/@types/react-calendar/-/react-calendar-3.9.0.tgz",
"integrity": "sha512-KpAu1MKAGFw5hNwlDnWsHWqI9i/igAB+8jH97YV7QpC2v7rlwNEU5i6VMFb73lGRacuejM/Zd2LklnEzkFV3XA==",
"dependencies": {
"@types/react": "*"
}
},
"node_modules/@types/react-dom": { "node_modules/@types/react-dom": {
"version": "18.0.4", "version": "18.0.4",
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.0.4.tgz", "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.0.4.tgz",
@ -4344,6 +4354,14 @@
"@xtuc/long": "4.2.2" "@xtuc/long": "4.2.2"
} }
}, },
"node_modules/@wojtekmaj/date-utils": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@wojtekmaj/date-utils/-/date-utils-1.0.3.tgz",
"integrity": "sha512-1VPkkTBk07gMR1fjpBtse4G+oJqpmE+0gUFB0dg3VIL7qJmUVaBoD/vlzMm/jNeOPfvlmerl1lpnsZyBUFIRuw==",
"funding": {
"url": "https://github.com/wojtekmaj/date-utils?sponsor=1"
}
},
"node_modules/@xtuc/ieee754": { "node_modules/@xtuc/ieee754": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
@ -6411,6 +6429,11 @@
"npm": "1.2.8000 || >= 1.4.16" "npm": "1.2.8000 || >= 1.4.16"
} }
}, },
"node_modules/detect-element-overflow": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/detect-element-overflow/-/detect-element-overflow-1.2.0.tgz",
"integrity": "sha512-Jtr9ivYPhpd9OJux+hjL0QjUKiS1Ghgy8tvIufUjFslQgIWvgGr4mn57H190APbKkiOmXnmtMI6ytaKzMusecg=="
},
"node_modules/detect-newline": { "node_modules/detect-newline": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz",
@ -8261,6 +8284,17 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/get-user-locale": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/get-user-locale/-/get-user-locale-1.5.1.tgz",
"integrity": "sha512-WiNpoFRcHn1qxP9VabQljzGwkAQDrcpqUtaP0rNBEkFxJdh4f3tik6MfZsMYZc+UgQJdGCxWEjL9wnCUlRQXag==",
"dependencies": {
"lodash.memoize": "^4.1.1"
},
"funding": {
"url": "https://github.com/wojtekmaj/get-user-locale?sponsor=1"
}
},
"node_modules/glob": { "node_modules/glob": {
"version": "7.2.3", "version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
@ -11577,6 +11611,14 @@
"semver": "bin/semver.js" "semver": "bin/semver.js"
} }
}, },
"node_modules/make-event-props": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/make-event-props/-/make-event-props-1.3.0.tgz",
"integrity": "sha512-oWiDZMcVB1/A487251hEWza1xzgCzl6MXxe9aF24l5Bt9N9UEbqTqKumEfuuLhmlhRZYnc+suVvW4vUs8bwO7Q==",
"funding": {
"url": "https://github.com/wojtekmaj/make-event-props?sponsor=1"
}
},
"node_modules/makeerror": { "node_modules/makeerror": {
"version": "1.0.12", "version": "1.0.12",
"resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz",
@ -13854,6 +13896,47 @@
"resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-6.0.0.tgz", "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-6.0.0.tgz",
"integrity": "sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw==" "integrity": "sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw=="
}, },
"node_modules/react-calendar": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/react-calendar/-/react-calendar-4.0.0.tgz",
"integrity": "sha512-y9Q5Oo3Mq869KExbOCP3aJ3hEnRZKZ0TqUa9QU1wJGgDZFrW1qTaWp5v52oZpmxTTrpAMTUcUGaC0QJcO1f8Nw==",
"dependencies": {
"@wojtekmaj/date-utils": "^1.0.2",
"clsx": "^1.2.1",
"get-user-locale": "^1.2.0",
"prop-types": "^15.6.0"
},
"funding": {
"url": "https://github.com/wojtekmaj/react-calendar?sponsor=1"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
}
},
"node_modules/react-date-picker": {
"version": "9.1.0",
"resolved": "https://registry.npmjs.org/react-date-picker/-/react-date-picker-9.1.0.tgz",
"integrity": "sha512-wj9SoOhEgQTzJsDRLePpNzUDNrcSiCpj1TFSwiAnLlOuJvvkk10I9rdvIyHmeJg/G17hyP5wSwTppCZHqOTHhA==",
"dependencies": {
"@types/react-calendar": "^3.0.0",
"@wojtekmaj/date-utils": "^1.0.3",
"clsx": "^1.2.1",
"get-user-locale": "^1.2.0",
"make-event-props": "^1.1.0",
"prop-types": "^15.6.0",
"react-calendar": "^4.0.0",
"react-fit": "^1.4.0",
"update-input-width": "^1.2.2"
},
"funding": {
"url": "https://github.com/wojtekmaj/react-date-picker?sponsor=1"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
}
},
"node_modules/react-dev-utils": { "node_modules/react-dev-utils": {
"version": "12.0.1", "version": "12.0.1",
"resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.0.1.tgz", "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.0.1.tgz",
@ -13988,6 +14071,23 @@
"resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.11.tgz", "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.11.tgz",
"integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==" "integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg=="
}, },
"node_modules/react-fit": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/react-fit/-/react-fit-1.4.0.tgz",
"integrity": "sha512-cf9sFKbr1rlTB9fNIKE5Uy4NCMUOqrX2mdJ69V4RtmV4KubPdtnbIP1tEar16GXaToCRr7I7c9d2wkTNk9TV5g==",
"dependencies": {
"detect-element-overflow": "^1.2.0",
"prop-types": "^15.6.0",
"tiny-warning": "^1.0.0"
},
"funding": {
"url": "https://github.com/wojtekmaj/react-fit?sponsor=1"
},
"peerDependencies": {
"react": "^15.5.0 || ^16.0.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^15.5.0 || ^16.0.0 || ^17.0.0 || ^18.0.0"
}
},
"node_modules/react-hook-form": { "node_modules/react-hook-form": {
"version": "7.31.3", "version": "7.31.3",
"resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.31.3.tgz", "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.31.3.tgz",
@ -15700,6 +15800,11 @@
"resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz", "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz",
"integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==" "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA=="
}, },
"node_modules/tiny-warning": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz",
"integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA=="
},
"node_modules/tmpl": { "node_modules/tmpl": {
"version": "1.0.5", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",
@ -15999,6 +16104,14 @@
"yarn": "*" "yarn": "*"
} }
}, },
"node_modules/update-input-width": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/update-input-width/-/update-input-width-1.2.2.tgz",
"integrity": "sha512-6QwD9ZVSXb96PxOZ01DU0DJTPwQGY7qBYgdniZKJN02Xzom2m+9J6EPxMbefskqtj4x78qbe5psDSALq9iNEYg==",
"funding": {
"url": "https://github.com/wojtekmaj/update-input-width?sponsor=1"
}
},
"node_modules/uri-js": { "node_modules/uri-js": {
"version": "4.4.1", "version": "4.4.1",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
@ -16007,6 +16120,21 @@
"punycode": "^2.1.0" "punycode": "^2.1.0"
} }
}, },
"node_modules/use-local-storage-state": {
"version": "18.1.1",
"resolved": "https://registry.npmjs.org/use-local-storage-state/-/use-local-storage-state-18.1.1.tgz",
"integrity": "sha512-09bl6q3mkSlkEt8KeBPCmdPEWEojWYF70Qbz+7wkfQX1feaFITM9m84+h0Jr6Cnf/IvpahkFh7UbX2VNN3ioTQ==",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/astoilkov"
},
"peerDependencies": {
"react": ">=18",
"react-dom": ">=18"
}
},
"node_modules/util-deprecate": { "node_modules/util-deprecate": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
@ -19682,6 +19810,14 @@
"@types/react": "*" "@types/react": "*"
} }
}, },
"@types/react-calendar": {
"version": "3.9.0",
"resolved": "https://registry.npmjs.org/@types/react-calendar/-/react-calendar-3.9.0.tgz",
"integrity": "sha512-KpAu1MKAGFw5hNwlDnWsHWqI9i/igAB+8jH97YV7QpC2v7rlwNEU5i6VMFb73lGRacuejM/Zd2LklnEzkFV3XA==",
"requires": {
"@types/react": "*"
}
},
"@types/react-dom": { "@types/react-dom": {
"version": "18.0.4", "version": "18.0.4",
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.0.4.tgz", "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.0.4.tgz",
@ -20036,6 +20172,11 @@
"@xtuc/long": "4.2.2" "@xtuc/long": "4.2.2"
} }
}, },
"@wojtekmaj/date-utils": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@wojtekmaj/date-utils/-/date-utils-1.0.3.tgz",
"integrity": "sha512-1VPkkTBk07gMR1fjpBtse4G+oJqpmE+0gUFB0dg3VIL7qJmUVaBoD/vlzMm/jNeOPfvlmerl1lpnsZyBUFIRuw=="
},
"@xtuc/ieee754": { "@xtuc/ieee754": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
@ -21551,6 +21692,11 @@
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
"integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg=="
}, },
"detect-element-overflow": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/detect-element-overflow/-/detect-element-overflow-1.2.0.tgz",
"integrity": "sha512-Jtr9ivYPhpd9OJux+hjL0QjUKiS1Ghgy8tvIufUjFslQgIWvgGr4mn57H190APbKkiOmXnmtMI6ytaKzMusecg=="
},
"detect-newline": { "detect-newline": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz",
@ -22902,6 +23048,14 @@
"get-intrinsic": "^1.1.1" "get-intrinsic": "^1.1.1"
} }
}, },
"get-user-locale": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/get-user-locale/-/get-user-locale-1.5.1.tgz",
"integrity": "sha512-WiNpoFRcHn1qxP9VabQljzGwkAQDrcpqUtaP0rNBEkFxJdh4f3tik6MfZsMYZc+UgQJdGCxWEjL9wnCUlRQXag==",
"requires": {
"lodash.memoize": "^4.1.1"
}
},
"glob": { "glob": {
"version": "7.2.3", "version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
@ -25317,6 +25471,11 @@
} }
} }
}, },
"make-event-props": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/make-event-props/-/make-event-props-1.3.0.tgz",
"integrity": "sha512-oWiDZMcVB1/A487251hEWza1xzgCzl6MXxe9aF24l5Bt9N9UEbqTqKumEfuuLhmlhRZYnc+suVvW4vUs8bwO7Q=="
},
"makeerror": { "makeerror": {
"version": "1.0.12", "version": "1.0.12",
"resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz",
@ -26825,6 +26984,33 @@
} }
} }
}, },
"react-calendar": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/react-calendar/-/react-calendar-4.0.0.tgz",
"integrity": "sha512-y9Q5Oo3Mq869KExbOCP3aJ3hEnRZKZ0TqUa9QU1wJGgDZFrW1qTaWp5v52oZpmxTTrpAMTUcUGaC0QJcO1f8Nw==",
"requires": {
"@wojtekmaj/date-utils": "^1.0.2",
"clsx": "^1.2.1",
"get-user-locale": "^1.2.0",
"prop-types": "^15.6.0"
}
},
"react-date-picker": {
"version": "9.1.0",
"resolved": "https://registry.npmjs.org/react-date-picker/-/react-date-picker-9.1.0.tgz",
"integrity": "sha512-wj9SoOhEgQTzJsDRLePpNzUDNrcSiCpj1TFSwiAnLlOuJvvkk10I9rdvIyHmeJg/G17hyP5wSwTppCZHqOTHhA==",
"requires": {
"@types/react-calendar": "^3.0.0",
"@wojtekmaj/date-utils": "^1.0.3",
"clsx": "^1.2.1",
"get-user-locale": "^1.2.0",
"make-event-props": "^1.1.0",
"prop-types": "^15.6.0",
"react-calendar": "^4.0.0",
"react-fit": "^1.4.0",
"update-input-width": "^1.2.2"
}
},
"react-dev-utils": { "react-dev-utils": {
"version": "12.0.1", "version": "12.0.1",
"resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.0.1.tgz", "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.0.1.tgz",
@ -26925,6 +27111,16 @@
"resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.11.tgz", "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.11.tgz",
"integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==" "integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg=="
}, },
"react-fit": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/react-fit/-/react-fit-1.4.0.tgz",
"integrity": "sha512-cf9sFKbr1rlTB9fNIKE5Uy4NCMUOqrX2mdJ69V4RtmV4KubPdtnbIP1tEar16GXaToCRr7I7c9d2wkTNk9TV5g==",
"requires": {
"detect-element-overflow": "^1.2.0",
"prop-types": "^15.6.0",
"tiny-warning": "^1.0.0"
}
},
"react-hook-form": { "react-hook-form": {
"version": "7.31.3", "version": "7.31.3",
"resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.31.3.tgz", "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.31.3.tgz",
@ -28194,6 +28390,11 @@
"resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz", "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz",
"integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==" "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA=="
}, },
"tiny-warning": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz",
"integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA=="
},
"tmpl": { "tmpl": {
"version": "1.0.5", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",
@ -28416,6 +28617,11 @@
"resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz",
"integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==" "integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg=="
}, },
"update-input-width": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/update-input-width/-/update-input-width-1.2.2.tgz",
"integrity": "sha512-6QwD9ZVSXb96PxOZ01DU0DJTPwQGY7qBYgdniZKJN02Xzom2m+9J6EPxMbefskqtj4x78qbe5psDSALq9iNEYg=="
},
"uri-js": { "uri-js": {
"version": "4.4.1", "version": "4.4.1",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
@ -28424,6 +28630,12 @@
"punycode": "^2.1.0" "punycode": "^2.1.0"
} }
}, },
"use-local-storage-state": {
"version": "18.1.1",
"resolved": "https://registry.npmjs.org/use-local-storage-state/-/use-local-storage-state-18.1.1.tgz",
"integrity": "sha512-09bl6q3mkSlkEt8KeBPCmdPEWEojWYF70Qbz+7wkfQX1feaFITM9m84+h0Jr6Cnf/IvpahkFh7UbX2VNN3ioTQ==",
"requires": {}
},
"util-deprecate": { "util-deprecate": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",

View File

@ -16,6 +16,7 @@
"luxon": "^3.0.4", "luxon": "^3.0.4",
"react": "^18.1.0", "react": "^18.1.0",
"react-big-calendar": "^1.5.0", "react-big-calendar": "^1.5.0",
"react-date-picker": "^9.1.0",
"react-dom": "^18.1.0", "react-dom": "^18.1.0",
"react-hook-form": "^7.31.3", "react-hook-form": "^7.31.3",
"react-modal": "^3.16.1", "react-modal": "^3.16.1",
@ -24,6 +25,7 @@
"react-scripts": "5.0.1", "react-scripts": "5.0.1",
"react-select": "^5.3.2", "react-select": "^5.3.2",
"typescript": "^4.6.4", "typescript": "^4.6.4",
"use-local-storage-state": "^18.1.1",
"web-vitals": "^2.1.4" "web-vitals": "^2.1.4"
}, },
"scripts": { "scripts": {

View File

@ -2,6 +2,7 @@ import axiosInstance from './axiosInstance'
export const getEnrollmentList = ( export const getEnrollmentList = (
params: Partial<{ params: Partial<{
year_group_id: number
page: number page: number
per_page: number per_page: number
name: string name: string
@ -17,6 +18,9 @@ export const getEnrollmentList = (
email: string email: string
mode: number mode: number
}[] }[]
}>('http://127.0.0.1:5000/api/students/registrations/', { }>(
params, `http://127.0.0.1:5000/api/students/registrations/${params.year_group_id}`,
}) {
params,
},
)

View File

@ -20,22 +20,24 @@ export interface Group {
export const getGroups = ( export const getGroups = (
params: Partial<{ params: Partial<{
year_group_id: number
page: number page: number
per_page: number per_page: number
name: string name: string
}>, }>,
) => ) =>
axiosInstance.get<{ max_pages: number; groups: Group[] }>( axiosInstance.get<{ max_pages: number; groups: Group[] }>(
'http://127.0.0.1:5000/api/coordinator/groups/', `http://127.0.0.1:5000/api/coordinator/groups/${params.year_group_id}`,
{ {
params, params,
}, },
) )
export const createGroup = (payload: CreateGroup) => export const createGroup = (year_group_id: number, payload: CreateGroup) =>
axiosInstance.post('http://127.0.0.1:5000/api/coordinator/groups/', payload) axiosInstance.post(
`http://127.0.0.1:5000/api/coordinator/groups/${year_group_id}`,
export const deleteGroup = (id: number) => payload,
axiosInstance.delete(
`http://127.0.0.1:5000/api/coordinator/groups/${id}/`,
) )
export const deleteGroup = (id: number) =>
axiosInstance.delete(`http://127.0.0.1:5000/api/coordinator/groups/${id}/`)

View File

@ -19,6 +19,7 @@ export interface Leader {
export const getLeaders = ( export const getLeaders = (
params: Partial<{ params: Partial<{
year_group_id: number
fullname: string fullname: string
order_by_first_name: OrderType order_by_first_name: OrderType
order_by_last_name: OrderType order_by_last_name: OrderType
@ -27,7 +28,7 @@ export const getLeaders = (
}> = {}, }> = {},
) => ) =>
axiosInstance.get<LeaderResponse>( axiosInstance.get<LeaderResponse>(
'http://127.0.0.1:5000/api/coordinator/project_supervisor', `http://127.0.0.1:5000/api/coordinator/project_supervisor/${params.year_group_id}`,
{ params }, { params },
) )

View File

@ -1,39 +1,39 @@
import axiosInstance from './axiosInstance' import axiosInstance from './axiosInstance'
export const getEvents = (scheduleId: number) => { export const getTermsOfDefences = (scheduleId: number) => {
return axiosInstance.get<{ return axiosInstance.get<{
enrollments: { term_of_defences: {
id: number id: number
start_date: string start_date: string
end_date: string end_date: string
title: string title: string
committee: { members_of_committee: {
members: { first_name: string; last_name: string }[] members: { first_name: string; last_name: string }[]
} }
group: { name: string } group: { name: string }
}[] }[]
}>( }>(
`http://127.0.0.1:5000/api/examination_schedule/enrollments/${scheduleId}/coordinator-view/?per_page=10000`, `http://127.0.0.1:5000/api/coordinator/enrollments/${scheduleId}/term-of-defences/`,
) )
} }
export const getStudentsSchedule = (scheduleId: number) => { export const getStudentsTermsOfDefences = (scheduleId: number) => {
return axiosInstance.get<{ return axiosInstance.get<{
enrollments: { term_of_defences: {
id: number id: number
start_date: string start_date: string
end_date: string end_date: string
title: string title: string
committee: { members_of_committee: {
members: { first_name: string; last_name: string }[] members: { first_name: string; last_name: string }[]
} }
group: { name: string } group: { name: string }
}[] }[]
}>( }>(
`http://127.0.0.1:5000/api/examination_schedule/enrollments/${scheduleId}/student-view?per_page=10000`, `http://127.0.0.1:5000/api/students/examination-schedule/${scheduleId}/enrollments/`,
) )
} }
export const getSchedules = () => { export const getSchedules = (year_group_id: number = 1) => {
return axiosInstance.get<{ return axiosInstance.get<{
examination_schedules: { examination_schedules: {
id: number id: number
@ -43,7 +43,7 @@ export const getSchedules = () => {
mode: boolean mode: boolean
}[] }[]
}>( }>(
'http://127.0.0.1:5000/api/coordinator/examination_schedule/?per_page=10000', `http://127.0.0.1:5000/api/coordinator/examination_schedule/${year_group_id}?per_page=10000`,
) )
} }
@ -51,27 +51,30 @@ export const createEvent = ({
start_date, start_date,
end_date, end_date,
scheduleId, scheduleId,
project_supervisors,
}: { }: {
start_date: string start_date: string
end_date: string end_date: string
scheduleId: number scheduleId: number
project_supervisors: number[]
}) => { }) => {
return axiosInstance.post( return axiosInstance.post(
`http://127.0.0.1:5000/api/coordinator/enrollments/${scheduleId}/`, `http://127.0.0.1:5000/api/coordinator/enrollments/${scheduleId}/add`,
{ {
start_date, start_date,
end_date, end_date,
project_supervisors,
}, },
) )
} }
export const createSchedule = (title: string) => { export const createSchedule = (
year_group_id: number,
payload: { title: string; start_date: string; end_date: string },
) => {
return axiosInstance.post( return axiosInstance.post(
'http://127.0.0.1:5000/api/coordinator/examination_schedule/', `http://127.0.0.1:5000/api/coordinator/examination_schedule/${year_group_id}/`,
{ payload,
title,
mode: true,
},
) )
} }

View File

@ -18,6 +18,7 @@ export interface Student {
export const getStudents = ( export const getStudents = (
params: Partial<{ params: Partial<{
year_group_id: number
fullname: string fullname: string
order_by_first_name: OrderType order_by_first_name: OrderType
order_by_last_name: OrderType order_by_last_name: OrderType
@ -27,7 +28,7 @@ export const getStudents = (
}> = {}, }> = {},
) => ) =>
axiosInstance.get<StudentResponse>( axiosInstance.get<StudentResponse>(
'http://127.0.0.1:5000/api/coordinator/students', `http://127.0.0.1:5000/api/coordinator/students/${params.year_group_id}`,
{ params }, { params },
) )

View File

@ -1,6 +1,11 @@
import { NavLink } from 'react-router-dom' import { NavLink } from 'react-router-dom'
import useLocalStorageState from 'use-local-storage-state'
const Login = () => { const Login = () => {
const [yearGroupId, setYearGroupId] = useLocalStorageState('yearGroupId', {
defaultValue: 1,
})
return ( return (
<> <>
<div className="flex items-center bg-gray-300 mt-20 py-6 px-10 shadow"> <div className="flex items-center bg-gray-300 mt-20 py-6 px-10 shadow">

View File

@ -6,6 +6,7 @@ import { createGroup, CreateGroup } from '../../api/groups'
import InputError from '../../components/InputError' import InputError from '../../components/InputError'
import Select from 'react-select' import Select from 'react-select'
import { getLeaders } from '../../api/leaders' import { getLeaders } from '../../api/leaders'
import useLocalStorageState from 'use-local-storage-state'
type SelectValue = { type SelectValue = {
value: string | number value: string | number
@ -14,6 +15,8 @@ type SelectValue = {
const AddGroup = () => { const AddGroup = () => {
const [isAlertVisible, setIsAlertVisible] = useState(false) const [isAlertVisible, setIsAlertVisible] = useState(false)
const [yearGroupId] = useLocalStorageState('yearGroupId')
const { const {
register, register,
handleSubmit, handleSubmit,
@ -29,13 +32,14 @@ const AddGroup = () => {
{ {
onSuccess: (data) => { onSuccess: (data) => {
setStudentOptions( setStudentOptions(
data?.data.students.filter(st => st.group === null) data?.data.students
.filter((st) => st.group === null)
.map(({ first_name, last_name, index }) => { .map(({ first_name, last_name, index }) => {
return { return {
value: index, value: index,
label: `${first_name} ${last_name} (${index})`, label: `${first_name} ${last_name} (${index})`,
} }
}), }),
) )
}, },
}, },
@ -46,12 +50,12 @@ const AddGroup = () => {
{ {
onSuccess: (data) => { onSuccess: (data) => {
setSupervisorOptions( setSupervisorOptions(
data?.data.project_supervisors.filter(ld => ld.count_groups < ld.limit_group).map( data?.data.project_supervisors
({ id, first_name, last_name }) => ({ .filter((ld) => ld.count_groups < ld.limit_group)
.map(({ id, first_name, last_name }) => ({
value: id, value: id,
label: `${first_name} ${last_name}`, label: `${first_name} ${last_name}`,
}), })),
),
) )
}, },
}, },
@ -59,7 +63,7 @@ const AddGroup = () => {
const { mutate: mutateCreateGroup } = useMutation( const { mutate: mutateCreateGroup } = useMutation(
'createGroup', 'createGroup',
(payload: CreateGroup) => createGroup(payload), (payload: CreateGroup) => createGroup(Number(yearGroupId), payload),
{ {
onSuccess: () => { onSuccess: () => {
setIsAlertVisible(true) setIsAlertVisible(true)

View File

@ -25,7 +25,7 @@ const EditSchedule = ({
scheduleId: string scheduleId: string
}) => { }) => {
const { register, handleSubmit, reset, control } = useForm<{ const { register, handleSubmit, reset, control } = useForm<{
committee: NestedValue<any[]> members_of_committee: NestedValue<any[]>
}>({ mode: 'onBlur' }) }>({ mode: 'onBlur' })
const [committeeOptions, setCommitteeOptions] = useState<SelectValue[]>([]) const [committeeOptions, setCommitteeOptions] = useState<SelectValue[]>([])
@ -56,7 +56,7 @@ const EditSchedule = ({
) )
const onSubmit = (data: any) => { const onSubmit = (data: any) => {
data?.committee?.forEach((id: number) => { data?.members_of_committee?.forEach((id: number) => {
mutateAssignSupervisor({ mutateAssignSupervisor({
scheduleId: Number(scheduleId), scheduleId: Number(scheduleId),
enrollmentId: eventData.id, enrollmentId: eventData.id,
@ -94,12 +94,12 @@ const EditSchedule = ({
<> <>
<div className="form-control"> <div className="form-control">
<div className="form-control"> <div className="form-control">
<label className="label" htmlFor="committee"> <label className="label" htmlFor="members_of_committee">
Komisja Komisja
</label> </label>
<Controller <Controller
control={control} control={control}
name="committee" name="members_of_committee"
rules={{ required: true }} rules={{ required: true }}
render={({ field: { onChange, onBlur } }) => ( render={({ field: { onChange, onBlur } }) => (
<Select <Select

View File

@ -2,6 +2,7 @@ import classNames from 'classnames'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { useMutation, useQuery } from 'react-query' import { useMutation, useQuery } from 'react-query'
import { useNavigate } from 'react-router-dom' import { useNavigate } from 'react-router-dom'
import useLocalStorageState from 'use-local-storage-state'
import { deleteGroup, getGroups } from '../../api/groups' import { deleteGroup, getGroups } from '../../api/groups'
import { ReactComponent as IconRemove } from '../../assets/svg/icon-remove.svg' import { ReactComponent as IconRemove } from '../../assets/svg/icon-remove.svg'
@ -9,6 +10,7 @@ const Groups = () => {
let navigate = useNavigate() let navigate = useNavigate()
const [page, setPage] = useState(1) const [page, setPage] = useState(1)
const [perPage, setPerPage] = useState(10) const [perPage, setPerPage] = useState(10)
const [yearGroupId] = useLocalStorageState('yearGroupId')
const perPageOptions = [ const perPageOptions = [
{ {
@ -34,7 +36,7 @@ const Groups = () => {
data: groups, data: groups,
refetch: refetchGroups, refetch: refetchGroups,
} = useQuery(['groups', page, perPage], () => } = useQuery(['groups', page, perPage], () =>
getGroups({ page, per_page: perPage }), getGroups({ year_group_id: Number(yearGroupId), page, per_page: perPage }),
) )
const { mutate: mutateDelete } = useMutation( const { mutate: mutateDelete } = useMutation(

View File

@ -4,11 +4,13 @@ import { useNavigate } from 'react-router-dom'
import { getLeaders, deleteLeader } from '../../api/leaders' import { getLeaders, deleteLeader } from '../../api/leaders'
import classNames from 'classnames' import classNames from 'classnames'
import { ReactComponent as IconRemove } from '../../assets/svg/icon-remove.svg' import { ReactComponent as IconRemove } from '../../assets/svg/icon-remove.svg'
import useLocalStorageState from 'use-local-storage-state'
const Leaders = () => { const Leaders = () => {
let navigate = useNavigate() let navigate = useNavigate()
const [page, setPage] = useState(1) const [page, setPage] = useState(1)
const [perPage, setPerPage] = useState(10) const [perPage, setPerPage] = useState(10)
const [yearGroupId] = useLocalStorageState('yearGroupId')
const perPageOptions = [ const perPageOptions = [
{ {
@ -34,7 +36,7 @@ const Leaders = () => {
data: leaders, data: leaders,
refetch: refetchLeaders, refetch: refetchLeaders,
} = useQuery(['project_supervisors', page, perPage], () => } = useQuery(['project_supervisors', page, perPage], () =>
getLeaders({ page, per_page: perPage }), getLeaders({ year_group_id: Number(yearGroupId), page, per_page: perPage }),
) )
const { mutate: mutateDelete } = useMutation( const { mutate: mutateDelete } = useMutation(

View File

@ -2,11 +2,18 @@ import { Calendar, luxonLocalizer, Views } from 'react-big-calendar'
import { DateTime, Settings } from 'luxon' import { DateTime, Settings } from 'luxon'
import { useCallback, useState } from 'react' import { useCallback, useState } from 'react'
import { useMutation, useQuery } from 'react-query' import { useMutation, useQuery } from 'react-query'
import { createEvent, downloadSchedule, getEvents } from '../../api/schedule' import {
createEvent,
downloadSchedule,
getTermsOfDefences,
} from '../../api/schedule'
import { useParams } from 'react-router-dom' import { useParams } from 'react-router-dom'
import Modal from 'react-modal' import Modal from 'react-modal'
import { useForm } from 'react-hook-form' import { Controller, NestedValue, useForm } from 'react-hook-form'
import EditSchedule from './EditSchedule' import EditSchedule from './EditSchedule'
import Select from 'react-select'
import { getLeaders } from '../../api/leaders'
import useLocalStorageState from 'use-local-storage-state'
const customStyles = { const customStyles = {
content: { content: {
@ -18,12 +25,17 @@ const customStyles = {
transform: 'translate(-50%, -50%)', transform: 'translate(-50%, -50%)',
}, },
} }
type SelectValue = {
value: string | number
label: string
}
const Schedule = () => { const Schedule = () => {
Settings.defaultZone = DateTime.local().zoneName Settings.defaultZone = DateTime.local().zoneName
Settings.defaultLocale = 'pl' Settings.defaultLocale = 'pl'
const { id } = useParams<{ id: string }>() const { id } = useParams<{ id: string }>()
const [yearGroupId] = useLocalStorageState('yearGroupId')
const [events, setEvents] = useState< const [events, setEvents] = useState<
{ {
id: number id: number
@ -47,42 +59,68 @@ const Schedule = () => {
const [isEditModalOpen, setIsEditModalOpen] = useState(false) const [isEditModalOpen, setIsEditModalOpen] = useState(false)
Modal.setAppElement('#root') Modal.setAppElement('#root')
const { register, handleSubmit, reset } = useForm<{ const { register, handleSubmit, reset, control } = useForm<{
from: string from: string
to: string to: string
project_supervisors: NestedValue<any[]>
}>({ mode: 'onBlur' }) }>({ mode: 'onBlur' })
const [committeeOptions, setCommitteeOptions] = useState<SelectValue[]>([])
const { refetch } = useQuery(['schedules'], () => getEvents(Number(id)), { const { isLoading: areLeadersLoading } = useQuery(
onSuccess: (data) => { 'leaders',
setEvents( () => getLeaders({ year_group_id: Number(yearGroupId), per_page: 1000 }),
data.data.enrollments.map( {
({ onSuccess: (data) => {
id, setCommitteeOptions(
start_date, data?.data.project_supervisors.map(
end_date, ({ id, first_name, last_name }) => ({
title = 'Obrona', value: id,
committee, label: `${first_name} ${last_name}`,
group, }),
}) => { ),
return { )
id, },
title: `${group?.name ?? '-'}`,
start: new Date(start_date),
end: new Date(end_date),
resource: {
committee,
group,
},
}
},
),
)
}, },
}) )
const { refetch } = useQuery(
['schedules'],
() => getTermsOfDefences(Number(id)),
{
onSuccess: (data) => {
setEvents(
data.data.term_of_defences.map(
({
id,
start_date,
end_date,
title = 'Obrona',
members_of_committee,
group,
}) => {
return {
id,
title: `${group?.name ?? '-'}`,
start: new Date(start_date),
end: new Date(end_date),
resource: {
members_of_committee,
},
}
},
),
)
},
},
)
const { mutateAsync: mutateCreateEvent } = useMutation( const { mutateAsync: mutateCreateEvent } = useMutation(
['createEvent'], ['createEvent'],
(data: { start_date: string; end_date: string; scheduleId: number }) => (data: {
createEvent(data), project_supervisors: number[]
start_date: string
end_date: string
scheduleId: number
}) => createEvent(data),
) )
const { mutate: mutateDownload } = useMutation( const { mutate: mutateDownload } = useMutation(
@ -105,16 +143,16 @@ const Schedule = () => {
if (view === Views.MONTH) { if (view === Views.MONTH) {
setIsModalOpen(true) setIsModalOpen(true)
} else { } else {
await mutateCreateEvent({ // await mutateCreateEvent({
start_date: DateTime.fromJSDate(event.start).toFormat( // start_date: DateTime.fromJSDate(event.start).toFormat(
'yyyy-LL-dd HH:mm:ss', // 'yyyy-LL-dd HH:mm:ss',
), // ),
end_date: DateTime.fromJSDate(event.end).toFormat( // end_date: DateTime.fromJSDate(event.end).toFormat(
'yyyy-LL-dd HH:mm:ss', // 'yyyy-LL-dd HH:mm:ss',
), // ),
scheduleId: Number(id), // scheduleId: Number(id),
}) // })
refetch() // refetch()
} }
} }
@ -147,6 +185,7 @@ const Schedule = () => {
.set({ hour: to[0], minute: to[1] }) .set({ hour: to[0], minute: to[1] })
.toFormat('yyyy-LL-dd HH:mm:ss'), .toFormat('yyyy-LL-dd HH:mm:ss'),
scheduleId: Number(id), scheduleId: Number(id),
project_supervisors: data?.project_supervisors,
}) })
refetch() refetch()
reset() reset()
@ -222,6 +261,33 @@ const Schedule = () => {
type="text" type="text"
{...register('to', { required: true })} {...register('to', { required: true })}
/> />
<label className="label" htmlFor="project_supervisors">
Komisja
</label>
<Controller
control={control}
name="project_supervisors"
rules={{ required: true }}
render={({ field: { onChange, onBlur } }) => (
<Select
closeMenuOnSelect={false}
options={committeeOptions}
placeholder="Wybierz komisje"
isMulti
onChange={(values) =>
onChange(values.map((value) => value.value))
}
onBlur={onBlur}
styles={{
control: (styles) => ({
...styles,
padding: '0.3rem',
borderRadius: '0.5rem',
}),
}}
/>
)}
/>
</div> </div>
<button className="btn btn-success mt-4">Dodaj termin</button> <button className="btn btn-success mt-4">Dodaj termin</button>
</form> </form>

View File

@ -2,11 +2,19 @@ import { useMutation, useQuery } from 'react-query'
import { createSchedule, getSchedules } from '../../api/schedule' import { createSchedule, getSchedules } from '../../api/schedule'
import { useForm } from 'react-hook-form' import { useForm } from 'react-hook-form'
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
import useLocalStorageState from 'use-local-storage-state'
import DatePicker from 'react-date-picker'
import { useState } from 'react'
const Schedules = () => { const Schedules = () => {
const { register, handleSubmit } = useForm<{ title: string }>({ const { register, handleSubmit } = useForm<{
title: string
}>({
mode: 'onBlur', mode: 'onBlur',
}) })
const [yearGroupId] = useLocalStorageState('yearGroupId')
const [startDate, setStartDate] = useState(new Date())
const [endDate, setEndDate] = useState(new Date())
const { data: schedules, refetch } = useQuery(['getSchedules'], () => const { data: schedules, refetch } = useQuery(['getSchedules'], () =>
getSchedules(), getSchedules(),
@ -14,7 +22,8 @@ const Schedules = () => {
const { mutate: mutateCreateSchedule } = useMutation( const { mutate: mutateCreateSchedule } = useMutation(
['createSchedule'], ['createSchedule'],
({ title }: { title: string }) => createSchedule(title), (payload: { title: string; start_date: string; end_date: string }) =>
createSchedule(Number(yearGroupId), payload),
{ {
onSuccess: () => { onSuccess: () => {
refetch() refetch()
@ -23,7 +32,11 @@ const Schedules = () => {
) )
const onSubmit = (data: any) => { const onSubmit = (data: any) => {
mutateCreateSchedule(data) mutateCreateSchedule({
...data,
start_date: startDate.toISOString(),
end_date: endDate.toISOString(),
})
} }
return ( return (
@ -42,6 +55,17 @@ const Schedules = () => {
type="text" type="text"
{...register('title', { required: true })} {...register('title', { required: true })}
/> />
<label className="label" htmlFor="start_date">
Od
</label>
<DatePicker onChange={setStartDate} value={startDate} />
<label className="label" htmlFor="end_date">
Do
</label>
<DatePicker onChange={setEndDate} value={endDate} />
</div> </div>
<button className="btn btn-success mt-4">Stwórz zapisy</button> <button className="btn btn-success mt-4">Stwórz zapisy</button>
</form> </form>

View File

@ -9,6 +9,7 @@ import {
} from '../../api/students' } from '../../api/students'
import classNames from 'classnames' import classNames from 'classnames'
import { ReactComponent as IconRemove } from '../../assets/svg/icon-remove.svg' import { ReactComponent as IconRemove } from '../../assets/svg/icon-remove.svg'
import useLocalStorageState from 'use-local-storage-state'
const Students = () => { const Students = () => {
let navigate = useNavigate() let navigate = useNavigate()
@ -16,6 +17,7 @@ const Students = () => {
const [page, setPage] = useState(1) const [page, setPage] = useState(1)
const [perPage, setPerPage] = useState(10) const [perPage, setPerPage] = useState(10)
const [mode, setMode] = useState(true) const [mode, setMode] = useState(true)
const [yearGroupId] = useLocalStorageState('yearGroupId')
const perPageOptions = [ const perPageOptions = [
{ {
@ -41,7 +43,12 @@ const Students = () => {
data: students, data: students,
refetch: refetchStudents, refetch: refetchStudents,
} = useQuery(['students', page, perPage, mode], () => } = useQuery(['students', page, perPage, mode], () =>
getStudents({ page, per_page: perPage, mode }), getStudents({
year_group_id: Number(yearGroupId),
page,
per_page: perPage,
mode,
}),
) )
const { mutate: mutateDownload } = useMutation( const { mutate: mutateDownload } = useMutation(

View File

@ -1,13 +1,21 @@
import { useState } from 'react' import { useState } from 'react'
import { useQuery } from 'react-query' import { useQuery } from 'react-query'
import useLocalStorageState from 'use-local-storage-state'
import { getEnrollmentList } from '../../api/enrollment' import { getEnrollmentList } from '../../api/enrollment'
const Enrollment = () => { const Enrollment = () => {
const [showAvailable, setShowAvailable] = useState(false) const [showAvailable, setShowAvailable] = useState(false)
const [mode, setMode] = useState(true) const [mode, setMode] = useState(true)
const [yearGroupId] = useLocalStorageState('yearGroupId')
const { isLoading, data: enrollmentData } = useQuery( const { isLoading, data: enrollmentData } = useQuery(
['enrollment', mode], ['enrollment', mode],
() => getEnrollmentList({ per_page: 1000, mode }), () =>
getEnrollmentList({
year_group_id: Number(yearGroupId),
per_page: 1000,
mode,
}),
) )
if (isLoading) { if (isLoading) {
return <div>Ładowanie</div> return <div>Ładowanie</div>

View File

@ -2,7 +2,7 @@ import { Calendar, luxonLocalizer, Views } from 'react-big-calendar'
import { DateTime, Settings } from 'luxon' import { DateTime, Settings } from 'luxon'
import { useCallback, useState } from 'react' import { useCallback, useState } from 'react'
import { useQuery } from 'react-query' import { useQuery } from 'react-query'
import { getStudentsSchedule } from '../../api/schedule' import { getStudentsTermsOfDefences } from '../../api/schedule'
import { useParams } from 'react-router-dom' import { useParams } from 'react-router-dom'
import Modal from 'react-modal' import Modal from 'react-modal'
import { useForm } from 'react-hook-form' import { useForm } from 'react-hook-form'
@ -54,17 +54,17 @@ const StudentSchedule = () => {
const { refetch } = useQuery( const { refetch } = useQuery(
['studentSchedules'], ['studentSchedules'],
() => getStudentsSchedule(Number(id)), () => getStudentsTermsOfDefences(Number(id)),
{ {
onSuccess: (data) => { onSuccess: (data) => {
setEvents( setEvents(
data.data.enrollments.map( data.data.term_of_defences.map(
({ ({
id, id,
start_date, start_date,
end_date, end_date,
title = 'Obrona', title = 'Obrona',
committee, members_of_committee,
group, group,
}) => { }) => {
return { return {
@ -73,8 +73,8 @@ const StudentSchedule = () => {
start: new Date(start_date), start: new Date(start_date),
end: new Date(end_date), end: new Date(end_date),
resource: { resource: {
committee,
group, group,
members_of_committee,
}, },
} }
}, },