fix
This commit is contained in:
@@ -5,6 +5,11 @@ import {
|
||||
LABS_DELETE_API,
|
||||
LABS_LIST_API,
|
||||
LABS_UPDATE_API,
|
||||
MEDICINE_ADD_QUESTIONERIES_EXCEL_API,
|
||||
MEDICINE_DELETE_API,
|
||||
MEDICINE_LIST_API,
|
||||
MEDICINE_SAVE_API,
|
||||
MEDICINE_UPDATE_API,
|
||||
MEETING_NOTES_API,
|
||||
MEETING_PRESCREPTIONS_API,
|
||||
PATIENT_DELETE_API,
|
||||
@@ -28,6 +33,8 @@ export default createStore({
|
||||
singlePatientAppointment: null,
|
||||
patientPrescription:null,
|
||||
patientNotes: null,
|
||||
medicineList: [],
|
||||
questioneriesList: []
|
||||
},
|
||||
mutations: {
|
||||
setLoading(state, payload) {
|
||||
@@ -55,7 +62,12 @@ export default createStore({
|
||||
setPatientNotes(state, payload) {
|
||||
state.patientNotes = payload
|
||||
},
|
||||
|
||||
setMedicineList(state, payload) {
|
||||
state.medicineList = payload
|
||||
},
|
||||
setQuestionersList(state, payload) {
|
||||
state.questioneriesList = payload
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
||||
@@ -370,6 +382,138 @@ export default createStore({
|
||||
console.error('Error:', error);
|
||||
});
|
||||
},
|
||||
async medicineList({ commit }, payload) {
|
||||
commit('setLoading', true)
|
||||
console.log(localStorage.getItem('admin_access_token'))
|
||||
await axios.post(MEDICINE_LIST_API, {}, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${localStorage.getItem('admin_access_token')}`,
|
||||
}
|
||||
}) .then(response => {
|
||||
commit('setLoading', false)
|
||||
console.log('Response:', response.data);
|
||||
let dataArray =[]
|
||||
// for (let data of response.data.medicines) {
|
||||
// let dataObject = {}
|
||||
// dataObject.title = data.title
|
||||
// dataObject.slug = data.slug
|
||||
// dataObject.price = data.price
|
||||
// dataObject.slot_time = data.slot_time
|
||||
// dataObject.appointment_id = data.appointment_id
|
||||
// dataObject.booking_time = data.booking_time
|
||||
// dataObject.contact_no = data.contact_no
|
||||
// dataObject.avatar = '',
|
||||
// dataObject.id = data.id,
|
||||
// dataArray.push(dataObject)
|
||||
// }
|
||||
console.log(dataArray)
|
||||
commit('setMedicineList',response.data.medicines)
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
commit('setLoading', false)
|
||||
console.error('Error:', error);
|
||||
});
|
||||
},
|
||||
async medicineUpdate({ commit }, payload) {
|
||||
commit('setLoading', true)
|
||||
await axios.post(MEDICINE_UPDATE_API+payload.id, {
|
||||
title: payload.title,
|
||||
slug: payload.slug,
|
||||
list_one_title: payload.list_one_title,
|
||||
list_sub_title: payload.list_sub_title,
|
||||
list_two_title: payload.list_two_title,
|
||||
price: payload.price,
|
||||
currency: payload.currency,
|
||||
excel: payload.excel,
|
||||
image:payload.image
|
||||
}, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${localStorage.getItem('admin_access_token')}`,
|
||||
}
|
||||
}) .then(response => {
|
||||
commit('setLoading', false)
|
||||
console.log('Response:', response.data);
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
commit('setLoading', false)
|
||||
console.error('Error:', error);
|
||||
});
|
||||
},
|
||||
async medicineDelete({ commit }, payload) {
|
||||
commit('setLoading', true)
|
||||
console.log(localStorage.getItem('admin_access_token'))
|
||||
await axios.post(MEDICINE_DELETE_API+payload.id, {}, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${localStorage.getItem('admin_access_token')}`,
|
||||
}
|
||||
}) .then(response => {
|
||||
commit('setLoading', false)
|
||||
console.log('Response:', response.data);
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
commit('setLoading', false)
|
||||
console.error('Error:', error);
|
||||
});
|
||||
},
|
||||
async questioneriesListExcel({ commit }, payload) {
|
||||
commit('setLoading', true)
|
||||
console.log(localStorage.getItem('admin_access_token'))
|
||||
await axios.post(MEDICINE_ADD_QUESTIONERIES_EXCEL_API, {}, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${localStorage.getItem('admin_access_token')}`,
|
||||
}
|
||||
}) .then(response => {
|
||||
commit('setLoading', false)
|
||||
console.log('Response:', response.data);
|
||||
|
||||
commit('setQuestionersList',response.data.medicines)
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
commit('setLoading', false)
|
||||
console.error('Error:', error);
|
||||
});
|
||||
},
|
||||
async medicineAdd({ commit }, payload) {
|
||||
commit('setLoading', true)
|
||||
// const formData = new FormData()
|
||||
// formData.append('title', defaultItem.value.title)
|
||||
// formData.append('slug', defaultItem.value.slug)
|
||||
// formData.append('list_one_title', defaultItem.value.list_one_title)
|
||||
// formData.append('list_sub_title', defaultItem.value.list_sub_title)
|
||||
// formData.append('list_two_title', defaultItem.value.list_two_title)
|
||||
// formData.append('price', defaultItem.value.price)
|
||||
// formData.append('currency', currencySign.value)
|
||||
|
||||
// formData.append('image', imageBase64.value)
|
||||
await axios.post(MEDICINE_SAVE_API, {
|
||||
title: payload.title,
|
||||
slug: payload.slug,
|
||||
list_one_title: payload.list_one_title,
|
||||
list_sub_title: payload.list_sub_title,
|
||||
list_two_title: payload.list_two_title,
|
||||
price: payload.price,
|
||||
currency: payload.currency,
|
||||
excel: payload.excel,
|
||||
image:payload.image
|
||||
}, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
'Authorization': `Bearer ${localStorage.getItem('admin_access_token')}`,
|
||||
}
|
||||
}) .then(response => {
|
||||
commit('setLoading', false)
|
||||
console.log('Response:', response.data);
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
commit('setLoading', false)
|
||||
console.error('Error:', error);
|
||||
});
|
||||
},
|
||||
},
|
||||
getters: {
|
||||
getIsLoading(state){
|
||||
@@ -397,5 +541,11 @@ export default createStore({
|
||||
getPatientNotes(state){
|
||||
return state.patientNotes
|
||||
},
|
||||
getMedcineList(state){
|
||||
return state.medicineList
|
||||
},
|
||||
getQuestioneriesList(state){
|
||||
return state.questioneriesList
|
||||
},
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user