framework for edit med feeds

This commit is contained in:
Paul Wilde 2023-02-11 11:55:26 +00:00
parent 0f1b107904
commit 4104b28f6f
9 changed files with 142 additions and 8 deletions

View file

@ -0,0 +1,19 @@
<script>
export default class CustomerAddress {
id = "";
description = "";
contract = "";
postal_name = "";
line_1 = "";
line_2 = "";
line_3 = "";
line_4 = "";
city = "";
county = "";
postcode = "";
country = "";
email = "";
faxno = "";
telephone = "";
}
</script>

View file

@ -0,0 +1,12 @@
<script>
import CustomerAddress from '@/types/CustomerAddressType.vue'
export default class Customer {
id = "";
acc_no = "";
name = "";
short_name = "";
full_title = "";
at_risk = false;
address = new CustomerAddress();
}
</script>

23
src/types/MedFeedType.vue Normal file
View file

@ -0,0 +1,23 @@
<script>
import Medication from '@/types/MedicationType.vue'
import Customer from '@/types/CustomerType.vue'
import CustomerAddress from '@/types/CustomerAddressType.vue'
import Product from '@/types/ProductType.vue'
import Vet from '@/types/VetType.vue'
export default class MedicatedFeed {
id = 0;
med_feed_id = 0;
medication = new Medication();
customer = new Customer();
product = new Product();
tonnage = 0;
vet = new Vet();
date_required = "";
delivery_address = new CustomerAddress();
alt_adds = [];
repeat = false;
repeat_message = "";
current = true;
isNew = true;
}
</script>

View file

@ -0,0 +1,9 @@
<script>
export default class Medication {
id = 0;
name = "";
info = [];
med_code = "";
inclusion_rate = "";
}
</script>

View file

@ -0,0 +1,7 @@
<script>
export default class Product {
code = "";
name = "";
price = "";
}
</script>

7
src/types/VetType.vue Normal file
View file

@ -0,0 +1,7 @@
<script>
export default class Vet {
id = 0;
practice = "";
contacts = [];
}
</script>

View file

@ -1,6 +1,5 @@
<template> <template>
<v-card :title="title" :subtitle="'Contract : ' + contract.no"> <v-card :title="title" :subtitle="'Contract : ' + contract.no">
{{ contract }}
<v-card-text> <v-card-text>
<v-container> <v-container>
<v-row> <v-row>

View file

@ -1,3 +1,55 @@
<template> <template>
Not Implemented, yet :-) <v-card :title="title">
<v-card-subtitle>
Medicated Feed :
<template v-if="mf.isNew">New</template>
<template v-else>{{ mf.id }}</template>
</v-card-subtitle>
<v-card-text>
<v-container>
<v-row>
<v-col cols="6">
{{ mf }}
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-card-actions>
<v-btn v-if="!mf.isNew" color="red-darken-1"
variant="text"
@click="saveMedFeed(mf)">Save</v-btn>
<v-btn v-if="mf.isNew" color="red-darken-1"
variant="text"
@click="saveMedFeed(mf)">Add</v-btn>
<v-spacer></v-spacer>
<v-btn color="blue-darken-1"
variant="text"
@click="close">Close</v-btn>
</v-card-actions>
</v-card>
</template> </template>
<script>
export default {
props:{
set_mf: {}
},
watch: {
set_mf(newval) {
this.mf = newval
},
},
data() {
return {
mf: this.set_mf,
}
},
methods: {
close() {
this.$emit('closetab','list')
},
saveMedFeed(medfeed) {
console.log(medfeed)
}
}
}
</script>

View file

@ -18,7 +18,7 @@
append-inner-icon="mdi-magnify"></v-text-field> append-inner-icon="mdi-magnify"></v-text-field>
</v-col> </v-col>
</v-row> </v-row>
<v-btn v-if="site_info.features.addmedfeed" color="warning" @click="editMedFeed({})">+ Add</v-btn> <v-btn v-if="site_info.features.addmedfeed" color="warning" @click="editMedFeed()">+ Add</v-btn>
<v-row> <v-row>
<v-col cols="8" xs="12" sm="12" md="8"> <v-col cols="8" xs="12" sm="12" md="8">
<v-progress-linear indeterminate color="blue" :active="loading"></v-progress-linear> <v-progress-linear indeterminate color="blue" :active="loading"></v-progress-linear>
@ -30,7 +30,7 @@
> >
<v-row class="item" :class="{ at_risk : item.customer.at_risk }"> <v-row class="item" :class="{ at_risk : item.customer.at_risk }">
<v-col cols="4"> <v-col cols="4">
Medicated Feed : {{ item.id }}, Medicated Feed : {{ item.id }}<br/>
{{ item.customer.acc_no }} - {{ item.customer.name }} {{ item.customer.acc_no }} - {{ item.customer.name }}
</v-col> </v-col>
<v-col> <v-col>
@ -57,8 +57,8 @@
</v-card> </v-card>
</v-container> </v-container>
</v-overlay> </v-overlay>
</v-btn> </v-btn><br/>
<v-btn v-if="site_info.editmedfeed" >Edit</v-btn> <v-btn v-if="site_info.features.editmedfeed" color="warning" @click="editMedFeed(item)">Edit</v-btn>
</v-col> </v-col>
</v-row> </v-row>
</RecycleScroller> </RecycleScroller>
@ -66,7 +66,7 @@
</v-row> </v-row>
</v-window-item> </v-window-item>
<v-window-item value="edit"> <v-window-item value="edit">
<MedFeedsEdit /> <MedFeedsEdit :set_mf="selected_mf" @closetab="tab = 'list'" @medfeedupdate="medfeedUpdated" />
</v-window-item> </v-window-item>
<v-window-item value="scriptreq"> <v-window-item value="scriptreq">
<ScriptReq :mf="selected_mf" :user="user_info"></ScriptReq> <ScriptReq :mf="selected_mf" :user="user_info"></ScriptReq>
@ -82,6 +82,7 @@ import MedFeedsEdit from './MedFeedsEdit.vue'
import ScriptReq from './MedFeedsScriptReq.vue' import ScriptReq from './MedFeedsScriptReq.vue'
import OrderForm from './MedFeedsOrderForm.vue' import OrderForm from './MedFeedsOrderForm.vue'
import methods from '@/CommonMethods.vue' import methods from '@/CommonMethods.vue'
import MedFeedType from '@/types/MedFeedType.vue';
export default { export default {
props: { props: {
site_info: {}, site_info: {},
@ -162,9 +163,14 @@ export default {
}) })
}, },
async editMedFeed(mf) { async editMedFeed(mf) {
console.log(mf)
if ( mf != undefined ) {
this.selected_mf = mf
} else {
this.selected_mf = new MedFeedType()
}
this.edit = true this.edit = true
this.tab = "edit" this.tab = "edit"
this.selected_mf = mf
} }
} }
} }