1"use strict";(self.webpackChunkpro_ui=self.webpackChunkpro_ui||[]).push([[8619],{46547(e,n,t){t.d(n,{Q:()=>r});const r={size:0,totalElements:0,totalPages:0,number:0}},12949(e,n,t){t.d(n,{EZ:()=>l,lp:()=>a,zO:()=>c});var r=t(85916),i=t(26910);async function a(e){var n;const{getAllActiveClientLimitedData:t,getAllActiveClientLimitedDataByManufacturer:a}=r.J.clients;let l=t();const c=null===(n=e.currentTeam)||void 0===n?void 0:n.teamManufacturerId;return c&&(l=a(c)),await i.A.get(l).then(e=>e.data.object.sort((e,n)=>e.clientName.localeCompare(n.clientName)))}async function l(e){const n=r.J.clients.getClientById(e);return await i.A.get(n).then(e=>e.data)}async function c(e){let n=r.J.clients.all();return n+="/".concat(e.clientId),await i.A.put(n,e).then(e=>e.data)}},79915(e,n,t){t.d(n,{Hf:()=>c,_P:()=>s,f:()=>o});var r=t(41836),i=t(51778),a=t(12949),l=t(82632);const c=()=>{const{user:e}=(0,l.Z)(),n=e;return(0,r.I)({queryKey:["allClientsLimitedData"],queryFn:()=>(0,a.lp)(n),enabled:n.isDataAdmin||n.isManufacturer})},o=e=>(0,r.I)({queryKey:["clientById".concat(e)],queryFn:()=>(0,a.EZ)(e),staleTime:0,gcTime:0}),s=e=>(0,i.n)({mutationKey:["updateClient",e],mutationFn:e=>(0,a.zO)(e)})},39645(e,n,t){t.d(n,{A:()=>r.A});var r=t(79336)},66978(e,n,t){t.d(n,{A:()=>q});var r=t(89379),i=t(9950),a=t(9449),l=t(12257),c=t(46547),o=t(53287),s=t(39645),d=t(49207),u=t(46817),f=t(35339),g=t(16491),m=t(61763),h=t(1320),b=t(15769),p=t(34075),x=t(22065),v=t(91180);const A=e=>{let n=[{id:"fabricId",label:"Id",width:100,align:"left"},{id:"fabricName",label:"Fabric Name",align:"left",href:e=>v.m6.manufacturing.manufacturingLibrary.fabric.edit(e.fabricId)},{id:"gerberCode",label:"Gerber Code",width:250,align:"left"},{id:"clientName",label:"Client Name",width:250,align:"left"},{id:"manufacturerName",label:"Manufacturer Name",align:"left"},{id:"inventoryItemId",label:"In Inventory",align:"center",getValue:e=>e.isInventory?"X":""},{id:"menu",label:"",width:35,align:"right",noSort:!0}];return e&&(n.splice(n.length-1,1),n=[{id:"select",label:"",width:100,align:"center",cellStyle:{padding:"0 12px 0 16px"}},...n]),n},j=e=>{let n=A(e);return e&&(n=n.filter(e=>"select"!==e.id)),n};var y=t(28429),F=t(42074),C=t(14857),I=t(36080),S=t(10371),w=t(68605),k=t(51496),D=t(25333),N=t(27987),P=t(87233),B=t(34276),E=t(19818),z=t(27230),L=t(10685),M=t(35923),O=t(44414);function T(e){let{fabricItem:n,isSelect:t,selectedFabric:r,onSelectedFabricChange:i,onDeleteFabric:a}=e;
1const c=(0,C.A)(),o=(0,y.Zp)(),s=(0,z.f)(),d=(0,M.C)(),u=(e,n)=>{const r=n[e.id];let i=(0,O.jsx)(O.Fragment,{children:r});if(!t&&e.href){let t=e.href(n);i=(0,O.jsx)(I.A,{component:F.k2,to:t||"",style:{textDecoration:"underline",color:c.palette.text.primary,fontWeight:700},children:r})}else if(e.getValue)return e.getValue(n);return i};return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(S.A,{hover:!0,onClick:()=>i&&i(n),sx:{cursor:"pointer","&.Mui-selected":{backgroundColor:"#e8f0fe"}},children:[t?(0,O.jsx)(w.A,{padding:"checkbox",children:(0,O.jsx)(k.A,{checked:(null===r||void 0===r?void 0:r.fabricId)===n.fabricId,onChange:()=>i&&i(n)})}):null,j(t).map(e=>(0,O.jsx)(w.A,{align:e.align,style:e.cellStyle,children:"menu"===e.id?(0,O.jsx)(D.A,{color:s.open?"primary":"default",onClick:s.onOpen,children:(0,O.jsx)(E.A,{icon:"eva:more-vertical-fill"})}):(0,O.jsx)(O.Fragment,{children:u(e,n)})},e.id)),(0,O.jsxs)(z.A,{open:s.open,onClose:s.onClose,arrow:"right-top",sx:{width:140},children:[(0,O.jsx)(N.A,{onClick:()=>{o(v.m6.manufacturing.manufacturingLibrary.fabric.edit(n.fabricId)),s.onClose()},children:(0,O.jsxs)(l.A,{direction:"row",children:[(0,O.jsx)(E.A,{icon:"solar:pen-bold"}),(0,O.jsx)(P.A,{children:"Edit"})]})}),(0,O.jsxs)(N.A,{onClick:()=>{d.onTrue(),s.onClose()},sx:{color:"error.main"},children:[(0,O.jsx)(E.A,{icon:"solar:trash-bin-trash-bold"}),"Delete"]})]})]},n.fabricId),(0,O.jsx)(L.T,{open:d.value,onClose:d.onFalse,title:"Delete",content:"Are you sure want to delete?",action:(0,O.jsx)(B.A,{variant:"contained",color:"error",onClick:()=>{a&&a(n),d.onFalse},children:"Delete"})})]})}function V(e){let{data:n,pageData:t,filters:r,loading:i,isSelect:a,selectedFabric:l,onSelectedFabricChange:c,onUpdateFilters:o,onDeleteFabric:s}=e;const d=!i&&!n.length;return(0,O.jsxs)(g.A,{children:[i?(0,O.jsx)(m.A,{color:"inherit"}):null,(0,O.jsx)(h.A,{sx:{position:"relative",overflow:"unset"}
1,children:(0,O.jsxs)(b.A,{size:"small",sx:{minWidth:800},children:[(0,O.jsx)(x.er,{order:r.sort,orderBy:r.sortBy,headLabel:A(a),onSort:e=>{o({sortBy:"".concat(e)})}}),(0,O.jsxs)(p.A,{children:[n.map(e=>(0,O.jsx)(T,{fabricItem:e,isSelect:a,selectedFabric:l,onSelectedFabricChange:c,onDeleteFabric:s},e.fabricId)),(0,O.jsx)(x.Sm,{notFound:d&&!i})]})]})}),d?null:(0,O.jsx)(x.We,{count:t.totalElements,page:t.number,rowsPerPageOptions:[10,25,50,100],rowsPerPage:r.size,onPageChange:(e,n)=>o({page:n}),onRowsPerPageChange:e=>{o({size:parseInt(e.target.value)})}})]})}function q(e){var n,t;let{filters:g,refetchFabric:m,isPending:h,isSelect:b,selectedFabric:p,onSelectedFabricChange:x,onDeleteFabric:v,onUpdateFilters:A}=e;const{data:j,isFetching:y,refetch:F}=(0,o.Py)(g.page,g.size,g.sortBy,g.sort,g.searchString,(null===(n=g.client)||void 0===n?void 0:n.clientId)||null,(null===(t=g.manufacturer)||void 0===t?void 0:t.manufacturerId)||null),C=(0,a.mN)({resolver:f.Q7,defaultValues:{client:(null===g||void 0===g?void 0:g.client)||void 0,manufacturer:(null===g||void 0===g?void 0:g.manufacturer)||void 0}}),I=C.watch("manufacturer"),S=C.watch("client"),w=e=>{const n=(0,r.A)((0,r.A)({},g),e);"page"in e||(n.page=0),"sortBy"in e&&(e.sortBy!==n.sortBy?n.sort="asc":n.sort="asc"===n.sort?"desc":"asc"),A(n)};return(0,i.useEffect)(()=>{w({manufacturer:null!==I&&void 0!==I?I:null})},[I]),(0,i.useEffect)(()=>{w({client:null!==S&&void 0!==S?S:null})},[S]),(0,i.useEffect)(()=>{y||F()},[g]),(0,i.useEffect)(()=>{m&&m>0&&F()},[m]),(0,O.jsxs)(l.A,{children:[(0,O.jsxs)(l.A,{direction:"row",spacing:1,marginY:2,paddingX:2,children:[(0,O.jsx)(s.A,{searchString:(null===g||void 0===g?void 0:g.searchString)||"",onSubmitSearch:e=>w({searchString:e})}),(0,O.jsxs)(a.Op,(0,r.A)((0,r.A)({},C),{},{children:[(0,O.jsx)(d.A,{clearable:!0}),(0,O.jsx)("div",{style:{width:400},children:(0,O.jsx)(u.A,{clearable:!0})})]}))]}),(0,O.jsx)(V,{data:(null===j||void 0===j?void 0:j.fabricViewItems)||[],pageData:(null===j||void 0===j?void 0:j.pageData)||c.Q,filters:g,loading:y||!!h,isSelect:b,selectedFabric:p,onSelectedFabricChange:x,onUpdateFilters:w,onDeleteFabric:v})]})}},38619(e,n,t){t.r(n),t.d(n,{default:()=>b});var r=t(9950),i=t(42074),a=t(85923),l=t(53287),c=t(82632),o=t(65517),s=t(66978),d=t(19818),u=t(91180),f=t(12811),g=t(12257),m=t(34276),h=t(44414);function b(){var e;const{getCurrentUserTeamManufacturer:n}=(0,c.Z)(),[t,b]=(0,f.M)("mfgFabricFilters",{page:0,size:50,sortBy:"fabricId",sort:"asc",searchString:"",client:null,manufacturer:null!==(e=n())&&void 0!==e?e:null}),[p,x]=(0,r.useState)(0),{mutate:v,isPending:A}=(0,l.YW)();return(0,h.jsxs)(g.A,{children:[(0,h.jsx)(o.A,{heading:"Fabrics",links:[{name:"Home",href:u.m6.general.dashboard.home},{name:"Fabrics",href:u.m6.manufacturing.manufacturingLibrary.fabric.list}],action:(0,h.jsx)(m.A,{variant:"outlined",color:"primary",endIcon:(0,h.jsx)(d.A,{icon:"eva:plus-fill"}),component:i.k2,to:u.m6.manufacturing.manufacturingLibrary.fabric.create,children:"Create Fabric"}),sx:{mb:{xs:3,md:5}}}),(0,h.jsx)(s.A,{filters:t,refetchFabric:p,isPending:A,onDeleteFabric:e=>{v(e.fabricId,{onSuccess:()=>{a.oR.success("Fabric successfully deleted!"),x(e=>e+1)}})},onUpdateFilters:e=>b(e)})]})}},49207(e,n,t){t.d(n,{A:()=>h});var r=t(89379),i=t(80045),a=t(9950),l=t(9449),c=t(82610),o=t(27553),s=t(12257),d=t(87233),u=t(8145),f=t(79915),g=t(44414);const m=["key"];function h(e){let{fieldName:n="client",idName:t,clearable:h,showAll:b,required:p,errorMessage:x}=e;const{control:v,formState:A,setValue:j}=(0,l.xW)(),{data:y}=(0,f.Hf)(),[F,C]=(0,a.useState)([]);return(0,a.useEffect)(()=>{if(y){const e=structuredClone(y);b&&e.unshift((0,c.SN)()),C(e)}},[y]),(0,g.jsx)(l.xI,{control:v,name:n,render:e=>{let{field:n}=e;return(0,g.jsx)(g.Fragment,{children:(0,g.jsx)(o.A,{fullWidth:!0,disableClearable:!h,options:F,getOptionLabel:e=>{if("string"===typeof e)return e;{const n=F.find(n=>n.clientId===e.clientId);return(null===n||void 0===n?void 0:n.clientName)||e.clientName}},isOptionEqualToValue:(e,n)=>e.clientId===n.clientId,renderOption:(e,n)=>{const t=e,{key:a}=t,l=(0,i.A)(t,m);return(0,g.jsx)(s.A,(0,r.A)((0,r.A)({direction:"row",spacing:2,alignItems:"center",component:"li"},l),{},{children:(0,g.jsx)(d.A,{variant:"body1",component:"span",children:n.clientName})}),a)},renderInput:e=>{var n,t;return(0,g.jsx)(u.A,(0,r.A)((0,r.A)({},e),{},{label:"Client".concat(p?"*":""),error:!!A.errors.client||!!x,helperText:null!==(n=A.errors)&&void 0!==n&&null!==(t=n.client)&&void 0!==t&&t.message?A.errors.client.message.toString():x||null}))},onChange:(e,r)=>{n.onChange(r),t&&(j(t,r?r.clientId:null),j("clientChanged",!0))},value:n.value||null,sx:{width:400}})})}})}},35339(e,n,t){t.d(n,{Q7:()=>l,bF:()=>a});var r=t(29714),i=t(26473);const a=r.Ik({clientId:r.ai(),clientName:r.Yj(),freeShipping:r.zM(),siteName:r.Yj().nullable()}),l=(r.Ik({client:a}),(0,i.t)(a))}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.