https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39796

            Bug ID: 39796
           Summary: Format discount and tax rate code should be moved out
                    of the vue component
 Change sponsored?: ---
           Product: Koha
           Version: 24.11
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: Acquisitions
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
        Depends on: 38010

vue/components/Vendors/VendorOrderingInformation.vue

+        formatTaxRate(taxRate) {
+            if (!taxRate) return 0;
+            const decimalPlaces = taxRate.toString().split(".")[1]?.length ||
0;
+            const multiplier = 10 ** decimalPlaces;
+            return Math.round(taxRate * multiplier) / (multiplier / 100);
+        },
+        formatDiscount() {
+            if (!this.vendor.discount) return 0.0;
+            const decimalPlaces =
+                this.vendor.discount.toString().split(".")[1]?.length || 0;
+            if (decimalPlaces) {
+                return this.vendor.discount;
+            } else {
+                return this.vendor.discount.toFixed(1);
+            }
+        },

This should not be there. Ideally it should be in a js file that would be
reusable from outside vue.


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38010
[Bug 38010] Migrate vendors to Vue
-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to