You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

63 lines
1.5 KiB

  1. {% extends "templates/web.html" %}
  2. {% block title %} {{ "Edit Profile" }} {% endblock %}
  3. {% block header %}<h2>{{ _("Edit Profile") }}</h2>{% endblock %}
  4. {% block page_content %}
  5. <div class="user-content" style="max-width: 500px; padding: 50px 0px;">
  6. <div class="alert alert-warning message" style="display: none;"></div>
  7. <form role = "form">
  8. <fieldset>
  9. <label>{{ _("Full Name") }}</label>
  10. <input class="form-control" type="text" id="fullname" value="{{ user.full_name or "" }}">
  11. </fieldset>
  12. <fieldset>
  13. <label>{{ _("Phone") }}</label>
  14. <input class="form-control" type="text" id="phone" value="{{ user.phone or "" }}">
  15. </fieldset>
  16. <button type="submit" class="btn btn-default" id="update_user">{{ _("Update") }}</button>
  17. </form>
  18. </div>
  19. <script type="text/javascript">
  20. frappe.ready(function(){
  21. $("#update_user").on("click",function(){
  22. var name = document.getElementById("fullname").value;
  23. var phone = document.getElementById("phone").value;
  24. frappe.call({
  25. type: "POST",
  26. method: "frappe.www.edit_profile.update_user",
  27. btn: $("#update_user"),
  28. args: {
  29. fullname: name,
  30. phone: phone
  31. },
  32. callback: function(r) {
  33. if(r.message) {
  34. frappe.msgprint(__(r.message));
  35. setTimeout(function() {
  36. window.location.href = "/edit-profile";
  37. },2000);
  38. }
  39. if(r.exc) {
  40. frappe.msgprint(r.exc);
  41. setTimeout(function() {
  42. window.location.href = "/me";
  43. },2000);
  44. }
  45. }
  46. });
  47. return false;
  48. });
  49. });
  50. </script>
  51. {% endblock %}