From: soufiane Date: Tue, 30 Apr 2024 13:19:07 +0000 (+0200) Subject: wip #6882 @3:00 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=b3b5e5dd3b983ffc735af3f49283d750827c7b7a;p=bastide-resah.git wip #6882 @3:00 --- diff --git a/resources/webflow/css/custom.css b/resources/webflow/css/custom.css index 6c7401a..2f98175 100644 --- a/resources/webflow/css/custom.css +++ b/resources/webflow/css/custom.css @@ -47,7 +47,7 @@ color: #000; height: 100%; width: 100%; - min-height: 25vh; + //min-height: 25vh; min-width: 320px; max-width: 336px; margin: 0 auto; @@ -121,7 +121,7 @@ a.back { font-weight: 700; } -#register, .form-header { +#register, .form-header, #send_email_forgotpass { background-color: rgba(59, 74, 153); color: #ffffff; } @@ -166,16 +166,16 @@ input { display: flex; flex-direction: column; } -#Bastide_register_form .form-controls { +.form-controls { margin-bottom: 1.25em; display: flex; flex-direction: column; } -#Bastide_register_form .form-controls label { +.form-controls label { margin-bottom: .625em; text-transform: uppercase; } -#Bastide_register_form .form-controls input { +.form-controls input { height: 30px; } #Bastide_register_form a { diff --git a/resources/webflow/index.html b/resources/webflow/index.html index 5eed13e..0a6a029 100644 --- a/resources/webflow/index.html +++ b/resources/webflow/index.html @@ -20,6 +20,7 @@
+
@@ -47,7 +48,7 @@
Ce compte n'existe pas !
- Mot de passe oublié ? + Mot de passe oublié ?
ou
@@ -56,7 +57,7 @@

Pas encore inscrit ?

