import{ek as E,r as c,b as R,a as G,gZ as M,hZ as W,j as t,C as O,P as e,_ as V,B as k,T as h,Q as Z,J as S,im as $}from"./index-d2b25495.js";import{A as J}from"./index-c9438dd3.js";import{S as N}from"./Buttons-2f5a8f17.js";import{G as F}from"./GoBack-f6710d2c.js";import{T as H}from"./index-75fca24c.js";import{C as K}from"./CardContent-be810fe0.js";import{D as L,a as U}from"./DialogContent-cded694d.js";import{D as X}from"./DialogTitle-a145b392.js";import{D as Y}from"./DialogActions-7c802cc8.js";import{D as w}from"./Divider-29971892.js";import"./index.esm-3043d6d4.js";import"./index.esm-ce3c2c20.js";import"./yup-267e586f.js";import"./index-38f860bc.js";import"./useMediaQuery-b1fbc166.js";import"./useControlled-8d737f13.js";import"./createSvgIcon-50503425.js";import"./TextArea-7e39a6e1.js";import"./TextField-e155d2be.js";import"./FormControl-73683015.js";import"./OutlinedInput-86f3ec98.js";import"./useFormControl-2b068664.js";import"./InputLabel-bb6ab40e.js";import"./Select-ef36a2b2.js";import"./Menu-337a466b.js";import"./Grow-8719411b.js";import"./List-863f013e.js";import"./createSvgIcon-e39ae511.js";import"./DialogContentText-43575e44.js";import"./InfoCircleOutlined-a1ed1ad6.js";import"./AntdIcon-8449be55.js";import"./objectSpread2-b41ee31b.js";import"./index-709861af.js";import"./LoadingButton-c8e88148.js";import"./composeClasses-b42b2e69.js";import"./Chip-75fd9653.js";import"./Avatar-9337c33f.js";import"./Tooltip-82372cdb.js";import"./popper-f3391c26.js";import"./Zoom-6c53779c.js";import"./TableContainer-dd7cf0ce.js";import"./TableRow-74f9cf3b.js";import"./Skeleton-1012c2e6.js";import"./index-1249dfe4.js";import"./TableHead-fac214d3.js";import"./TablePagination-2c2a1682.js";import"./MenuItem-2bdddad4.js";import"./dividerClasses-02a44d89.js";import"./listItemTextClasses-cadd4b00.js";import"./KeyboardArrowRight-7e978a8a.js";const Ui=()=>{var f,v,_,C,b;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(N,{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(F,{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(K,{children:[t.jsx(k,{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(Z,{direction:"row",spacing:1,alignItems:"center",children:[t.jsx(h,{variant:"h5",children:"Description:"}),t.jsx(S,{onClick:()=>m(!0),children:"Click to see description"}),d&&t.jsxs(L,{open:d,onClose:()=>m(!1),maxWidth:"md",fullWidth:!0,children:[t.jsx(X,{children:"Description"}),t.jsx(U,{children:t.jsx(h,{children:i==null?void 0:i.description})}),t.jsx(Y,{children:t.jsx(S,{onClick:()=>m(!1),children:"Close"})})]})]})})]})}),t.jsx(w,{sx:{my:2}}),t.jsx(k,{children:t.jsx(H,{showPagination:!1,count:(C=i==null?void 0:i.quotationitems)!=null&&C.length?(b=i==null?void 0:i.quotationitems)==null?void 0:b.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(J,{data:i,app_label:"TenderManagement",model_name:"reverseauction",instance_id:s||"",callback:()=>{x($({id:s||""}))}})})]})})};export{Ui as default};
