release v2.0.0 #4
|
@ -141,7 +141,11 @@
|
||||||
</div>
|
</div>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
<q-card-section v-if="props.row.volumes.length > 0 && notLoading">
|
<q-card-section v-if="props.row.volumes.length > 0 && notLoading">
|
||||||
<drink-price-volumes :model-value="props.row.volumes" :public="public" :nodetails="nodetails" />
|
<drink-price-volumes
|
||||||
|
:model-value="props.row.volumes"
|
||||||
|
:public="public"
|
||||||
|
:nodetails="nodetails"
|
||||||
|
/>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
|
@ -276,7 +280,7 @@ export default defineComponent({
|
||||||
field: 'package_size',
|
field: 'package_size',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
sort,
|
sort,
|
||||||
public: false
|
public: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'cost_per_package',
|
name: 'cost_per_package',
|
||||||
|
@ -327,7 +331,7 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
filterable: true,
|
filterable: true,
|
||||||
sortable: false,
|
sortable: false,
|
||||||
public: false
|
public: false,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const column_calc = [
|
const column_calc = [
|
||||||
|
@ -372,7 +376,11 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const search_keys = computed(() => columns.filter((column) => column.filterable && ((props.public || props.nodetails) ? column.public : true)));
|
const search_keys = computed(() =>
|
||||||
|
columns.filter(
|
||||||
|
(column) => column.filterable && (props.public || props.nodetails ? column.public : true)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
const pagination = ref({
|
const pagination = ref({
|
||||||
sortBy: 'name',
|
sortBy: 'name',
|
||||||
|
|
|
@ -31,7 +31,7 @@ export default defineComponent({
|
||||||
name: 'BuildManual',
|
name: 'BuildManual',
|
||||||
props: {
|
props: {
|
||||||
steps: {
|
steps: {
|
||||||
type: Array as PropType<Array<string>> || undefined,
|
type: (Array as PropType<Array<string>>) || undefined,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
editable: {
|
editable: {
|
||||||
|
|
|
@ -7,11 +7,12 @@
|
||||||
swipeable
|
swipeable
|
||||||
control-color="primary"
|
control-color="primary"
|
||||||
arrows
|
arrows
|
||||||
|
:keep-alive="false"
|
||||||
>
|
>
|
||||||
<q-carousel-slide v-for="volume in volumes" :key="volume.id" :name="volume.id">
|
<q-carousel-slide v-for="volume in volumes" :key="volume.id" :name="volume.id">
|
||||||
<div class="full-width row">
|
<div class="full-width row">
|
||||||
<q-input
|
<q-input
|
||||||
v-model.number="volume.volume"
|
v-model.number="volume._volume"
|
||||||
class="q-pa-sm col-10"
|
class="q-pa-sm col-10"
|
||||||
:outlined="!editable || !volume_can_edit"
|
:outlined="!editable || !volume_can_edit"
|
||||||
:filled="editable && volume_can_edit"
|
:filled="editable && volume_can_edit"
|
||||||
|
@ -23,6 +24,7 @@
|
||||||
suffix="L"
|
suffix="L"
|
||||||
min="0"
|
min="0"
|
||||||
step="0.001"
|
step="0.001"
|
||||||
|
@update:model-value="updateVolume(volume)"
|
||||||
/>
|
/>
|
||||||
<div v-if="deleteable && editable" class="q-pa-sm col-2 text-right">
|
<div v-if="deleteable && editable" class="q-pa-sm col-2 text-right">
|
||||||
<q-btn round icon="mdi-delete" size="sm" color="negative" @click="deleteVolume">
|
<q-btn round icon="mdi-delete" size="sm" color="negative" @click="deleteVolume">
|
||||||
|
@ -93,7 +95,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="q-pa-sm">
|
<div class="q-pa-sm">
|
||||||
<ingredients
|
<ingredients
|
||||||
v-if="!public"
|
v-if="!public"
|
||||||
v-model="volume.ingredients"
|
v-model="volume.ingredients"
|
||||||
:editable="editable"
|
:editable="editable"
|
||||||
@update="updateVolume(volume)"
|
@update="updateVolume(volume)"
|
||||||
|
@ -139,7 +141,7 @@ export default defineComponent({
|
||||||
nodetails: {
|
nodetails: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
emits: {
|
emits: {
|
||||||
'update:modelValue': (val: Array<DrinkPriceVolume>) => val,
|
'update:modelValue': (val: Array<DrinkPriceVolume>) => val,
|
||||||
|
@ -179,10 +181,8 @@ export default defineComponent({
|
||||||
});
|
});
|
||||||
|
|
||||||
function updateVolume(_volume: DrinkPriceVolume) {
|
function updateVolume(_volume: DrinkPriceVolume) {
|
||||||
console.log('updateVolume', _volume);
|
|
||||||
const index = volumes.value.findIndex((a) => a.id === _volume.id);
|
const index = volumes.value.findIndex((a) => a.id === _volume.id);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
console.log('updateVolume old', volumes.value[index]);
|
|
||||||
volumes.value[index].volume = calc_volume(_volume);
|
volumes.value[index].volume = calc_volume(_volume);
|
||||||
}
|
}
|
||||||
change();
|
change();
|
||||||
|
|
|
@ -122,9 +122,9 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
<q-card-section>
|
<q-card-section :key="key">
|
||||||
<drink-price-volumes
|
<drink-price-volumes
|
||||||
v-model="edit_drink.volumes"
|
v-model="edit_volumes"
|
||||||
editable
|
editable
|
||||||
@update="updateVolume"
|
@update="updateVolume"
|
||||||
@delete-volume="deleteVolume"
|
@delete-volume="deleteVolume"
|
||||||
|
@ -172,8 +172,11 @@ export default defineComponent({
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
//edit_drink.value = <Drink>JSON.parse(JSON.stringify(props.drink));
|
//edit_drink.value = <Drink>JSON.parse(JSON.stringify(props.drink));
|
||||||
edit_drink.value = clone(props.drink);
|
edit_drink.value = clone(props.drink);
|
||||||
|
edit_volumes.value = clone(props.drink.volumes);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const key = ref(0);
|
||||||
|
|
||||||
const store = usePricelistStore();
|
const store = usePricelistStore();
|
||||||
|
|
||||||
const toDeleteObjects = ref<DeleteObjects>({
|
const toDeleteObjects = ref<DeleteObjects>({
|
||||||
|
@ -183,7 +186,9 @@ export default defineComponent({
|
||||||
});
|
});
|
||||||
|
|
||||||
const edit_drink = ref<Drink>();
|
const edit_drink = ref<Drink>();
|
||||||
|
const edit_volumes = ref<Array<DrinkPriceVolume>>([]);
|
||||||
function save() {
|
function save() {
|
||||||
|
(<Drink>edit_drink.value).volumes = edit_volumes.value;
|
||||||
emit('save', <Drink>edit_drink.value, toDeleteObjects.value, drinkPic.value, deletePic.value);
|
emit('save', <Drink>edit_drink.value, toDeleteObjects.value, drinkPic.value, deletePic.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,15 +196,25 @@ export default defineComponent({
|
||||||
emit('cancel');
|
emit('cancel');
|
||||||
}
|
}
|
||||||
function updateVolume(index: number) {
|
function updateVolume(index: number) {
|
||||||
if (index > -1 && edit_drink.value) {
|
if (index > -1 && edit_volumes.value) {
|
||||||
edit_drink.value.volumes[index].min_prices = calc_min_prices(
|
edit_volumes.value[index].min_prices = calc_min_prices(
|
||||||
edit_drink.value.volumes[index],
|
edit_volumes.value[index],
|
||||||
edit_drink.value.cost_per_volume,
|
//edit_drink.value.cost_per_volume,
|
||||||
|
cost_per_volume.value,
|
||||||
store.min_prices
|
store.min_prices
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateVolumes() {
|
||||||
|
setTimeout(() => {
|
||||||
|
edit_volumes.value?.forEach((_, index) => {
|
||||||
|
updateVolume(index);
|
||||||
|
});
|
||||||
|
key.value++;
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
|
||||||
function deletePrice(price: FG.DrinkPrice) {
|
function deletePrice(price: FG.DrinkPrice) {
|
||||||
toDeleteObjects.value.prices.push(price);
|
toDeleteObjects.value.prices.push(price);
|
||||||
}
|
}
|
||||||
|
@ -287,10 +302,14 @@ export default defineComponent({
|
||||||
|
|
||||||
const cost_per_volume = computed({
|
const cost_per_volume = computed({
|
||||||
get: () => {
|
get: () => {
|
||||||
|
let retVal: number;
|
||||||
if (auto_cost_per_volume.value) {
|
if (auto_cost_per_volume.value) {
|
||||||
return <number>calc_cost_per_volume(<Drink>edit_drink.value);
|
retVal = <number>calc_cost_per_volume(<Drink>edit_drink.value);
|
||||||
|
} else {
|
||||||
|
retVal = <number>(<Drink>edit_drink.value).cost_per_volume;
|
||||||
}
|
}
|
||||||
return <number>(<Drink>edit_drink.value).cost_per_volume;
|
updateVolumes();
|
||||||
|
return retVal;
|
||||||
},
|
},
|
||||||
set: (val: number) => ((<Drink>edit_drink.value).cost_per_volume = val),
|
set: (val: number) => ((<Drink>edit_drink.value).cost_per_volume = val),
|
||||||
});
|
});
|
||||||
|
@ -316,6 +335,8 @@ export default defineComponent({
|
||||||
delete_drink,
|
delete_drink,
|
||||||
auto_cost_per_volume,
|
auto_cost_per_volume,
|
||||||
cost_per_volume,
|
cost_per_volume,
|
||||||
|
edit_volumes,
|
||||||
|
key,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { defineComponent } from 'vue';
|
||||||
import CalculationTable from '../components/CalculationTable.vue';
|
import CalculationTable from '../components/CalculationTable.vue';
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'InnerPricelist',
|
name: 'InnerPricelist',
|
||||||
components: {CalculationTable},
|
components: { CalculationTable },
|
||||||
setup() {
|
setup() {
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue