Repository URL to install this package:
|
Version:
5.17.5.2543 ▾
|
"use strict";(self["webpackChunk_zoom_client_email_desktop"]=self["webpackChunk_zoom_client_email_desktop"]||[]).push([[125],{90125:function(e,t,a){a.r(t),a.d(t,{default:function(){return y}});var n=function(){var e=this,t=e._self._c;return t("zm-dialog",{ref:"dialog",attrs:{title:e.title,visible:e.visible,"close-on-press-escape":!1,top:"4vh",width:"548px","append-to-body":""}},[t("contact-form",{ref:"contactForm",attrs:{contactEdits:e.contactEdits,"zm-ta":"add-contact-criteria"},on:{update:e.handleContactFormUpdate}}),t("span",{staticClass:"add-contact-footer",attrs:{slot:"footer"},slot:"footer"},[t("zm-button",{staticClass:"button-left",attrs:{tabindex:"0","zm-ta":"add-contact-cancel"},on:{click:e.handleCancel}},[e._v(e._s(e.$t("operation.cancel")))]),t("section",{staticClass:"button-right"},[t("zm-button",{attrs:{disabled:e.loading,type:"primary",tabindex:"0","zm-ta":"add-contact"},on:{click:e.handleSubmit}},[e._v(" "+e._s(e.submitText)+" ")])],1)],1)],1)},o=[],l=a(70021),i=a(56706),r=a(34948),s=a(68571),c=(a(45794),a(6886),a(51367)),m=a.n(c),d=a(29648),u=a(63012),p=function(){var e=this,t=e._self._c;return t("section",{staticClass:"contact-criteria-container"},[t("zm-form",{ref:"form",staticClass:"contact-criteria-form",attrs:{model:e.formInline,rules:e.rules,"label-position":"top"}},[t("zm-form-item",{attrs:{label:e.$t("common.firstName"),prop:"firstName",for:"formInline-firstName"}},[t("zm-input",{staticClass:"input-box",attrs:{label:"","zm-ta":"add-contactfirstName"},model:{value:e.formInline.firstName,callback:function(t){e.$set(e.formInline,"firstName",t)},expression:"formInline.firstName"}})],1),t("zm-form-item",{attrs:{label:e.$t("common.lastName"),prop:"lastName",for:"formInline-lastName"}},[t("zm-input",{staticClass:"input-box",attrs:{label:"","zm-ta":"add-contact-lastName"},model:{value:e.formInline.lastName,callback:function(t){e.$set(e.formInline,"lastName",t)},expression:"formInline.lastName"}})],1),t("zm-form-item",{attrs:{label:e.$t("common.displayName"),prop:"displayName",for:"formInline-displayName"}},[t("zm-input",{staticClass:"input-box",attrs:{label:"","zm-ta":"add-contact-displayName",placeholder:e.$t("contacts.displayNamePlaceHolder")},model:{value:e.formInline.displayName,callback:function(t){e.$set(e.formInline,"displayName",t)},expression:"formInline.displayName"}})],1),t("div",{staticClass:"email-row"},[t("zm-form-item",{style:{width:"35%"},attrs:{label:e.$t("common.emailLabel"),prop:"label",for:"formInline-emailLabel"}},[t("zm-select",{staticClass:"input-box-label",style:{width:"100%"},attrs:{placeholder:e.$t("common.pleaseSelect"),label:e.$t("common.pleaseSelect")},model:{value:e.formInline.emailLabel,callback:function(t){e.$set(e.formInline,"emailLabel",t)},expression:"formInline.emailLabel"}},e._l(e.emailLabels,(function(e){return t("zm-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1),t("zm-form-item",{staticClass:"input-box-dropdown",attrs:{label:e.$t("common.emailAddress"),prop:"emailAddress",for:"formInline-emailAddress"}},[t("zm-input",{style:{width:"100%"},attrs:{label:"","zm-ta":"add-contact-emailAddress",placeholder:e.$t("contacts.emailPlaceHolder"),required:""},model:{value:e.formInline.emailAddress,callback:function(t){e.$set(e.formInline,"emailAddress",t)},expression:"formInline.emailAddress"}})],1)],1),e._l(e.formInline.phoneNumbers,(function(a,n){return t("div",{key:n,staticClass:"email-row"},[t("zm-form-item",{style:{width:"35%"},attrs:{label:e.$t("common.phoneNumberLabel"),prop:"label",for:"formInline-phoneNumbers-label"}},[t("zm-select",{staticClass:"input-box-label",style:{width:"100%"},attrs:{placeholder:e.$t("common.pleaseSelect"),label:e.$t("common.pleaseSelect")},on:{input:function(t){return e.updatePhoneNumberLabel(n,t)}},model:{value:e.formInline.phoneNumbers[n].label,callback:function(t){e.$set(e.formInline.phoneNumbers[n],"label",t)},expression:"formInline.phoneNumbers[index].label"}},e._l(e.phoneLabels,(function(e){return t("zm-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1),t("zm-form-item",{attrs:{label:e.$t("common.phoneNumber"),prop:"phoneNumber",for:"formInline-phoneNumbers"}},[t("zm-input",{staticClass:"input-box",style:{width:"100%"},attrs:{label:"","zm-ta":"add-contact-phoneNumbers-phoneNumber",placeholder:e.$t("contacts.phoneNumberPlaceHolder")},on:{input:function(t){return e.updatePhoneNumber(n,t)}},model:{value:e.formInline.phoneNumbers[n].phoneNumber,callback:function(t){e.$set(e.formInline.phoneNumbers[n],"phoneNumber",t)},expression:"formInline.phoneNumbers[index].phoneNumber"}})],1)],1)}))],2)],1)},f=[],b=(a(77950),a(71372),a(6798)),h={name:"ContactForm",props:{contactEdits:{type:Object,default:function(){}}},data:function(){var e=this,t=function(t,a,n){if(a){var o=a.split(" OR ");o.some((function(e){return!b.Utils.isValidEmailAddress(e)}))&&n(new Error(e.$t("groupSetting.correctEmailAddress")))}n()};return{formInline:{displayName:"",firstName:"",lastName:"",emailAddress:"",emailLabel:"",emailAddresses:[{email:"",label:""}],phoneNumbers:[{phoneNumber:"",label:""}]},rules:{emailAddress:[{validator:t,trigger:"blur"},{required:!0,message:this.$t("contacts.emailRequired"),trigger:"blur"}]},phoneLabels:[{label:"Home",value:"Home"},{label:"Work",value:"Work"},{label:"Other",value:"Other"},{label:"Mobile",value:"Mobile"},{label:"Main",value:"Main"},{label:"Home Fax",value:"Home Fax"},{label:"Work Fax",value:"Work Fax"},{label:"Googole Voice",value:"Googole Voice"},{label:"Pager",value:"Pager"}],emailLabels:[{label:"Home",value:"Home"},{label:"Work",value:"Work"},{label:"Other",value:"Other"}]}},computed:(0,r.Z)({},(0,d.Se)()),watch:{formInline:{handler:function(e){this.$emit("update",e)},immediate:!0}},methods:{init:function(){var e,t,a,n,o,l,i,r,s;this.formInline.displayName=(null===(e=this.contactEdits)||void 0===e?void 0:e.displayName)||"",this.formInline.firstName=(null===(t=this.contactEdits)||void 0===t?void 0:t.firstName)||"",this.formInline.lastName=(null===(a=this.contactEdits)||void 0===a?void 0:a.lastName)||"",this.formInline.emailAddress=(null===(n=this.contactEdits)||void 0===n||null===(o=n.emailAddresses)||void 0===o?void 0:o[0].email)||"",this.formInline.emailLabel=(null===(l=this.contactEdits)||void 0===l||null===(i=l.emailAddresses)||void 0===i?void 0:i[0].label)||"",this.formInline.emailAddresses=(null===(r=this.contactEdits)||void 0===r?void 0:r.emailAddresses)||[{email:"",label:""}],this.formInline.phoneNumbers=(null===(s=this.contactEdits)||void 0===s?void 0:s.phoneNumbers)||[{phoneNumber:"",label:""}],this.$refs.form.clearValidate()},updateEmail:function(e,t){var a=this.formInline.emailAddresses[e];a.email=t,this.$set(this.formInline.emailAddresses,e,a)},updateLabel:function(e,t){var a=this.formInline.emailAddresses[e];a.label=t,this.$set(this.formInline.emailAddresses,e,a)},updatePhoneNumber:function(e,t){var a=this.formInline.phoneNumbers[e];a.phoneNumber=t,this.$set(this.formInline.phoneNumbers,e,a)},updatePhoneNumberLabel:function(e,t){var a=this.formInline.phoneNumbers[e];a.label=t,this.$set(this.formInline.phoneNumbers,e,a)},validate:function(){var e=this;return new Promise((function(t,a){e.$refs.form.validate((function(n){if(!n)return a(new Error("validate error"));var o=Object.values(e.formInline).some((function(e){return!!e}));return o?t(e.formInline):a(new Error("validate error"))}))}))}}},v=h,N=a(93483),I=(0,N.Z)(v,p,f,!1,null,"28a73eae",null),C=I.exports,$={name:"AddContactDialog",components:{ContactForm:C},props:{contactEdits:{type:Object}},data:function(){return{visible:!1,isContactExist:!1,isFulfilled:!1,loading:!1,contactData:null}},computed:{isEdit:function(){return this.contactEdits.contactId},title:function(){return this.isEdit?this.$t("contacts.updateContact"):this.$t("contacts.addContact")},submitText:function(){return this.isEdit?this.$t("common.update"):this.$t("common.create")}},watch:{visible:{handler:function(e){var t=this;this.$store.commit("setPreventBack",e),e&&this.$nextTick((function(){t.$refs.contactForm.init()}))},immediate:!0},contactData:{handler:function(e){this.isContactExist=e&&Object.entries(e).filter((function(e){var t=(0,s.Z)(e,2),a=(t[0],t[1]);return"string"===typeof a?!!a.trim():a})).length>0},deep:!0,immediate:!0}},methods:(0,r.Z)((0,r.Z)({},(0,d.nv)("contacts",["addContactToStore","updateContactInStore","deleteContact","setContactList"])),{},{handleContactFormUpdate:function(e){this.contactData=e},prepareContactData:function(e){var t={displayName:e.displayName,firstName:e.firstName,lastName:e.lastName,emailAddresses:[{email:e.emailAddress}]};e.emailLabel&&"Unknown"!==e.emailLabel&&(t.emailAddresses[0].label=e.emailLabel);var a=[];return e.phoneNumbers.length>0&&e.phoneNumbers.forEach((function(e){var t={};""!==e.label&&(t.label=e.label),""!==e.phoneNumber&&(t.phoneNumber=e.phoneNumber,a.push(t))})),a.length>0&&(t.phoneNumbers=a),t},addContact:function(e){var t=this;return(0,i.Z)((0,l.Z)().mark((function a(){var n,o;return(0,l.Z)().wrap((function(a){while(1)switch(a.prev=a.next){case 0:return n=t.prepareContactData(e),a.next=3,u.Contacts.createpersonalcontact({contact:n});case 3:o=a.sent,0===o.errorCode?(n.contactId=o.data.CreatePersonalContact.contactId,t.addContactToStore(n),t.$undoNotice({title:t.$t("contacts.contactHasBeenCreated")})):t.$msg(t.$t("contacts.failedToCreateAContact"));case 5:case"end":return a.stop()}}),a)})))()},updateContact:function(e){var t=this;return(0,i.Z)((0,l.Z)().mark((function a(){var n,o,i;return(0,l.Z)().wrap((function(a){while(1)switch(a.prev=a.next){case 0:return n=t.prepareContactData(e),o={contactId:e.contactId,contact:n},a.next=4,u.Contacts.updateContact(o);case 4:i=a.sent,0===i.errorCode?(o.contact.contactId=e.contactId,t.updateContactInStore(o),t.$undoNotice({title:t.$t("contacts.contactHasBeenUpdated")})):1===i.errorCode&&t.$msg(t.$t("contacts.failedToUpdateContact"));case 6:case"end":return a.stop()}}),a)})))()},open:function(){this.visible=!0},close:function(){this.visible=!1,Object.assign(this.contactData,this.$options.data.call(this).contactData)},handleSubmit:function(){var e=this;return(0,i.Z)((0,l.Z)().mark((function t(){var a,n,o,i;return(0,l.Z)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.$refs.contactForm.validate();case 3:e.loading=!0,a=Object.create(null),t.t0=(0,l.Z)().keys(e.contactData);case 6:if((t.t1=t.t0()).done){t.next=18;break}if(n=t.t1.value,e.contactData.hasOwnProperty(n)){t.next=10;break}return t.abrupt("continue",6);case 10:if("emailAddresses"!==n&&"phoneNumbers"!==n){t.next=14;break}return t.abrupt("continue",6);case 14:o="string"===typeof e.contactData[n]?e.contactData[n].trim():e.contactData[n],a[n]=m().sanitize(o);case 16:t.next=6;break;case 18:if(i=(0,r.Z)((0,r.Z)({},e.contactEdits),a),!e.isEdit){t.next=26;break}return t.next=23,e.updateContact(i);case 23:e.loading=!1,t.next=30;break;case 26:return i.contactId="",t.next=29,e.addContact(i);case 29:e.loading=!1;case 30:e.$emit("submit",i),e.close(),t.next=37;break;case 34:t.prev=34,t.t2=t["catch"](0);case 37:return t.prev=37,e.loading=!1,t.finish(37);case 40:case"end":return t.stop()}}),t,null,[[0,34,37,40]])})))()},handleCancel:function(){this.$emit("cancel"),this.close(),this.loading=!1}})},x=$,k=(0,N.Z)(x,n,o,!1,null,"fe323fac",null),y=k.exports}}]);