Files
pleno-vue/src/components/displays/superuser/tables/CollectedOrderInvoicesDefaultTable.vue
T

94 lines
3.1 KiB
Vue

<script setup>
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
import { SessionUser } from "@/components/session/token/SessionUser.vue";
import ActionSettingsWheelButton from "@/components/displays/buttons/ActionSettingsWheelButton.vue";
import ActionSettingsWheelItem from "@/components/displays/buttons/ActionSettingsWheelItem.vue";
const props = defineProps({
objects: {
type: Array,
default: () => [],
},
});
const redirect = (path) => {
window.open(path, '_blank');
}
const parseProcessor = (value) => {
if (value === null) return t('global.no_data');
if (value === 1) return 'E-conomic';
return t('global.other');
}
const parseDate = (value) => {
if (value === null) return '-';
return value;
}
const parseClosedAt = (value) => {
if (value === null) return t('global.open');
return t('global.closed') + ' ' + value;
}
</script>
<template>
<table class="table is-fullwidth is-hoverable is-striped">
<thead>
<tr>
<th>{{ SessionUser.objects.collectedOrderInvoices.columns.id.label }}</th>
<th>{{ SessionUser.objects.collectedOrderInvoices.columns.customer_number.label }}</th>
<th>{{ SessionUser.objects.collectedOrderInvoices.columns.name.label }}</th>
<th>{{ SessionUser.objects.collectedOrderInvoices.columns.notes.label }}</th>
<th>{{ SessionUser.objects.collectedOrderInvoices.columns.processor.label }}</th>
<th>{{ SessionUser.objects.collectedOrderInvoices.columns.external_id.label }}</th>
<th>{{ SessionUser.objects.collectedOrderInvoices.columns.po_number.label }}</th>
<th>{{ SessionUser.objects.collectedOrderInvoices.columns.closed_at.label }}</th>
<th>{{ SessionUser.objects.collectedOrderInvoices.columns.created_at.label }}</th>
<th>{{ SessionUser.objects.collectedOrderInvoices.columns.updated_at.label }}</th>
<th class="has-text-right">{{ $t('tables.actions') }}</th>
</tr>
</thead>
<tbody>
<tr v-for="object in props.objects" :key="object.id">
<td>{{ object.id }}</td>
<td>{{ object.customer_number }}</td>
<td>{{ object.name ?? '-' }}</td>
<td>{{ object.notes ?? '-' }}</td>
<td>{{ parseProcessor(object.processor) }}</td>
<td>{{ object.external_id ?? '-' }}</td>
<td>{{ object.po_number ?? '-' }}</td>
<td>{{ parseClosedAt(object.closed_at) }}</td>
<td>{{ parseDate(object.created_at) }}</td>
<td>{{ parseDate(object.updated_at) }}</td>
<td>
<div class="buttons is-float-right">
<ActionSettingsWheelButton>
<template #actions>
<ActionSettingsWheelItem
icon="fas fa-eye"
@click="redirect('/superuser/invoices/' + object.id)"
:label="t('common.show')"
/>
</template>
</ActionSettingsWheelButton>
</div>
</td>
</tr>
<tr v-if="objects.length === 0">
<td colspan="11">
{{ $t('global.no_data') }}
</td>
</tr>
</tbody>
</table>
</template>
<style scoped>
</style>