felicity-lims/felicity/templates/static/assets/Storage-62d0550d.js

2 lines
12 KiB
JavaScript
Raw Normal View History

2023-11-11 00:48:39 +08:00
import{_ as g,a4 as Q,u as X,a5 as Y,aw as Z,ax as $,ay as oo,az as to,aA as eo,aB as no,aC as ao,aD as ro,w as so}from"./shipment-53265c2d.js";import{G as b,f as io,w as T,d as lo,c as co,T as mo,B as o,al as r,F as d,ag as i}from"./_plugin-vue_export-helper-dacf3d65.js";import{v as l,e as v}from"./runtime-dom.esm-bundler-98433118.js";const h=b(()=>g(()=>import("./SimpleModal-9e28c074.js"),["assets/SimpleModal-9e28c074.js","assets/_plugin-vue_export-helper-dacf3d65.js","assets/runtime-dom.esm-bundler-98433118.js","assets/SimpleModal-f645a074.css"])),uo=b(()=>g(()=>import("./PageHeading-f8f1dd15.js"),["assets/PageHeading-f8f1dd15.js","assets/_plugin-vue_export-helper-dacf3d65.js"])),po=b(()=>g(()=>import("./ContainerView-1b325388.js"),["assets/ContainerView-1b325388.js","assets/shipment-53265c2d.js","assets/_plugin-vue_export-helper-dacf3d65.js"])),ho=b(()=>g(()=>import("./TreeItem-9dde2d2f.js"),["assets/TreeItem-9dde2d2f.js","assets/_plugin-vue_export-helper-dacf3d65.js","assets/shipment-53265c2d.js","assets/runtime-dom.esm-bundler-98433118.js"])),yo=io({name:"storage-home",setup(n,go){const{treeData:f,tags:s,activeTree:m,newStoreRoom:k,newStorageLocation:x,newStorageSection:A,newStorageContainer:C,setActiveTree:p}=Q(),R=X(),c=Y(),{withClientMutation:u}=so();c.fetchStorageTree(),T(()=>m.value,(e,a)=>{e&&e.tag===s.storageContainer&&c.fetchStorageContainer(e.uid)}),T(()=>f.value,(e,a)=>{if(!e)return;const F=R?.options?.history?.state;if(F?.sample){const S=JSON.parse(F?.sample)?.storageContainer,y=S?.storageSection,w=y?.storageLocation,q=w?.storeRoom;p({...q,tag:s.storeRoom}),p({...w,tag:s.storageLocation}),p({...y,tag:s.storageSection}),p({...S,tag:s.storageContainer})}});const O=lo(()=>m.value?.tag===s.storeRoom?s.storageLocation:m.value?.tag===s.storageLocation?s.storageSection:m.value?.tag===s.storageSection?s.storageContainer:m.value?.tag===s.storageContainer?s.containerView:null),t=co({roomModalShow:!1,roomFormTitle:"",roomForm:{},roomFormAction:!0,locationModalShow:!1,locationFormTitle:"",locationForm:{},locationFormAction:!0,sectionModalShow:!1,sectionFormTitle:"",sectionForm:{},sectionFormAction:!0,containerModalShow:!1,containerFormTitle:"",containerForm:{},containerFormAction:!0});function E(){const e={...t.roomForm};u(Z,{payload:e},"createStoreRoom").then(a=>{c.addStoreRoom(a),k(a)})}function _(){const e={name:t.roomForm.name,description:t.roomForm.description};u($,{uid:t.roomForm.uid,payload:e},"updateStoreRoom").then(a=>c.updateStoreRoom(a))}function M(e,a){t.roomFormAction=e,t.roomFormTitle=(e?"CREATE":"EDIT")+" A STORE ROOM",t.roomModalShow=!0,e?Object.assign(t.roomForm,{}):Object.assign(t.roomForm,{...a})}function D(){t.roomFormAction===!0&&E(),t.roomFormAction===!1&&_(),t.roomModalShow=!1}function L(){const e={...t.locationForm,storeRoomUid:m.value.uid};u(oo,{payload:e},"createStorageLocation").then(a=>{c.addStorageLocation(a),x(a)})}function N(){const e={name:t.locationForm.name,description:t.locationForm.description};u(to,{uid:t.locationForm.uid,payload:e},"updateStorageLocation").then(a=>c.updateStorageLocation(a))}function V(e,a){t.locationFormAction=e,t.locationFormTitle=(e?"CREATE":"EDIT")+" A STORAGE LOCATION",t.locationModalShow=!0,e?Object.assign(t.locationForm,{}):Object.assign(t.locationForm,{...a})}function I(){t.locationFormAction===!0&&L(),t.locationFormAction===!1&&N(),t.locationModalShow=!1}function U(){const e={...t.sectionForm,storageLocationUid:m.value.uid};u(eo,{payload:e},"createStorageSection").then(a=>{c.addStorageSection(a),A(a)})}function G(){const e={name:t.sectionForm.name,description:t.sectionForm.description};u(no,{uid:t.sectionForm.uid,payload:e},"updateStorageSection").then(a=>c.updateStorageSection(a))}function j(e,a){t.sectionFormAction=e,t.sectionFormTitle=(e?"CREATE":"EDIT")+" A STORAGE SECTION",t.sectionModalShow=!0,e?Object.assign(t.sectionForm,{}):Object.assign(t.sectionForm,{...a})}function W(){t.sectionFormAction===!0&&U(),t.sectionFormAction===!1&&G(),t.sectionModalShow=!1}function P(){const e={...t.containerForm,storageSectionUid:m.value.uid};u(ao,{payload:e},"cr