You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.9 KiB
52 lines
1.9 KiB
const fields = ['civility', 'first_name', 'last_name', 'email_address', 'address', 'postal_code', 'city', 'phone'];
|
|
const formID = "my-account-form";
|
|
const MyAccount = {
|
|
create: () => {
|
|
MyAccount.confirm('Êtes-vous sûr de vouloir vous inscrire?', () => {
|
|
const formData = $("#"+formID).serializeArray();
|
|
Helper.help.ajax(app.get_vars().baseurl + "mon-compte/create", "post", formData, (result) => {
|
|
if (app.isalive(result)) {
|
|
app._notify(result.mtype, result.message);
|
|
if (result.mtype == "success")
|
|
location.href = app.get_vars().baseurl + "authenticate";
|
|
// else if (result.mtype == "error")
|
|
// campaign_ma.response.populateErrFields(result.mdetail);
|
|
}
|
|
});
|
|
});
|
|
},
|
|
|
|
update: (userId = null) => {
|
|
if (!userId) return;
|
|
MyAccount.confirm('Are you sure you want to save changes?', () => {
|
|
const formData = $("#"+formID).serializeArray();
|
|
Helper.help.ajax(app.get_vars().baseurl + `mon-compte/update/${userId}`, "post", formData, (result) => {
|
|
if (app.isalive(result)) {
|
|
app._notify(result.mtype, result.message);
|
|
if (result.mtype == "success")
|
|
window.setTimeout(() =>{location.reload();}, 3000);
|
|
}
|
|
});
|
|
});
|
|
},
|
|
|
|
confirm: (msg, cb) => {
|
|
app.modal.confirm_box({
|
|
title: 'Confirmer l’action',
|
|
className: 'my-modal-with-md event-normal-registration-cont-modal',
|
|
message: msg,
|
|
buttons: {
|
|
confirm: {
|
|
label: app.get_vars()._app.btn._confirm,
|
|
className: "btn-default-style"
|
|
},
|
|
cancel: {
|
|
label: app.get_vars()._app.btn._close,
|
|
className: "btn-default-style2"
|
|
}
|
|
},
|
|
_continue: cb
|
|
});
|
|
}
|
|
|
|
}
|