The user can now update his profile details in /edit-profile link
This commit is contained in:
parent
94521f66b0
commit
3df13da6ae
1 changed files with 33 additions and 17 deletions
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
{% block page_content %}
|
||||
<div class="user-content" style="max-width: 500px; padding: 50px 0px;">
|
||||
<div class="alert alert-warning" id="message" style="display: none;"></div>
|
||||
<form>
|
||||
<div class="alert alert-warning message" style="display: none;"></div>
|
||||
<form role = "form">
|
||||
<fieldset>
|
||||
<label>{{ _("Full Name") }}</label>
|
||||
<input class="form-control" type="text" id="fullname" value="{{ user.full_name or "" }}">
|
||||
|
|
@ -16,31 +16,47 @@
|
|||
<label>{{ _("Phone") }}</label>
|
||||
<input class="form-control" type="text" id="phone" value="{{ user.phone or "" }}">
|
||||
</fieldset>
|
||||
<button id="update_user" type="submit" class="btn btn-default">{{ _("Update") }}</button>
|
||||
<button type="submit" class="btn btn-default" id="update_user">{{ _("Update") }}</button>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
frappe.ready(function() {
|
||||
$("#fullname").val(getCookie("full_name") || "");
|
||||
$("#update_user").click(function() {
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
frappe.ready(function(){
|
||||
$("#update_user").on("click",function(){
|
||||
var name = document.getElementById("fullname").value;
|
||||
var phone = document.getElementById("phone").value;
|
||||
|
||||
frappe.call({
|
||||
method: "frappe.templates.pages.edit_profile.update_user",
|
||||
type: "POST",
|
||||
method: "frappe.www.edit_profile.update_user",
|
||||
btn: $("#update_user"),
|
||||
args: {
|
||||
fullname: $("#fullname").val(),
|
||||
org_name: $("#org_name").val(),
|
||||
phone: $("#phone").val()
|
||||
fullname: name,
|
||||
phone: phone
|
||||
},
|
||||
btn: this,
|
||||
msg: $("#message"),
|
||||
callback: function(r) {
|
||||
if(!r.exc) $("#user-full-name").html($("#fullname").val());
|
||||
if(r.message) {
|
||||
frappe.msgprint(__(r.message));
|
||||
setTimeout(function() {
|
||||
window.location.href = "/edit-profile";
|
||||
},2000);
|
||||
}
|
||||
if(r.exc) {
|
||||
frappe.msgprint(r.exc);
|
||||
setTimeout(function() {
|
||||
window.location.href = "/me";
|
||||
},2000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
return false;
|
||||
})
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue