This commit is contained in:
2024-05-16 14:36:52 -04:00
parent 7164e41aa1
commit 52a02c7595
34 changed files with 771 additions and 2342 deletions

View File

@@ -122,13 +122,14 @@
</span>
</div>
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0">
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0 py-5">
<label class="block text-white text-sm font-bold mb-2">Automatic</label>
<input v-model="CreateCustomerForm.basicInfo.customer_automatic" class="checkbox checkbox-xs" id="automatic"
type="checkbox" />
</div>
<div class="col-span-12 md:col-span-12 flex mt-5 mb-5">
<button class="btn btn-accent">
<button class="btn btn-accent btn-sm">
Create Customer
</button>
</div>
@@ -167,6 +168,16 @@ export default defineComponent({
x: '',
custList: [],
new_user_id: 0,
company: {
creation_date: "",
account_prefix: "",
company_name: "",
company_address: "",
company_town: "",
company_zip: "",
company_state: "",
company_phone_number: "",
},
CreateCustomerForm: {
basicInfo: {
customer_last_name: "",
@@ -207,6 +218,7 @@ export default defineComponent({
mounted() {
this.getCustomerTypeList();
this.getStatesList();
this.getCompany();
},
methods: {
acceptNumber() {
@@ -218,6 +230,20 @@ export default defineComponent({
this.CreateCustomerForm.basicInfo.customer_phone_number = ''
}
},
getCompany() {
let path = import.meta.env.VITE_BASE_URL + '/admin/company/' + import.meta.env.VITE_COMPANY_ID;
axios({
method: "get",
url: path,
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
this.company = response.data;
})
},
userStatus() {
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
axios({
@@ -247,6 +273,7 @@ export default defineComponent({
customer_automatic: string;
customer_home_type: string,
customer_state: string;
}) {
let path = import.meta.env.VITE_BASE_URL + "/customer/create";
axios({
@@ -279,6 +306,7 @@ export default defineComponent({
customer_state: this.CreateCustomerForm.basicInfo.customer_state,
customer_apt: this.CreateCustomerForm.basicInfo.customer_apt,
customer_address: this.CreateCustomerForm.basicInfo.customer_address,
};
this.CreateCustomer(payload);
},

View File

@@ -19,7 +19,7 @@
</router-link>
</li>
</ul>
<div class="w-full mt-10" v-if="customer !== null">
<div class="w-full mt-10" >
<div class="grid grid-cols-12 gap-5">
<div class="col-span-4 p-5 ">
@@ -215,6 +215,7 @@
<th>Automatic</th>
<th>Prime</th>
<th>Same Day</th>
<th></th>
</tr>
</thead>
<tbody>
@@ -254,16 +255,16 @@
<td class="flex gap-5">
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }">
<button class="btn btn-sm btn-accent">Edit</button>
</router-link>
</router-link>
<a @click.prevent="deleteCall(oil['id'])">
<button class="btn btn-sm btn-error">Delete</button>
</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@@ -332,16 +333,19 @@ export default defineComponent({
delivery_format: false,
delivery_template: PaginationComp
},
}
},
created() {
this.userStatus()
this.getCustomer(this.$route.params.id);
this.getCreditCards(this.$route.params.id)
this.getCreditCardsCount(this.$route.params.id)
},
mounted() {
this.getCustomer(this.$route.params.id)
this.getCustomerDelivery(this.$route.params.id, this.delivery_page)
this.getPage(this.delivery_page)
},
@@ -353,7 +357,7 @@ export default defineComponent({
methods: {
getPage: function (page: any) {
// we simulate an api call that fetch the records from a backend
this.getCustomer(page)
this.getCustomerDelivery(this.$route.params.id, page)
},
userStatus() {
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
@@ -441,6 +445,29 @@ export default defineComponent({
})
},
deleteCall(delivery_id: any) {
let path = import.meta.env.VITE_BASE_URL + '/delivery/delete/' + delivery_id;
axios({
method: 'delete',
url: path,
headers: authHeader(),
}).then((response: any) => {
if (response.data.ok) {
notify({
title: "Success",
text: "deleted oil order",
type: "success",
});
this.getPage
} else {
notify({
title: "Failure",
text: "error deleting oil order",
type: "success",
});
}
})
},
},
})
</script>