2 lines
4.6 KiB
JavaScript
2 lines
4.6 KiB
JavaScript
import{T as W,a as T,b as o,d as i,e as t,f as G,g as $}from"./KeyboardArrowRight.800c6a53.js";import{d as q}from"./Add.87c13906.js";import{ak as J,aq as d,r as K,ah as Q,f as e,j as r,C as U,ar as V,as as I,at as P,au as v,av as _,aw as D,i as p,ap as u,P as X,g as Y,S as Z,ax as w,B as R,T as ee,ay as ae}from"./index.8dfdc9ed.js";import{P as te}from"./Page.2c1cad43.js";import{H as le}from"./HeaderBreadcrumbs.4d7b190c.js";import{G as h}from"./Grid.9e7e99d7.js";import{C as ne}from"./Card.57605f6f.js";import{T as re}from"./TableHead.4a10995a.js";function ge(){const{themeStretch:L}=J();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(Y,{"aria-label":"expand row",size:"small",onClick:()=>O(!s),children:s?e(G,{}):e($,{})})}),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(Z,{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(w,{in:s,timeout:"auto",unmountOnExit:!0,children:r(R,{sx:{margin:1},children:[e(ee,{variant:"h6",gutterBottom:!0,component:"div",children:"History"}),r(T,{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(o,{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 ae.get("/corporates");g(!1),N(a.data)};K.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=Q(),[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(te,{title:"Membership : Corporate List",children:r(U,{maxWidth:L?!1:"xl",children:[e(le,{heading:"Coporate List",links:[{name:"Dashboard",href:"/dashboard"},{name:"Corporates",href:"/corporates"}]}),r(h,{container:!0,spacing:3,sx:{mb:2},justifyContent:"flex-end",children:[e(h,{item:!0,children:e(V,{id:"outlined-basic",label:"Search",variant:"outlined",sx:{width:400}})}),e(h,{item:!0,children:r(I,{sx:{width:200},children:[e(P,{id:"plan-id-label",children:"PlanID"}),e(v,{labelId:"plan-id-label",id:"plan-id",multiple:!0,value:C,onChange:k,input:e(_,{label:"PlanID"}),MenuProps:f,children:E.map(a=>e(D,{value:a,style:b(a,C,x),children:a},a))})]})}),e(h,{item:!0,children:r(I,{sx:{width:200},children:[e(P,{id:"status-filter-label",children:"Status"}),e(v,{labelId:"status-filter-label",id:"status-filter",multiple:!0,value:S,onChange:z,input:e(_,{label:"Status"}),MenuProps:f,children:["Active","Suspended"].map(a=>e(D,{value:a,style:b(a,S,x),children:a},a))})]})}),e(h,{item:!0,children:e(p,{to:"/corporates/create",children:e(u,{variant:"outlined",startIcon:e(q,{}),sx:{p:1.8},children:"Create"})})})]}),e(ne,{children:e(W,{component:X,children:r(T,{"aria-label":"collapsible table",children:[e(o,{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(o,{children:e(i,{children:e(t,{colSpan:8,align:"center",children:"Loading"})})}):m.data.length==0?e(o,{children:e(i,{children:e(t,{colSpan:8,align:"center",children:"No Data"})})}):e(o,{children:m.data.map(a=>e(A,{row:a},a.code))})]})})})]})})}export{ge as default};
|