2771 lines
104 KiB
JavaScript
2771 lines
104 KiB
JavaScript
import ability from "@/plugins/casl/ability";
|
|
import axios from "@axios";
|
|
import { createStore } from "vuex";
|
|
export default createStore({
|
|
state: {
|
|
calendlyAvailableTimes: {
|
|
available_times:[]
|
|
},
|
|
paymentProcessed: false,
|
|
isMicEnabled: false,
|
|
isCamEnabled: false,
|
|
isDisqualified: false,
|
|
showStartOverPupup: false,
|
|
sideBarWidth: 0,
|
|
floatingWindow: false,
|
|
floatingWindowSrc: null,
|
|
callStarted: false,
|
|
isErrorMsg: false,
|
|
isSuccessMsg: false,
|
|
showMessage: null,
|
|
callToken: null,
|
|
callType: null,
|
|
redirectTo: null,
|
|
time_diff: null,
|
|
patientOrderList: [],
|
|
patientOrderDetail: null,
|
|
patientProfileData: null,
|
|
subscriptionList: null,
|
|
subscriptionById: null,
|
|
providerAppointmentOrderList: null,
|
|
notifications: [],
|
|
notificationCount: 0,
|
|
orderPatientProfile: null,
|
|
orderLabKit: null,
|
|
orderLabKitPatient: null,
|
|
patientChat:null,
|
|
errors: {
|
|
name: undefined,
|
|
last_name: undefined,
|
|
phone: undefined,
|
|
email: undefined,
|
|
dob: undefined,
|
|
address: undefined,
|
|
city: undefined,
|
|
state: undefined,
|
|
zipcode: undefined,
|
|
country: undefined,
|
|
termAndCondtiton: undefined,
|
|
receviceSMs: undefined,
|
|
isPolicy: undefined,
|
|
},
|
|
patientsStats:null,
|
|
patientAppiontment:[],
|
|
analyticsFilter: null,
|
|
getHistoryFilter: null,
|
|
getHistory: null,
|
|
getanalytics: null,
|
|
isTonalSnackbarVisible: false,
|
|
errorMessage: null,
|
|
isLoading: false,
|
|
currentPage: null,
|
|
access_token: null,
|
|
current_call_patient: null,
|
|
plan: {
|
|
plan_name: null,
|
|
plan_amount: null,
|
|
product_file_path: null,
|
|
},
|
|
patient: {
|
|
id: null,
|
|
first_name: null,
|
|
last_name: null,
|
|
email: null,
|
|
dob: null,
|
|
phone_no: null,
|
|
address: null,
|
|
city: null,
|
|
state: null,
|
|
zipcode: null,
|
|
country: null,
|
|
gender: null,
|
|
weight: null,
|
|
height: null,
|
|
url: null,
|
|
},
|
|
saveCategoryAnswer: null,
|
|
selectedCategory: null,
|
|
set_categories: null,
|
|
medical_category_question: null,
|
|
available_slots: null,
|
|
selectedTimezone: null,
|
|
bookAppointment: {
|
|
status:null,
|
|
agent_name: null,
|
|
appiontmentId: null,
|
|
appointment_date: null,
|
|
appointment_time: null,
|
|
end_time: null,
|
|
timezone: null,
|
|
slot_time: null,
|
|
items:null
|
|
},
|
|
additionalInformation: {
|
|
answers: null,
|
|
},
|
|
patientsNotification:null,
|
|
agentProfile: null,
|
|
category_answers: null,
|
|
shippingInformation: {
|
|
first_name: null,
|
|
last_name: null,
|
|
email: null,
|
|
phone: null,
|
|
shipping_address1: null,
|
|
shipping_address2: null,
|
|
shipping_city: null,
|
|
shipping_state: null,
|
|
shipping_zipcode: null,
|
|
shipping_country: null,
|
|
billing_address1: null,
|
|
billing_address2: null,
|
|
billing_city: null,
|
|
billing_state: null,
|
|
billing_zipcode: null,
|
|
billing_country: null,
|
|
shipping_amount: null,
|
|
total_amount: null,
|
|
},
|
|
patientsShippingActivity:null,
|
|
patientLabKit:null,
|
|
prescriptionHistory: null,
|
|
patientAnswers: null,
|
|
patientNotes: null,
|
|
patientPrescription: null,
|
|
singlePatientAppointment: null,
|
|
labOrderKitAgent: null,
|
|
labOrderProductKitAgent: null,
|
|
// appiontmentId:null,
|
|
setLabOrderStatus: null,
|
|
},
|
|
mutations: {
|
|
setPaymentProcessed(state, payload){
|
|
state.paymentProcessed = payload;
|
|
},
|
|
setCalendlyAvailableTImes(state, payload){
|
|
state.calendlyAvailableTimes = payload;
|
|
},
|
|
updatePatientAppiontments(state, payload){
|
|
state.patientAppiontment = payload;
|
|
},
|
|
setIsMicEnabled(state, payload) {
|
|
state.isMicEnabled = payload;
|
|
},
|
|
setIsCamEnabled(state, payload) {
|
|
state.isCamEnabled = payload;
|
|
},
|
|
setIsDisqualified(state, payload) {
|
|
state.isDisqualified = payload;
|
|
},
|
|
setShowStartOverPupup(state, payload) {
|
|
state.showStartOverPupup = payload;
|
|
},
|
|
setSideBarWidth(state, payload) {
|
|
state.sideBarWidth = payload;
|
|
},
|
|
setErrorMsg(state, payload) {
|
|
console.log("payload");
|
|
clearTimeout(state.timeout);
|
|
state.isErrorMsg = payload;
|
|
state.timeout = setTimeout(() => {
|
|
state.isErrorMsg = false;
|
|
}, 5000);
|
|
},
|
|
setSuccessMsg(state, payload) {
|
|
console.log("payload");
|
|
clearTimeout(state.timeout);
|
|
state.isSuccessMsg = payload;
|
|
state.timeout = setTimeout(() => {
|
|
state.isSuccessMsg = false;
|
|
}, 5000);
|
|
},
|
|
setShowMsg(state, payload) {
|
|
console.log("payload");
|
|
state.showMessage = payload;
|
|
},
|
|
setOrderPatientProfile(state, payload) {
|
|
console.log("payload");
|
|
state.orderPatientProfile = payload;
|
|
},
|
|
|
|
setFloatingWindow(state, payload) {
|
|
state.floatingWindow = payload;
|
|
},
|
|
setFloatingWindowSrc(state, payload) {
|
|
state.floatingWindowSrc = payload;
|
|
},
|
|
setCallStarted(state, payload) {
|
|
state.callStarted = payload;
|
|
},
|
|
setCallToken(state, payload) {
|
|
state.callToken = payload;
|
|
},
|
|
setCallType(state, payload) {
|
|
state.callType = payload;
|
|
},
|
|
setOrderLabKit(state, payload) {
|
|
state.orderLabKit = payload;
|
|
},
|
|
setOrderLabKitPatient(state, payload) {
|
|
state.orderLabKitPatient = payload;
|
|
},
|
|
setPatientChat(state, payload) {
|
|
state.patientChat = payload;
|
|
},
|
|
|
|
setSinglePatientAppointment(state, payload) {
|
|
state.singlePatientAppointment = payload;
|
|
},
|
|
setCurrentCallPatient(state, payload) {
|
|
localStorage.setItem("getCurrentPatient", payload);
|
|
console.log(
|
|
"current pt",
|
|
localStorage.getItem("getCurrentPatient")
|
|
);
|
|
state.current_call_patient =
|
|
localStorage.getItem("getCurrentPatient");
|
|
},
|
|
setPatientAnswers(state, payload) {
|
|
state.patientAnswers = payload;
|
|
},
|
|
setTimeDiff(state, payload) {
|
|
state.time_diff = payload;
|
|
},
|
|
setErrors(state, payload) {
|
|
state.errors = payload;
|
|
},
|
|
setRedirectTo(state, payload) {
|
|
state.redirectTo = payload;
|
|
},
|
|
setIsTonalSnackbarVisible(state, payload) {
|
|
state.isTonalSnackbarVisible = payload;
|
|
},
|
|
setErrorMessage(state, payload) {
|
|
state.errorMessage = payload;
|
|
},
|
|
setLoading(state, payload) {
|
|
console.log("payload");
|
|
state.isLoading = payload;
|
|
},
|
|
setPatientOrderList(state, payload) {
|
|
console.log("payload");
|
|
state.patientOrderList = payload;
|
|
},
|
|
|
|
setCurrentPage(state, payload) {
|
|
console.log("cuirrent page", payload);
|
|
localStorage.setItem("getCurrentPage", payload);
|
|
state.currentPage = localStorage.getItem("getCurrentPage");
|
|
},
|
|
setAccessToken(state, payload) {
|
|
state.access_token = payload;
|
|
},
|
|
setAnalytics(state, payload) {
|
|
state.getanalytics = payload;
|
|
},
|
|
setAnalyticsFilter(state, payload) {
|
|
state.analyticsFilter = payload;
|
|
},
|
|
// setCategoryAnswer(state, payload) {
|
|
// state.saveCategoryAnswer = payload
|
|
// },
|
|
setProviderAppointmentOrderList(state, payload) {
|
|
state.providerAppointmentOrderList = payload;
|
|
},
|
|
|
|
updatePlan(state, payload) {
|
|
state.plan.plan_name = payload.plan_name;
|
|
state.plan.plan_amount = payload.plan_amount;
|
|
state.plan.product_file_path = payload.product_file_path;
|
|
},
|
|
updatePatient(state, payload) {
|
|
// console.log('patient payload',payload)
|
|
state.patient.id = payload.id;
|
|
state.patient.first_name = payload.first_name;
|
|
state.patient.last_name = payload.last_name;
|
|
state.patient.email = payload.email;
|
|
state.patient.dob = payload.dob;
|
|
state.patient.phone_no = payload.phone_no;
|
|
state.patient.gender = payload.gender;
|
|
state.patient.address = payload.address;
|
|
state.patient.city = payload.city;
|
|
state.patient.state = payload.state;
|
|
state.patient.country = payload.country;
|
|
state.patient.url = payload.profile_picture;
|
|
},
|
|
updateSelectCategory(state, payload) {
|
|
state.saveCategoryAnswer = payload;
|
|
console.log("saveCategoryAnswer", saveCategoryAnswer);
|
|
},
|
|
setAvailableSlots(state, payload) {
|
|
state.available_slots = payload;
|
|
},
|
|
setPatientPrescriptions(state, payload) {
|
|
state.patient_prescription = payload;
|
|
},
|
|
setCategories(state, payload) {
|
|
state.set_categories = payload;
|
|
},
|
|
setMedicalCategoryQuestion(state, payload) {
|
|
state.medical_category_question = payload;
|
|
},
|
|
setSelectedTimezone(state, payload) {
|
|
state.selectedTimezone = payload;
|
|
},
|
|
setAgentProfile(state, payload) {
|
|
state.agentProfile = payload;
|
|
},
|
|
setHistory(state, payload) {
|
|
state.getHistory = payload;
|
|
},
|
|
setPrescriptionHistory(state, payload) {
|
|
state.prescriptionHistory = payload;
|
|
},
|
|
|
|
setHistoryFilter(state, payload) {
|
|
state.getHistoryFilter = payload;
|
|
},
|
|
|
|
updateBookAppointment(state, payload) {
|
|
state.bookAppointment.agent_name = payload.agent_name;
|
|
state.bookAppointment.appiontmentId = payload.appiontmentId;
|
|
state.bookAppointment.appointment_date = payload.appointment_date;
|
|
state.bookAppointment.appointment_time = payload.appointment_time;
|
|
state.bookAppointment.timezone = payload.timezone;
|
|
state.bookAppointment.end_time = payload.end_time;
|
|
state.bookAppointment.status = payload.appointment_status;
|
|
state.bookAppointment.slot_time = payload.slot_time;
|
|
state.bookAppointment.order_id = payload.order_id;
|
|
state.bookAppointment.items = payload.items;
|
|
},
|
|
updateAdditionalInformation(state, payload) {
|
|
state.additionalInformation.answers = payload.answers;
|
|
},
|
|
updateShippingInformation(state, payload) {
|
|
state.shippingInformation.first_name = payload.first_name;
|
|
state.shippingInformation.last_name = payload.last_name;
|
|
state.shippingInformation.email = payload.email;
|
|
state.shippingInformation.phone = payload.phone;
|
|
state.shippingInformation.shipping_address1 =
|
|
payload.shipping_address1;
|
|
state.shippingInformation.shipping_address2 =
|
|
payload.shipping_address2;
|
|
state.shippingInformation.shipping_city = payload.shipping_city;
|
|
state.shippingInformation.shipping_state = payload.shipping_state;
|
|
state.shippingInformation.shipping_zipcode =
|
|
payload.shipping_zipcode;
|
|
state.shippingInformation.shipping_country =
|
|
payload.shipping_country;
|
|
state.shippingInformation.billing_address1 =
|
|
payload.billing_address1;
|
|
state.shippingInformation.billing_address2 =
|
|
payload.billing_address2;
|
|
state.shippingInformation.billing_city = payload.billing_city;
|
|
state.shippingInformation.billing_state = payload.billing_state;
|
|
state.shippingInformation.billing_zipcode = payload.billing_zipcode;
|
|
state.shippingInformation.billing_country = payload.billing_country;
|
|
state.shippingInformation.shipping_amount = payload.shipping_amount;
|
|
state.shippingInformation.total_amount = payload.total_amount;
|
|
},
|
|
updateSelectedQuestionAnswer(state, payload) {
|
|
// console.log("actions",payload.category_answers);
|
|
state.category_answers = payload.category_answers;
|
|
},
|
|
setPatientNotes(state, payload) {
|
|
state.patientNotes = payload;
|
|
},
|
|
setPrescription(state, payload) {
|
|
state.patientPrescription = payload;
|
|
},
|
|
setLabOrderKitAgent(state, payload) {
|
|
state.labOrderKitAgent = payload;
|
|
},
|
|
setLabOrderProductKitList(state, payload) {
|
|
state.labOrderProductKitAgent = payload;
|
|
},
|
|
setLabOrderStatus(state, payload) {
|
|
state.setLabOrderStatus = payload;
|
|
},
|
|
setPatientOrderDetail(state, payload) {
|
|
state.patientOrderDetail = payload;
|
|
},
|
|
setPatientDetail(state, payload) {
|
|
state.patientProfileData = payload;
|
|
},
|
|
setSubscriptionList(state, payload) {
|
|
state.subscriptionList = payload;
|
|
},
|
|
setSubscriptionById(state, payload) {
|
|
state.subscriptionById = payload;
|
|
},
|
|
setLabOrderPatirntKit(state, payload) {
|
|
state.patientLabKit = payload;
|
|
},
|
|
setPatientsShippingActivity(state, payload) {
|
|
state.patientsShippingActivity = payload;
|
|
},
|
|
setPatientsNotification(state, payload) {
|
|
state.patientsNotification = payload;
|
|
},
|
|
setPatientStats(state, payload) {
|
|
state.patientsStats = payload;
|
|
},
|
|
|
|
|
|
|
|
SET_NOTIFICATIONS(state, notifications) {
|
|
state.notifications = notifications
|
|
},
|
|
SET_NOTIFICATION_COUNT(state, count) {
|
|
state.notificationCount = count
|
|
},
|
|
ADD_NOTIFICATION(state, payload) {
|
|
console.log('notification',payload)
|
|
state.notifications.push(payload);
|
|
state.notificationCount++;
|
|
},
|
|
},
|
|
actions: {
|
|
async updatePaymentProcessed({ commit }, payload) {
|
|
commit("setPaymentProcessed", payload);
|
|
},
|
|
async updateIsMicEnabled({ commit }, payload) {
|
|
commit("setIsMicEnabled", payload);
|
|
},
|
|
async updateIsCamEnabled({ commit }, payload) {
|
|
commit("setIsCamEnabled", payload);
|
|
},
|
|
async updateIsDisqualified({ commit }, payload) {
|
|
commit("setIsDisqualified", payload);
|
|
},
|
|
async updateShowStartOverPupup({ commit }, payload) {
|
|
commit("setShowStartOverPupup", payload);
|
|
},
|
|
async updateSideBarWidth({ commit }, payload) {
|
|
commit("setSideBarWidth", payload);
|
|
},
|
|
async updateFloatingWindow({ commit }, payload) {
|
|
commit("setFloatingWindow", payload);
|
|
},
|
|
async updateFloatingWindowSrc({ commit }, payload) {
|
|
commit("setFloatingWindowSrc", payload);
|
|
},
|
|
async updateCallStarted({ commit }, payload) {
|
|
commit("setCallStarted", payload);
|
|
},
|
|
async updateCurrentCallPatient({ commit }, payload) {
|
|
commit("setCurrentCallPatient", payload);
|
|
},
|
|
async updateCallToken({ commit }, payload) {
|
|
commit("setCallToken", payload);
|
|
},
|
|
async updateCallType({ commit }, payload) {
|
|
commit("setCallType", payload);
|
|
},
|
|
async updateCurrentPage({ commit }, payload) {
|
|
commit("setCurrentPage", payload);
|
|
},
|
|
async setSelectedQuestionAnswer({ commit }, payload) {
|
|
commit("updateSelectedQuestionAnswer", payload);
|
|
},
|
|
async setCategoryAnswer({ commit }, payload) {
|
|
commit("setCategoryAnswer", payload);
|
|
},
|
|
async getHistory({ commit }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/agent/api/get-history",
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response History Meeting:", response.data);
|
|
commit("setHistory", response.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async getDateFilter({ commit }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/api/get-history",
|
|
{
|
|
appointment_date: payload.appointment_date
|
|
},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
commit("setPrescriptionHistory", response.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async getPrescriptionHistory({ commit }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/api/get-history",
|
|
{
|
|
appointment_date: 'all'
|
|
},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
commit("setPrescriptionHistory", response.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
// async getHistoryFilter({ commit }, payload) {
|
|
// commit('setLoading', true)
|
|
// await axios.post('/agent/api/get-meeting-history'+payload.filter, {},{
|
|
// headers: {
|
|
// 'Authorization': `Bearer ${localStorage.getItem('access_token')}`,
|
|
// }
|
|
// }) .then(response => {
|
|
// commit('setLoading', false)
|
|
// console.log('Response:', response.data);
|
|
// commit('setHistoryFilter',response.data)
|
|
// })
|
|
// .catch(error => {
|
|
// commit('setLoading', false)
|
|
// console.error('Error:', error);
|
|
// });
|
|
// },
|
|
|
|
async setSelectCategoryId({ commit }, payload) {
|
|
commit("setLoading", payload);
|
|
},
|
|
|
|
async updateIsLoading({ commit }, payload) {
|
|
commit("setLoading", payload);
|
|
},
|
|
async updateIsTonalSnackbar({ commit }, payload) {
|
|
commit("setIsTonalSnackbarVisible", payload);
|
|
},
|
|
async updateErrorMessage({ commit }, payload) {
|
|
commit("setErrorMessage", payload);
|
|
},
|
|
async updatePatientPlan({ commit }, payload) {
|
|
commit("updatePlan", payload);
|
|
},
|
|
async registerPatient({ commit }, payload) {
|
|
// commit('setLoading', true)
|
|
await axios
|
|
.post("/api/register-patient", {
|
|
first_name: payload.first_name,
|
|
last_name: payload.last_name,
|
|
phone_no: payload.phone_no,
|
|
email: payload.email,
|
|
dob: payload.dob,
|
|
gender: payload.gender,
|
|
password:payload.password
|
|
})
|
|
.then((r) => {
|
|
console.log("Reigster", r.data);
|
|
localStorage.setItem("patient_id", r.data.data.id);
|
|
localStorage.setItem("access_token", r.data.access_token);
|
|
localStorage.setItem("user_role", "patient");
|
|
localStorage.setItem("cominguser", "register");
|
|
localStorage.setItem("isLogin", "false");
|
|
localStorage.setItem(
|
|
"userAbilities",
|
|
'[{"action":"manage","subject":"all"}]'
|
|
);
|
|
|
|
const userAbilities = [
|
|
{ action: "manage", subject: "all" },
|
|
];
|
|
ability.update(userAbilities);
|
|
// commit('setLoading', false)
|
|
commit("setAccessToken", r.data.access_token);
|
|
commit("updatePatient", r.data.data);
|
|
commit("setErrors", { email: undefined });
|
|
})
|
|
.catch((e) => {
|
|
console.log(e);
|
|
commit("setErrors", e.response.data.errors);
|
|
commit("setLoading", false);
|
|
console.log("Error", e.response.data.errors);
|
|
});
|
|
},
|
|
|
|
async submitFormNote({ commit }, payload) {
|
|
console.log(payload.patient_id);
|
|
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/agent/api/add-note/" +
|
|
payload.patient_id +
|
|
"/" +
|
|
payload.appointment_id,
|
|
{
|
|
note: payload.note,
|
|
note_type: payload.note_type,
|
|
},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((r) => {
|
|
console.log(r.data);
|
|
commit("setLoading", false);
|
|
})
|
|
.catch((e) => {
|
|
console.log(e);
|
|
commit("setErrors", e.response.data.errors);
|
|
commit("setLoading", false);
|
|
console.log("Error", e.response.data.errors);
|
|
});
|
|
},
|
|
|
|
async savePatientPlan({ commit, state }, payload) {
|
|
// commit('setLoading', true)
|
|
await axios
|
|
.post(
|
|
"/api/save-plan/" + localStorage.getItem("patient_id"),
|
|
{
|
|
plan_name: payload.plan_name,
|
|
plan_amount: payload.plan_amount,
|
|
plan_id: payload.plan_id,
|
|
},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
// commit('setLoading', false)
|
|
commit("setRedirectTo", "book-appointment");
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.log("Error:", error);
|
|
});
|
|
},
|
|
|
|
async getCategory({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/api/get-profile-categories",
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
commit("setCategories", response.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async getAgentCategory({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/agent/api/get-profile-categories",
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
commit("setCategories", response.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async getAnalytics({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/agent/api/get-analytics",
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
commit("setAnalytics", response.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async getPatientPrescriptions({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/api/patients-prescriptions",
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
commit("setPrescription", response.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async getAnalyticsFilter({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post("/agent/api/get-analytics/" + payload.filter, {
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
})
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
commit("setAnalyticsFilter", response.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async getHistoryFilter({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post("/agent/api/get-meeting-history/" + payload.filter, {
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
})
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response Meeting Hisotry Filter:", response.data);
|
|
commit("setHistoryFilter", response.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
|
|
async getLabKitOrderStatus({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/api/get-stored-latest-order-data",
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
commit("setLabOrderStatus", response.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async getAgentProfile({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/agent/api/agent-profile",
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
commit("setAgentProfile", response.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async getMedicalHistoryQuestion({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/api/get-profile-question/" +
|
|
localStorage.getItem("category_id"),
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
commit("setMedicalCategoryQuestion", response.data);
|
|
// category_question
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async getPatientInfo({ commit, state }, payload) {
|
|
// commit('setLoading', true)
|
|
commit("setIsTonalSnackbarVisible", false);
|
|
commit("setErrorMessage", null);
|
|
await axios
|
|
.post(
|
|
"/api/get-patient-detail/" +
|
|
localStorage.getItem("patient_id"),
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
|
|
.then((response) => {
|
|
// commit('setLoading', false)
|
|
console.log("Response:", response.data);
|
|
commit(
|
|
"setAccessToken",
|
|
localStorage.getItem("access_token")
|
|
);
|
|
commit(
|
|
"setCurrentPage",
|
|
localStorage.getItem("currentPage")
|
|
);
|
|
commit("updatePatient", response.data.patient);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async getPatientInfoByID({ commit, state }, payload) {
|
|
// commit('setLoading', true)
|
|
// commit('setIsTonalSnackbarVisible', false)
|
|
// commit('setErrorMessage', null)
|
|
await axios
|
|
.post(
|
|
"/agent/api/patient-profile-details/" +
|
|
localStorage.getItem("patient_id"),
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
|
|
.then((response) => {
|
|
// commit('setLoading', false)
|
|
// console.log('Response Patient ById:', response.data);
|
|
// commit('setAccessToken', localStorage.getItem('access_token'))
|
|
// commit('setCurrentPage', localStorage.getItem('currentPage'))
|
|
commit("updatePatient", response.data.patient);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
|
|
async getPlanInfo({ commit, state }, payload) {
|
|
// commit('setLoading', true)
|
|
await axios
|
|
.post(
|
|
"/api/get-plan-by-patient/" +
|
|
localStorage.getItem("patient_id"),
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
// commit('setLoading', false)
|
|
console.log("Response Plan:", response.data);
|
|
if (response.data[0]) {
|
|
commit("updatePlan", {
|
|
plan_name: response.data[0].title,
|
|
plan_amount: response.data[0].price,
|
|
product_file_path:
|
|
response.data[0].product_file_path,
|
|
});
|
|
}
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.log("Error:", error);
|
|
});
|
|
},
|
|
async updateSelectedTimezone({ commit }, payload) {
|
|
console.log("setSelectedTimezone", payload);
|
|
commit("setSelectedTimezone", payload);
|
|
},
|
|
async getAvailableSlotsData({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/api/available-slots/" + payload.date,
|
|
{},
|
|
{
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
Accept: "application/json",
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
commit("setRedirectTo", "review-appointment");
|
|
commit("setAvailableSlots", response.data.available_slots);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.log("Error:", error);
|
|
});
|
|
},
|
|
async getCalendlyAvailableSlots({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/api/calendly/get-available-times-schedule",
|
|
{
|
|
month:payload.month,
|
|
timezone:payload.timezone
|
|
},
|
|
{
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
Accept: "application/json",
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
commit("setRedirectTo", "review-appointment");
|
|
localStorage.setItem('getCalendlyAvailableTImes',JSON.stringify(response.data.slots))
|
|
commit("setCalendlyAvailableTImes", response.data.slots);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.log("Error:", error);
|
|
});
|
|
},
|
|
|
|
async getDashboardStats({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"api/get-stats",
|
|
{},
|
|
{
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
Accept: "application/json",
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
console.log("setPatientStats",response.data);
|
|
commit("setLoading", false);
|
|
commit("setPatientStats", response.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.log("Error:", error);
|
|
});
|
|
},
|
|
async getPatientsNotification({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/api/get-notification",
|
|
{},
|
|
{
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
Accept: "application/json",
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
console.log("setPatientsNotification",response.data);
|
|
commit("setLoading", false);
|
|
commit("setPatientsNotification", response.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.log("Error:", error);
|
|
});
|
|
},
|
|
async getPatientsNotification({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/api/get-notification",
|
|
{},
|
|
{
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
Accept: "application/json",
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
console.log("setPatientsNotification",response.data);
|
|
commit("setLoading", false);
|
|
commit("setPatientsNotification", response.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.log("Error:", error);
|
|
});
|
|
},
|
|
async patientsShippingActivity({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/api/patient-shipping-activity",
|
|
{},
|
|
{
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
Accept: "application/json",
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
console.log("setPatientsShippingActivity",response.data);
|
|
commit("setLoading", false);
|
|
commit("setPatientsShippingActivity", response.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.log("Error:", error);
|
|
});
|
|
},
|
|
async savePatientAppointment({ commit, state }, payload) {
|
|
// commit('setLoading', true)
|
|
commit("setErrorMessage", null);
|
|
commit("setIsTonalSnackbarVisible", false);
|
|
await axios
|
|
.post(
|
|
"/api/book-appointment",
|
|
{
|
|
patient_id: payload.patient_id,
|
|
patient_name: payload.patient_name,
|
|
patient_email: payload.patient_email,
|
|
appointment_date: payload.appointment_date,
|
|
appointment_time: payload.appointment_time,
|
|
timezone: payload.timezone,
|
|
cart_id: localStorage.getItem('cart_id'),
|
|
},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
console.log("Response:", response.data);
|
|
// commit("setLoading", false);
|
|
commit("setTimeDiff", response.data.time_diff);
|
|
const appointmentDetail = response.data.appointment;
|
|
localStorage.setItem(
|
|
"patient_appointment_id",
|
|
appointmentDetail.id
|
|
);
|
|
localStorage.setItem(
|
|
"selected_time_slot",
|
|
payload.timeSlotString
|
|
);
|
|
commit("updateBookAppointment", {
|
|
appointment_date: appointmentDetail.appointment_date,
|
|
appointment_time: appointmentDetail.appointment_time,
|
|
timezone: appointmentDetail.timezone,
|
|
slot_time: payload.timeSlotString,
|
|
});
|
|
commit("setRedirectTo", "review-appointment");
|
|
// commit('setLoading', false)
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
if (error.response.data.message) {
|
|
commit("setIsTonalSnackbarVisible", true);
|
|
commit("setErrorMessage", error.response.data.message);
|
|
}
|
|
console.log("Error:", error);
|
|
});
|
|
},
|
|
async savePatientCalendlyAppointment({ commit, state }, payload) {
|
|
// commit('setLoading', true)
|
|
commit("setErrorMessage", null);
|
|
commit("setIsTonalSnackbarVisible", false);
|
|
await axios
|
|
.post(
|
|
"/api/calendly/book-schedular",
|
|
{
|
|
patient_id: payload.patient_id,
|
|
patient_name: payload.patient_name,
|
|
patient_email: payload.patient_email,
|
|
appointment_date: payload.appointment_date,
|
|
appointment_time: payload.appointment_time,
|
|
timezone: payload.timezone,
|
|
cart_id: localStorage.getItem('cart_id'),
|
|
url:payload.url
|
|
},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
if (error.response.data.message) {
|
|
commit("setIsTonalSnackbarVisible", true);
|
|
commit("setErrorMessage", error.response.data.message);
|
|
}
|
|
console.log("Error:", error);
|
|
});
|
|
},
|
|
async getPatientAppointment({ commit, state }, payload) {
|
|
// commit('setLoading', true)
|
|
|
|
await axios
|
|
.post(
|
|
"/api/agent-last-appointment-detail/" +
|
|
localStorage.getItem("patient_id"),
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
// commit('setLoading', false)
|
|
console.log("Response last appiontment:", response.data);
|
|
commit("updatePatientAppiontments", response.data);
|
|
commit("updatePatient", response.data.patient);
|
|
commit("updateBookAppointment", {
|
|
appointment_date:
|
|
response.data.appointment.appointment_date,
|
|
order_id:
|
|
response.data.appointment.order_id,
|
|
appointment_status:
|
|
response.data.appointment.status,
|
|
agent_name: response.data.appointment.agent_name,
|
|
appiontmentId: response.data.appointment.id,
|
|
appointment_time:
|
|
response.data.appointment.appointment_time,
|
|
timezone: response.data.appointment.timezone,
|
|
end_time: response.data.appointment.end_time,
|
|
items: response.data.items_data,
|
|
slot_time: localStorage.getItem("selected_time_slot"),
|
|
});
|
|
commit("updateShippingInformation", {
|
|
first_name: response.data.appointment.first_name,
|
|
last_name: response.data.appointment.last_name,
|
|
email: response.data.appointment.patient_email,
|
|
phone: response.data.patient.phone_no,
|
|
shipping_address1:
|
|
response.data.appointment.shipping_address1,
|
|
shipping_address2:
|
|
response.data.appointment.shipping_address2,
|
|
shipping_city: response.data.appointment.shipping_city,
|
|
shipping_state:
|
|
response.data.appointment.shipping_state,
|
|
shipping_zipcode:
|
|
response.data.appointment.shipping_zipcode,
|
|
shipping_country:
|
|
response.data.appointment.shipping_country,
|
|
billing_address1: null,
|
|
billing_address2: null,
|
|
billing_city: null,
|
|
billing_state: null,
|
|
billing_zipcode: null,
|
|
billing_country: null,
|
|
shipping_amount: null,
|
|
total_amount: "92.50",
|
|
});
|
|
commit("setTimeDiff", response.data.time_diff);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.log("Error:", error);
|
|
});
|
|
},
|
|
async saveAdditionalInformation({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
|
|
await axios
|
|
.post(
|
|
"/api/medical-history-question-post/" +
|
|
localStorage.getItem("patient_id"),
|
|
{
|
|
answers: payload.answers,
|
|
},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
"Content-Type": "application/json",
|
|
Accept: "application/json",
|
|
},
|
|
}
|
|
)
|
|
|
|
.then((response) => {
|
|
console.log("answer api", response.data);
|
|
commit("updateAdditionalInformation", payload);
|
|
commit("setLoading", false);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.log("Error:", error);
|
|
});
|
|
},
|
|
async getAdditionalInformation({ commit, state }, payload) {
|
|
// commit('setLoading', true)
|
|
|
|
await axios
|
|
.post(
|
|
"api/medical-history-question-get/" +
|
|
localStorage.getItem("patient_id"),
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
console.log("Response:", response.data);
|
|
commit("updateAdditionalInformation", response.data);
|
|
// commit('setLoading', false)
|
|
})
|
|
.catch((error) => {
|
|
console.log("Error:", error);
|
|
});
|
|
},
|
|
async saveShippingInformation({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
|
|
await axios
|
|
.post(
|
|
"/api/store-order-data/1",
|
|
{
|
|
first_name: payload.first_name,
|
|
last_name: payload.last_name,
|
|
email: payload.email,
|
|
phone: payload.phone,
|
|
patient_id: payload.patient_id,
|
|
shipping_address1: payload.shipping_address1,
|
|
shipping_address2: payload.shipping_address2,
|
|
shipping_city: payload.shipping_city,
|
|
shipping_state: payload.shipping_state,
|
|
shipping_zipcode: payload.shipping_zipcode,
|
|
shipping_country: payload.shipping_country,
|
|
billing_address1: payload.billing_address1,
|
|
billing_address2: payload.billing_address2,
|
|
billing_city: payload.billing_city,
|
|
billing_state: payload.billing_state,
|
|
billing_zipcode: payload.billing_zipcode,
|
|
billing_country: payload.billing_country,
|
|
shipping_amount: payload.shipping_amount,
|
|
total_amount: payload.total_amount,
|
|
items: payload.items,
|
|
},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
"Content-Type": "application/json",
|
|
Accept: "application/json",
|
|
},
|
|
}
|
|
)
|
|
.then((r) => {
|
|
console.log("store order", r.data);
|
|
localStorage.setItem('cart_id',r.data.cart.id)
|
|
commit("setLoading", false);
|
|
})
|
|
.catch((e) => {
|
|
commit("setLoading", false);
|
|
console.log("error ", e.response);
|
|
});
|
|
},
|
|
async updatePatientAddress({ commit, state }, payload) {
|
|
// commit('setLoading', true)
|
|
|
|
await axios
|
|
.post(
|
|
"/api/update-patient/" + localStorage.getItem("patient_id"),
|
|
{
|
|
address: payload.address,
|
|
city: payload.city,
|
|
state: payload.state,
|
|
zip_code: payload.zip_code,
|
|
country: payload.country,
|
|
},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
"Content-Type": "application/json",
|
|
Accept: "application/json",
|
|
},
|
|
}
|
|
)
|
|
.then((r) => {
|
|
// commit('setLoading', false)
|
|
console.log("updated patient ", r.data);
|
|
})
|
|
.catch((e) => {
|
|
commit("setLoading", false);
|
|
console.log(e.response);
|
|
});
|
|
},
|
|
async processPayment({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
commit("setPaymentProcessed", false);
|
|
commit("setErrorMessage", null);
|
|
commit("setIsTonalSnackbarVisible", false);
|
|
await axios
|
|
.post(
|
|
"/api/process-payment",
|
|
{
|
|
card_number: payload.card_number,
|
|
cvv: payload.cvv,
|
|
expiration_month: payload.expiration_month,
|
|
expiration_year: payload.expiration_year,
|
|
order_id: localStorage.getItem('cart_id'),
|
|
},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
"Content-Type": "application/json",
|
|
Accept: "application/json",
|
|
},
|
|
}
|
|
)
|
|
|
|
.then((response) => {
|
|
commit("setSuccessMsg", true);
|
|
console.log("Response:", response.data);
|
|
commit("setShowMsg", response.data.message);
|
|
commit("setPaymentProcessed", true);
|
|
commit("setLoading", false);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
if (error.response.data.message) {
|
|
commit("setIsTonalSnackbarVisible", true);
|
|
commit("setErrorMessage", error.response.data.message);
|
|
}
|
|
console.error(error);
|
|
});
|
|
},
|
|
async saveQuestionAnswers({ commit }, payload) {
|
|
// commit('setLoading', true)
|
|
await axios
|
|
.post(
|
|
"/api/create-question-builder/" + payload.category,
|
|
payload.answers,
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
"Content-Type": "application/json",
|
|
Accept: "application/json",
|
|
},
|
|
}
|
|
)
|
|
.then((r) => {
|
|
console.log("question answer", r.data);
|
|
commit("setPatientAnswers", payload);
|
|
})
|
|
.catch((e) => {
|
|
console.log(e);
|
|
commit("setErrors", e.response.data.errors);
|
|
commit("setLoading", false);
|
|
console.log("Error", e.response.data.errors);
|
|
});
|
|
},
|
|
async getPatientQuestionsAnswers({ commit }, payload) {
|
|
// commit('setLoading', true)
|
|
|
|
await axios
|
|
.post("/api/get-question-builder", {
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
})
|
|
.then((response) => {
|
|
console.log("Response:", response.data.data);
|
|
commit("setPatientAnswers", response.data.data);
|
|
// commit('setLoading', false)
|
|
})
|
|
.catch((error) => {
|
|
console.log("Error:", error);
|
|
});
|
|
},
|
|
async getAgentQuestionsAnswers({ commit }, payload) {
|
|
// commit('setLoading', true)
|
|
|
|
await axios
|
|
.post(
|
|
"/agent/api/get-question-builder/" +
|
|
localStorage.getItem("patient_id"),
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
console.log("Response:", response.data.data);
|
|
commit("setPatientAnswers", response.data.data);
|
|
// commit('setLoading', false)
|
|
})
|
|
.catch((error) => {
|
|
console.log("Error:", error);
|
|
});
|
|
},
|
|
async getAgentPatientNotes({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/agent/api/get-note/" +
|
|
localStorage.getItem("getCurrentPatient"),
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response:", response.data.data);
|
|
commit("setPatientNotes", response.data.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async getAppointmentByIdAgent({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/agent/api/get-appointment/" +
|
|
payload.patient_id +
|
|
"/" +
|
|
payload.appointment_id,
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response SinglePatientAppointment:", response.data.data);
|
|
commit("setSinglePatientAppointment", response.data.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async getAppointmentByIdPatient({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/api/get-appointment-detail/" + payload.appointment_id,
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response getAppointmentByIdPatient:", response.data.data);
|
|
commit("setSinglePatientAppointment", response.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async getHistoryPatientNotes({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/agent/api/get-note/" +
|
|
payload.patient_id +
|
|
"/" +
|
|
payload.appointment_id,
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response setPatientNotes:", response.data.data);
|
|
commit("setPatientNotes", response.data.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async getPatientPrescriptionsByID({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
`/api/get-patient-prescriptions/${payload.appointment_id}`,
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
let itemsPrescriptions = [];
|
|
for (let data of response.data) {
|
|
let dataObject = {};
|
|
dataObject.name = data.prescription.name;
|
|
dataObject.brand = data.prescription.brand;
|
|
dataObject.from = data.prescription.from;
|
|
dataObject.direction_quantity =
|
|
data.prescription.direction_quantity;
|
|
dataObject.dosage = data.prescription.dosage;
|
|
dataObject.quantity = data.prescription.quantity;
|
|
dataObject.refill_quantity =
|
|
data.prescription.refill_quantity;
|
|
dataObject.actions = "";
|
|
dataObject.id = data.prescription.id;
|
|
dataObject.comments = data.comments;
|
|
dataObject.direction_one = data.direction_one;
|
|
dataObject.direction_two = data.direction_two;
|
|
dataObject.status = data.status;
|
|
dataObject.created_at = data.created_at;
|
|
itemsPrescriptions.push(dataObject);
|
|
}
|
|
console.log("Response getPatientPrescriptionsByID:", response.data);
|
|
commit("setPrescription", itemsPrescriptions);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
commit("setPrescription", null);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async getPatientPrescriptionNotes({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/api/get-note/" + payload.appointment_id,
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response setPatientNotes:", response.data.data);
|
|
commit("setPatientNotes", response.data.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async getPrescriptions({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
`/agent/api/get-patient-prescriptions/${payload.patient_id}/${payload.appointment_id}`,
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
|
|
let doctor = {};
|
|
let itemsPrescriptions = [];
|
|
for (let data of response.data) {
|
|
let dataObject = {};
|
|
dataObject.first_name = data.patient.first_name;
|
|
dataObject.last_name = data.patient.last_name;
|
|
dataObject.gender = data.patient.gender;
|
|
dataObject.dob = data.patient.dob;
|
|
dataObject.patient_address =
|
|
data.patient.address +
|
|
" " +
|
|
data.patient.city +
|
|
" " +
|
|
data.patient.state +
|
|
" " +
|
|
data.patient.country;
|
|
dataObject.name = data.prescription.name;
|
|
dataObject.brand = data.prescription.brand;
|
|
dataObject.from = data.prescription.from;
|
|
dataObject.direction_quantity =
|
|
data.prescription.direction_quantity;
|
|
dataObject.dosage = data.prescription.dosage;
|
|
dataObject.quantity = data.prescription.quantity;
|
|
dataObject.refill_quantity =
|
|
data.prescription.refill_quantity;
|
|
dataObject.actions = "";
|
|
dataObject.id = data.prescription.id;
|
|
dataObject.comments = data.comments;
|
|
dataObject.direction_one = data.direction_one;
|
|
dataObject.direction_two = data.direction_two;
|
|
dataObject.doctor = data.telemedPro;
|
|
dataObject.status = data.status;
|
|
dataObject.date = data.created_at;
|
|
dataObject.agent_sign = data.telemedPro.name;
|
|
dataObject.medical_license_number =
|
|
data.telemedPro.medical_license_number;
|
|
itemsPrescriptions.push(dataObject);
|
|
}
|
|
console.log("Response setPrescription:", response.data);
|
|
|
|
commit("setPrescription", itemsPrescriptions);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
commit("setPrescription", null);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async getPatientLabKit({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
`/api/get-patient-labkits`,
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response Patient Lab kit:", response.data.labKits);
|
|
|
|
commit("setLabOrderPatirntKit", response.data.labKits);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
commit("setLabOrderProductKitList", null);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async getLabKitProductList({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
`/agent/api/get-lab-kit`,
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response Lab kit:", response.data.kit);
|
|
|
|
commit("setLabOrderProductKitList", response.data.kit);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
commit("setLabOrderProductKitList", null);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async getLabKits({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios.post('/api/get-lab-kit', {})
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response Lab kit:", response.data.kit);
|
|
|
|
commit("setLabOrderProductKitList", response.data.kit);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
commit("setLabOrderProductKitList", null);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async saveLabOrderProductList({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
`/agent/api/order-lab-kit/${payload.labkit}/${payload.patient_id}`,
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response SaveLabkit:", response.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
//commit('setLabOrderProductKitList',null)
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async getLabOrderList({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
`/agent/api/get-order-lab-kit/${payload.patient_id}`,
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response getLabOrderList:", response.data);
|
|
let itemsLaborder = [];
|
|
for (let data of response.data.order) {
|
|
let dataObject = {};
|
|
dataObject.name =
|
|
data.first_name + " " + data.last_name;
|
|
dataObject.address =
|
|
data.shipping_address1 +
|
|
"," +
|
|
data.shipping_city +
|
|
" " +
|
|
data.shipping_state +
|
|
"," +
|
|
data.shipping_zipcode;
|
|
dataObject.total_amount = data.total_amount;
|
|
dataObject.shipping_amount = data.shipping_amount;
|
|
dataObject.status = data.status;
|
|
dataObject.phone = data.phone;
|
|
dataObject.date = data.created_at;
|
|
dataObject.email = data.email;
|
|
dataObject.testName = data.name;
|
|
dataObject.actions = "";
|
|
dataObject.id = data.id;
|
|
itemsLaborder.push(dataObject);
|
|
}
|
|
commit("setLabOrderKitAgent", itemsLaborder);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
commit("setLabOrderKitAgent", null);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async deletePatientRegRecord({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/api/delete-patient-record",
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async orderPtaientListFilter({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/api/order-list",
|
|
{
|
|
from_date: payload.from_date?payload.from_date:'',
|
|
to_date: payload.to_date?payload.to_date:'',
|
|
},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log(
|
|
"------------------ setPatientOrderList ------------------:",
|
|
response.data
|
|
);
|
|
commit("setPatientOrderList", response.data.order_data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async orderPtaientList({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/api/order-list",
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log(
|
|
"------------------ setPatientOrderList ------------------:",
|
|
response.data
|
|
);
|
|
commit("setPatientOrderList", response.data.order_data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async orderAgentList({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/agent/api/order-list",
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log(
|
|
"------------------ setPatientOrderList ------------------:",
|
|
response.data
|
|
);
|
|
commit("setPatientOrderList", response.data.order_data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async orderAgentListFilter({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/api/order-list",
|
|
{
|
|
from_date: payload.from_date?payload.from_date:'',
|
|
to_date: payload.to_date?payload.to_date:'',
|
|
},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log(
|
|
"------------------ setPatientOrderList ------------------:",
|
|
response.data
|
|
);
|
|
commit("setPatientOrderList", response.data.order_data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async orderDetailAgent({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/agent/api/order-details/" + payload.id,
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log(
|
|
"------------------ setPatientOrderDetail ------------------:",
|
|
response.data
|
|
);
|
|
commit("setPatientOrderDetail", response.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async orderDetailPatient({ commit, state }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/api/order-details/" + payload.id,
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log(
|
|
"------------------ setPatientOrderDetail ------------------:",
|
|
response.data
|
|
);
|
|
commit("setPatientOrderDetail", response.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async patientDetial({ commit }, payload) {
|
|
commit("setLoading", true);
|
|
|
|
await axios
|
|
.post(
|
|
"/api/patient-profile",
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
commit("setPatientDetail", response.data.profile);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async profileUpdatePatient({ commit }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/api/update-profile",
|
|
{
|
|
first_name: payload.first_name,
|
|
last_name: payload.last_name,
|
|
phone_no: payload.phone_no,
|
|
},
|
|
{
|
|
headers: {
|
|
"Content-Type": "multipart/form-data",
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
if (response.data.message && response.status === 200) {
|
|
commit("setSuccessMsg", true);
|
|
console.log("Response:", response.data.message);
|
|
commit("setShowMsg", response.data.message);
|
|
}
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async profilePicPatient({ commit }, payload) {
|
|
commit("setLoading", true);
|
|
await axios
|
|
.post(
|
|
"/api/change-profile-image",
|
|
{
|
|
image: payload.image,
|
|
},
|
|
{
|
|
headers: {
|
|
"Content-Type": "multipart/form-data",
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async patientPasswordupdate({ commit }, payload) {
|
|
commit("setLoading", true);
|
|
|
|
await axios
|
|
.post(
|
|
"/api/reset-password",
|
|
{
|
|
password: payload.password,
|
|
new_password: payload.new_password,
|
|
confirm_password: payload.confirm_password,
|
|
},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
if (response.data.status == "error") {
|
|
commit("setErrorMsg", true);
|
|
console.log("Response:", response.data.msg);
|
|
commit("setShowMsg", response.data.msg);
|
|
}
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async subscriptionList({ commit }, payload) {
|
|
commit("setLoading", true);
|
|
|
|
await axios
|
|
.post(
|
|
"/api/subscription-list-data",
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
commit("setSubscriptionList", response.data.subscriptions);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async subscriptionByID({ commit }, payload) {
|
|
commit("setLoading", true);
|
|
|
|
await axios
|
|
.post(
|
|
"/api/subscription-detail/" + payload.id,
|
|
{ },
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
commit("setSubscriptionById", response.data.subscriptions);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async subscriptionCancel({ commit }, payload) {
|
|
commit("setLoading", true);
|
|
|
|
await axios
|
|
.post(
|
|
"/api/subscription-cancel/" + payload.id,
|
|
{status:"Cancelled"},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
commit("setSubscriptionById", response.data.subscriptions);
|
|
if (response.data.status=='Success') {
|
|
commit("setSuccessMsg", true);
|
|
console.log("Response:", response.data.subscriptions);
|
|
commit("setShowMsg", response.data.subscriptions);
|
|
}
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async dashboardOrderAppoinmentList({ commit }, payload) {
|
|
commit("setLoading", true);
|
|
|
|
await axios
|
|
.post(
|
|
"/agent/api/get-completed-appointment-list",
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
for (let data of response.data) {
|
|
try {
|
|
if (data.appointment_status.toLowerCase() !== 'completed') {
|
|
console.log('data ===== ',data)
|
|
commit("ADD_NOTIFICATION", data);
|
|
}
|
|
} catch (error) {
|
|
|
|
}
|
|
|
|
}
|
|
//SET_NOTIFICATION_COUNT
|
|
commit("setProviderAppointmentOrderList", response.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async agentMeetingSatausUpdate({ commit }, payload) {
|
|
commit("setLoading", true);
|
|
|
|
await axios
|
|
.post(
|
|
"/agent/api/appointment-status/"+payload.id,
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response Appintment Status:", response.data);
|
|
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async OrderPatientProfile({ commit }, payload) {
|
|
commit("setLoading", true);
|
|
|
|
await axios
|
|
.post(
|
|
"/agent/api/patient-history/"+payload.id,
|
|
{},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
|
|
//SET_NOTIFICATION_COUNT
|
|
commit("setOrderPatientProfile", response.data);
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async saveOrderLabKitBYitems({ commit }, payload) {
|
|
//commit("setLoading", true);
|
|
|
|
await axios
|
|
.post(
|
|
"/agent/api/labkit-order-items",
|
|
{
|
|
cart_id: payload.cart_id,
|
|
item_id: payload.item_id,
|
|
lab_kit_id:payload.lab_kit_id
|
|
},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
if (response.data.message) {
|
|
commit("setSuccessMsg", true);
|
|
console.log("Response:", response.data.message);
|
|
commit("setShowMsg", response.data.message);
|
|
}
|
|
//SET_NOTIFICATION_COUNT
|
|
|
|
})
|
|
.catch((error) => {
|
|
commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async getOrderLabKit({ commit }, payload) {
|
|
commit("setLoading", false);
|
|
|
|
await axios
|
|
.post(
|
|
"/agent/api/labkit-order-items-get",
|
|
{
|
|
cart_id: payload.cart_id,
|
|
|
|
},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
// commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
commit("setOrderLabKit", response.data.data);
|
|
//SET_NOTIFICATION_COUNT
|
|
|
|
})
|
|
.catch((error) => {
|
|
// commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
|
|
async getOrderLabKitPatient({ commit }, payload) {
|
|
commit("setLoading", false);
|
|
|
|
await axios
|
|
.post(
|
|
"/api/labkit-order-items-get",
|
|
{
|
|
cart_id: payload.cart_id,
|
|
|
|
},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
// commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
commit("setOrderLabKitPatient", response.data.data);
|
|
//SET_NOTIFICATION_COUNT
|
|
|
|
})
|
|
.catch((error) => {
|
|
// commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
async getPtaientForChat({ commit }, payload) {
|
|
commit("setLoading", false);
|
|
|
|
await axios
|
|
.post(
|
|
"/agent/api/patient-appointments",
|
|
{
|
|
|
|
|
|
},
|
|
{
|
|
headers: {
|
|
Authorization: `Bearer ${localStorage.getItem(
|
|
"access_token"
|
|
)}`,
|
|
},
|
|
}
|
|
)
|
|
.then((response) => {
|
|
// commit("setLoading", false);
|
|
console.log("Response:", response.data);
|
|
commit("setPatientChat", response.data.data);
|
|
//SET_NOTIFICATION_COUNT
|
|
|
|
})
|
|
.catch((error) => {
|
|
// commit("setLoading", false);
|
|
console.error("Error:", error);
|
|
});
|
|
},
|
|
},
|
|
getters: {
|
|
getPaymentProcessed(state) {
|
|
return state.paymentProcessed;
|
|
},
|
|
getCalendlyAvailableTImes(state) {
|
|
return state.calendlyAvailableTimes;
|
|
},
|
|
getIsMicEnabled(state) {
|
|
return state.isMicEnabled;
|
|
},
|
|
getIsCamEnabled(state) {
|
|
return state.isCamEnabled;
|
|
},
|
|
getIsDisqualified(state) {
|
|
return state.isDisqualified;
|
|
},
|
|
getShowStartOverPupup(state) {
|
|
return state.showStartOverPupup;
|
|
},
|
|
getSideBarWidth(state) {
|
|
return state.sideBarWidth;
|
|
},
|
|
getFloatingWindow(state) {
|
|
return state.floatingWindow;
|
|
},
|
|
getFloatingWindowSrc(state) {
|
|
return state.floatingWindowSrc;
|
|
},
|
|
getCallStarted(state) {
|
|
return state.callStarted;
|
|
},
|
|
getCallToken(state) {
|
|
return state.callToken;
|
|
},
|
|
getCallType(state) {
|
|
return state.callType;
|
|
},
|
|
getSinglePatientAppointment(state) {
|
|
return state.singlePatientAppointment;
|
|
},
|
|
getCurrentCallPatient(state) {
|
|
return state.current_call_patient;
|
|
},
|
|
getTimeDiff(state) {
|
|
return state.time_diff;
|
|
},
|
|
getSelectedQuestionAnswer(state) {
|
|
return state.category_answers;
|
|
},
|
|
// getCategoryQuestionAnswer(state){
|
|
// return state.saveCategoryAnswer;
|
|
// },
|
|
getPatientAnswers(state) {
|
|
return state.patientAnswers;
|
|
},
|
|
getAgentProfile(state) {
|
|
return state.agentProfile;
|
|
},
|
|
getHistory(state) {
|
|
return state.getHistory;
|
|
},
|
|
getPrescriptionHistory(state) {
|
|
return state.prescriptionHistory;
|
|
},
|
|
getPatientsStats(state) {
|
|
return state.patientsStats;
|
|
},
|
|
|
|
getHistoryFilter(state) {
|
|
return state.getHistoryFilter;
|
|
},
|
|
|
|
getAnalytics(state) {
|
|
return state.getanalytics;
|
|
},
|
|
getPatientsShippingActivity(state) {
|
|
return state.patientsShippingActivity;
|
|
},
|
|
getAnalyticsFilter(state) {
|
|
return state.analyticsFilter;
|
|
},
|
|
getErrors(state) {
|
|
return state.errors;
|
|
},
|
|
getRedirectTo(state) {
|
|
return state.redirectTo;
|
|
},
|
|
getIsTonalSnackbarVisible(state) {
|
|
return state.isTonalSnackbarVisible;
|
|
},
|
|
getErrorMessage(state) {
|
|
return state.errorMessage;
|
|
},
|
|
getIsLoading(state) {
|
|
return state.isLoading;
|
|
},
|
|
getCurrentPage(state) {
|
|
return state.currentPage;
|
|
// return localStorage.getItem('getCurrentPage')
|
|
},
|
|
getAccessToken(state) {
|
|
return state.access_token;
|
|
},
|
|
getLabOrderStatus(state) {
|
|
return state.setLabOrderStatus;
|
|
},
|
|
getPatientPlan(state) {
|
|
return state.plan;
|
|
},
|
|
getPatient(state) {
|
|
return state.patient;
|
|
},
|
|
getAvailableSlots(state) {
|
|
return state.available_slots;
|
|
},
|
|
getCategories(state) {
|
|
return state.set_categories;
|
|
},
|
|
getMedicalCategoryQuestion(state) {
|
|
return state.medical_category_question;
|
|
},
|
|
|
|
getSelectedTimezone(state) {
|
|
return state.selectedTimezone;
|
|
},
|
|
getBookedAppointment(state) {
|
|
return state.bookAppointment;
|
|
},
|
|
getAdditionalInformation(state) {
|
|
return state.additionalInformation;
|
|
},
|
|
getShippingInformation(state) {
|
|
return state.shippingInformation;
|
|
},
|
|
getPatientNotes(state) {
|
|
return state.patientNotes;
|
|
},
|
|
getPrescriptionList(state) {
|
|
return state.patientPrescription;
|
|
},
|
|
getPrescription(state) {
|
|
return state.patientPrescription;
|
|
},
|
|
getPatientLabKit(state) {
|
|
return state.patientLabKit;
|
|
},
|
|
getLabOrderKitAgent(state) {
|
|
return state.labOrderKitAgent;
|
|
},
|
|
getLabOrderProductList(state) {
|
|
return state.labOrderProductKitAgent;
|
|
},
|
|
getPatientOrderList(state) {
|
|
return state.patientOrderList;
|
|
},
|
|
getPatientOrderDetail(state) {
|
|
return state.patientOrderDetail;
|
|
},
|
|
getPatientDetail(state) {
|
|
return state.patientProfileData;
|
|
},
|
|
getPatientsNotification(state){
|
|
return state.patientsNotification;
|
|
},
|
|
getsubscriptionList(state) {
|
|
return state.subscriptionList;
|
|
},
|
|
getErrorMsg(state) {
|
|
return state.isErrorMsg;
|
|
},
|
|
getSuccessMsg(state) {
|
|
console.log("payload");
|
|
return state.isSuccessMsg;
|
|
},
|
|
getShowMsg(state) {
|
|
console.log("payload");
|
|
return state.showMessage;
|
|
},
|
|
getSubscriptionById(state) {
|
|
return state.subscriptionById;
|
|
},
|
|
getProviderAppointmentOrderList(state) {
|
|
return state.providerAppointmentOrderList;
|
|
},
|
|
getNotifications(state)
|
|
{
|
|
return state.notifications
|
|
},
|
|
getNotificationCount(state)
|
|
{
|
|
return state.notificationCount
|
|
},
|
|
getOrderPatientProfile(state) {
|
|
return state.orderPatientProfile
|
|
},
|
|
getOrderLabKit(state) {
|
|
return state.orderLabKit
|
|
},
|
|
getOrderLabKitPatient(state) {
|
|
return state.orderLabKitPatient
|
|
},
|
|
|
|
getPatientUpcomingAppiontments(state){
|
|
return state.patientAppiontment;
|
|
},
|
|
getPatientChat(state){
|
|
return state.patientChat;
|
|
}
|
|
|
|
},
|
|
});
|