import{b as A,ek as T,a as m,eu as I,ev as M,j as i,I as z,ef as F,ew as $,ej as E,J as c,ex as J}from"./index-d2b25495.js";import{o as R}from"./yup-267e586f.js";import{S as X}from"./SelectComponent-d286bfef.js";import{u as G}from"./index.esm-ce3c2c20.js";import{c as h,b as _}from"./index.esm-3043d6d4.js";import{D as H,a as K}from"./DialogContent-cded694d.js";import{D as L}from"./DialogTitle-a145b392.js";import{D as N}from"./DialogContentText-43575e44.js";import{D as O}from"./DialogActions-7c802cc8.js";const ir=({open:S,hide:s,selectedData:r,params:f})=>{var g,p,a,u,x;const b=A(),{id:j}=T();m(n=>I(n));const{tenderStage:{loading:y,pageParams:o,selecteditems:Q,modal:U,itemsList:l}}=m(n=>M(n)),C=h().shape({tender_stage:h({label:_().required("Please select a tender stage"),value:_().required("Please select a tender stage")}).required("Please select a tender stage").nullable()}),{control:v,handleSubmit:w,reset:B,getValues:k}=G({resolver:R(C),values:{tender_stage:(g=r==null?void 0:r.tender_stage)!=null&&g.id?{label:(p=r==null?void 0:r.tender_stage)!=null&&p.name?(a=r==null?void 0:r.tender_stage)==null?void 0:a.name:"",value:(u=r==null?void 0:r.tender_stage)!=null&&u.id?(x=r==null?void 0:r.tender_stage)==null?void 0:x.id:""}:null}}),d=k("tender_stage"),q=n=>{var e;const t={tender_id:r.id,tender_stage_id:(e=n==null?void 0:n.tender_stage)==null?void 0:e.value};b(J({id:r!=null&&r.id?r==null?void 0:r.id:"",data:t,hide:s,params:f})),B()};return i.jsxs(H,{open:S,onClose:s,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[i.jsxs(L,{sx:{bgcolor:"primary.main",color:"white",p:1,px:2,display:"flex",alignItems:"center",justifyContent:"space-between"},variant:"h4",id:"alert-dialog-title",children:["Biding Stage",i.jsx(z,{onClick:s,children:i.jsx(F,{color:"white"})})]}),i.jsx(K,{sx:{px:"24px",pt:"12px !important",pb:0},children:i.jsx(N,{id:"alert-dialog-description",sx:{width:500},children:i.jsx("form",{style:{width:"100%"},children:i.jsx(X,{name:"tender_stage",label:"Bid Stage",control:v,rules:{required:!0},options:(l==null?void 0:l.map(n=>{var t,e;return{id:((t=n.stage)==null?void 0:t.id)||"",name:String(((e=n==null?void 0:n.stage)==null?void 0:e.name)||"")}}))??[],loading:y,selectParams:{page:o==null?void 0:o.page,page_size:o==null?void 0:o.page_size,search:o==null?void 0:o.search,no_of_pages:o==null?void 0:o.no_of_pages,tender:j},hasMore:(o==null?void 0:o.page)<(o==null?void 0:o.no_of_pages),fetchapi:$,clearData:E})})})}),i.jsxs(O,{sx:{p:2},children:[i.jsx(c,{onClick:s,variant:"outlined",color:"secondary",children:"Cancel"}),i.jsx(c,{variant:"contained",onClick:w(q),type:"submit",color:"primary",disabled:!(d!=null&&d.value),autoFocus:!0,children:"Save"})]})]})};export{ir as S};
