136 lines
3.2 KiB
Vue
136 lines
3.2 KiB
Vue
<script setup>
|
|
import { computed, ref } from 'vue';
|
|
import { useI18n } from 'vue-i18n';
|
|
import VnTable from 'components/VnTable/VnTable.vue';
|
|
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
|
import SupplierListFilter from './SupplierListFilter.vue';
|
|
|
|
const { t } = useI18n();
|
|
const tableRef = ref();
|
|
|
|
const columns = computed(() => [
|
|
{
|
|
align: 'left',
|
|
label: t('globals.id'),
|
|
name: 'id',
|
|
isId: true,
|
|
chip: {
|
|
condition: () => true,
|
|
},
|
|
},
|
|
{
|
|
align: 'left',
|
|
label: t('globals.name'),
|
|
name: 'socialName',
|
|
create: true,
|
|
columnFilter: {
|
|
name: 'search',
|
|
},
|
|
isTitle: true,
|
|
},
|
|
{
|
|
align: 'left',
|
|
label: t('supplier.list.tableVisibleColumns.nif'),
|
|
name: 'nif',
|
|
columnFilter: {
|
|
inWhere: true,
|
|
},
|
|
cardVisible: true,
|
|
},
|
|
{
|
|
align: 'left',
|
|
label: t('globals.alias'),
|
|
name: 'alias',
|
|
columnFilter: {
|
|
name: 'search',
|
|
},
|
|
cardVisible: true,
|
|
},
|
|
{
|
|
align: 'left',
|
|
label: t('supplier.list.tableVisibleColumns.account'),
|
|
name: 'account',
|
|
columnFilter: {
|
|
inWhere: true,
|
|
},
|
|
},
|
|
{
|
|
align: 'left',
|
|
label: t('supplier.list.payMethod'),
|
|
name: 'payMethod',
|
|
columnFilter: {
|
|
inWhere: true,
|
|
name: 'payMethodFk',
|
|
component: 'select',
|
|
attrs: {
|
|
url: 'payMethods',
|
|
fields: ['id', 'name'],
|
|
find: {
|
|
value: 'payMethodFk',
|
|
label: 'name',
|
|
},
|
|
},
|
|
},
|
|
visible: false,
|
|
},
|
|
{
|
|
align: 'left',
|
|
label: t('supplier.summary.payDay'),
|
|
name: 'payDay',
|
|
columnFilter: {
|
|
inWhere: true,
|
|
},
|
|
visible: false,
|
|
},
|
|
{
|
|
align: 'left',
|
|
label: t('globals.country'),
|
|
name: 'country',
|
|
columnFilter: {
|
|
component: 'select',
|
|
name: 'countryFk',
|
|
attrs: {
|
|
url: 'countries',
|
|
fields: ['id', 'name'],
|
|
},
|
|
},
|
|
},
|
|
]);
|
|
</script>
|
|
|
|
<template>
|
|
<VnSearchbar data-key="SuppliersList" :limit="20" :label="t('Search suppliers')" />
|
|
<RightMenu>
|
|
<template #right-panel>
|
|
<SupplierListFilter data-key="SuppliersList" />
|
|
</template>
|
|
</RightMenu>
|
|
<VnTable
|
|
ref="tableRef"
|
|
data-key="SuppliersList"
|
|
url="Suppliers/filter"
|
|
redirect="supplier"
|
|
:create="{
|
|
urlCreate: 'Suppliers/newSupplier',
|
|
title: t('Create Supplier'),
|
|
onDataSaved: ({ id }) => tableRef.redirect(id),
|
|
formInitialData: {},
|
|
mapper: (data) => {
|
|
data.name = data.socialName;
|
|
delete data.socialName;
|
|
return data;
|
|
},
|
|
}"
|
|
:right-search="false"
|
|
order="id ASC"
|
|
:columns="columns"
|
|
/>
|
|
</template>
|
|
|
|
<i18n>
|
|
es:
|
|
Search suppliers: Buscar proveedores
|
|
Create Supplier: Crear proveedor
|
|
</i18n>
|