import{O as pe,r as h,at as Pe,a as Be,b as t,j as r,Q as Me,B as o,T as Ae,o as q,p as ze,bi as $e,A as j,e as Ee,H as We,F as he,bl as Re,R as ne,bm as oe,bY as Le,bn as ie,bZ as qe,Y as je,g as Ve,c4 as Ue,q as s,be as Ge,S as se,I as Y,aI as D,t as le,aj as _e,G as L,s as Qe,a0 as Fe,v as He,w as Ke,x as de,y as x,z as Ye,b_ as Je,u as Ze,c as ce}from"./index-ktJf6c6X.js";import{c as Xe,r as et,d as tt,u as at,a as rt,b as nt}from"./finishedGoodsInventoryApi-Dja9Al1r.js";import{u as ot}from"./useDebounce-CaL4UoZq.js";import{r as it}from"./renderStatusBox-CoIp7mNd.js";import{C as st}from"./ContentCopy-5ceei5pJ.js";import{C as lt}from"./Close-Df3VFe0l.js";const dt=({open:O,onClose:T,packing:l,onApprove:P,onReject:z,entity:I})=>{const g=pe();if(!l)return null;const k=(l.items||[]).reduce((i,y)=>{const m=y.masterBarcode;return i[m]||(i[m]=[]),i[m].push(y),i},{}),$=()=>{const i=window.open("","_blank");if(i){const y=`
        <html>
          <head>
            <title>Order Booking - ${l.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>Order Booking</h1>
              <h2>Order No: ${l.packingNumber} | Date: ${le(l.createdAt||"")}</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">${l.clientName}</div>
                </div>
                <div class="info-item">
                  <div class="info-label">Phone Number</div>
                  <div class="info-value">${l.phoneNumber}</div>
                </div>
                <div class="info-item">
                  <div class="info-label">Experience Center</div>
                  <div class="info-value">${l.experienceCenterName||"Main Unit"}</div>
                </div>
              </div>
            </div>
            ${Object.entries(k).map(([m,S])=>{const c=S[0],N=S.reduce((d,u)=>d+(parseFloat(u.sqft)||0),0),C=S.filter(d=>d.packingItemDetailDTOList&&d.packingItemDetailDTOList.length>0).flatMap(d=>d.packingItemDetailDTOList).filter((d,u,E)=>u===E.findIndex(B=>B.subBarcode===d.subBarcode)),A=C.length>0?C.length:S.length;return`
                  <div class="table-section">
                    <div class="table-header">
                      <div class="table-title">${c.name} (${c.country})</div>
                      <div class="table-subtitle">Master Barcode: <span class="highlight">${m}</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>
                        <tr>
                          <td>1</td>
                          <td>${m}</td>
                          <td>${c.country}</td>
                          <td>${c.type}</td>
                          <td>${c.name}</td>
                          <td>${c.unit}</td>
                          <td>${N}</td>
                        </tr>
                      </tbody>
                    </table>
                    <div class="table-summary">
                      Items: ${A} | Total Sqft: <span class="highlight">${N}</span>
                    </div>
                    ${C.length>0?`<div class="sub-table-title">Sub Items for ${c.name} (${m}):</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>
                                    ${C.map((d,u)=>`<tr>
                                            <td>${u+1}</td>
                                            <td>${d.subBarcode}</td>
                                            <td>${d.width}</td>
                                            <td>${d.length}</td>
                                            <td>${d.uom}</td>
                                            <td>${d.quantity}</td>
                                            <td>${d.storageType||"-"}</td>
                                          </tr>`).join("")}
                                  </tbody>
                                </table>`:""}
                  </div>
                `}).join("")}
            <div class="overall-summary">
              <div class="overall-title">Overall Summary</div>
              <div class="overall-stats">
                <span>Total Items: <span class="highlight">${l.items.length}</span></span>
                <span>Total Sqft: <span class="highlight">${l.totalSqft}</span></span>
              </div>
            </div>
          </body>
        </html>
      `;i.document.write(y),i.document.close(),i.focus(),i.print(),i.close()}};return t(Je,{open:O,onClose:T,children:r(o,{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(o,{sx:{p:3,borderBottom:`1px solid ${g.palette.divider}`,backgroundColor:D(g.palette.primary.main,.07)},children:r(o,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[r(o,{children:[r(s,{variant:"h5",fontWeight:700,color:"primary",children:["Order Booking - ",l.packingNumber]}),r(s,{variant:"body2",color:"text.secondary",sx:{mt:.5},children:["Created on ",le(l.createdAt)]})]}),r(o,{sx:{display:"flex",alignItems:"center",gap:1},children:[l.status==="PENDING_APPROVAL"&&I.write&&r(he,{children:[t(j,{btnType:"approve",onClick:()=>P==null?void 0:P("APPROVED"),children:"Approve"}),t(j,{btnType:"close",onClick:()=>z==null?void 0:z("REJECTED"),children:"Rejected"})]}),t(j,{btnType:"print",onClick:$,children:"Print"}),t(q,{onClick:T,size:"large",children:t(lt,{})})]})]})}),r(o,{sx:{p:{xs:1,md:3},maxHeight:"calc(95vh - 120px)",overflow:"auto"},children:[r(_e,{sx:{p:3,mb:3,backgroundColor:i=>i.palette.mode==="dark"?"rgba(3, 169, 244, 0.1)":D(i.palette.info.main,.07),borderRadius:2,boxShadow:0},children:[t(s,{variant:"h6",sx:{mb:2,color:g.palette.info.main,fontWeight:600},children:"Client Information"}),r(L,{container:!0,spacing:3,children:[t(L,{item:!0,xs:12,md:4,children:r(o,{children:[t(s,{variant:"body2",color:"text.secondary",gutterBottom:!0,fontWeight:600,children:"Client Name"}),t(s,{variant:"body1",fontWeight:700,color:"primary.main",children:l.clientName})]})}),t(L,{item:!0,xs:12,md:4,children:r(o,{children:[t(s,{variant:"body2",color:"text.secondary",gutterBottom:!0,fontWeight:600,children:"Phone Number"}),t(s,{variant:"body1",fontWeight:700,color:"primary.main",children:l.phoneNumber})]})}),t(L,{item:!0,xs:12,md:4,children:r(o,{children:[t(s,{variant:"body2",color:"text.secondary",gutterBottom:!0,fontWeight:600,children:"Experience Center"}),t(s,{variant:"body1",fontWeight:700,color:"primary.main",children:l.experienceCenterName||"Main Unit"})]})})]})]}),Object.entries(k).map(([i,y])=>{const m=y[0],S=y.reduce((c,N)=>c+(parseFloat(N.sqft)||0),0);return r(o,{sx:{mb:4,borderRadius:2,boxShadow:1,p:2,border:`1px solid ${D(g.palette.primary.main,.08)}`},children:[r(o,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,p:1.5,backgroundColor:c=>c.palette.mode==="dark"?"rgba(25, 118, 210, 0.1)":D(c.palette.primary.main,.04),borderRadius:1,border:c=>`1px solid ${c.palette.mode==="dark"?"rgba(25, 118, 210, 0.2)":D(c.palette.primary.main,.08)}`},children:[r(o,{children:[r(s,{variant:"h6",sx:{color:g.palette.primary.main,fontWeight:700},children:[m.name," (",m.country,")"]}),m.type&&r(s,{variant:"body2",color:"text.secondary",sx:{mt:.5},children:["Colour: ",t("span",{style:{color:g.palette.info.main,fontWeight:600},children:m.type})]})]}),r(s,{variant:"h6",sx:{color:g.palette.primary.main,fontWeight:700},children:["Price: ₹",m.sellingPricePerUom]}),r(s,{variant:"body2",color:"text.secondary",children:["Master Barcode: ",t("span",{style:{color:g.palette.success.main,fontWeight:600},children:i})]})]}),(()=>{const N=y.filter(p=>p.packingItemDetailDTOList&&p.packingItemDetailDTOList.length>0).flatMap(p=>p.packingItemDetailDTOList).filter((p,C,A)=>C===A.findIndex(d=>d.subBarcode===p.subBarcode));return N.length>0?t(o,{sx:{mt:2,mb:2,ml:2,borderRadius:1,p:2,border:`1px solid ${D(g.palette.info.main,.08)}`},children:t(Qe,{component:Fe,sx:{boxShadow:0},children:r(He,{size:"small",children:[t(Ke,{children:r(de,{children:[t(x,{sx:{fontWeight:700},children:"S.No"}),t(x,{sx:{fontWeight:700},children:"Sub Barcode"}),t(x,{sx:{fontWeight:700},children:"Width"}),t(x,{sx:{fontWeight:700},children:"Length"}),t(x,{sx:{fontWeight:700},children:"UOM"}),t(x,{sx:{fontWeight:700},children:"Quantity"}),t(x,{sx:{fontWeight:700},children:"Storage Type"})]})}),t(Ye,{children:N.map((p,C)=>r(de,{children:[t(x,{children:C+1}),t(x,{children:p.subBarcode}),t(x,{children:p.width}),t(x,{children:p.length}),t(x,{children:p.uom}),t(x,{children:p.quantity}),t(x,{children:p.storageType||"-"})]},p.id||`${p.subBarcode}-${C}`))})]})})}):null})(),r(o,{sx:{p:1.5,borderRadius:1,mt:1,fontWeight:600,color:g.palette.primary.main},children:["Items: ",y.length," | Total Sqft: ",t("span",{style:{color:g.palette.success.main},children:S})]})]},i)}),r(o,{sx:{mt:3,p:2,backgroundColor:i=>i.palette.mode==="dark"?"rgba(25, 118, 210, 0.1)":D(i.palette.primary.main,.07),borderRadius:2,border:i=>`1px solid ${i.palette.mode==="dark"?"rgba(25, 118, 210, 0.2)":D(i.palette.primary.main,.08)}`,display:"flex",justifyContent:"space-between",alignItems:"center",boxShadow:0},children:[t(s,{variant:"h6",color:"primary",fontWeight:700,children:"Overall Summary"}),r(o,{sx:{display:"flex",gap:3},children:[r(s,{variant:"body1",color:"text.secondary",children:["Total Items: ",t("span",{style:{fontWeight:700,color:g.palette.primary.main},children:l.items.length})]}),r(s,{variant:"body1",color:"text.secondary",children:["Total Sqft: ",t("span",{style:{fontWeight:700,color:g.palette.success.main},children:l.totalSqft})]})]})]})]})]})})},ct=({onCreateNew:O,onEditPacking:T})=>{const l=pe(),[P,z]=h.useState("list"),[I,g]=h.useState({packingNumber:"",clientName:"",experienceCenter:"",phoneNumber:""}),[k,$]=h.useState(null),[i,y]=h.useState(!1),[m,S]=h.useState(null),[c,N]=h.useState(null),[p,C]=h.useState(null),[A,d]=h.useState(!1),[u,E]=h.useState(null),[B,me]=h.useState({}),V=Pe(e=>e.userRole.roleDetails),ue=[I.packingNumber,I.clientName,I.experienceCenter,I.phoneNumber].filter(Boolean).join(" ");h.useEffect(()=>{if(V){const e=V.find(a=>a.applicationEntityName.toLowerCase().replace(/\s+/g,"")==="orderbookings");me(e)}},[V]);const U=ot(ue,500),{data:G,isLoading:pt,refetch:J}=Xe(m!==null?{id:m}:et.skipToken,{refetchOnMountOrArgChange:!0});h.useEffect(()=>{},[G,m]);const[w,Z]=h.useState({page:0,pageSize:10}),{openSnackbar:f}=Be(),[W,_]=h.useState([]),[ge,Q]=h.useState(0),[X,{data:ht={},isLoading:fe}]=tt(),[mt]=at(),[be]=rt(),[xe]=nt(),[ye,F]=h.useState(null),R=h.useCallback(async(e,a)=>{F(null);try{const n=await X({page:e,size:a,searchByName:{searchValue:U}});if(n&&n.data){const v=n.data,M=(v.data||[]).map((b,re)=>({packingNumber:b.packingNumber||`temp-${b.id||re}`,clientName:b.clientName||"",phoneNumber:b.phoneNumber||"",totalSqft:b.totalSqft||0,totalAmount:b.totalAmount||0,items:b.packingItemsDTOList||[],id:b.id!==void 0&&b.id!==null?b.id:re,createdAt:b.createdDate||"",experience:b.experience||"Main Unit",status:b.status||""}));_(M),Q(v.totalCount||0)}else{F(n.error);const v=n.error;_([]),Q(0)}}catch(n){F(n),_([]),Q(0)}},[X,U]);h.useEffect(()=>{R(w.page,w.pageSize)},[R,w,U]),new Set(W.map(e=>e.clientName)).size,W.reduce((e,a)=>e+(a.totalSqft||0),0),W.reduce((e,a)=>e+(a.totalAmount||0),0);const ve=e=>{if(e.id===void 0||e.id===null||e.id===""){f("Cannot view: Missing packing ID","error");return}const a=typeof e.id=="string"?parseInt(e.id):e.id;if(isNaN(a)){f("Invalid packing ID","error");return}S(a),$(e),y(!0),typeof J=="function"&&J()},ke=e=>{if(e.id===void 0||e.id===null||e.id===""){f("Cannot edit: Missing packing ID","error");return}if(T)try{T(e)}catch{f("Error opening edit mode","error")}},H=()=>{y(!1),$(null),S(null)},K=()=>{N(null),C(null)},Ce=()=>{p&&f("Order Booking approved!","success"),K()},Se=()=>{p&&f("Order Booking rejected!","error"),K()},Ne=e=>{E(e),d(!0)},ee=()=>{d(!1),E(null)},Ie=async()=>{var e;if(u&&u.id){const a=parseInt(u.id.toString());if(isNaN(a)){f("Invalid packing ID","error");return}const n=await be({orderId:a,orderNumber:u.packingNumber||""});if("data"in n)f("Order Booking sent for approval!","success"),R(w.page,w.pageSize),H();else{const v=n.error,M=((e=v==null?void 0:v.data)==null?void 0:e.message)??"An error occurred";f(M,"error")}}ee()},te=async e=>{var a;if(k&&k.id!==void 0&&k.id!==null&&k.id!==""){const n=typeof k.id=="string"?parseInt(k.id):k.id;if(isNaN(n)){f("Invalid packing ID","error");return}const v=await xe({id:n,status:e});if("data"in v)f(`Order Booking ${e.toLowerCase()}!`,"success"),R(w.page,w.pageSize),H();else{const M=v.error,b=((a=M==null?void 0:M.data)==null?void 0:a.message)??"An error occurred";f(b,"error")}}},we=e=>{e&&(navigator&&navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(e).then(()=>{f("Pack No copied to clipboard.","success")}).catch(()=>{f("Failed to copy Pack No.","error")}):f("Clipboard not supported in this browser.","error"))},ae=(e,a)=>{g(n=>({...n,[e]:a})),Z(n=>({...n,page:0}))},De=[{field:"clientName",headerName:"Client",flex:1},{field:"phoneNumber",headerName:"Phone",flex:1},{field:"experience",headerName:"Experience",flex:1},{field:"packingNumber",headerName:"Pack No",flex:1.2,renderCell:e=>{const a=e.value||e.row.packingNumber||"";return r(se,{direction:"row",alignItems:"center",spacing:1,children:[t(s,{variant:"body2",sx:{fontFamily:"monospace"},children:a}),a&&t(q,{size:"small",onClick:n=>{n.stopPropagation(),we(a)},children:t(st,{fontSize:"small"})})]})}},{field:"createdAt",headerName:"Created",flex:1,renderCell:e=>We(e.value)},{field:"status",headerName:"Status",flex:1,renderCell:e=>it(e.value)},{field:"action",headerName:"Action",flex:1.5,sortable:!1,renderCell:e=>{const a=(e.row.status||"").toUpperCase(),n=a!=="CANCELLED"&&a!=="COMPLETED"&&a!=="PENDING"&&a!=="APPROVED"&&a!=="CANCELLED_INVOICE",v=a==="INITIATED";return r(se,{direction:"row",spacing:.5,alignItems:"center",children:[B.read&&t(Y,{type:"View",onClick:()=>ve(e.row)}),T&&n&&B.create&&t(Y,{type:"Edit",onClick:()=>ke(e.row)}),v&&B.create&&t(Y,{type:"Send",onClick:()=>Ne(e.row)})]})}}];function Oe(e){return{packingNumber:e.packingNumber,clientName:e.clientName,phoneNumber:e.phoneNumber,experienceCenterName:e.experience||"Main Unit",totalSqft:Array.isArray(e.packingItemsDTOList)?e.packingItemsDTOList.reduce((a,n)=>a+(n.totalQuantity||0),0):0,totalAmount:0,items:Array.isArray(e.packingItemsDTOList)?e.packingItemsDTOList.flatMap(a=>(a.packingItemDetailDTOList||[]).map(n=>({id:n.id,itemId:a.id,country:a.country,type:a.colour||"",name:a.productName,masterBarcode:a.masterBarcode,barcode:n.subBarcode,unit:n.uom,sqft:n.quantity,rate:a.sellingPricePerUom||0,total:(n.quantity*(a.sellingPricePerUom||0)).toFixed(2),width:n.width,length:n.length,storageType:n.storageType||"",sellingPricePerUom:a.sellingPricePerUom||0,packingItemDetailDTOList:a.packingItemDetailDTOList||[]}))):[],createdAt:e.createdDate||e.date||"",status:e.status||"",id:e.id}}const Te=h.useCallback(()=>t("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",color:l.palette.text.secondary,fontSize:"16px"},children:"No Data Available"}),[l.palette.text.secondary]);return t(Ge,{error:ye,children:r(o,{p:2,sx:{width:"100%"},children:[r(Me,{children:[r(o,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:[t(o,{sx:{display:"flex",gap:2,alignItems:"center",flexWrap:"wrap"},children:t(Ae,{placeholder:"Search packing number...",variant:"outlined",size:"small",value:I.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=>ae("packingNumber",e.target.value),InputProps:{startAdornment:t(q,{edge:"start",size:"small",sx:{color:"text.secondary"},children:t($e,{})}),endAdornment:I.packingNumber&&t(q,{edge:"end",onClick:()=>ae("packingNumber",""),size:"small",sx:{color:"text.secondary"},children:t(ze,{})})}})}),t(o,{children:O&&B.create&&t(j,{btnType:"create",onClick:O,children:"Create Order"})})]}),P==="list"?t(Ee,{columns:De,rows:W,checkboxSelection:!1,enableManageColumns:!0,defaultHiddenColumns:["id"],autoHeight:!0,getRowId:e=>e.id||e.packingNumber||`row-${Math.random()}`,rowCount:ge,paginationMode:"server",paginationModel:w,onPaginationModelChange:Z,pageSizeOptions:[10,25,50,100],components:{NoRowsOverlay:Te},loading:fe}):t(he,{})]}),t(dt,{open:i,onClose:H,packing:G?Oe(G):k,onApprove:te,onReject:te,entity:B}),r(Re,{anchorEl:c,open:!!c,onClose:K,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:[r(ne,{onClick:Ce,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(oe,{children:t(o,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,borderRadius:"50%",backgroundColor:"success.100",mr:1.5},children:t(Le,{fontSize:"small",sx:{color:"success.main"}})})}),t(ie,{primary:"Approve",primaryTypographyProps:{fontSize:"0.95rem",fontWeight:600,color:"success.main"},secondary:"Mark as approved",secondaryTypographyProps:{fontSize:"0.75rem",color:"text.secondary"}})]}),r(ne,{onClick:Se,sx:{py:2,px:2,"&:hover":{backgroundColor:e=>e.palette.mode==="dark"?"error.dark":"error.50"}},children:[t(oe,{children:t(o,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,borderRadius:"50%",backgroundColor:"error.100",mr:1.5},children:t(qe,{fontSize:"small",sx:{color:"error.main"}})})}),t(ie,{primary:"Reject",primaryTypographyProps:{fontSize:"0.95rem",fontWeight:600,color:"error.main"},secondary:"Mark as rejected",secondaryTypographyProps:{fontSize:"0.75rem",color:"text.secondary"}})]})]}),t(je,{open:A,onClose:ee,maxWidth:"xs",onConfirm:()=>Ie(),confirmText:"Move to Packing List",children:t(Ve,{sx:{pt:2,pb:2,px:2},children:r(o,{sx:{display:"flex",alignItems:"flex-start",gap:1.5},children:[t(o,{sx:{width:40,height:40,borderRadius:"50%",backgroundColor:e=>e.palette.mode==="dark"?"rgba(3, 169, 244, 0.2)":"info.100",display:"flex",alignItems:"center",justifyContent:"center",mt:.5,flexShrink:0},children:t(Ue,{sx:{color:"info.main",fontSize:22}})}),r(o,{flex:1,children:[t(s,{variant:"subtitle1",fontWeight:600,color:"info.main",gutterBottom:!0,children:"Packing List Approve"}),r(s,{variant:"body2",color:"text.secondary",mb:2,children:["Are you sure you want to approve and send this to the Packing List?"," "]}),r(o,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",columnGap:2,flexWrap:"wrap"},children:[r(o,{sx:{minWidth:"45%"},children:[t(s,{variant:"caption",color:"text.secondary",children:"Packing NO"}),t(s,{variant:"body2",fontWeight:500,children:(u==null?void 0:u.packingNumber)||"—"})]}),r(o,{sx:{minWidth:"45%"},children:[t(s,{variant:"caption",color:"text.secondary",children:"Client Name"}),t(s,{variant:"body2",fontWeight:500,children:(u==null?void 0:u.clientName)||"—"})]})]})]})]})})})]})})},kt=()=>{const O=Ze();return t(ct,{onCreateNew:()=>{O(ce.ORDER_BOOKING_CREATE)},onEditPacking:P=>{O(ce.ORDER_BOOKING_CREATE,{state:{editData:P,mode:"edit"}})}})};export{kt as default};