- créer un compte + créer un compte
@@ -82,4 +83,4 @@ - \ No newline at end of file + diff --git a/resources/webflow/js/custom.js b/resources/webflow/js/custom.js index c432d3f..fd2fe2c 100644 --- a/resources/webflow/js/custom.js +++ b/resources/webflow/js/custom.js @@ -1,15 +1,11 @@ -function getCaption(title) { - $('#Bastide_cart .caption').remove() - return `

${title}

` +function Cart() { + this.init(); } -$(function () { - console.log($('meta[name="csrf-token"]')); - $('#wf-form-login').attr('action', '/landing/login'); - $("#wf-form-login").append(''); - - var mview = `
`; - var registerForm = `
+Cart.prototype = { + init: function() { + var $this = this + var registerForm = `
établissement hospitalier @@ -72,74 +68,245 @@ $(function () {
` - $(document).on("click", "#create-account", function() { - $("#viewOverlay").addClass("active") - $("section.main").append(mview) - $("section.main #view").addClass("active").append(registerForm) - $("#Bastide_cart").prepend(getCaption('Créer un compte')) - }) - $(document).on("submit", "#wf-form-login", function(e) { - e.preventDefault() - let formData = $(this).serialize() - var $this = this - $.ajax({ - url: '/fluidbook/login', - type: 'POST', - data: formData, - success: function(data) { - window.location.href = window.location.href+'catalogue' - }, - error: function(xhr, status, error) { - $(".errors-container").remove() - $(".error").removeClass("error") - $("#wf-form-login").addClass("error").prepend('

Une erreur est survenue. Verifiez vos identifiants.

') + $(document).on("click", '[data-action]', function () { + let title = $(this).data('title') + let action = $(this).data('action') + $this.openModal(title, $this.getCartContent('register')) + $this.updateTitle(title) + $this.updateCart(action) + $this.updateDataContent() + }); + + $(document).on("submit", "#wf-form-login", function(e) { + e.preventDefault() + let formData = $(this).serialize() + var $this = this + $.ajax({ + url: '/fluidbook/login', + type: 'POST', + data: formData, + success: function(data) { + window.location.href = window.location.href+'catalogue' + }, + error: function(xhr, status, error) { + $(".errors-container").remove() + $(".error").removeClass("error") + $("#wf-form-login").addClass("error").prepend('

Une erreur est survenue. Verifiez vos identifiants.

') + } + }); + }); + + $(document).on("submit", "#Bastide_register_form", function(e) { + e.preventDefault() + let formData = $(this).serialize() + $this.register(formData) + }) + + $(document).on("submit", "#Bastide_forgotpass_form", function(e) { + e.preventDefault() + let formData = $(this).serialize() + $this.forgotpass(formData) + }) + + $(document).on("click", "#send_email_forgotpass", function(e) { + e.preventDefault() + $this.forgotpass() + }) + + + /** + * + * Close view + * + */ + $(document).on("click", "#closeview", function() { + $this.closeView() + }) + + $(document).mouseup(function(e) + { + var container = $("#Bastide_cart"); + + // if the target of the click isn't the container nor a descendant of the container + if (!container.is(e.target) && container.has(e.target).length === 0) + { + $this.closeView() } }); - }); + }, - $(document).on("submit", "#Bastide_register_form", function(e) { - e.preventDefault() - var $this = this - let formData = $(this).serialize() + getCaption: function(title) { + return `

${title}

` + }, + + updateDataContent: function () { + let dataContent = $("#Bastide_auth_form").find('[data-content]').data('content') + $("#Bastide_cart").attr('data-content',dataContent) + }, + + updateTitle: function(title = "Connexion") { + $("#mview-dialog-title").text(title) + }, + + openModal: function (title, content) { + let $this = this + let view = "
" + view += `
+ ${this.getCaption(title)} +
+ ${content} +
+
`; + view += "
"; + $("section.main").append(view) + $("#viewOverlay,#view").addClass("active") + }, + + getCartContent: function (action = null) { + let form = `
`; + switch (action) { + case 'register': + form += `
+
+
+ établissement hospitalier +
+
+ + +
+
+ + +
+
+
+
+ Contact +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+ +
` + break; + case 'register_ok': + form += `

Votre demande de création de compte sera examinée dans les plus brefs délais. + Vous recevrez un email de confirmation dans les 24h (pensez à vérifier votre dossier spam).

+

Nos équipes commerciales se tiennent à votre disposition : + resah@bastide-medical.fr

+
` + break; + case 'forgot_pass': + form += `
+
+ + +
+ +
` + break; + case 'forgot_pass_notif': + form += `

Vous allez recevoir un email avec un lien vous permettant de redéfinir votre mot de passe.

+
` + break; + default: + form += `` + } + form += `
`; + return form; + }, + + updateCart: function (content = null) { + if ($('#Bastide_cart').length > 0) { + $('#Bastide_cart .content').html(this.getCartContent(content)); + } + }, + + closeView: function() { + $("#viewOverlay").removeClass("active") + $("#view").remove() + }, + register: function(d) { + var $this = this $.ajax({ url: '/fluidbook/signin', type: 'POST', - data: formData, + data: d, success: function(data) { - $("#Bastide_cart").attr("data-content","").prepend(getCaption('Merci !')) - $("#Bastide_auth_form").html(`

Votre demande de création de compte sera examinée dans les plus brefs délais. - Vous recevrez un email de confirmation dans les 24h (pensez à vérifier votre dossier spam).

-

Nos équipes commerciales se tiennent à votre disposition : - resah@bastide-medical.fr

-
`) + $this.updateTitle('Merci !') + $this.updateCart('register_ok') + $this.updateDataContent() }, error: function(xhr, status, error) { - let errors = JSON.parse(xhr.responseText); - $("#Bastide_register_form .errors-container").remove() - $(".error").removeClass("error") - for(let k in errors['errors']) { - $("#Bastide_register_form [name="+k+"]").parent().append('
') - $(".errors-container").parent().addClass("error") - for(let i in errors['errors'][k]) { - $("#Bastide_register_form [name="+k+"]").parent().find('.errors-container').append(`
${errors['errors'][k][i]}
`) - } - } + let errorsMessage = JSON.parse(xhr.responseText); + $this.displayErrors(errorsMessage) } }); - }) + }, - $(document).mouseup(function(e) - { - var container = $("#Bastide_cart"); + forgotpass: function(d) { + //do action + this.updateCart('forgot_pass_notif') + this.updateDataContent() + }, - // if the target of the click isn't the container nor a descendant of the container - if (!container.is(e.target) && container.has(e.target).length === 0) - { - $("#viewOverlay").removeClass("active") - $("#view").remove() + displayErrors: function(errors) { + $("#Bastide_auth_form .errors-container").remove() + $(".error").removeClass("error") + for(let k in errors['errors']) { + $("#Bastide_auth_form [name="+k+"]").parent().append('
') + $(".errors-container").parent().addClass("error") + for(let i in errors['errors'][k]) { + $("#Bastide_auth_form [name="+k+"]").parent().find('.errors-container').append(`
${errors['errors'][k][i]}
`) + } } - }); + }, +} + +$(function () { + $('#wf-form-login').attr('action', '/landing/login'); + $("#wf-form-login").append(''); + const cart = new Cart(); });