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-def636a4.js";import{A as N}from"./index-6fe42869.js";import{S as F}from"./Buttons-edf041d8.js";import{G as H}from"./GoBack-37987f0d.js";import{T as J}from"./index-fc769754.js";import{C as L}from"./CardContent-c8b2d0af.js";import{D as U,a as X}from"./DialogContent-0cb684b3.js";import{D as Y}from"./DialogTitle-e2e75924.js";import{D as Z}from"./DialogActions-c4045764.js";import{D as w}from"./Divider-6e68cefb.js";import"./index.esm-eec4f448.js";import"./index.esm-7d9d1491.js";import"./yup-c8535458.js";import"./NewApprovalCard-f1344302.js";import"./AccessTime-522c6471.js";import"./index-f48c8aa0.js";import"./useMediaQuery-4304fb25.js";import"./useControlled-bd643819.js";import"./createSvgIcon-d6b04b87.js";import"./TextArea-6c103c50.js";import"./TextField-2ba95a45.js";import"./FormControl-1f811046.js";import"./OutlinedInput-ddb8bb3f.js";import"./useFormControl-880b2f7b.js";import"./List-17cd485b.js";import"./InputLabel-e2e73b27.js";import"./Select-2cfb5afd.js";import"./Menu-af49d134.js";import"./Grow-85576dd3.js";import"./createSvgIcon-ff487f53.js";import"./DialogContentText-b2259947.js";import"./InfoCircleOutlined-3c134b7f.js";import"./AntdIcon-34324527.js";import"./objectSpread2-a4d0f5f6.js";import"./presets-dbb0f3bf.js";import"./LoadingButton-621a0e8f.js";import"./composeClasses-b42b2e69.js";import"./Chip-81b6c661.js";import"./Avatar-03680000.js";import"./Tooltip-762a58b6.js";import"./Zoom-41db3342.js";import"./TableContainer-5944247b.js";import"./TableRow-2c544f58.js";import"./Skeleton-5cf57ed1.js";import"./index-b5a6fbe3.js";import"./TableHead-f0476938.js";import"./TablePagination-7d3b42e9.js";import"./MenuItem-8fdd2340.js";import"./dividerClasses-2b953c2a.js";import"./listItemTextClasses-063fcacf.js";import"./KeyboardArrowRight-bfb3d848.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};
