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

2 lines
5.1 KiB
JavaScript

import{H as E}from"./HeaderBreadcrumbs.5be7a6b4.js";import{P as G}from"./Page.aa656a85.js";import{a as H,aT as A,a0 as u,r as o,f as e,S as N,j as s,P as q,au as T,i as O,$ as _,bL as k,T as $,Y as w,av as z,I as K,aU as v,ap as U,C as V}from"./index.ef35a7e7.js";import{B as Y}from"./BasePagination.b907cc44.js";import{C as J}from"./Card.cc6fb9c1.js";import{T as M}from"./TableContainer.d3d72d8f.js";import{T as Q,a as f,b as x,c as t}from"./TableRow.e3e9b73a.js";import{G as y}from"./Grid.ba6e5a37.js";import{B as X}from"./ButtonGroup.4a34b591.js";import{D as Z,a as ee}from"./DialogContent.e5ce391a.js";import{D as ae}from"./DialogContentText.b86c39d8.js";import{D as te}from"./DialogActions.42f6565d.js";import{S as ne}from"./Search.250eac5e.js";function re(){H(),A();const[d,m]=u();u(),u();const[ie,B]=u();function I(n){const a=o.exports.useRef(null),[i,h]=o.exports.useState(""),S=r=>{var g;const c=(g=r.target.value)!=null?g:"";h(c)},P=r=>{r.preventDefault(),n.onSearch(i)};return o.exports.useEffect(()=>{var r;h((r=d.get("search"))!=null?r:"")},[]),e("form",{style:{width:"100%"},children:e(y,{container:!0,spacing:2,sx:{justifyContent:"space-between",alignItems:"center"},children:e(y,{item:!0,xs:12,sm:12,md:12,lg:12,children:e(z,{id:"search-input",ref:a,variant:"outlined",fullWidth:!0,onChange:S,onKeyDown:r=>{r.key==="Enter"&&P(r)},value:i,InputProps:{startAdornment:e(K,{position:"start",children:e(ne,{})}),placeholder:"Search"}})})})})}function F(n){return e(y,{container:!0,spacing:2,sx:{p:2,justifyContent:"space-between",alignItems:"center"},children:e(y,{item:!0,xs:12,md:12,lg:12,children:e(I,{onSearch:R})})})}function j(n){const{row:a}=n;T.useState(!1);const[i,h]=T.useState(!1),S=P=>{w.delete(`/doctors/${a.id}`).then(r=>{C({...p,data:p.data.filter(c=>c.id!=a.id)}),v("Data berhasil dihapus",{variant:"success"})}).catch(r=>{var c,g;v((g=(c=r.response.data.message)!=null?c:r.message)!=null?g:"Failed Processing Request",{variant:"error"})})};return s(T.Fragment,{children:[s(x,{children:[e(t,{}),e(t,{align:"left",children:a.date_created?a.date_created:"-"}),e(t,{align:"left",children:a.date_appointment?a.date_appointment:"-"}),e(t,{align:"left",children:a.health_care?a.health_care:"-"}),e(t,{align:"left",children:a.doctor_name?a.doctor_name:"-"}),e(t,{align:"left",children:a.speciality?a.speciality:"-"}),e(t,{align:"left",children:a.appointment_media?a.appointment_media:"-"}),e(t,{align:"left",children:a.status?a.status:"-"}),e(t,{align:"center",children:e(X,{variant:"text","aria-label":"text button group",children:e(O,{to:"/report/appointments/"+a.id+"/show",children:e(_,{children:e(k,{icon:"ph:eye-bold",style:{width:"24px",height:"24px"}})})})})})]}),s(Z,{open:i,onClose:()=>{h(!1)},"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[s(ee,{sx:{p:5},children:[e(k,{icon:"eva:trash-2-outline",style:{width:"100px",height:"100px",color:"#FF0000",margin:"auto",display:"block",marginBottom:"20px",alignContent:"center"}}),e(ae,{sx:{fontWeight:"bold",pb:1},id:"alert-dialog-title",children:"Apakah anda yakin ingin menghapus"}),s($,{sx:{fontWeight:"bold"},id:"alert-dialog-title",children:[a.name,"?"]})]}),s(te,{children:[e(_,{onClick:()=>{h(!1)},color:"primary",children:"Batal"}),e(_,{onClick:()=>{S(a.id)},color:"primary",autoFocus:!0,children:"Hapus"})]})]})]})}const l={fontWeight:"bold"},[L,D]=o.exports.useState(!0);o.exports.useState(0),o.exports.useState("idle");const[p,C]=o.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});o.exports.useState(5);const b=async(n=null)=>{D(!0);const a=n||Object.fromEntries([...d.entries()]),i=await w.get("/appointments",{params:a});D(!1),C(i.data)},R=async(n,a,i)=>{await b({search:n,organization_id:a,speciality_id:i}),B({search:n,organization_id:a,speciality_id:i})},W=(n,a)=>{const i=Object.fromEntries([...d.entries(),["page",a]]);b(i),m(i)};return o.exports.useEffect(()=>{b()},[]),e(N,{children:s(J,{sx:{marginTop:"30px"},children:[e(F,{sx:{marginTop:"100px"}}),e(M,{component:q,children:s(Q,{children:[e(f,{children:s(x,{children:[e(t,{style:l,align:"left"}),e(t,{style:l,align:"left",children:"Tanggal Booking"}),e(t,{style:l,align:"left",children:"Tanggal Appointment"}),e(t,{style:l,align:"left",children:"Faskes"}),e(t,{style:l,align:"left",children:"Nama Dokter"}),e(t,{style:l,align:"left",children:"Spesialisasi"}),e(t,{style:l,align:"left",children:"Appointment Via App/Website"}),e(t,{style:l,align:"left",children:"Status Appointment"}),e(t,{style:l,align:"left"})]})}),L?e(f,{children:e(x,{children:e(t,{colSpan:8,align:"center",children:"Loading"})})}):p.data.length==0?e(f,{children:e(x,{children:e(t,{colSpan:8,align:"center",children:"No Data"})})}):e(f,{children:p.data.map(n=>e(j,{row:n},n.id))})]})}),e(Y,{paginationData:p,onPageChange:W})]})})}function be(){const{themeStretch:d}=U();A();const m="Appointments";return e(G,{title:m,children:s(V,{maxWidth:d?!1:"xl",children:[e(E,{heading:m,links:[{name:"Report",href:"/report"},{name:"Appointments",href:"/report/appointments"}]}),e(re,{})]})})}export{be as default};