0.0.293
This commit is contained in:
@@ -244,26 +244,43 @@ async function attachFilemeassge (el,id_ticket=null,sender=null,receiver=null,ch
|
|||||||
}
|
}
|
||||||
|
|
||||||
function change_profile_confirm (el){
|
function change_profile_confirm (el){
|
||||||
|
event.preventDefault()
|
||||||
let form = el.form
|
let form = el.form
|
||||||
|
let changed_elements = {}
|
||||||
for (let i = 0;i < form.length;i++){
|
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({
|
$.ajax({
|
||||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||||
url: '/user_account/change_avatar_confirm/',
|
url: '/user_account/change_profile_confirm/',
|
||||||
type: "POST",
|
type: "POST",
|
||||||
// async: true,
|
// async: true,
|
||||||
cache: false,
|
cache: false,
|
||||||
processData: false,
|
processData: false,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
// enctype: 'json',
|
// enctype: 'json',
|
||||||
data: JSON.stringify(data),
|
data: JSON.stringify(changed_elements),
|
||||||
success: function(data){
|
success: function(data){
|
||||||
middleWareJS()
|
middleWareJS()
|
||||||
|
|
||||||
document.querySelector(".avatar_user_profile").src = data.url;
|
document.querySelector(".info_profile").innerHTML = data.html;
|
||||||
|
|
||||||
},
|
},
|
||||||
error: function (data){
|
error: function (data){
|
||||||
|
|||||||
@@ -19,42 +19,44 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="clear_both"></div>
|
<div class="clear_both"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container_form_profile">
|
<form name="form_user_data">
|
||||||
<div class="container_el_form_profile">
|
<div class="container_form_profile">
|
||||||
<label class="label_f_profile" for="name"><span class="orange-text">*</span> Ваше имя</label>
|
<div class="container_el_form_profile">
|
||||||
<input class="input_f_profile" type="text" id="id_firstname" name="firstname" {% if profileForm.initial.firstname %}value="{{ profileForm.initial.firstname }}" {% endif %} >
|
<label class="label_f_profile" for="name"><span class="orange-text">*</span> Ваше имя</label>
|
||||||
</div>
|
<input class="input_f_profile" type="text" id="id_firstname" name="firstname" {% if profileForm.initial.firstname %}value="{{ profileForm.initial.firstname }}" {% endif %} {% if profileForm.initial.firstname %}data-initial-value="{{ profileForm.initial.firstname }}"{% else %}data-initial-value=""{% endif %} >
|
||||||
<div class="container_el_form_profile">
|
</div>
|
||||||
<label class="label_f_profile" for="id_lastname"><span class="orange-text">*</span> Ваша фамилия</label>
|
<div class="container_el_form_profile">
|
||||||
<input class="input_f_profile" type="text" id="id_lastname" name="lastname" {% if profileForm.initial.lastname %}value="{{ profileForm.initial.lastname }}" {% endif %}>
|
<label class="label_f_profile" for="id_lastname"><span class="orange-text">*</span> Ваша фамилия</label>
|
||||||
</div>
|
<input class="input_f_profile" type="text" id="id_lastname" name="lastname" {% if profileForm.initial.lastname %}value="{{ profileForm.initial.lastname }}" {% endif %} {% if profileForm.initial.lastname %}data-initial-value="{{ profileForm.initial.lastname }}"{% else %}data-initial-value=""{% endif %}>
|
||||||
<div class="container_el_form_profile">
|
</div>
|
||||||
<label class="label_f_profile" for="id_tel"><span class="orange-text">*</span> Номер телефона</label>
|
<div class="container_el_form_profile">
|
||||||
<input class="input_f_profile" type="text" id="id_tel" name="tel" {% if profileForm.initial.tel %}value="{{ profileForm.initial.tel }}" {% endif %}>
|
<label class="label_f_profile" for="id_tel"><span class="orange-text">*</span> Номер телефона</label>
|
||||||
</div>
|
<input class="input_f_profile" type="text" id="id_tel" name="tel" {% if profileForm.initial.tel %}value="{{ profileForm.initial.tel }}" {% endif %} {% if profileForm.initial.tel %}data-initial-value="{{ profileForm.initial.tel }}"{% else %}data-initial-value=""{% endif %}>
|
||||||
<div class="container_el_form_profile">
|
</div>
|
||||||
<label class="label_f_profile" for="id_email"><span class="orange-text">*</span> Е-mail</label>
|
<div class="container_el_form_profile">
|
||||||
<input class="input_f_profile" type="text" id="id_email" name="email" {% if profileForm.initial.email %}value="{{ profileForm.initial.email }}" {% endif %}>
|
<label class="label_f_profile" for="id_email"><span class="orange-text">*</span> Е-mail</label>
|
||||||
</div>
|
<input class="input_f_profile" type="text" id="id_email" name="email" {% if profileForm.initial.email %}value="{{ profileForm.initial.email }}" {% endif %} {% if profileForm.initial.email %}data-initial-value="{{ profileForm.initial.email }}"{% else %}data-initial-value=""{% endif %}>
|
||||||
<div class="container_el_form_profile">
|
</div>
|
||||||
<label class="label_f_profile" for="id_country"><span class="orange-text">*</span> Страна проживания</label>
|
<div class="container_el_form_profile">
|
||||||
<input class="input_f_profile" type="text" id="id_country" name="country" {% if profileForm.initial.country %}value="{{ profileForm.initial.country }}" {% endif %}>
|
<label class="label_f_profile" for="id_country"><span class="orange-text">*</span> Страна проживания</label>
|
||||||
</div>
|
<input class="input_f_profile" type="text" id="id_country" name="country" {% if profileForm.initial.country %}value="{{ profileForm.initial.country }}" {% endif %} {% if profileForm.initial.country %}data-initial-value="{{ profileForm.initial.country }}"{% else %}data-initial-value=""{% endif %}>
|
||||||
<div class="container_el_form_profile">
|
</div>
|
||||||
<label class="label_f_profile" for="id_city"><span class="orange-text">*</span> Город проживаня</label>
|
<div class="container_el_form_profile">
|
||||||
<input class="input_f_profile" type="text" id="id_city" name="city" {% if profileForm.initial.city %}value="{{ profileForm.initial.city }}" {% endif %}>
|
<label class="label_f_profile" for="id_city"><span class="orange-text">*</span> Город проживаня</label>
|
||||||
</div>
|
<input class="input_f_profile" type="text" id="id_city" name="city" {% if profileForm.initial.city %}value="{{ profileForm.initial.city }}" {% endif %} {% if profileForm.initial.city %}data-initial-value="{{ profileForm.initial.city }}"{% else %}data-initial-value=""{% endif %}>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="line_f_form_profile"></div>
|
<div class="line_f_form_profile"></div>
|
||||||
|
|
||||||
<div class="container_el_form_profile">
|
<div class="container_el_form_profile">
|
||||||
<label class="label_f_profile" for="id_password"><span class="orange-text">*</span> Новый пароль</label>
|
<label class="label_f_profile" for="id_password"><span class="orange-text">*</span> Новый пароль</label>
|
||||||
<input class="input_f_profile" type="text" id="id_password" name="password" {% if profileForm.initial.password %}value="{{ profileForm.initial.password }}" {% endif %}>
|
<input class="input_f_profile" type="text" id="id_password" name="password" {% if profileForm.initial.password %}value="{{ profileForm.initial.password }}" {% endif %} {% if profileForm.initial.password %}data-initial-value="{{ profileForm.initial.password }}"{% else %}data-initial-value=""{% endif %}>
|
||||||
</div>
|
</div>
|
||||||
<div class="container_el_form_profile">
|
<div class="container_el_form_profile">
|
||||||
<label class="label_f_profile" for="id_confirm_password"><span class="orange-text">*</span> Подвердить пароль</label>
|
<label class="label_f_profile" for="id_confirm_password"><span class="orange-text">*</span> Подвердить пароль</label>
|
||||||
<input class="input_f_profile" type="text" id="id_confirm_password" name="confirm_password" {% if profileForm.initial.confirm_password %}value="{{ profileForm.initial.confirm_password }}" {% endif %}>
|
<input class="input_f_profile" type="text" id="id_confirm_password" name="confirm_password" {% if profileForm.initial.confirm_password %}value="{{ profileForm.initial.confirm_password }}" {% endif %} {% if profileForm.initial.confirm_password %}data-initial-value="{{ profileForm.initial.confirm_password }}"{% else %}data-initial-value=""{% endif %}>
|
||||||
</div>
|
</div>
|
||||||
<button class="confirm_profile_btn">Сохарнить</button>
|
<button class="confirm_profile_btn" onclick="change_profile_confirm(this)">Сохарнить</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
Reference in New Issue
Block a user