1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5029],{33856:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/company/[companyId]/settings/company/licenses",function(){return t(35666)}])},26068:function(e,n,t){"use strict";var r=t(85893),i=t(93967),s=t.n(i),a=t(45697),l=t.n(a),c=t(33912),o=t.n(c),d=t(79728),_=t(73898),u=t(86510),p=t(63367);let m=e=>{let{label:n,placeholder:t="",name:i="",readOnly:a=!1,disabled:l=!1,type:c="text",value:p,defaultReadOnlyValue:m,defaultValue:h,onChange:x,inputProps:v=null,RightIcon:f,RightButton:g,errorMessage:y,shouldKeepErrorMessageAsItIs:b=!1,className:j,description:N,descriptionClassName:C,handleFocus:T=()=>{},handleBlur:w=()=>{},dataCy:L}=e,R="string"==typeof n?n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-_]/g,"").toLowerCase():"";return(0,r.jsxs)("div",{className:s()(o().text_input_wrap,{[o().disabled]:l,[o().has_right_button]:!!g,[o().right_icon]:(!!f||y)&&!g},j),children:[n&&(0,r.jsx)("label",{"data-cy":"".concat(L,"-label"),htmlFor:"".concat(R,"-input"),children:n}),a?(0,r.jsx)("p",{"data-cy":"".concat(L,"-field"),className:o().read_only_text,children:p||0===p?p:m}):(0,r.jsx)("input",{"data-cy":"".concat(L,"-input"),id:"".concat(R,"-input"),className:s()(o().text_input,{[o().has_error]:y}),type:c,name:i,disabled:a||l,value:(null==v?void 0:v.name)?void 0:p,defaultValue:h,placeholder:t,onChange:function(){for(var e=arguments.length,n=Array(e),t=0;t<e;t++)n[t]=arguments[t];l||a||!x||x(...n)},onFocus:T,onBlur:w,...v}),(0,r.jsx)(()=>f?(0,r.jsx)("div",{className:s()(o().right_icon_wrap,{[o().right_icon_error]:y}),children:(0,r.jsx)(f,{})}):g?(0,r.jsx)("div",{className:o().right_button,children:(0,r.jsx)(g,{})}):y?(0,r.jsx)("div",{className:o().right_icon_error_wrap,children:(0,r.jsx)(_.jj,{})}):null,{}),y?(0,r.jsx)(d.Z,{message:b?y:null===u.Z||void 0===u.Z?void 0:u.Z.getTitleCasedString(y),className:o().error_message}):N&&(0,r.jsx)("div",{className:s()(o().description,C),children:N})]})};m.propTypes={label:l().oneOfType([l().string,l().object]),value:(e,n,t)=>(0,p.D)(e,n,t),defaultValue:(e,n,t)=>(0,p.D)(e,n,t),defaultReadOnlyValue:l().string,onChange:l().func,placeholder:l().string,name:l().string,type:l().string,disabled:l().bool,readOnly:l().bool,inputProps:l().object,RightIcon:l().func,RightButton:l().func,errorMessage:l().string,shouldKeepErrorMessageAsItIs:l().bool,className:l().string,handleFocus:l().func,handleBlur:l().func,description:l().string,descriptionClassName:l().string,dataCy:l().string},n.Z=m},17217:function(e,n,t){"use strict";t.d(n,{Tn:function(){return l},_x:function(){return c},lG:function(){return s}});var r=t(47533),i=t(16310);let s=(0,r.X)(i.Ry().shape({companyProfile:i.Ry().shape({contactEmail:i.Z_().nullable(!0).required("Email is required."),website:i.Z_().nullable(!0).required("Website is required."),contactPhone:i.Z_().nullable(!0).required("Phone number is required.").matches(/^[0-9\s()/.-]+$/,'Phone number can only contain digits and "() / - ." characters.'),contactAddress:i.Z_().test("contactAddressCustom","Business address is required.",e=>!!e||new i.p8("Please select an option for your business address.",e,"companyProfile.contactAddress"))})})),a=i.Ry().shape({emailReminderFrequency:i.Z_().nullable(!0).required("Email Reminders are required."),reminderEmail:i.Z_().nullable(!0).required("Email Body is required."),emailReminderOccurrences:i.Z_().nullable(!0).required("Stop After is required."),smsReminderFrequency:i.Z_().nullable(!0).required("SMS Reminders are required."),smsReminderOccurrences:i.Z_().nullable(!0).required("Stop After is required.")}),l=(0,r.X)(i.Ry().shape({estimateReminders:a,saveForLaterReminders:a})),c=(0,r.X)(i.Ry().shape({licenses:i.IX().of(i.Ry().shape({licenseName:i.Z_().nullable(!0).required("License name is required."),licenseNumber:i.Z_().nullable(!0).required("License number is required.").matches(/^[a-zA-Z0-9]+$/,"License number can only contain digits and letters."),state:i.Ry().nullable(!0).shape({value:i.Z_().required("State is required.")})}))}))},35666:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return k}});var r=t(85893),i=t(67294),s=t(45007),a=t(11163),l=t(87536),c=t(73659),o=t.n(c),d=t(73502),_=t(36983),u=t(63560),p=t(29652),m=t
1(45697),h=t.n(m),x=t(93967),v=t.n(x),f=t(5298),g=t.n(f),y=t(73898);let b=e=>{let{children:n,licenseName:t,index:a}=e,l=(0,s.I0)(),[c,o]=(0,i.useState)(!0);return(0,i.useEffect)(()=>{c&&l((0,u.Rh)())},[]),(0,r.jsxs)("div",{"data-cy":"license-".concat(a+1,"-container"),className:g().layout_wrapper,children:[(0,r.jsxs)("div",{className:v()(g().container,{[g().container_open]:c}),children:[(0,r.jsxs)("div",{className:g().header_name,children:[(0,r.jsx)(y.lP,{}),(0,r.jsx)("div",{"data-cy":"license-".concat(a+1,"-title"),className:g().title,children:t})]}),(0,r.jsx)("div",{className:g().toggle_container,children:(0,r.jsx)("div",{className:g().toggle_button,children:c?(0,r.jsx)("img",{src:"/up-chevron.svg",onClick:()=>o(!1)}):(0,r.jsx)("img",{src:"/down-chevron.svg",onClick:()=>o(!0)})})})]}),c&&n]})};b.propTypes={children:h().node,licenseName:h().string,index:h().number};var j=t(90519),N=t.n(j),C=t(56247),T=t(2390),w=t(26068),L=t(5422),R=t(63571);let E=e=>{var n,t,i,a,l,c,o;let{license:d,register:_,errors:m,control:h,remove:x,index:v,readOnly:f=!1}=e,g=(0,s.I0)(),{width:j}=(0,R.Z)(),{data:E}=(0,p.gz)();return(0,r.jsx)(b,{licenseName:d.licenseName,index:v,children:(0,r.jsxs)("div",{className:N().license_container,children:[(0,r.jsx)(w.Z,{dataCy:"license-name",label:"Contractor's license name",placeholder:"Enter Contractor's License name here",inputProps:_("licenses.".concat(v,".licenseName")),errorMessage:null==m?void 0:null===(t=m[v])||void 0===t?void 0:null===(n=t.licenseName)||void 0===n?void 0:n.message,readOnly:f,value:d.licenseName}),(0,r.jsxs)("div",{"data-cy":"contractor-container",className:N().contractor_options,children:[(0,r.jsxs)("div",{className:N().field_option,children:[(0,r.jsx)("div",{children:"General Contactor's License"}),(0,r.jsx)(C.Z,{inputProps:_("licenses.".concat(v,".licenseType")),value:"GENERAL_CONTRACTOR",dataCy:"GENERAL_CONTRACTOR",disabled:f})]}),(0,r.jsxs)("div",{className:N().field_option,children:[(0,r.jsx)("div",{children:"Electrical Contractor's License"}),(0,r.jsx)(C.Z,{inputProps:_("licenses.".concat(v,".licenseType")),value:"ELECTRICAL_CONTRACTOR",dataCy:"ELECTRICAL_CONTRACTOR",disabled:f})]})]}),(0,r.jsx)("div",{children:(0,r.jsx)("div",{className:N().select_wrapper,children:f?(0,r.jsx)(w.Z,{label:"State",readOnly:!0,value:d.state.label,className:N().read_only_state}):(0,r.jsx)(T.Z,{dataCy:"state",label:"State",placeholder:"Select state",options:E,isSearchable:!0,control:h,name:"licenses.".concat(v,".state"),errorMessage:null==m?void 0:null===(l=m[v])||void 0===l?void 0:null===(a=l.state)||void 0===a?void 0:null===(i=a.value)||void 0===i?void 0:i.message})})}),(0,r.jsx)(w.Z,{dataCy:"license-number",label:"Contractor's license number",placeholder:"Enter Contractor's License number here",inputProps:_("licenses.".concat(v,".licenseNumber")),errorMessage:null==m?void 0:null===(o=m[v])||void 0===o?void 0:null===(c=o.licenseNumber)||void 0===c?void 0:c.message,readOnly:f,value:d.licenseNumber}),!f&&(0,r.jsx)("div",{className:N().delete_container,children:(0,r.jsx)(L.Z,{dataCy:"delete-".concat(v+1,"-license"),leftIcon:(0,r.jsx)(y.vc,{}),text:j>600?"Delete":null,type:"red",onClick:()=>{d.newLicense?x(v):g((0,u.b)(d.id))},className:N().delete_button})})]})})};E.propTypes={license:h().object.isRequired,index:h().number.isRequired,errors:h().array,register:h().func,control:h().object,remove:h().func,readOnly:h().bool};var Z=t(59700),q=t(88496),O=t(17217),A=t(12171),S=t(85637);let P={licenses:[]},F={licenseName:"New license",licenseType:"GENERAL_CONTRACTOR",licenseNumber:null,stateId:null,newLicense:!0,state:{}},I=()=>{let{width:e}=(0,R.Z)(),n=(0,a.useRouter)(),{companyId:t}=n.query,c=(0,s.I0)(),d=(0,p.rW)(),m=(0,p.Up)(),h=(0,p.lW)(),x=(0,p.RU)(),v=(0,S.Z)(A._I.COMPANY_SETTINGS.EDIT),{handleSubmit:f,register:g,reset:b,control:j,formState:{errors:N,isDirty:C}}=(0,l.cI)({defaultValues:P,resolver:O._x}),{fields:T,append:w,remove:I}=(0,l.Dq)({control:j,name:"licenses",keyName:"customId"});(0,i.useEffect)(()=>{c((0,u.Dz)(t))},[]),(0,i.useEffect)(()=>{let e=[];h.forEach(n=>{let{state:t}=n,r={...n,state:{value:t.id.toString(),label:t.name}};e.push(r)}),b({companyProfile:d,estimateReminders:m,licenses:e})},[b,d,m,h]);let k=()=>{w(F)},V=[{text:"Settings",path:(0,Z.Kk)(n.asPath,"")},{text:"Company Settings",path:(0,Z.Kk)(n.asPath,"/company")},{text:"Licenses",path:null}];return(0,r.jsxs)(_.Z,{hasGoBack:!0,breadcrumbsData:V,description:"Your general contractorâs and/or electrical contractorâs license(s).",rightButtons:v&&(0,r.jsx)(L.Z,{leftIcon:(0,r.jsx)(y.vc,{}),text:e>600?"Save":null,type:"indigo-filled",disabled:!C,onClick:f(e=>{C&&c((0,u.SY)(t,e))}),className:o().create_new_button,dataCy:"company-settings-save"}),children:[!x&&(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:o().overall_cxontainer,children:[(v||T.length>0)&&(0,r.jsx)("div",{className:o().section_wrapper,children:T.length>0?T.map((e,n)=>(0,r.jsx)(E,{license:e,index:n,register:g,errors:null==N?void 0:N.licenses,control:j,remove:I,readOnly:!v},e.id)):(0,r.jsx)("div",{className:o().no_results,children:"No licenses"})}),v&&(0,r.jsx)("div",{className:o().add_license_container,children:(0,r.jsx)(L.Z,{dataCy:T.length>=1?"add-another-license":"add-license",text:T.length>=1?"Add another license":"Add license",leftIcon:(0,r.jsx)(y.dt,{}),onClick:()=>{k()}})})]})}),x&&(0,r.jsx)(q.Z,{})]})};I.layout=d.y.DASHBOARD_V2;var k=I},63367:function(e,n,t){"use strict";t.d(n,{D:function(){return r}});let r=(e,n,t)=>
1{if(void 0!==e[n]){if("number"===e.type&&"number"!=typeof+e[n])return Error("Invalid prop ".concat(n," supplied to '").concat(t,"', expected 'number'."));if("text"===e.type&&"string"!=typeof e[n])return Error("Invalid prop ".concat(n," supplied to '").concat(t,"', expected 'string'."))}return null}},33912:function(e){e.exports={text_input_wrap:"TextField_text_input_wrap__YP2Ee",has_right_button:"TextField_has_right_button__0pj6T",disabled:"TextField_disabled__0Vq_t",helperText:"TextField_helperText__LQ3l4",text_input:"TextField_text_input__YWXeJ",read_only_text:"TextField_read_only_text__fctmb",right_button:"TextField_right_button__yrW6t",disabled_text:"TextField_disabled_text__TNC9m",has_error:"TextField_has_error__3zwox",right_icon:"TextField_right_icon__wXJwv",right_icon_error_wrap:"TextField_right_icon_error_wrap__DvWN6",right_icon_wrap:"TextField_right_icon_wrap__s9MnA",right_icon_error:"TextField_right_icon_error__6tBXT",error_message:"TextField_error_message__Jp3Xu",description:"TextField_description__9THuj"}},90519:function(e){e.exports={license_container:"License_license_container__8rP_v",field_option:"License_field_option__41rn_",contractor_options:"License_contractor_options__ZAiJ3",actions_item_img:"License_actions_item_img__A9SCe",icon_wrapper:"License_icon_wrapper__QRirA",select_field:"License_select_field__ELQnS",delete_container:"License_delete_container__ZXqXB",read_only_state:"License_read_only_state__CCkwy"}},5298:function(e){e.exports={layout_wrapper:"LicenseLayout_layout_wrapper__E0lqL",container:"LicenseLayout_container__tclYO",container_open:"LicenseLayout_container_open__0jHOw",toggle_container:"LicenseLayout_toggle_container__nMvJ7",header_name:"LicenseLayout_header_name__UOw66",title:"LicenseLayout_title__wpMN6"}},73659:function(e){e.exports={container:"licenses_container__S66oL",overall_container:"licenses_overall_container__i04qs",section_wrapper:"licenses_section_wrapper__tTSXc",no_results:"licenses_no_results__U69jg",floating_position:"licenses_floating_position__GVeRi",floating_wrapper:"licenses_floating_wrapper__sVhcf",field_option:"licenses_field_option__5Vdzu",add_license_container:"licenses_add_license_container__cWx6p"}},47533:function(e,n,t){"use strict";t.d(n,{X:function(){return c}});var r=t(87536);let i=(e,n,t)=>{if(e&&"reportValidity"in e){let i=(0,r.U2)(t,n);e.setCustomValidity(i&&i.message||""),e.reportValidity()}},s=(e,n)=>{for(let t in n.fields){let r=n.fields[t];r&&r.ref&&"reportValidity"in r.ref?i(r.ref,t,e):r.refs&&r.refs.forEach(n=>i(n,t,e))}},a=(e,n)=>{n.shouldUseNativeValidation&&s(e,n);let t={};for(let i in e){let s=(0,r.U2)(n.fields,i),a=Object.assign(e[i]||{},{ref:s&&s.ref});if(l(n.names||Object.keys(e),i)){let e=Object.assign({},(0,r.U2)(t,i));(0,r.t8)(e,"root",a),(0,r.t8)(t,i,e)}else(0,r.t8)(t,i,a)}return t},l=(e,n)=>e.some(e=>e.startsWith(n+"."));function c(e,n,t){return void 0===n&&(n={}),void 0===t&&(t={}),function(i,l,c){try{return Promise.resolve(function(r,a){try{var o=(n.context,Promise.resolve(e["sync"===t.mode?"validateSync":"validate"](i,Object.assign({abortEarly:!1},n,{context:l}))).then(function(e){return c.shouldUseNativeValidation&&s({},c),{values:t.raw?i:e,errors:{}}}))}catch(e){return a(e)}return o&&o.then?o.then(void 0,a):o}(0,function(e){var n;if(!e.inner)throw e;return{values:{},errors:a((n=!c.shouldUseNativeValidation&&"all"===c.criteriaMode,(e.inner||[]).reduce(function(e,t){if(e[t.path]||(e[t.path]={message:t.message,type:t.type}),n){var i=e[t.path].types,s=i&&i[t.type];e[t.path]=(0,r.KN)(t.path,n,e,t.type,s?[].concat(s,t.message):t.message)}return e},{})),c)}}))}catch(e){return Promise.reject(e)}}}}},function(e){e.O(0,[1664,7360,2888,9774,179],function(){return e(e.s=33856)}),_N_E=e.O()}]);
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.