import{eh as E,r as c,b as R,a as G,h0 as M,i7 as W,j as t,E as O,Q as e,_ as V,B as S,T as h,S as $,K as k,ix as K}from"./index-43bf7a1c.js";import{A as N}from"./index-9f4c114d.js";import{S as F}from"./Buttons-2efb74f5.js";import{G as H}from"./GoBack-7b84c382.js";import{T as J}from"./index-2d303f1d.js";import{C as L}from"./CardContent-69a98a60.js";import{D as U,a as X}from"./DialogContent-d5902709.js";import{D as Y}from"./DialogTitle-20dc6f66.js";import{D as Z}from"./DialogActions-d63c6496.js";import{D as w}from"./Divider-c942d994.js";import"./index.esm-f9e0a906.js";import"./index.esm-0548c843.js";import"./yup-3b80ed10.js";import"./NewApprovalCard-66a208ab.js";import"./AccessTime-ae9d2c86.js";import"./index-913b2dc6.js";import"./useMediaQuery-d6627623.js";import"./useControlled-ab567149.js";import"./createSvgIcon-9dc1e611.js";import"./TextArea-23730be7.js";import"./TextField-4da97115.js";import"./FormControl-8d011aab.js";import"./OutlinedInput-6bcf3cf8.js";import"./useFormControl-2c5d60c2.js";import"./List-6fcc4821.js";import"./InputLabel-6c7474f0.js";import"./Select-44fd3147.js";import"./Menu-362130d3.js";import"./Grow-ca573f65.js";import"./createSvgIcon-f118be02.js";import"./DialogContentText-abf03c9f.js";import"./InfoCircleOutlined-93449dd4.js";import"./AntdIcon-634507e8.js";import"./objectSpread2-c31b885b.js";import"./presets-bb9bdfd8.js";import"./LoadingButton-570cb73d.js";import"./composeClasses-b42b2e69.js";import"./Chip-94eea1f7.js";import"./Avatar-ec89b895.js";import"./Tooltip-c7371fbe.js";import"./Zoom-23a3d69f.js";import"./TableContainer-b977c6cc.js";import"./TableRow-86264944.js";import"./Skeleton-ed4df299.js";import"./index-5757b954.js";import"./TableHead-fb4972c5.js";import"./TablePagination-9147f93d.js";import"./MenuItem-58b8887e.js";import"./dividerClasses-497df10c.js";import"./listItemTextClasses-0ea25cee.js";import"./KeyboardArrowRight-8bd7c13f.js";const Yi=()=>{var f,v,_,b,C;const{id:s,tenderId:q,tab:B}=E(),[d,m]=c.useState(!1),x=R(),{purchaseQuotation:{selectedData:i,pageParams:a}}=G(o=>M(o));c.useEffect(()=>{x(W({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{Yi as default};
