feat: complete admin panel and backend admin api migration
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<template>
|
||||
<!--
|
||||
Ported from legacy henza_admin/src/views/wallet/wallet.vue.
|
||||
The "میزان شارژ پس از هر سفارش" card at the top of the legacy file is
|
||||
COMMENTED OUT there and stays absent here. Note the card is gated on
|
||||
`wallet.percent` even though it renders the charge LIST — legacy's own
|
||||
mismatch, preserved.
|
||||
-->
|
||||
<div>
|
||||
<a-card v-if="hasPermission('wallet.percent')" title="لیست کیف پول های شارژ شده">
|
||||
<XTable ref="tbl" :model="model">
|
||||
<template #time="{ text }">
|
||||
{{ text ? jdateTime(text) : '' }}
|
||||
</template>
|
||||
<template #value="{ text, record }">
|
||||
<span :class="{ 'text-danger': text < 0, 'text-success': text > 0 }">
|
||||
<template v-if="record.transaction_type == 1">
|
||||
{{ Math.abs(Number(text)) }} گرم
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ priceUnit(Math.abs(Number(text))) }}
|
||||
</template>
|
||||
</span>
|
||||
</template>
|
||||
</XTable>
|
||||
</a-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import XTable from '../../components/x-table/XTable.vue';
|
||||
import { buildWalletModel } from './walletTbl';
|
||||
import { useUsersStore } from '../../stores/users';
|
||||
import { jdateTime, priceUnit } from '../../utils/filters';
|
||||
|
||||
const users = useUsersStore();
|
||||
const hasPermission = (rid: string) => Boolean(users.hasPermission(rid));
|
||||
|
||||
const model = buildWalletModel();
|
||||
const tbl = ref<{ fetch: () => Promise<void> } | null>(null);
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// Ported from legacy henza_admin/src/views/wallet/walletTbl.js
|
||||
import XTbl, { Xtc } from '../../components/x-table/model';
|
||||
|
||||
export function buildWalletModel(): XTbl {
|
||||
const tbl = new XTbl('admin/documents/wallet/list', 'لیست کیف پول های شارژ شده');
|
||||
tbl.add(new Xtc('id', 'شماره'));
|
||||
tbl.add(new Xtc('customer.name', 'نام مشتری').filterKey('customer.fullName').filterText());
|
||||
tbl.add(new Xtc('order.id', 'شماره سفارش').filterText());
|
||||
tbl.add(new Xtc('value', 'میزان شارژ').renderSlot('value'));
|
||||
tbl.add(new Xtc('expire_at', 'تاریخ انقضا').noSort().renderSlot('time'));
|
||||
tbl.noFilters();
|
||||
return tbl;
|
||||
}
|
||||
|
||||
export default buildWalletModel;
|
||||
Reference in New Issue
Block a user