refactor: refs #8945 reorganize imports and enhance confirmation dialog for unassigning invoices
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
This commit is contained in:
parent
574bf7f771
commit
a2e8f332df
|
@ -1,23 +1,25 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
|
||||||
import InvoiceInDescriptorProxy from 'pages/InvoiceIn/Card/InvoiceInDescriptorProxy.vue';
|
|
||||||
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
|
||||||
import { toDate, toCurrency } from 'src/filters/index';
|
import { toDate, toCurrency } from 'src/filters/index';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
|
import InvoiceInDescriptorProxy from 'pages/InvoiceIn/Card/InvoiceInDescriptorProxy.vue';
|
||||||
|
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
||||||
|
|
||||||
const tableRef = ref();
|
|
||||||
const { t } = useI18n();
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const { t } = useI18n();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
const quasar = useQuasar();
|
||||||
|
const tableRef = ref();
|
||||||
const dataKey = 'fixedAssetInvoiceIn';
|
const dataKey = 'fixedAssetInvoiceIn';
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
|
@ -65,19 +67,25 @@ const columns = computed(() => [
|
||||||
actions: [
|
actions: [
|
||||||
{
|
{
|
||||||
title: t('fixedAsset.invoice.unassignInvoice'),
|
title: t('fixedAsset.invoice.unassignInvoice'),
|
||||||
icon: 'delete',
|
|
||||||
action: (row) =>
|
|
||||||
openConfirmationModal(
|
|
||||||
t('fixedAsset.invoice.unassignInvoice'),
|
|
||||||
t('fixedAsset.invoice.unassignInvoiceConfirmation'),
|
|
||||||
() => unassignInvoice(row.id),
|
|
||||||
),
|
|
||||||
isPrimary: true,
|
isPrimary: true,
|
||||||
|
icon: 'delete',
|
||||||
|
action: ({ id }) => confirmRemove(id),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
function confirmRemove(id) {
|
||||||
|
quasar.dialog({
|
||||||
|
component: VnConfirm,
|
||||||
|
componentProps: {
|
||||||
|
title: t('fixedAsset.invoice.unassignInvoice'),
|
||||||
|
message: t('fixedAsset.invoice.unassignInvoiceConfirmation'),
|
||||||
|
promise: () => unassignInvoice(id),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async function unassignInvoice(id) {
|
async function unassignInvoice(id) {
|
||||||
try {
|
try {
|
||||||
await axios.delete(`PpeComponents/${id}`);
|
await axios.delete(`PpeComponents/${id}`);
|
||||||
|
@ -103,7 +111,7 @@ async function unassignInvoice(id) {
|
||||||
formInitialData: {
|
formInitialData: {
|
||||||
ppeFk: parseInt(route.params.id, 10),
|
ppeFk: parseInt(route.params.id, 10),
|
||||||
},
|
},
|
||||||
onDataSaved: ( {id} ) => tableRef.reload(),
|
onDataSaved: ({ id }) => tableRef.reload(),
|
||||||
}"
|
}"
|
||||||
:disable-option="{ card: true }"
|
:disable-option="{ card: true }"
|
||||||
auto-load
|
auto-load
|
||||||
|
@ -138,4 +146,4 @@ async function unassignInvoice(id) {
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -278,7 +278,7 @@ function toFixedAssetUrl(section) {
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard v-if="entity.ppeComponents?.length > 0" class="vn-two">
|
<QCard v-if="entity.ppeComponents?.length > 0" class="vn-two">
|
||||||
<VnTitle
|
<VnTitle
|
||||||
:url="toFixedAssetUrl('invoice-in')"
|
:url="toFixedAssetUrl('invoice')"
|
||||||
:text="$t('globals.pageTitles.assignedInvoices')"
|
:text="$t('globals.pageTitles.assignedInvoices')"
|
||||||
data-cy="titleInvoiceBlock"
|
data-cy="titleInvoiceBlock"
|
||||||
/>
|
/>
|
||||||
|
@ -300,7 +300,9 @@ function toFixedAssetUrl(section) {
|
||||||
<QTd>
|
<QTd>
|
||||||
<span class="link" data-cy="supplierLink">
|
<span class="link" data-cy="supplierLink">
|
||||||
{{ props.row.invoiceIn.supplier.name }}
|
{{ props.row.invoiceIn.supplier.name }}
|
||||||
<SupplierDescriptorProxy :id="props.row.invoiceIn.supplierFk" />
|
<SupplierDescriptorProxy
|
||||||
|
:id="props.row.invoiceIn.supplierFk"
|
||||||
|
/>
|
||||||
</span>
|
</span>
|
||||||
</QTd>
|
</QTd>
|
||||||
<QTd>
|
<QTd>
|
||||||
|
|
Loading…
Reference in New Issue