1(this["webpackJsonplisfarma-admin"]=this["webpackJsonplisfarma-admin"]||[]).push([[68],{146:function(e,a,t){"use strict";t.d(a,"a",function(){return d});var s=t(0),r=t(351),c=t(478),n=t(177),l=t(129),i=t(165),o=t(4);class d extends s.Component{static parsePhoneValue(e){if(!e)return{country:"MX",localNumber:""};if(e.startsWith("+")){const a=[...i.a].sort((e,a)=>{var t,s;return((null===(t=a.cc)||void 0===t?void 0:t.length)||0)-((null===(s=e.cc)||void 0===s?void 0:s.length)||0)});for(const t of a)if(t.cc&&e.startsWith("+".concat(t.cc)))return{country:t.code,localNumber:e.substring(1+t.cc.length)}}return{country:"MX",localNumber:e}}constructor(e){if(super(e),this.state={country:"MX",phone:""},e.value){const a=d.parsePhoneValue(e.value);this.state.country=a.country,this.state.phone=e.value}else this.state.phone="+".concat(l.a.getInstance().getCountryCode(this.state.country))}componentDidUpdate(e,a,t){if(e.value!==this.props.value)if(this.props.value){const e=d.parsePhoneValue(this.props.value);this.setState({country:e.country,phone:this.props.value})}else this.setState({phone:"+".concat(l.a.getInstance().getCountryCode(this.state.country))})}render(){return Object(o.jsxs)("div",{className:"dv-input-phone",children:[Object(o.jsx)(r.a,{className:"pl-12",disabled:this.props.disabled,size:this.props.size||"md",value:this.state.phone,onChange:e=>this.onChangePhone(e.target.value)}),Object(o.jsxs)(c.a,{className:"dropdown-country",onSelect:(e,a)=>this.onSelect(e),children:[Object(o.jsx)(c.a.Toggle,{disabled:this.props.disabled,variant:"light",size:"sm",className:"dropdown-toggle",children:Object(o.jsx)(n.a,{countryCode:this.state.country,className:"mr-1"})}),Object(o.jsx)(c.a.Menu,{className:"max-h-80 overflow-y-scroll",children:i.a.map((e,a)=>Object(o.jsxs)(c.a.Item,{eventKey:e.code,active:this.state.country===e.code,children:[Object(o.jsx)(n.a,{countryCode:e.code,className:"mr-2"}),e.name]},e.code))})]})]})}onSelect(e){const a=l.a.getInstance().getCountryCode(e),t=d.parsePhoneValue(this.state.phone).localNumber,s="+".concat(a).concat(t);this.setState({country:e,phone:s}),this.props.onChange&&this.props.onChange(s)}onChangePhone(e){const a=e.replace(/[^\d+]/g,"");this.setState({phone:a}),this.props.onChange&&this.props.onChange(a)}}d.defaultProps={required:!0,disabled:!1}},177:function(e,a,t){"use strict";var s=t(0),r=t(30),c=t.n(r),n=["cdnSuffix","cdnUrl","countryCode","style","svg"];function l(){return l=Object.assign||function(e){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},l.apply(this,arguments)}function i(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);a&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),t.push.apply(t,s)}return t}function o(e){for(var a=1;a<arguments.length;a++){var t=null!=arguments[a]?arguments[a]:{};a%2?i(Object(t),!0).forEach(function(a){d(e,a,t[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))})}return e}function d(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function h(e,a){if(null==e)return{};var t,s,r=function(e,a){if(null==e)return{};var t,s,r={},c=Object.keys(e);for(s=0;s<c.length;s++)t=c[s],a.indexOf(t)>=0||(r[t]=e[t]);return r}(e,a);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(s=0;s<c.length;s++)t=c[s],a.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}function j(e){e.cdnSuffix;var a=e.cdnUrl,t=e.countryCode,r=e.style,c=e.svg,i=h(e,n);if("string"!==typeof t)return null;if(c){var d="".concat(a).concat(t.toLowerCase(),".").concat("svg");return s.createElement("img",l({},i,{src:d,style:o({display:"inline-block",width:"1em",height:"1em",verticalAlign:"middle"},r)}))}var j=t.toUpperCase().replace(/./g,function(e){return String.fromCodePoint(e.charCodeAt(0)+127397)});return s.createElement("span",l({role:"img"},i,{style:o({display:"inline-block",fontSize:"1em",lineHeight:"1em",verticalAlign:"middle"},r)}),j)}j.propTypes={cdnUrl:c.a.string,countryCode:c.a.string.isRequired,style:c.a.object,svg:c.a.bool},j.defaultProps={cdnUrl:"https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.4.3/flags/4x3/",svg:!1},a.a=j},203:function(e,a,t){"use strict";t.d(a,"a",function(){return n});var s=t(0),r=t(421),c=t(4);class n extends s.Component{constructor(e){super(e),this.state={file:null},this.handleChange=this.handleChange.bind(this)}render(){var e;const a=this.props,t=a.defaultImage,s=a.className,n=a.classImageContainer,l=a.withBorder,i=a.showSeeFile,o=a.label,d=a.image,h=this.state.file;return Object(c.jsxs)(c.Fragment,{children:[Object(c.jsx)("input",{className:"hidden",type:"file",accept:"image/*",onChange:this.handleChange,ref:e=>this.fileInput=e}),Object(c.jsxs)("div",{className:"dv-file-input flex flex-col w-full items-center ".concat(null!==s&&void 0!==s?s:""),ref:e=>this.refContainer=e,style:n?{}:{height:null===(e=this.refContainer)||void 0===e?void 0:e.offsetHeight},children:[Object(c.jsx)("div",{className:"dv-image-uploader cursor-pointer ".concat(null!==n&&void 0!==n?n:"flex-1"," ").concat(l||h||d?"border border-gray-300":""),onClick:()=>{var e;return null===(e=this.fileInput)||void 0===e?void 0:e.click()},children:h?Object(c.jsx)(r.a,{src:h,className:"img-file",alt:""}):d?Object(c.jsx)(r.a,{src:d,className:"img-file",alt:""}):Object(c.jsx)("img",{src:null!==t&&void 0!==t?t:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEUAAAA6CAYAAADm+ZQ9AAAEn0lEQVRoge2bSW4TQRiFnzvO5ExOlCyQOAAHQIIrsOAA3APuwB1gxYYlB4BbsOEUmefECfpK/aKOBxTb9Xfw8KRWO3a7XPXq/UP9VWnc39+rxGtJPyW1NSaOjo50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5WEAE5QNM0Cvt6DJleD2FQeBXkD6k8Jr3nlJitMJMiDfpohFOipf+3CHG+9SuvHXvQnr3jmftWK2QUUoPo6CWciR+ZWdnJxFAPQS1oABe8153jZawa8fMZ5Qd6lCIUWuZnJlGHUQjbzxhIlxVOA+BCBRV935U7VscDBZzQg2YSfUcjDNVnuGqey/KaNqeo08cdoPB/087kvZdaRHrGoVnbRaB+TJ2T1RBOo4z482IM6//O1wM505eBReF47/KdHyWiPH5FJw+/suJ5sPxLnbhfHjFXn9aTzIxZEwGhfgfQNkt6CHFrJFc2ekkKT1TBIiCC1/2n/1Ob/UcLialRjHT7Hg94V6bdZchBp64hhCfG5k2OB/qmxJI+gtY2uDt9X2q1AAAAABJRU5ErkJggg==",className:"img-thumbnail w-20",alt:""})}),i&&(h||d)?Object(c.jsx)("a",{href:this.fileLink()?this.fileLink():void 0,target:"_blank",rel:"noreferrer",className:"mt-1",variant:"link",size:"sm",children:"See File"}):null,o?Object(c.jsx)("span",{className:"mt-1",children:o}):null]})]})}fileLink(){const e=this.props.image,a=this.state.file;return a||e}handleChange(e){!e.target.files||e.target.files.length<=0||(this.setState({file:URL.createObjectURL(e.target.files[0])}),this.props.onSelectFile&&this.props.onSelectFile(e.target.files[0]))}}n.defaultProps={showSeeFile:!1,withBorder:!0}},275:function(e,a,t){"use strict";var s=t(125),r=t(0),c=t.n(r),n=t(333),l=t(350),i=t(158),o=t(2),d=t(4);const h=c.a.forwardRef((e,a)=>{let t=e.onNew;const c=Object(o.g)(),h=Object(i.a)().t,j=Object(r.useState)(!1),b=Object(s.a)(j,2),p=b[0],u=b[1];return Object(r.useImperativeHandle)(a,()=>({show:()=>{u(!0)}})),Object(d.jsx)(n.a,{centered:!0,className:"modal-confirm-create",show:p,onHide:()=>u(!1),children:Object(d.jsxs)(n.a.Body,{className:"flex flex-col px-8 py-16",children:[Object(d.jsxs)("div",{className:"flex flex-col items-center dv-body",children:[Object(d.jsx)("span",{children:h("success-saved")}),Object(d.jsx)("span",{className:"mt-6",children:h("create-new-user-or-return")})]}),Object(d.jsxs)("div",{className:"grid grid-cols-2 mt-10 gap-x-12",children:[Object(d.jsx)(l.a,{variant:"secondary",size:"sm",onClick:()=>{c.goBack(),u(!1)},children:h("return")}),Object(d.jsx)(l.a,{variant:"danger",size:"sm",onClick:()=>{t(),u(!1)},children:h("create-new-user")})]})]})})});a.a=h},441:function(e,a,t){"use strict";t.r(a);var s=t(125),r=t(0),c=t.n(r),n=t(479),l=t(422),i=t(350),o=t(203),d=t(42),h=t(129),j=t(146),b=t(158),p=t(54),u=t(40),m=t(32),O=t(275),x=t(2),g=t(29),f=t(1),v=t(4);a.default=()=>{const e=Object(b.a)().t,a=Object(m.c)(),t=Object(r.useRef)(),C=Object(x.g)(),y=Object(r.useState)(""),N=Object(s.a)(y,2),w=N[0],S=N[1],A=Object(r.useState)(null),I=Object(s.a)(A,2),E=I[0],P=I[1],L={email:"",type:"admin",confirmEmail:"",profilePicture:"",firstName:"",paternalName:"",maternalName:"",birthday:"",area:"",employeeNumber:"",address:"",zipCode:"",town:"",state:"",country:"",taxId:"",personalId:"",cellPhone:"",phone:"",password:""},k=Object(r.useState)(L),U=Object(s.a)(k,2),q=U[0],B=U[1],G=e=>{const a=e.target,t=a.dataset.param;B(e=>({...e,[t]:a.value}))};return Object(v.jsxs)(c.a.Fragment,{children:[Object(v.jsxs)("div",{className:"l-container page-edit-user",children:[Object(v.jsx)("div",{className:"l-header",children:Object(v.jsx)("h2",{className:"sp-title m-0",children:e("lisfarma-users")})}),Object(v.jsxs)("div",{className:"dv-content",children:[Object(v.jsx)("div",{className:"dv-header",children:Object(v.jsx)("span",{className:"sp-label",children:e("edit-user")})}),Object(v.jsxs)(n.a,{className:"dv-form mt-3 p-4",onSubmit:async e=>{e.preventDefault(),a(Object(p.b)(!0));try{var s;const e={...q};delete e.confirmEmail,await u.a.createUsersRaw([e]),null===(s=t.current)||void 0===s||s.show()}catch(e){S(e.message)}a(Object(p.b)(!1))},children:[w?Object(v.jsx)(l.a,{variant:"danger",className:"alert-error mb-4 text-base",dismissible:!0,onClose:()=>S(""),children:Object(v.jsx)("div",{className:"text-xs",children:w})}):null,Object(v.jsxs)("div",{className:"dv-section",children:[Object(v.jsx)("h6",{className:"h-title",children:e("account-detail")}),Object(v.jsxs)("div",{className:"grid grid-cols-12 gap-x-6",children:[Object(v.jsxs)(n.a.Group,{className:"col-span-6",children:[Object(v.jsx)(n.a.Label,{className:"mb-1",children:e("email")}),Object(v.jsx)(n.a.Control,{type:"email",placeholder:e("email"),value:q.email,"data-param":"email",onChange:G,required:!0})]}),Object(v.jsxs)(n.a.Group,{className:"col-span-6",children:[Object(v.jsx)(n.a.Label,{className:"mb-1",children:e("email-confirm")}),Object(v.jsx)(n.a.Control,{type:"email",placeholder:e("email-confirm"),value:q.confirmEmail,"data-param":"confirmEmail",onChange:G})]})]})]}),Object(v.jsxs)("div",{className:"dv-section",children:[Object(v.jsx)("h6",{className:"h-title",children:e("contact-detail")}),Object(v.jsxs)("div",{className:"grid grid-cols-6 gap-x-6",children:[Object(v.jsx)("div",{className:"pb-4",children:Object(v.jsx)(o.a,{onSelectFile:e=>(async e=>{a(Object(p.b)(!0));try{const a=await u.a.uploadFile(e,"".concat(f.a.STORAGE_PATH_IMAGE));B(e=>({...e,profilePicture:a})),P(a)}catch(t){S("Profile picture upload error:"+t.message)}a(Object(p.b)(!1))})(e),image:E,className:"h-full"})}),Object(v.jsxs)("div",{className:"col-span-5 grid grid-cols-3 gap-x-6",children:[Object(v.jsxs)(n.a.Group,{children:[Object(v.jsx)(n.a.Label,{className:"mb-1",children:e("name")}
1),Object(v.jsx)(n.a.Control,{placeholder:e("name"),value:q.firstName,"data-param":"firstName",onChange:G,required:!0})]}),Object(v.jsxs)(n.a.Group,{children:[Object(v.jsx)(n.a.Label,{className:"mb-1",children:e("name-paternal")}),Object(v.jsx)(n.a.Control,{placeholder:e("name-paternal"),value:q.paternalName,"data-param":"paternalName",onChange:G,required:!0})]}),Object(v.jsxs)(n.a.Group,{children:[Object(v.jsx)(n.a.Label,{className:"mb-1",children:e("name-maternal")}),Object(v.jsx)(n.a.Control,{placeholder:e("name-maternal"),value:q.maternalName,"data-param":"maternalName",onChange:G,required:!0})]}),Object(v.jsxs)(n.a.Group,{children:[Object(v.jsx)(n.a.Label,{className:"mb-1",children:e("birthday")}),Object(v.jsx)(n.a.Control,{type:"date",value:h.a.dobInput(q.birthday),"data-param":"birthday",onChange:G,required:!0})]}),Object(v.jsxs)(n.a.Group,{children:[Object(v.jsx)(n.a.Label,{className:"mb-1",children:e("area")}),Object(v.jsx)(n.a.Control,{as:"select",value:q.area,"data-param":"area",onChange:G,required:!0,children:d.a.areaList().map((e,a)=>Object(v.jsx)("option",{value:e.value,children:e.name},e.value))})]}),Object(v.jsxs)(n.a.Group,{children:[Object(v.jsx)(n.a.Label,{className:"mb-1",children:e("employee-number")}),Object(v.jsx)(n.a.Control,{placeholder:e("employee-number"),value:q.employeeNumber,"data-param":"employeeNumber",onChange:G,required:!0})]})]}),Object(v.jsxs)(n.a.Group,{children:[Object(v.jsx)(n.a.Label,{className:"mb-1",children:e("location")}),Object(v.jsx)(n.a.Control,{as:"select",children:Object(v.jsx)("option",{children:"Of. Bermudas"})})]}),Object(v.jsxs)(n.a.Group,{className:"col-span-5",children:[Object(v.jsx)(n.a.Label,{className:"mb-1",children:e("address")}),Object(v.jsx)(n.a.Control,{placeholder:e("address"),value:q.address,"data-param":"address",onChange:G,required:!0})]}),Object(v.jsxs)(n.a.Group,{children:[Object(v.jsx)(n.a.Label,{className:"mb-1",children:e("zip-code")}),Object(v.jsx)(n.a.Control,{type:"number",placeholder:e("zip-code"),value:q.zipCode,"data-param":"zipCode",onChange:G,required:!0})]}),Object(v.jsxs)("div",{className:"col-span-5 grid grid-cols-3 gap-x-6",children:[Object(v.jsxs)(n.a.Group,{children:[Object(v.jsx)(n.a.Label,{className:"mb-1",children:e("town")}),Object(v.jsx)(n.a.Control,{placeholder:e("town"),value:q.town,"data-param":"town",onChange:G,required:!0})]}),Object(v.jsxs)(n.a.Group,{children:[Object(v.jsx)(n.a.Label,{className:"mb-1",children:e("country")}),Object(v.jsx)(n.a.Control,{as:"select",value:q.country,"data-param":"country",onChange:e=>{var a,t;G(e),a="state",t="",B(e=>({...e,[a]:t}))},required:!0,children:h.a.getInstance().renderCountryOptions()})]}),Object(v.jsxs)(n.a.Group,{children:[Object(v.jsx)(n.a.Label,{className:"mb-1",children:e("state")}),Object(v.jsx)(n.a.Control,{disabled:!q.country,as:"select",value:q.state,"data-
1param":"state",onChange:G,required:!0,children:h.a.getInstance().renderStateOptions(q.country)})]})]}),Object(v.jsxs)(n.a.Group,{children:[Object(v.jsx)(n.a.Label,{className:"mb-1",children:e("tax")}),Object(v.jsx)(n.a.Control,{placeholder:e("tax"),value:q.taxId,"data-param":"taxId",onChange:G,required:!0})]}),Object(v.jsxs)("div",{className:"col-span-5 grid grid-cols-3 gap-x-6",children:[Object(v.jsxs)(n.a.Group,{children:[Object(v.jsx)(n.a.Label,{className:"mb-1",children:e("personal-id-number")}),Object(v.jsx)(n.a.Control,{placeholder:e("personal-id-number"),value:q.personalId,"data-param":"personalId",onChange:G,required:!0})]}),Object(v.jsxs)(n.a.Group,{children:[Object(v.jsx)(n.a.Label,{className:"mb-1",children:e("cell-phone")}),Object(v.jsx)(j.a,{value:q.cellPhone,"data-param":"cellPhone",onChange:e=>B({...q,cellPhone:e}),required:!0})]}),Object(v.jsxs)(n.a.Group,{children:[Object(v.jsx)(n.a.Label,{className:"mb-1",children:e("phone")}),Object(v.jsx)(j.a,{value:q.phone,"data-param":"phone",onChange:e=>B({...q,phone:e}),required:!0})]}),Object(v.jsxs)(n.a.Group,{children:[Object(v.jsx)(n.a.Label,{className:"mb-1",children:e("temp-password")}),Object(v.jsx)(n.a.Control,{value:q.password,"data-param":"password",placeholder:e("temp-password"),onChange:G,required:!0})]})]})]})]}),Object(v.jsx)("div",{className:"dv-footer",children:Object(v.jsxs)("div",{className:"flex",children:[Object(v.jsx)(i.a,{variant:"dark",type:"submit",size:"sm",className:"but-round but-action uppercase",children:e("save")}),Object(v.jsx)(i.a,{variant:"light",size:"sm",className:"but-round but-action but-outline ml-3 uppercase",onClick:()=>C.push(g.b.USERS),children:e("cancel")})]})})]})]})]}),Object(v.jsx)(O.a,{ref:t,onNew:()=>B(L)})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.