$(document).ready(function() {
// $("#ContactDetails").DataTable({
// stripeClasses: [],
// lengthChange: false,
// searching: false,
// paging: false,
// info: false,
// });
// $("#EnquiryDetails").DataTable({
// stripeClasses: [],
// lengthChange: false,
// searching: false,
// paging: false,
// info: false,
// });
// $("#CertificateDetails").DataTable({
// stripeClasses: [],
// lengthChange: false,
// searching: false,
// paging: false,
// info: false,
// });
// $("#SopDocumentDetails").DataTable({
// stripeClasses: [],
// lengthChange: false,
// searching: false,
// paging: false,
// info: false,
// });
// Masters table and add page
// myTableUser
// $("#myTableUser").DataTable({
// columnDefs: [{ width: "5%", targets: [0, 1] }],
// stripeClasses: [],
// colReorder: true,
// });
let milpartAddBtn = $(
''
);
$("#myTableMILpart_filter").append(milpartAddBtn);
milpartAddBtn.on("click", function() {
window.location.href = "/milpart_add";
});
// let enquiryAddBtn = $(
// ''
// );
// let excelUploadBtn = $(
// ''
// );
let milsoAddBtn = $(
''
);
let milsoexcelUploadBtn = $(
''
);
$("#myTableMILso_filter").append(milsoexcelUploadBtn);
milsoexcelUploadBtn.on("click", function () {
$("#excelUpload").modal("show");
});
$("#myTableMILso_filter").append(milsoAddBtn);
milsoAddBtn.on("click", function() {
window.location.href = "milson_add";
});
// $("#myTableEnquiry_filter").append(enquiryAddBtn);
// $("#myTableEnquiry_filter").append(excelUploadBtn);
// enquiryAddBtn.on("click", function() {
// window.location.href = "/enquiry/enquiries_add";
// });
// excelUploadBtn.on("click", function () {
// $("#excelUpload").modal("show");
// });
let itemstageAddBtn = $(
''
);
$("#myTablePOITEM_filter").append(itemstageAddBtn);
itemstageAddBtn.on("click", function() {
window.location.href = "po_item_stage_add";
});
let userAddBtn = $(
''
);
$("#myTableUser_filter").append(userAddBtn);
userAddBtn.on("click", function() {
window.location.href = "/profile/user_add";
});
let siteAddBtn = $(
''
);
let asnothrAddBtn = $(
''
);
$("#myTableASNotherchrgs_filter").append(asnothrAddBtn);
asnothrAddBtn.on("click", function() {
window.location.href = "/asn_other_charges_add";
});
$("#myTableSite_filter").append(siteAddBtn);
siteAddBtn.on("click", function() {
window.location.href = "/site_add";
});
let sampleQualificationAddBtn = $(
''
);
let samplequaldwnldBtn = $(
''
);
// Append both buttons next to each other
$("#myTableSampleQualification_filter").append(
sampleQualificationAddBtn,samplequaldwnldBtn
);
// "Add Sample Qualification" button functionality
sampleQualificationAddBtn.on("click", function () {
window.location.href = "sample_qualification_add";
});
samplequaldwnldBtn.on("click", function () {
window.location.href = "sample_qualification_excel_export";
});
// Excel Upload button functionality
// Trigger the modal when the "Upload Excel File" button is clicked
// sampleexcelUploadBtn.on("click", function () {
// $("#excelUploadModal").modal("show");
// });
let functionAddBtn = $(
''
);
$("#myTableFunction_filter").append(functionAddBtn);
functionAddBtn.on("click", function() {
window.location.href = "/function_add";
});
let docTypeAddBtn = $(
''
);
$("#myTableDocumentType_filter").append(docTypeAddBtn);
docTypeAddBtn.on("click", function() {
window.location.href = "/document_type_add";
});
let actionTobeTakenAddBtn = $(
''
);
$("#myTableActionToBeTaken_filter").append(actionTobeTakenAddBtn);
actionTobeTakenAddBtn.on("click", function() {
window.location.href = "/action_tobe_taken_add";
});
let docAddBtn = $(
''
);
// let documentUploadBtn = $(
// ''
// );
// $("#myTableInspectionClosingChecklist").DataTable({
// columnDefs: [{ width: "5%", targets: [0, 1] }],
// stripeClasses: [],
// colReorder: true,
// });
// let checklistexcelUploadBtn = $(
// ''
// );
let ICCAddBtn = $(
''
);
let checklistldwnldBtn = $(
''
);
$("#myTableInspectionClosingChecklist_filter").append(ICCAddBtn);
$("#myTableInspectionClosingChecklist_filter").append(checklistldwnldBtn);
ICCAddBtn.on("click", function () {
window.location.href = "inspection_closing_checklist_add";
});
checklistldwnldBtn.on("click", function () {
window.location.href = "check_list_export";
});
let docdwnBtn = $(
''
);
$("#myTableDocument_filter").append(docAddBtn,docdwnBtn);
docAddBtn.on("click", function() {
window.location.href = "/document_add";
});
docdwnBtn.on("click", function() {
window.location.href = "/document_excel_export";
});
let ThirdPartyAddBtn = $(
''
);
$("#myTableThirdParty_filter").append(ThirdPartyAddBtn);
ThirdPartyAddBtn.on("click", function() {
window.location.href = "/third_party_add";
});
let ReqAddBtn = $(
''
);
$("#myTableReq_filter").append(ReqAddBtn);
ReqAddBtn.on("click", function() {
window.location.href = "/requirement_add";
});
$("#myTable").DataTable({
columnDefs: [{ width: "5%", targets: [0, 1] }],
stripeClasses: [],
colReorder: true,
});
// $("#myTablePOITEM").DataTable({
// columnDefs: [{ orderable: false, targets: "_all" }],
// stripeClasses: [],
// sorting: false,
// });
$("#myTableCompany").DataTable({
columnDefs: [{ width: "5%", targets: [0, 1] }],
stripeClasses: [],
colReorder: true,
});
let companyAddBtn = $(
''
);
$("#myTableCompany_filter").append(companyAddBtn);
companyAddBtn.on("click", function() {
window.location.href = "company-add.html";
});
$("#ReAuditTable").DataTable({
columnDefs: [{ width: "85%", targets: 1 }],
stripeClasses: [],
lengthChange: false,
searching: false,
paging: false,
info: false,
});
$("#PreAuditTable").DataTable({
columnDefs: [{ width: "85%", targets: 2 }],
stripeClasses: [],
lengthChange: false,
searching: false,
paging: false,
info: false,
});
$("#PreAuditTable1").DataTable({
columnDefs: [{ width: "85%", targets: 1 }],
stripeClasses: [],
lengthChange: false,
searching: false,
paging: false,
info: false,
});
let enqCatAddBtn = $(
''
);
// $("#myTableEnquiryCategory_filter").append(enqCatAddBtn);
// enqCatAddBtn.on("click", function() {
// window.location.href = "/enquiry_category_add";
// });
// sub type add
// $("#myTableSubtype").DataTable({
// columnDefs: [{ width: "5%", targets: [0, 1] }],
// stripeClasses: [],
// colReorder: true,
// });
let subTypeAddBtn = $(
''
);
$("#myTableSubtype_filter").append(subTypeAddBtn);
subTypeAddBtn.on("click", function() {
window.location.href = "/sub_type_add";
});
// UOM add
// $("#myTableUOM").DataTable({
// columnDefs: [{ width: "5%", targets: [0, 1] }],
// stripeClasses: [],
// colReorder: true,
// });
let uOMAddBtn = $(
''
);
$("#myTableUOM_filter").append(uOMAddBtn);
uOMAddBtn.on("click", function() {
window.location.href = "/uom_add";
});
// Currency add
// $("#myTableCurrency").DataTable({
// columnDefs: [{ width: "5%", targets: [0, 1] }],
// stripeClasses: [],
// colReorder: true,
// });
let currencyAddBtn = $(
''
);
$("#myTableCurrency_filter").append(currencyAddBtn);
currencyAddBtn.on("click", function() {
window.location.href = "/currency_add";
});
let FeedBackAddBtn = $(
''
);
$("#myTableFeedback_filter").append(FeedBackAddBtn);
FeedBackAddBtn.on("click", function() {
window.location.href = "/enquiry/buyerfeedback_add";
});
// myTableDelIncoTerm
// $("#myTableDelIncoTerm").DataTable({
// columnDefs: [{ width: "5%", targets: [0, 1] }],
// stripeClasses: [],
// colReorder: true,
// });
let delIncoTermAddBtn = $(
''
);
$("#myTableDelIncoTerm_filter").append(delIncoTermAddBtn);
delIncoTermAddBtn.on("click", function() {
window.location.href = "/income_terms_add";
});
let delpaymentAddBtn = $(
''
);
$("#myTableDelPaymentTerm_filter").append(delpaymentAddBtn);
delpaymentAddBtn.on("click", function() {
window.location.href = "/payment_add";
});
let stsAddBtn = $(
''
);
$("#myTablestatus_filter").append(stsAddBtn);
stsAddBtn.on("click", function() {
window.location.href = "/status_add";
});
let designationAddBtn = $(
''
);
$("#myTableDesignation_filter").append(designationAddBtn);
designationAddBtn.on("click", function() {
window.location.href = "/designation_add";
});
// myTableDepartment
// $("#myTableDepartment").DataTable({
// columnDefs: [{ width: "5%", targets: [0, 1] }],
// stripeClasses: [],
// colReorder: true,
// });
let departmentAddBtn = $(
''
);
$("#myTableDepartment_filter").append(departmentAddBtn);
departmentAddBtn.on("click", function() {
window.location.href = "/departments_add";
});
let tpextndcntrAddBtn = $(
''
);
$("#myTabletype_extend_control_filter").append(tpextndcntrAddBtn);
tpextndcntrAddBtn.on("click", function() {
window.location.href = "/type_and_extent_control_add";
});
// myTableSupplier
// $("#myTableSupplier").DataTable({
// columnDefs: [{ width: "5%", targets: [0, 1] }],
// stripeClasses: [],
// colReorder: true,
// });
// let supplierAddBtn = $(
// ''
// );
// if(IspurchaseAdminMangerBuyer){
// $("#myTableSupplier_filter").append(supplierAddBtn);
// supplierAddBtn.on("click", function() {
// window.location.href = "/supplier_add";
//
// });
// }
//
// $("#myTableSupplier_filter").append(supplierAddBtn);
// supplierAddBtn.on("click", function() {
// window.location.href = "/supplier_add";
// });
// $("#myTableEnquiry").DataTable({
// columnDefs: [{ width: "5%", targets: [0, 1] }],
// stripeClasses: [],
// colReorder: true,
// });
let testdecAddBtn = $(
''
);
$("#myTableTestdescription_filter").append(testdecAddBtn);
testdecAddBtn.on("click", function() {
window.location.href = "/test_description_add";
});
let postagemapAddBtn = $(
''
);
$("#myTablepostagemapping_filter").append(postagemapAddBtn);
postagemapAddBtn.on("click", function() {
window.location.href = "postage_mapping_add";
});
$("#itemStage").DataTable({
columnDefs: [{ width: "30%", targets: 0 },],
stripeClasses: [],
lengthChange: false,
searching: false,
paging: false,
info: false,
});
let compnAddBtn = $(
''
);
$("#myTablecomapny_filter").append(compnAddBtn);
compnAddBtn.on("click", function() {
window.location.href = "/company_add";
});
var companyNoValue = document.getElementById("company_no").value;
console.log(companyNoValue)
if (parseInt(companyNoValue, 10) > 0) {
// Select the button using jQuery and hide it
// document.getElementById("id_company_add_btn").style.display = 'none';
let btn = $("#id_company_add_btn");
console.log('inside if')
console.log(btn)
btn.hide(); // Hides the button
}
let userRoleAddBtn = $(
''
);
$("#myTableRole_filter").append(userRoleAddBtn);
userRoleAddBtn.on("click", function() {
window.location.href = "/user_role_add";
});
// Purchase order
$("#myTablePO").DataTable({
columnDefs: [{ width: "5%", targets: [0, 1] }],
stripeClasses: [],
lengthChange: false,
searching: false,
pageLength: 10,
});
//
$("#sendModal").on("shown.bs.modal", function() {
$("#myTableSendEnquiry")
.DataTable({
columnDefs: [{ width: "5%", targets: [0, 1] }],
stripeClasses: [],
})
.columns.adjust()
.draw();
});
$("#compareItemModal").on("shown.bs.modal", function() {
// Check if the DataTable is already initialized and destroy it if it is
if ($.fn.DataTable.isDataTable("#myTableCompareItemModal")) {
$("#myTableCompareItemModal").DataTable().destroy();
}
// Initialize the DataTable
$("#myTableCompareItemModal")
.DataTable({
columnDefs: [
{ width: "5%", targets: 0 },
{ width: "10%", targets: [2, 3] },
{ width: "36%", targets: 1 },
],
stripeClasses: [],
responsive: true,
lengthChange: false,
})
.columns.adjust()
.draw();
});
$("#compareItemModal").on("shown.bs.modal", function() {
// Check if the DataTable is already initialized and destroy it if it is
if ($.fn.DataTable.isDataTable("#myTableCompareItemModalKSB")) {
$("#myTableCompareItemModalKSB").DataTable().destroy();
}
// Initialize the DataTable
$("#myTableCompareItemModalKSB")
.DataTable({
columnDefs: [{ width: "18%", targets: [0, 1] }],
stripeClasses: [],
responsive: true,
searching: false,
lengthChange: false,
info: false,
paginate: false,
})
.columns.adjust()
.draw();
});
$("#compareItemModal").on("shown.bs.modal", function() {
// Check if the DataTable is already initialized and destroy it if it is
if ($.fn.DataTable.isDataTable("#myTableCompareItemModalKSBPrev")) {
$("#myTableCompareItemModalKSBPrev").DataTable().destroy();
}
// Initialize the DataTable
$("#myTableCompareItemModalKSBPrev")
.DataTable({
stripeClasses: [],
responsive: true,
searching: false,
lengthChange: false,
info: false,
paginate: false,
})
.columns.adjust()
.draw();
});
$("#myTableSupplierItemModal").DataTable({
columnDefs: [
{ width: "5%", targets: 0 },
{ width: "40%", targets: 1 },
],
stripeClasses: [],
});
$("#myTableEnqOffer").DataTable({
columnDefs: [
{ width: "5%", targets: 0 },
{ width: "40%", targets: 1 },
],
stripeClasses: [],
});
$("#myTableCompareItem").DataTable({
columnDefs: [{ width: "5%", targets: [0, 1] }],
stripeClasses: [],
});
// $("#myTableEnqApp").DataTable({
// columnDefs: [{ width: "5%", targets: [0, 1] }],
// stripeClasses: [],
// lengthChange: false,
// searching: false,
// pageLength: 10,
// });
// myTablePODetails
$("#myTablePODetails").DataTable({
columnDefs: [{ width: "5%", targets: 0 }],
stripeClasses: [],
lengthChange: false,
searching: false,
pageLength: 10,
colReorder: true,
});
// myTableDeliveryDetails
$("#myTableDeliveryDetails").DataTable({
columnDefs: [{ width: "5%", targets: 0 }],
stripeClasses: [],
lengthChange: false,
searching: false,
pageLength: 10,
});
$("#myTableAssignStage").DataTable({
columnDefs: [{ width: "5%", targets: [0,2] }],
stripeClasses: [],
lengthChange: false,
searching: false,
pageLength: 10,
});
$("#myTableDeliveryDetail").DataTable({
columnDefs: [{ width: "5%", targets: [0,2] }],
stripeClasses: [],
lengthChange: false,
searching: false,
pageLength: 10,
});
$("#myTableHistory").DataTable({
columnDefs: [{ width: "5%", targets: 0 }],
stripeClasses: [],
lengthChange: false,
searching: false,
pageLength: 10,
});
$("#myTableRequestView").DataTable({
columnDefs: [{ width: "5%", targets: 0 }],
stripeClasses: [],
});
$("#myTableEnqCommentView").DataTable({
columnDefs: [{ width: "5%", targets: 0 }],
stripeClasses: [],
});
$("#myTableComparisonOverview").DataTable({
scrollX: true,
columnDefs: [{ width: "5%", targets: 0 }],
stripeClasses: [],
});
$("#myTableSupplierItemView").DataTable({
columnDefs: [{ orderable: false, targets: "_all" }],
stripeClasses: [],
sorting: false,
});
$("#myTableSupplierItemView2").DataTable({
columnDefs: [{ width: "5%", targets: 0 }],
stripeClasses: [],
responsive: false,
});
$("#myTableEnquiryComment").DataTable({
columnDefs: [{ width: "5%", targets: [0, 1] }],
stripeClasses: [],
});
//maintanence
$("#myTableMaintenence").DataTable({
columnDefs: [{ width: "5%", targets: [0, 1] }],
stripeClasses: [],
lengthChange: false,
searching: false,
pageLength: 10,
});
//
//maintanenceDetails
$("#myTableMntDetails").DataTable({
columnDefs: [{ width: "5%", targets: [0, 1] }],
stripeClasses: [],
lengthChange: false,
searching: false,
pageLength: 10,
});
//
$("#myTablePOQuery").DataTable({
columnDefs: [{ width: "1%", targets: 0 }],
stripeClasses: [],
pageLength: 10,
lengthChange: false,
searching: false,
info: false,
paginate: false,
});
$("#myTablePOQueryMaintenance").DataTable({
columnDefs: [{ width: "1%", targets: 0 }],
stripeClasses: [],
pageLength: 10,
lengthChange: false,
searching: false,
info: false,
paginate: false,
});
$("#myTableSCD").DataTable({
columnDefs: [{ width: "5%", targets: [0, 1] }],
stripeClasses: [],
lengthChange: false,
searching: false,
pageLength: 10,
});
$("#myTableSCDQuery").DataTable({
columnDefs: [{ width: "1%", targets: 0 }],
stripeClasses: [],
pageLength: 10,
lengthChange: false,
searching: false,
info: false,
paginate: false,
});
// myTableSCDDetails
$("#myTableSCDDetails").DataTable({
columnDefs: [{ width: "5%", targets: 0 }],
stripeClasses: [],
lengthChange: false,
searching: false,
pageLength: 10,
colReorder: true,
});
$("#myTableReadyforOffer").DataTable({
columnDefs: [{ width: "5%", targets: [0, 1] }],
stripeClasses: [],
lengthChange: false,
searching: false,
pageLength: 10,
});
$("#myTableEnqOfferStatus").DataTable({
columnDefs: [{ width: "5%", targets: 0 }],
stripeClasses: [],
});
$("#myTableRequestApprovalList").DataTable({
columnDefs: [{ width: "5%", targets: 0 }],
stripeClasses: [],
});
$("#myTableApprovedList").DataTable({
columnDefs: [{ width: "5%", targets: 0 }],
stripeClasses: [],
});
});
// Password toggle functionality
const togglePasswordBtns = document.querySelectorAll(".toggle-password-btn");
const passwordInputs = document.querySelectorAll(".toggle-password");
const toggleIcons = document.querySelectorAll(".toggle-icon");
togglePasswordBtns.forEach((btn, index) => {
btn.addEventListener("click", function() {
const type =
passwordInputs[index].getAttribute("type") === "password" ?
"text" :
"password";
passwordInputs[index].setAttribute("type", type);
toggleIcons[index].classList.toggle("bi-eye-slash-fill");
});
});
// Select type initialize
//VirtualSelect.init({ ele: "#select-type" });
$(document).ready(function() {
$(".tab-item").click(function() {
// Remove 'active' class from all tab items
$(".tab-item").removeClass("active");
// Add 'active' class to the clicked tab item
$(this).addClass("active");
// Add 'bg-dark' class to all tab items except the clicked one
$(".tab-item").not(".active").addClass("bg-non-active");
// Remove 'bg-dark' class from the clicked tab item
$(this).removeClass("bg-non-active");
});
});
// Master Enquiry add
// $("#myTableUserRole").DataTable({
// columnDefs: [{ width: "5%", targets: [0, 1] }],
// stripeClasses: [],
// colReorder: true,
// });
// let userRoleAddBtn = $(
// ''
// );
// $("#myTableUserRole_filter").append(userRoleAddBtn);
// userRoleAddBtn.on("click", function() {
// window.location.href = "/enquiry_category_add";
// });