@openmrs/esm-stock-management-app 1.0.1-pre.383 → 1.0.1-pre.390
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/39.js +1 -0
- package/dist/39.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-stock-management-app.js +1 -1
- package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +23 -23
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/index.ts +18 -0
- package/src/routes.json +56 -51
- package/src/stock-items/add-stock-item/packaging-units/packaging-units-delete-modal-button.component.tsx +34 -0
- package/src/stock-items/add-stock-item/packaging-units/packaging-units-delete-modal.component.tsx +100 -0
- package/src/stock-items/add-stock-item/packaging-units/packaging-units.component.tsx +36 -79
- package/src/stock-items/add-stock-item/packaging-units/packaging-units.scss +25 -2
- package/src/stock-items/add-stock-item/packaging-units-concept-selector/packaging-units-concept-selector.component.tsx +1 -1
- package/src/stock-operations/add-stock-operation/stock-operation-submission.component.tsx +8 -3
- package/dist/56.js +0 -1
- package/dist/56.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
var _openmrs_esm_stock_management_app;(()=>{"use strict";var e,r,t,n,o,a,i,l,s,u,f,p,c,d,h,m,v,g={1371:(e,r,t)=>{var n={"./start":()=>Promise.all([t.e(935),t.e(835),t.e(672),t.e(
|
1
|
+
var _openmrs_esm_stock_management_app;(()=>{"use strict";var e,r,t,n,o,a,i,l,s,u,f,p,c,d,h,m,v,g={1371:(e,r,t)=>{var n={"./start":()=>Promise.all([t.e(935),t.e(835),t.e(672),t.e(39)]).then((()=>()=>t(3529)))},o=(e,r)=>(t.R=r,r=t.o(n,e)?n[e]():Promise.resolve().then((()=>{throw new Error('Module "'+e+'" does not exist in container.')})),t.R=void 0,r),a=(e,r)=>{if(t.S){var n="default",o=t.S[n];if(o&&o!==e)throw new Error("Container initialization failed as it has already been initialized with a different share scope");return t.S[n]=e,t.I(n,r)}};t.d(r,{get:()=>o,init:()=>a})}},b={};function y(e){var r=b[e];if(void 0!==r)return r.exports;var t=b[e]={id:e,loaded:!1,exports:{}};return g[e].call(t.exports,t,t.exports,y),t.loaded=!0,t.exports}y.m=g,y.c=b,y.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return y.d(r,{a:r}),r},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,y.t=function(t,n){if(1&n&&(t=this(t)),8&n)return t;if("object"==typeof t&&t){if(4&n&&t.__esModule)return t;if(16&n&&"function"==typeof t.then)return t}var o=Object.create(null);y.r(o);var a={};e=e||[null,r({}),r([]),r(r)];for(var i=2&n&&t;"object"==typeof i&&!~e.indexOf(i);i=r(i))Object.getOwnPropertyNames(i).forEach((e=>a[e]=()=>t[e]));return a.default=()=>t,y.d(o,a),o},y.d=(e,r)=>{for(var t in r)y.o(r,t)&&!y.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},y.f={},y.e=e=>Promise.all(Object.keys(y.f).reduce(((r,t)=>(y.f[t](e,r),r)),[])),y.u=e=>e+".js",y.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),y.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t={},n="@openmrs/esm-stock-management-app:",y.l=(e,r,o,a)=>{if(t[e])t[e].push(r);else{var i,l;if(void 0!==o)for(var s=document.getElementsByTagName("script"),u=0;u<s.length;u++){var f=s[u];if(f.getAttribute("src")==e||f.getAttribute("data-webpack")==n+o){i=f;break}}i||(l=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,y.nc&&i.setAttribute("nonce",y.nc),i.setAttribute("data-webpack",n+o),i.src=e),t[e]=[r];var p=(r,n)=>{i.onerror=i.onload=null,clearTimeout(c);var o=t[e];if(delete t[e],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach((e=>e(n))),r)return r(n)},c=setTimeout(p.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=p.bind(null,i.onerror),i.onload=p.bind(null,i.onload),l&&document.head.appendChild(i)}},y.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},y.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{y.S={};var e={},r={};y.I=(t,n)=>{n||(n=[]);var o=r[t];if(o||(o=r[t]={}),!(n.indexOf(o)>=0)){if(n.push(o),e[t])return e[t];y.o(y.S,t)||(y.S[t]={});var a=y.S[t],i="@openmrs/esm-stock-management-app",l=(e,r,t,n)=>{var o=a[e]=a[e]||{},l=o[r];(!l||!l.loaded&&(!n!=!l.eager?n:i>l.from))&&(o[r]={get:t,from:i,eager:!!n})},s=[];return"default"===t&&(l("@openmrs/esm-framework","5.4.1-pre.1561",(()=>Promise.all([y.e(800),y.e(672)]).then((()=>()=>y(4800))))),l("dayjs","1.11.10",(()=>y.e(484).then((()=>()=>y(7484))))),l("react-i18next","11.18.6",(()=>Promise.all([y.e(672),y.e(629)]).then((()=>()=>y(707))))),l("react-router-dom","6.21.1",(()=>Promise.all([y.e(26),y.e(935),y.e(672)]).then((()=>()=>y(8026))))),l("react","18.2.0",(()=>y.e(294).then((()=>()=>y(7294))))),l("swr/_internal","2.2.5",(()=>Promise.all([y.e(46),y.e(672)]).then((()=>()=>y(46)))))),e[t]=s.length?Promise.all(s).then((()=>e[t]=1)):1}}})(),(()=>{var e;y.g.importScripts&&(e=y.g.location+"");var r=y.g.document;if(!e&&r&&(r.currentScript&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&!e;)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),y.p=e})(),o=e=>{var r=e=>e.split(".").map((e=>+e==e?+e:e)),t=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(e),n=t[1]?r(t[1]):[];return t[2]&&(n.length++,n.push.apply(n,r(t[2]))),t[3]&&(n.push([]),n.push.apply(n,r(t[3]))),n},a=(e,r)=>{e=o(e),r=o(r);for(var t=0;;){if(t>=e.length)return t<r.length&&"u"!=(typeof r[t])[0];var n=e[t],a=(typeof n)[0];if(t>=r.length)return"u"==a;var i=r[t],l=(typeof i)[0];if(a!=l)return"o"==a&&"n"==l||"s"==l||"u"==a;if("o"!=a&&"u"!=a&&n!=i)return n<i;t++}},i=e=>{var r=e[0],t="";if(1===e.length)return"*";if(r+.5){t+=0==r?">=":-1==r?"<":1==r?"^":2==r?"~":r>0?"=":"!=";for(var n=1,o=1;o<e.length;o++)n--,t+="u"==(typeof(l=e[o]))[0]?"-":(n>0?".":"")+(n=2,l);return t}var a=[];for(o=1;o<e.length;o++){var l=e[o];a.push(0===l?"not("+s()+")":1===l?"("+s()+" || "+s()+")":2===l?a.pop()+" "+a.pop():i(l))}return s();function s(){return a.pop().replace(/^\((.+)\)$/,"$1")}},l=(e,r)=>{if(0 in e){r=o(r);var t=e[0],n=t<0;n&&(t=-t-1);for(var a=0,i=1,s=!0;;i++,a++){var u,f,p=i<e.length?(typeof e[i])[0]:"";if(a>=r.length||"o"==(f=(typeof(u=r[a]))[0]))return!s||("u"==p?i>t&&!n:""==p!=n);if("u"==f){if(!s||"u"!=p)return!1}else if(s)if(p==f)if(i<=t){if(u!=e[i])return!1}else{if(n?u>e[i]:u<e[i])return!1;u!=e[i]&&(s=!1)}else if("s"!=p&&"n"!=p){if(n||i<=t)return!1;s=!1,i--}else{if(i<=t||f<p!=n)return!1;s=!1}else"s"!=p&&"n"!=p&&(s=!1,i--)}}var c=[],d=c.pop.bind(c);for(a=1;a<e.length;a++){var h=e[a];c.push(1==h?d()|d():2==h?d()&d():h?l(h,r):!d())}return!!d()},s=(e,r)=>{var t=e[r];return Object.keys(t).reduce(((e,r)=>!e||!t[e].loaded&&a(e,r)?r:e),0)},u=(e,r,t,n)=>"Unsatisfied version "+t+" from "+(t&&e[r][t].from)+" of shared singleton module "+r+" (required "+i(n)+")",f=(e,r,t,n)=>{var o=s(e,t);return l(n,o)||p(u(e,t,o,n)),c(e[t][o])},p=e=>{"undefined"!=typeof console&&console.warn&&console.warn(e)},c=e=>(e.loaded=1,e.get()),d=(e=>function(r,t,n,o){var a=y.I(r);return a&&a.then?a.then(e.bind(e,r,y.S[r],t,n,o)):e(0,y.S[r],t,n,o)})(((e,r,t,n,o)=>r&&y.o(r,t)?f(r,0,t,n):o())),h={},m={1672:()=>d("default","react",[1,18],(()=>y.e(294).then((()=>()=>y(7294))))),1914:()=>d("default","react-router-dom",[1,6],(()=>y.e(26).then((()=>()=>y(8026))))),2653:()=>d("default","dayjs",[1,1],(()=>y.e(484).then((()=>()=>y(7484))))),3397:()=>d("default","react-i18next",[1,11],(()=>y.e(707).then((()=>()=>y(707))))),5512:()=>d("default","swr/_internal",[1,2],(()=>y.e(46).then((()=>()=>y(46))))),7248:()=>d("default","@openmrs/esm-framework",[1,5],(()=>y.e(800).then((()=>()=>y(4800)))))},v={39:[1914,2653,3397,5512,7248],672:[1672]},y.f.consumes=(e,r)=>{y.o(v,e)&&v[e].forEach((e=>{if(y.o(h,e))return r.push(h[e]);var t=r=>{h[e]=0,y.m[e]=t=>{delete y.c[e],t.exports=r()}},n=r=>{delete h[e],y.m[e]=t=>{throw delete y.c[e],r}};try{var o=m[e]();o.then?r.push(h[e]=o.then(t).catch(n)):t(o)}catch(e){n(e)}}))},(()=>{var e={122:0};y.f.j=(r,t)=>{var n=y.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else if(672!=r){var o=new Promise(((t,o)=>n=e[r]=[t,o]));t.push(n[2]=o);var a=y.p+y.u(r),i=new Error;y.l(a,(t=>{if(y.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var o=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;i.message="Loading chunk "+r+" failed.\n("+o+": "+a+")",i.name="ChunkLoadError",i.type=o,i.request=a,n[1](i)}}),"chunk-"+r,r)}else e[r]=0};var r=(r,t)=>{var n,o,[a,i,l]=t,s=0;if(a.some((r=>0!==e[r]))){for(n in i)y.o(i,n)&&(y.m[n]=i[n]);l&&l(y)}for(r&&r(t);s<a.length;s++)o=a[s],y.o(e,o)&&e[o]&&e[o][0](),e[o]=0},t=globalThis.webpackChunk_openmrs_esm_stock_management_app=globalThis.webpackChunk_openmrs_esm_stock_management_app||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),y.nc=void 0;var _=y(1371);_openmrs_esm_stock_management_app=_})();
|
@@ -32,26 +32,23 @@
|
|
32
32
|
"initial": false,
|
33
33
|
"entry": false,
|
34
34
|
"recorded": false,
|
35
|
-
"
|
36
|
-
"size": 25608,
|
35
|
+
"size": 1033166,
|
37
36
|
"sizes": {
|
38
|
-
"javascript":
|
37
|
+
"javascript": 1032956,
|
38
|
+
"consume-shared": 210
|
39
39
|
},
|
40
40
|
"names": [],
|
41
|
-
"idHints": [
|
42
|
-
"vendors"
|
43
|
-
],
|
41
|
+
"idHints": [],
|
44
42
|
"runtime": [
|
45
|
-
"@openmrs/esm-stock-management-app"
|
46
|
-
"main"
|
43
|
+
"@openmrs/esm-stock-management-app"
|
47
44
|
],
|
48
45
|
"files": [
|
49
|
-
"
|
46
|
+
"39.js"
|
50
47
|
],
|
51
48
|
"auxiliaryFiles": [
|
52
|
-
"
|
49
|
+
"39.js.map"
|
53
50
|
],
|
54
|
-
"hash": "
|
51
|
+
"hash": "2cbfcdfa0269bf60",
|
55
52
|
"childrenByOrder": {}
|
56
53
|
},
|
57
54
|
{
|
@@ -59,23 +56,26 @@
|
|
59
56
|
"initial": false,
|
60
57
|
"entry": false,
|
61
58
|
"recorded": false,
|
62
|
-
"
|
59
|
+
"reason": "reused as split chunk (cache group: defaultVendors)",
|
60
|
+
"size": 25608,
|
63
61
|
"sizes": {
|
64
|
-
"javascript":
|
65
|
-
"consume-shared": 210
|
62
|
+
"javascript": 25608
|
66
63
|
},
|
67
64
|
"names": [],
|
68
|
-
"idHints": [
|
65
|
+
"idHints": [
|
66
|
+
"vendors"
|
67
|
+
],
|
69
68
|
"runtime": [
|
70
|
-
"@openmrs/esm-stock-management-app"
|
69
|
+
"@openmrs/esm-stock-management-app",
|
70
|
+
"main"
|
71
71
|
],
|
72
72
|
"files": [
|
73
|
-
"
|
73
|
+
"46.js"
|
74
74
|
],
|
75
75
|
"auxiliaryFiles": [
|
76
|
-
"
|
76
|
+
"46.js.map"
|
77
77
|
],
|
78
|
-
"hash": "
|
78
|
+
"hash": "acc8ddae60337eb2",
|
79
79
|
"childrenByOrder": {}
|
80
80
|
},
|
81
81
|
{
|
@@ -102,7 +102,7 @@
|
|
102
102
|
"auxiliaryFiles": [
|
103
103
|
"openmrs-esm-stock-management-app.js.map"
|
104
104
|
],
|
105
|
-
"hash": "
|
105
|
+
"hash": "2e753c4548057b13",
|
106
106
|
"childrenByOrder": {}
|
107
107
|
},
|
108
108
|
{
|
@@ -110,10 +110,10 @@
|
|
110
110
|
"initial": true,
|
111
111
|
"entry": true,
|
112
112
|
"recorded": false,
|
113
|
-
"size":
|
113
|
+
"size": 4782215,
|
114
114
|
"sizes": {
|
115
115
|
"consume-shared": 252,
|
116
|
-
"javascript":
|
116
|
+
"javascript": 4760267,
|
117
117
|
"share-init": 252,
|
118
118
|
"runtime": 21444
|
119
119
|
},
|
@@ -130,7 +130,7 @@
|
|
130
130
|
"auxiliaryFiles": [
|
131
131
|
"main.js.map"
|
132
132
|
],
|
133
|
-
"hash": "
|
133
|
+
"hash": "c181c28d434fae3b",
|
134
134
|
"childrenByOrder": {}
|
135
135
|
},
|
136
136
|
{
|
package/dist/routes.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":"^2.24.0"},"extensions":[{"name":"stock-management-dashboard","slot":"stock-management-dashboard-slot","component":"stockManagementDashboard"},{"name":"stock-management-admin-card-link","slot":"system-admin-page-card-link-slot","component":"stockManagementAdminCardLink"},{"name":"stock-operation-dialog","component":"stockOperationDialog"},{"name":"import-bulk-stock-items","component":"importBulkStockItemsDialog"},{"name":"delete-stock-modal","component":"deleteStockModal"},{"name":"delete-stock-user-scope-modal","component":"deleteUserScopeModal"},{"name":"stock-management-app-menu-item","component":"stockManagementAppMenuItem","slot":"app-menu-item-slot","meta":{"name":" Stock Management"}},{"name":"delete-stock-rule-modal","component":"deleteStockRuleModal"}],"pages":[{"component":"stockManagement","route":"stock-management"}],"version":"1.0.1-pre.
|
1
|
+
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":"^2.24.0"},"extensions":[{"name":"stock-management-dashboard","slot":"stock-management-dashboard-slot","component":"stockManagementDashboard"},{"name":"stock-management-admin-card-link","slot":"system-admin-page-card-link-slot","component":"stockManagementAdminCardLink"},{"name":"stock-operation-dialog","component":"stockOperationDialog"},{"name":"import-bulk-stock-items","component":"importBulkStockItemsDialog"},{"name":"delete-stock-modal","component":"deleteStockModal"},{"name":"delete-stock-user-scope-modal","component":"deleteUserScopeModal"},{"name":"stock-management-app-menu-item","component":"stockManagementAppMenuItem","slot":"app-menu-item-slot","meta":{"name":" Stock Management"}},{"name":"delete-stock-rule-modal","component":"deleteStockRuleModal"},{"name":"delete-packaging-unit-modal","component":"deletePackagingUnitModal"},{"name":"delete-packaging-unit-button","component":"deletePackagingUnitButton"}],"pages":[{"component":"stockManagement","route":"stock-management"}],"version":"1.0.1-pre.390"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
@@ -8,6 +8,8 @@ import stockOperationDialogComponent from "./stock-operations/stock-operations-d
|
|
8
8
|
import stockManagementDashboardComponent from "./dashboard/stock-management-dashboard.component";
|
9
9
|
import stockManagementComponent from "./stock-management.component";
|
10
10
|
import stockManagementAdminCardLinkComponent from "./stock-management-admin-card-link.component";
|
11
|
+
import deletePackagingUnitModalButtonComponent from "./stock-items/add-stock-item/packaging-units/packaging-units-delete-modal-button.component";
|
12
|
+
import deletePackagingUnitComponent from "./stock-items/add-stock-item/packaging-units/packaging-units-delete-modal.component";
|
11
13
|
|
12
14
|
const moduleName = "@openmrs/esm-stock-management-app";
|
13
15
|
|
@@ -52,6 +54,22 @@ export const deleteUserScopeModal = getSyncLifecycle(deleteUserModalComponent, {
|
|
52
54
|
moduleName,
|
53
55
|
});
|
54
56
|
|
57
|
+
export const deletePackagingUnitModal = getSyncLifecycle(
|
58
|
+
deletePackagingUnitComponent,
|
59
|
+
{
|
60
|
+
featureName: "delete-packaging-unit-modal",
|
61
|
+
moduleName,
|
62
|
+
}
|
63
|
+
);
|
64
|
+
|
65
|
+
export const deletePackagingUnitButton = getSyncLifecycle(
|
66
|
+
deletePackagingUnitModalButtonComponent,
|
67
|
+
{
|
68
|
+
featureName: "delete-packging-unit-button",
|
69
|
+
moduleName,
|
70
|
+
}
|
71
|
+
);
|
72
|
+
|
55
73
|
export const importBulkStockItemsDialog = getSyncLifecycle(
|
56
74
|
bulkImportComponent,
|
57
75
|
options
|
package/src/routes.json
CHANGED
@@ -1,53 +1,58 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
},
|
7
|
-
"extensions": [
|
8
|
-
{
|
9
|
-
"name": "stock-management-dashboard",
|
10
|
-
"slot": "stock-management-dashboard-slot",
|
11
|
-
"component": "stockManagementDashboard"
|
2
|
+
"$schema": "https://json.openmrs.org/routes.schema.json",
|
3
|
+
"backendDependencies": {
|
4
|
+
"fhir2": ">=1.2",
|
5
|
+
"webservices.rest": "^2.24.0"
|
12
6
|
},
|
13
|
-
{
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
7
|
+
"extensions": [{
|
8
|
+
"name": "stock-management-dashboard",
|
9
|
+
"slot": "stock-management-dashboard-slot",
|
10
|
+
"component": "stockManagementDashboard"
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"name": "stock-management-admin-card-link",
|
14
|
+
"slot": "system-admin-page-card-link-slot",
|
15
|
+
"component": "stockManagementAdminCardLink"
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"name": "stock-operation-dialog",
|
19
|
+
"component": "stockOperationDialog"
|
20
|
+
},
|
21
|
+
{
|
22
|
+
"name": "import-bulk-stock-items",
|
23
|
+
"component": "importBulkStockItemsDialog"
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"name": "delete-stock-modal",
|
27
|
+
"component": "deleteStockModal"
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"name": "delete-stock-user-scope-modal",
|
31
|
+
"component": "deleteUserScopeModal"
|
32
|
+
},
|
33
|
+
{
|
34
|
+
"name": "stock-management-app-menu-item",
|
35
|
+
"component": "stockManagementAppMenuItem",
|
36
|
+
"slot": "app-menu-item-slot",
|
37
|
+
"meta": {
|
38
|
+
"name": " Stock Management"
|
39
|
+
}
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"name": "delete-stock-rule-modal",
|
43
|
+
"component": "deleteStockRuleModal"
|
44
|
+
},
|
45
|
+
{
|
46
|
+
"name": "delete-packaging-unit-modal",
|
47
|
+
"component": "deletePackagingUnitModal"
|
48
|
+
},
|
49
|
+
{
|
50
|
+
"name": "delete-packaging-unit-button",
|
51
|
+
"component": "deletePackagingUnitButton"
|
52
|
+
}
|
53
|
+
],
|
54
|
+
"pages": [{
|
55
|
+
"component": "stockManagement",
|
56
|
+
"route": "stock-management"
|
57
|
+
}]
|
58
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import React, { useCallback } from "react";
|
2
|
+
import { Button } from "@carbon/react";
|
3
|
+
import { TrashCan } from "@carbon/react/icons";
|
4
|
+
import { showModal } from "@openmrs/esm-framework";
|
5
|
+
import { StockItemPackagingUOMDTO } from "../../../core/api/types/stockItem/StockItemPackagingUOM";
|
6
|
+
|
7
|
+
interface DeleteModalButtonProps {
|
8
|
+
row?: StockItemPackagingUOMDTO;
|
9
|
+
closeModal: () => void;
|
10
|
+
}
|
11
|
+
|
12
|
+
const DeleteModalButton: React.FC<DeleteModalButtonProps> = ({ row }) => {
|
13
|
+
const launchDeleteModal = useCallback(() => {
|
14
|
+
const dispose = showModal("delete-packaging-unit-modal", {
|
15
|
+
closeModal: () => dispose(),
|
16
|
+
row,
|
17
|
+
});
|
18
|
+
}, [row]);
|
19
|
+
return (
|
20
|
+
<div>
|
21
|
+
<Button
|
22
|
+
type="button"
|
23
|
+
size="sm"
|
24
|
+
className="submitButton clear-padding-margin"
|
25
|
+
iconDescription={"Delete"}
|
26
|
+
kind="ghost"
|
27
|
+
renderIcon={TrashCan}
|
28
|
+
onClick={launchDeleteModal}
|
29
|
+
/>
|
30
|
+
</div>
|
31
|
+
);
|
32
|
+
};
|
33
|
+
|
34
|
+
export default DeleteModalButton;
|
package/src/stock-items/add-stock-item/packaging-units/packaging-units-delete-modal.component.tsx
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
import { showNotification, showToast } from "@openmrs/esm-framework";
|
2
|
+
import React, { useState } from "react";
|
3
|
+
import { deleteStockItemPackagingUnit } from "../../stock-items.resource";
|
4
|
+
import { useTranslation } from "react-i18next";
|
5
|
+
import { StockItemPackagingUOMDTO } from "../../../core/api/types/stockItem/StockItemPackagingUOM";
|
6
|
+
import styles from "../packaging-units/packaging-units.scss";
|
7
|
+
import {
|
8
|
+
Button,
|
9
|
+
ModalHeader,
|
10
|
+
ModalBody,
|
11
|
+
ModalFooter,
|
12
|
+
TextArea,
|
13
|
+
} from "@carbon/react";
|
14
|
+
|
15
|
+
interface DeletePackagingUnitProps {
|
16
|
+
row?: StockItemPackagingUOMDTO;
|
17
|
+
closeModal: () => void;
|
18
|
+
}
|
19
|
+
|
20
|
+
const DeletePackagingUnit: React.FC<DeletePackagingUnitProps> = ({
|
21
|
+
row,
|
22
|
+
closeModal,
|
23
|
+
}) => {
|
24
|
+
const { t } = useTranslation();
|
25
|
+
|
26
|
+
const [reason, setReason] = useState("");
|
27
|
+
|
28
|
+
const handleReasonChange = (e) => {
|
29
|
+
setReason(e.target.value);
|
30
|
+
};
|
31
|
+
|
32
|
+
const handleDelete = (e) => {
|
33
|
+
e.preventDefault();
|
34
|
+
deleteStockItemPackagingUnit(row.uuid).then(
|
35
|
+
() => {
|
36
|
+
showToast({
|
37
|
+
critical: true,
|
38
|
+
title: t("deletePackagingUnitTitle", `Delete packing item `),
|
39
|
+
kind: "success",
|
40
|
+
description: t(
|
41
|
+
"deletePackagingUnitMesaage",
|
42
|
+
`Stock Item packing unit deleted Successfully`
|
43
|
+
),
|
44
|
+
});
|
45
|
+
},
|
46
|
+
(error) => {
|
47
|
+
showNotification({
|
48
|
+
title: t(
|
49
|
+
"deletePackingUnitErrorTitle",
|
50
|
+
`Error Deleting a stock item packing unit`
|
51
|
+
),
|
52
|
+
kind: "error",
|
53
|
+
critical: true,
|
54
|
+
description: error?.message,
|
55
|
+
});
|
56
|
+
}
|
57
|
+
);
|
58
|
+
};
|
59
|
+
|
60
|
+
return (
|
61
|
+
<div>
|
62
|
+
<ModalHeader
|
63
|
+
closeModal={closeModal}
|
64
|
+
className={styles.productiveHeading03}
|
65
|
+
>
|
66
|
+
{t("removePackagingUnit", "Remove Packaging Unit")}?
|
67
|
+
</ModalHeader>
|
68
|
+
<ModalBody>
|
69
|
+
<span>
|
70
|
+
{t(
|
71
|
+
"removePackagingUnitConfirmation",
|
72
|
+
`Would you really like to remove the packaging unit ${row?.packagingUomName} from the stock item?`
|
73
|
+
)}
|
74
|
+
</span>
|
75
|
+
<TextArea
|
76
|
+
id="reason"
|
77
|
+
labelText={t("reasonLabel", "Please explain the reason:")}
|
78
|
+
onChange={handleReasonChange}
|
79
|
+
maxLength={500}
|
80
|
+
placeholder={t("reasonPlaceholder", "Enter reason here")}
|
81
|
+
/>
|
82
|
+
</ModalBody>
|
83
|
+
<ModalFooter>
|
84
|
+
<Button kind="secondary" onClick={closeModal}>
|
85
|
+
{t("no", "No")}
|
86
|
+
</Button>
|
87
|
+
<Button
|
88
|
+
kind="danger"
|
89
|
+
type="submit"
|
90
|
+
onClick={handleDelete}
|
91
|
+
disabled={reason.length < 1}
|
92
|
+
>
|
93
|
+
{t("yes", "Yes")}
|
94
|
+
</Button>
|
95
|
+
</ModalFooter>
|
96
|
+
</div>
|
97
|
+
);
|
98
|
+
};
|
99
|
+
|
100
|
+
export default DeletePackagingUnit;
|
@@ -14,22 +14,16 @@ import {
|
|
14
14
|
} from "@carbon/react";
|
15
15
|
import PackagingUnitsConceptSelector from "../packaging-units-concept-selector/packaging-units-concept-selector.component";
|
16
16
|
import ControlledNumberInput from "../../../core/components/carbon/controlled-number-input/controlled-number-input.component";
|
17
|
-
import { Save
|
17
|
+
import { Save } from "@carbon/react/icons";
|
18
18
|
import { FormProvider, useForm, useFormContext } from "react-hook-form";
|
19
19
|
import { zodResolver } from "@hookform/resolvers/zod";
|
20
20
|
import { PackageUnitFormData, packageUnitSchema } from "./validationSchema";
|
21
21
|
import { StockItemPackagingUOMDTO } from "../../../core/api/types/stockItem/StockItemPackagingUOM";
|
22
|
-
import {
|
23
|
-
|
24
|
-
deleteStockItemPackagingUnit,
|
25
|
-
} from "../../stock-items.resource";
|
26
|
-
import {
|
27
|
-
showNotification,
|
28
|
-
showSnackbar,
|
29
|
-
showToast,
|
30
|
-
} from "@openmrs/esm-framework";
|
22
|
+
import { createStockItemPackagingUnit } from "../../stock-items.resource";
|
23
|
+
import { showSnackbar } from "@openmrs/esm-framework";
|
31
24
|
import { useTranslation } from "react-i18next";
|
32
25
|
import styles from "./packaging-units.scss";
|
26
|
+
import DeleteModalButton from "./packaging-units-delete-modal-button.component";
|
33
27
|
|
34
28
|
interface PackagingUnitsProps {
|
35
29
|
isEditing?: boolean;
|
@@ -39,7 +33,6 @@ interface PackagingUnitsProps {
|
|
39
33
|
}
|
40
34
|
|
41
35
|
const PackagingUnits: React.FC<PackagingUnitsProps> = ({
|
42
|
-
isEditing,
|
43
36
|
stockItemUuid,
|
44
37
|
handleTabChange,
|
45
38
|
}) => {
|
@@ -67,7 +60,7 @@ const PackagingUnits: React.FC<PackagingUnitsProps> = ({
|
|
67
60
|
styles: { width: "50%" },
|
68
61
|
},
|
69
62
|
],
|
70
|
-
[]
|
63
|
+
[t]
|
71
64
|
);
|
72
65
|
|
73
66
|
const packageUnitForm = useForm<PackageUnitFormData>({
|
@@ -177,79 +170,43 @@ const PackagingUnitRow: React.FC<{
|
|
177
170
|
row: StockItemPackagingUOMDTO;
|
178
171
|
key?: string;
|
179
172
|
}> = ({ isEditing, row, key }) => {
|
180
|
-
const { t } = useTranslation();
|
181
|
-
|
182
173
|
const {
|
183
174
|
control,
|
184
175
|
formState: { errors },
|
185
176
|
} = useFormContext();
|
186
177
|
|
187
|
-
const handleDelete = (e) => {
|
188
|
-
e.preventDefault();
|
189
|
-
deleteStockItemPackagingUnit(row.uuid).then(
|
190
|
-
() => {
|
191
|
-
showToast({
|
192
|
-
critical: true,
|
193
|
-
title: t("deletePackagingUnitTitle", `Delete packing item `),
|
194
|
-
kind: "success",
|
195
|
-
description: t(
|
196
|
-
"deletePackagingUnitMesaage",
|
197
|
-
`Stock Item packing unit deleted Successfully`
|
198
|
-
),
|
199
|
-
});
|
200
|
-
},
|
201
|
-
(error) => {
|
202
|
-
showNotification({
|
203
|
-
title: t(
|
204
|
-
"deletePackingUnitErrorTitle",
|
205
|
-
`Error Deleting a stock item packing unit`
|
206
|
-
),
|
207
|
-
kind: "error",
|
208
|
-
critical: true,
|
209
|
-
description: error?.message,
|
210
|
-
});
|
211
|
-
}
|
212
|
-
);
|
213
|
-
};
|
214
|
-
|
215
178
|
return (
|
216
|
-
|
217
|
-
<
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
<
|
233
|
-
<
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
179
|
+
<>
|
180
|
+
<TableRow>
|
181
|
+
<TableCell>
|
182
|
+
{isEditing ? (
|
183
|
+
<PackagingUnitsConceptSelector
|
184
|
+
row={row}
|
185
|
+
controllerName={"packagingUomUuid"}
|
186
|
+
name="packagingUomUuid"
|
187
|
+
control={control}
|
188
|
+
invalid={!!errors.packagingUomUuid}
|
189
|
+
/>
|
190
|
+
) : (
|
191
|
+
(!isEditing || !row.uuid.startsWith("new-item")) &&
|
192
|
+
row?.packagingUomName
|
193
|
+
)}
|
194
|
+
</TableCell>
|
195
|
+
<TableCell>
|
196
|
+
<div className={styles.packingTableCell}>
|
197
|
+
<ControlledNumberInput
|
198
|
+
row={row}
|
199
|
+
controllerName="factor"
|
200
|
+
name="factor"
|
201
|
+
control={control}
|
202
|
+
id={`${row.uuid}-${key}`}
|
203
|
+
invalid={!!errors.factor}
|
204
|
+
/>
|
241
205
|
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
kind="ghost"
|
248
|
-
renderIcon={TrashCan}
|
249
|
-
onClick={(e) => handleDelete(e)}
|
250
|
-
/>
|
251
|
-
</div>
|
252
|
-
</TableCell>
|
253
|
-
</TableRow>
|
206
|
+
<DeleteModalButton closeModal={() => true} row={row} />
|
207
|
+
</div>
|
208
|
+
</TableCell>
|
209
|
+
</TableRow>
|
210
|
+
</>
|
254
211
|
);
|
255
212
|
};
|
@@ -1,7 +1,6 @@
|
|
1
1
|
@use '@carbon/styles/scss/colors';
|
2
2
|
@use "@carbon/styles/scss/spacing";
|
3
3
|
@use "@carbon/styles/scss/type";
|
4
|
-
|
5
4
|
.packingTable {
|
6
5
|
min-height: 15rem;
|
7
6
|
display: block;
|
@@ -11,11 +10,35 @@
|
|
11
10
|
display: flex;
|
12
11
|
align-items: center;
|
13
12
|
}
|
13
|
+
|
14
14
|
.packagingTableBody {
|
15
15
|
min-height: spacing.$spacing-13;
|
16
|
-
|
17
16
|
}
|
17
|
+
|
18
18
|
.packagingTableContainer {
|
19
19
|
min-height: 15rem;
|
20
20
|
display: block;
|
21
|
+
}
|
22
|
+
|
23
|
+
.searchAndSave {
|
24
|
+
display: flex;
|
25
|
+
flex-direction: column;
|
26
|
+
align-items: flex-start;
|
27
|
+
.submitButton {
|
28
|
+
margin-top: 1rem;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
.deleteModal {
|
33
|
+
:global(.cds--modal-container.cds--modal-container--sm) {
|
34
|
+
:global(.cds--modal-content) {
|
35
|
+
:global(.cds--form-item) {
|
36
|
+
margin-top: 1rem;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
:global(cds--form-item) {
|
43
|
+
margin-top: 1rem;
|
21
44
|
}
|
@@ -37,7 +37,7 @@ const PackagingUnitsConceptSelector = <T,>(
|
|
37
37
|
<Controller
|
38
38
|
name={props.controllerName}
|
39
39
|
control={props.control}
|
40
|
-
render={({ field: { onChange
|
40
|
+
render={({ field: { onChange } }) => (
|
41
41
|
<ComboBox
|
42
42
|
titleText={props.title}
|
43
43
|
name={props.name}
|