import{eh as E,r as c,b as W,a as R,gW as G,hW as M,j as t,E as O,Q as e,_ as V,B as S,T as h,S as $,K as k,ij as K}from"./index-76d4793e.js";import{A as N}from"./index-6560cb04.js";import{S as F}from"./Buttons-3dd523a8.js";import{G as H}from"./GoBack-71b56a16.js";import{T as J}from"./index-1fae9bc3.js";import{C as L}from"./CardContent-2f10f9e9.js";import{D as U,a as X}from"./DialogContent-7bd8dd8f.js";import{D as Y}from"./DialogTitle-71dd5b3a.js";import{D as Z}from"./DialogActions-5a5e1db9.js";import{D as w}from"./Divider-3f770145.js";import"./index.esm-ad8a7c9f.js";import"./index.esm-3adfd9f7.js";import"./yup-688ec4f6.js";import"./index-ecea5cfc.js";import"./useMediaQuery-8cb39c65.js";import"./useControlled-e03384de.js";import"./createSvgIcon-510bc162.js";import"./TextArea-f4ef1e8b.js";import"./TextField-9c64a4a2.js";import"./FormControl-c671c595.js";import"./OutlinedInput-ac933786.js";import"./useFormControl-c8d490e1.js";import"./List-4c24b3e8.js";import"./InputLabel-5ed57f0e.js";import"./Select-338083eb.js";import"./Menu-ed7c6894.js";import"./Grow-84b30c0e.js";import"./createSvgIcon-01ec10fc.js";import"./DialogContentText-7642f81f.js";import"./InfoCircleOutlined-c8b96a94.js";import"./AntdIcon-55dc1b5f.js";import"./objectSpread2-51b6810f.js";import"./LoadingButton-89ba2db7.js";import"./composeClasses-b42b2e69.js";import"./Chip-456ce28e.js";import"./Avatar-ff1026d1.js";import"./Tooltip-0a59b9eb.js";import"./Zoom-871401ed.js";import"./TableContainer-4147c2f3.js";import"./TableRow-736f36bd.js";import"./Skeleton-5d9101fd.js";import"./index-85763c32.js";import"./TableHead-c6031541.js";import"./TablePagination-5e47b2d0.js";import"./MenuItem-cff1abce.js";import"./dividerClasses-45958eb8.js";import"./listItemTextClasses-89e7894e.js";import"./KeyboardArrowRight-8920e265.js";const Li=()=>{var f,v,_,b,C;const{id:s,tenderId:q,tab:B}=E(),[d,m]=c.useState(!1),x=W(),{purchaseQuotation:{selectedData:i,pageParams:a}}=R(o=>G(o));c.useEffect(()=>{x(M({id:s||""}))},[s]);const Q=[{label:"Code",value:i==null?void 0:i.code},{label:"Status",value:t.jsx(F,{authorized_status:(i==null?void 0:i.authorized_status)||"",authorized_status_name:(i==null?void 0:i.authorized_status_name)||""})},{label:"Created On",value:i==null?void 0:i.created_on},{label:"Delivery Date",value:i==null?void 0:i.deliverydate},{label:"Purchase Enquiry Code",value:(f=i==null?void 0:i.purchase_enquiry)==null?void 0:f.name},{label:"Vendor/OEM",value:(v=i==null?void 0:i.vendor)==null?void 0:v.name},{label:"Project",value:(_=i==null?void 0:i.project)==null?void 0:_.name}],T=[{title:"S.No",width:100},{title:"Item",width:100},{title:"Item Code",width:100},{title:"Available Qty",width:100},{title:"Item Price",width:100},{title:"Total Price (Qty * Price)",width:100}];function g(o,n,r,l,u,p){return{index:o,name:n,code:r,quantity:l,price:u,Total:p}}const j=c.useMemo(()=>{var o,n;return(n=(o=i==null?void 0:i.quotationitems)==null?void 0:o.filter(r=>!(r!=null&&r.dodelete)))==null?void 0:n.map((r,l)=>{var p,P,y,z;const u=(a.page-1)*a.page_size+(l+1);return g(u,(p=r==null?void 0:r.item)!=null&&p.name?(P=r==null?void 0:r.item)==null?void 0:P.name:"",(y=r==null?void 0:r.item)!=null&&y.code?(z=r==null?void 0:r.item)==null?void 0:z.code:"",r.qty?r.qty:"",r.price?r.price:"",r.total_price?r.total_price:"")})},[i,g]),A=(o,n)=>{},I=o=>{};return O(),t.jsx(H,{is_goback:!0,go_back_url:`/tenders/view/${q}/${B}/purchase_quotation/`,title:"Purchase Quotation",showSaveButton:!1,loading:!1,children:t.jsxs(e,{container:!0,sx:{my:2},children:[t.jsx(e,{size:{xs:12,lg:(i==null?void 0:i.authorized_status)!==4?8.5:12},children:t.jsx(V,{children:t.jsxs(L,{children:[t.jsx(S,{p:4,sx:{borderRadius:2},children:t.jsxs(e,{container:!0,spacing:3,children:[Q.map(o=>t.jsx(e,{size:{xs:12,md:4},children:t.jsxs(h,{variant:"h6",children:[o.label,": "," ",o==null?void 0:o.value]})})),t.jsx(e,{size:{xs:12,md:4},children:t.jsxs($,{direction:"row",spacing:1,alignItems:"center",children:[t.jsx(h,{variant:"h5",children:"Description:"}),t.jsx(k,{onClick:()=>m(!0),children:"Click to see description"}),d&&t.jsxs(U,{open:d,onClose:()=>m(!1),maxWidth:"md",fullWidth:!0,children:[t.jsx(Y,{children:"Description"}),t.jsx(X,{children:t.jsx(h,{children:i==null?void 0:i.description})}),t.jsx(Z,{children:t.jsx(k,{onClick:()=>m(!1),children:"Close"})})]})]})})]})}),t.jsx(w,{sx:{my:2}}),t.jsx(S,{children:t.jsx(J,{showPagination:!1,count:(b=i==null?void 0:i.quotationitems)!=null&&b.length?(C=i==null?void 0:i.quotationitems)==null?void 0:C.length:0,columns:T,rows:j||[],loading:!1,page:a.page,pageSize:a.page_size,handleChangePage:A,handleChangeRowsPerPage:I})})]})})}),(i==null?void 0:i.authorized_status)!==4&&t.jsx(e,{size:{xs:12,lg:3.5},children:t.jsx(N,{data:i,app_label:"TenderManagement",model_name:"reverseauction",instance_id:s||"",callback:()=>{x(K({id:s||""}))}})})]})})};export{Li as default};
