@openmrs/esm-stock-management-app 1.0.1-pre.499 → 1.0.1-pre.508
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{647.js → 157.js} +1 -1
- package/dist/157.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 +28 -28
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/core/api/types/stockOperation/StockOperationDTO.ts +1 -0
- package/src/stock-operations/add-stock-operation/add-stock-operation.component.tsx +26 -4
- package/src/stock-operations/add-stock-operation/add-stock-operation.utils.tsx +4 -1
- package/src/stock-operations/add-stock-operation/received-items.component.tsx +93 -0
- package/src/stock-operations/stock-operations-table.component.tsx +3 -1
- package/dist/647.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(26),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(26),t.e(672),t.e(157)]).then((()=>()=>t(4322)))},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.7.3-pre.2161",(()=>Promise.all([y.e(793),y.e(672)]).then((()=>()=>y(1793))))),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(764),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(764).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(793).then((()=>()=>y(1793)))))},v={157:[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=_})();
|
@@ -77,7 +77,31 @@
|
|
77
77
|
"auxiliaryFiles": [
|
78
78
|
"openmrs-esm-stock-management-app.js.map"
|
79
79
|
],
|
80
|
-
"hash": "
|
80
|
+
"hash": "3a2954b76c46346a",
|
81
|
+
"childrenByOrder": {}
|
82
|
+
},
|
83
|
+
{
|
84
|
+
"rendered": true,
|
85
|
+
"initial": false,
|
86
|
+
"entry": false,
|
87
|
+
"recorded": false,
|
88
|
+
"size": 1732683,
|
89
|
+
"sizes": {
|
90
|
+
"javascript": 1732473,
|
91
|
+
"consume-shared": 210
|
92
|
+
},
|
93
|
+
"names": [],
|
94
|
+
"idHints": [],
|
95
|
+
"runtime": [
|
96
|
+
"@openmrs/esm-stock-management-app"
|
97
|
+
],
|
98
|
+
"files": [
|
99
|
+
"157.js"
|
100
|
+
],
|
101
|
+
"auxiliaryFiles": [
|
102
|
+
"157.js.map"
|
103
|
+
],
|
104
|
+
"hash": "5b44bb3f16f9f06b",
|
81
105
|
"childrenByOrder": {}
|
82
106
|
},
|
83
107
|
{
|
@@ -85,10 +109,10 @@
|
|
85
109
|
"initial": true,
|
86
110
|
"entry": true,
|
87
111
|
"recorded": false,
|
88
|
-
"size":
|
112
|
+
"size": 5401110,
|
89
113
|
"sizes": {
|
90
114
|
"consume-shared": 252,
|
91
|
-
"javascript":
|
115
|
+
"javascript": 5379160,
|
92
116
|
"share-init": 252,
|
93
117
|
"runtime": 21446
|
94
118
|
},
|
@@ -105,7 +129,7 @@
|
|
105
129
|
"auxiliaryFiles": [
|
106
130
|
"main.js.map"
|
107
131
|
],
|
108
|
-
"hash": "
|
132
|
+
"hash": "d1e1410dc5cdf2f4",
|
109
133
|
"childrenByOrder": {}
|
110
134
|
},
|
111
135
|
{
|
@@ -268,30 +292,6 @@
|
|
268
292
|
"hash": "33d19b566a1b7e04",
|
269
293
|
"childrenByOrder": {}
|
270
294
|
},
|
271
|
-
{
|
272
|
-
"rendered": true,
|
273
|
-
"initial": false,
|
274
|
-
"entry": false,
|
275
|
-
"recorded": false,
|
276
|
-
"size": 1723593,
|
277
|
-
"sizes": {
|
278
|
-
"javascript": 1723383,
|
279
|
-
"consume-shared": 210
|
280
|
-
},
|
281
|
-
"names": [],
|
282
|
-
"idHints": [],
|
283
|
-
"runtime": [
|
284
|
-
"@openmrs/esm-stock-management-app"
|
285
|
-
],
|
286
|
-
"files": [
|
287
|
-
"647.js"
|
288
|
-
],
|
289
|
-
"auxiliaryFiles": [
|
290
|
-
"647.js.map"
|
291
|
-
],
|
292
|
-
"hash": "7200b38ad813355f",
|
293
|
-
"childrenByOrder": {}
|
294
|
-
},
|
295
295
|
{
|
296
296
|
"rendered": false,
|
297
297
|
"initial": false,
|
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-nav-menu","slot":"stock-sidebar-slot","component":"stockNavMenu","online":true,"offline":true},{"name":"overview-db-link","slot":"stock-page-dashboard-slot","component":"stockOverviewLink","meta":{"name":"overview","slot":"overview-dashboard-slot","title":"overview"},"order":0,"online":true,"offline":true},{"name":"stock-overview-db","slot":"overview-dashboard-slot","component":"stockOverview"},{"name":"operations-db-link","slot":"stock-page-dashboard-slot","component":"stockOperationsLink","meta":{"name":"operations","slot":"operations-dashboard-slot","title":"operations"},"order":2,"online":true,"offline":true},{"name":"stock-operations-db","slot":"operations-dashboard-slot","component":"stockOperations"},{"name":"items-db-link","slot":"stock-page-dashboard-slot","component":"stockItemsLink","meta":{"name":"items","slot":"items-dashboard-slot","title":"items"},"order":1,"online":true,"offline":true},{"name":"stock-items-db","slot":"items-dashboard-slot","component":"stockItems"},{"name":"user-scopes-db-link","slot":"stock-page-dashboard-slot","component":"stockUserScopesLink","meta":{"name":"user-scopes","slot":"user-scopes-dashboard-slot","title":"user-scopes"},"order":3,"online":true,"offline":true},{"name":"stock-user-scopes-db","slot":"user-scopes-dashboard-slot","component":"stockUserScopes"},{"name":"sources-db-link","slot":"stock-page-dashboard-slot","component":"stockSourcesLink","meta":{"name":"sources","slot":"sources-dashboard-slot","title":"Sources"},"order":2,"online":true,"offline":true},{"name":"stock-sources-db","slot":"sources-dashboard-slot","component":"stockSources"},{"name":"locations-db-link","slot":"stock-page-dashboard-slot","component":"stockLocationsLink","meta":{"name":"locations","slot":"locations-dashboard-slot","title":"Locations"},"order":4,"online":true,"offline":true},{"name":"stock-locations-db","slot":"locations-dashboard-slot","component":"stockLocations"},{"name":"reports-db-link","slot":"stock-page-dashboard-slot","component":"stockReportsLink","meta":{"name":"reports","slot":"reports-dashboard-slot","title":"Reports"},"order":5,"online":true,"offline":true},{"name":"stock-reports-db","slot":"reports-dashboard-slot","component":"stockReports"},{"name":"settings-db-link","slot":"stock-page-dashboard-slot","component":"stockSettingsLink","meta":{"name":"settings","slot":"settings-dashboard-slot","title":"Settings"},"order":6,"online":true,"offline":true},{"name":"stock-settings-db","slot":"settings-dashboard-slot","component":"stockSettings"},{"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":"root","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-nav-menu","slot":"stock-sidebar-slot","component":"stockNavMenu","online":true,"offline":true},{"name":"overview-db-link","slot":"stock-page-dashboard-slot","component":"stockOverviewLink","meta":{"name":"overview","slot":"overview-dashboard-slot","title":"overview"},"order":0,"online":true,"offline":true},{"name":"stock-overview-db","slot":"overview-dashboard-slot","component":"stockOverview"},{"name":"operations-db-link","slot":"stock-page-dashboard-slot","component":"stockOperationsLink","meta":{"name":"operations","slot":"operations-dashboard-slot","title":"operations"},"order":2,"online":true,"offline":true},{"name":"stock-operations-db","slot":"operations-dashboard-slot","component":"stockOperations"},{"name":"items-db-link","slot":"stock-page-dashboard-slot","component":"stockItemsLink","meta":{"name":"items","slot":"items-dashboard-slot","title":"items"},"order":1,"online":true,"offline":true},{"name":"stock-items-db","slot":"items-dashboard-slot","component":"stockItems"},{"name":"user-scopes-db-link","slot":"stock-page-dashboard-slot","component":"stockUserScopesLink","meta":{"name":"user-scopes","slot":"user-scopes-dashboard-slot","title":"user-scopes"},"order":3,"online":true,"offline":true},{"name":"stock-user-scopes-db","slot":"user-scopes-dashboard-slot","component":"stockUserScopes"},{"name":"sources-db-link","slot":"stock-page-dashboard-slot","component":"stockSourcesLink","meta":{"name":"sources","slot":"sources-dashboard-slot","title":"Sources"},"order":2,"online":true,"offline":true},{"name":"stock-sources-db","slot":"sources-dashboard-slot","component":"stockSources"},{"name":"locations-db-link","slot":"stock-page-dashboard-slot","component":"stockLocationsLink","meta":{"name":"locations","slot":"locations-dashboard-slot","title":"Locations"},"order":4,"online":true,"offline":true},{"name":"stock-locations-db","slot":"locations-dashboard-slot","component":"stockLocations"},{"name":"reports-db-link","slot":"stock-page-dashboard-slot","component":"stockReportsLink","meta":{"name":"reports","slot":"reports-dashboard-slot","title":"Reports"},"order":5,"online":true,"offline":true},{"name":"stock-reports-db","slot":"reports-dashboard-slot","component":"stockReports"},{"name":"settings-db-link","slot":"stock-page-dashboard-slot","component":"stockSettingsLink","meta":{"name":"settings","slot":"settings-dashboard-slot","title":"Settings"},"order":6,"online":true,"offline":true},{"name":"stock-settings-db","slot":"settings-dashboard-slot","component":"stockSettings"},{"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":"root","route":"stock-management"}],"version":"1.0.1-pre.508"}
|
package/package.json
CHANGED
@@ -3,6 +3,7 @@ import { StockOperationItemDTO } from "./StockOperationItemDTO";
|
|
3
3
|
import { StockOperationStatus } from "./StockOperationStatus";
|
4
4
|
|
5
5
|
export interface StockOperationDTO {
|
6
|
+
receivedItems: any;
|
6
7
|
uuid: string | null | undefined;
|
7
8
|
cancelReason: string | null | undefined;
|
8
9
|
cancelledBy: number;
|
@@ -1,10 +1,11 @@
|
|
1
|
-
import React, { useState } from "react";
|
1
|
+
import React, { useEffect, useState } from "react";
|
2
2
|
import { useTranslation } from "react-i18next";
|
3
3
|
import { TabItem } from "../../core/components/tabs/types";
|
4
4
|
import VerticalTabs from "../../core/components/tabs/vertical-tabs.component";
|
5
5
|
import BaseOperationDetails from "./base-operation-details.component";
|
6
6
|
import StockItemsAddition from "./stock-items-addition.component";
|
7
7
|
import StockOperationSubmission from "./stock-operation-submission.component";
|
8
|
+
import ReceivedItems from "./received-items.component";
|
8
9
|
import { AddStockOperationProps } from "./types";
|
9
10
|
import { useInitializeStockOperations } from "./add-stock-operation.resource";
|
10
11
|
import { AccordionSkeleton } from "@carbon/react";
|
@@ -25,6 +26,7 @@ import { StockOperation } from "./stock-operation-context/useStockOperationConte
|
|
25
26
|
import { formatDate, parseDate, showSnackbar } from "@openmrs/esm-framework";
|
26
27
|
import {
|
27
28
|
OperationType,
|
29
|
+
StockOperationTypeIsStockIssue,
|
28
30
|
StockOperationType,
|
29
31
|
} from "../../core/api/types/stockOperation/StockOperationType";
|
30
32
|
import { operationStatusColor } from "../stock-operations.resource";
|
@@ -39,6 +41,11 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
|
|
39
41
|
props?.isEditing
|
40
42
|
);
|
41
43
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
44
|
+
const [canReceiveItems, setCanReceiveItems] = useState(false);
|
45
|
+
|
46
|
+
useEffect(() => {
|
47
|
+
setCanReceiveItems(props?.model?.permission?.canReceiveItems ?? false);
|
48
|
+
}, [props?.model?.permission]);
|
42
49
|
|
43
50
|
if (isLoading) return <AccordionSkeleton />;
|
44
51
|
if (isError) {
|
@@ -54,6 +61,8 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
|
|
54
61
|
}
|
55
62
|
|
56
63
|
let operations: StockOperationType[] | null | undefined;
|
64
|
+
const status = props?.model?.status;
|
65
|
+
|
57
66
|
const tabs: TabItem[] = [
|
58
67
|
{
|
59
68
|
name: isEditing
|
@@ -75,7 +84,7 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
|
|
75
84
|
: props?.operation?.name === "Stock Issue"
|
76
85
|
? props?.model
|
77
86
|
: result?.dto
|
78
|
-
} // check if type is stockIssue and pass
|
87
|
+
} // check if type is stockIssue and pass requisition data
|
79
88
|
onSave={async () => {
|
80
89
|
setManageStockItems(true);
|
81
90
|
setSelectedIndex(1);
|
@@ -98,7 +107,7 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
|
|
98
107
|
: props?.operation?.name === "Stock Issue"
|
99
108
|
? props?.model
|
100
109
|
: result?.dto
|
101
|
-
} // check if type is stockIssue and pass
|
110
|
+
} // check if type is stockIssue and pass requisition data
|
102
111
|
onSave={async () => {
|
103
112
|
setManageSubmitOrComplete(true);
|
104
113
|
setSelectedIndex(2);
|
@@ -161,7 +170,20 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
|
|
161
170
|
),
|
162
171
|
disabled: !(props.isEditing || manageSubmitOrComplete),
|
163
172
|
},
|
164
|
-
]
|
173
|
+
].concat(
|
174
|
+
StockOperationTypeIsStockIssue(
|
175
|
+
props?.model?.operationType as OperationType
|
176
|
+
) || canReceiveItems
|
177
|
+
? status === "DISPATCHED" || status === "COMPLETED"
|
178
|
+
? [
|
179
|
+
{
|
180
|
+
name: t("receivedItems", "Received Items"),
|
181
|
+
component: <ReceivedItems model={props?.model} />,
|
182
|
+
},
|
183
|
+
]
|
184
|
+
: []
|
185
|
+
: []
|
186
|
+
);
|
165
187
|
|
166
188
|
return (
|
167
189
|
<>
|
@@ -70,7 +70,10 @@ export async function initializeNewStockOperation(
|
|
70
70
|
let destinationPartyList: Party[] | null | undefined;
|
71
71
|
|
72
72
|
if (isNew) {
|
73
|
-
model = structuredClone(
|
73
|
+
model = structuredClone({
|
74
|
+
...initialStockOperationValue(),
|
75
|
+
receivedItems: [],
|
76
|
+
});
|
74
77
|
model = Object.assign(model, {
|
75
78
|
operationDate: today(),
|
76
79
|
operationTypeName: currentStockOperationType?.name,
|
@@ -0,0 +1,93 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { useTranslation } from "react-i18next";
|
3
|
+
import { StockOperationDTO } from "../../core/api/types/stockOperation/StockOperationDTO";
|
4
|
+
import {
|
5
|
+
DataTable,
|
6
|
+
Table,
|
7
|
+
TableBody,
|
8
|
+
TableContainer,
|
9
|
+
TableHead,
|
10
|
+
TableHeader,
|
11
|
+
TableRow,
|
12
|
+
TableCell,
|
13
|
+
DataTableSkeleton,
|
14
|
+
} from "@carbon/react";
|
15
|
+
|
16
|
+
const formatDate = (date: Date | string | null) => {
|
17
|
+
if (!date) return " ";
|
18
|
+
const d = new Date(date);
|
19
|
+
const day = String(d.getDate()).padStart(2, "0");
|
20
|
+
const month = String(d.getMonth() + 1).padStart(2, "0");
|
21
|
+
const year = d.getFullYear();
|
22
|
+
return `${month}/${day}/${year}`;
|
23
|
+
};
|
24
|
+
|
25
|
+
interface ReceivedItemsProps {
|
26
|
+
model?: StockOperationDTO;
|
27
|
+
}
|
28
|
+
|
29
|
+
const ReceivedItems: React.FC<ReceivedItemsProps> = ({ model }) => {
|
30
|
+
const { t } = useTranslation();
|
31
|
+
|
32
|
+
const headers = [
|
33
|
+
{ key: "item", header: t("item", "Item") },
|
34
|
+
{ key: "requested", header: t("requested", "Requested") },
|
35
|
+
{ key: "batch", header: t("batch", "Batch No") },
|
36
|
+
{ key: "expiry", header: t("expiry", "Expiry Date") },
|
37
|
+
{ key: "qtySent", header: t("qtySent", "Qty Sent") },
|
38
|
+
{ key: "qtyReceived", header: t("qtyReceived", "Qty Received") },
|
39
|
+
{ key: "qtyUoM", header: t("qtyUoM", "Qty UoM") },
|
40
|
+
];
|
41
|
+
|
42
|
+
const rows =
|
43
|
+
model?.stockOperationItems?.map((item) => ({
|
44
|
+
id: item.uuid,
|
45
|
+
item: item.stockItemName,
|
46
|
+
requested: item.quantityRequested || " ",
|
47
|
+
batch: item.batchNo,
|
48
|
+
expiry: formatDate(item.expiration),
|
49
|
+
qtySent: item.quantity || " ",
|
50
|
+
qtyReceived: item.quantityReceived || " ",
|
51
|
+
qtyUoM: item.quantityReceivedPackagingUOMName,
|
52
|
+
})) || [];
|
53
|
+
|
54
|
+
if (!model) {
|
55
|
+
return <DataTableSkeleton role="progressbar" />;
|
56
|
+
}
|
57
|
+
|
58
|
+
return (
|
59
|
+
<div style={{ margin: "10px" }}>
|
60
|
+
<DataTable rows={rows} headers={headers}>
|
61
|
+
{({ rows, headers, getHeaderProps, getTableProps, getRowProps }) => (
|
62
|
+
<TableContainer>
|
63
|
+
<Table {...getTableProps()}>
|
64
|
+
<TableHead>
|
65
|
+
<TableRow>
|
66
|
+
{headers.map((header) => (
|
67
|
+
<TableHeader
|
68
|
+
{...getHeaderProps({ header })}
|
69
|
+
key={header.key}
|
70
|
+
>
|
71
|
+
{header.header}
|
72
|
+
</TableHeader>
|
73
|
+
))}
|
74
|
+
</TableRow>
|
75
|
+
</TableHead>
|
76
|
+
<TableBody>
|
77
|
+
{rows.map((row) => (
|
78
|
+
<TableRow {...getRowProps({ row })} key={row.id}>
|
79
|
+
{row.cells.map((cell) => (
|
80
|
+
<TableCell key={cell.id}>{cell.value}</TableCell>
|
81
|
+
))}
|
82
|
+
</TableRow>
|
83
|
+
))}
|
84
|
+
</TableBody>
|
85
|
+
</Table>
|
86
|
+
</TableContainer>
|
87
|
+
)}
|
88
|
+
</DataTable>
|
89
|
+
</div>
|
90
|
+
);
|
91
|
+
};
|
92
|
+
|
93
|
+
export default ReceivedItems;
|
@@ -435,11 +435,13 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
435
435
|
/>
|
436
436
|
|
437
437
|
<StockOperationsFilters
|
438
|
+
conceptUuid={config.stockSourceTypeUUID}
|
438
439
|
filterName={StockFilters.STATUS}
|
439
440
|
onFilterChange={handleOnFilterChange}
|
440
441
|
/>
|
441
442
|
|
442
443
|
<StockOperationsFilters
|
444
|
+
conceptUuid={config.stockSourceTypeUUID}
|
443
445
|
filterName={StockFilters.OPERATION}
|
444
446
|
onFilterChange={handleOnFilterChange}
|
445
447
|
/>
|
@@ -454,7 +456,7 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
454
456
|
onOperationTypeSelected={(operation) => {
|
455
457
|
launchAddOrEditDialog(
|
456
458
|
t,
|
457
|
-
initialStockOperationValue(),
|
459
|
+
{ ...initialStockOperationValue(), receivedItems: [] },
|
458
460
|
false,
|
459
461
|
operation,
|
460
462
|
operations,
|