From 65eccde4874cbaee015b60be3c09ddfc4aeaf1eb Mon Sep 17 00:00:00 2001 From: ArtemB Date: Fri, 15 Dec 2023 15:44:23 +0300 Subject: [PATCH] 0.0.326 upd change_profile --- static/js/user_profile_2.js | 45 ++++++++++++----------- templates/blocks/profile/b_chats.html | 4 +- templates/blocks/profile/b_new_route.html | 2 +- templates/blocks/profile/b_profile.html | 8 ++-- templates/forms/f_commercial_offer.html | 2 +- templates/forms/f_feedback_form.html | 2 +- templates/forms/f_registration.html | 2 +- 7 files changed, 35 insertions(+), 30 deletions(-) diff --git a/static/js/user_profile_2.js b/static/js/user_profile_2.js index a04102d..69ff70c 100644 --- a/static/js/user_profile_2.js +++ b/static/js/user_profile_2.js @@ -367,25 +367,26 @@ async function attachFilemeassge (el,id_ticket=null,sender=null,receiver=null,ch function change_profile_confirm (el){ event.preventDefault() let form = el.form - let changed_elements = {} - for (let i = 0;i < form.length;i++){ - let cur_el = form[i] - if (cur_el.localName !== 'button'){ - let new_val = cur_el.value - let dataset = cur_el.dataset - let old_val = '' - if (dataset){ - old_val = dataset['initialValue'] - } - // if (old_val){ - if (old_val === new_val){ - // - } else { - changed_elements[cur_el.name] = cur_el.value - } - } - // } - } + let formData = new FormData(form); + // let changed_elements = {} + // for (let i = 0;i < form.length;i++){ + // let cur_el = form[i] + // if (cur_el.localName !== 'button'){ + // let new_val = cur_el.value + // let dataset = cur_el.dataset + // let old_val = '' + // if (dataset){ + // old_val = dataset['initialValue'] + // } + // // if (old_val){ + // if (old_val === new_val){ + // // + // } else { + // changed_elements[cur_el.name] = cur_el.value + // } + // } + // // } + // } $.ajax({ @@ -397,7 +398,8 @@ function change_profile_confirm (el){ processData: false, contentType: false, // enctype: 'json', - data: JSON.stringify(changed_elements), + // data: JSON.stringify(changed_elements), + data: formData, success: function(data){ middleWareJS() @@ -406,7 +408,8 @@ function change_profile_confirm (el){ }, error: function (data){ - document.querySelector(".avatar_user_profile").innerHTML = data.responseJSON.html; + // document.querySelector(".avatar_user_profile").innerHTML = data.responseJSON.html; + document.querySelector(".info_profile").innerHTML = data.responseJSON.html; } }); diff --git a/templates/blocks/profile/b_chats.html b/templates/blocks/profile/b_chats.html index 155ef38..54fbdfe 100644 --- a/templates/blocks/profile/b_chats.html +++ b/templates/blocks/profile/b_chats.html @@ -65,7 +65,9 @@ {{ cur_receiver.last_name }} {{ cur_receiver.first_name }}
- + + +
diff --git a/templates/blocks/profile/b_new_route.html b/templates/blocks/profile/b_new_route.html index de74afc..83850dc 100644 --- a/templates/blocks/profile/b_new_route.html +++ b/templates/blocks/profile/b_new_route.html @@ -404,7 +404,7 @@ /> {% if not errors_off and form.errors and form.errors.phone %} - {{ form.errors.phone }} + {{ form.errors.phone|safe }} {% endif %} diff --git a/templates/blocks/profile/b_profile.html b/templates/blocks/profile/b_profile.html index 9e068f1..9ae5e68 100644 --- a/templates/blocks/profile/b_profile.html +++ b/templates/blocks/profile/b_profile.html @@ -37,10 +37,10 @@
- {% if profileForm.errors.tel %}
{{ profileForm.errors.tel }}
{% endif %} + {% if profileForm.errors.tel %}
{{ profileForm.errors.tel|safe }}
{% endif %}
- + {% if profileForm.errors.email %}
{{ profileForm.errors.email }}
{% endif %}
@@ -58,11 +58,11 @@
- +
- +
diff --git a/templates/forms/f_commercial_offer.html b/templates/forms/f_commercial_offer.html index 316f0db..1bdc86d 100644 --- a/templates/forms/f_commercial_offer.html +++ b/templates/forms/f_commercial_offer.html @@ -27,7 +27,7 @@ onkeydown = "hideErrors(this)" placeholder="{% translate 'Телефон' %}"{% if form.phone %} value="{{ form.phone }}"{% endif %}> {% if form.errors.phone %} - {{ form.errors.phone }} + {{ form.errors.phone|safe }} {% endif %} diff --git a/templates/forms/f_feedback_form.html b/templates/forms/f_feedback_form.html index 2cf9f50..02d8103 100644 --- a/templates/forms/f_feedback_form.html +++ b/templates/forms/f_feedback_form.html @@ -42,7 +42,7 @@ onkeydown ="hideErrors(this)" placeholder="{% translate 'Телефон' %}"{% if form.phone %} value="{{ form.phone }}"{% endif %}> {% if form.errors.phone %} - {{ form.errors.phone }} + {{ form.errors.phone|safe }} {% endif %} diff --git a/templates/forms/f_registration.html b/templates/forms/f_registration.html index 13a4cb4..cc06312 100644 --- a/templates/forms/f_registration.html +++ b/templates/forms/f_registration.html @@ -62,7 +62,7 @@ {% if form.data.tel %} value="{{ form.data.tel }}"{% endif %}> {% if form.errors and form.errors.tel %} - {{ form.errors.tel }} + {{ form.errors.tel|safe }} {% endif %}