From 258d6647290709f679ae10bf1ba7bc71b8858992 Mon Sep 17 00:00:00 2001 From: Muhammad Vakili <m.vakili95@gmail.com> Date: Tue, 29 Jan 2019 06:06:50 +0330 Subject: [PATCH] Modify dealer balance format --- frontend/client/filters/index.js | 14 ++++++++++++++ frontend/client/views/dealer/DealList.vue | 2 +- frontend/client/views/dealer/index.vue | 3 ++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/frontend/client/filters/index.js b/frontend/client/filters/index.js index e69de29..d9864f0 100644 --- a/frontend/client/filters/index.js +++ b/frontend/client/filters/index.js @@ -0,0 +1,14 @@ +module.exports = { + 'balance': function (value) { + if (value < 0) { + return 'بدهکار' + } else if (value > 0) { + return 'بستانکار' + } else { + return '' + } + }, + 'abs': function (value) { + return Math.abs(value) + } +} diff --git a/frontend/client/views/dealer/DealList.vue b/frontend/client/views/dealer/DealList.vue index 9fb098c..197475f 100644 --- a/frontend/client/views/dealer/DealList.vue +++ b/frontend/client/views/dealer/DealList.vue @@ -31,7 +31,7 @@ </span> </b-table-column> <b-table-column field="dealTime" label="زمان خرید / فروش" sortable> - <date-picker :class="{'disable-event': !table.openedDetailed.includes(detailProps.row.id)}" type="datetime" :auto-submit="true" format="YYYY-MM-DD HH:mm" display-format="HH:mm jYYYY/jMM/jDD" v-model="detailProps.row.dealTime" disabled></date-picker> + <date-picker :class="{'disable-event': !table.openedDetailed.includes(detailProps.row.id)}" type="datetime" :auto-submit="true" format="YYYY-MM-DD HH:mm" display-format="HH:mm jYYYY/jMM/jDD" v-model="detailProps.row.dealTime"></date-picker> </b-table-column> <b-table-column field="dealPrice.amount" label="قیمت خرید / فروش" sortable> <input class="input" v-if="table.openedDetailed.includes(detailProps.row.id)" type="text" placeholder="قیمت خرید" v-model="detailProps.row.dealPrice.amount" /> diff --git a/frontend/client/views/dealer/index.vue b/frontend/client/views/dealer/index.vue index 37c7905..7c17cb7 100644 --- a/frontend/client/views/dealer/index.vue +++ b/frontend/client/views/dealer/index.vue @@ -46,7 +46,8 @@ {{ props.row.address || ' ... ' }} </b-table-column> <b-table-column field="balance" label="بدهی/طلب" sortable> - {{ props.row.balance}} + {{ props.row.balance || 0 | abs |currency('', 0) }} + {{ props.row.balance || 0 | balance }} </b-table-column> <b-table-column label="" width="100"> <b-dropdown :mobile-modal="false" v-model="isPublic" class="control" position="is-bottom-left">