80 lines
2.6 KiB
Vue
80 lines
2.6 KiB
Vue
<template>
|
|
<!--
|
|
Ported from legacy henza_admin/src/views/branch/buyList.vue — the branch's
|
|
purchase invoices: the product allocations head office sent to this branch.
|
|
|
|
The backend scopes allocations by the caller's branch, so a branch user sees
|
|
only their own without the view having to filter.
|
|
-->
|
|
<div id="page-user-list">
|
|
<a-card title="فاکتور خرید">
|
|
<XTable ref="tbl" :model="model">
|
|
<template #opt="{ record }">
|
|
<a-tooltip title="مشاهده">
|
|
<EyeOutlined class="cursor-pointer mx-1 text-primary" @click="view(record)" />
|
|
</a-tooltip>
|
|
</template>
|
|
</XTable>
|
|
|
|
<a-modal v-model:open="visible" title="مشاهده فاکتور" width="70%">
|
|
<div v-if="tempRow">
|
|
<a-descriptions bordered size="small" :column="2">
|
|
<a-descriptions-item label="شعبه">{{ tempRow.name }}</a-descriptions-item>
|
|
<a-descriptions-item label="ثبت کننده">
|
|
{{ tempRow.allocator_user?.name ?? '-' }}
|
|
</a-descriptions-item>
|
|
<a-descriptions-item label="تاریخ">{{ jdate(tempRow.caj) }}</a-descriptions-item>
|
|
<a-descriptions-item label="تعداد آیتم">{{ tempRow.count_item }}</a-descriptions-item>
|
|
</a-descriptions>
|
|
|
|
<a-table
|
|
class="mt-4"
|
|
size="small"
|
|
:data-source="tempRow.products"
|
|
:columns="productColumns"
|
|
:pagination="false"
|
|
row-key="id"
|
|
/>
|
|
</div>
|
|
<a-empty v-else />
|
|
|
|
<template #footer>
|
|
<a-button @click="visible = false">بستن</a-button>
|
|
</template>
|
|
</a-modal>
|
|
</a-card>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref } from 'vue';
|
|
import { EyeOutlined } from '@ant-design/icons-vue';
|
|
import XTable from '../../components/x-table/XTable.vue';
|
|
import { buildBranchBuyListModel } from './orderListModel';
|
|
import { jdate } from '../../utils/filters';
|
|
import api from '../../api/client';
|
|
|
|
const model = buildBranchBuyListModel();
|
|
const tbl = ref<{ fetch: () => Promise<void> } | null>(null);
|
|
const visible = ref(false);
|
|
const tempRow = ref<Record<string, any> | undefined>(undefined);
|
|
|
|
const productColumns = [
|
|
{ title: 'کد محصول', dataIndex: 'product_code' },
|
|
{ title: 'نام محصول', dataIndex: 'title' },
|
|
{ title: 'وزن', dataIndex: 'grams' },
|
|
];
|
|
|
|
async function view(record: Record<string, any>) {
|
|
const { data } = await api.get(`branch/product/${record.id}`);
|
|
tempRow.value = data;
|
|
visible.value = true;
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.mt-4 {
|
|
margin-top: 1rem;
|
|
}
|
|
</style>
|