add update function to master formularium

This commit is contained in:
2023-10-30 09:59:03 +07:00
parent 87864a496c
commit 759e692465
11 changed files with 2333 additions and 2004 deletions

View File

@@ -56,6 +56,7 @@
"stylis-plugin-rtl": "^2.1.1",
"vite": "^3.2.7",
"vite-plugin-svgr": "^2.4.0",
"yarn": "^1.22.19",
"yup": "^0.32.11"
},
"devDependencies": {
@@ -1936,9 +1937,9 @@
}
},
"node_modules/@babel/traverse": {
"version": "7.23.0",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.0.tgz",
"integrity": "sha512-t/QaEvyIoIkwzpiZ7aoSKK8kObQYeF7T2v+dazAYCb8SXtp58zEVkWW7zAnju8FNKNdr4ScAOEDmMItbyOmEYw==",
"version": "7.23.2",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.2.tgz",
"integrity": "sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==",
"dependencies": {
"@babel/code-frame": "^7.22.13",
"@babel/generator": "^7.23.0",
@@ -2420,6 +2421,16 @@
"node": ">=6.0.0"
}
},
"node_modules/@jridgewell/source-map": {
"version": "0.3.5",
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.5.tgz",
"integrity": "sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==",
"devOptional": true,
"dependencies": {
"@jridgewell/gen-mapping": "^0.3.0",
"@jridgewell/trace-mapping": "^0.3.9"
}
},
"node_modules/@jridgewell/sourcemap-codec": {
"version": "1.4.14",
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
@@ -3883,9 +3894,9 @@
}
},
"node_modules/@typescript-eslint/typescript-estree/node_modules/semver": {
"version": "7.3.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
"integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
"version": "7.5.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
@@ -4221,6 +4232,12 @@
"integrity": "sha1-9wtzXGvKGlycItmCw+Oef+ujva0=",
"dev": true
},
"node_modules/async": {
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==",
"dev": true
},
"node_modules/asynciterator.prototype": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/asynciterator.prototype/-/asynciterator.prototype-1.0.0.tgz",
@@ -4437,9 +4454,9 @@
}
},
"node_modules/browserslist": {
"version": "4.21.9",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.9.tgz",
"integrity": "sha512-M0MFoZzbUrRU4KNfCrDLnvyE7gub+peetoTid3TBIqtunaDJyXlwhakT+/VkvSXcfIzFfK/nkCs4nmyTmxdNSg==",
"version": "4.22.1",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.1.tgz",
"integrity": "sha512-FEVc202+2iuClEhZhrWy6ZiAcRLvNMyYcxZ8raemul1DYVOVdFsbqckWLdsixQZCpJlwe77Z3UTalE7jsjnKfQ==",
"funding": [
{
"type": "opencollective",
@@ -4455,10 +4472,10 @@
}
],
"dependencies": {
"caniuse-lite": "^1.0.30001503",
"electron-to-chromium": "^1.4.431",
"node-releases": "^2.0.12",
"update-browserslist-db": "^1.0.11"
"caniuse-lite": "^1.0.30001541",
"electron-to-chromium": "^1.4.535",
"node-releases": "^2.0.13",
"update-browserslist-db": "^1.0.13"
},
"bin": {
"browserslist": "cli.js"
@@ -4531,9 +4548,9 @@
"integrity": "sha1-IsxKNKCrxDlQ9CxkEQJKP2NmtFo="
},
"node_modules/caniuse-lite": {
"version": "1.0.30001517",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001517.tgz",
"integrity": "sha512-Vdhm5S11DaFVLlyiKu4hiUTkpZu+y1KA/rZZqVQfOD5YdDT/eQKlkt7NaE0WGOFgX32diqt9MiP9CAiFeRklaA==",
"version": "1.0.30001554",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001554.tgz",
"integrity": "sha512-A2E3U//MBwbJVzebddm1YfNp7Nud5Ip+IPn4BozBmn4KqVX7AvluoIDFWjsv5OkGnKUXQVmMSoMKLa3ScCblcQ==",
"funding": [
{
"type": "opencollective",
@@ -4695,28 +4712,18 @@
}
},
"node_modules/core-js-compat": {
"version": "3.21.1",
"resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.21.1.tgz",
"integrity": "sha512-gbgX5AUvMb8gwxC7FLVWYT7Kkgu/y7+h/h1X43yJkNqhlK2fuYyQimqvKGNZFAY6CKii/GFKJ2cp/1/42TN36g==",
"version": "3.33.1",
"resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.33.1.tgz",
"integrity": "sha512-6pYKNOgD/j/bkC5xS5IIg6bncid3rfrI42oBH1SQJbsmYPKF7rhzcFzYCcxYMmNQQ0rCEB8WqpW7QHndOggaeQ==",
"dev": true,
"dependencies": {
"browserslist": "^4.19.1",
"semver": "7.0.0"
"browserslist": "^4.22.1"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/core-js"
}
},
"node_modules/core-js-compat/node_modules/semver": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz",
"integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==",
"dev": true,
"bin": {
"semver": "bin/semver.js"
}
},
"node_modules/core-js-pure": {
"version": "3.21.1",
"resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.21.1.tgz",
@@ -4912,12 +4919,12 @@
}
},
"node_modules/ejs": {
"version": "3.1.6",
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.6.tgz",
"integrity": "sha512-9lt9Zse4hPucPkoP7FHDF0LQAlGyF9JVpnClFLFH3aSSbxmyoqINRpp/9wePWJTUl4KOQwRL72Iw3InHPDkoGw==",
"version": "3.1.9",
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.9.tgz",
"integrity": "sha512-rC+QVNMJWv+MtPgkt0y+0rVEIdbtxVADApW9JXrUVlzHetgcyczP/E7DJmWJ4fJCZF2cPcBk0laWO9ZHMG3DmQ==",
"dev": true,
"dependencies": {
"jake": "^10.6.1"
"jake": "^10.8.5"
},
"bin": {
"ejs": "bin/cli.js"
@@ -4927,9 +4934,9 @@
}
},
"node_modules/electron-to-chromium": {
"version": "1.4.467",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.467.tgz",
"integrity": "sha512-2qI70O+rR4poYeF2grcuS/bCps5KJh6y1jtZMDDEteyKJQrzLOEhFyXCLcHW6DTBjKjWkk26JhWoAi+Ux9A0fg=="
"version": "1.4.568",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.568.tgz",
"integrity": "sha512-3TCOv8+BY6Ltpt1/CmGBMups2IdKOyfEmz4J8yIS4xLSeMm0Rf+psSaxLuswG9qMKt+XbNbmADybtXGpTFlbDg=="
},
"node_modules/emoji-regex": {
"version": "9.2.2",
@@ -5994,12 +6001,33 @@
}
},
"node_modules/filelist": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.2.tgz",
"integrity": "sha512-z7O0IS8Plc39rTCq6i6iHxk43duYOn8uFJiWSewIq0Bww1RNybVHSCjahmcC87ZqAm4OTvFzlzeGu3XAzG1ctQ==",
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz",
"integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==",
"dev": true,
"dependencies": {
"minimatch": "^3.0.4"
"minimatch": "^5.0.1"
}
},
"node_modules/filelist/node_modules/brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dev": true,
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/filelist/node_modules/minimatch": {
"version": "5.1.6",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
"integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
"dev": true,
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=10"
}
},
"node_modules/fill-range": {
@@ -6115,6 +6143,19 @@
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true
},
"node_modules/fsevents": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
"hasInstallScript": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
@@ -6887,29 +6928,93 @@
}
},
"node_modules/jake": {
"version": "10.8.2",
"resolved": "https://registry.npmjs.org/jake/-/jake-10.8.2.tgz",
"integrity": "sha512-eLpKyrfG3mzvGE2Du8VoPbeSkRry093+tyNjdYaBbJS9v17knImYGNXQCUV0gLxQtF82m3E8iRb/wdSQZLoq7A==",
"version": "10.8.7",
"resolved": "https://registry.npmjs.org/jake/-/jake-10.8.7.tgz",
"integrity": "sha512-ZDi3aP+fG/LchyBzUM804VjddnwfSfsdeYkwt8NcbKRvo4rFkjhs456iLFn3k2ZUWvNe4i48WACDbza8fhq2+w==",
"dev": true,
"dependencies": {
"async": "0.9.x",
"chalk": "^2.4.2",
"filelist": "^1.0.1",
"minimatch": "^3.0.4"
"async": "^3.2.3",
"chalk": "^4.0.2",
"filelist": "^1.0.4",
"minimatch": "^3.1.2"
},
"bin": {
"jake": "bin/cli.js"
},
"engines": {
"node": "*"
"node": ">=10"
}
},
"node_modules/jake/node_modules/async": {
"version": "0.9.2",
"resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz",
"integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=",
"node_modules/jake/node_modules/ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"dependencies": {
"color-convert": "^2.0.1"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/jake/node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/jake/node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"dependencies": {
"color-name": "~1.1.4"
},
"engines": {
"node": ">=7.0.0"
}
},
"node_modules/jake/node_modules/color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
"node_modules/jake/node_modules/has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/jake/node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"dependencies": {
"has-flag": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@@ -7208,9 +7313,15 @@
"integrity": "sha512-wynEP02LmIbLpcYw8uBKpcfF6dmg2vcpKqxeH5UcoKEYdExslsdUA4ugFauuaeYdTB76ez6gJW8XAZ6CgkXYxA=="
},
"node_modules/nanoid": {
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz",
"integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==",
"version": "3.3.6",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz",
"integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"bin": {
"nanoid": "bin/nanoid.cjs"
},
@@ -7569,9 +7680,9 @@
}
},
"node_modules/postcss": {
"version": "8.4.18",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.18.tgz",
"integrity": "sha512-Wi8mWhncLJm11GATDaQKobXSNEYGUHeQLiQqDFG1qQ5UTDPTEvKw0Xt5NsTpktGTwLps3ByrWsBrG0rB8YQ9oA==",
"version": "8.4.31",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",
"integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==",
"funding": [
{
"type": "opencollective",
@@ -7580,10 +7691,14 @@
{
"type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/postcss"
},
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"dependencies": {
"nanoid": "^3.3.4",
"nanoid": "^3.3.6",
"picocolors": "^1.0.0",
"source-map-js": "^1.0.2"
},
@@ -8729,14 +8844,14 @@
}
},
"node_modules/terser": {
"version": "5.11.0",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.11.0.tgz",
"integrity": "sha512-uCA9DLanzzWSsN1UirKwylhhRz3aKPInlfmpGfw8VN6jHsAtu8HJtIpeeHHK23rxnE/cDc+yvmq5wqkIC6Kn0A==",
"version": "5.22.0",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.22.0.tgz",
"integrity": "sha512-hHZVLgRA2z4NWcN6aS5rQDc+7Dcy58HOf2zbYwmFcQ+ua3h6eEFf5lIDKTzbWwlazPyOZsFQO8V80/IjVNExEw==",
"devOptional": true,
"dependencies": {
"acorn": "^8.5.0",
"@jridgewell/source-map": "^0.3.3",
"acorn": "^8.8.2",
"commander": "^2.20.0",
"source-map": "~0.7.2",
"source-map-support": "~0.5.20"
},
"bin": {
@@ -8752,15 +8867,6 @@
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"devOptional": true
},
"node_modules/terser/node_modules/source-map": {
"version": "0.7.3",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
"integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==",
"devOptional": true,
"engines": {
"node": ">= 8"
}
},
"node_modules/text-table": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
@@ -9040,9 +9146,9 @@
}
},
"node_modules/update-browserslist-db": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz",
"integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==",
"version": "1.0.13",
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz",
"integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==",
"funding": [
{
"type": "opencollective",
@@ -9844,6 +9950,19 @@
"node": ">= 6"
}
},
"node_modules/yarn": {
"version": "1.22.19",
"resolved": "https://registry.npmjs.org/yarn/-/yarn-1.22.19.tgz",
"integrity": "sha512-/0V5q0WbslqnwP91tirOvldvYISzaqhClxzyUKXYxs07yUILIs5jx/k6CFe8bvKSkds5w+eiOqta39Wk3WxdcQ==",
"hasInstallScript": true,
"bin": {
"yarn": "bin/yarn.js",
"yarnpkg": "bin/yarn.js"
},
"engines": {
"node": ">=4.0.0"
}
},
"node_modules/yocto-queue": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",

