Files
aso/public/dashboard/assets/Index.88273dbb.js
2022-08-15 12:44:36 +07:00

2 lines
4.7 KiB
JavaScript

import{d as W,a as G}from"./KeyboardArrowRight.e1fc3789.js";import{d as $}from"./Add.30b0a8ee.js";import{ak as q,aq as d,r as J,ah as K,f as e,j as r,C as Q,ar as U,as as T,at as I,au as P,av as v,aw as _,i as p,ap as u,P as V,g as X,S as Y,ax as Z,B as w,T as R,ay as ee}from"./index.cfad77cc.js";import{P as ae}from"./Page.08a3a680.js";import{H as te}from"./HeaderBreadcrumbs.c55c2afa.js";import{G as o}from"./Grid.25d80463.js";import{C as le}from"./Card.3fda610a.js";import{T as ne,a as D,b as h,c as i,d as t}from"./TableRow.8f9db011.js";import{T as re}from"./TableHead.f1c8d260.js";import"./jsx-runtime_commonjs-proxy.a46fd57f.js";function fe(){const{themeStretch:L}=q();function A(a){const{row:l}=a,[s,O]=d.useState(!1);return r(d.Fragment,{children:[r(i,{sx:{"& > *":{borderBottom:"unset"}},children:[e(t,{children:e(X,{"aria-label":"expand row",size:"small",onClick:()=>O(!s),children:s?e(W,{}):e(G,{})})}),e(t,{align:"left",children:l.code}),e(t,{align:"left",children:l.name}),e(t,{align:"left",children:e(u,{variant:"outlined",color:"success",size:"small",children:"Active"})}),e(t,{align:"right",children:r(Y,{direction:"row",justifyContent:"flex-end",spacing:1,children:[e(p,{to:"/corporates/"+l.id+"/edit",children:e(u,{variant:"outlined",color:"primary",size:"small",children:"Edit"})}),e(p,{to:"/corporates/"+l.id,children:e(u,{variant:"outlined",color:"primary",size:"small",children:"Config"})})]})})]}),e(i,{children:e(t,{style:{paddingBottom:0,paddingTop:0},colSpan:6,children:e(Z,{in:s,timeout:"auto",unmountOnExit:!0,children:r(w,{sx:{margin:1},children:[e(R,{variant:"h6",gutterBottom:!0,component:"div",children:"History"}),r(D,{size:"small","aria-label":"purchases",children:[e(re,{children:r(i,{children:[e(t,{children:"Date"}),e(t,{children:"Customer"}),e(t,{align:"right",children:"Amount"}),e(t,{align:"right",children:"Total price ($)"})]})}),e(h,{children:l.history?l.history.map(n=>r(i,{children:[e(t,{component:"th",scope:"row",children:n==null?void 0:n.date}),e(t,{children:n==null?void 0:n.customerId}),e(t,{align:"right",children:n==null?void 0:n.amount}),e(t,{align:"right",children:Math.round((n==null?void 0:n.amount)*1e3*100)/100})]},n==null?void 0:n.date)):e(i,{children:e(t,{colSpan:8,children:"No Data"})})})]})]})})})})]})}const[B,g]=d.useState(!0),[m,N]=d.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}),F=async()=>{g(!0);const a=await ee.get("/corporates");g(!1),N(a.data)};J.exports.useEffect(()=>{F()},[]);const c={fontWeight:"bold"},H=48,M=8,f={PaperProps:{style:{maxHeight:H*4.5+M,width:250}}},E=["PLAN001","PLAN002","PLAN003","PLAN004","PLAN005"];function b(a,l,s){return{fontWeight:l.indexOf(a)===-1?s.typography.fontWeightRegular:s.typography.fontWeightMedium}}const x=K(),[C,j]=d.useState([]),k=a=>{const{target:{value:l}}=a;j(typeof l=="string"?l.split(","):l)},[S,y]=d.useState([]),z=a=>{const{target:{value:l}}=a;y(typeof l=="string"?l.split(","):l)};return d.useRef(null),e(ae,{title:"Membership : Corporate List",children:r(Q,{maxWidth:L?!1:"xl",children:[e(te,{heading:"Coporate List",links:[{name:"Dashboard",href:"/dashboard"},{name:"Corporates",href:"/corporates"}]}),r(o,{container:!0,spacing:3,sx:{mb:2},justifyContent:"flex-end",children:[e(o,{item:!0,children:e(U,{id:"outlined-basic",label:"Search",variant:"outlined",sx:{width:400}})}),e(o,{item:!0,children:r(T,{sx:{width:200},children:[e(I,{id:"plan-id-label",children:"PlanID"}),e(P,{labelId:"plan-id-label",id:"plan-id",multiple:!0,value:C,onChange:k,input:e(v,{label:"PlanID"}),MenuProps:f,children:E.map(a=>e(_,{value:a,style:b(a,C,x),children:a},a))})]})}),e(o,{item:!0,children:r(T,{sx:{width:200},children:[e(I,{id:"status-filter-label",children:"Status"}),e(P,{labelId:"status-filter-label",id:"status-filter",multiple:!0,value:S,onChange:z,input:e(v,{label:"Status"}),MenuProps:f,children:["Active","Suspended"].map(a=>e(_,{value:a,style:b(a,S,x),children:a},a))})]})}),e(o,{item:!0,children:e(p,{to:"/corporates/create",children:e(u,{variant:"outlined",startIcon:e($,{}),sx:{p:1.8},children:"Create"})})})]}),e(le,{children:e(ne,{component:V,children:r(D,{"aria-label":"collapsible table",children:[e(h,{children:r(i,{children:[e(t,{style:c,align:"left",children:"#"}),e(t,{style:c,align:"left",children:"Code"}),e(t,{style:c,align:"left",children:"Name"}),e(t,{style:c,align:"left",children:"Status"}),e(t,{style:c,align:"right",children:"Action"})]})}),B?e(h,{children:e(i,{children:e(t,{colSpan:8,align:"center",children:"Loading"})})}):m.data.length==0?e(h,{children:e(i,{children:e(t,{colSpan:8,align:"center",children:"No Data"})})}):e(h,{children:m.data.map(a=>e(A,{row:a},a.code))})]})})})]})})}export{fe as default};