text: (this.webpackJsonpclient=this.webpackJsonpclient||[]).push([[0],{34:function(e,t,n){},35:function(e,t,n){},36:function(e,t,n){},46:function(e,t,n){},66:function(e,t,n){},68:function(e,t,n){},69:function(e,t,n){},75:function(e,t,n){},76:function(e,t,n){},77:function(e,t,n){},78:function(e,t,n){},79:function(e,t,n){},80:function(e,t,n){},81:function(e,t,n){},82:function(e,t,n){},83:function(e,t,n){"use strict";n.r(t);var c=n(1),s=n.n(c),a=n(37),r=n.n(a),i=(n(46),n(2)),l=n(3),o=n(4),j=n(16),d=n(13),u=n.n(d),b=n(19),h=n(11),O=n(38),m=n(20),x=n.n(m),p=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"",i=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"Employee",l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:[],o=arguments.length>8&&void 0!==arguments[8]?arguments[8]:"";Object(h.a)(this,e),this.firstName=void 0,this.lastName=void 0,this.email=void 0,this.address=void 0,this.phoneNumber=void 0,this.password=void 0,this.type=void 0,this.requestIds=void 0,this.id=void 0,this.firstName=t,this.lastName=n,this.email=c,this.address=s,this.phoneNumber=a,this.password=r,this.type=i,this.requestIds=l,this.id=o},f=function e(t,n,c){Object(h.a)(this,e),this.description="",this.cost=0,this.date="",this.description=t,this.cost=n,this.date=c},v=n(41),g=n(40),y=function(e){Object(v.a)(n,e);var t=Object(g.a)(n);function n(e,c,s,a,r,i,l,o){return Object(h.a)(this,n),t.call(this,e,c,s,a,r,i,"Manager",o)}return n}(p),w=function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"",l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0;Object(h.a)(this,e),this.expenses=void 0,this.requester=void 0,this.status=void 0,this.startDate=void 0,this.endDate=void 0,this.id=void 0,this.total=void 0,this.expenses=n,this.requester=c,this.status=s,this.startDate=a,this.endDate=r,this.id=i,this.total=l,n.forEach((function(e){t.total+=e.cost}))},N=function(){function e(){Object(h.a)(this,e)}return Object(O.a)(e,null,[{key:"getNewEmployee",value:function(){return new p}},{key:"getNewRequest",value:function(){return new w}},{key:"getDummyEmployee",value:function(){return new p("first","last","abc@abc.com","123 street",123456890,"password","Employee",[],"0")}},{key:"getDummyEmployees",value:function(){return[e.getDummyEmployee(),e.getDummyEmployee(),e.getDummyEmployee()]}},{key:"getDummyManager",value:function(){return new y("boss","man","daboss@abc.com","111 street",123456890,"password","Employee",[])}},{key:"getDummyRequest",value:function(){var e=[new f("drink",200,"5-5-21"),new f("pizza",200,"5-5-21"),new f("chips",200,"5-5-21")];return new w(e,"100","pending","5-5-21","5-5-21","0")}},{key:"getDummyRequests",value:function(){return console.log("getdummyrequests"),[e.getDummyRequest(),e.getDummyRequest(),e.getDummyRequest()]}},{key:"getDummyEmployeeRequests",value:function(t){var n=e.getDummyRequests();return console.log(n),n}},{key:"getObject",value:function(t,n,c){setTimeout((function(){var e=n();void 0!==c&&c(e),t(e)}),e.loadDelay)}},{key:"retriveResult",value:function(e){return e}},{key:"getEmployeeByEmail",value:function(e){}},{key:"login",value:function(){var t=Object(b.a)(u.a.mark((function t(n,c){return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:x()({method:"GET",url:e.url,params:c}).then((function(e){console.log(e.status),200===e.status&&(console.log(e.data),n(e.data))})).catch((function(e){console.log(e)}));case 1:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()},{key:"setLogOutCallback",value:function(t){e.appSetStateCb=t}},{key:"logout",value:function(){localStorage.removeItem("user"),localStorage.removeItem("isManager"),e.appSetStateCb(null)}},{key:"setUser",value:function(e){localStorage.setItem("user",JSON.stringify(e))}},{key:"getCurrentUserId",value:function(){return JSON.parse(localStorage.getItem("user")).id}},{key:"getIsManager",value:function(){return"Manager"===JSON.parse(localStorage.getItem("user")).type}},{key:"getDao",value:function(){var t=Object(b.a)(u.a.mark((function t(n,c){return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:x()({method:"GET",url:e.url,params:c}).then((function(e){e&&200===e.status&&(console.log(JSON.stringify(e.data)),n(e.data))})).catch((function(e){console.error(e)}));case 1:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()},{key:"postDao",value:function(){var t=Object(b.a)(u.a.mark((function t(n,c){return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return console.log("postDao: ".concat(c)),t.next=3,x.a.post(e.url,c,{headers:{"Content-Type":"application/json"}}).then((function(e){e&&200===e.status&&n(e.data.json)})).catch((function(e){console.error(e)}));case 3:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()}]),e}();N.loadDelay=200,N.url="http://localhost:8888",N.appSetStateCb=void 0;n(66);var S=n(0);function R(e){var t=Object(c.useRef)(null),n=Object(c.useRef)(null),s=function(e){var c;e.preventDefault();var s=e.target.id,r=t.current.value,i=n.current.value;N.getDao(a,(c={},Object(j.a)(c,s,r),Object(j.a)(c,"password",i),c))};function a(t){var n=t.map;N.setUser(n),e.callback(n)}return Object(S.jsxs)("div",{className:"Login",children:[Object(S.jsx)("h2",{children:"Reinbursement Portal"}),Object(S.jsxs)("form",{children:[Object(S.jsx)("ul",{children:Object(S.jsxs)(c.Fragment,{children:[Object(S.jsx)("li",{children:Object(S.jsx)("input",{ref:t,type:"text",defaultValue:"abc@abc.com"})}),Object(S.jsx)("li",{children:Object(S.jsx)("input",{ref:n,type:"text",defaultValue:"pass"})})]})}),Object(S.jsxs)("div",{className:"loginButtons",children:[Object(S.jsx)("button",{onClick:s,id:"login",children:"Employee Login"}),Object(S.jsx)("button",{onClick:s,id:"mgrLogin",children:"Manager Login"})]})]})]})}n(68),n(69);function D(e){var t=N.getCurrentUserId();return Object(S.jsx)("div",{className:"Sidebar",children:Object(S.jsxs)("ul",{children:[Object(S.jsx)("li",{children:Object(S.jsx)(l.b,{to:"/RequestCreate",className:"nounderline",children:"Request"})}),Object(S.jsx)("li",{children:Object(S.jsx)(l.b,{to:"/RequestViewByEmployee/"+t,className:"nounderline",children:"Home"})}),Object(S.jsx)("li",{children:Object(S.jsx)("hr",{})}),Object(S.jsx)("li",{children:Object(S.jsx)(l.b,{to:"/ProfileView",className:"nounderline",children:"Profile"})}),Object(S.jsx)("li",{children:Object(S.jsx)(l.b,{to:"/PasswordReset",className:"nounderline",children:"Password Reset"})}),Object(S.jsx)("li",{children:Object(S.jsx)("hr",{})}),Object(S.jsx)("li",{children:Object(S.jsx)(l.b,{to:"/Logout",className:"nounderline",children:"Logout"})})]})})}function q(e){return Object(S.jsxs)("div",{className:"SidebarManager",children:[Object(S.jsxs)("ul",{children:[Object(S.jsx)("li",{children:Object(S.jsx)(l.b,{to:"/RequestsViewAll/all",className:"nounderline",children:"Requests"})}),Object(S.jsx)("li",{children:Object(S.jsx)(l.b,{to:"/EmployeesView",className:"nounderline",children:"Employees"})}),Object(S.jsx)("li",{children:Object(S.jsx)(l.b,{to:"/EmployeeCreate",className:"nounderline",children:"Create Employee"})})]}),Object(S.jsx)(D,{user:e.user})]})}function E(e){var t=Object(o.f)();Object(c.useEffect)((function(){setTimeout((function(){var n=e&&e.path;void 0!==n&&t.push(n),e&&e.logoutCb&&N.logout()}),2e3)}),[e,t]);var n=e&&e.title;return Object(S.jsxs)("div",{className:"Spinner",children:[Object(S.jsx)("h2",{children:n}),Object(S.jsxs)("div",{className:"lds-spinner",children:[Object(S.jsx)("div",{}),Object(S.jsx)("div",{}),Object(S.jsx)("div",{}),Object(S.jsx)("div",{}),Object(S.jsx)("div",{}),Object(S.jsx)("div",{}),Object(S.jsx)("div",{}),Object(S.jsx)("div",{}),Object(S.jsx)("div",{}),Object(S.jsx)("div",{}),Object(S.jsx)("div",{}),Object(S.jsx)("div",{})]})]})}n(34);function C(e){return Object(S.jsx)(c.Fragment,{children:Object(S.jsxs)("tr",{children:[Object(S.jsx)("td",{children:e.date}),Object(S.jsx)("td",{children:e.expense}),Object(S.jsx)("td",{className:"enMoney",children:e.amount}),Object(S.jsx)("td",{children:Object(S.jsx)("span",{onClick:e.handleSubmit,id:e.id,children:"x"})})]},e.id)})}n(75),n(76);function k(e){return Object(S.jsx)(c.Fragment,{children:function(){var t=new Date(e.date);try{return Object(S.jsxs)("span",{className:"entry-date",children:[Object(S.jsx)("span",{className:"month",children:t.toLocaleString("default",{month:"short"})}),Object(S.jsx)("span",{className:"day",children:t.getDay()}),Object(S.jsx)("span",{className:"year",children:t.getFullYear()})]})}catch(n){console.error(n)}}()})}function I(){var e=Object(o.h)().id,t=Object(c.useState)(),n=Object(i.a)(t,2),s=n[0],a=n[1];Object(c.useEffect)((function(){N.getDao(a,{req:e})}),[e]);var r=function(e){return"pending"===e.status?Object(S.jsx)("div",{children:Object(S.jsxs)("form",{className:"reviewForm",children:[Object(S.jsx)("button",{className:"button",children:"Approve"}),Object(S.jsx)("button",{className:"button",children:"Deny"})]})}):Object(S.jsx)("div",{className:"requestReviewer",children:Object(S.jsxs)("h4",{children:["Reviewer: ",e.reviewerId]})})};return Object(S.jsx)("div",{className:"RequestReview",children:0===Object.keys(void 0===s||s).length?Object(S.jsx)(E,{}):function(){var e=[];try{var t=s[0],n=t.expenses;n.forEach((function(t,n){var c=new Date(t.date).toLocaleDateString("en-US",{timeZone:"UTC"}),s=(.01*parseInt(t.amount)).toFixed(2);e.push(Object(S.jsx)(C,{id:n+1,date:c,expense:t.expense,amount:s}))}));var a=(.01*Number(t.total)).toFixed(2);return Object(S.jsxs)(c.Fragment,{children:[Object(S.jsxs)("table",{children:[Object(S.jsx)("thead",{children:Object(S.jsxs)("tr",{children:[Object(S.jsx)("th",{children:"Requester"}),Object(S.jsx)("th",{children:"Status"}),Object(S.jsx)("th",{children:"Dates"})]})}),Object(S.jsx)("tbody",{children:Object(S.jsxs)("tr",{children:[Object(S.jsx)("td",{children:t.requesterId}),Object(S.jsx)("td",{children:t.status}),Object(S.jsxs)("td",{className:"dateRange",children:[Object(S.jsx)(k,{date:t.startDate}),Object(S.jsx)(k,{date:t.endDate})]})]},0)})]}),Object(S.jsx)("hr",{}),Object(S.jsxs)("table",{children:[Object(S.jsx)("thead",{children:Object(S.jsxs)("tr",{children:[Object(S.jsx)("th",{children:"Date"}),Object(S.jsx)("th",{children:"Expense"}),Object(S.jsx)("th",{children:"Amount"})]})}),Object(S.jsxs)("tbody",{children:[e,Object(S.jsxs)("tr",{children:[Object(S.jsx)("td",{}),Object(S.jsx)("td",{}),Object(S.jsx)("td",{className:"enMoney",children:a})]},n.length+1)]})]}),Object(S.jsx)("hr",{}),r(t)]})}catch(i){console.log(i)}return Object(S.jsx)("div",{})}()})}n(35);function F(e){var t=Object(o.f)(),n=Object(c.useRef)(),s=function(e){var n=e.target,c=n.innerHTML;"req"===n.id&&t.push({pathname:"/RequestReview/"+c}),"emp"===n.id&&t.push({pathname:"/RequestViewByEmployee/"+c})};return Object(S.jsx)(c.Fragment,{children:void 0!==e&&e.isOwner?Object(S.jsx)(c.Fragment,{children:Object(S.jsxs)("tr",{onClick:s,children:[Object(S.jsx)("td",{ref:n,id:"req",className:"linkRef",children:e.data.hexId}),Object(S.jsx)("td",{children:e.data.status}),Object(S.jsx)("td",{children:Object(S.jsx)("p",{className:"enMoney",children:(e.data.total/100).toFixed(2)})}),Object(S.jsxs)("td",{children:["[",e.data.startDate,"]-[",e.data.endDate,"]"]})]},e.id)}):Object(S.jsx)(c.Fragment,{children:Object(S.jsxs)("tr",{onClick:s,children:[Object(S.jsx)("td",{ref:n,id:"req",className:"linkRef",children:e.data.hexId}),Object(S.jsx)("td",{children:e.data.status}),Object(S.jsx)("td",{children:Object(S.jsx)("p",{className:"enMoney",children:(e.data.total/100).toFixed(2)})}),Object(S.jsxs)("td",{className:"dateRange",children:[Object(S.jsx)(k,{date:e.data.startDate}),Object(S.jsx)(k,{date:e.data.endDate})]}),Object(S.jsx)("td",{ref:n,id:"emp",className:"linkRef",children:e.data.requesterId})]},e.id)})})}function V(e){var t=Object(c.useState)(void 0!==e.empId&&e.empId===N.getCurrentUserId()),n=Object(i.a)(t,1)[0],s=function(){if(!n)return Object(S.jsxs)("h3",{children:["requester: ",e.empId]})},a=function(){if(!n)return Object(S.jsx)("th",{children:"Requester"})},r=function(e){console.log(e)};return Object(S.jsx)("div",{className:"RequestsViewAllList",children:function(){var t=[];return e.data.forEach((function(e,c){t.push(Object(S.jsx)(F,{data:e,callback:r,isOwner:n},c+1))})),Object(S.jsxs)(c.Fragment,{children:[s(),Object(S.jsxs)("table",{children:[Object(S.jsx)("thead",{children:Object(S.jsxs)("tr",{children:[Object(S.jsx)("th",{children:"Id"}),Object(S.jsx)("th",{children:"Status"}),Object(S.jsx)("th",{children:"Total"}),Object(S.jsx)("th",{children:"Dates"}),a()]},0)}),Object(S.jsx)("tbody",{children:t})]})]})}()})}var P=function(e,t,n,c){var s=("number"===typeof e.target?e.target.toString():e.target).value,a=t;if(s.length>0&&s.length<3)n(a);else{var r=new RegExp("^\\b"+s);n(a=t.filter((function(e){var t=function(e,t){return!0===e?function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t;return{id:e.id,firstName:e.firstName,lastName:e.lastName,email:e.email,phone:e.phone,address:e.address}}(t):function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t;return{id:e.id,status:e.status,requester:e.requester}}(t)}(c,e);return Object.values(t).filter((function(e){return r.test(e)})).length>0})))}};function L(){var e=Object(o.h)().id,t=Object(o.h)().empFlag,n=Object(c.useState)([]),s=Object(i.a)(n,2),a=s[0],r=s[1],l=Object(c.useState)([]),j=Object(i.a)(l,2),d=j[0],u=j[1];Object(c.useEffect)((function(){void 0!==t?N.getDao(b,{empReq:e}):N.getDao(b,{req:e})}),[e,t]);var b=function(e){r(e),u(e)};return Object(S.jsx)("div",{className:"RequestsViewAll",children:0===Object.keys(void 0===a||a).length?Object(S.jsx)(E,{}):Object(S.jsxs)(c.Fragment,{children:[Object(S.jsx)("input",{type:"text",placeholder:"Filter...",onChange:function(e){return P(e,a,u,!1)}}),Object(S.jsx)(V,{data:d,empId:t?e:void 0})]})})}n(77);function T(e){var t=Object(o.f)(),n=Object(c.useRef)(),s=Object(c.useState)(!0);return Object(S.jsx)(c.Fragment,{children:s&&Object(S.jsxs)("tr",{onClick:function(){var e=n.current.innerHTML;t.push({pathname:"/RequestsViewAll/"+e})},children:[Object(S.jsx)("td",{ref:n,className:"linkRef",children:e.data.hexId}),Object(S.jsx)("td",{children:e.data.firstName}),Object(S.jsx)("td",{children:e.data.lastName}),Object(S.jsx)("td",{children:e.data.email}),Object(S.jsx)("td",{children:function(e){var t=(""+e).replace(/\D/g,"");console.log(t);var n=t.match(/^(\d{3})(\d{3})(\d{4})$/);return n?"("+n[1]+") "+n[2]+"-"+n[3]:e}(e.data.phoneNumber)}),Object(S.jsx)("td",{children:e.data.address}),Object(S.jsx)("td",{children:e.data.type})]},e.id)})}function M(e){return Object(S.jsx)("div",{className:"EmployeesViewList",children:function(){var t,n=[];for(t=0;t<e.data.length;t++){var c=e.data[t];n.push(Object(S.jsx)(T,{data:c},t+1))}return Object(S.jsxs)("table",{children:[Object(S.jsx)("thead",{children:Object(S.jsxs)("tr",{children:[Object(S.jsx)("th",{children:"Id"}),Object(S.jsx)("th",{children:"First Name"}),Object(S.jsx)("th",{children:"Last Name"}),Object(S.jsx)("th",{children:"Email"}),Object(S.jsx)("th",{children:"Phone"}),Object(S.jsx)("th",{children:"Address"}),Object(S.jsx)("th",{children:"Type"})]},0)}),Object(S.jsx)("tbody",{children:n})]})}()})}function U(e){var t=Object(c.useState)([]),n=Object(i.a)(t,2),s=n[0],a=n[1],r=Object(c.useState)([]),l=Object(i.a)(r,2),o=l[0],j=l[1];Object(c.useEffect)((function(){N.getDao(d,{emp:"all"})}),[]);var d=function(e){a(e),j(e)};return Object(S.jsx)("div",{className:"EmployeesView",children:0===Object.keys(void 0===s||s).length?Object(S.jsx)(E,{}):Object(S.jsxs)(c.Fragment,{children:[Object(S.jsx)("input",{type:"text",placeholder:"Filter...",onChange:function(e){return P(e,s,j,!0)}}),Object(S.jsx)(M,{data:o})]})})}var A=n(6),B=n(18);n(78);function J(e){var t=Object(c.useRef)(null),n=function(n){n.preventDefault();var c=Object(B.a)(t.current).filter((function(e){return"text"===e.type&&e.value.length>0})),s={};Object.values(c).forEach((function(e){s[e.id]=e.value}));try{e.handleSubmit(s)}catch(a){console.log(a)}};return Object(S.jsx)("div",{className:"EmployeeCreateForm",children:function(){if(0===Object.keys(void 0===e.data||null===e.data||e.data).length)return Object(S.jsx)(E,{});var c=void 0===e.title?"ModelView":e.title;return Object(S.jsx)("form",{ref:t,onSubmit:n,autocomplete:"off",children:Object(S.jsxs)("fieldset",{children:[Object(S.jsx)("legend",{children:c}),Object.entries(e.data).map((function(e,t){var n=Object(i.a)(e,2),c=n[0],s=(n[1],c.charAt(0).toUpperCase()+c.replace(/([A-Z])/g," $1").slice(1)),a="text",r=".*";switch(c){case"email":a="email";break;case"phoneNumber":a="tel",r="[0-9]{10}"}return Object(S.jsx)("span",{children:Object(S.jsx)("input",{type:a,id:c,name:c,defaultValue:"",placeholder:s,pattern:r,required:!0})},t)})),Object(S.jsx)("button",{type:"submit",children:"Submit"})]})})}()})}function H(e){var t=Object(o.f)(),n=Object(c.useState)(),s=Object(i.a)(n,2),a=s[0],r=s[1];function l(e){console.log(e),t.push({pathname:"/Success",state:{detail:"Created Employee"}})}return Object(c.useEffect)((function(){var e,t=N.getNewEmployee();delete(e=t).password,delete e.requestIds,delete e.id,delete e.type,r(t)}),[]),Object(S.jsx)("div",{className:"EmployeeCreate",children:Object(S.jsx)(J,{data:a,handleSubmit:function(e){e.phoneNumber=parseInt(e.phoneNumber),e=Object(A.a)(Object(A.a)(Object(A.a)({},e),{command:"create"}),{cmdType:"employee"}),N.postDao(l,e)},title:"Create Employee",blank:!0})})}n(79);function Z(e){var t=Object(c.useRef)(null),n=function(n){n.preventDefault();var c=Object(B.a)(t.current).filter((function(e){return"text"===e.type&&e.value.length>0})),s={};Object.values(c).forEach((function(e){s[e.id]=e.value}));try{e.handleSubmit(s)}catch(a){console.log(a)}};return Object(S.jsx)("div",{className:"ModelView",children:function(){if(0===Object.keys(void 0===e.data||null===e.data||e.data).length)return Object(S.jsx)(E,{});var c=void 0===e.title?"ModelView":e.title;return Object(S.jsx)("form",{ref:t,autocomplete:"off",onSubmit:n,children:Object(S.jsxs)("fieldset",{children:[Object(S.jsx)("legend",{children:c}),Object.entries(e.data).map((function(t,n){var c=Object(i.a)(t,2),s=c[0],a=c[1],r=s.charAt(0).toUpperCase()+s.replace(/([A-Z])/g," $1").slice(1),l=a,o=!0;switch(s){case"firstName":case"lastName":case"address":case"phoneNumber":o=!1}return e&&e.blank?Object(S.jsxs)("span",{children:[Object(S.jsx)("label",{htmlFor:s,children:r}),Object(S.jsx)("input",{type:"text",id:s,name:s,disabled:o})]},n):Object(S.jsxs)("span",{children:[Object(S.jsx)("label",{htmlFor:s,children:r}),Object(S.jsx)("input",{type:"text",id:s,name:s,defaultValue:l,disabled:o})]},n)})),Object(S.jsx)("button",{type:"submit",children:"Submit"})]})})}()})}n(80);function $(){var e=Object(o.f)(),t=Object(c.useState)(),n=Object(i.a)(t,2),s=n[0],a=n[1];function r(e){delete e.requestIds,delete e.password,delete e.id,delete e.hexId,a(e)}function l(t){console.log(t),e.push({pathname:"/ProfileViewUpdateSuccess/Success"})}return Object(c.useEffect)((function(){var e=N.getIsManager(),t=N.getCurrentUserId();e?N.getDao(r,{mgr:t}):N.getDao(r,{emp:t})}),[]),Object(S.jsx)("div",{className:"ProfileView",children:Object(S.jsx)(Z,{data:s,handleSubmit:function(e){void 0===e.requestIds&&(e.requestIds=[]),void 0===e.id&&(e.id={}),e.phoneNumber=parseInt(e.phoneNumber),e=Object(A.a)(Object(A.a)(Object(A.a)({},e),{command:"update"}),{cmdType:"employee"}),N.postDao(l,e)},title:"Profile"})})}n(81);function z(){var e=Object(c.useRef)(null),t=Object(c.useRef)(null),n=Object(c.useRef)(null),s=Object(o.f)(),a=function(e){console.log(e),s.push({pathname:"/Success",state:{detail:"Updated Password"}})};return Object(S.jsx)("div",{className:"PasswordReset",children:Object(S.jsxs)("form",{ref:n,onSubmit:function(c){return function(c){var s,r;c.preventDefault();var i,l=null===t||void 0===t||null===(s=t.current)||void 0===s?void 0:s.value;(null===e||void 0===e||null===(r=e.current)||void 0===r?void 0:r.value)===l||(alert("passwords do not match"),null===n||void 0===n||null===(i=n.current)||void 0===i||i.reset());var o={command:"updatePass"};o.cmdType=N.getIsManager()?"manager":"employee",o.password=l,o.id=N.getCurrentUserId(),N.postDao(a,o)}(c)},children:[Object(S.jsxs)("div",{children:[Object(S.jsxs)("label",{htmlFor:"password",children:["New Password",Object(S.jsx)("br",{}),Object(S.jsx)("small",{children:"(8 characters minimum)"})]}),Object(S.jsx)("input",{ref:e,type:"password",id:"password",minLength:8,autoComplete:"new-password",required:!0})]}),Object(S.jsxs)("div",{children:[Object(S.jsx)("label",{htmlFor:"passwordconfirm",children:"Confirm Password"}),Object(S.jsx)("input",{ref:t,type:"password",id:"passwordconfirm",minLength:8,autoComplete:"new-password",required:!0})]}),Object(S.jsx)("div",{children:Object(S.jsx)("button",{type:"submit",children:"Submit"})})]})})}function G(e){var t=Object(c.useRef)(),n=Object(c.useRef)(),s=Object(c.useRef)(),a=Object(c.useRef)(),r=Object(c.useState)({}),l=Object(i.a)(r,2),o=l[0],j=l[1],d=Object(c.useState)(0),u=Object(i.a)(d,2),b=u[0],h=u[1],O=Object(c.useState)(null),m=Object(i.a)(O,2),x=m[0],p=m[1],f=Object(c.useState)(null),v=Object(i.a)(f,2),g=v[0],y=v[1],w=Object(c.useState)(0),N=Object(i.a)(w,2),R=N[0],D=N[1];Object(c.useEffect)((function(){if(e&&e.data&&e.data.length>0){var t=e.data[0].expenses,n=[];t.forEach((function(e){console.log(e);var t={expense:e.expense,amount:parseInt(e.amount),date:e.date};n.push(t)})),j({listItems:n}),h(e.data[0].total),D(t.length)}}),[e,o]);var q=function(){for(var e=[],t=[],n=o.listItems;void 0!==n;)e.push({date:n.date,expense:n.expense,amount:n.amount}),n=n.listItems;for(;e.length>0;)t.push(e.pop());return t},E=function(e){};return Object(S.jsx)("div",{className:"RequestCreateForm",children:Object(S.jsxs)("form",{ref:a,onSubmit:function(t){t.preventDefault();var n=q();if(void 0!==n&&0!==n.length){var c={expenses:n,total:b,startDate:x,endDate:g};e.handleSubmit(c)}else alert("Please fill out expenses")},autocomplete:"off",children:[Object(S.jsxs)("fieldset",{children:[Object(S.jsxs)("ul",{children:[Object(S.jsx)("li",{children:Object(S.jsx)("input",{ref:t,type:"date",id:"dateInput",defaultValue:(new Date).toISOString().split("T")[0]})}),Object(S.jsx)("li",{children:Object(S.jsx)("input",{ref:n,type:"text",id:"textInput",placeholder:"Expense...",required:!0})}),Object(S.jsx)("li",{children:Object(S.jsx)("input",{ref:s,type:"number",id:"amountInput",min:"0.01",step:"0.01",placeholder:"Cost...",required:!0})})]}),Object(S.jsx)("button",{className:"btnAdd",onClick:function(e){e.preventDefault(),function(e){!1!==a.current.checkValidity()?0!==e.expense.length?new Date(e.date).getTime()>(new Date).getTime()?alert("Please select a valid date."):((null===x||new Date(e.date).getTime()<new Date(x).getTime())&&p(e.date),(null===g||new Date(e.date).getTime()>new Date(g).getTime())&&y(e.date),isNaN(e.amount)?alert("Please enter an amount."):(e.amount=100*parseFloat(e.amount).toFixed(2),console.log(e.amount),e.amount<1?alert("Please enter an amount."):(h(b+e.amount),j({listItems:Object(A.a)(Object(A.a)({},o),e)}),D(R+1),console.log(o)))):alert("Please enter an expense."):a.current.reportValidity()}({expense:n.current.value,amount:s.current.value,date:t.current.value||t.current.defaultValue})},children:"Add"})]}),function(){var e=q(),t=[];e.forEach((function(e,n){var c=new Date(e.date).toLocaleDateString("en-US",{timeZone:"UTC"}),s=.01*e.amount;t.push(Object(S.jsx)(C,{id:n+1,date:c,expense:e.expense,amount:s,handleSubmit:E}))}));var n=(.01*b).toFixed(2),c=e.length+2;return Object(S.jsxs)("table",{children:[Object(S.jsx)("thead",{children:Object(S.jsxs)("tr",{children:[Object(S.jsx)("th",{children:"Date"}),Object(S.jsx)("th",{children:"Expense"}),Object(S.jsx)("th",{children:"Amount"})]},0)}),Object(S.jsxs)("tbody",{children:[t,Object(S.jsxs)("tr",{children:[Object(S.jsx)("td",{}),Object(S.jsx)("td",{}),Object(S.jsx)("td",{className:"enMoney",children:n})]},c)]})]})}(),Object(S.jsx)("button",{type:"submit",className:"btnSubmit",children:"Submit"})]})})}function Y(e){var t=Object(o.f)(),n=Object(c.useState)(),s=Object(i.a)(n,2),a=s[0],r=s[1];function l(e){delete e.requester,delete e.status,delete e.startDate,delete e.endDate,delete e.id,delete e.total}function j(e){console.log(e),t.push({pathname:"/Success",state:{detail:"Request"}})}return Object(c.useEffect)((function(){N.getObject(r,N.getNewRequest,l)}),[]),Object(S.jsx)("div",{className:"RequestCreate",children:Object(S.jsx)(G,{data:a,handleSubmit:function(e){console.log(e),e=Object(A.a)(Object(A.a)(Object(A.a)({},e),{command:"create"}),{cmdType:"request"}),console.log(e),N.postDao(j,e)},title:"Create Request"})})}function K(){var e=Object(o.g)();return Object(S.jsx)("div",{className:"Success",children:Object(S.jsxs)("h1",{children:["Successully ",e.state.detail]})})}function Q(){var e=Object(o.h)().status;return Object(S.jsx)("div",{className:"ProfileViewUpdateSuccess",children:Object(S.jsxs)("h1",{children:["Successully Updated ",e]})})}function W(e){return Object(S.jsx)("div",{className:"Logout",children:Object(S.jsx)(E,{title:"Logging Out...",path:"/",logoutCb:e.logoutCb})})}function X(e){var t=Object(o.h)().id,n=Object(c.useState)(),s=Object(i.a)(n,2),a=s[0],r=s[1];return Object(c.useEffect)((function(){N.getDao(r,{empReq:t})}),[t]),Object(S.jsx)("div",{className:"RequestViewByEmployee",children:0===Object.keys(void 0===a||a).length?Object(S.jsx)("div",{children:"No Requests"}):Object(S.jsx)(V,{data:a,empId:t,loggedId:e.id})})}function _(){return Object(S.jsx)("div",{className:"NoRequests",children:Object(S.jsx)("h2",{children:"No Requests"})})}n(36);function ee(e){return Object(S.jsxs)(c.Fragment,{children:[Object(S.jsx)(q,{user:e.user}),Object(S.jsx)("div",{className:"ManagerHome",children:Object(S.jsxs)(o.c,{children:[Object(S.jsx)(o.a,{path:"/RequestViewByEmployee/:id",component:function(){return Object(S.jsx)(X,{id:e.user})}}),Object(S.jsx)(o.a,{path:"/RequestsViewAll/:id",component:L}),Object(S.jsx)(o.a,{path:"/RequestReview/:id",component:I}),Object(S.jsx)(o.a,{path:"/EmployeesView",component:U}),Object(S.jsx)(o.a,{path:"/EmployeeCreate",component:H}),Object(S.jsx)(o.a,{path:"/ProfileView",component:function(){return Object(S.jsx)($,{})}}),Object(S.jsx)(o.a,{path:"/PasswordReset",component:z}),Object(S.jsx)(o.a,{path:"/RequestCreate",component:function(){return Object(S.jsx)(Y,{})}}),Object(S.jsx)(o.a,{path:"/Success",component:K}),Object(S.jsx)(o.a,{path:"/EmployeeViewUpdateSuccess/:status",component:Q}),Object(S.jsx)(o.a,{path:"/Logout",component:function(){return Object(S.jsx)(W,{logoutCb:e.logoutCb})}}),Object(S.jsx)(o.a,{path:"/NoRequests",component:_})]})})]})}function te(e){return Object(S.jsxs)(c.Fragment,{children:[Object(S.jsx)(D,{user:e.user}),Object(S.jsx)("div",{className:"EmployeeHome",children:Object(S.jsxs)(o.c,{children:[Object(S.jsx)(o.a,{path:"/RequestViewByEmployee/:id",component:function(){return Object(S.jsx)(X,{id:e.user})}}),Object(S.jsx)(o.a,{path:"/RequestsViewAll/:id",component:L}),Object(S.jsx)(o.a,{path:"/ProfileView",component:function(){return Object(S.jsx)($,{})}}),Object(S.jsx)(o.a,{path:"/PasswordReset",component:z}),Object(S.jsx)(o.a,{path:"/RequestCreate",component:Y}),Object(S.jsx)(o.a,{path:"/Success",component:K}),Object(S.jsx)(o.a,{path:"/EmployeeViewUpdateSuccess/:status",component:Q}),Object(S.jsx)(o.a,{path:"/Logout",component:function(){return Object(S.jsx)(W,{logoutCb:e.logoutCb})}}),Object(S.jsx)(o.a,{path:"/NoRequests",component:_})]})})]})}n(82);var ne=function(){var e=Object(c.useState)(null),t=Object(i.a)(e,2),n=t[0],s=t[1];!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){},t=Object(c.useRef)(!1);t||(e(),t.current=!0)}((function(){console.log("once before render")})),N.setLogOutCallback(s);return Object(S.jsx)("div",{className:"App",children:Object(S.jsx)(l.a,{children:Object(S.jsx)(o.a,{path:"/",children:null===n?Object(S.jsx)(R,{callback:s}):"Manager"===n.type?Object(S.jsx)(ee,{user:n.id,logoutCb:s}):Object(S.jsx)(te,{user:n.id,logoutCb:s})})})})},ce=function(e){e&&e instanceof Function&&n.e(3).then(n.bind(null,84)).then((function(t){var n=t.getCLS,c=t.getFID,s=t.getFCP,a=t.getLCP,r=t.getTTFB;n(e),c(e),s(e),a(e),r(e)}))};r.a.render(Object(S.jsx)(s.a.StrictMode,{children:Object(S.jsx)(ne,{})}),document.getElementById("root")),ce()}},[[83,1,2]]]);
  //# sourceMappingURL=main.c897317f.chunk.js.map