diff --git a/static/js/user_profile_2.js b/static/js/user_profile_2.js index 8e03dc7..3a37efe 100644 --- a/static/js/user_profile_2.js +++ b/static/js/user_profile_2.js @@ -244,26 +244,43 @@ 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 + } + } + // } } $.ajax({ headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, - url: '/user_account/change_avatar_confirm/', + url: '/user_account/change_profile_confirm/', type: "POST", // async: true, cache: false, processData: false, contentType: false, // enctype: 'json', - data: JSON.stringify(data), + data: JSON.stringify(changed_elements), success: function(data){ middleWareJS() - document.querySelector(".avatar_user_profile").src = data.url; + document.querySelector(".info_profile").innerHTML = data.html; }, error: function (data){ diff --git a/templates/blocks/profile/b_profile.html b/templates/blocks/profile/b_profile.html index a783d3d..5995af7 100644 --- a/templates/blocks/profile/b_profile.html +++ b/templates/blocks/profile/b_profile.html @@ -19,42 +19,44 @@
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
-
+
-
- - -
-
- - -
- +
+ + +
+
+ + +
+ -
\ No newline at end of file +
+ \ No newline at end of file