function callpostnotification() { $("#page_main_div").load( "html_modules/postnotificationRead.html", function() { document.getElementById("display_module_name").innerHTML = "Post Notification"; document.getElementById("module_name_for_save").value = "Post Notification"; getDefaultHeadFooterLinks("Post Notification"); getPostnotificationDetails(); } ); } function getPostnotificationDetails() { $.ajax({ type: "POST", url: $host_url + "getPostnotificationDetails", success: bulidPostNotificationTable }); } function bulidPostNotificationTable(response) { response = eval("(" + response + ")"); // console.log("resresresponsesese",response); var result = response.data; html = ""; console.log("resultresultresult", result); html += ``; for (var i = 0; i < result.length; i++) { // console.log("asaasasa",result['i']); let row = result[i]; html += ` `; } html += `
Sl No. Label File Name From Date From To Order Action
${i + 1} ${ row["flabel"] } link ${ row["ffromdate"] } ${ row["ftodate"] } ${ row["forder"] } Edit | Delete
`; $("#getpostnotfTable").html(html); } function callpostnotificationAdd() { $("#page_main_div").load("html_modules/postnotification.html", function() { document.getElementById("display_module_name").innerHTML = "Post Notification"; document.getElementById("module_name_for_save").value = "Add Post Notification"; getDefaultHeadFooterLinks("Post Notification"); }); } function callpostnotificationEdit(postno) { html = ""; $.ajax({ type: "POST", url: $host_url + "getPostnotificationEdit&postno=" + postno, success: function(response) { response = eval("(" + response + ")"); var result = response.data; $("#page_main_div").load( "html_modules/postnotification.html", function() { document.getElementById("display_module_name").innerHTML = "Post Notification"; document.getElementById("module_name_for_save").value = "Edit Post Notification"; getDefaultHeadFooterLinks("Post Notification"); document.getElementById("label_type").value = result["flabel"]; html += `File Uploded before: File
Use same`; $("#editfile").html(html); document.getElementById("postno").value = result["fpostno"]; document.getElementById("post_date_from").value = result["ffromdate"]; document.getElementById("post_date_to").value = result["ftodate"]; document.getElementById("order_no").value = result["forder"]; document.getElementById("colour").value = result["fcolour"]; } ); } }); } function callpostnotificationDelete(postno) { confirm("Sure to delete"); $.ajax({ type: "POST", url: $host_url + "getPostnotificationDelete&postno=" + postno, success: function(response) { console.log("deldeldel", response); getPostnotificationDetails(); } }); } function savepostnotification() { if (trim(document.getElementById("label_type").value) == "") { alert("Please enter the Label"); document.getElementById("label_type").focus(); return; } if ( document.getElementById("module_name_for_save").value == "Edit Post Notification" && document.getElementById("hfilepath").value == "F" ) { if (trim(document.getElementById("filepath").value) == "") { alert("Please choose filepath"); document.getElementById("filepath").focus(); return; } } if (trim(document.getElementById("post_date_from").value) == "") { alert("Please enter From Date"); document.getElementById("post_date_from").focus(); return; } if (trim(document.getElementById("post_date_to").value) == "") { alert("Please enter To Date"); document.getElementById("post_date_to").focus(); return; } if (trim(document.getElementById("order_no").value) == "") { alert("Please enter Order number of Notification"); document.getElementById("order_no").focus(); return; } if (trim(document.getElementById("colour").value) == "") { alert("Please select Colour for Notification"); document.getElementById("colour").focus(); return; } if (document.getElementById("radio_yes").checked) { rate_value = document.getElementById("radio_yes").value; } else { rate_value = "No"; } var type = document.getElementById("module_name_for_save").value == "Edit Post Notification" ? "edit" : "add"; if ( document.getElementById("module_name_for_save").value == "Edit Post Notification" && document.getElementById("hfilepath").value == "F" ) { var file_file = "filepath"; var file_name = $("#" + file_file).val(); var file_size = $("#" + file_file)[0].files[0].size; var file_extn = file_name.split(".").pop(); var file_extn = file_extn.toLowerCase(); if ( file_extn == "xls" || file_extn == "xlsx" || file_extn == "pdf" || file_extn == "jpg" || file_extn == "jpeg" ) { } else { alert("xls, xlsx, PDF files are allowed!"); return false; } if (file_size >= 1000000) { alert("Upload files with size less then 1MB!"); return false; } } var postno = document.getElementById("postno").value; var list_data = ""; list_data = $host_url + "savepostnotification"; list_data += "&postno=" + postno; list_data += "&filepath=" + file_name; list_data += "&type=" + type; list_data += "&label_type=" + trim(document.getElementById("label_type").value); list_data += "&post_date_from=" + trim(document.getElementById("post_date_from").value); list_data += "&post_date_to=" + trim(document.getElementById("post_date_to").value); list_data += "&order_no=" + trim(document.getElementById("order_no").value); list_data += "&colour=" + trim(document.getElementById("colour").value); list_data += "&rate_value=" + rate_value; list_data += "&samefile=" + trim(document.getElementById("hfilepath").value); document .getElementById("form_module_image_upload") .setAttribute("action", list_data); return AIM.submit( document.getElementById("form_module_image_upload"), "report_display", { onComplete: savepostnotificationResponce } ); } function savepostnotificationResponce($responce) { $responce = eval("(" + $responce + ")"); alert($responce.data); } function Clearpostnotification() { document.getElementById("label_type").value = ""; document.getElementById("filepath").value = ""; document.getElementById("post_date_from").value = ""; document.getElementById("post_date_to").value = ""; document.getElementById("order_no").value = ""; document.getElementById("colour").value = ""; document.getElementById("rate_value").value = ""; }