View File

@@ -86,6 +86,7 @@
"stylis-plugin-rtl": "^2.1.1",
"vite": "^3.2.7",
"vite-plugin-svgr": "^2.4.0",
"yarn": "^1.22.19",
"yup": "^0.32.11"
},
"devDependencies": {

View File

@@ -45,7 +45,7 @@ export default function CategoryDetail({props, formularium} : ParamsDetail) {
console.log(dataValue)
setDialogOpen(isOpen)
setDataValue(dataValue)
setDescriptionValue('Are you sure to inactive this service ?')
setDescriptionValue('Are you sure to inactive this formularium ?')
setUrl(url)
};
@@ -216,7 +216,6 @@ export default function CategoryDetail({props, formularium} : ParamsDetail) {
</TableRow>
</TableBody>
{/* TODO: dialog update status */}
<DialogUpdateStatus
openDialog={isDialogOpen}
setOpenDialog={setDialogOpen}

View File

@@ -267,7 +267,7 @@ import {
</Box>{' '}
Failed
{importResult.data.failed_rows.map((row, index) => (
<Typography variant='body' key={index} color="error"> [Code=>{row.code ? row.code : 'Required'},Name=>{row.name ? row.name : 'Required'}]</Typography>
<Typography variant='body' key={index} color="error"> [Code={row.code ? row.code : 'Required'},Name={row.name ? row.name : 'Required'}]</Typography>
))}
</Box>
</Stack>

View File

@@ -331,6 +331,7 @@ export default function List() {
// console.log(response.data);
setDataTableLoading(false);
console.log(formularium_template_id)
setDataTableData(response.data);
}

View File

@@ -0,0 +1,102 @@
// @mui
import { Box, Button, Card, Collapse, IconButton, InputLabel, MenuItem, OutlinedInput, Paper, Grid, Select, SelectChangeEvent, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, TextField, Typography, Badge, Tab, Tabs, CardHeader, Stack, Menu, ButtonGroup, Pagination } from '@mui/material';
import { LoadingButton } from "@mui/lab";
import { CachedOutlined, FindInPageOutlined } from '@mui/icons-material';
// hooks
import React, { ChangeEvent, Component, useEffect, useRef, useState } from 'react';
import useSettings from '../../../../hooks/useSettings';
import { useNavigate, useParams, useSearchParams } from 'react-router-dom';
import { RHFSelect, FormProvider } from '@/components/hook-form';
import { yupResolver } from '@hookform/resolvers/yup';
import { useForm } from 'react-hook-form';
// components
import axios from '../../../../utils/axios';
import Label from '@/components/Label';
import TableMoreMenu from '@/components/table/TableMoreMenu';
import DialogUpdateStatus from '@/components/DialogUpdateStatus'
import * as Yup from 'yup';
import { FormulariumData } from "../Type";
type Props = {
props: FormulariumData,
isActive: number,
}
export default function DetailFormularium({props, isActive} : Props) {
const [open, setOpen] = React.useState(false);
return (
<TableBody>
<TableRow>
<TableCell align='left' width={50} />
<TableCell align='left'>{props.code}</TableCell>
<TableCell align='left'>{props.atc_code}</TableCell>
<TableCell align='left'>{props.name}</TableCell>
<TableCell align='left'>{props.category_name}</TableCell>
<TableCell align='left'>{props.uom}</TableCell>
<TableCell align='left'>
{isActive == 1 ? (
<Label color='success'>Active</Label>
) : (
<Label color='error'>Inactive</Label>
)}
</TableCell>
<TableCell align='center' width={100}>
<TableMoreMenu actions = {
<>
<MenuItem onClick={() => setOpen(!open)}>
<FindInPageOutlined />
Detail
</MenuItem>
</>
} />
</TableCell>
</TableRow>
<TableRow>
<TableCell colSpan={8} style={{paddingBottom: 0, paddingTop: 0}}>
<Collapse in={open} timeout='auto' unmountOnExit>
<Card sx={{paddingX:2, paddingY:2, marginBottom:3}}>
<Box sx={{margin: 1, pb: 2}}>
<Grid container>
<Grid item>
<Typography sx={{fontWeight: '600', mb: 1}}>Detail</Typography>
<Grid container>
<Grid item xs={2}>Description</Grid>
<Grid item xs={10}> : {props.description}</Grid>
<Grid item xs={2}>General Indication</Grid>
<Grid item xs={10}> : {props.general_indication}</Grid>
<Grid item xs={2}>Composition</Grid>
<Grid item xs={10}> : {props.composition}</Grid>
<Grid item xs={2}>Kategori Obat</Grid>
<Grid item xs={10}> : {props.kategori_obat}</Grid>
<Grid item xs={2}>BPOM Registration</Grid>
<Grid item xs={10}> : {props.bpom_registration}</Grid>
<Grid item xs={2}>Classification</Grid>
<Grid item xs={10}> : {props.classifications}</Grid>
<Grid item xs={2}>Cat For</Grid>
<Grid item xs={10}> : {props.cat_for}</Grid>
<Grid item xs={2}>Class</Grid>
<Grid item xs={10}> : {props.class}</Grid>
<Grid item xs={2}>Manufacturer</Grid>
<Grid item xs={10}> : {props.manufacturer}</Grid>
</Grid>
</Grid>
</Grid>
</Box>
</Card>
</Collapse>
</TableCell>
</TableRow>
</TableBody>
)
}

View File

@@ -8,20 +8,23 @@ import CancelIcon from '@mui/icons-material/Cancel';
// hooks
import React, { ChangeEvent, Component, useEffect, useRef, useState } from 'react';
import useSettings from '../../../../hooks/useSettings';
import { useNavigate, useParams, useSearchParams } from 'react-router-dom';
import { useLocation, useNavigate, useParams, useSearchParams } from 'react-router-dom';
// components
import axios from '../../../../utils/axios';
import { LaravelPaginatedData } from '../../../../@types/paginated-data';
import { Icd } from '../../../../@types/diagnosis';
import BasePagination from '../../../../components/BasePagination';
import { enqueueSnackbar } from 'notistack';
import DetailFormularium from "./DetailFormularium";
import { FormulariumData } from '../Type';
export default function List() {
const navigate = useNavigate();
const { master_formularium_id } = useParams();
const { id: formularium_template_id } = useParams();
const [searchParams, setSearchParams] = useSearchParams();
const [importResult, setImportResult] = useState(null);
const { isActive } = useLocation().state as { isActive: number }
function SearchInput(props: any) {
const searchInput = useRef<HTMLInputElement>(null);
@@ -105,7 +108,7 @@ export default function List() {
}
const handleFormulariumList = async (appliedFilter = null) => {
axios.get(`master/formulariums/${master_formularium_id}/list`)
axios.get(`master/formulariums/${formularium_template_id}/list`)
.then((response) => {
const link = document.createElement('a');
link.href = response.data.data.file_url;
@@ -124,7 +127,7 @@ export default function List() {
if (importForm.current?.files?.length) {
const formData = new FormData();
formData.append('file', importForm.current?.files[0])
axios.post(`master/formularium/${master_formularium_id}/import`, formData )
axios.post(`master/formularium/${formularium_template_id}/import`, formData )
.then(response => {
handleCancelImportButton();
loadDataTableData();
@@ -216,7 +219,7 @@ export default function List() {
}
// Default data
const [dataTableRow, setDataTableRow] = useState<[] | null>(null)
const [dataTableRow, setDataTableRow] = useState<FormulariumData[] | null>(null)
const [dataTableIsLoading, setDataTableLoading] = useState(true);
const [dataTableData, setDataTableData] = useState<LaravelPaginatedData>({
current_page: 1,
@@ -236,9 +239,11 @@ export default function List() {
const loadDataTableData = async (appliedFilter : any | null = null) => {
setDataTableLoading(true);
const filter = appliedFilter ? appliedFilter : Object.fromEntries([...searchParams.entries()]);
const response = await axios.get(`/master/formulariums/${master_formularium_id}`, { params: filter });
const response = await axios.get(`/master/formulariums/${formularium_template_id}`, { params: filter });
setDataTableLoading(false);
console.log(formularium_template_id)
console.log(response)
setDataTableData(response.data)
setDataTableRow(response.data.data)
}
@@ -276,9 +281,31 @@ export default function List() {
<TableCell style={headStyle} align='left'>Name</TableCell>
<TableCell style={headStyle} align='left'>Category Name</TableCell>
<TableCell style={headStyle} align='left'>UOM</TableCell>
<TableCell style={headStyle} align='left'>Status</TableCell>
<TableCell style={headStyle} align='center' width={100}></TableCell>
</TableRow>
</TableHead>
{dataTableIsLoading ? (
<TableBody>
<TableRow>
<TableCell colSpan={8} align='center'>
Loading
</TableCell>
</TableRow>
</TableBody>
) : dataTableData.data.length == 0 ? (
<TableBody>
<TableRow>
<TableCell colSpan={8} align='center'>
No Data
</TableCell>
</TableRow>
</TableBody>
) : (
dataTableRow?.map(item => (
<DetailFormularium props={item} isActive={isActive}/>
))
)}
</Table>
</TableContainer>

View File

@@ -8,7 +8,7 @@ import List from "./Formularium";
export default function Formularium() {
const pageTitle = "Formularium"
const { id } = useParams();
const { id: formularium_template_id } = useParams();
return (
<Page title={ pageTitle }>
@@ -25,7 +25,7 @@ export default function Formularium() {
},
{
name: 'Detail',
href: `/master/formularium-template-v2/${id}/detail`
href: `/master/formularium-template-v2/${formularium_template_id}/detail`
},
]}
/>

View File

@@ -1,13 +1,19 @@
import * as Yup from 'yup';
import TableMoreMenu from "@/components/table/TableMoreMenu"
import EditOutlinedIcon from '@mui/icons-material/EditOutlined';
import CachedOutlinedIcon from '@mui/icons-material/CachedOutlined';
import HistoryIcon from '@mui/icons-material/History';
import FindInPageOutlinedIcon from '@mui/icons-material/FindInPageOutlined';
import { Collapse, Grid, MenuItem, Paper, Table, TableCell, TableContainer, TableHead, TableRow } from "@mui/material"
import React, { useEffect } from "react";
import { Button, Card, Collapse, Grid, MenuItem, Paper, Stack, Table, TableCell, TableContainer, TableHead, TableRow, Typography } from "@mui/material"
import React, { Fragment, useEffect, useState } from "react";
import axios from "@/utils/axios";
import { useNavigate, useParams } from "react-router-dom";
import { RHFSelect, FormProvider } from '@/components/hook-form';
import DialogUpdateStatus from '@/components/DialogUpdateStatus'
import { MasterFormularium } from "./Type";
import { LoadingButton } from "@mui/lab";
import { useForm } from 'react-hook-form';
import { yupResolver } from '@hookform/resolvers/yup';
type Props = {
props: MasterFormularium
@@ -16,33 +22,190 @@ type Props = {
export default function FormulariumRow({props} : Props) {
const navigate = useNavigate();
const [isDialogOpen, setDialogOpen] = useState(false);
const [dataValue, setDataValue] = useState<MasterFormularium | null>(null);
const [dataDescription, setDescriptionValue] = useState('');
const [url, setUrl] = useState('');
let titles = {
name: 'Update Status',
icon: '-'
}
type FormValuesProps = {
value: string;
active: boolean;
};
const handleActivate = (isOpen: boolean, dataValue: MasterFormularium) => {
setDialogOpen(isOpen);
setDataValue(dataValue);
setDescriptionValue("Are you sure to inactive this formularium ? ");
setUrl(url);
};
const NewMasterFormSchema = Yup.object().shape({
reason: Yup.string().required('Reason edit is required')
});
const methods = useForm<FormValuesProps>({
resolver: yupResolver(NewMasterFormSchema)
});
const onSubmit = async (row: any) => {
try {
handleUpdate(dataValue?.active, dataValue?.id, row.reason)
} catch (error: any) {
console.log('data gagal');
}
const ascent = document?.querySelector('ascent');
if (ascent != null) {
ascent.innerHTML = '';
}
};
const handleUpdate = (active: number, id: number, reason: string) => {
if (active == 1) {
active = 0
} else {
active = 1
}
axios
.put(`/master/formularium-template/${id}/activation`, {
active: active,
})
.then((res) => {
window.location.reload();
})
}
const {
reset,
handleSubmit,
formState: { isSubmitting },
} = methods;
const getContent = () => (
<>
<Stack paddingX={2} paddingY={2}>
<Typography variant='subtitle1'>Are you sure to Change this Formularium</Typography>
<Stack>
<Card>
<Grid container paddingX={2} paddingY={2}>
<Grid item xs={5} md={5}>
<Typography variant="inherit">Formularium name</Typography>
</Grid>
<Grid item xs={7}>
<Typography variant="subtitle1">{dataValue?.name}</Typography>
</Grid>
</Grid>
</Card>
<Typography marginTop={5} marginBottom={3} variant="subtitle1">Reason for update</Typography>
<FormProvider methods={methods} onSubmit={handleSubmit(onSubmit)}>
<RHFSelect
name="reason"
label="Reason for update"
>
<option value=""></option>
<option value="Agreement changed">Agreement changed</option>
<option value="Endorsement">Endorsement</option>
<option value="Renewal">Renewal</option>
<option value="Wrong Setting">Wrong Setting</option>
</RHFSelect>
<Stack
alignItems='center'
justifyContent='flex-end'
direction={{xs: 'column', md: 'row'}}
spacing={2}
marginTop={5}
>
<Stack direction='row' spacing={1}>
<Button
sx={{boxShadow: 'none'}}
variant='outlined'
size='medium'
fullWidth={true}
onClick={() => setDialogOpen(false)}
>
Cancel
</Button>
{dataValue?.active == 1 ?
<LoadingButton
sx={{boxShadow: '0px 2px 4px rgba(0,0,0,0.1)'}}
type='submit'
variant='contained'
size='medium'
fullWidth={true}
loading={isSubmitting}
color='error'
>
Inactive
</LoadingButton> :
<LoadingButton
sx={{boxShadow: '0px 2px 4px rgba(0,0,0,0.1)'}}
type='submit'
variant='contained'
size='medium'
fullWidth={true}
loading={isSubmitting}
color='success'
>
Active
</LoadingButton>
}
</Stack>
</Stack>
</FormProvider>
</Stack>
</Stack>
</>
)
return (
<TableRow>
<TableCell align="left" width={50}></TableCell>
<TableCell align="left">{props.name}</TableCell>
<TableCell align="left">{props.description}</TableCell>
<TableCell align="center" width={100}>
<TableMoreMenu actions = {
<>
<MenuItem onClick={() => navigate(`/master/formularium-template-v2/${props.id}/detail`)}>
<FindInPageOutlinedIcon />
Detail
</MenuItem>
<MenuItem onClick={() => navigate(`/master/formularium-template-v2/${props.id}/edit`)}>
<EditOutlinedIcon />
Edit
</MenuItem>
<MenuItem>
<CachedOutlinedIcon />
Update Status
</MenuItem>
<MenuItem onClick={() => navigate(`/master/formularium-template-v2/${props.id}/history`)}>
<HistoryIcon />
History
</MenuItem>
</>
} />
</TableCell>
</TableRow>
<Fragment>
<TableRow>
<TableCell align="left" width={50}></TableCell>
<TableCell align="left">{props.name}</TableCell>
<TableCell align="left">{props.description}</TableCell>
<TableCell align="center" width={100}>
<TableMoreMenu actions = {
<>
<MenuItem onClick={() => navigate(`/master/formularium-template-v2/${props.id}/detail`, {state: { isActive: props.active }})}>
<FindInPageOutlinedIcon />
Detail
</MenuItem>
<MenuItem onClick={() => navigate(`/master/formularium-template-v2/${props.id}/edit`)}>
<EditOutlinedIcon />
Edit
</MenuItem>
<MenuItem onClick={() => handleActivate(true, {
id: props.id,
name: props.name,
description: props.description,
active: props.active
})
}>
<CachedOutlinedIcon />
Update Status
</MenuItem>
<MenuItem onClick={() => navigate(`/master/formularium-template-v2/${props.id}/history`)}>
<HistoryIcon />
History
</MenuItem>
</>
} />
</TableCell>
</TableRow>
<DialogUpdateStatus
openDialog={isDialogOpen}
setOpenDialog={setDialogOpen}
description={dataDescription}
title={titles}
data={dataValue}
content={getContent()}
/>
</Fragment>
)
}

View File

@@ -2,6 +2,7 @@ export type MasterFormularium = {
id: number
name: string
description: string
active: number
}

File diff suppressed because it is too large Load Diff