HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/buyercall/build/public/contact_note_js.af0ee87acaba89076fcb.js
/*! For license information please see contact_note_js.af0ee87acaba89076fcb.js.LICENSE.txt */
(()=>{var __webpack_modules__={"./buyercall/assets/scripts/mobile/contact_note.js":()=>{eval('$(function () {\n  getContactNoteList();\n  end_url = location.href.split(\'/\')[5];\n  $("#nav-details").attr("href", "/mobile/contact_detail/" + end_url + location.search);\n  $("#nav-timeline").attr("href", "/mobile/timeline/" + end_url + location.search);\n});\nfunction getContactNoteList() {\n  params = new URLSearchParams(location.search);\n  username = params.get(\'username\');\n  password = params.get(\'password\');\n  contact_id = window.location.pathname.split(\'/\')[3];\n  $.ajax({\n    type: "GET",\n    url: "/mobile/contact_notes_list/" + contact_id,\n    data: {\n      "username": username,\n      "password": password\n    },\n    success: function success(result) {\n      $("#notesList").html(result.html_content);\n      $(\'.notes-edit-btn\').click(function () {\n        $(this).closest(".message-wrapper").find(\'.message p\').attr("contenteditable", true);\n        $(this).closest(".notes-card").find(\'.save-note-btn\').attr("hidden", false);\n      });\n      $(\'.save-note-btn\').click(function () {\n        para = $(this).closest(".notes-card").find(\'.message p\');\n        para.attr("contenteditable", false);\n        updateNote(para.text(), para.attr("data-id"));\n        $(this).attr("hidden", true);\n      });\n      $(".rm-note-btn").click(function () {\n        note_id = $(this).attr("data-id");\n        $("#dlt-note-id").val(note_id);\n        $("#removeToModal").modal("show");\n      });\n    }\n  });\n}\nfunction createNote(note) {\n  params = new URLSearchParams(location.search);\n  username = params.get(\'username\');\n  password = params.get(\'password\');\n  contact_id = window.location.pathname.split(\'/\')[3];\n  $.ajax({\n    type: "POST",\n    url: "/mobile/add_note/" + contact_id,\n    data: {\n      "username": username,\n      "password": password,\n      "note": note\n    },\n    success: function success(result) {\n      if (result.status) {\n        window.location.reload();\n      } else {\n        $("#addNoteModal").modal("hide");\n        $("#error-msg").text(result.error);\n        $("#validationError").modal(\'show\');\n      }\n    }\n  });\n}\nfunction updateNote(note, note_id) {\n  params = new URLSearchParams(location.search);\n  username = params.get(\'username\');\n  password = params.get(\'password\');\n  contact_id = window.location.pathname.split(\'/\')[3];\n  $.ajax({\n    type: "POST",\n    url: "/mobile/edit_note/" + contact_id,\n    data: {\n      "username": username,\n      "password": password,\n      "note": note,\n      "note_id": note_id\n    },\n    success: function success(result) {\n      if (result.status) {\n        // window.location.reload();\n      }\n    }\n  });\n}\nfunction deleteNote(note_id) {\n  params = new URLSearchParams(location.search);\n  username = params.get(\'username\');\n  password = params.get(\'password\');\n  $.ajax({\n    type: "POST",\n    url: "/mobile/delete_note/" + note_id,\n    data: {\n      "username": username,\n      "password": password\n    },\n    success: function success(result) {\n      if (result.status) {\n        window.location.reload();\n      }\n    }\n  });\n}\n$("#add-note-button").on("click", function () {\n  note = $("#new-note").val();\n  createNote(note);\n});\n$(".btn-dlt").on("click", function () {\n  note = $("#dlt-note-id").val();\n  deleteNote(note);\n});\n$("#back-to-contact").on("click", function () {\n  if ($(".save-note-btn:visible").length) {\n    $("#modal-ok-link").attr("href", "/mobile/contact_leads/detail" + location.search);\n    $("#backToModal").modal(\'show\');\n  } else {\n    location.href = "/mobile/contact_leads/detail" + location.search;\n  }\n});\n\n//# sourceURL=webpack:///./buyercall/assets/scripts/mobile/contact_note.js?')}},__webpack_exports__={};__webpack_modules__["./buyercall/assets/scripts/mobile/contact_note.js"]()})();