1import{r as d,j as e,L as f,n as xe,U as he,T as ge,e7 as fe,d as je,o as L,p as q,F as S,v as p,Q as be,a9 as U,x as R,D as _e,e as Ne,P as ye,bP as Se,i3 as Ce,db as we,G as Y,i4 as H,gF as Fe,d4 as ke,gG as ve,d1 as Q,u as Ie,c as De,da as Ve,W as J,a5 as X,Y as Z,i5 as Ae,aP as Ee,bW as W,ex as K,i6 as Pe,b as Le}from"./index-BYjmYzu-.js";import{E as qe,H as Re}from"./header_component-Btwak9wi.js";import{R as ee}from"./rbac_button_wrapper-Bdh6PdN4.js";import{F as Te}from"./filter_group-DlIM42Sr.js";import{f as se,b as Be,h as Me}from"./vendor_utils-CFF0Rzui.js";import{D as ze,C as Ge}from"./dropdown_item-D-YCmEUf.js";import{M as Oe}from"./modal_header-BCd36PwY.js";import{v as b}from"./form_utils-BRD3em_d.js";import{L as $e}from"./loader-CDxSUCj6.js";import{A as He}from"./index-CKmpMa3z.js";import{R as We}from"./BellOutlined-D3SY1Xql.js";import{u as T}from"./index-B8b6KHqX.js";import{b as Ke,p as Ue,d as Ye,f as Qe,h as Je,i as Xe,u as Ze}from"./index-DAkkRkhc.js";import{D as es}from"./delete_confirm-C5V3H8xR.js";import{M as te}from"./index-BNQX9KrA.js";import{M as E}from"./dropdown-CVdns1v5.js";import{g as ss}from"./utils-BZTh1pv3.js";import{S as ts}from"./constants-DWya29Vt.js";import{C as P}from"./col-DSokC5oO.js";import{C as as}from"./common_page-Bxr-oQPy.js";import{T as ns}from"./tab_components-B8bQccEp.js";import"./api-BfcZN4hw.js";import"./LoadingOutlined-CBjTJf7a.js";import"./index-Da89g_ZO.js";import"./DialogWrap-BcWh8mEF.js";import"./Portal-BnIU9h3K.js";import"./getScrollBarSize-BX5bDlpW.js";import"./useId-CCfbXMy0.js";import"./Dropdown-Dy0ThnTD.js";import"./isNumeric-OYazz19Q.js";import"./react-number-format.es-HDPTMfGw.js";function os({vendorCategories:s,filterCategory:o}){const[a,r]=d.useState([]),n=i=>{o(i)};return d.useEffect(()=>{r(se(s,"checkbox"))},[s]),e.jsxs("div",{children:[e.jsx("p",{className:"text-color-light",children:"Filter by categories"}),e.jsx(f,{component:Te,name:"Filter by transaction type",items:a,onChange:i=>n(i)})]})}const{Paragraph:rs}=ge;function is({title:s,email:o,contact:a,closeModal:r,inviteLink:n}){const i=l=>{l.preventDefault(),navigator.clipboard.writeText(n)};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-center mt-8",children:e.jsx("img",{src:xe("success.svg"),alt:"success"})}),e.jsx("p",{className:"mt-6 text-lg font-semibold text-center",children:s}),e.jsx("p",{className:"text-text-color-medium m-0 mb-3",children:"Link sent to"}),e.jsxs("div",{className:"flex w-full items-center p-3 border border-border-color border-1 border-solid shadow-none rounded",children:[e.jsx("div",{children:e.jsxs(He,{shape:"square",style:{backgroundColor:"#FBFBFB",border:"1px solid #F0F0F1",color:"#0F48E3 !important"},size:35,children:[" ",e.jsxs("span",{className:"text-primary",children:[he(o)[0]," "]})]})}),e.jsxs("div",{className:"pl-6",children:[e.jsx("p",{className:"text-heading-color font-semibold m-0",children:o}),e.jsxs("p",{className:"text-sm text-color-light m-0",children:["+91",a]})]})]}),n&&e.jsx("div",{className:"mt-4",children:e.jsx(rs,{onClick:i,copyable:{text:n,icon:e.jsx(fe,{className:"copyIcon"})},className:"text-center",children:"Copy the link!"})}),e.jsx("p",{className:"text-center text-3xl mt-20 mb-4 text-primary",children:e.jsx(We,{})}),e.jsx("p",{className:"text-text-color-medium-2 text-xs text-center m-0 mb-2",children:"We will notify you once the vendor has updated his details."}),e.jsx("button",{onClick:r,className:"text-heading-color cursor-pointer font-bold py-3 mt-2 text-center w-full bg-background-color border border-border-color border-1 border-solid shadow-none rounded",children:"CLOSE"})]})}const ls="_labeledInput_o8aju_23",cs="_prefix_o8aju_36",ds="_icon_o8aju_47",ms="_bankDetails_o8aju_68",us="_vendorInfo_o8aju_99",ps="_ifsc_o8aju_102",xs="_form_o8aju_105",hs="_fieldRequired_o8aju_108",gs="_bankInfoSubmit_o8aju_124",fs="_downloadAction_o8aju_128",js="_inviteForm_o8aju_135",bs="_header_o8aju_144",t={labeledInput:ls,prefix:cs,icon:ds,bankDetails:ms,vendorInfo:us,ifsc:ps,form:xs,fieldRequired:hs,bankInfoSubmit:gs,downloadAction:fs,inviteForm:js,header:bs};function _s(s){const{profile:o}=je(),a=o.full_name,r=o.company.uuid,n=o.company.name,{closeModal:i}
1=s,[l,c]=d.useState(!1),[u,x]=d.useState(!1),[j,h]=d.useState(!0),[_,m]=d.useState(!1),[k,C]=d.useState(null),w=async v=>{var D,V;h(v),x(!0),c(!0);const y=await Be({...v,company_uuid:r,company_name:n||a});y&&y.status===200&&y.data?(m(!0),C((V=(D=y.data)==null?void 0:D.result)==null?void 0:V.invite_link),_e({message:"Success",description:y.data.message})):Ne({message:"Error",description:"Unable to send registration link"}),x(!1),c(!1)},N=e.jsxs(e.Fragment,{children:[!_&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-text-color-medium-2",children:"A self-registration link would be send to the below email ID. Once the vendor updates his details via the link it would automatically reflect on your dashboard."}),e.jsx(L,{initialValues:{contact:"",email:""},onSubmit:w,children:e.jsxs(q,{noValidate:!0,className:t.form,children:[e.jsx(f,{prefix:e.jsx(be,{className:t.icon}),component:S,label:"Email Address",required:!0,name:"email",size:"large",validate:b([{test:p.required,message:"Email Address is required"},{test:p.email,message:"Enter valid Email adress"}]),placeholder:"[email protected]",wrapperClassName:t.labeledInput}),e.jsx(f,{prefix:e.jsxs("span",{className:t.prefix,children:[e.jsx(U,{className:t.icon}),e.jsx("span",{className:t.indianCode,children:"+91"})]}),component:S,label:"Phone Number",required:!0,size:"small",name:"contact",maxLength:10,validate:b([{test:p.required,message:"Phone number is required"},{test:p.phoneNumber,message:"Enter valid Phone number"}]),placeholder:"Phone Number",wrapperClassName:t.labeledInput}),e.jsx(R,{Component:()=>e.jsxs("button",{disabled:u,type:"submit",className:"py-3 mt-4 bg-primary text-white border border-none rounded w-full cursor-pointer",children:["SEND REGISTRATION LINK",l&&e.jsx("span",{className:"pl-4",children:e.jsx($e,{color:"white",size:24})})]}),size:"medium",className:"w-full mt-12 bg-primary",disabled:u})]})})]}),_&&e.jsx(is,{title:"Self-Registration link sent",email:j.email,contact:j.contact,closeModal:i,inviteLink:k})]});return e.jsx("div",{className:"p-8",children:N})}const Ns=({action:s,initalValues:o,submitVendorData:a,submitVendorForm:r})=>{const{category:n}=T(),i=s==="edit";return e.jsx("div",{className:t.vendorInfo,children:e.jsx(L,{initialValues:o,onSubmit:i?a:r,children:({setFieldValue:l})=>e.jsxs(q,{noValidate:!0,className:t.form,children:[e.jsx(f,{prefix:e.jsx(ye,{className:t.icon}),component:S,required:!0,autoFocus:!0,name:"name",size:"small",label:"Name",placeholder:"Enter name",wrapperClassName:t.labeledInput,validate:b([{test:p.required,message:"Name is required"}])}),e.jsx(f,{prefix:e.jsxs("span",{className:t.prefix,children:[e.jsx(U,{className:t.icon}),e.jsx("span",{className:t.indianCode,children:"+91"})]}),component:S,label:"Phone Number",size:"small",name:"contact",maxLength:10,validate:b([{test:p.phoneNumber,message:"Enter valid Phone number"}]),placeholder:"Phone Number",wrapperClassName:t.labeledInput}),e.jsx(f,{prefix:e.jsx("span",{className:t.prefix,children:e.jsx(Ce,{className:t.icon})}),component:Se,options:se(n,"select"),label:e.jsxs(e.Fragment,{children:["Category ",e.jsx("sup",{className:t.fieldRequired,children:" *"})]}),required:!0,size:"small",name:"category_id",validate:b([{test:p.required,message:"Category is required"}]),wrapperClassName:t.labeledInput}),!i&&e.jsx(f,{prefix:e.jsx("span",{className:t.prefix,children:e.jsx(we,{className:t.icon})}),component:S,label:"GST / PAN No.",size:"small",name:"gst_number",validate:b([{test:p.required,message:"Please enter GST or PAN no"},{test:p.gstOrPan,message:"Enter valid GST/PAN no."}]),placeholder:"27ADEYMS000D6A",wrapperClassName:t.labeledInput,disabled:i,onChange:c=>{var u,x;return l("gst_number",(x=(u=c.target.value)==null?void 0:u.toUpperCase())==null?void 0:x.trim())}}),e.jsx("div",{className:t.downloadAction,children:e.jsx(R,{Component:Y,children:s==="edit"?"Submit":"Next"})})]})})})},ys=({bankDetails:s,setBankDetails:o,initalValues:a,setVendorDetails:r,submitVendorData:n})=>{d.useEffect(()=>o(void 0),[]);const i=async l=>{const c=l.target.value;if(!p.ifsc(c))return;const u=await Ke(c);u&&o(u)};return e.jsx("div",{className:t.vendorInfo,children:e.jsx(L,{initialValues:a,enableReinitialize:!1,onSubmit:n,children:({isSubmitting:l})=>e.jsxs(q,{noValidate:!0,className:t.form,children:[e.jsx(f,{prefix:e.jsx(ke,{className:t.icon}),component:S,required:!0,name:"bank_account_number",size:"small",onPaste:H,onCopy:H,onKeyDown:c=>Fe(c,[]),label:"Account Number",placeholder:"Beneficiary Account Number",wrapperClassName:t.labeledInput,validate:b([{test:p.required,message:"Account Number is required"}])}),e.jsx(f,{prefix:e.jsx(ve,{className:t.icon}),component:S,size:"small",name:"ifsc_code",onChange:i,label:"IFSC Code",placeholder:"BANK0000251",wrapperClassName:t.ifsc,validate:b([{test:p.required,message:"IFSC is required"},{test:p.ifsc,message:"Enter valid IFSC"}])}
1),s&&e.jsxs("div",{className:t.bankDetails,children:[s.BANK," ",s.BRANCH&&e.jsx(e.Fragment,{children:","})," ",s.BRANCH]}),e.jsx(R,{Component:Y,loading:l,size:"medium",className:t.bankInfoSubmit,children:e.jsx("span",{className:"text-base",children:"Submit"})})]})})})},Ss=({formStep:s,action:o,showInviteForm:a})=>s===1&&!a?`${o==="edit"?"Edit":"Add new "} Vendor`:a?"Vendor Registration Link":"Vendor Bank Details";function ae(s){var M;const{mutate:o}=Q(),{closeModal:a,vendor:r={},action:n="add"}=s,[i]=Ie(),l=i.get("newVendorName")||"",{category:c,isLoading:u}=T(),[x,j]=d.useState(),[h,_]=d.useState(1),[m,k]=d.useState(void 0),[C,w]=d.useState(!1),[N,v]=d.useState(!1),{display_name:y,gst_number:D,phone:V,bank_account_number:ne,ifsc_code:oe,uuid:re,status:ie}=r,le=g=>{j(g),_(2)},B=async g=>{const{bank_account_number:I,ifsc_code:ce}=g;let{name:z,gst_number:de,category_id:G,contact:O}=x??{};n==="edit"&&Object.keys(r).length&&(z=g.name,G=g.category_id,O=g.contact);const{pennydrop_error:me,account_name:ue}=I?await Ue({account_no:I,ifsc:ce}):{};if(me)return;w(!0),j({...x,...g});const $={display_name:z,gst_number:de,phone:O,category_id:G,account_name:ue,internal_service:"payments",...g},{ok:pe}=n==="edit"&&Object.keys(r).length?await Ye({...$,status:ie,sellerId:re}):await Qe($);pe&&(await X(Z.payments.getSellers,o),a())};return u?e.jsx(De,{}):e.jsxs(e.Fragment,{children:[e.jsx(Oe,{onClose:a,onBack:()=>{_(1),v(!1)},showBackButton:h===2||N,topFixedHeader:!0,title:e.jsx(Ss,{formStep:h,action:n,showInviteForm:N})}),!N&&e.jsxs(e.Fragment,{children:[h===1&&e.jsx(Ns,{submitVendorData:B,submitVendorForm:le,initalValues:{name:l||y||"",contact:V||"",gst_number:D||"",category_id:((M=c.filter(g=>{var I;return((I=r==null?void 0:r.category)==null?void 0:I.uuid)===g.uuid})[0])==null?void 0:M.id)||"",...x},action:n}),h===2&&e.jsx(ys,{initalValues:{bank_account_number:ne||"",ifsc_code:oe||""},setVendorDetails:j,setBankDetails:k,bankDetails:m,submitVendorData:B})]}),N&&e.jsx(_s,{closeModal:a}),!N&&e.jsxs("div",{children:[e.jsx("span",{className:t.header,children:e.jsx("b",{children:"Don't know vendor details?"})}),e.jsxs("div",{className:t.inviteForm,children:[e.jsx("div",{children:e.jsx(Ve,{className:t.icon})}),e.jsx("div",{children:e.jsx("p",{children:"Send a self-registration link to the vendor and once they confirm their details they are added."})}),e.jsx("div",{children:e.jsx(J,{size:"small",onClick:()=>{v(!0)},children:"SEND LINK"})})]})]})]})}const Cs=({vendor:s})=>{const{mutate:o}=Q(),[a,r]=d.useState(),{status:n}=Je(s.uuid)??{},i=async()=>{const{ok:l}=await Xe({seller_id:s.uuid,status:n});l&&await X(Z.payments.getSellers,o)};return e.jsxs(e.Fragment,{children:[a&&e.jsx(te,{onCancel:()=>r(void 0),closable:!1,open:!0,width:478,footer:null,children:e.jsx(ae,{vendor:a,closeModal:()=>r(void 0),action:"edit"})}),e.jsxs(E,{onClick:({domEvent:l})=>l.stopPropagation(),children:[e.jsx(E.Item,{onClick:({domEvent:l})=>{l.stopPropagation(),r(s)},children:e.jsx(ze,{cta:"EDIT",color:"primary",IconComponent:Ae})}),e.jsx(E.Item,{children:e.jsx(es,{entityLabel:"vendor",deleteAction:i})})]})]})},ws="_cardContainer_19g8x_10",Fs="_hoverShowDropdown_19g8x_16",ks="_categoryTag_19g8x_26",vs="_pendingAmount_19g8x_46",F={cardContainer:ws,hoverShowDropdown:Fs,categoryTag:ks,pendingAmount:vs},Is=({vendor:s,onClickCardHandler:o,showArchive:a=!1})=>{var n,i,l;const r=e.jsx(Cs,{vendor:s});return e.jsx(e.Fragment,{children:e.jsxs(Ee,{onClick:()=>!a&&o(s),className:F.cardContainer,children:[e.jsxs(P,{span:10,children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx(W,{title:s.display_name,children:e.jsx("p",{className:"capitalize font-semibold text-heading-color text-size-lg m-0",children:K(s.display_name,25)})}),s.status===ts.VERIFIED&&e.jsx(W,{title:"Verified Vendor",children:e.jsx(Pe,{className:"ml-2 relative top-px "})})]}),e.jsxs("p",{className:"m-0 text-xs text-color-light",children:[s==null?void 0:s.bank_account_number," - ",s==null?void 0:s.ifsc_code]})]}),e.jsx(P,{span:6,className:F.categoryTag,children:e.jsx("span",{className:F.categoryTag,style:{color:`#${(n=s==null?void 0:s.category)==null?void 0:n.color_code}`,background:`#${((i=s==null?void 0:s.category)==null?void 0:i.color_code)+25}`},children:K((l=s==null?void 0:s.category)==null?void 0:l.name,15)})}),e.jsx(P,{span:6,className:F.pendingAmount,children:ss(parseFloat(s.pending_amount))}),e.jsx("div",{children:e.jsx("div",{className:F.hoverShowDropdown,onClick:c=>c.stopPropagation(),children:e.jsx(ee,{children:e.jsx(Ge,{menu:r,overlayClassName:F.dropdown})})})})]})})},Ds="_content_4a5bg_19",Vs="_rightContainer_4a5bg_25",A={content:Ds,rightContainer:Vs},ct=()=>{const{vendors:s}=Ze(),[o,a]=d.useState(!1),{category:r}=T(),n=Le(),[i,l]=d.useState(null),[c,u]=d.useState(s),x=m=>{if(l(m),m&&m.length){const k=s==null?void 0:s.filter(C=>{var w;return m.includes((w=C==null?void 0:C.category)==null?void 0:w.name)});u(k)}else u(s)},j=m=>{n(`/payments/vendors/${m.uuid}/${m.vendor_uuid}/`)};d.useEffect(()=>{x(i)},[s]);const h=()=>a(!1),_=()=>
1e.jsx(ee,{actionType:"add_vendor",children:e.jsx(J,{className:A.addVendorButton,size:"medium",onClick:()=>a(!0),children:"ADD VENDOR"})});return e.jsx(as,{RightColComponent:e.jsx("div",{className:A.rightContainer,children:e.jsx(os,{filterCategory:x,vendorCategories:r})}),children:e.jsxs(e.Fragment,{children:[o&&e.jsx(te,{onCancel:h,closable:!1,open:!0,width:478,footer:null,onClose:h,children:e.jsx(ae,{closeModal:h,action:"add"})}),e.jsx(ns,{dataTitle:"Total Vendors",dataValue:c==null?void 0:c.length,ActionComponents:_,formatValue:!1}),s.length===0?e.jsx(qe,{}):e.jsxs("div",{children:[e.jsx("div",{className:A.header,children:e.jsx(Re,{config:Me})}),e.jsx("div",{className:A.content,children:c==null?void 0:c.map(m=>e.jsx(Is,{vendor:m,onClickCardHandler:j},m.uuid))})]})]})})};export{ct as Component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.