forked from verdnatura/salix-front
fix: editTableOptions
This commit is contained in:
parent
31b8088b5f
commit
3276548f88
|
@ -180,6 +180,61 @@ const columns = computed(() => [
|
|||
},
|
||||
]);
|
||||
|
||||
const editTableFieldsOptions = [
|
||||
{
|
||||
field: 'rate2',
|
||||
label: t('item.fixedPrice.groupingPrice'),
|
||||
component: 'input',
|
||||
attrs: {
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'rate3',
|
||||
label: t('item.fixedPrice.packingPrice'),
|
||||
component: 'input',
|
||||
attrs: {
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'minPrice',
|
||||
label: t('item.fixedPrice.minPrice'),
|
||||
component: 'input',
|
||||
attrs: {
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'hasMinPrice',
|
||||
label: t('item.fixedPrice.hasMinPrice'),
|
||||
component: 'checkbox',
|
||||
attrs: {
|
||||
'false-value': 0,
|
||||
'true-value': 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'started',
|
||||
label: t('item.fixedPrice.started'),
|
||||
component: 'date',
|
||||
},
|
||||
{
|
||||
field: 'ended',
|
||||
label: t('item.fixedPrice.ended'),
|
||||
component: 'date',
|
||||
},
|
||||
{
|
||||
field: 'warehouseFk',
|
||||
label: t('item.fixedPrice.warehouse'),
|
||||
component: 'select',
|
||||
attrs: {
|
||||
options: [],
|
||||
'option-label': 'name',
|
||||
'option-value': 'id',
|
||||
},
|
||||
},
|
||||
];
|
||||
const getRowUpdateInputEvents = (props, resetMinPrice, inputType = 'text') => {
|
||||
return inputType === 'text'
|
||||
? {
|
||||
|
@ -298,11 +353,12 @@ const openEditTableCellDialog = () => {
|
|||
};
|
||||
const onEditCellDataSaved = async () => {
|
||||
rowsSelected.value = [];
|
||||
tableRef.value.reload();
|
||||
};
|
||||
const removeFuturePrice = async () => {
|
||||
try {
|
||||
rowsSelected.value.forEach(({ id }) => {
|
||||
const rowIndex = fixedPrices.value.findIndex((r) => r.id === id);
|
||||
const rowIndex = fixedPrices.value.findIndex(({ id }) => id === id);
|
||||
removePrice(id, rowIndex);
|
||||
});
|
||||
} catch (err) {
|
||||
|
@ -311,27 +367,18 @@ const removeFuturePrice = async () => {
|
|||
};
|
||||
const quasar = useQuasar();
|
||||
|
||||
function confirmRemove(item) {
|
||||
function confirmRemove(item, isFuture) {
|
||||
const promise = async () =>
|
||||
isFuture ? removeFuturePrice(item.id) : removePrice(item.id);
|
||||
quasar.dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
title: t('globals.rowWillBeRemoved'),
|
||||
message: t('globals.confirmDeletion'),
|
||||
promise: async () => removePrice(item.id),
|
||||
promise,
|
||||
},
|
||||
});
|
||||
}
|
||||
function confirmRemoveFuturePrice(item) {
|
||||
quasar.dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
title: t('globals.rowWillBeRemoved'),
|
||||
message: t('globals.confirmDeletion'),
|
||||
promise: async () => removeFuturePrice(item.id),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const removePrice = async (id) => {
|
||||
try {
|
||||
await axios.delete(`FixedPrices/${id}`);
|
||||
|
@ -393,7 +440,7 @@ const itemFixedPriceFilterRef = ref();
|
|||
color="primary"
|
||||
icon="delete"
|
||||
flat
|
||||
@click="confirmRemoveFuturePrice"
|
||||
@click="(row) => confirmRemove(row, true)"
|
||||
:title="t('globals.remove')"
|
||||
v-if="rowsSelected.length"
|
||||
/>
|
||||
|
@ -597,6 +644,8 @@ const itemFixedPriceFilterRef = ref();
|
|||
@on-data-saved="onEditCellDataSaved()"
|
||||
/>
|
||||
</QDialog>
|
||||
{{ rowsSelected }}
|
||||
**{{ editTableFieldsOptions }}
|
||||
</QPage>
|
||||
</template>
|
||||
<style lang="scss">
|
||||
|
|
Loading…
Reference in New Issue