Merge pull request 'Changa purchese' (#40) from cosmos into main

Reviewed-on: OneTeam/don_confiao#40
This commit is contained in:
mono 2024-10-05 10:44:39 -05:00
commit 46904d0825
5 changed files with 32 additions and 18 deletions

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" /> <link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Welcome to Vuetify 3</title> <title>Don Confiao</title>
</head> </head>
<body> <body>

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -1,25 +1,31 @@
<template> <template>
<v-container> <v-container>
<v-form ref="form" v-model="valid"> <v-form ref="form" v-model="valid">
<v-text-field <div class="d-flex mb-4">
v-model="purchase.date" <v-select
label="Fecha" v-model="purchase.customer"
type="date" :items="clients"
:rules="[rules.required]" item-title="name"
required item-value="id"
></v-text-field> label="Cliente"
<v-select :rules="[rules.required]"
v-model="purchase.customer" required
:items="clients" class="mr-4"
item-title="name" ></v-select>
item-value="id" <v-text-field
label="Cliente" v-model="purchase.date"
:rules="[rules.required]" label="Fecha"
required type="date"
></v-select> :rules="[rules.required]"
required
style="flex: 0 1 250px;"
></v-text-field>
</div>
<v-textarea <v-textarea
v-model="purchase.notes" v-model="purchase.notes"
label="Notas" label="Notas"
rows="2"
></v-textarea> ></v-textarea>
<v-divider></v-divider> <v-divider></v-divider>
<v-container> <v-container>
@ -102,7 +108,7 @@
return { return {
valid: false, valid: false,
purchase: { purchase: {
date: '', date: this.getCurrentDate(),
client: null, client: null,
notes: '', notes: '',
saleline_set: [{product:'', unit_price: 0, quantity: 0}], saleline_set: [{product:'', unit_price: 0, quantity: 0}],
@ -130,6 +136,14 @@
}, },
}, },
methods: { methods: {
getCurrentDate() {
const today = new Date();
const yyyy = today.getFullYear();
const mm = String(today.getMonth() + 1).padStart(2, '0');
const dd = String(today.getDate()).padStart(2, '0');
return `${yyyy}-${mm}-${dd}`;
},
onProductChange(index) { onProductChange(index) {
const selectedProductId = this.purchase.saleline_set[index].product; const selectedProductId = this.purchase.saleline_set[index].product;
const selectedProduct = this.products.find(p => p.id == selectedProductId); const selectedProduct = this.products.find(p => p.id == selectedProductId);