(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["custom-contract-create"],{"17da":function(t,e,a){"use strict";var n=a("ddbd"),r=a("66a7");e["a"]=Object(n["a"])({socialSecurityNumber:null,name:null,email:null,phone:null,isCompany:!1,organizationNumber:null,companyName:null,address:Object(r["a"])()})},"64b0c":function(t,e,a){t.exports={primary:"#102537",secondary:"#d6e4eb",warning:"#e9ab05",success:"#0abb59",error:"#e7201b","light-grey":"#f7f7f7",dark:"#272727",grey:"#e3e3e3"}},a276:function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t._self._c;return e("Loader",{staticClass:"custom-contract-create",attrs:{value:t.contactPromise,message:t.$metaInfo.title}},[e("div",{staticClass:"container view"},[e("HeaderComponent",{attrs:{title:t.$metaInfo.title}}),e("Paywall",{attrs:{value:t.$store.state.addons,items:"custom-contract"},scopedSlots:t._u([{key:"content",fn:function(){return[e("Pricing",{attrs:{value:"custom-contract"},scopedSlots:t._u([{key:"actions",fn:function(){return[e("ButtonComponent",{attrs:{label:t.$t("activate"),icon:["fal","plus"],theme:"primary",labels:{confirm:t.$t("confirm")},icons:{confirm:["fas","question-circle"]},confirm:"",promise:t.addonPromise},on:{click:t.addon}})]},proxy:!0}])})]},proxy:!0},{key:"default",fn:function(){return[e("Card",{staticClass:"custom-contract-create__form",attrs:{tag:"form"},on:{submit:function(e){return e.preventDefault(),t.submit.apply(null,arguments)}},scopedSlots:t._u([{key:"default",fn:function(){return[e("div",{staticClass:"custom-contract-create__inputs"},[e("FileComponent",{attrs:{"data-field":"document",label:"".concat(t.labels.contract," (").concat(t.$t("maximumShort")," 25MB)"),"upload-options":{acl:"private"},upload:t.upload,required:"",accept:".pdf"},model:{value:t.data.template.document,callback:function(e){t.$set(t.data.template,"document",e)},expression:"data.template.document"}}),e("FileComponent",{attrs:{label:"".concat(t.$tc("attachment",2)," (").concat(t.$t("maximumShort")," 25MB)"),accept:".pdf","upload-options":{acl:"private"},upload:t.upload,multiple:"","data-field":"attachment"},scopedSlots:t._u([{key:"below",fn:function(){return[e("Alert",{staticClass:"mt-1"},[e("div",[t._v(t._s(t.$t("attachmentsSigningUploadWarning")))])])]},proxy:!0}]),model:{value:t.data.template.attachments,callback:function(e){t.$set(t.data.template,"attachments",e)},expression:"data.template.attachments"}})],1),e("InputComponent",{staticClass:"mt-2",attrs:{label:t.labels.signingAuthority,required:"","is-valid":t.validator.fields.signingAuthority.valid,"validation-message":t.validator.fields.signingAuthority.error}},[e("UserSelect",{staticClass:"elder-input__element",attrs:{search:"",multiple:"",items:t.fetchUsers,title:t.$t("selectx",{x:t.labels.signingAuthority.toLowerCase()})},model:{value:t.data.signingAuthority,callback:function(e){t.$set(t.data,"signingAuthority",e)},expression:"data.signingAuthority"}})],1),e("hr",{staticClass:"mt-4 mb-3"}),e("div",[e("h2",[t._v(t._s(t.$tc("buyer")))]),e("Applicant",{attrs:{rules:t.rulesOverride,"disabled-fields":t.disabledApplicantFields},model:{value:t.data.data,callback:function(e){t.$set(t.data,"data",e)},expression:"data.data"}})],1)]},proxy:!0},{key:"footer",fn:function(){return[e("ButtonComponent",{attrs:{label:t.$t("sendToSigning"),theme:"primary",type:"submit",promise:t.promises.mutate,disabled:!t.validator.passes,icon:["fal","file-contract"]}})]},proxy:!0}])})]},proxy:!0}])})],1)])},r=[],i=(a("8e6e"),a("456d"),a("96cf"),a("3b8d")),o=(a("6762"),a("2fdb"),a("768b")),c=(a("ac6a"),a("ffc1"),a("bd86")),s=a("c495"),u=a("e54d"),l=a("17da"),d=a("2f62"),p=a("ed08"),m=a("4f57"),f=a("f5ef"),b=a("9fb8"),h=a("f4b8"),y=a("d0a3"),g=a("4676"),v=a("b66f"),O=a("27f9"),C=a("c304"),j=a("ae8d"),$=a("ea98"),A=a("f9ec"),w=a("012d"),S=a("bab7");function x(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function P(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?x(Object(a),!0).forEach((function(e){Object(c["a"])(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):x(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}var k={"applicant.socialSecurityNumber":"socialSecurityNumber|different:coApplicant.socialSecurityNumber","coApplicant.socialSecurityNumber":"socialSecurityNumber"},_={mixins:[Object(u["a"])({source:null,model:{template:{document:null,attachments:[]},data:{applicant:Object(l["a"])(),hasCoApplicant:!1,coApplicant:Object(l["a"])(),customFields:null},signingAuthority:[]},transform:{signingAuthority:function(t){return t?t.map((function(t){return t.id})):[]}}}),Object(s["a"])({rules:{data:P(P({},C["c"]),k),"template.document":"required",signingAuthority:"required"},labels:"labels",data:"data"})],props:{contact:String},watch:{contact:{handler:"fetchContact",immediate:!0}},data:function(){return{contactPromise:null,addonPromise:null,rulesOverride:k,disabledApplicantFields:[]}},computed:P(P({},Object(d["e"])("Contract",["item","promises"])),{},{labels:function(){return P({contract:this.$tc("contract"),signingAuthority:this.$t("signingAuthority")},Object(p["p"])("data.",C["b"]))}}),methods:P(P({},Object(d["b"])("Contract",["mutate"])),{},{submit:function(){var t=this,e=this.getData();return e.data.hasCoApplicant||delete e.data.coApplicant,this.mutate([e,{mutation:"CustomContractCreate",strategy:"none"}]).then((function(){return t.$route.query.returnTo?t.$router.push(t.$route.query.returnTo):t.contact?t.$router.push({name:"contact-dashboard",params:{id:t.contact}}):void t.$router.push({name:"contacts"})}))},fetchUsers:function(t){return t=P(P({},t),{},{type:"user"}),b["a"].get({filter:t},{query:"UserSearch"})},fetchContact:function(){var t=this;if(this.contact)return this.contactPromise=h["a"].contractPrefill({id:this.contact}).then((function(e){t.data=Object(m["a"])(t.data,{data:{applicant:e}}),t.disabledApplicantFields=Object.entries(Object(p["n"])(t.data.data)).filter((function(t){var e=Object(o["a"])(t,2),a=e[0],n=e[1];return null!==n&&["email","phone","name"].some((function(t){return a.includes(t)}))})).map((function(t){var e=Object(o["a"])(t,1),a=e[0];return a}))}))},addon:function(){return this.addonPromise=this.$store.dispatch("subscription",{item:"custom-contract",state:!0})},upload:function(){var t=Object(i["a"])(regeneratorRuntime.mark((function t(e,a,n){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(!(e.size>25e6)){t.next=3;break}throw f["a"].$emit("notification",{theme:"error",content:"".concat(this.$t("maximumShort")," 25MB")}),new Error("File too large");case 3:return t.abrupt("return",Object(y["a"])(e,a,n));case 4:case"end":return t.stop()}}),t,this)})));function e(e,a,n){return t.apply(this,arguments)}return e}()}),mounted:function(){this.data.signingAuthority.length||(this.data.signingAuthority=[this.$store.state.user])},metaInfo:function(){return{title:this.$t("createContract")}},components:{InputComponent:v["a"],HeaderComponent:g["a"],Card:j["a"],FileComponent:O["a"],Applicant:C["a"],UserSelect:$["a"],Paywall:A["b"],Pricing:w["a"],Alert:S["a"]}},q=_,F=(a("a963"),a("2877")),N=Object(F["a"])(q,n,r,!1,null,null,null);e["default"]=N.exports},a963:function(t,e,a){"use strict";a("64b0c")}}]);
//# sourceMappingURL=custom-contract-create.dd3ef30e.js.map