import{r as _,hd as B,j as n,cP as U,B as x,I as P,T as L,K as p,M as O}from"./index-aa586041.js";import{d as z}from"./Close-5020046f.js";import{P as R}from"./Buttons-d2dac5d1.js";import{D as T}from"./Dialog-26aea2b0.js";const mi=({open:M,onClose:l,selectedAssetData:i,selectedImagesData:W=[]})=>{var f,v,g,y,w,S,I,C,k;_.useState(!0);const[N,b]=_.useState(!1),[h,E]=_.useState(null),{Asset:{},system:{userAccessList:F,systemPreferences:{preferences:{is_inventory:r,asset_fields:{is_asset_name:G,is_asset_description:H,is_asset_dropdown:Y,is_serial_number:K,is_model_number:V,is_department:q,is_intimation_department:J,is_machine_priority:Q,is_unit:X,is_location:Z,is_area:$,is_cost_center:c,is_supplier:d,is_invoice_number:a,is_invoice_date:D,is_asset_value:A,is_power_details:s,is_manufacture_name:t,is_installation_year:e,is_upload_images:ii,is_category:ni}}}}}=B(),u=({label:m,value:j})=>n.jsxs(O,{direction:"row",alignItems:"center",mb:1,children:[n.jsxs(x,{sx:{fontWeight:600,mr:1,fontSize:"13px"},children:[m," :"]}),n.jsx(x,{sx:{fontSize:"13px"},children:j||""})]}),o=({label:m,value:j})=>n.jsxs(x,{display:"flex",mb:0,p:1,children:[n.jsxs(x,{sx:{width:150,fontWeight:600,fontSize:"13px"},children:[m,":"]}),n.jsx(x,{sx:{width:220,fontSize:"13px"},children:j||""})]});return n.jsxs(n.Fragment,{children:[n.jsx(U,{open:M,onClose:l,children:n.jsxs(x,{sx:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"95%",overflowY:"auto",bgcolor:"#fff",borderRadius:2,boxShadow:24,p:2},children:[n.jsx(x,{display:"flex",justifyContent:"flex-end",children:n.jsx(P,{onClick:l,children:n.jsx(z,{})})}),n.jsxs(x,{display:"flex",flexDirection:"column",mb:1,p:1,sx:{backgroundColor:"#f5f5f5"},children:[n.jsx(x,{display:"flex",justifyContent:"space-between",alignItems:"center",children:n.jsx(L,{variant:"h5",color:"green",children:n.jsx("strong",{children:i==null?void 0:i.name})})}),n.jsxs(x,{display:"flex",gap:6,mt:1,children:[n.jsx(u,{label:"Code",value:i==null?void 0:i.code}),!r&&n.jsx(u,{label:"Department",value:(f=i==null?void 0:i.department)==null?void 0:f.label}),!r&&n.jsx(u,{label:"Unit",value:(v=i==null?void 0:i.location_unit)==null?void 0:v.label}),!r&&n.jsx(u,{label:"Area",value:(g=i==null?void 0:i.area)==null?void 0:g.label}),!r&&n.jsx(u,{label:"Location",value:(y=i==null?void 0:i.location)==null?void 0:y.label}),!r&&n.jsx(u,{label:"Priority",value:n.jsx(R,{priority:(i==null?void 0:i.priority)||"",priority_name:(i==null?void 0:i.priority_name)||""})})]})]}),n.jsx(p,{container:!0,spacing:2,mt:1,children:n.jsx(p,{size:{xs:12},sx:{backgroundColor:"#f5f5f5",borderRadius:2},children:n.jsxs(p,{container:!0,spacing:1,children:[n.jsxs(p,{size:{xs:12,md:6},p:2,children:[!r&&n.jsx(o,{label:"Intemation Dep",value:(w=i==null?void 0:i.intimation_departments)!=null&&w.length?i.intimation_departments.map(m=>m.label).join(", "):"N/A"}),!r&&n.jsx(o,{label:"Cost center",value:(S=i==null?void 0:i.cost_center)==null?void 0:S.label}),!r&&n.jsx(o,{label:"Supplier",value:(I=i==null?void 0:i.supplier)==null?void 0:I.name}),!r&&n.jsx(o,{label:"Invoice Number",value:i==null?void 0:i.invoice_no}),!r&&n.jsx(o,{label:"Invoice Date",value:i!=null&&i.invoice_date?new Date(i.invoice_date).toLocaleDateString("en-GB").replace(/\//g,"-"):"N/A"}),n.jsx(o,{label:"Serial Number",value:i==null?void 0:i.asset_sno})]}),n.jsxs(p,{size:{xs:12,md:6},p:2,children:[r&&n.jsx(o,{label:"Status",value:i==null?void 0:i.asset_status_name}),r&&n.jsx(o,{label:"Type",value:i==null?void 0:i.stock_choice_name}),n.jsx(o,{label:"Model Number",value:i==null?void 0:i.model_no}),!r&&n.jsx(o,{label:"Make",value:i==null?void 0:i.make}),!r&&n.jsx(o,{label:"Power Details",value:i==null?void 0:i.power_details}),!r&&n.jsx(o,{label:"Asset Value",value:i==null?void 0:i.asset_value}),!r&&n.jsx(o,{label:"Installation Year",value:i==null?void 0:i.year}),n.jsx(o,{label:"Description",value:i==null?void 0:i.description}),r&&n.jsx(o,{label:"HSN Code",value:i==null?void 0:i.hsncode}),r&&n.jsx(o,{label:"Category",value:(C=i==null?void 0:i.category)==null?void 0:C.name}),r&&n.jsx(o,{label:"UOM",value:(k=i==null?void 0:i.uom)==null?void 0:k.name})]})]})})})]})}),n.jsx(T,{open:N,onClose:()=>b(!1),maxWidth:"md",children:n.jsxs(x,{p:2,children:[n.jsx(x,{display:"flex",justifyContent:"flex-end",children:n.jsx(P,{onClick:()=>b(!1),children:n.jsx(z,{})})}),h&&n.jsx("img",{src:h,alt:"Preview",style:{width:"100%",height:"auto",maxHeight:"80vh",objectFit:"contain"}})]})})]})};export{mi as A};
