2 lines
5.2 KiB
JavaScript
2 lines
5.2 KiB
JavaScript
import{bi as k,bj as w,bk as E,r as a,Z as B,bl as F,o as H,$ as R,bm as y,f as d,j as e,n as N,s as q,S as D,T as g,I as M,t as W,a2 as _,a3 as G,ay as V,Y as P,a4 as Y}from"./index.4f61bfb1.js";import{P as U}from"./Page.f00bcef1.js";import{H as X}from"./HeaderBreadcrumbs.dda529db.js";import{G as s}from"./Grid.c1e049cd.js";import{T as Z}from"./TextField.4a80d643.js";import{S as z}from"./Search.aaf8524e.js";import{L as J}from"./LoadingButton.69e85be7.js";import{L as K,l as $}from"./LinearProgress.7ce3ba86.js";import{C as Q}from"./Card.08e30663.js";import{F as ee,S as te}from"./FormControlLabel.70f1e7c6.js";import{C as ae}from"./Checkbox.66cb8f21.js";import"./generateUtilityClasses.06032f54.js";import"./SwitchBase.1ec49b3e.js";function A(i=k){const r=i===k?w:E(i);return function(){const{store:c}=r();return c}}const re=A();function se(i=k){const r=i===k?re:A(i);return function(){return r().dispatch}}const ie=se();q(K)(({theme:i})=>({height:10,borderRadius:6,[`&.${$.colorPrimary}`]:{backgroundColor:"#D1F1F1"},[`& .${$.bar}`]:{borderRadius:6,backgroundColor:"#54D62C"}}));function ne({title:i,openDialog:r,setOpenDialog:I}){const{corporateValue:c}=a.exports.useContext(B),[T,x]=a.exports.useState([]),n=ie(),o=F(t=>t.claims.data);a.exports.useState({id:0,fullName:"",memberId:"",limit:{current:0,total:0,percentage:0}});const u=H(),[f,b]=a.exports.useState(""),[S,h]=a.exports.useState({}),v=async t=>{t.preventDefault(),h(f===""?{}:{search:f}),await new Promise(p=>setTimeout(p,500))},C=(t,p)=>{if(p)n(y.patch([...o,t]));else{let l=o.filter(m=>m.memberId!==t.memberId);n(y.patch(l))}};return a.exports.useEffect(()=>{(async()=>{if(r===!0){const t=await R.get(`${c}/members`,{params:{...S,type:"claim-submit"}});x(t.data.data)}})()},[c,r,S]),a.exports.useEffect(()=>{n(y.dispatch())},[n]),d(s,{container:!0,children:[d(s,{item:!0,xs:12,paddingX:"10px",paddingY:"20px",children:[e("form",{onSubmit:v,children:e(Z,{id:"search-input",variant:"outlined",fullWidth:!0,onChange:t=>b(t==null?void 0:t.target.value),value:f,InputProps:{startAdornment:e(N,{position:"start",children:e(z,{})})},placeholder:"Search Name or Member ID... ",sx:{marginTop:2}})}),(()=>e(D,{children:e(D,{marginTop:2,spacing:1,children:T.map((t,p)=>e(Q,{sx:{bgcolor:l=>o.some(m=>m.memberId===t.memberId)?l.palette.primary.lighter:l.palette.background.default},children:d(D,{direction:"row",alignItems:"center",children:[e(s,{item:!0,xs:1,lg:1,xl:1,children:e("form",{children:e(ee,{value:"end",control:e(ae,{onChange:l=>C(t,l.target.checked)}),label:"",labelPlacement:"end",sx:{marginLeft:"20px"}})})}),e("div",{style:{position:"relative",flex:"none",height:"fit-content",margin:"15px"},children:e("img",{width:52,height:52,src:"/images/user-profile.png",alt:"user-profile",style:{borderRadius:"50%"}})}),d(s,{item:!0,xs:11,lg:11,xl:11,children:[e(g,{variant:"subtitle1",children:t.fullName}),e(g,{color:"#637381",variant:"body2",sx:{fontWeight:500},children:t.memberId})]}),e(s,{item:!0,xs:1,lg:1,xl:1,style:{display:"flex",justifyContent:"right",alignItems:"right"},children:e(M,{disabled:o.length>0,sx:{marginLeft:"10px"},onClick:()=>{n(y.patch([t])),u(`/claim-request/${t.id}`)},children:e(W,{icon:"ic:round-chevron-right"})})})]})},p))})}))()]}),e(s,{item:!0,xs:12,children:e(J,{variant:"contained",sx:{marginTop:2,p:2,margin:"10px"},fullWidth:!0,disabled:o.length===0,onClick:()=>u("/claim-request/bulk"),children:"Claim Submit Selected"})})]})}function Ce(){const{themeStretch:i}=_(),{corporateValue:r}=a.exports.useContext(B),[I,c]=a.exports.useState([]);a.exports.useState([]);const[T,x]=a.exports.useState(!0),[n,o]=G(),[u,f]=a.exports.useState({});a.exports.useState();const[b,S]=a.exports.useState("asc"),[h,v]=a.exports.useState("fullName"),C={order:b,setOrder:S,orderBy:h,setOrderBy:v},L=new Date,t=V(L);a.exports.useState(0),a.exports.useState(10);const[p,l]=a.exports.useState({current_page:0,from:0,last_page:0,links:[],path:"",per_page:0,to:0,total:0});return a.exports.useEffect(()=>{(async()=>{x(!0);const m=await R.get(`${r}/claim-report/claim-status`);c([{name:"Requested",value:m.data.data.requesteds,color:P.dark.primary.dark},{name:"Approval",value:m.data.data.approveds,color:P.dark.warning.dark},{name:"Rejected",value:m.data.data.rejecteds,color:P.dark.error.dark}]);const j=Object.keys(u).length!==0?u:Object.fromEntries([...n.entries(),["order",C.order],["orderBy",C.orderBy]]),O=await R.get(`${r}/members`,{params:{...j,type:"claim-report"}});o(j),l(O.data.data.allMembersByClaimStatus),x(!1)})()},[u,n,b,h,o,r]),d(U,{title:"Claim Reports",children:[e(X,{heading:"Claim Submit",links:[{name:"Case Management",href:"/dashboard"},{name:"Claim Submit",href:"/claim-submit"}]}),e(Y,{maxWidth:i?!1:"xl",children:d(s,{container:!0,spacing:2,children:[e(s,{item:!0,xs:12,lg:6,md:6,children:e(g,{variant:"h6",sx:{marginLeft:"10px"},children:" Select Employee"})}),e(s,{item:!0,xs:12,lg:6,md:6,sx:{display:"flex",justifyContent:"flex-end"},children:d(te,{direction:"row",alignItems:"center",children:[e(g,{variant:"inherit",align:"right",sx:{marginRight:"10px"},children:"Submission Date"}),e(g,{variant:"subtitle1",align:"right",sx:{marginRight:"10px"},children:t})]})}),e(s,{item:!0,xs:12,lg:12,md:12,children:e(ne,{openDialog:!0,setOpenDialog:!1,title:{name:"te"}})})]})})]})}export{Ce as default};
|