From 15a660d5730f5039adc8cd23e478b878e1ff9462 Mon Sep 17 00:00:00 2001 From: Andre Emiliano Date: Sat, 26 Jun 2021 15:04:38 +0000 Subject: [PATCH] Added changes for normal users to see their applications --- package-lock.json | 296 +++++++++++++++++++++++++ package.json | 2 + src/App.js | 8 +- src/components/.newApplication.js.swp | Bin 16384 -> 0 bytes src/components/application.js | 70 +++++- src/components/applicationcard.js | 26 +-- src/components/applicationsForUsers.js | 88 ++++++++ src/components/editApplication.js | 2 +- src/components/homegrid.js | 10 +- src/components/login.js | 14 +- src/components/nav.js | 40 ++-- src/components/newApplication.js | 1 + src/components/register.js | 2 +- src/setupProxy.js | 11 + 14 files changed, 519 insertions(+), 51 deletions(-) delete mode 100644 src/components/.newApplication.js.swp create mode 100644 src/components/applicationsForUsers.js create mode 100644 src/setupProxy.js diff --git a/package-lock.json b/package-lock.json index ff4e0ec..f8e3ee0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,10 +18,12 @@ "react-dom": "^17.0.1", "react-router-dom": "^5.2.0", "react-scripts": "4.0.0", + "react-select": "^4.3.1", "web-vitals": "^0.2.4" }, "devDependencies": { "cross-env": "^7.0.3", + "http-proxy-middleware": "^0.19.1", "jest": "^26.6.0", "supertest": "^6.1.3" } @@ -1333,6 +1335,97 @@ "resolved": "https://registry.npmjs.org/@csstools/normalize.css/-/normalize.css-10.1.0.tgz", "integrity": "sha512-ij4wRiunFfaJxjB0BdrYHIH8FxBJpOwNPhhAcunlmPdXudL1WQV1qoP9un6JsEBAgQH+7UXyyjh0g7jTxXK6tg==" }, + "node_modules/@emotion/cache": { + "version": "11.4.0", + "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.4.0.tgz", + "integrity": "sha512-Zx70bjE7LErRO9OaZrhf22Qye1y4F7iDl+ITjet0J+i+B88PrAOBkKvaAWhxsZf72tDLajwCgfCjJ2dvH77C3g==", + "dependencies": { + "@emotion/memoize": "^0.7.4", + "@emotion/sheet": "^1.0.0", + "@emotion/utils": "^1.0.0", + "@emotion/weak-memoize": "^0.2.5", + "stylis": "^4.0.3" + } + }, + "node_modules/@emotion/hash": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz", + "integrity": "sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==" + }, + "node_modules/@emotion/memoize": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.5.tgz", + "integrity": "sha512-igX9a37DR2ZPGYtV6suZ6whr8pTFtyHL3K/oLUotxpSVO2ASaprmAe2Dkq7tBo7CRY7MMDrAa9nuQP9/YG8FxQ==" + }, + "node_modules/@emotion/react": { + "version": "11.4.0", + "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.4.0.tgz", + "integrity": "sha512-4XklWsl9BdtatLoJpSjusXhpKv9YVteYKh9hPKP1Sxl+mswEFoUe0WtmtWjxEjkA51DQ2QRMCNOvKcSlCQ7ivg==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@emotion/cache": "^11.4.0", + "@emotion/serialize": "^1.0.2", + "@emotion/sheet": "^1.0.1", + "@emotion/utils": "^1.0.0", + "@emotion/weak-memoize": "^0.2.5", + "hoist-non-react-statics": "^3.3.1" + }, + "peerDependencies": { + "@babel/core": "^7.0.0", + "react": ">=16.8.0" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "@types/react": { + "optional": true + } + } + }, + "node_modules/@emotion/react/node_modules/@babel/runtime": { + "version": "7.14.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.14.6.tgz", + "integrity": "sha512-/PCB2uJ7oM44tz8YhC4Z/6PeOKXp4K588f+5M3clr1M4zbqztlo0XEfJ2LEzj/FgwfgGcIdl8n7YYjTCI0BYwg==", + "dependencies": { + "regenerator-runtime": "^0.13.4" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@emotion/serialize": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.0.2.tgz", + "integrity": "sha512-95MgNJ9+/ajxU7QIAruiOAdYNjxZX7G2mhgrtDWswA21VviYIRP1R5QilZ/bDY42xiKsaktP4egJb3QdYQZi1A==", + "dependencies": { + "@emotion/hash": "^0.8.0", + "@emotion/memoize": "^0.7.4", + "@emotion/unitless": "^0.7.5", + "@emotion/utils": "^1.0.0", + "csstype": "^3.0.2" + } + }, + "node_modules/@emotion/sheet": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.0.1.tgz", + "integrity": "sha512-GbIvVMe4U+Zc+929N1V7nW6YYJtidj31lidSmdYcWozwoBIObXBnaJkKNDjZrLm9Nc0BR+ZyHNaRZxqNZbof5g==" + }, + "node_modules/@emotion/unitless": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz", + "integrity": "sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==" + }, + "node_modules/@emotion/utils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.0.0.tgz", + "integrity": "sha512-mQC2b3XLDs6QCW+pDQDiyO/EdGZYOygE8s5N5rrzjSI4M3IejPE/JPndCBwRT9z982aqQNi6beWs1UeayrQxxA==" + }, + "node_modules/@emotion/weak-memoize": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz", + "integrity": "sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==" + }, "node_modules/@eslint/eslintrc": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.2.1.tgz", @@ -5305,6 +5398,11 @@ "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==" }, + "node_modules/csstype": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.8.tgz", + "integrity": "sha512-jXKhWqXPmlUeoQnF/EhTtTl4C9SnrxSH/jZUih3jmO6lBKr99rP3/+FmrMj4EFpOXzMtXHAZkd3x0E6h6Fgflw==" + }, "node_modules/cyclist": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-1.0.1.tgz", @@ -5718,6 +5816,15 @@ "utila": "~0.4" } }, + "node_modules/dom-helpers": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz", + "integrity": "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==", + "dependencies": { + "@babel/runtime": "^7.8.7", + "csstype": "^3.0.2" + } + }, "node_modules/dom-serializer": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz", @@ -10853,6 +10960,11 @@ "node": ">= 0.6" } }, + "node_modules/memoize-one": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-5.2.1.tgz", + "integrity": "sha512-zYiwtZUcYyXKo/np96AGZAckk+FWWsUdJ3cHGGmld7+AhvcWmQyGCYUh1hc4Q/pkOhb65dQR/pqCyK0cOaHz4Q==" + }, "node_modules/memory-fs": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", @@ -14543,6 +14655,17 @@ "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.9.tgz", "integrity": "sha512-nQTTcUu+ATDbrSD1BZHr5kgSD4oF8OFjxun8uAaL8RwPBacGBNPf/yAuVVdx17N8XNzRDMrZ9XcKZHCjPW+9ew==" }, + "node_modules/react-input-autosize": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/react-input-autosize/-/react-input-autosize-3.0.0.tgz", + "integrity": "sha512-nL9uS7jEs/zu8sqwFE5MAPx6pPkNAriACQ2rGLlqmKr2sPGtN7TXTyDdQt4lbNXVx7Uzadb40x8qotIuru6Rhg==", + "dependencies": { + "prop-types": "^15.5.8" + }, + "peerDependencies": { + "react": "^16.3.0 || ^17.0.0" + } + }, "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", @@ -14666,6 +14789,39 @@ "fsevents": "^2.1.3" } }, + "node_modules/react-select": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/react-select/-/react-select-4.3.1.tgz", + "integrity": "sha512-HBBd0dYwkF5aZk1zP81Wx5UsLIIT2lSvAY2JiJo199LjoLHoivjn9//KsmvQMEFGNhe58xyuOITjfxKCcGc62Q==", + "dependencies": { + "@babel/runtime": "^7.12.0", + "@emotion/cache": "^11.4.0", + "@emotion/react": "^11.1.1", + "memoize-one": "^5.0.0", + "prop-types": "^15.6.0", + "react-input-autosize": "^3.0.0", + "react-transition-group": "^4.3.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0", + "react-dom": "^16.8.0 || ^17.0.0" + } + }, + "node_modules/react-transition-group": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.2.tgz", + "integrity": "sha512-/RNYfRAMlZwDSr6z4zNKV6xu53/e2BuaBbGhbyYIXTrmgu/bGHzmqOs7mJSJBHy9Ud+ApHx3QjrkKSp1pxvlFg==", + "dependencies": { + "@babel/runtime": "^7.5.5", + "dom-helpers": "^5.0.1", + "loose-envify": "^1.4.0", + "prop-types": "^15.6.2" + }, + "peerDependencies": { + "react": ">=16.6.0", + "react-dom": ">=16.6.0" + } + }, "node_modules/read-pkg": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", @@ -16950,6 +17106,11 @@ "node": ">=8" } }, + "node_modules/stylis": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.0.10.tgz", + "integrity": "sha512-m3k+dk7QeJw660eIKRRn3xPF6uuvHs/FFzjX3HQ5ove0qYsiygoAhwn5a3IYKaZPo5LrYD0rfVmtv1gNY1uYwg==" + }, "node_modules/superagent": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/superagent/-/superagent-6.1.0.tgz", @@ -21140,6 +21301,84 @@ "resolved": "https://registry.npmjs.org/@csstools/normalize.css/-/normalize.css-10.1.0.tgz", "integrity": "sha512-ij4wRiunFfaJxjB0BdrYHIH8FxBJpOwNPhhAcunlmPdXudL1WQV1qoP9un6JsEBAgQH+7UXyyjh0g7jTxXK6tg==" }, + "@emotion/cache": { + "version": "11.4.0", + "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.4.0.tgz", + "integrity": "sha512-Zx70bjE7LErRO9OaZrhf22Qye1y4F7iDl+ITjet0J+i+B88PrAOBkKvaAWhxsZf72tDLajwCgfCjJ2dvH77C3g==", + "requires": { + "@emotion/memoize": "^0.7.4", + "@emotion/sheet": "^1.0.0", + "@emotion/utils": "^1.0.0", + "@emotion/weak-memoize": "^0.2.5", + "stylis": "^4.0.3" + } + }, + "@emotion/hash": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz", + "integrity": "sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==" + }, + "@emotion/memoize": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.5.tgz", + "integrity": "sha512-igX9a37DR2ZPGYtV6suZ6whr8pTFtyHL3K/oLUotxpSVO2ASaprmAe2Dkq7tBo7CRY7MMDrAa9nuQP9/YG8FxQ==" + }, + "@emotion/react": { + "version": "11.4.0", + "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.4.0.tgz", + "integrity": "sha512-4XklWsl9BdtatLoJpSjusXhpKv9YVteYKh9hPKP1Sxl+mswEFoUe0WtmtWjxEjkA51DQ2QRMCNOvKcSlCQ7ivg==", + "requires": { + "@babel/runtime": "^7.13.10", + "@emotion/cache": "^11.4.0", + "@emotion/serialize": "^1.0.2", + "@emotion/sheet": "^1.0.1", + "@emotion/utils": "^1.0.0", + "@emotion/weak-memoize": "^0.2.5", + "hoist-non-react-statics": "^3.3.1" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.14.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.14.6.tgz", + "integrity": "sha512-/PCB2uJ7oM44tz8YhC4Z/6PeOKXp4K588f+5M3clr1M4zbqztlo0XEfJ2LEzj/FgwfgGcIdl8n7YYjTCI0BYwg==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + } + } + }, + "@emotion/serialize": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.0.2.tgz", + "integrity": "sha512-95MgNJ9+/ajxU7QIAruiOAdYNjxZX7G2mhgrtDWswA21VviYIRP1R5QilZ/bDY42xiKsaktP4egJb3QdYQZi1A==", + "requires": { + "@emotion/hash": "^0.8.0", + "@emotion/memoize": "^0.7.4", + "@emotion/unitless": "^0.7.5", + "@emotion/utils": "^1.0.0", + "csstype": "^3.0.2" + } + }, + "@emotion/sheet": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.0.1.tgz", + "integrity": "sha512-GbIvVMe4U+Zc+929N1V7nW6YYJtidj31lidSmdYcWozwoBIObXBnaJkKNDjZrLm9Nc0BR+ZyHNaRZxqNZbof5g==" + }, + "@emotion/unitless": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz", + "integrity": "sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==" + }, + "@emotion/utils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.0.0.tgz", + "integrity": "sha512-mQC2b3XLDs6QCW+pDQDiyO/EdGZYOygE8s5N5rrzjSI4M3IejPE/JPndCBwRT9z982aqQNi6beWs1UeayrQxxA==" + }, + "@emotion/weak-memoize": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz", + "integrity": "sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==" + }, "@eslint/eslintrc": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.2.1.tgz", @@ -24516,6 +24755,11 @@ } } }, + "csstype": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.8.tgz", + "integrity": "sha512-jXKhWqXPmlUeoQnF/EhTtTl4C9SnrxSH/jZUih3jmO6lBKr99rP3/+FmrMj4EFpOXzMtXHAZkd3x0E6h6Fgflw==" + }, "cyclist": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-1.0.1.tgz", @@ -24857,6 +25101,15 @@ "utila": "~0.4" } }, + "dom-helpers": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz", + "integrity": "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==", + "requires": { + "@babel/runtime": "^7.8.7", + "csstype": "^3.0.2" + } + }, "dom-serializer": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz", @@ -29079,6 +29332,11 @@ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" }, + "memoize-one": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-5.2.1.tgz", + "integrity": "sha512-zYiwtZUcYyXKo/np96AGZAckk+FWWsUdJ3cHGGmld7+AhvcWmQyGCYUh1hc4Q/pkOhb65dQR/pqCyK0cOaHz4Q==" + }, "memory-fs": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", @@ -32177,6 +32435,14 @@ "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.9.tgz", "integrity": "sha512-nQTTcUu+ATDbrSD1BZHr5kgSD4oF8OFjxun8uAaL8RwPBacGBNPf/yAuVVdx17N8XNzRDMrZ9XcKZHCjPW+9ew==" }, + "react-input-autosize": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/react-input-autosize/-/react-input-autosize-3.0.0.tgz", + "integrity": "sha512-nL9uS7jEs/zu8sqwFE5MAPx6pPkNAriACQ2rGLlqmKr2sPGtN7TXTyDdQt4lbNXVx7Uzadb40x8qotIuru6Rhg==", + "requires": { + "prop-types": "^15.5.8" + } + }, "react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", @@ -32288,6 +32554,31 @@ "workbox-webpack-plugin": "5.1.4" } }, + "react-select": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/react-select/-/react-select-4.3.1.tgz", + "integrity": "sha512-HBBd0dYwkF5aZk1zP81Wx5UsLIIT2lSvAY2JiJo199LjoLHoivjn9//KsmvQMEFGNhe58xyuOITjfxKCcGc62Q==", + "requires": { + "@babel/runtime": "^7.12.0", + "@emotion/cache": "^11.4.0", + "@emotion/react": "^11.1.1", + "memoize-one": "^5.0.0", + "prop-types": "^15.6.0", + "react-input-autosize": "^3.0.0", + "react-transition-group": "^4.3.0" + } + }, + "react-transition-group": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.2.tgz", + "integrity": "sha512-/RNYfRAMlZwDSr6z4zNKV6xu53/e2BuaBbGhbyYIXTrmgu/bGHzmqOs7mJSJBHy9Ud+ApHx3QjrkKSp1pxvlFg==", + "requires": { + "@babel/runtime": "^7.5.5", + "dom-helpers": "^5.0.1", + "loose-envify": "^1.4.0", + "prop-types": "^15.6.2" + } + }, "read-pkg": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", @@ -34227,6 +34518,11 @@ } } }, + "stylis": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.0.10.tgz", + "integrity": "sha512-m3k+dk7QeJw660eIKRRn3xPF6uuvHs/FFzjX3HQ5ove0qYsiygoAhwn5a3IYKaZPo5LrYD0rfVmtv1gNY1uYwg==" + }, "superagent": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/superagent/-/superagent-6.1.0.tgz", diff --git a/package.json b/package.json index 31864fe..c55140a 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "react-dom": "^17.0.1", "react-router-dom": "^5.2.0", "react-scripts": "4.0.0", + "react-select": "^4.3.1", "web-vitals": "^0.2.4" }, "scripts": { @@ -42,6 +43,7 @@ }, "devDependencies": { "cross-env": "^7.0.3", + "http-proxy-middleware": "^0.19.1", "jest": "^26.6.0", "supertest": "^6.1.3" } diff --git a/src/App.js b/src/App.js index 9e12823..370e17d 100644 --- a/src/App.js +++ b/src/App.js @@ -1,10 +1,6 @@ import React from 'react'; import { Layout } from 'antd'; -import { - BrowserRouter as Router, - Switch, - Route -} from "react-router-dom"; +import {BrowserRouter as Router, Switch, Route} from "react-router-dom"; import './App.css'; import Nav from './components/nav'; @@ -13,6 +9,7 @@ import Register from './components/register'; import Login from './components/login'; import Home from './components/home'; import Application from './components/application'; +import ApplicationForUsers from './components/applicationsForUsers'; import NewApplication from './components/newApplication'; import EditApplication from './components/editApplication'; import Messages from './components/messages'; @@ -77,6 +74,7 @@ class App extends React.Component { } /> } /> } /> + } /> } /> } /> diff --git a/src/components/.newApplication.js.swp b/src/components/.newApplication.js.swp deleted file mode 100644 index 99d899560b819b894adec64701fd318508a76f8c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeHOONb;%8BW({@6!h;%Od=nbLi^c?9A?&ot+`6YVGNr#*x{Xp?i8f41;E8Mpb1` zR%V(JIo)MZ>UvOC5WI*WdJq)!B0K0w*#*TFbUg@ypa+FLh>M`;Nj;vb;0541Z~}P!?I;I44+Ow9U=H}#+cfR3z;A(9fZM+Q@D;!XZUC2o4*_R@e`0Lp`24;I%G|vj(IHQF zJqlK}Ir(%qqdg)qj#*Fd2W(%b-INQzKkn)3hQ^YUL}}>h#&91YLmGdC4{F=3rmu!L7C|UED;_3e3C>7iDWDlgjkN}5pL6vQ(dRg ztBNKr*to+E8l&DSW!=lh8XY%AFkzmbfB;*!^yz|SKnzax_z3r8X3sk|yidAAKzq!zl4T zrLG?7HtFXa?z^PZQ?w%@rz15Boe{&kZp+lz;T(6Hyahw6H#B4prUSPp*_4~xiM+Ah zkCM@|j&Np+ju^W1Z2ijRt*d&K)n{^W=7&PW+_o$y^hZvxG-N>#EuC6kUN+Ues->N1 z-%M{>PV8H^R`65ao8t3EHKdkR^lhRDrfO#%%?;T0=EZp<8(?YqW|6p{#6D2RLzxY@ z2IkGws*;bW$3~7H%v4b+N0f#UB(R8?@_AY{mIq{WlW?X6-j6Gd>t;?kzJ#HityQIG z(lxBVQq`{h3A>VhwNX^5Xsf?9!)p}E^|JHdqYFYE8#tywCAlpfTCQEKLfwPha)OlA zriRQDr7`!Elt>e7UzpP7&BD%0E6-{a^Wl&hMb=D>!m%IT|D-0k0d0+(7DKUU)EMt& z4a~HSwIQEi)RSIsBY*2ub|BqV!Z5kvA7$YsH0e<0(QDqIv4G@`|8nm5v#wD~IDQCs z)lZ_4Y7J`>3%qL4n057A>CVU(aQ3DX9M>x+jP zt17|V@iDz+Vx@MiNFl|6q{He}y%L_nIoP_Md$npnkY?nGncY|Kg^9})*-Y_Bi$0K6 z8SYG;l2$Fwy~?TaG{%l2PNFzhRheXxx*{r)Cz>0;LDQv~E2RXhh7aVVuA-Xj=u}-j zMbmQR7nS84v3}Z`9Mv0|)MApbPo`K5JzFFxGe&S)@TvCvm4IQ%C+rOvR^uUqalmP+ zC50qq6!ledZtdp0u{ZPuQ=2cl?*yC~H1b3Hv@vq_?NcYGxRfiWr=nXn#k|clV7=@2 zDo5TSsUf=SZdK{~>o6aC+8eTj)peG8tRTV$gn4%@N8Z@INFq16GuEzP}47ZQHyiLnAHHeR@%#~-V%xBQx)X2Mmj|`+Ez987> zqBD*laZl|vGv9JtcL(}7DH~QZFK~8PaHx#UN;ASpm){V?$J|c@l-$hswdg}R^m#CY zd+Im}$y@GTG@94Svf0McAi3!*%bTW^3P13L&$uN$1LNW&YLlPvT3tzokR2p#x(dKpaX2utSd6tBvw;r&Wb{!! zHDTq!Gp~UluTJX3)YEG^(*+p;#%CQ#Uj4~N;280{<;jr`qrG)RBm|^J2xLkKSX^Y` zKn#16)62`#x@@&0O(vWQXQ*gKDc(jED3Qf=O5|y`H&I2a$j6i#MkB?4lfxT^8gi+Ls2qk0 z3|BFSDdzcx`XBQ%^E`{nHX6x{8XJ+C)Fl>*Fu)| EA4F1o_W%F@ diff --git a/src/components/application.js b/src/components/application.js index d23ace2..89bc774 100644 --- a/src/components/application.js +++ b/src/components/application.js @@ -1,13 +1,20 @@ import React from 'react'; import { withRouter } from 'react-router'; -import { Image, Row, Col, Typography, Space, Button } from 'antd'; +import { Image, Row, Col, Typography, Space, Button, Form, Input } from 'antd'; import { status, json } from '../utilities/requestHandlers'; +import { Component } from 'react'; +import Select from 'react-select'; import UserContext from '../contexts/user'; import {useContext} from 'react'; const { Title, Paragraph } = Typography; +const formItemLayout = { + labelCol: { xs: { span: 24 }, sm: { span: 6 } }, + wrapperCol: { xs: { span: 24 }, sm: { span: 12 } } +}; + class Application extends React.Component { static contextType = UserContext; @@ -15,18 +22,19 @@ class Application extends React.Component { constructor(props) { super(props); this.deleteHandler = this.deleteHandler.bind(this) + this.edit = this.edit.bind(this) this.state = { application: {} } } + componentDidMount() { const id = this.props.match.params.id; // available using withRouter() const username = this.context.user.username const password = this.context.user.password - const url = "https://animal-hello-3000.codio-box.uk/api/v1/applications/${id}" - fetch(url, { - method: "GET", + fetch(`https://animal-hello-3000.codio-box.uk/api/v1/applications/${id}`, { + method: 'GET', headers: { "Authorization": "Basic " + btoa(username + ":" + password) }, @@ -34,13 +42,41 @@ class Application extends React.Component { .then(status) .then(json) .then(application => { - console.log(application) this.setState({application:application}) }) .catch(err => { console.log(`Fetch error for application ${id}`) }); - } + }; + + + edit(values){ //Edit application + if (this.context.user.loggedIn){ + const id = this.props.match.params.id; + console.log(values) + const {status}=values + values.userID=this.context.user.ID + const { confirm, ...data } = values; + fetch(`https://animal-hello-3000.codio-box.uk/api/v1/applications/${id}`, { + method: "PUT", + body: data, + headers:{ + "Authorization": "Basic " + btoa("andre" + ":" + "12345") + } + }) + .then(status) + .then(json) + .then(data => { + console.log("updated succesfully"); + console.log(data) + this.setState({redirect:"/"}) + }) + .catch(errorResponse => { + console.log('Update failed'); + alert(`Error: ${JSON.stringify(errorResponse)}`); + }); + }; + }; deleteHandler() { const username = this.context.user.username @@ -62,19 +98,28 @@ class Application extends React.Component { }); } - render() { +render() { + if (!this.state.application) { + return

Loading application...

+ } const application = this.state.application; //Error Here!! Change the user.role to a valid verification let adminSpace = - if(this.context.user.loggedIn){ + if(this.context.user.loggedIn){ //Add user.role so that only admins can change it! adminSpace = - + } + + const options = [ + { value: 'pending', label: 'Pending' }, + { value: 'accepted', label: 'Accepted' }, + { value: 'rejected', label: 'Rejected' }, + ] - return( //add {adminSpace} here + return(
@@ -88,6 +133,11 @@ class Application extends React.Component { Founded in: {application.dateFunded} Created In: {application.dateCreated} Status: {application.status} +
+ +