Files
aso/public/dashboard/assets/Index.875d562d.js
2023-02-01 19:16:50 +07:00

2 lines
6.7 KiB
JavaScript

import{H as ee}from"./HeaderBreadcrumbs.fcbc782e.js";import{P as ae}from"./Page.1de38bf1.js";import{a as te,aT as N,a0 as k,r as l,f as e,S as ne,j as i,P as ie,au as B,g as re,aB as se,B as oe,bL as le,T as ce,$ as R,Y as w,av as I,I as de,aU as W,ap as he,C as pe}from"./index.95eebec8.js";import{B as me}from"./BasePagination.3106f606.js";import{d as ue,a as ge}from"./KeyboardArrowRight.28eba6d1.js";import{C as fe}from"./Card.8814c548.js";import{T as xe}from"./TableContainer.3833ff35.js";import{T as Se,a as z,b,c}from"./TableRow.0f6b86c0.js";import{G as n}from"./Grid.df60038f.js";import{D as be,a as ye}from"./DialogContent.6a054fb7.js";import{D as De}from"./DialogContentText.e6ab6831.js";import{D as Te}from"./DialogActions.edd814cc.js";import{S as Ce}from"./Search.745e80fc.js";import{A as K}from"./Autocomplete.72d1df11.js";import"./jsx-runtime_commonjs-proxy.33f300db.js";function Pe(){te(),N();const[m,y]=k(),[H,_e]=k(),[$,ke]=k(),[we,q]=k();function G(r){const t=l.exports.useRef(null),[s,D]=l.exports.useState(""),[T,f]=l.exports.useState(""),[C,x]=l.exports.useState(""),P=a=>{var d;const o=(d=a.target.value)!=null?d:"";x(o)},p=a=>{var d;const o=(d=a.id)!=null?d:"";console.log(o),D(o)},S=a=>{var d;const o=(d=a.id)!=null?d:"";f(o)},h=a=>{a.preventDefault(),r.onSearch(C,s,T)},[_,V]=l.exports.useState([]),[X,Z]=l.exports.useState([]);l.exports.useEffect(()=>{var a,o,d;w.get("/search-organizations").then(O=>{V(O.data)}),w.get("/search-specialities").then(O=>{Z(O.data)}),x((a=m.get("search"))!=null?a:""),D((o=H.get("organization_id"))!=null?o:""),f((d=$.get("speciality_id"))!=null?d:"")},[]);const A=[{id:"",value:"",name:"Semua"}],F=A.concat(_),L=A.concat(X);return e("form",{style:{width:"100%"},children:i(n,{container:!0,spacing:2,sx:{justifyContent:"space-between",alignItems:"center"},children:[e(n,{item:!0,xs:12,sm:12,md:8,lg:8,children:e(I,{id:"search-input",ref:t,variant:"outlined",fullWidth:!0,onChange:P,onKeyDown:a=>{a.key==="Enter"&&h(a)},value:C,InputProps:{startAdornment:e(de,{position:"start",children:e(Ce,{})}),placeholder:"Search"}})}),e(n,{item:!0,xs:12,sm:4,md:2,lg:2,children:e(K,{id:"organizations",options:F,value:F.find(a=>a.id==s),getOptionLabel:a=>a.name,onChange:(a,o)=>{p(o)},onKeyDown:a=>{a.key==="Enter"&&h(a)},renderInput:a=>e(I,{...a,label:"Rumah Sakit",variant:"outlined",fullWidth:!0})})}),e(n,{item:!0,xs:12,sm:4,md:2,lg:2,children:e(K,{id:"specialities",options:L,getOptionLabel:a=>a.name,value:L.find(a=>a.id==T),onChange:(a,o)=>S(o),onKeyDown:a=>{a.key==="Enter"&&h(a)},renderInput:a=>e(I,{...a,label:"Spesialis",variant:"outlined",fullWidth:!0})})})]})})}function M(r){return e(n,{container:!0,spacing:2,sx:{p:2,justifyContent:"space-between",alignItems:"center"},children:e(n,{item:!0,xs:12,md:12,lg:12,children:e(G,{onSearch:Y})})})}function J(r){var x,P;const{row:t}=r,[s,D]=B.useState(!1),[T,f]=B.useState(!1),C=p=>{w.delete(`/doctors/${t.id}`).then(S=>{E({...g,data:g.data.filter(h=>h.id!=t.id)}),W("Data berhasil dihapus",{variant:"success"})}).catch(S=>{var h,_;W((_=(h=S.response.data.message)!=null?h:S.message)!=null?_:"Failed Processing Request",{variant:"error"})})};return i(B.Fragment,{children:[i(b,{children:[e(c,{children:e(re,{"aria-label":"expand row",size:"small",onClick:()=>D(!s),children:s?e(ue,{}):e(ge,{})})}),e(c,{align:"left",children:t.name?t.name:"-"}),e(c,{align:"left",children:(P=(x=t.organizations)==null?void 0:x.map(p=>p.organization_name).join(", "))!=null?P:"-"}),e(c,{align:"left",children:t.specialties?t.specialties.map(p=>p.specialty_name).join(", "):"-"}),e(c,{align:"left",children:t.address?t.address:"-"})]}),e(b,{children:e(c,{style:{paddingBottom:0,paddingTop:0,backgroundColor:"rgba(244, 246, 248, 0.5)"},colSpan:9999,children:e(se,{in:s,timeout:"auto",unmountOnExit:!0,children:e(oe,{sx:{margin:1,pb:2,pl:4},children:i(n,{container:!0,children:[e(n,{item:!0,xs:6,sx:{padding:2},children:i(n,{container:!0,children:[e(n,{item:!0,xs:6,children:"Pendidikan"}),i(n,{item:!0,xs:6,children:[": ",t.education?t.education:"-"]}),e(n,{item:!0,xs:6,children:"Pengalaman Kerja"}),i(n,{item:!0,xs:6,children:[": ",t.experience?t.experience:"-"]}),e(n,{item:!0,xs:6,children:"Jenis Kelamin"}),i(n,{item:!0,xs:6,children:[": ",t.gender?t.gender:"-"]})]})}),e(n,{item:!0,xs:6,sx:{padding:2},children:i(n,{container:!0,children:[e(n,{item:!0,xs:6,children:"Email"}),i(n,{item:!0,xs:6,children:[": ",t.email?t.email:"-"]}),e(n,{item:!0,xs:6,children:"No. Telp"}),i(n,{item:!0,xs:6,children:[": ",t.phone?t.phone:"-"]}),e(n,{item:!0,xs:6,children:"Penghargaan"}),i(n,{item:!0,xs:6,children:[": ",t.award?t.award:"-"]})]})})]})})})})}),i(be,{open:T,onClose:()=>{f(!1)},"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[i(ye,{sx:{p:5},children:[e(le,{icon:"eva:trash-2-outline",style:{width:"100px",height:"100px",color:"#FF0000",margin:"auto",display:"block",marginBottom:"20px",alignContent:"center"}}),e(De,{sx:{fontWeight:"bold",pb:1},id:"alert-dialog-title",children:"Apakah anda yakin ingin menghapus"}),i(ce,{sx:{fontWeight:"bold"},id:"alert-dialog-title",children:[t.name,"?"]})]}),i(Te,{children:[e(R,{onClick:()=>{f(!1)},color:"primary",children:"Batal"}),e(R,{onClick:()=>{C(t.id)},color:"primary",autoFocus:!0,children:"Hapus"})]})]})]})}const u={fontWeight:"bold"},[U,j]=l.exports.useState(!0);l.exports.useState(0),l.exports.useState("idle");const[g,E]=l.exports.useState({current_page:1,data:[],path:"",first_page_url:"",last_page:1,last_page_url:"",next_page_url:"",prev_page_url:"",per_page:10,from:0,to:0,total:0});l.exports.useState(5);const v=async(r=null)=>{j(!0);const t=r||Object.fromEntries([...m.entries()]),s=await w.get("/doctors",{params:t});j(!1),E(s.data)},Y=async(r,t,s)=>{await v({search:r,organization_id:t,speciality_id:s}),q({search:r,organization_id:t,speciality_id:s})},Q=(r,t)=>{const s=Object.fromEntries([...m.entries(),["page",t]]);v(s),y(s)};return l.exports.useEffect(()=>{v()},[]),e(ne,{children:i(fe,{sx:{marginTop:"30px"},children:[e(M,{sx:{marginTop:"100px"}}),e(xe,{component:ie,children:i(Se,{children:[e(z,{children:i(b,{children:[e(c,{style:u,align:"left"}),e(c,{style:u,align:"left",children:"Nama Dokter"}),e(c,{style:u,align:"left",children:"Rumah Sakit"}),e(c,{style:u,align:"left",children:"Spesialis"}),e(c,{style:u,align:"left",children:"Alamat"})]})}),U?e(z,{children:e(b,{children:e(c,{colSpan:8,align:"center",children:"Loading"})})}):g.data.length==0?e(z,{children:e(b,{children:e(c,{colSpan:8,align:"center",children:"No Data"})})}):e(z,{children:g.data.map(r=>e(J,{row:r},r.id))})]})}),e(me,{paginationData:g,onPageChange:Q})]})})}function $e(){const{themeStretch:m}=he();N();const y="Manage Dokter";return e(ae,{title:y,children:i(pe,{maxWidth:m?!1:"xl",children:[e(ee,{heading:y,links:[{name:"Master",href:"/master"},{name:"Dokter",href:"/master/doctors"}]}),e(Pe,{})]})})}export{$e as default};