|
|
@ -21,6 +21,8 @@ const item = reactive({
|
|
|
|
const form = ref(null);
|
|
|
|
const form = ref(null);
|
|
|
|
|
|
|
|
|
|
|
|
const submit = () => {
|
|
|
|
const submit = () => {
|
|
|
|
|
|
|
|
console.log(isValid.value)
|
|
|
|
|
|
|
|
if (isValid.value === false) return;
|
|
|
|
props.item.name = item.name;
|
|
|
|
props.item.name = item.name;
|
|
|
|
props.item.price = item.price * 100;
|
|
|
|
props.item.price = item.price * 100;
|
|
|
|
props.item.user = store.users.find(user => user.name === item.user);
|
|
|
|
props.item.user = store.users.find(user => user.name === item.user);
|
|
|
@ -35,23 +37,31 @@ const submit = () => {
|
|
|
|
label="Item Name"
|
|
|
|
label="Item Name"
|
|
|
|
required
|
|
|
|
required
|
|
|
|
v-model="item.name"
|
|
|
|
v-model="item.name"
|
|
|
|
|
|
|
|
validate-on="blur"
|
|
|
|
|
|
|
|
:rules="[v => !!v || 'Item is required']"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<v-text-field
|
|
|
|
<v-text-field
|
|
|
|
label="Price"
|
|
|
|
label="Price"
|
|
|
|
suffix="€"
|
|
|
|
suffix="€"
|
|
|
|
required
|
|
|
|
required
|
|
|
|
v-model="item.price"
|
|
|
|
v-model="item.price"
|
|
|
|
|
|
|
|
validate-on="blur"
|
|
|
|
|
|
|
|
:rules="[v => !!v || 'Item is required']"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<v-text-field
|
|
|
|
<v-text-field
|
|
|
|
label="Description"
|
|
|
|
label="Description"
|
|
|
|
required
|
|
|
|
required
|
|
|
|
v-model="item.description"
|
|
|
|
v-model="item.description"
|
|
|
|
|
|
|
|
validate-on="blur"
|
|
|
|
|
|
|
|
:rules="[v => !!v || 'Item is required']"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<v-select
|
|
|
|
<v-select
|
|
|
|
label="User"
|
|
|
|
label="User"
|
|
|
|
:items="store.users.map(user => user.name)"
|
|
|
|
:items="store.users.map(user => user.name)"
|
|
|
|
required
|
|
|
|
required
|
|
|
|
v-model="item.user"
|
|
|
|
v-model="item.user"
|
|
|
|
|
|
|
|
validate-on="blur"
|
|
|
|
|
|
|
|
:rules="[v => !!v || 'Item is required']"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<v-btn color="primary" @click="submit()">edit item</v-btn>
|
|
|
|
<v-btn color="primary" @click="submit()">edit item</v-btn>
|
|
|
|
</v-form>
|
|
|
|
</v-form>
|
|
|
|