Files
aso/public/dashboard/assets/Index.14c6fcd9.js
2023-02-15 09:07:33 +07:00

2 lines
7.5 KiB
JavaScript

import{H as te}from"./HeaderBreadcrumbs.5be7a6b4.js";import{P as ne}from"./Page.aa656a85.js";import{a as ie,aT as G,a0 as w,r as c,f as e,S as re,j as i,P as se,i as K,$ as b,au as I,g as oe,bL as j,aB as le,B as ce,T as de,Y as v,av as L,I as he,aU as N,ap as pe,C as me}from"./index.ef35a7e7.js";import{B as ue}from"./BasePagination.b907cc44.js";import{d as ge,a as xe}from"./KeyboardArrowRight.aa71047a.js";import{d as fe}from"./Add.f5557507.js";import{C as Se}from"./Card.cc6fb9c1.js";import{T as be}from"./TableContainer.d3d72d8f.js";import{T as ye,a as z,b as y,c as o}from"./TableRow.e3e9b73a.js";import{G as n}from"./Grid.ba6e5a37.js";import{B as De}from"./ButtonGroup.4a34b591.js";import{D as Ce,a as Te}from"./DialogContent.e5ce391a.js";import{D as ke}from"./DialogContentText.b86c39d8.js";import{D as Pe}from"./DialogActions.42f6565d.js";import{S as _e}from"./Search.250eac5e.js";import{A as $}from"./Autocomplete.eb44dd5e.js";import"./jsx-runtime_commonjs-proxy.a0db3bf1.js";import"./Chip.8bf36fd3.js";function we(){ie(),G();const[u,D]=w(),[H,ve]=w(),[q,ze]=w(),[Be,M]=w();function J(r){const a=c.exports.useRef(null),[s,C]=c.exports.useState(""),[T,p]=c.exports.useState(""),[k,f]=c.exports.useState(""),P=t=>{var d;const l=(d=t.target.value)!=null?d:"";f(l)},m=t=>{var d;const l=(d=t.id)!=null?d:"";console.log(l),C(l)},S=t=>{var d;const l=(d=t.id)!=null?d:"";p(l)},h=t=>{t.preventDefault(),r.onSearch(k,s,T)},[_,Z]=c.exports.useState([]),[ee,ae]=c.exports.useState([]);c.exports.useEffect(()=>{var t,l,d;v.get("/search-organizations").then(O=>{Z(O.data)}),v.get("/search-specialities").then(O=>{ae(O.data)}),f((t=u.get("search"))!=null?t:""),C((l=H.get("organization_id"))!=null?l:""),p((d=q.get("speciality_id"))!=null?d:"")},[]);const F=[{id:"",value:"",name:"Semua"}],R=F.concat(_),W=F.concat(ee);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(L,{id:"search-input",ref:a,variant:"outlined",fullWidth:!0,onChange:P,onKeyDown:t=>{t.key==="Enter"&&h(t)},value:k,InputProps:{startAdornment:e(he,{position:"start",children:e(_e,{})}),placeholder:"Search"}})}),e(n,{item:!0,xs:12,sm:4,md:2,lg:2,children:e($,{id:"organizations",options:R,value:R.find(t=>t.id==s),getOptionLabel:t=>t.name,onChange:(t,l)=>{m(l)},onKeyDown:t=>{t.key==="Enter"&&h(t)},renderInput:t=>e(L,{...t,label:"Rumah Sakit",variant:"outlined",fullWidth:!0})})}),e(n,{item:!0,xs:12,sm:4,md:2,lg:2,children:e($,{id:"specialities",options:W,getOptionLabel:t=>t.name,value:W.find(t=>t.id==T),onChange:(t,l)=>S(l),onKeyDown:t=>{t.key==="Enter"&&h(t)},renderInput:t=>e(L,{...t,label:"Spesialis",variant:"outlined",fullWidth:!0})})})]})})}function U(r){return i(n,{container:!0,spacing:2,sx:{p:2,justifyContent:"space-between",alignItems:"center"},children:[e(n,{item:!0,xs:12,md:10,lg:10,children:e(J,{onSearch:V})}),e(n,{item:!0,xs:12,md:2,lg:2,sx:{textAlign:"right"},children:e(K,{to:"/master/doctors/create",style:{textDecoration:"none"},children:e(b,{variant:"outlined",startIcon:e(fe,{}),sx:{p:1.8},children:"Create"})})})]})}function Y(r){var f,P;const{row:a}=r,[s,C]=I.useState(!1),[T,p]=I.useState(!1),k=m=>{v.delete(`/doctors/${a.id}`).then(S=>{A({...x,data:x.data.filter(h=>h.id!=a.id)}),N("Data berhasil dihapus",{variant:"success"})}).catch(S=>{var h,_;N((_=(h=S.response.data.message)!=null?h:S.message)!=null?_:"Failed Processing Request",{variant:"error"})})};return i(I.Fragment,{children:[i(y,{children:[e(o,{children:e(oe,{"aria-label":"expand row",size:"small",onClick:()=>C(!s),children:s?e(ge,{}):e(xe,{})})}),e(o,{align:"left",children:a.name?a.name:"-"}),e(o,{align:"left",children:(P=(f=a.organizations)==null?void 0:f.map(m=>m.organization_name).join(", "))!=null?P:"-"}),e(o,{align:"left",children:a.specialties?a.specialties.map(m=>m.specialty_name).join(", "):"-"}),e(o,{align:"left",children:a.address?a.address:"-"}),e(o,{align:"center",children:i(De,{variant:"text","aria-label":"text button group",children:[e(K,{to:"/master/doctors/"+a.id+"/edit",children:e(b,{children:e(j,{icon:"ph:pencil-simple-fill",style:{width:"24px",height:"24px"}})})}),e(b,{onClick:()=>{p(!0)},children:e(j,{icon:"eva:trash-2-outline",style:{width:"24px",height:"24px"}})})]})})]}),e(y,{children:e(o,{style:{paddingBottom:0,paddingTop:0,backgroundColor:"rgba(244, 246, 248, 0.5)"},colSpan:9999,children:e(le,{in:s,timeout:"auto",unmountOnExit:!0,children:e(ce,{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:[": ",a.education?a.education:"-"]}),e(n,{item:!0,xs:6,children:"Pengalaman Kerja"}),i(n,{item:!0,xs:6,children:[": ",a.experience?a.experience:"-"]}),e(n,{item:!0,xs:6,children:"Jenis Kelamin"}),i(n,{item:!0,xs:6,children:[":"," ",a.gender=="male"?"Laki-Laki":a.gender=="female"?"Perempuan":"-"]})]})}),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:[": ",a.email?a.email:"-"]}),e(n,{item:!0,xs:6,children:"No. Telp"}),i(n,{item:!0,xs:6,children:[": ",a.phone?a.phone:"-"]}),e(n,{item:!0,xs:6,children:"Penghargaan"}),i(n,{item:!0,xs:6,children:[": ",a.award?a.award:"-"]})]})})]})})})})}),i(Ce,{open:T,onClose:()=>{p(!1)},"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[i(Te,{sx:{p:5},children:[e(j,{icon:"eva:trash-2-outline",style:{width:"100px",height:"100px",color:"#FF0000",margin:"auto",display:"block",marginBottom:"20px",alignContent:"center"}}),e(ke,{sx:{fontWeight:"bold",pb:1},id:"alert-dialog-title",children:"Apakah anda yakin ingin menghapus"}),i(de,{sx:{fontWeight:"bold"},id:"alert-dialog-title",children:[a.name,"?"]})]}),i(Pe,{children:[e(b,{onClick:()=>{p(!1)},color:"primary",children:"Batal"}),e(b,{onClick:()=>{k(a.id)},color:"primary",autoFocus:!0,children:"Hapus"})]})]})]})}const g={fontWeight:"bold"},[Q,E]=c.exports.useState(!0);c.exports.useState(0),c.exports.useState("idle");const[x,A]=c.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});c.exports.useState(5);const B=async(r=null)=>{E(!0);const a=r||Object.fromEntries([...u.entries()]),s=await v.get("/doctors",{params:a});E(!1),A(s.data)},V=async(r,a,s)=>{await B({search:r,organization_id:a,speciality_id:s}),M({search:r,organization_id:a,speciality_id:s})},X=(r,a)=>{const s=Object.fromEntries([...u.entries(),["page",a]]);B(s),D(s)};return c.exports.useEffect(()=>{B()},[]),e(re,{children:i(Se,{sx:{marginTop:"30px"},children:[e(U,{sx:{marginTop:"100px"}}),e(be,{component:se,children:i(ye,{children:[e(z,{children:i(y,{children:[e(o,{style:g,align:"left"}),e(o,{style:g,align:"left",children:"Nama Dokter"}),e(o,{style:g,align:"left",children:"Rumah Sakit"}),e(o,{style:g,align:"left",children:"Spesialis"}),e(o,{style:g,align:"left",children:"Alamat"})]})}),Q?e(z,{children:e(y,{children:e(o,{colSpan:8,align:"center",children:"Loading"})})}):x.data.length==0?e(z,{children:e(y,{children:e(o,{colSpan:8,align:"center",children:"No Data"})})}):e(z,{children:x.data.map(r=>e(Y,{row:r},r.id))})]})}),e(ue,{paginationData:x,onPageChange:X})]})})}function Ye(){const{themeStretch:u}=pe();G();const D="Manage Dokter";return e(ne,{title:D,children:i(me,{maxWidth:u?!1:"xl",children:[e(te,{heading:D,links:[{name:"Master",href:"/master"},{name:"Dokter",href:"/master/doctors"}]}),e(we,{})]})})}export{Ye as default};