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-60a3c753.js";import{A as N}from"./index-143f0421.js";import{S as F}from"./Buttons-0f6898d9.js";import{G as H}from"./GoBack-ae228613.js";import{T as J}from"./index-7e55cf46.js";import{C as L}from"./CardContent-faee3650.js";import{D as U,a as X}from"./DialogContent-89e21f2e.js";import{D as Y}from"./DialogTitle-fe69da5c.js";import{D as Z}from"./DialogActions-e754942c.js";import{D as w}from"./Divider-b296c48e.js";import"./index.esm-62d6b2f7.js";import"./index.esm-c494934a.js";import"./yup-92678dde.js";import"./NewApprovalCard-8c91325b.js";import"./AccessTime-4a7c0149.js";import"./index-900fa817.js";import"./useMediaQuery-dba48e3b.js";import"./useControlled-194ef007.js";import"./createSvgIcon-9e50512c.js";import"./TextArea-b2d5bcf9.js";import"./TextField-32b29087.js";import"./FormControl-d13d2693.js";import"./OutlinedInput-3a884178.js";import"./useFormControl-e13b5747.js";import"./List-f567f8e4.js";import"./InputLabel-71dfc9d4.js";import"./Select-99fc0d84.js";import"./Menu-d1b7e1c3.js";import"./Grow-68442588.js";import"./createSvgIcon-de433e5f.js";import"./DialogContentText-6688bd59.js";import"./InfoCircleOutlined-351fb70a.js";import"./AntdIcon-bed41c21.js";import"./objectSpread2-85813881.js";import"./presets-06d13753.js";import"./LoadingButton-3975ddf9.js";import"./composeClasses-b42b2e69.js";import"./Chip-cc311899.js";import"./Avatar-a21f41a5.js";import"./Tooltip-88e63512.js";import"./Zoom-9a0dc652.js";import"./TableContainer-414c12e0.js";import"./TableRow-0b33776c.js";import"./Skeleton-98c353d9.js";import"./index-a99c9f65.js";import"./TableHead-f864c753.js";import"./TablePagination-218dde38.js";import"./MenuItem-2f410bd2.js";import"./dividerClasses-3fa67596.js";import"./listItemTextClasses-36afdb92.js";import"./KeyboardArrowRight-b2645aed.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};
