import{a as Ne,w as Pe,u as we,j as t,h as o,l as Ie,i as De,r as Te,C as $e,F as ie,N as Me,I as Oe,A as Y,x as ze,G as B,y as Be,z as Ae,B as Le,D as Z,E as We}from"./index-Da-VPv7f.js";import{r as c,ai as Re,aj as Ee,ak as qe,al as je,am as Ve,an as Ue,ao as Fe}from"./mui-icons-CVqIXJUc.js";import{u as Qe,a as Ge,b as Ye,c as He,r as _e}from"./finishedGoodsInventoryApi-DS9DspRc.js";import{u as Je}from"./useDebounce-D9UmRpJE.js";import{T as Ke,a as ee,d as te}from"./mui-x-pickers-BflNfF54.js";import{u as se,T as m,f as N}from"./mui-x-charts-CP3e2jhe.js";import{l,k as Xe,I as A,m as Ze,c as ae,n as re,o as oe,S as ne,P as et,p as g,M as tt}from"./mui-x-datagrid-D42xrz8e.js";const at=Ne.injectEndpoints({endpoints:P=>({setMakerPackingStatus:P.mutation({query:({orderId:y,orderNumber:n})=>({url:"packing-order",method:"POST",body:{orderId:y,orderNumber:n}})}),getPackingOrdesByPage:P.mutation({query:({page:y,size:n,searchByName:w,type:I})=>({url:`packing-order/search-by-criteria?type=${I}&page=${y}&size=${n}`,method:"POST",body:w})}),getPackingListById:P.query({query:y=>({url:`packing-list/${y}`,method:"GET"})}),createPackingList:P.mutation({query:y=>({url:"packing-list/create",method:"POST",body:y})})})}),{useSetMakerPackingStatusMutation:vt,useGetPackingOrdesByPageMutation:rt,useGetPackingListByIdQuery:St,useCreatePackingListMutation:Ct}=at,ot=({open:P,onClose:y,packing:n,onApprove:w,onReject:I,entity:$})=>{const b=se();if(!n)return null;const v=(n.items||[]).reduce((i,h)=>{const f=h.masterBarcode;return i[f]||(i[f]=[]),i[f].push(h),i},{}),L=()=>{const i=window.open("","_blank");if(i){const h=`
        <html>
          <head>
            <title>Packing Details - ${n.packingNumber}</title>
            <style>
              body { font-family: 'Segoe UI', Arial, sans-serif; margin: 0; padding: 24px; background: #fff; color: #222; }
              .header { text-align: center; margin-bottom: 32px; border-bottom: 2px solid #1976d2; padding-bottom: 16px; }
              .header h1 { margin: 0; font-size: 2.2rem; color: #1976d2; }
              .header h2 { margin: 0; font-size: 1.2rem; color: #555; font-weight: 400; }
              .info-section { margin-bottom: 28px; }
              .info-grid { display: flex; gap: 32px; justify-content: center; margin-bottom: 12px; }
              .info-item { background: #f5faff; border: 1px solid #e3eafc; padding: 14px 18px; border-radius: 8px; min-width: 180px; }
              .info-label { font-weight: 600; color: #1976d2; font-size: 13px; }
              .info-value { font-size: 15px; margin-top: 4px; color: #222; }
              .section-title { font-size: 1.1rem; color: #1976d2; font-weight: 600; margin-bottom: 10px; margin-top: 30px; }
              .table-section { margin-bottom: 24px; border-radius: 10px; box-shadow: 0 2px 8px #e3eafc; background: #fafdff; padding: 10px 10px 4px 10px; }
              .table-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
              .table-title { font-weight: 600; color: #1976d2; font-size: 1rem; }
              .table-subtitle { color: #888; font-size: 12px; }
              table { width: 100%; border-collapse: collapse; margin-bottom: 6px; }
              th, td { border: 1px solid #e3eafc; padding: 4px 7px; font-size: 12px; }
              th { background: #e3eafc; color: #1976d2; font-weight: 600; }
              td { background: #fff; }
              .table-summary { background: #f5faff; padding: 6px; border-radius: 0 0 8px 8px; font-size: 12px; color: #1976d2; border: 1px solid #e3eafc; border-top: none; }
              .sub-table-title { font-size: 0.95rem; color: #388e3c; font-weight: 600; margin: 7px 0 2px 0; }
              .overall-summary { background: #e3f2fd; padding: 10px; border-radius: 8px; border: 1px solid #1976d2; margin-top: 18px; }
              .overall-title { font-weight: 700; color: #1976d2; margin-bottom: 7px; font-size: 1.05rem; }
              .overall-stats { display: flex; gap: 24px; font-size: 0.98rem; }
              .highlight { color: #388e3c; font-weight: 600; }
              @media print {
                body { margin: 0; padding: 0; background: #fff; }
                .no-print { display: none; }
                .header { margin-bottom: 12px; padding-bottom: 6px; }
                .info-section { margin-bottom: 10px; }
                .info-grid { gap: 10px; margin-bottom: 4px; }
                .info-item { padding: 6px 8px; min-width: 120px; font-size: 11px; background: #fff !important; border-color: #e3eafc !important; }
                .info-label { font-size: 11px; }
                .info-value { font-size: 12px; }
                .table-section, .overall-summary { box-shadow: none !important; background: #fff !important; margin-bottom: 10px; padding: 4px 2px 2px 2px; page-break-inside: avoid; }
                .sub-table-title { margin: 3px 0 1px 0; font-size: 11px; }
                table { margin-bottom: 2px; }
                th, td { padding: 2px 4px; font-size: 10px; }
                .table-summary { padding: 3px; font-size: 10px; }
                .overall-summary { padding: 5px; margin-top: 8px; }
                .overall-title { font-size: 11px; margin-bottom: 3px; }
                .overall-stats { gap: 10px; font-size: 10px; }
              }
            </style>
          </head>
          <body>
            <div class="header">
              <h1>Packing Details</h1>
              <h2>Packing No: ${n.packingNumber} | Date: ${new Date(n.createdAt||"").toLocaleDateString()}</h2>
            </div>
            <div class="info-section">
              <div class="info-grid">
                <div class="info-item">
                  <div class="info-label">Client Name</div>
                  <div class="info-value">${n.clientName}</div>
                </div>
                <div class="info-item">
                  <div class="info-label">Phone Number</div>
                  <div class="info-value">${n.phoneNumber}</div>
                </div>
                <div class="info-item">
                  <div class="info-label">Experience Center</div>
                  <div class="info-value">${n.experienceCenterName||"Main Unit"}</div>
                </div>
              </div>
            </div>
            ${Object.entries(v).map(([f,x])=>{const s=x[0],S=x.reduce((a,u)=>a+(parseFloat(u.sqft)||0),0);return`
                  <div class="table-section">
                    <div class="table-header">
                      <div class="table-title">${s.name} (${s.country})</div>
                      <div class="table-subtitle">Master Barcode: <span class="highlight">${f}</span></div>
                    </div>
                    <table>
                      <thead>
                        <tr>
                         <th>S.No</th>
                          <th>Master Barcode</th>
                          <th>Country</th>
                          <th>Type</th>
                          <th>Name</th>
                          <th>Unit</th>
                          <th>Sqft</th>
                        </tr>
                      </thead>
                      <tbody>
                        ${x.map((a,u)=>`<tr>
                                <td>${u+1}</td>
                                <td>${a.masterBarcode}</td>
                                <td>${a.country}</td>
                                <td>${a.type}</td>
                                <td>${a.name}</td>
                                <td>${a.unit}</td>
                                <td>${a.sqft}</td>
                              </tr>`).join("")}
                      </tbody>
                    </table>
                    <div class="table-summary">
                      Items: ${x.length} | Total Sqft: <span class="highlight">${S}</span>
                    </div>
                    ${x.map(a=>a.packingItemDetailDTOList&&a.packingItemDetailDTOList.length>0?`<div class="sub-table-title">Sub Items for ${a.name} (${a.masterBarcode}):</div>
                                <table>
                                  <thead>
                                    <tr>
                                      <th>S.No</th>
                                      <th>Sub Barcode</th>
                                      <th>Width</th>
                                      <th>Length</th>
                                      <th>UOM</th>
                                      <th>Quantity</th>
                                      <th>Storage Type</th>
                                    </tr>
                                  </thead>
                                  <tbody>
                                    ${a.packingItemDetailDTOList.map((u,D)=>`<tr>
                                            <td>${D+1}</td>
                                            <td>${u.subBarcode}</td>
                                            <td>${u.width}</td>
                                            <td>${u.length}</td>
                                            <td>${u.uom}</td>
                                            <td>${u.quantity}</td>
                                            <td>${u.storageType||"-"}</td>
                                          </tr>`).join("")}
                                  </tbody>
                                </table>`:"").join("")}
                  </div>
                `}).join("")}
            <div class="overall-summary">
              <div class="overall-title">Overall Summary</div>
              <div class="overall-stats">
                <span>Total Items: <span class="highlight">${n.items.length}</span></span>
                <span>Total Sqft: <span class="highlight">${n.totalSqft}</span></span>
              </div>
            </div>
          </body>
        </html>
      `;i.document.write(h),i.document.close(),i.focus(),i.print(),i.close()}};return t(tt,{open:P,onClose:y,children:o(l,{sx:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"95%",maxWidth:1200,maxHeight:"95vh",bgcolor:"background.paper",borderRadius:3,boxShadow:24,p:0,overflow:"hidden"},children:[t(l,{sx:{p:3,borderBottom:`1px solid ${b.palette.divider}`,backgroundColor:N(b.palette.primary.main,.07)},children:o(l,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o(l,{children:[o(m,{variant:"h5",fontWeight:700,color:"primary",children:["Packing Details - ",n.packingNumber]}),o(m,{variant:"body2",color:"text.secondary",sx:{mt:.5},children:["Created on ",new Date(n.createdAt).toLocaleDateString()]})]}),o(l,{sx:{display:"flex",alignItems:"center",gap:1},children:[n.status==="PENDING"&&$.write&&o(ie,{children:[t(Y,{btnType:"approve",onClick:()=>w==null?void 0:w("APPROVED",n.id),children:"Approve"}),t(Y,{btnType:"close",onClick:()=>I==null?void 0:I("REJECTED",n.id),children:"Reject"})]}),t(Y,{btnType:"print",onClick:L,children:"Print"}),t(A,{onClick:y,size:"large",children:t(Fe,{})})]})]})}),o(l,{sx:{p:{xs:1,md:3},maxHeight:"calc(95vh - 120px)",overflow:"auto"},children:[o(ze,{sx:{p:3,mb:3,backgroundColor:i=>i.palette.mode==="dark"?"rgba(3, 169, 244, 0.1)":N(i.palette.info.main,.07),borderRadius:2,boxShadow:0},children:[t(m,{variant:"h6",sx:{mb:2,color:b.palette.info.main,fontWeight:600},children:"Client Information"}),o(B,{container:!0,spacing:3,children:[t(B,{item:!0,xs:12,md:4,children:o(l,{children:[t(m,{variant:"body2",color:"text.secondary",gutterBottom:!0,fontWeight:600,children:"Client Name"}),t(m,{variant:"body1",fontWeight:700,color:"primary.main",children:n.clientName})]})}),t(B,{item:!0,xs:12,md:4,children:o(l,{children:[t(m,{variant:"body2",color:"text.secondary",gutterBottom:!0,fontWeight:600,children:"Phone Number"}),t(m,{variant:"body1",fontWeight:700,color:"primary.main",children:n.phoneNumber})]})}),t(B,{item:!0,xs:12,md:4,children:o(l,{children:[t(m,{variant:"body2",color:"text.secondary",gutterBottom:!0,fontWeight:600,children:"Experience Center"}),t(m,{variant:"body1",fontWeight:700,color:"primary.main",children:n.experienceCenterName||"Main Unit"})]})})]})]}),Object.entries(v).map(([i,h])=>{const f=h[0],x=h.reduce((s,S)=>s+(parseFloat(S.sqft)||0),0);return o(l,{sx:{mb:4,borderRadius:2,boxShadow:1,background:s=>s.palette.mode==="dark"?"rgba(255,255,255,0.02)":"#fff",p:2,border:s=>`1px solid ${s.palette.mode==="dark"?"rgba(25, 118, 210, 0.2)":N(s.palette.primary.main,.08)}`},children:[o(l,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,p:1.5,backgroundColor:s=>s.palette.mode==="dark"?"rgba(25, 118, 210, 0.1)":N(s.palette.primary.main,.04),borderRadius:1,border:s=>`1px solid ${s.palette.mode==="dark"?"rgba(25, 118, 210, 0.2)":N(s.palette.primary.main,.08)}`},children:[o(l,{children:[o(m,{variant:"h6",sx:{color:b.palette.primary.main,fontWeight:700},children:[f.name," (",f.country,")"]}),f.type&&o(m,{variant:"body2",color:"text.secondary",sx:{mt:.5},children:["Colour: ",t("span",{style:{color:b.palette.info.main,fontWeight:600},children:f.type})]})]}),o(m,{variant:"h6",sx:{color:b.palette.primary.main,fontWeight:700},children:["Price: ₹",f.sellingPricePerUom]}),o(m,{variant:"body2",color:"text.secondary",children:["Master Barcode: ",t("span",{style:{color:b.palette.success.main,fontWeight:600},children:i})]})]}),(()=>{const S=h.filter(a=>a.packingItemDetailDTOList&&a.packingItemDetailDTOList.length>0).flatMap(a=>a.packingItemDetailDTOList).filter((a,u,D)=>u===D.findIndex(W=>W.subBarcode===a.subBarcode));return S.length>0?t(l,{sx:{mt:2,mb:2,ml:2,background:a=>a.palette.mode==="dark"?"rgba(3, 169, 244, 0.1)":"#f5faff",borderRadius:1,p:2,border:a=>`1px solid ${a.palette.mode==="dark"?"rgba(3, 169, 244, 0.2)":N(a.palette.info.main,.08)}`},children:t(Be,{component:et,sx:{boxShadow:0},children:o(Ae,{size:"small",children:[t(Le,{children:o(Z,{children:[t(g,{sx:{fontWeight:700},children:"S.No"}),t(g,{sx:{fontWeight:700},children:"Sub Barcode"}),t(g,{sx:{fontWeight:700},children:"Width"}),t(g,{sx:{fontWeight:700},children:"Length"}),t(g,{sx:{fontWeight:700},children:"UOM"}),t(g,{sx:{fontWeight:700},children:"Quantity"}),t(g,{sx:{fontWeight:700},children:"Storage Type"})]})}),t(We,{children:S.map((a,u)=>o(Z,{children:[t(g,{children:u+1}),t(g,{children:a.subBarcode}),t(g,{children:a.width}),t(g,{children:a.length}),t(g,{children:a.uom}),t(g,{children:a.quantity}),t(g,{children:a.storageType||"-"})]},a.id||`${a.subBarcode}-${u}`))})]})})}):null})(),o(l,{sx:{background:s=>s.palette.mode==="dark"?"rgba(25, 118, 210, 0.1)":"#e3f2fd",p:1.5,borderRadius:1,mt:1,fontWeight:600,color:b.palette.primary.main},children:["Items: ",h.length," | Total Sqft: ",t("span",{style:{color:b.palette.success.main},children:x})]})]},i)}),o(l,{sx:{mt:3,p:2,backgroundColor:i=>i.palette.mode==="dark"?"rgba(25, 118, 210, 0.1)":N(i.palette.primary.main,.07),borderRadius:2,border:i=>`1px solid ${i.palette.mode==="dark"?"rgba(25, 118, 210, 0.2)":N(i.palette.primary.main,.08)}`,display:"flex",justifyContent:"space-between",alignItems:"center",boxShadow:0},children:[t(m,{variant:"h6",color:"primary",fontWeight:700,children:"Overall Summary"}),o(l,{sx:{display:"flex",gap:3},children:[o(m,{variant:"body1",color:"text.secondary",children:["Total Items: ",t("span",{style:{fontWeight:700,color:b.palette.primary.main},children:n.items.length})]}),o(m,{variant:"body1",color:"text.secondary",children:["Total Sqft: ",t("span",{style:{fontWeight:700,color:b.palette.success.main},children:n.totalSqft})]})]})]})]})]})})},Nt=({onCreateNew:P,onEditPacking:y})=>{const n=se(),[w,I]=c.useState("list"),[$,b]=c.useState("PENDING"),[v,L]=c.useState({packingNumber:"",clientName:"",experienceCenter:"",phoneNumber:""}),[i,h]=c.useState(null),[f,x]=c.useState(!1),[s,S]=c.useState(null),[a,u]=c.useState(null),[D,W]=c.useState(null),[nt,it]=c.useState(!1),[st,lt]=c.useState(null),[le,de]=c.useState({}),R=Pe(e=>e.userRole.roleDetails),ce=[v.packingNumber,v.clientName,v.experienceCenter,v.phoneNumber].filter(Boolean).join(" ");c.useEffect(()=>{if(R){const e=R.find(p=>p.applicationEntityName.toLowerCase().replace(/\s+/g,"")==="packinglists");de(e)}},[R]);const E=Je(ce,500),[T,q]=c.useState({page:0,pageSize:10}),{openSnackbar:C}=we(),[O,j]=c.useState([]),[pe,V]=c.useState(0),[H,{data:dt={},isLoading:ue}]=rt(),[ct]=Qe(),[pt]=Ge(),[me]=Ye(),{data:U,isLoading:ut,refetch:mt}=He(s!==null?{id:s}:_e.skipToken,{refetchOnMountOrArgChange:!0});c.useEffect(()=>{if(U&&s){const e=Se(U);h(e)}},[U,s]);const[he,F]=c.useState(null),Q=c.useCallback(async(e,p)=>{F(null);try{const r=await H({page:e,size:p,searchByName:{searchValue:E},type:$});if(r&&r.data){const k=r.data,z=(k.data||[]).map((d,M)=>({packingNumber:d.packingNumber||`temp-${d.id||M}`,orderNumber:d.orderNumber||d.packingNumber||`temp-${d.id||M}`,clientName:d.clientName||"",phoneNumber:d.phoneNumber||"",totalSqft:d.totalSqft||0,totalAmount:d.totalAmount||0,items:d.packingItemsDTOList||[],id:d.id||d.orderId||M,orderId:d.orderId||d.id,createdDate:d.createdDate||"",experience:d.experience||"Main Unit",status:d.status||""}));j(z),V(k.totalCount||0)}else{F(r.error);const k=r.error;j([]),V(0)}}catch(r){F(r),j([]),V(0)}},[H,E,$]);c.useEffect(()=>{Q(T.page,T.pageSize)},[Q,T,E]),new Set(O.map(e=>e.clientName)).size,O.reduce((e,p)=>e+(p.totalSqft||0),0),O.reduce((e,p)=>e+(p.totalAmount||0),0);const[ge,be]=c.useState(null),_=async e=>{be(e.id);try{e.orderId?(S(e.orderId),x(!0)):(h(e),x(!0))}catch{h(e),x(!0)}},J=()=>{x(!1),h(null),S(null)},G=()=>{u(null),W(null)},fe=()=>{D&&C("Packing List approved!","success"),G()},xe=()=>{D&&C("Packing List rejected!","error"),G()},K=async(e,p)=>{var r;if(i&&i.id){const k=parseInt(ge);if(isNaN(k)){C("Invalid packing ID","error");return}const z=await me({id:k,status:e});if("data"in z)C(`Order Booking ${e.toLowerCase()}!`,"success"),Q(T.page,T.pageSize),J();else{const d=z.error,M=((r=d==null?void 0:d.data)==null?void 0:r.message)??"An error occurred";C(M,"error")}}},X=(e,p)=>{L(r=>({...r,[e]:p})),q(r=>({...r,page:0}))},ye=(e,p)=>{b(p),q(r=>({...r,page:0}))},ke=e=>{e&&(navigator&&navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(e).then(()=>{C("Pack No copied to clipboard.","success")}).catch(()=>{C("Failed to copy Pack No.","error")}):C("Clipboard not supported in this browser.","error"))},ve=[{field:"clientName",headerName:"Client",flex:1},{field:"phoneNumber",headerName:"Phone",flex:1},{field:"experience",headerName:"Experience",flex:1},{field:"orderNumber",headerName:"Pack No",flex:1,renderCell:e=>{const p=e.value||e.row.orderNumber||e.row.packingNumber||"";return o(ne,{direction:"row",alignItems:"center",spacing:1,children:[t(m,{variant:"body2",sx:{fontFamily:"monospace"},children:p}),p&&t(A,{size:"small",onClick:r=>{r.stopPropagation(),ke(p)},children:t(Ue,{fontSize:"small"})})]})}},{field:"createdDate",headerName:"Created On",flex:1,renderCell:e=>te(e.value).format("M/D/YYYY h:mm A")},{field:"status",headerName:"Status",flex:1,renderCell:e=>Te(e.value)},{field:"action",headerName:"Action",flex:1.5,sortable:!1,renderCell:e=>((e.row.status||"").toUpperCase(),t(ne,{direction:"row",spacing:1,children:t(Oe,{type:"View",onClick:()=>_(e.row)})}))}];function Se(e){var p;return{packingNumber:e.packingNumber,orderNumber:e.orderNumber||e.packingNumber,clientName:e.clientName,phoneNumber:e.phoneNumber,experienceCenterName:e.experience||"Main Unit",totalSqft:Array.isArray(e.packingItemsDTOList)?e.packingItemsDTOList.reduce((r,k)=>r+(k.totalQuantity||0),0):0,totalAmount:Array.isArray(e.packingItemsDTOList)?e.packingItemsDTOList.reduce((r,k)=>r+(k.totalQuantity||0)*(k.sellingPricePerUom||0),0):0,items:Array.isArray(e.packingItemsDTOList)?e.packingItemsDTOList.map(r=>({id:r.id,country:r.country,type:r.colour||"",name:r.productName,masterBarcode:r.masterBarcode,barcode:r.masterBarcode,unit:r.uom,sqft:r.totalQuantity,rate:r.sellingPricePerUom||0,total:((r.totalQuantity||0)*(r.sellingPricePerUom||0)).toFixed(2),sellingPricePerUom:r.sellingPricePerUom||0,packingItemDetailDTOList:r.packingItemDetailDTOList||[]})):[],createdAt:e.createdDate||e.date||"",status:e.status||"",id:((p=e.id)==null?void 0:p.toString())||""}}const Ce=c.useCallback(()=>t("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",color:n.palette.text.secondary,fontSize:"16px"},children:"No Data Available"}),[n.palette.text.secondary]);return t(Me,{error:he,children:o(l,{p:2,sx:{width:"100%"},children:[o(Ie,{children:[t(l,{sx:{mb:3},children:o(Ke,{value:$,onChange:ye,"aria-label":"packing list tabs",sx:{mb:2,"& .MuiTab-root":{fontWeight:600,textTransform:"none",fontSize:"1rem"}},children:[t(ee,{value:"PENDING",label:"PENDING"}),t(ee,{value:"APPROVED",label:"APPROVED"})]})}),o(l,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:[t(l,{sx:{display:"flex",gap:2,alignItems:"center",flexWrap:"wrap"},children:t(Xe,{placeholder:"Search packing number...",variant:"outlined",size:"small",value:v.packingNumber,sx:{width:240,"& .MuiOutlinedInput-root":{backgroundColor:e=>e.palette.mode==="dark"?"rgba(255,255,255,0.05)":"white","&:hover":{"& .MuiOutlinedInput-notchedOutline":{borderColor:"primary.main"}}}},onChange:e=>X("packingNumber",e.target.value),InputProps:{startAdornment:t(A,{edge:"start",size:"small",sx:{color:"text.secondary"},children:t(Ee,{})}),endAdornment:v.packingNumber&&t(A,{edge:"end",onClick:()=>X("packingNumber",""),size:"small",sx:{color:"text.secondary"},children:t(Re,{})})}})}),t(l,{})]}),w==="list"?t(De,{columns:ve,rows:O,checkboxSelection:!1,enableManageColumns:!0,defaultHiddenColumns:["id"],autoHeight:!0,getRowId:e=>e.packingNumber||e.id||`row-${Math.random()}`,rowCount:pe,paginationMode:"server",paginationModel:T,onPaginationModelChange:q,pageSizeOptions:[10,25,50,100],components:{NoRowsOverlay:Ce},loading:ue,mobileCardRenderer:e=>t($e,{title:e.orderNumber||e.packingNumber||`Packing #${e.id}`,fields:[{label:"Client",value:e.clientName},{label:"Phone",value:e.phoneNumber},{label:"Status",value:e.status},{label:"Created",value:e.createdDate?te(e.createdDate).format("M/D/YYYY"):"-"}],actions:[{icon:t(qe,{fontSize:"small"}),label:"View",onClick:()=>_(e)}]})}):t(ie,{})]}),t(ot,{open:f,onClose:J,packing:i,onApprove:K,onReject:K,entity:le}),o(Ze,{anchorEl:a,open:!!a,onClose:G,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},PaperProps:{sx:{mt:1,minWidth:180,boxShadow:e=>e.palette.mode==="dark"?"0 8px 32px rgba(0,0,0,0.3)":"0 8px 32px rgba(0,0,0,0.12)",borderRadius:3,border:"1px solid",borderColor:e=>e.palette.divider,overflow:"hidden"}},children:[o(ae,{onClick:fe,sx:{py:2,px:2,"&:hover":{backgroundColor:e=>e.palette.mode==="dark"?"success.dark":"success.50"},borderBottom:"1px solid",borderColor:e=>e.palette.divider},children:[t(re,{children:t(l,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,borderRadius:"50%",backgroundColor:"success.100",mr:1.5},children:t(je,{fontSize:"small",sx:{color:"success.main"}})})}),t(oe,{primary:"Approve",primaryTypographyProps:{fontSize:"0.95rem",fontWeight:600,color:"success.main"},secondary:"Mark as approved",secondaryTypographyProps:{fontSize:"0.75rem",color:"text.secondary"}})]}),o(ae,{onClick:xe,sx:{py:2,px:2,"&:hover":{backgroundColor:e=>e.palette.mode==="dark"?"error.dark":"error.50"}},children:[t(re,{children:t(l,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,borderRadius:"50%",backgroundColor:"error.100",mr:1.5},children:t(Ve,{fontSize:"small",sx:{color:"error.main"}})})}),t(oe,{primary:"Reject",primaryTypographyProps:{fontSize:"0.95rem",fontWeight:600,color:"error.main"},secondary:"Mark as rejected",secondaryTypographyProps:{fontSize:"0.75rem",color:"text.secondary"}})]})]})]})})};export{Nt as default};
