better type system

This commit is contained in:
Paul Wilde 2023-02-11 11:59:21 +00:00
parent 4104b28f6f
commit 22f368bf22
2 changed files with 7 additions and 10 deletions

View file

@ -1,15 +1,8 @@
<script> <script>
import Customer from '@/types/CustomerType.vue';
export default class Contract { export default class Contract {
no = ""; no = "";
customer = { customer = new Customer();
id: "",
acc_no: "",
name: "",
short_name: "",
at_risk: false,
address: {
}
};
terms = ""; terms = "";
products = []; products = [];
start_date = new Date(); start_date = new Date();

View file

@ -58,7 +58,7 @@
</template> </template>
<v-row> <v-row>
<v-col cols="4"> <v-col cols="4">
<v-btn @click="contract.products.push({})" v-if="contract.products.length < 4">+ Add Product</v-btn> <v-btn @click="addProduct()" v-if="contract.products.length < 4">+ Add Product</v-btn>
</v-col> </v-col>
</v-row> </v-row>
<v-row> <v-row>
@ -93,6 +93,7 @@
import axios from 'axios' import axios from 'axios'
import DatePicker from '@vuepic/vue-datepicker' import DatePicker from '@vuepic/vue-datepicker'
import methods from '@/CommonMethods.vue' import methods from '@/CommonMethods.vue'
import Product from '@/types/ProductType.vue'
export default { export default {
props: { props: {
setcontract: {} setcontract: {}
@ -142,6 +143,9 @@ export default {
close() { close() {
this.$emit('closetab','list') this.$emit('closetab','list')
}, },
addProduct() {
this.contract.products.push(new Product())
},
async saveContract(){ async saveContract(){
this.saving = true this.saving = true
let url = this.$api_url + "/customers/contracts/" + this.contract.no + "/save" let url = this.$api_url + "/customers/contracts/" + this.contract.no + "/save"