Skip to content

Commit

Permalink
Fix final formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MrNaif2018 committed Mar 5, 2023
1 parent 9a0e847 commit 1fe6a0f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pages/pos.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
<p class="is-size-5">
{{ items.amount }} {{ currency
}}<span v-if="items.discount !== '0'">
- {{ (items.amount * items.discount) / 100 }} {{ currency }} ({{
items.discount
}}%)</span
- {{ decimalStr((items.amount * items.discount) / 100) }}
{{ currency }} ({{ items.discount }}%)</span
><span v-if="items.tip !== '0'"> + {{ items.tip }} {{ currency }}</span>
</p>
</div>
Expand Down Expand Up @@ -86,7 +85,10 @@
</template>

<script>
import mixins from "@/utils/mixins"
export default {
mixins: [mixins],
data() {
return {
items: {
Expand Down Expand Up @@ -131,6 +133,12 @@ export default {
},
processButton(i, j) {
let value = this.getNewValue(this.items[this.currentType], i, j)
// strip all values after decimal point of currency
if (value.includes(".")) {
const toAdd =
this.currentType === "discount" ? 2 : this.$store.getters.divisibility
value = value.substring(0, value.indexOf(".") + toAdd + 1)
}
if (this.currentType === "discount" && parseFloat(value) > 100)
value = "100"
this.items[this.currentType] = value
Expand Down

0 comments on commit 1fe6a0f

Please sign in to comment.