-
Notifications
You must be signed in to change notification settings - Fork 0
/
14.bundle.min.js
1 lines (1 loc) · 76.2 KB
/
14.bundle.min.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[14],{380:function(e,a,t){"use strict";t.r(a);var n=t(0),c=t.n(n),l=t(1),r=t.n(l),s=t(382),o=t(33),m=t(2),i=t(40),u=t.n(i),d=t(18),p=t.n(d),f=t(22),E=t(16),b=t(27),g=t.n(b),N=t(82),v=t(70),h=t(93),y=t.n(h),C=t(31),S=t(54),k=t(24),w=t(52),x=t(46),j=t(89),O=t(20),P=function(e){var a=Object(n.useState)(!1),t=p()(a,2),l=t[0],r=t[1],s=Object(n.useState)(!0),o=p()(s,2),i=o[0],d=o[1],E=Object(n.useState)([]),b=p()(E,2),N=b[0],v=b[1],h=Object(n.useState)([]),P=p()(h,2),D=P[0],G=P[1],A=Object(n.useState)([]),F=p()(A,2),M=F[0],I=F[1],T=Object(n.useState)([]),L=p()(T,2),V=L[0],U=L[1],q=Object(n.useState)("manual-create"),B=p()(q,2),W=B[0],z=B[1],Y=Object(C.a)(),R=Y.register,K=Y.handleSubmit,Z=Y.errors,$=Y.formState,J=N.map((function(e){return{label:e.name+" ("+e.contactsCount+")",value:e.id,data:e}}));Object(n.useEffect)((function(){_()}),[]);var Q,_=function(){j.a.getCountries().then((function(e){I(e.result.data)})),x.a.loadAllGroups().then((function(e){v(e.result.data)}))},H=function(e){U(e)};return c.a.createElement("form",{onSubmit:K((function(a,t){(r(!0),a.country={id:a.country},"import-contacts"===W)?(a.files=D,a.groups=V.map((function(e){return e.data.uuid})).join(","),(a.groups.length?w.a.uploadGroupContacts(a):w.a.uploadContacts(a)).then((function(a){a.success&&(f.a.success(a.message,{position:"top-right"}),g.a.publish("CONTACTS:ADDED",null),t.target.reset(),G([]),r(!1),e.cancel())}),(function(e){f.a.error(e.message,{position:"top-right"}),r(!1)}))):(a.groups=V?V.map((function(e){return e.data})):[],w.a.createContact(a).then((function(a){a.success&&(f.a.success(a.message,{position:"top-right"}),g.a.publish("CONTACTS:ADDED",a.result.data),t.target.reset(),U([]),r(!1),e.cancel())}),(function(e){f.a.error(e.message,{position:"top-right"}),r(!1)})))}))},c.a.createElement("div",{className:"modal-body "+(l?"spinner pl-0":"")},c.a.createElement(m.a,{isLoading:l}),c.a.createElement("div",{className:"form-group"},c.a.createElement("div",{className:"selectgroup w-100"},c.a.createElement("label",{className:"selectgroup-item"},c.a.createElement("input",{type:"radio",name:"transportation",defaultValue:"manual-create",className:"selectgroup-input",defaultChecked:"manual-create"===W}),c.a.createElement("span",{className:"selectgroup-button selectgroup-button-icon font-weight-bold",onClick:function(){return z("manual-create")}},c.a.createElement("i",{className:"fa fa-user-plus"})," Create Manually")),c.a.createElement("label",{className:"selectgroup-item"},c.a.createElement("input",{type:"radio",name:"transportation",defaultValue:"import-contacts",className:"selectgroup-input",defaultChecked:"import-contacts"===W}),c.a.createElement("span",{className:"selectgroup-button selectgroup-button-icon font-weight-bold",onClick:function(){return z("import-contacts")}},c.a.createElement("i",{className:"fa fa-users"})," Import Contacts")))),c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{htmlFor:"groups",className:"form-control-label"},"Select Contact Groups:"),c.a.createElement(S.a,{id:"groups",name:"groups",isMulti:!0,options:J,value:V,closeMenuOnSelect:!1,placeholder:"Search Contact Groups",onChange:H}),c.a.createElement("div",{className:"help-block text-primary text-small"},c.a.createElement("strong",null,c.a.createElement("i",{className:"fa fa-info-circle"})," Info:"," "),"If you select any groups, the created contact will automatically be linked to the selected group. If not, you can always add later."))),(Q="","manual-create"!==W&&(Q=c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{htmlFor:"csvFiles",className:"form-control-label mb-1"},"Drag and Drop CSV file: ",c.a.createElement("span",{className:"text-danger"},"*")),c.a.createElement("div",{className:"help-block text-info text-label mb-2"},c.a.createElement("strong",null,c.a.createElement("i",{className:"fa fa-info-circle"})," Info:"," "),"You can download the sample"," ",c.a.createElement("a",{className:"font-weight-bold",href:"/assets/downloads/contacts-list-template.csv",download:"contacts-list-template.csv"},"contact-list-template.csv")," ","file here."),c.a.createElement("div",{className:"dropzone-custom"},c.a.createElement("input",{id:"csvFiles",name:"csvFiles",type:"file",className:"form-control",placeholder:"Select Contacts CSV File",onChange:function(e){e.target.files.length&&G([].concat(u()(D),[e.target.files[0]]))},ref:R({name:"csvFiles"},{validate:function(){return!(!D||!D.length)||"Please select at least one proper CSV file."}})}),c.a.createElement("div",{className:"jumbotron mb-0"},c.a.createElement("div",{className:"text-primary text-center"},c.a.createElement("strong",null,c.a.createElement("i",{className:"fa fa-info-circle"})," Info:"," ")," ","Drag your files here or click in this area to add more files",c.a.createElement("div",{className:"text-warning"},"Allowed file size 5MB and type CSV")))),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{error:D.length?null:Z.csvFiles}))),c.a.createElement("div",{className:"form-group"},D.length?c.a.createElement("label",{className:"form-control-label"},"Selected Files:"):"",D.map((function(e,a){return c.a.createElement("div",{className:"text-left mb-2",key:"file"+a},c.a.createElement("span",{className:"badge badge-success mr-2"},e.name),c.a.createElement("span",{type:"button",className:"badge badge-danger",onClick:function(){return e=a,void G(D.filter((function(a,t){return t!==e})));var e}},c.a.createElement("i",{className:"fa fa-times"})))}))))),Q)),c.a.createElement("div",{className:"row"},function(){var e,a="";"manual-create"===W&&(a=c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-6"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{className:"form-control-label",htmlFor:"input-first-name"},"First Name: ",c.a.createElement("span",{className:"text-danger"},"*")),c.a.createElement("input",{id:"input-first-name",name:"firstName",className:"form-control"+O.a.checkValadity("firstName",Z,$),placeholder:"Enter First Name",ref:R({required:"Please enter first name."})}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{error:Z.firstName})))),c.a.createElement("div",{className:"col-lg-6"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{className:"form-control-label",htmlFor:"input-last-name"},"Last Name: ",c.a.createElement("span",{className:"text-danger"},"*")),c.a.createElement("input",{id:"input-last-name",name:"lastName",className:"form-control"+O.a.checkValadity("lastName",Z,$),placeholder:"Enter Last Name",ref:R({required:"Please enter last name."})}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{error:Z.lastName}))))),c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-6"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{className:"form-control-label",htmlFor:"input-device"},"Choose Country:"),c.a.createElement("select",{id:"input-device",name:"country",className:"custom-select"+O.a.checkValadity("country",Z,$),ref:R({required:"Please select a Country"})},c.a.createElement("option",{key:"opt-no-device",value:""},"Select Contact Country"),M.map((function(e){return c.a.createElement("option",{key:e.countryCode,value:e.id},O.a.truncateString(e.name,30)," (",e.dialCode,")")}))),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{error:Z.country})))),c.a.createElement("div",{className:"col-lg-6"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{className:"form-control-label",htmlFor:"input-phone-number"},"Phone Number ",c.a.createElement("small",null,"(Without Country Code)"),": ",c.a.createElement("span",{className:"text-danger"},"*")),c.a.createElement("input",{id:"input-phone-number",name:"phoneNumber",className:"form-control"+O.a.checkValadity("phoneNumber",Z,$),placeholder:"Enter Phone Number",ref:R({required:"Enter contact phone number.",minLength:{value:9,message:"Phone Number should be of 9 digits."},maxLength:{value:13,message:"Phone Number should be of 13 digits."},pattern:{value:/^[0-9]{9,13}$/i,message:"Entered phone number is not a valid number."}})}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{error:Z.phoneNumber}))))),c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-6"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{className:"form-control-label",htmlFor:"input-email"},"Email Address:"),c.a.createElement("input",{id:"input-email",name:"email",className:"form-control"+O.a.checkValadity("email",Z,$),placeholder:"john@example.com",ref:R({pattern:{value:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i,message:"Invalid Email address provided."}})}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{error:Z.email})))),c.a.createElement("div",{className:"col-lg-6"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{htmlFor:"tags",className:"form-control-label"},"Add Tags:"),c.a.createElement("input",{type:"text",id:"tags",name:"tags",className:"form-control",placeholder:"#artist, #designer, #cyclist, #teacher, ...",ref:R}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{field:"Tags",error:Z.tags}))))),c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{htmlFor:"notes",className:"form-control-label"},"Notes for the contact:"),c.a.createElement("textarea",{name:"notes",rows:"3",className:"form-control",placeholder:"A few words about your contact ...",ref:R}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{field:"Contact Notes",error:Z.notes})))),c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{className:"custom-switch mt-0 pl-0"},c.a.createElement("input",(e={name:"isActive",type:"checkbox"},y()(e,"name","custom-switch-checkbox"),y()(e,"value",i),y()(e,"className","custom-switch-input"),y()(e,"defaultChecked",i),y()(e,"ref",R()),e)),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{error:Z.isActive})),c.a.createElement("span",{className:"custom-switch-indicator",onClick:function(){return d(!i)}}),c.a.createElement("span",{className:"custom-switch-description"},"Keep as active contact?")))))));return a}())),c.a.createElement("div",{className:"modal-footer bg-whitesmoke"},c.a.createElement("div",{className:"text-left"},c.a.createElement("button",{className:"btn btn-lg btn-success mr-2",type:"reset"},"Clear Form"),c.a.createElement("button",{className:"btn btn-lg btn-primary mr-2",disabled:$.isSubmitting,type:"submit"},"Save Contact Details"),c.a.createElement("button",{className:"btn btn-lg btn-danger mr-2",type:"buton","data-dismiss":"modal",onClick:e.cancel},"Cancel"))))};P.propTypes={cancel:r.a.func};var D=P,G=function(e){var a=function(e){return{label:e.firstName+" "+(e.lastName?e.lastName:""),value:e.id,data:e}},t=Object(n.useState)(!1),l=p()(t,2),r=l[0],s=l[1],o=Object(n.useState)([]),i=p()(o,2),u=i[0],d=i[1],E=Object(n.useState)([]),b=p()(E,2),g=b[0],N=b[1],v=Object(n.useState)(e.contacts.map(a)||[]),h=p()(v,2),y=h[0],w=h[1],j=Object(C.a)(),P=j.register,D=j.handleSubmit,G=j.errors,A=j.formState,F=e.contacts.map(a),M=u.map((function(e){return{label:e.name+" ("+e.contactsCount+")",value:e.id,data:e}}));Object(n.useEffect)((function(){I()}),[]);var I=function(){x.a.loadAllGroups().then((function(e){d(e.result.data)}))};return c.a.createElement(c.a.Fragment,null,c.a.createElement("form",{onSubmit:D((function(a,t){return s(!0),a.groups=g.map((function(e){return e.data})),a.contacts=y.map((function(e){return e.data})),O.a.isEmpty(a.name)&&!a.groups.length?(f.a.error("Please enter the New Group name or select at least one existing group.",{position:"top-right"}),s(!1),!1):(a.groups.length?x.a.assignContactsToGroup(a):x.a.createGroup(a)).then((function(a){a.success&&(f.a.success(a.message,{position:"top-right"}),t.target.reset(),e.cancel())}),(function(e){return f.a.error(e.message,{position:"top-right"})})).finally((function(){s(!1)}))}))},c.a.createElement("div",{className:"modal-body "+(r?"spinner pl-0":"")},c.a.createElement(m.a,{isLoading:r}),c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{className:"mb-0",htmlFor:"group-name"},"New Group Name (optional):"),c.a.createElement("div",{className:"mt-0 mb-2"},c.a.createElement("span",{className:"text-primary text-small"},c.a.createElement("strong",null,c.a.createElement("i",{className:"fa fa-info-circle"})," Info:"," "),"A new group will be created upon saving and selected contacts will be assciated to this group.")),c.a.createElement("input",{type:"text",id:"group-name",name:"name",className:"form-control",placeholder:"What would you call your group?",ref:P({minLength:{value:5,message:"Group Name should be of 5 characters."}})}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{field:"Group Name",error:G.name}))))),c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{className:"mb-0",htmlFor:"groups"},"Select Existing Group(s):"),c.a.createElement("div",{className:"mt-0 mb-2"},c.a.createElement("span",{className:"text-primary text-small"},c.a.createElement("strong",null,c.a.createElement("i",{className:"fa fa-info-circle"})," Info:"," "),"Selected Contacts will be saved to each choosen group(s).")),c.a.createElement(S.a,{id:"groups",name:"groups",isMulti:!0,options:M,closeMenuOnSelect:!1,placeholder:"Search Existing Groups",onChange:function(e){N(e||[])},value:g}))),c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{htmlFor:"contacts",className:"mb-0"},"Select Contacts:"),c.a.createElement("div",{className:"mt-0 mb-2"},c.a.createElement("span",{className:"text-primary text-small"},c.a.createElement("strong",null,c.a.createElement("i",{className:"fa fa-info-circle"})," Info:"," "),"Selected contacts will automatically be assigned to the group choosen.")),c.a.createElement(S.a,{id:"contacts",name:"contacts",isMulti:!0,options:F,closeMenuOnSelect:!1,placeholder:"Search Contacts",onChange:function(e){e&&w(e)},value:y}))))))),c.a.createElement("div",{className:"modal-footer bg-whitesmoke"},c.a.createElement("div",{className:"text-left"},c.a.createElement("button",{className:"btn btn-lg btn-primary mr-2",disabled:A.isSubmitting,type:"submit"},"Save Details"),c.a.createElement("button",{className:"btn btn-lg btn-danger mr-2",type:"button","data-dismiss":"modal",onClick:e.cancel},"Cancel")))))};G.propTypes={cancel:r.a.func,contacts:r.a.arrayOf(r.a.object)};var A=G,F=t(81),M=t(60),I=function(e){var a=function(e){return{label:e.firstName+" "+(e.lastName?e.lastName:""),value:e.id,data:e}},t=Object(n.useState)(0),l=p()(t,2),r=l[0],s=l[1],o=Object(n.useState)([]),i=p()(o,2),d=i[0],E=i[1],b=Object(n.useState)(!1),N=p()(b,2),v=N[0],h=N[1],y=Object(n.useState)(""),w=p()(y,2),x=w[0],j=w[1],P=Object(n.useState)(!0),D=p()(P,2),G=D[0],A=D[1],I=Object(n.useState)(""),T=p()(I,2),L=T[0],V=T[1],U=Object(n.useState)(""),q=p()(U,2),B=q[0],W=q[1],z=Object(C.a)(),Y=z.register,R=z.handleSubmit,K=z.errors,Z=z.getValues,$=z.formState,J=Object(n.useState)(e.contacts.map(a)||[]),Q=p()(J,2),_=Q[0],H=Q[1],X=e.contacts.map(a);Object(n.useEffect)((function(){ee()}),[]);var ee=function(){F.a.loadSmsDevices().then((function(e){e.success&&E(e.result.data.filter((function(e){return!1===e.isDeleted})))}))},ae=function(e){K.contacts=e&&e.length?null:{message:"Please select at least one of the contacts"},H(e)};return c.a.createElement("form",{onSubmit:R((function(a,t){h(!0),a.userContacts=_.map((function(e){return e.data})),M.a.createNewSms(a).then((function(a){a.success&&(g.a.publish("SMS:ADDED",a.result.data),f.a.success(a.message,{position:"top-right"}),t.target.reset(),H([]),e.cancel())}),(function(e){f.a.error(e.message,{position:"top-right"})})).finally((function(){h(!1)}))}))},c.a.createElement("div",{className:"modal-body "+(v?"spinner pl-0":"")},c.a.createElement(m.a,{isLoading:v}),c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-4"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{className:"form-control-label",htmlFor:"input-device"},"Choose Device:"),c.a.createElement("select",{id:"input-device",name:"smsDeviceId",className:"custom-select"+O.a.checkValadity("smsDeviceId",K,$),ref:Y({required:"Please select a SMS Device"}),onChange:function(e){return V(e.target.value)}},c.a.createElement("option",{key:"opt-no-device",value:""},"Select SMS Device"),d.filter((function(e){return e.isActive})).map((function(e){return c.a.createElement("option",{key:e.uuid,value:e.uuid},e.deviceName)}))),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{error:K.smsDeviceId})))),c.a.createElement("div",{className:"col-lg-4"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{className:"form-control-label",htmlFor:"input-device"},"SIM Card Options:"),c.a.createElement("select",{id:"input-device",name:"smsSimCardOption",className:"custom-select"+O.a.checkValadity("smsSimCardOption",K,$),ref:Y({required:"Please select a SMS Device"}),onChange:function(e){return W(e.target.value)}},c.a.createElement("option",{value:""},"Select SMS Device"),c.a.createElement("option",{value:"AUTO_SELECT"},"Auto Select SIM Card"),c.a.createElement("option",{value:"DEFAULT"},"Default SIM Card"),c.a.createElement("option",{value:"SELECTED"},"Selected SIM Card")),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{error:K.smsSimCardOption})))),c.a.createElement("div",{className:"col-lg-4"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{className:"form-control-label",htmlFor:"input-sim-card"},"Choose SIM Card:"),"SELECTED"===B?c.a.createElement(c.a.Fragment,null,c.a.createElement("select",{id:"input-sim-card",name:"simCardId",ref:Y({required:"Please select the SIM card."}),className:"custom-select"+O.a.checkValadity("simCardId",K,$)},function(e){var a=c.a.createElement("option",{key:"opt-none",value:""},"No SIM Cards");if(e){var t=d.find((function(a){return a.uuid===e}));t&&(a=[c.a.createElement("option",{key:"opt-select",value:""},"Select SIM Cards")].concat(u()(t.cards.filter((function(e){return e.isActive&&!e.isDeleted})).map((function(e){return c.a.createElement("option",{key:e.uuid,value:e.uuid},e.displayName)})))))}return a}(L)),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{error:K.simCardId}))):c.a.createElement("p",{className:"pt-2 text-success"},Z().smsSimCardOption?c.a.createElement(c.a.Fragment,null,c.a.createElement("i",{className:"fa fa-check-circle"})," ",O.a.capatalize(Z().smsSimCardOption)):"No Sim Option Selected")))),c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-8"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{className:"form-control-label",htmlFor:"input-title"},"Message Title:"),c.a.createElement("input",{type:"text",id:"input-title",name:"title",placeholder:"Message title",className:"form-control"+O.a.checkValadity("title",K,$),ref:Y({required:"Please enter your Message Title.",minLength:{value:6,message:"Message Title should be minimum of 6 characters."}})}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{error:K.title})))),c.a.createElement("div",{className:"col-lg-4"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{className:"form-control-label",htmlFor:"sms-type"},"Choose SMS Type:"),c.a.createElement("select",{id:"sms-type",name:"smsType",className:"custom-select"+O.a.checkValadity("smsType",K,$),ref:Y({required:"Please select a Message Type"})},c.a.createElement("option",{key:"opt-no-device",value:""},"Select Message Type"),c.a.createElement("option",{key:"Business",value:"Business"},"Business"),c.a.createElement("option",{key:"Promotion",value:"Promotion"},"Promotion"),c.a.createElement("option",{key:"Offer",value:"Offer"},"Offer"),c.a.createElement("option",{key:"Wishes",value:"Wishes"},"Wishes"),c.a.createElement("option",{key:"Notification",value:"Notification"},"Notification"),c.a.createElement("option",{key:"Others",value:"Others"},"Others")),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{error:K.smsType})))),c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{htmlFor:"contents",className:"form-control-label mb-0"},"Message Body:"),c.a.createElement("div",{className:"mt-0 mb-2"},c.a.createElement("span",{className:"text-primary text-small"},c.a.createElement("strong",null,c.a.createElement("i",{className:"fa fa-info-circle"})," Quick Tip:"," "),"You can customize the message using placeholders by clicking the ones below the message box.")),c.a.createElement("textarea",{name:"contents",rows:"4",placeholder:"Write your message here ...",className:"form-control"+O.a.checkValadity("contents",K,$),value:x,onChange:function(e){j(e.target.value),s(Z().contents.length)},ref:Y({required:"Please enter your Message Body.",minLength:{value:10,message:"Message Body should be minimum of 10 characters."}})}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{error:K.contents})),c.a.createElement("div",{className:"bg-black pt-2"},c.a.createElement("span",null,c.a.createElement("strong",null,"Placeholders:")),c.a.createElement("span",{className:"float-right"},c.a.createElement("strong",null,c.a.createElement("span",{className:r>10&&r<=160?"text-success":"text-warning"},"Characters:"," "," ",r),c.a.createElement("span",{className:"text-light"}," ","|"," "),c.a.createElement("span",{className:"text-danger"},Math.ceil(r/160).toFixed(0)," Message(s)"))),c.a.createElement("div",{className:"mt-1"},c.a.createElement("span",{className:"badge pointer badge-primary pl-3 pr-3 pb-2 mr-2 mb-2",onClick:function(e){e.preventDefault(),j(x+" {firstName}")}},"First Name"),c.a.createElement("span",{className:"badge pointer badge-secondary pl-3 pr-3 pb-2 mr-2 mb-2",onClick:function(e){e.preventDefault(),j(x+"{lastName}")}},"Last Name"),c.a.createElement("span",{className:"badge pointer badge-warning pl-3 pr-3 pb-2 mr-2 mb-2",onClick:function(e){e.preventDefault(),j(x+" {senderName}")}},"Sender Name"),c.a.createElement("span",{className:"badge pointer badge-success pl-3 pr-3 pb-2 mr-2 mb-2",onClick:function(e){e.preventDefault(),j(x+" {senderEmail}")}},"Sender Email"))))),c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{htmlFor:"contacts",className:"form-control-label mb-0"},"Select Contacts:"),c.a.createElement("div",{className:"mt-0 mb-2"},c.a.createElement("span",{className:"text-primary text-small"},c.a.createElement("strong",null,c.a.createElement("i",{className:"fa fa-info-circle"})," Info:"," ")," ","Choose the Contact(s) to which this SMS message needs to be sent.")),c.a.createElement(S.a,{id:"contacts",name:"contacts",isMulti:!0,options:X,closeMenuOnSelect:!1,placeholder:"Search Messaging Contacts",onChange:ae,value:_,ref:Y({name:"contacts"},{validate:function(){return!(!_||!_.length)||"Please select at least one of the contacts"}})}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{error:K.contacts})))),c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"form-group"},c.a.createElement("div",{className:"form-control-label"},c.a.createElement("strong",null,"Save as Draft Message"),c.a.createElement("div",{className:"mt-0 mb-2"},c.a.createElement("span",{className:"text-primary text-small"},c.a.createElement("strong",null,c.a.createElement("i",{className:"fa fa-info-circle"})," Tip:"," "),"Saving the message as ",c.a.createElement("strong",null,"Draft Message"),", you can edit it later, where ",c.a.createElement("strong",null,"Final Message")," will not be editable."))),c.a.createElement("label",{className:"custom-switch mt-0 pl-0"},c.a.createElement("input",{type:"checkbox",name:"isInDraft",value:G,className:"custom-switch-input",defaultChecked:G,ref:Y()}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{error:K.isInDraft})),c.a.createElement("span",{className:"custom-switch-indicator mt-2",onClick:function(){return A(!G)}}),c.a.createElement("span",{className:"custom-switch-description mt-2",onClick:function(){return A(!G)}},G?"Yes, Save as Draft Messsage.":"Save as final Message.")))))),c.a.createElement("div",{className:"modal-footer bg-whitesmoke"},c.a.createElement("div",{className:"text-left"},c.a.createElement("button",{className:"btn btn-lg btn-primary mr-2",type:"submit"},G?"Save as Draft Message":"Save Messsage & Process Later"),c.a.createElement("button",{className:"btn btn-lg btn-danger mr-2",type:"buton","data-dismiss":"modal",onClick:e.cancel},"Cancel"))))};I.propTypes={history:r.a.any,cancel:r.a.func,contacts:r.a.arrayOf(r.a.object)};var T=Object(o.g)(c.a.memo(I)),L=window.console,V=function(e){var a=Object(n.useState)(!1),t=p()(a,2),l=t[0],r=t[1],o=Object(n.useState)(!1),i=p()(o,2),d=i[0],b=i[1],h=Object(n.useState)(!1),y=p()(h,2),C=y[0],S=y[1],k=Object(n.useState)(""),x=p()(k,2),j=x[0],O=x[1],P=Object(n.useState)({}),G=p()(P,2),F=G[0],M=G[1],I=Object(n.useState)(!1),V=p()(I,2),U=V[0],q=V[1],B=Object(n.useState)(!1),W=p()(B,2),z=W[0],Y=W[1],R=Object(n.useState)("single"),K=p()(R,2),Z=K[0],$=K[1],J=Object(n.useState)(10),Q=p()(J,2),_=Q[0],H=Q[1],X=Object(n.useState)(0),ee=p()(X,2),ae=ee[0],te=ee[1],ne=Object(n.useState)({count:0,items:[]}),ce=p()(ne,2),le=ce[0],re=ce[1],se=Object(n.useState)([]),oe=p()(se,2),me=oe[0],ie=oe[1];Object(n.useEffect)((function(){return fe(),function(){g.a.clearAllSubscriptions()}}),[]);var ue,de,pe,fe=function(){g.a.subscribe("CONTACTS:ADDED",(function(e,a){L.log("Received ".concat(e," Event")),a?Ee(a):be(ae)})),be(ae)},Ee=function(e){re((function(a){return{count:a.count++,items:[].concat(u()(a.items),[e])}}))},be=function(e){Y(!0),w.a.loadPaginatedContacts(e,_).then((function(a){Y(!1),a.success&&(te(e),H(_),re(a.result.data))}),(function(e){return L.log(e.message)})).finally((function(){Y(!1)}))},ge=function(){return le.items.filter((function(e){return!0===e.isSelected}))},Ne=function(){q(!U)},ve=function(e,a,t,n){e.preventDefault(),w.a.quickUpdateUserContact(a,t,n).then((function(e){e.success&&(re({count:le.count,items:le.items.map((function(t){return t.uuid===a?Object.assign({},e.result.data,{isSelected:t.isSelected}):t}))}),f.a.success(e.message,{position:"top-right"}))}),(function(e){f.a.error(e.message,{position:"top-right"})}))},he=function(){r(!l)},ye=function(){b(!d)},Ce=function(){S(!C)},Se=function(){return c.a.createElement("div",{className:"row align-items-center"},c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("h5",{className:"mb-0"},"New Contact's Details"),c.a.createElement("div",{className:"text-success text-small"},c.a.createElement("strong",null,c.a.createElement("i",{className:"fa fa-info-circle"})," Info:"," "),"We'll never share your information to anyone and your contact information will be saved using"," ",c.a.createElement("strong",null,"bank level security"),".")))},ke=function(){return c.a.createElement("div",{className:"row align-items-center"},c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("h5",{className:"mb-0"},"Contact Group's Details"),c.a.createElement("div",{className:"text-success text-small"},c.a.createElement("strong",null,c.a.createElement("i",{className:"fa fa-info-circle"})," Info:"," "),"Please select or create new Group with selcted contacts to be saved.")))},we=function(){return c.a.createElement("div",{className:"row align-items-center"},c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("h5",{className:"mb-0"},"SMS Message Details"),c.a.createElement("div",{className:"text-success text-small"},c.a.createElement("strong",null,c.a.createElement("i",{className:"fa fa-info-circle"})," Info:"," "),"Please fill up the form with appropriate data to send SMS to selected contacts.")))};return c.a.createElement(s.a,{in:!0,appear:!0,timeout:1500,classNames:"fade"},c.a.createElement("div",{className:"card card-primary"},c.a.createElement("div",{className:"card-header"},c.a.createElement("h4",null,c.a.createElement("div",{className:"btn pointer btn-primary btn-md ml-2 note-btn",onClick:function(){return he()}},c.a.createElement("i",{className:"fa fa-user-plus"})," "," Create New Contact"),c.a.createElement(E.b,{to:"/dashboard/contacts/groups"},c.a.createElement("div",{className:"btn pointer mb-0 btn-dark btn-md ml-2 note-btn"+(pe="/dashboard/contacts/groups",e.location.pathname===pe?" active":"")},c.a.createElement("i",{className:"fa fa-users"})," "," List Contact Groups"))),c.a.createElement("div",{className:"card-header-action"},ge().length>0&&c.a.createElement("div",{className:"btn-group mr-2",role:"group","aria-label":"Selected Contacts Actions"},c.a.createElement("button",{type:"button",className:"btn btn-primary",onClick:function(e){return e.preventDefault(),ie(le.items.filter((function(e){return!0===e.isSelected}))),void ye()}},c.a.createElement("i",{className:"fa fa-layer-group"})," Group Contacts"),c.a.createElement("button",{type:"button",className:"btn btn-success",onClick:function(e){return e.preventDefault(),ie(le.items.filter((function(e){return!0===e.isSelected}))),void Ce()}},c.a.createElement("i",{className:"fa fa-paper-plane"})," Send Message"),c.a.createElement("button",{type:"button",className:"btn btn-warning",onClick:function(e){return function(e,a){e.preventDefault(),L.log(a);var t={actionType:"bock",contacts:a.map((function(e){return e.uuid}))};w.a.blockContacts(t).then((function(e){if(e.success){var t=le.items.map((function(e){return-1!==a.indexOf(e)&&(e.isBlocked=!0,e.isSelected=!1),e}));re({count:le.count,items:t}),f.a.success(e.message,{position:"top-right"})}}),(function(e){f.a.error(e.message,{position:"top-right"})}))}(e,ge())}},c.a.createElement("i",{className:"fa fa-ban"})," Block Contacts"),c.a.createElement("button",{type:"button",className:"btn btn-danger",onClick:function(e){return a=e,t=ge(),a.preventDefault(),$("multiple"),O("Delete all selected contacts?"),M(t),void Ne();var a,t}},c.a.createElement("i",{className:"fa fa-trash"})," Delete Contacts")),c.a.createElement("span",{className:"btn btn-info btn-sm"}," ",c.a.createElement("i",{className:"fa fa-list"})," Total: ",le.count," Contacts"))),c.a.createElement("div",{className:"card-body p-0"},c.a.createElement("div",{className:"standard-table"+(z?" spinner":"")},c.a.createElement(m.a,{isLoading:z}),c.a.createElement("div",{className:"standard-table table-responsive"},c.a.createElement("table",{className:"table table-stripped"},c.a.createElement("thead",null,c.a.createElement("tr",null,c.a.createElement("th",{className:"text-center"},c.a.createElement("div",{className:"custom-checkbox custom-control"},c.a.createElement("input",{type:"checkbox",checked:ge().length===le.items.length,onChange:function(e){return a=e,void re({count:le.count,items:le.items.map((function(e){return a.target.checked?e.isSelected=!0:e.isSelected=!1,e}))});var a},className:"custom-control-input",id:"checkbox-group"}),c.a.createElement("label",{htmlFor:"checkbox-group",className:"custom-control-label"}," "))),c.a.createElement("th",null,"Contact Name"),c.a.createElement("th",null,"Country"),c.a.createElement("th",null,"Phone Number"),c.a.createElement("th",null,"Contact Tags"),c.a.createElement("th",{className:"text-center"},"Active?"),c.a.createElement("th",{className:"text-center"},"Blocked?"),c.a.createElement("th",null))),c.a.createElement("tbody",null,le.items.length?le.items.map((function(e){return c.a.createElement("tr",{key:e.uuid},c.a.createElement("td",{className:"text-center"},c.a.createElement("div",{className:"custom-checkbox custom-control"},c.a.createElement("input",{type:"checkbox",checked:(a=e.isSelected,!0===a),className:"custom-control-input",id:"checkbox-"+e.id,onChange:function(a){return t=a,n=e,void re({count:le.count,items:le.items.map((function(e){return e.uuid===n.uuid&&(t.target.checked?e.isSelected=!0:e.isSelected=!1),e}))});var t,n}}),c.a.createElement("label",{htmlFor:"checkbox-"+e.id,className:"custom-control-label"}," "))),c.a.createElement("td",null,c.a.createElement("span",{className:"pointer"+(e.isFavourite?" text-warning":"")},c.a.createElement("i",{className:"fa fa-star",onClick:function(a){return ve(a,e.uuid,"favorite",!e.isFavourite)}})),c.a.createElement("img",{alt:"image",src:"/assets/img/avatar/avatar-5.png",className:"rounded-circle mr-2 ml-3",width:"32","data-toggle":"title"}),e.firstName," ",e.lastName),c.a.createElement("td",null,c.a.createElement("span",{className:"mr-2"},e.country.name," (",e.country.dialCode,")")),c.a.createElement("td",null,c.a.createElement("span",{className:"mr-2"},e.phoneNumber),"NTC"===e.simType?c.a.createElement("span",{className:"badge custom-badge badge-info"},e.simType):"NCELL"===e.simType?c.a.createElement("span",{className:"badge custom-badge badge-primary"},e.simType):c.a.createElement("span",{className:"badge custom-badge badge-warning"},e.simType)),c.a.createElement("td",{className:"text-primary"},e.tags),c.a.createElement("td",{className:"text-center"},c.a.createElement("div",{className:"badge badge-"+(e.isActive?"success":"danger")},e.isActive?"Yes":"No")),c.a.createElement("td",{className:"text-center"},c.a.createElement("div",{className:"badge badge-"+(e.isBlocked?"success":"danger")},e.isBlocked?"Yes":"No")),c.a.createElement("td",null,c.a.createElement("div",{className:"text-right dropdown"},c.a.createElement("button",{type:"button",className:"btn btn-outline-primary btn-md","data-toggle":"dropdown"},c.a.createElement("span",{className:"fa fa-ellipsis-v"})," Actions"),c.a.createElement("div",{className:"dropdown-menu dropdown-menu-right"},c.a.createElement("div",{className:"dropdown-title"},"Actions"),c.a.createElement(E.b,{className:"dropdown-item text-primary",to:"/dashboard/contacts/"+e.uuid+"/view"},c.a.createElement("i",{className:"fa fa-eye mr-2"})," View Details"),c.a.createElement(E.b,{className:"dropdown-item text-success",to:"/dashboard/contacts/"+e.uuid+"/edit"},c.a.createElement("i",{className:"fa fa-edit mr-2"})," Edit Details"),c.a.createElement("div",{className:"dropdown-divider"}),c.a.createElement("a",{className:"dropdown-item text-danger",href:"#",onClick:function(a){return ve(a,e.uuid,"blocked",!e.isBlocked)}},c.a.createElement("i",{className:"fa fa-ban mr-2"})," ",e.isBlocked?"Unblock Contact":"Block Contact"),c.a.createElement("a",{className:"dropdown-item text-info",href:"#",onClick:function(a){return ve(a,e.uuid,"active",!e.isActive)}},c.a.createElement("i",{className:"fa fa-check-circle mr-2"})," ",e.isActive?"Deactivate":"Activate"),c.a.createElement("a",{className:"dropdown-item text-warning",href:"#",onClick:function(a){return ve(a,e.uuid,"favorite",!e.isFavourite)}},c.a.createElement("i",{className:"fa fa-star mr-2"})," ",e.isFavourite?"Remove Favorite":"Make Favorite"),c.a.createElement("div",{className:"dropdown-divider"}),c.a.createElement("a",{className:"dropdown-item has-icon text-danger",href:"#",onClick:function(a){return t=e,a.preventDefault(),$("single"),O("Delete contact?"),M(t),void Ne();var t}},c.a.createElement("i",{className:"fa fa-trash-alt mr-2"})," Delete Contact")))));var a})):c.a.createElement("tr",{className:"text-warning text-center"},c.a.createElement("td",{colSpan:7},c.a.createElement("strong",null,c.a.createElement("i",{className:"fa fa-info-circle"})," Info:"),c.a.createElement("span",{className:"mr-4"}," There are no contacts yet!")))))))),c.a.createElement("div",{className:"card-footer"},(ue=le.count||0,de=Math.ceil(ue/_),c.a.createElement("nav",{"aria-label":"Contacts Pagination"},c.a.createElement("ul",{className:"pagination justify-content-center mb-0"},c.a.createElement("li",{className:"page-item "+(ae<=0?"disabled":"")},c.a.createElement("button",{type:"button",className:"page-link",tabIndex:"-1",onClick:function(){return be(ae-1)}},c.a.createElement("i",{className:"fas fa-angle-left"}),c.a.createElement("span",{className:"sr-only"},"Previous"))),function(){for(var e=[],a=function(a){e.push(c.a.createElement("li",{className:"page-item"+(a===ae?" active":""),key:a,onClick:function(){return be(a)}},c.a.createElement("button",{type:"button",className:"page-link"},a+1)))},t=0;t<de;t++)a(t);return c.a.createElement(n.Fragment,null,e)}(),c.a.createElement("li",{className:"page-item "+(de===ae+1?"disabled":"")},c.a.createElement("button",{type:"button",className:"page-link",onClick:function(){return be(ae+1)}},c.a.createElement("i",{className:"fas fa-angle-right"}),c.a.createElement("span",{className:"sr-only"},"Next"))))))),c.a.createElement(N.a,{isOpen:l,header:c.a.createElement(Se,null),content:c.a.createElement(D,{cancel:he}),closeModal:he}),c.a.createElement(N.a,{isOpen:d,header:c.a.createElement(ke,null),content:c.a.createElement(A,{cancel:ye,contacts:me}),closeModal:ye}),c.a.createElement(N.a,{isOpen:C,header:c.a.createElement(we,null),content:c.a.createElement(T,{cancel:Ce,contacts:me}),closeModal:Ce}),c.a.createElement(v.a,{isOpen:U,title:j,content:"Are you sure you want to delete all selected contacts?",closeModal:Ne,confirm:"single"===Z?function(e){q(!U),w.a.deleteContactById(e.uuid).then((function(a){a.success?(f.a.success(a.message,{position:"top-right"}),re({count:le.count--,items:le.items.filter((function(a){return a.uuid!==e.uuid}))})):f.a.error(a.message,{position:"top-right"})}),(function(e){f.a.error(e.message,{position:"top-right"})}))}:function(e){q(!U),L.log(e);var a={actionType:"delete",contacts:e.map((function(e){return e.uuid}))};w.a.deleteContacts(a).then((function(a){if(a.success){var t=le.items.filter((function(a){return-1===e.indexOf(a)}));re({count:t.length,items:t}),f.a.success(a.message,{position:"top-right"})}}),(function(e){f.a.error(e.message,{position:"top-right"})}))},cancel:function(){q(!U)},data:F})))};V.propTypes={title:r.a.string,location:r.a.object};var U=Object(o.g)(c.a.memo(V)),q=function(e){var a=Object(n.useState)({}),t=p()(a,2),l=t[0],r=t[1],o=Object(n.useState)(!1),i=p()(o,2),u=i[0],d=i[1];Object(n.useEffect)((function(){f()}),[]);var f=function(){d(!0),w.a.loadContactByUuid(e.match.params.contactId).then((function(e){r(e.result.data),d(!1)}))};return c.a.createElement("div",{className:u?"spinner":""},c.a.createElement(m.a,{isLoading:u}),c.a.createElement(s.a,{timeout:1500,classNames:"fade"},c.a.createElement("div",{className:"card card-info"},c.a.createElement("div",{className:"card-header"},c.a.createElement("h4",null,c.a.createElement("i",{className:"fa fa-address-card"})," Contact Details")),c.a.createElement("div",{className:"card-body"},c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-6"},c.a.createElement("div",{className:"mt-2 mb-1 section-title"},"Full Name:"),c.a.createElement("div",{className:"card card-body bg-light mb-1"},c.a.createElement("span",{className:"font-weight-bold"},l.firstName," ",l.lastName))),c.a.createElement("div",{className:"col-lg-6"},c.a.createElement("div",{className:"mt-2 mb-1 section-title"},"Email:"),c.a.createElement("div",{className:"card card-body bg-light mb-1"},c.a.createElement("span",{className:"font-weight-bold"},l.email||"Not Available"))),c.a.createElement("div",{className:"col-lg-6"},c.a.createElement("div",{className:"mt-2 mb-1 section-title"},"Phone Number:"),c.a.createElement("div",{className:"card card-body bg-light mb-1"},c.a.createElement("span",{className:"font-weight-bold"},void 0!==l.country?l.country.dialCode:""," ",l.phoneNumber," (",l.simType,")"))),c.a.createElement("div",{className:"col-lg-6"},c.a.createElement("div",{className:"mt-2 mb-1 section-title"},"Tags:"),c.a.createElement("div",{className:"card card-body bg-light mb-1"},c.a.createElement("span",{className:"font-weight-bold"},l.tags||"Not Available"))),c.a.createElement("div",{className:"col-lg-6"},c.a.createElement("div",{className:"mt-2 mb-1 section-title"},"Notes:"),c.a.createElement("div",{className:"card card-body bg-light mb-1"},c.a.createElement("span",{className:"font-weight-bold"},l.notes||"Not Available"))))),c.a.createElement("div",{className:"card-footer"},c.a.createElement(E.b,{className:"btn btn-lg btn-primary mr-2",to:"/dashboard/contacts/"+l.uuid+"/edit"},c.a.createElement("i",{className:"fa fa-edit mr-2"})," Edit Contact"),c.a.createElement(E.b,{className:"btn btn-lg btn-danger mr-2",to:"/dashboard/contacts"},"Cancel")))))};q.propTypes={title:r.a.string,match:r.a.any};var B=Object(o.g)(q),W=function(e){var a=Object(n.useState)(!0),t=p()(a,2),l=t[0],r=t[1],s=Object(n.useState)(!1),o=p()(s,2),i=o[0],u=o[1],d=Object(n.useState)([]),E=p()(d,2),b=E[0],N=E[1],v=Object(n.useState)([]),h=p()(v,2),y=h[0],j=h[1],O=Object(C.a)(),P=O.register,D=O.handleSubmit,G=O.errors,A=O.formState,F=b.map((function(e){return{label:e.firstName+" "+(e.lastName?e.lastName:""),value:e.id,data:e}}));Object(n.useEffect)((function(){M()}),[]);var M=function(){w.a.loadAllContacts().then((function(e){e.success&&N(e.result.data)}))};return c.a.createElement(c.a.Fragment,null,c.a.createElement("form",{onSubmit:D((function(a,t){u(!0),a.contacts=y.map((function(e){return e.data})),x.a.createGroup(a).then((function(a){a.success&&(g.a.publish("GROUPS:ADDED",a.result.data),f.a.success(a.message,{position:"top-right"}),t.target.reset(),e.cancel())}),(function(e){return f.a.error(e.message,{position:"top-right"})})).finally((function(){u(!1)}))}))},c.a.createElement("div",{className:"modal-body "+(i?"spinner pl-0":"")},c.a.createElement(m.a,{isLoading:i}),c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"mb-4"},c.a.createElement("div",{className:"heading-md text-muted"},"Group Details"),c.a.createElement("div",{className:"text-primary text-label"},"Create a group with multiple contacts. ",c.a.createElement("strong",null," Note:"),c.a.createElement("span",{className:"text-danger"}," *")," fields are required fields."))),c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{className:"form-control-label",htmlFor:"group-name"},"Group Name: ",c.a.createElement("span",{className:"text-danger"},"*")),c.a.createElement("input",{type:"text",id:"group-name",name:"name",className:"form-control",placeholder:"What would you call your group?",ref:P({required:"Please enter the group name."})}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{field:"Group Name",error:G.name}))))),c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{htmlFor:"notes",className:"form-control-label"},"Group Notes: ",c.a.createElement("span",{className:"text-danger"},"*")),c.a.createElement("textarea",{id:"notes",name:"notes",rows:"3",className:"form-control",placeholder:"Write that will help you learn about the group ...",ref:P({required:"Please enter the details about the group",minLength:{value:10,message:"Group Notes must contain at least 10 characters."},maxLength:{value:200,message:"Group Notes shouldn't contain more than 200 characters."}})}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{field:"Group Description",error:G.notes})))),c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{htmlFor:"contacts",className:"form-control-label"},"Select Contacts:"),c.a.createElement(S.a,{id:"contacts",name:"contacts",isMulti:!0,options:F,closeMenuOnSelect:!1,placeholder:"Search Contacts",onChange:function(e){e&&j(e)},value:y}),c.a.createElement("div",{className:"help-block text-primary text-label"},c.a.createElement("strong",null,c.a.createElement("i",{className:"fa fa-info-circle"})," Info:"," "),"Enter few characters to start searching. Selected contacts will automatically be assigned to the group."))),c.a.createElement("div",{className:"col-lg-5"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{className:"custom-switch mt-0 pl-0"},c.a.createElement("input",{name:"isActive",type:"checkbox",value:l,className:"custom-switch-input",defaultChecked:l,ref:P()}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{error:G.isActive})),c.a.createElement("span",{className:"custom-switch-indicator",onClick:function(){return r(!l)}}),c.a.createElement("span",{className:"custom-switch-description"},"Keep as active group?")))))))),c.a.createElement("div",{className:"modal-footer bg-whitesmoke"},c.a.createElement("div",{className:"text-left"},c.a.createElement("button",{className:"btn btn-lg btn-success mr-2",type:"reset"},"Clear Form"),c.a.createElement("button",{className:"btn btn-lg btn-primary mr-2",disabled:A.isSubmitting,type:"submit"},"Save Messaging Group"),c.a.createElement("button",{className:"btn btn-lg btn-danger mr-2",type:"button","data-dismiss":"modal",onClick:e.cancel},"Cancel")))))};W.propTypes={cancel:r.a.func};var z=W,Y=window.console,R=function(e){var a=Object(n.useState)(!1),t=p()(a,2),l=t[0],r=t[1],o=Object(n.useState)(!1),i=p()(o,2),d=i[0],b=i[1],v=Object(n.useState)(10),h=p()(v,2),y=h[0],C=h[1],S=Object(n.useState)(0),k=p()(S,2),w=k[0],j=k[1],O=Object(n.useState)({count:0,items:[]}),P=p()(O,2),D=P[0],G=P[1];Object(n.useEffect)((function(){return I(),function(){g.a.clearAllSubscriptions()}}),[]);var A,F,M,I=function(){g.a.subscribe("GROUPS:ADDED",(function(e,a){"GROUPS:ADDED"===e&&L(a)})),T(w)},T=function(e){r(!0),x.a.listUserGroups(e,y).then((function(a){r(!1),a.success&&(j(e),C(y),G(a.result.data))}),(function(e){r(!1),Y.log(e.message)}))},L=function(e){G((function(a){return{count:a.count++,items:[].concat(u()(a.items),[e])}}))},V=function(e,a,t,n){e.preventDefault(),x.a.quickUpdateUserGroup(a,t,n).then((function(e){e.success&&(G({count:D.count,items:D.items.map((function(t){return t.uuid===a?e.result.data:t}))}),f.a.success(e.message,{position:"top-right"}))}),(function(e){f.a.error(e.message,{position:"top-right"})}))},U=function(){b(!d)},q=function(){return c.a.createElement("div",{className:"row align-items-center"},c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("h3",{className:"mb-0"},"Create Messaging Group "),c.a.createElement("span",{className:"text-success text-label"},c.a.createElement("strong",null,c.a.createElement("i",{className:"fa fa-info-circle"})," Info:"," "),"Your contact group information will be saved using ",c.a.createElement("strong",null,"bank level security"),".")))};return c.a.createElement(s.a,{in:!0,appear:!0,timeout:1500,classNames:"fade"},c.a.createElement("div",{className:"card"},c.a.createElement("div",{className:"card-header"},c.a.createElement("h4",null,c.a.createElement("span",{className:"btn pointer btn-primary btn-md ml-2",onClick:function(){return U()}},c.a.createElement("i",{className:"fa fa-plus"})," Create New Group"),c.a.createElement(E.b,{to:"/dashboard/contacts"},c.a.createElement("span",{className:"btn pointer mb-0 btn-dark btn-md ml-2"+(M="/dashboard/contacts",e.location.pathname===M?" active":"")},c.a.createElement("i",{className:"fa fa-list"})," "," List All Contacts"))),c.a.createElement("div",{className:"card-header-action"},c.a.createElement("span",{className:"btn btn-info btn-sm"},c.a.createElement("i",{className:"fa fa-list"})," Total: ",D.count," Groups"))),c.a.createElement("div",{className:"card-body p-0 "+(l?"spinner":"")},c.a.createElement(m.a,{isLoading:l}),c.a.createElement("div",{className:"standard-table table-responsive "},c.a.createElement("table",{className:"table table-stripped"},c.a.createElement("thead",null,c.a.createElement("tr",null,c.a.createElement("th",null),c.a.createElement("th",null,"Group Name"),c.a.createElement("th",{className:"text-center"},"Total Contacts"),c.a.createElement("th",null,"Group Notes"),c.a.createElement("th",{className:"text-center"},"Active?"),c.a.createElement("th",null))),c.a.createElement("tbody",null,D.items.length?D.items.map((function(e){return c.a.createElement("tr",{key:e.uuid},c.a.createElement("td",{className:"text-center"},c.a.createElement("span",{className:e.isFavorite?"text-warning":"",type:"button"},c.a.createElement("i",{className:"fa fa-star",onClick:function(a){return V(a,e.uuid,"favorite",!e.isFavorite)}}))),c.a.createElement("td",null,e.name),c.a.createElement("td",{className:"text-center"},c.a.createElement("span",{className:"badge badge-"+(e.contactsCount>0?"primary":"danger")},e.contactsCount||0," Contacts")),c.a.createElement("td",null,e.notes),c.a.createElement("td",{className:"text-center"},c.a.createElement("div",{className:"badge badge-"+(e.isActive?"success":"danger")},e.isActive?"Yes":"No")),c.a.createElement("td",null,c.a.createElement("div",{className:"text-center dropdown"},c.a.createElement("button",{type:"button",className:"btn btn-outline-primary btn-md","data-toggle":"dropdown"},c.a.createElement("span",{className:"fa fa-ellipsis-v"})," Actions"),c.a.createElement("div",{className:"dropdown-menu"},c.a.createElement("div",{className:"dropdown-title"},"Actions"),c.a.createElement(E.b,{className:"dropdown-item has-icon text-primary",to:"/dashboard/contacts/groups/"+e.uuid+"/view"},c.a.createElement("i",{className:"fas fa-eye"})," View Group Details"),c.a.createElement(E.b,{className:"dropdown-item has-icon text-success",to:"/dashboard/contacts/groups/"+e.uuid+"/edit"},c.a.createElement("i",{className:"far fa-edit"})," Edit Group Details"),c.a.createElement("div",{className:"dropdown-divider"}),c.a.createElement("a",{className:"dropdown-item text-info",href:"#",onClick:function(a){return V(a,e.uuid,"active",!e.isActive)}},c.a.createElement("i",{className:"fa fa-check-circle mr-2"})," ",e.isActive?"Deactivate":"Activate"),c.a.createElement("a",{className:"dropdown-item text-warning",href:"#",onClick:function(a){return V(a,e.uuid,"favorite",!e.isFavorite)}},c.a.createElement("i",{className:"fa fa-star mr-2"})," ",e.isFavorite?"Remove Favorite":"Make Favorite"),c.a.createElement("div",{className:"dropdown-divider"}),c.a.createElement("a",{className:"dropdown-item has-icon text-danger",href:"#",onClick:function(a){return t=a,n=e.uuid,t.preventDefault(),void x.a.deleteGroupById(n).then((function(e){e.success&&(G({count:D.count--,items:D.items.filter((function(e){return e.uuid!==n}))}),f.a.success(e.message,{position:"top-right"}))}));var t,n}},c.a.createElement("i",{className:"fas fa-trash-alt"})," Delete Group")))))})):c.a.createElement("tr",{className:"text-warning text-center"},c.a.createElement("td",{colSpan:7},c.a.createElement("strong",null,c.a.createElement("i",{className:"fa fa-info-circle"})," Info:"," "),c.a.createElement("span",{className:"mr-4"},"There are no groups yet!"))))))),c.a.createElement("div",{className:"card-footer"},(A=D.count||0,F=Math.ceil(A/y),c.a.createElement("nav",{"aria-label":"Groups Pagination"},c.a.createElement("ul",{className:"pagination justify-content-center mb-0"},c.a.createElement("li",{className:"page-item "+(w<=0?"disabled":"")},c.a.createElement("button",{type:"button",className:"page-link",tabIndex:"-1",onClick:function(){return T(w-1)}},c.a.createElement("i",{className:"fas fa-angle-left"}),c.a.createElement("span",{className:"sr-only"},"Previous"))),function(){for(var e=[],a=function(a){e.push(c.a.createElement("li",{className:"page-item"+(a===w?" active":""),key:a,onClick:function(){return T(a)}},c.a.createElement("button",{type:"button",className:"page-link"},a+1)))},t=0;t<F;t++)a(t);return c.a.createElement(n.Fragment,null,e)}(),c.a.createElement("li",{className:"page-item "+(F===w+1?"disabled":"")},c.a.createElement("button",{type:"button",className:"page-link",onClick:function(){return T(w+1)}},c.a.createElement("i",{className:"fas fa-angle-right"}),c.a.createElement("span",{className:"sr-only"},"Next"))))))),c.a.createElement(N.a,{isOpen:d,header:c.a.createElement(q,null),content:c.a.createElement(z,{cancel:U}),closeModal:U})))};R.propTypes={title:r.a.string,location:r.a.object};var K=Object(o.g)(c.a.memo(R)),Z=function(e){var a=Object(n.useState)(!1),t=p()(a,2),l=t[0],r=t[1],s=Object(n.useState)(!1),o=p()(s,2),i=o[0],u=o[1],d=Object(n.useState)([]),b=p()(d,2),N=b[0],v=b[1],h=Object(n.useState)([]),y=p()(h,2),j=y[0],O=y[1],P=Object(C.a)(),D=P.register,G=P.handleSubmit,A=P.errors,F=P.formState,M=Object(n.useState)({uuid:"",name:"",notes:"",contacts:[],isActive:!0}),I=p()(M,2),T=I[0],L=I[1],V=N.map((function(e){return{label:e.firstName+" "+(e.lastName?e.lastName:""),value:e.id,data:e}}));Object(n.useEffect)((function(){U()}),[]);var U=function(){r(!0),x.a.getGroup(e.match.params.groupId).then((function(e){e.success&&(L(e.result.data),u(e.result.data.isActive),O(e.result.data.contacts.map((function(e){return{label:e.firstName+" "+(e.lastName?e.lastName:""),value:e.uuid,data:e}}))))}),(function(e){return f.a.error(e.message,{position:"top-right"})})).finally((function(){r(!1)})),w.a.loadAllContacts().then((function(e){e.success&&v(e.result.data)}))};return c.a.createElement("div",{className:"card "+(l?"spinner":"")},c.a.createElement(m.a,{isLoading:l}),c.a.createElement("form",{onSubmit:G((function(a,t){t.preventDefault(),r(!0),a.contacts=j.map((function(e){return e.data})),x.a.updateGroup(a,e.match.params.groupId).then((function(e){e.success&&(g.a.publish("GROUPS:ADDED",e.result.data),f.a.success(e.message,{position:"top-right"}))}),(function(e){return f.a.error(e.message,{position:"top-right"})})).finally((function(){r(!1)}))}))},c.a.createElement("div",{className:"modal-header"},c.a.createElement("div",{className:"row align-items-center"},c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("h3",{className:"mb-0"},"Update Messaging Group "),c.a.createElement("span",{className:"text-success"},c.a.createElement("strong",null,c.a.createElement("i",{className:"fa fa-info-circle"})," Info:"," "),"Your contact group information will be saved using ",c.a.createElement("strong",null,"bank level security"),".")))),c.a.createElement("div",{className:"card-body"},c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"mb-4"},c.a.createElement("div",{className:"heading-md text-muted"},"Group Details"),c.a.createElement("span",{className:"text-primary"},"Combine multiple contacts in a group."))),c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{className:"form-control-label",htmlFor:"group-name"},"Group Name:"),c.a.createElement("input",{type:"text",id:"group-name",name:"name",defaultValue:T.name,className:"form-control",placeholder:"Enter your messaging group name",ref:D({required:"Please enter the proper group name."})}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{field:"Group Name",error:A.name}))))),c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{htmlFor:"contents",className:"form-control-label"},"Group Notes:"),c.a.createElement("textarea",{name:"notes",rows:"5",defaultValue:T.notes,className:"form-control",placeholder:"Write that will help you learn about the group ...",ref:D({required:"Please enter the details about the group",minLength:{value:10,message:"Group Notes must contain at least 10 characters."},maxLength:{value:200,message:"Group Notes shouldn't contain more than 200 characters."}})}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{field:"Group Description",error:A.description})))),c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{htmlFor:"contacts",className:"form-control-label"},"Select Contacts:"),c.a.createElement(S.a,{id:"contacts",name:"contacts",isMulti:!0,options:V||[],closeMenuOnSelect:!1,placeholder:"Select Contacts to attach to this Group",onChange:function(e){O(e)},value:j}),c.a.createElement("div",{className:"help-block text-primary text-small"},c.a.createElement("strong",null,c.a.createElement("i",{className:"fa fa-info-circle"})," Info:"," "),"Selected contacts will automatically be assigned to the group."))),c.a.createElement("div",{className:"col-lg-5"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{className:"custom-switch mt-0 pl-0"},c.a.createElement("input",{name:"isActive",type:"checkbox",value:i,className:"custom-switch-input",checked:i,ref:D(),onChange:function(e){return e}}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{error:A.isActive})),c.a.createElement("span",{className:"custom-switch-indicator",onClick:function(){return u(!i)}}),c.a.createElement("span",{className:"custom-switch-description"},"Keep as active group?")))))))),c.a.createElement("div",{className:"card-footer bg-whitesmoke"},c.a.createElement("div",{className:"text-left"},c.a.createElement("button",{className:"btn btn-lg btn-primary mr-2",disabled:F.isSubmitting,type:"submit"},"Update Messaging Group"),c.a.createElement(E.b,{className:"btn btn-lg btn-danger mr-2",to:"/dashboard/contacts/groups"},"Cancel")))))};Z.propTypes={history:r.a.any,match:r.a.object};var $=Object(o.g)(c.a.memo(Z)),J=function(e){var a=Object(n.useState)({}),t=p()(a,2),l=t[0],r=t[1],s=Object(n.useState)(!1),o=p()(s,2),i=o[0],u=o[1];Object(n.useEffect)((function(){d()}),[]);var d=function(){u(!0),x.a.getGroup(e.match.params.groupId).then((function(e){r(e.result.data),u(!1)}))};return c.a.createElement("div",{className:i?"spinner":""},c.a.createElement(m.a,{isLoading:i}),c.a.createElement("div",{className:"card card-info"},c.a.createElement("div",{className:"card-header"},c.a.createElement("h4",null,c.a.createElement("i",{className:"fa fa-address-card"})," Group Details")),c.a.createElement("div",{className:"card-body"},c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-6"},c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"mt-2 mb-1 section-title"},"Group Name:"),c.a.createElement("div",{className:"card card-body bg-light mb-1"},c.a.createElement("span",{className:"font-weight-bold"},l.name))),c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"mt-2 mb-1 section-title"},"Group Notes:"),c.a.createElement("div",{className:"card card-body bg-light mb-1"},c.a.createElement("span",{className:"font-weight-bold"},l.notes))),c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"mt-2 mb-1 section-title"},"Status:"),c.a.createElement("div",{className:"card card-body bg-light mb-1"},c.a.createElement("span",{className:"font-weight-bold"},l.isActive?"Active":"Disabled"))))),c.a.createElement("div",{className:"col-lg-6"},c.a.createElement("div",{className:"mt-2 mb-1 section-title"},"Group Contacts:"),c.a.createElement("div",{className:"row"},l.contacts&&l.contacts.map((function(e,a){return c.a.createElement("div",{key:e.uuid,className:"mb-2 mt-2 col-lg-4"},c.a.createElement("img",{alt:"image",src:"/assets/img/avatar/avatar-5.png",className:"rounded-circle mr-2",width:"28","data-toggle":"title"}),c.a.createElement("span",{className:"font-weight-bold"},a+1,". ",e.firstName," ",e.lastName),c.a.createElement("span",{className:"font-weight-bold"},e.tags))})))))),c.a.createElement("div",{className:"card-footer"},c.a.createElement(E.b,{className:"btn btn-lg btn-primary mr-2",to:"/dashboard/contacts/groups/"+l.uuid+"/edit"},c.a.createElement("i",{className:"far fa-edit"})," Edit Group"),c.a.createElement(E.b,{className:"btn btn-lg btn-danger mr-2",to:"/dashboard/contacts/groups"},"Cancel"))))};J.propTypes={title:r.a.string,match:r.a.any};var Q=Object(o.g)(J),_=function(e){var a=Object(n.useState)(!1),t=p()(a,2),l=t[0],r=t[1],s=Object(n.useState)(!0),o=p()(s,2),i=o[0],u=o[1],d=Object(n.useState)([]),b=p()(d,2),g=b[0],N=b[1],v=Object(n.useState)([]),h=p()(v,2),y=h[0],P=h[1],D=Object(n.useState)([]),G=p()(D,2),A=G[0],F=G[1],M=Object(n.useState)(null),I=p()(M,2),T=I[0],L=I[1],V=Object(C.a)(),U=V.register,q=V.handleSubmit,B=V.errors,W=V.formState,z=Object(n.useState)({uuid:"",name:"",notes:"",groups:[],isActive:!0,country:{id:""}}),Y=p()(z,2),R=Y[0],K=Y[1],Z=g.map((function(e){return{label:e.name+" ("+e.contactsCount+")",value:e.id,data:e}})),$=y.map((function(e){return{label:e.name+" ("+e.dialCode+")",value:e.id,data:e}}));Object(n.useEffect)((function(){J()}),[]);var J=function(){r(!0),j.a.getCountries().then((function(e){P(e.result.data)})),x.a.loadAllGroups().then((function(e){N(e.result.data)})),w.a.loadContactByUuid(e.match.params.contactId).then((function(e){e.success&&(r(!1),K(e.result.data),u(e.result.data.isActive),L(void 0!==e.result.data.country?{label:e.result.data.country.name+" ("+e.result.data.country.dialCode+")",value:e.result.data.country.id,data:e.result.data.country}:null),F(void 0!==e.result.data.groups?e.result.data.groups.map((function(e){return{label:e.name,value:e.uuid,data:e}})):[]))}))};return c.a.createElement("div",{className:"card"},c.a.createElement("form",{onSubmit:q((function(a,t){return t.preventDefault(),r(!0),a.country=T.data,a.groups=A.map((function(e){return e.data})),w.a.updateContact(e.match.params.contactId,a).then((function(e){e.success&&f.a.success(e.message,{position:"top-right"}),r(!1)}),(function(e){f.a.error(e.message,{position:"top-right"}),r(!1)}))}))},c.a.createElement("div",{className:"modal-header"},c.a.createElement("div",{className:"row align-items-center"},c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("h5",{className:"mb-0"},"Update Contact's Details"),c.a.createElement("div",{className:"text-info text-md"},c.a.createElement("strong",null,c.a.createElement("i",{className:"fa fa-info-circle"})," Info:"," "),"We'll never share your information to anyone and your contact information will be saved using"," ",c.a.createElement("strong",null,"bank level security"),".")))),c.a.createElement("div",{className:"card-body "+(l?"spinner":"")},c.a.createElement(m.a,{isLoading:l}),c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-10"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{htmlFor:"groups",className:"form-control-label"},"Select Contact Groups:"),c.a.createElement(S.a,{id:"groups",name:"groups",isMulti:!0,options:Z||[],value:A,closeMenuOnSelect:!1,placeholder:"Search Contact Groups",onChange:function(e){F(e)}}),c.a.createElement("div",{className:"help-block text-primary text-md"},c.a.createElement("strong",null,c.a.createElement("i",{className:"fa fa-info-circle"})," Info:"," "),"If you select any groups, the created contact will automatically be linked to the selected group. If not, you can always add later.")))),c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-10"},c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-6"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{className:"form-control-label",htmlFor:"input-first-name"},"First Name: ",c.a.createElement("span",{className:"text-danger"},"*")),c.a.createElement("input",{id:"input-first-name",name:"firstName",defaultValue:R.firstName,className:"form-control"+O.a.checkValadity("firstName",B,W),placeholder:"Enter First Name",ref:U({required:"Please enter first name."})}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{error:B.firstName})))),c.a.createElement("div",{className:"col-lg-6"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{className:"form-control-label",htmlFor:"input-last-name"},"Last Name: ",c.a.createElement("span",{className:"text-danger"},"*")),c.a.createElement("input",{id:"input-last-name",name:"lastName",defaultValue:R.lastName,className:"form-control"+O.a.checkValadity("lastName",B,W),placeholder:"Enter Last Name",ref:U({required:"Please enter last name."})}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{error:B.lastName}))))),c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-6"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{htmlFor:"country",className:"form-control-label"},"Choose Country:"),c.a.createElement(S.a,{id:"country",name:"country",options:$||[],value:T,placeholder:"Search Country",onChange:function(e){L(e)},ref:U({name:"country"},{validate:function(){return!!T||"Please select a country"}})}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{error:B.country})))),c.a.createElement("div",{className:"col-lg-5"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{className:"form-control-label",htmlFor:"input-phone-number"},"Phone Number: ",c.a.createElement("span",{className:"text-danger"},"*")),c.a.createElement("input",{id:"input-phone-number",name:"phoneNumber",defaultValue:R.phoneNumber,className:"form-control"+O.a.checkValadity("phoneNumber",B,W),placeholder:"Enter Phone Number",ref:U({required:"Enter contact phone number.",minLength:{value:9,message:"Phone Number should be of 9 digits."},maxLength:{value:13,message:"Phone Number should be of 13 digits."},pattern:{value:/^[0-9]{9,13}$/i,message:"Entered phone number is not a valid number."}})}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{error:B.phoneNumber}))))),c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-6"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{className:"form-control-label",htmlFor:"input-email"},"Email Address:"),c.a.createElement("input",{id:"input-email",name:"email",defaultValue:R.email,className:"form-control"+O.a.checkValadity("email",B,W),placeholder:"john@example.com",ref:U({pattern:{value:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i,message:"Invalid Email address provided."}})}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{error:B.email})))),c.a.createElement("div",{className:"col-lg-6"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{htmlFor:"tags",className:"form-control-label"},"Add Tags:"),c.a.createElement("input",{type:"text",id:"tags",name:"tags",className:"form-control",placeholder:"#artist, #designer, #cyclist, #teacher, ...",defaultValue:R.tags,ref:U}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{field:"Tags",error:B.tags}))))),c.a.createElement("div",{className:"row"},c.a.createElement("div",{className:"col-lg-12"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{htmlFor:"notes",className:"form-control-label"},"Notes for the contact:"),c.a.createElement("textarea",{name:"notes",rows:"3",className:"form-control",placeholder:"A few words about your contact ...",defaultValue:R.notes,ref:U}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{field:"Contact Notes",error:B.description})))),c.a.createElement("div",{className:"col-lg-10"},c.a.createElement("div",{className:"form-group"},c.a.createElement("label",{htmlFor:"isActive",className:"custom-switch mt-0 pl-0"},c.a.createElement("input",{id:"isActive",name:"isActive",type:"checkbox",value:i,className:"custom-switch-input",checked:i,ref:U(),onChange:function(e){return e}}),c.a.createElement("div",{className:"help-block"},c.a.createElement(k.a,{error:B.isActive})),c.a.createElement("span",{className:"custom-switch-indicator",onClick:function(){return u(!i)}}),c.a.createElement("span",{className:"custom-switch-description"},"Keep as an active contact?")))))))),c.a.createElement("div",{className:"card-footer bg-whitesmoke"},c.a.createElement("div",{className:"text-left"},c.a.createElement("button",{className:"btn btn-lg btn-primary mr-2",disabled:W.isSubmitting,type:"submit"},"Update Contact Details"),c.a.createElement(E.b,{className:"btn btn-lg btn-danger mr-2",to:"/dashboard/contacts"},"Cancel")))))};_.propTypes={history:r.a.any,match:r.a.object};var H=Object(o.g)(c.a.memo(_)),X=[{path:"/dashboard/contacts",exact:!0,sidebar:function(){return c.a.createElement("div",null,"User's Contacts")},main:function(){return c.a.createElement(c.a.Suspense,{fallback:c.a.createElement(m.a,{isLoading:!0})},c.a.createElement(U,{title:"User Contacts"}))}},{path:"/dashboard/contacts/groups",exact:!0,sidebar:function(){return c.a.createElement("div",null,"Contact's Groups")},main:function(){return c.a.createElement(c.a.Suspense,{fallback:c.a.createElement(m.a,{isLoading:!0})},c.a.createElement(K,{title:"Contact Groups"}))}},{path:"/dashboard/contacts/:contactId/view",exact:!0,sidebar:function(){return c.a.createElement("div",null,"Contact Details")},main:function(){return c.a.createElement(c.a.Suspense,{fallback:c.a.createElement(m.a,{isLoading:!0})},c.a.createElement(B,{title:"Contact Detail Page"}))}},{path:"/dashboard/contacts/:contactId/edit",exact:!0,sidebar:function(){return c.a.createElement("div",null,"Contact Edit View")},main:function(){return c.a.createElement(c.a.Suspense,{fallback:c.a.createElement(m.a,{isLoading:!0})},c.a.createElement(H,{title:"Contact Edit Page"}))}},{path:"/dashboard/contacts/groups/:groupId/view",exact:!0,sidebar:function(){return c.a.createElement("div",null,"Contact Group Detail")},main:function(){return c.a.createElement(c.a.Suspense,{fallback:c.a.createElement(m.a,{isLoading:!0})},c.a.createElement(Q,{title:"Group Detail Page"}))}},{path:"/dashboard/contacts/groups/:groupId/edit",exact:!0,sidebar:function(){return c.a.createElement("div",null,"Edit Group Detail")},main:function(){return c.a.createElement(c.a.Suspense,{fallback:c.a.createElement(m.a,{isLoading:!0})},c.a.createElement($,{title:"Group Edit Page"}))}}],ee=function(){Object(n.useEffect)((function(){e()}),[]);var e=function(){var e=document.createElement("script");e.src="/assets/modules/prism/prism.js",e.async=!0,document.body.appendChild(e)};return c.a.createElement("div",null,c.a.createElement(o.d,null,X.map((function(e,a){return c.a.createElement(o.b,{key:a,path:e.path,exact:e.exact})}))),c.a.createElement("section",{className:"section"},c.a.createElement(s.a,{in:!0,appear:!0,timeout:500,classNames:"hero"},c.a.createElement("div",{className:"section-header"},c.a.createElement("h5",{className:"mb-0 mr-5"},c.a.createElement("i",{className:"fa fa-users"})," Users Contacts"),c.a.createElement("div",{className:"section-header-breadcrumb"},c.a.createElement("div",{className:"breadcrumb-item active"},c.a.createElement("a",{href:"#"},"Dashboard")),c.a.createElement("div",{className:"breadcrumb-item"},"Contacts or Groups")))),c.a.createElement(s.a,{in:!0,appear:!0,timeout:500,classNames:"fade"},c.a.createElement("div",{className:"section-body"},c.a.createElement("div",{className:"alert alert-light alert-has-icon"},c.a.createElement("div",{className:"alert-icon text-warning"},c.a.createElement("i",{className:"far fa-lightbulb"})),c.a.createElement("div",{className:"alert-body"},c.a.createElement("span",{className:"close","data-dismiss":"alert"},c.a.createElement("span",null,"×")),c.a.createElement("div",{className:"pt-1"},c.a.createElement("span",{className:"text-primary"},"Note: ",c.a.createElement("strong",null,"Blocked")," and ",c.a.createElement("strong",null,"in-active")," contacts will ",c.a.createElement("strong",null,"not be available")," for use in SMS. So, make sure the contacts are active before use.")))),c.a.createElement(o.d,null,X.map((function(e,a){return c.a.createElement(o.b,{key:a,path:e.path,exact:e.exact,children:c.a.createElement(e.main,null)})})))))))};ee.propTypes={history:r.a.any,location:r.a.any};a.default=Object(o.g)(ee)},46:function(e,a,t){"use strict";var n=t(25),c={createGroup:function(e){return n.a.post("/groups/create",e,!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},updateGroup:function(e,a){return n.a.update("/groups/"+a,e,!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},quickUpdateUserGroup:function(e,a,t){return n.a.get("/user/groups/"+e+"/quick-update/"+a+"/"+t,!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},getGroup:function(e){return n.a.get("/groups/"+e,!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},assignContactsToGroup:function(e){return n.a.post("/groups/assign-contacts",e,!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},listUserGroups:function(e,a){return n.a.get("/user/groups/"+e+"/"+a,!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},loadAllGroups:function(){return n.a.get("/user/groups",!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},deleteGroupById:function(e){return n.a.delete("/groups/".concat(e),!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))}};a.a=c},52:function(e,a,t){"use strict";var n=t(25),c={createContact:function(e){return n.a.post("/contacts/create",e,!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},loadAllContacts:function(){return n.a.get("/user/contacts",!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},updateContact:function(e,a){return n.a.update("/user/contacts/"+e,a,!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},quickUpdateUserContact:function(e,a,t){return n.a.get("/user/contacts/"+e+"/quick-update/"+a+"/"+t,!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},uploadContacts:function(e){var a=new FormData;return a.append("action","import-contacts"),e.files.forEach((function(e){return a.append("files",e)})),n.a.post("/import/contacts",a,!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},uploadGroupContacts:function(e){var a=new FormData;return a.append("groups",e.groups),e.files.forEach((function(e){return a.append("files",e)})),n.a.post("/import/group/contacts",a,!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},searchContacts:function(e){return n.a.get("/user/contacts/search?query="+e,!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},loadContactByUuid:function(e){return n.a.get("/user/contacts/"+e,!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},loadPaginatedContacts:function(e,a){return n.a.get("/user/contacts/"+e+"/"+a,!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},blockContacts:function(e){return n.a.post("/user/contacts/block",e,!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},deleteContacts:function(e){return n.a.post("/user/contacts/delete",e,!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},deleteContactById:function(e){return n.a.delete("/user/contacts/".concat(e),!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))}};a.a=c},60:function(e,a,t){"use strict";var n=t(25),c={createNewSms:function(e){return n.a.post("/smses/create",e,!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},updateSms:function(e){return n.a.update("/smses/".concat(e.uuid),e,!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},loadSmsMessages:function(){return n.a.get("user/smses",!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},deleteSmsById:function(e){return n.a.delete("/smses/".concat(e),!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},getSmsMessage:function(e){return n.a.get("/smses/".concat(e),!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},startSmsProcessing:function(e){return n.a.post("/smses/".concat(e,"/schedule"),{},!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},getSmsMessageSchedule:function(e,a,t,c){return n.a.get("/smses/".concat(e,"/schedule/").concat(t,"/").concat(c,"?status=").concat(a),!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))},loadPaginatedSmsMessages:function(e,a,t){return n.a.get("/user/smses/"+a+"/"+t+"?status="+e,!0).then((function(e){return Promise.resolve(e)}),(function(e){return Promise.reject(e)}))}};a.a=c}}]);