diff --git a/payroll/static/payroll/action.js b/payroll/static/payroll/action.js index a3954c677..e91a9ac89 100644 --- a/payroll/static/payroll/action.js +++ b/payroll/static/payroll/action.js @@ -328,10 +328,11 @@ $("#deletePayslipBulk").click(function (e) { languageCode = code; var confirmMessage = deletePayslipMessages[languageCode]; var textMessage = noRowMessages[languageCode]; + var checkedRows = $(".payslip-checkbox").filter(":checked"); ids = []; ids.push($("#selectedPayslip").attr("data-ids")); ids = JSON.parse($("#selectedPayslip").attr("data-ids")); - if (ids.length === 0) { + if (ids.length === 0 & checkedRows.length === 0) { Swal.fire({ text: textMessage, icon: "warning", @@ -347,6 +348,18 @@ $("#deletePayslipBulk").click(function (e) { confirmButtonText: "Confirm", }).then(function (result) { if (result.isConfirmed) { + if (ids.length === 0) { + e.preventDefault(); + ids=[] + checkedRows.each(function(){ + ids.push($(this).attr("id")); + }) + } else if(checkedRows.length === 0) { + e.preventDefault(); + ids = []; + ids.push($("#selectedPayslip").attr("data-ids")); + ids = JSON.parse($("#selectedPayslip").attr("data-ids")); + } $.ajax({ type: "POST", url: "/payroll/payslip-bulk-delete", diff --git a/payroll/templates/payroll/payslip/group_payslips.html b/payroll/templates/payroll/payslip/group_payslips.html index d319d1b5d..fae96eea2 100644 --- a/payroll/templates/payroll/payslip/group_payslips.html +++ b/payroll/templates/payroll/payslip/group_payslips.html @@ -35,12 +35,14 @@
- +
+ +
{% trans "Employee" %}
{% trans "Period" %}
@@ -55,16 +57,15 @@ {% for payslip in payslip.list %}
-
-
- -
+
+
diff --git a/payroll/templates/payroll/payslip/list_payslips.html b/payroll/templates/payroll/payslip/list_payslips.html index 6d7fba6fb..d58c16435 100644 --- a/payroll/templates/payroll/payslip/list_payslips.html +++ b/payroll/templates/payroll/payslip/list_payslips.html @@ -1,31 +1,7 @@ {% load i18n %} {% load static i18n %} {% include 'filter_tags.html' %} - -
- {% trans "Select All Payslips" %} -
-
- {% trans "Unselect All Payslips" %} -
-
- {% trans "Export Payslips" %} -
-
{% include "payroll/payslip/payslip_table.html" %}
- diff --git a/payroll/templates/payroll/payslip/view_payslips.html b/payroll/templates/payroll/payslip/view_payslips.html index cb69ed72d..a6538dbba 100644 --- a/payroll/templates/payroll/payslip/view_payslips.html +++ b/payroll/templates/payroll/payslip/view_payslips.html @@ -176,7 +176,7 @@
- @@ -197,6 +197,7 @@ class="oh-btn oh-btn--dropdown" @click="open = !open" @click.outside="open = false" + onclick="event.preventDefault()" > {% trans "Actions" %}