fix
This commit is contained in:
parent
dce2aa9357
commit
7fab7461cd
@ -357,6 +357,8 @@
|
||||
"requiredPhone": true,
|
||||
"requiredFirstName": true,
|
||||
"requiredLastName": true,
|
||||
"requiredEmail": true
|
||||
"requiredEmail": true,
|
||||
"requiredExcelValidator": true,
|
||||
"requiredImageValidator": true
|
||||
}
|
||||
}
|
||||
|
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@ -91,5 +91,7 @@
|
||||
"borderStyle": "solid"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"editor.autoIndent": "advanced",
|
||||
"editor.bracketPairColorization.independentColorPoolPerBracketType": true
|
||||
}
|
||||
|
6
auto-imports.d.ts
vendored
6
auto-imports.d.ts
vendored
@ -122,7 +122,9 @@ declare global {
|
||||
const regexValidator: typeof import('./resources/js/@core/utils/validators.js')['regexValidator']
|
||||
const registerPlugins: typeof import('./resources/js/@core/utils/plugins.js')['registerPlugins']
|
||||
const requiredEmail: typeof import('./resources/js/@core/utils/validators.js')['requiredEmail']
|
||||
const requiredExcelValidator: typeof import('./resources/js/@core/utils/validators.js')['requiredExcelValidator']
|
||||
const requiredFirstName: typeof import('./resources/js/@core/utils/validators.js')['requiredFirstName']
|
||||
const requiredImageValidator: typeof import('./resources/js/@core/utils/validators.js')['requiredImageValidator']
|
||||
const requiredLastName: typeof import('./resources/js/@core/utils/validators.js')['requiredLastName']
|
||||
const requiredPhone: typeof import('./resources/js/@core/utils/validators.js')['requiredPhone']
|
||||
const requiredValidator: typeof import('./resources/js/@core/utils/validators.js')['requiredValidator']
|
||||
@ -481,7 +483,9 @@ declare module 'vue' {
|
||||
readonly regexValidator: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['regexValidator']>
|
||||
readonly registerPlugins: UnwrapRef<typeof import('./resources/js/@core/utils/plugins.js')['registerPlugins']>
|
||||
readonly requiredEmail: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredEmail']>
|
||||
readonly requiredExcelValidator: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredExcelValidator']>
|
||||
readonly requiredFirstName: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredFirstName']>
|
||||
readonly requiredImageValidator: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredImageValidator']>
|
||||
readonly requiredLastName: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredLastName']>
|
||||
readonly requiredPhone: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredPhone']>
|
||||
readonly requiredValidator: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredValidator']>
|
||||
@ -833,7 +837,9 @@ declare module '@vue/runtime-core' {
|
||||
readonly regexValidator: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['regexValidator']>
|
||||
readonly registerPlugins: UnwrapRef<typeof import('./resources/js/@core/utils/plugins.js')['registerPlugins']>
|
||||
readonly requiredEmail: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredEmail']>
|
||||
readonly requiredExcelValidator: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredExcelValidator']>
|
||||
readonly requiredFirstName: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredFirstName']>
|
||||
readonly requiredImageValidator: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredImageValidator']>
|
||||
readonly requiredLastName: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredLastName']>
|
||||
readonly requiredPhone: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredPhone']>
|
||||
readonly requiredValidator: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredValidator']>
|
||||
|
@ -124,3 +124,15 @@ export const requiredEmail = value => {
|
||||
|
||||
return !!String(value).trim().length || 'Email is required'
|
||||
}
|
||||
export const requiredImageValidator = value => {
|
||||
if (isNullOrUndefined(value) || isEmptyArray(value) || value === false)
|
||||
return 'Image field is required'
|
||||
|
||||
return !!String(value).trim().length || 'Email is required'
|
||||
}
|
||||
export const requiredExcelValidator = value => {
|
||||
if (isNullOrUndefined(value) || isEmptyArray(value) || value === false)
|
||||
return 'Excel field is required'
|
||||
|
||||
return !!String(value).trim().length || 'Email is required'
|
||||
}
|
||||
|
@ -23,5 +23,10 @@ export const MEETING_NOTES_API = MAIN_DOMAIN + "/api/admin/get-note/"
|
||||
export const APPOINTMENT_DETAILS_API = MAIN_DOMAIN + "/api/admin/get-appointment/"
|
||||
|
||||
|
||||
export const MEDICINE_LIST_API = MAIN_DOMAIN + "/api/admin/get-med-list"
|
||||
export const MEDICINE_ADD_QUESTIONERIES_EXCEL_API = MAIN_DOMAIN + "/api/admin/questions-files"
|
||||
|
||||
export const MEDICINE_SAVE_API = MAIN_DOMAIN + "/api/admin/save-med"
|
||||
export const MEDICINE_UPDATE_API = MAIN_DOMAIN + "/api/admin/update-med/"
|
||||
export const MEDICINE_DELETE_API = MAIN_DOMAIN + "/api/admin/delete-med/"
|
||||
|
||||
|
@ -15,16 +15,16 @@ import { useStore } from 'vuex'
|
||||
const store = useStore()
|
||||
const cardStatisticsWithImages = [
|
||||
{
|
||||
title: 'Ratings',
|
||||
subtitle: 'Year of 2021',
|
||||
title: 'Patients',
|
||||
subtitle: 'Year of 2024',
|
||||
stats: '13k',
|
||||
change: 15.6,
|
||||
image: illustration1,
|
||||
color: 'primary',
|
||||
},
|
||||
{
|
||||
title: 'Sessions',
|
||||
subtitle: 'Last Week',
|
||||
title: 'Providers',
|
||||
subtitle: 'Year of 2024',
|
||||
stats: '24.5k',
|
||||
change: -20,
|
||||
image: illustration2,
|
||||
@ -59,6 +59,7 @@ onMounted(() => {
|
||||
cols="12"
|
||||
md="3"
|
||||
sm="6"
|
||||
|
||||
>
|
||||
<CardStatisticsWithImages v-bind="statistics" />
|
||||
</VCol>
|
||||
@ -66,6 +67,7 @@ onMounted(() => {
|
||||
<VCol
|
||||
cols="12"
|
||||
md="6"
|
||||
|
||||
>
|
||||
<CrmTransactions />
|
||||
</VCol>
|
||||
@ -74,6 +76,7 @@ onMounted(() => {
|
||||
cols="12"
|
||||
sm="6"
|
||||
md="3"
|
||||
|
||||
>
|
||||
<CrmTotalSales />
|
||||
</VCol>
|
||||
@ -82,6 +85,7 @@ onMounted(() => {
|
||||
cols="12"
|
||||
sm="6"
|
||||
md="3"
|
||||
|
||||
>
|
||||
<CrmRevenueReport />
|
||||
</VCol>
|
||||
@ -89,6 +93,7 @@ onMounted(() => {
|
||||
<VCol
|
||||
cols="12"
|
||||
md="6"
|
||||
style="display: none;"
|
||||
>
|
||||
<CrmSalesOverview />
|
||||
</VCol>
|
||||
@ -96,6 +101,7 @@ onMounted(() => {
|
||||
<VCol
|
||||
cols="12"
|
||||
md="6"
|
||||
style="display: none;"
|
||||
>
|
||||
<CrmActivityTimeline />
|
||||
</VCol>
|
||||
@ -104,6 +110,7 @@ onMounted(() => {
|
||||
cols="12"
|
||||
sm="8"
|
||||
md="4"
|
||||
style="display: none;"
|
||||
>
|
||||
<CrmWeeklySales />
|
||||
</VCol>
|
||||
@ -112,11 +119,13 @@ onMounted(() => {
|
||||
cols="12"
|
||||
md="2"
|
||||
sm="4"
|
||||
style="display: none;"
|
||||
>
|
||||
<VRow class="match-height">
|
||||
<VCol
|
||||
cols="6"
|
||||
sm="12"
|
||||
style="display: none;"
|
||||
>
|
||||
<CrmTotalGrowthCharts />
|
||||
</VCol>
|
||||
@ -124,6 +133,7 @@ onMounted(() => {
|
||||
<VCol
|
||||
cols="6"
|
||||
sm="12"
|
||||
style="display: none;"
|
||||
>
|
||||
<CardStatisticsVertical v-bind="statistic" />
|
||||
</VCol>
|
||||
@ -133,6 +143,7 @@ onMounted(() => {
|
||||
<VCol
|
||||
cols="12"
|
||||
md="4"
|
||||
style="display: none;"
|
||||
>
|
||||
<CrmUpgradeYourPlan />
|
||||
</VCol>
|
||||
@ -140,6 +151,7 @@ onMounted(() => {
|
||||
<VCol
|
||||
cols="12"
|
||||
md="4"
|
||||
style="display: none;"
|
||||
>
|
||||
<CrmMeetingSchedule />
|
||||
</VCol>
|
||||
@ -147,6 +159,7 @@ onMounted(() => {
|
||||
<VCol
|
||||
cols="12"
|
||||
md="4"
|
||||
style="display: none;"
|
||||
>
|
||||
<CrmDeveloperMeetup />
|
||||
</VCol>
|
||||
|
@ -1,28 +1,45 @@
|
||||
<script setup>
|
||||
import data from '@/views/demos/forms/tables/data-table/datatable';
|
||||
|
||||
import { useStore } from 'vuex';
|
||||
const store = useStore()
|
||||
const editDialog = ref(false)
|
||||
const addDialog = ref(false)
|
||||
const deleteDialog = ref(false)
|
||||
const search = ref('')
|
||||
const refVForm = ref(null)
|
||||
const refVFormAdd = ref(null)
|
||||
const selectDropdown = ref(false)
|
||||
const selectdataList = ref(null)
|
||||
const defaultItem = ref({
|
||||
responsiveId: '',
|
||||
id: -1,
|
||||
avatar: '',
|
||||
fullName: '',
|
||||
post: '',
|
||||
email: '',
|
||||
city: '',
|
||||
startDate: '',
|
||||
salary: -1,
|
||||
age: '',
|
||||
experience: '',
|
||||
status: -1,
|
||||
title: '',
|
||||
slug: '',
|
||||
list_one_title: '',
|
||||
list_sub_title: '',
|
||||
list_two_title: '',
|
||||
price: '',
|
||||
currency:""
|
||||
})
|
||||
|
||||
const requiredImageValidator = (value) => !!value || 'Please select an image file.'
|
||||
const requiredExcelValidator = (value) => !!value || 'Please select an Excel file.'
|
||||
const imageFile = ref(null)
|
||||
const excelFile = ref(null)
|
||||
const editedItem = ref(defaultItem.value)
|
||||
const editedIndex = ref(-1)
|
||||
const userList = ref([])
|
||||
const isLoading=ref(false)
|
||||
const medicineList = ref([])
|
||||
const isLoading = ref(false)
|
||||
const currencySign = ref('$');
|
||||
const imageBase64 = ref(null)
|
||||
const excelBase64 = ref(null)
|
||||
const currencies = ref([
|
||||
{ code: 'USD', name: 'US Dollar', sign: '$' },
|
||||
{ code: 'EUR', name: 'Euro', sign: '€' },
|
||||
{ code: 'GBP', name: 'British Pound', sign: '£' },
|
||||
{ code: 'JPY', name: 'Japanese Yen', sign: '¥' },
|
||||
])
|
||||
const setCurrency = (code, sign) => {
|
||||
currencySign.value = sign;
|
||||
// You can perform additional operations with the selected currency code if needed
|
||||
};
|
||||
// status options
|
||||
const selectedOptions = [
|
||||
{
|
||||
@ -49,30 +66,31 @@ const selectedOptions = [
|
||||
|
||||
// headers
|
||||
const headers = [
|
||||
{
|
||||
title: 'NAME',
|
||||
key: 'fullName',
|
||||
{
|
||||
title: 'ID',
|
||||
key: 'id',
|
||||
},
|
||||
{
|
||||
title: 'EMAIL',
|
||||
key: 'email',
|
||||
title: 'Title',
|
||||
key: 'title',
|
||||
},
|
||||
{
|
||||
title: 'DATE',
|
||||
key: 'startDate',
|
||||
title: 'Slug',
|
||||
key: 'slug',
|
||||
},
|
||||
{
|
||||
title: 'SALARY',
|
||||
key: 'salary',
|
||||
title: 'Price',
|
||||
key: 'price',
|
||||
},
|
||||
{
|
||||
title: 'AGE',
|
||||
key: 'age',
|
||||
title: 'Short Detail',
|
||||
key: 'list_one_title',
|
||||
},
|
||||
{
|
||||
title: 'STATUS',
|
||||
key: 'status',
|
||||
title: 'Short Description',
|
||||
key: 'list_sub_title',
|
||||
},
|
||||
|
||||
{
|
||||
title: 'ACTIONS',
|
||||
key: 'actions',
|
||||
@ -108,64 +126,260 @@ const resolveStatusVariant = status => {
|
||||
}
|
||||
|
||||
const editItem = item => {
|
||||
editedIndex.value = userList.value.indexOf(item)
|
||||
editedIndex.value = medicineList.value.indexOf(item)
|
||||
editedItem.value = { ...item }
|
||||
editDialog.value = true
|
||||
}
|
||||
|
||||
const addItem = item => {
|
||||
addDialog.value = true
|
||||
}
|
||||
const deleteItem = item => {
|
||||
editedIndex.value = userList.value.indexOf(item)
|
||||
editedIndex.value = medicineList.value.indexOf(item)
|
||||
editedItem.value = { ...item }
|
||||
deleteDialog.value = true
|
||||
}
|
||||
|
||||
const selectfile = (data) => {
|
||||
if (data == 'dropdown') {
|
||||
selectDropdown.value = true
|
||||
} else {
|
||||
selectDropdown.value = false
|
||||
}
|
||||
|
||||
}
|
||||
const close = () => {
|
||||
editDialog.value = false
|
||||
editedIndex.value = -1
|
||||
editedItem.value = { ...defaultItem.value }
|
||||
}
|
||||
|
||||
const closeAdd = () => {
|
||||
addDialog.value = false
|
||||
}
|
||||
const closeDelete = () => {
|
||||
deleteDialog.value = false
|
||||
editedIndex.value = -1
|
||||
editedItem.value = { ...defaultItem.value }
|
||||
}
|
||||
const getmedicineList = computed(async () => {
|
||||
store.dispatch('updateIsLoading', true)
|
||||
await store.dispatch('medicineList')
|
||||
console.log('medicineList',store.getters.getMedcineList)
|
||||
let list = store.getters.getMedcineList
|
||||
await store.dispatch('questioneriesListExcel')
|
||||
store.dispatch('updateIsLoading', false)
|
||||
let getQuestioneriesList = store.getters.getQuestioneriesList
|
||||
medicineList.value = list
|
||||
return medicineList.value
|
||||
});
|
||||
const convertImageToBase64 = (event) => {
|
||||
const file = event.target.files[0]
|
||||
const reader = new FileReader()
|
||||
reader.readAsDataURL(file)
|
||||
reader.onload = () => {
|
||||
imageBase64.value = reader.result.split(',')[1]
|
||||
}
|
||||
}
|
||||
|
||||
const save = () => {
|
||||
if (editedIndex.value > -1)
|
||||
Object.assign(userList.value[editedIndex.value], editedItem.value)
|
||||
else
|
||||
userList.value.push(editedItem.value)
|
||||
close()
|
||||
const convertExcelToBase64 = (event) => {
|
||||
const file = event.target.files[0]
|
||||
const reader = new FileReader()
|
||||
reader.readAsDataURL(file)
|
||||
reader.onload = () => {
|
||||
excelBase64.value = reader.result.split(',')[1]
|
||||
}
|
||||
}
|
||||
|
||||
const save = async () => {
|
||||
const { valid } = await refVFormAdd.value.validate()
|
||||
console.log(valid)
|
||||
if (valid) {
|
||||
try {
|
||||
|
||||
if (editedIndex.value > -1) {
|
||||
Object.assign(medicineList.value[editedIndex.value], editedItem.value)
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
medicineList.value.push(editedItem.value)
|
||||
console.log(imageFile.value)
|
||||
//const formData = new FormData()
|
||||
//formData.append('image', imageBase64.value)
|
||||
|
||||
|
||||
// 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)
|
||||
let ecelData=''
|
||||
if (selectDropdown.value) {
|
||||
let datexcel = {
|
||||
type: 'string',
|
||||
data:selectdataList.value
|
||||
}
|
||||
console.log(datexcel)
|
||||
ecelData=datexcel
|
||||
//formData.append('excel', datexcel)
|
||||
} else {
|
||||
|
||||
let datexcel = {
|
||||
type: 'file',
|
||||
data:excelBase64.value
|
||||
}
|
||||
ecelData = datexcel
|
||||
// formData.append('excel', datexcel)
|
||||
}
|
||||
await store.dispatch('medicineAdd',{
|
||||
title: defaultItem.value.title,
|
||||
slug: defaultItem.value.slug,
|
||||
list_one_title: defaultItem.value.list_one_title,
|
||||
list_sub_title: defaultItem.value.list_sub_title,
|
||||
list_two_title: defaultItem.value.list_two_title,
|
||||
price: defaultItem.value.price,
|
||||
currency: currencySign.value,
|
||||
excel:'', //ecelData,
|
||||
image:''//imageBase64.value
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Handle the API response
|
||||
console.log(response.data)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
addDialog.value = false
|
||||
await store.dispatch('medicineList')
|
||||
let list = store.getters.getMedcineList
|
||||
medicineList.value = list
|
||||
closeAdd()
|
||||
}
|
||||
}
|
||||
const update = async () => {
|
||||
const { valid } = await refVForm.value.validate()
|
||||
console.log(valid)
|
||||
if (valid) {
|
||||
try {
|
||||
|
||||
if (editedIndex.value > -1) {
|
||||
Object.assign(medicineList.value[editedIndex.value], editedItem.value)
|
||||
|
||||
console.log(imageFile.value)
|
||||
|
||||
let ecelData=''
|
||||
if (selectDropdown.value) {
|
||||
let datexcel = {
|
||||
type: 'string',
|
||||
data:selectdataList.value
|
||||
}
|
||||
console.log(datexcel)
|
||||
ecelData=datexcel
|
||||
//formData.append('excel', datexcel)
|
||||
} else {
|
||||
|
||||
let datexcel = {
|
||||
type: 'file',
|
||||
data:excelBase64.value
|
||||
}
|
||||
ecelData = datexcel
|
||||
// formData.append('excel', datexcel)
|
||||
}
|
||||
await store.dispatch('medicineUpdate', {
|
||||
id:editedItem.value.id,
|
||||
title: editedItem.value.title,
|
||||
slug: editedItem.value.slug,
|
||||
list_one_title: editedItem.value.list_one_title,
|
||||
list_sub_title: editedItem.value.list_sub_title,
|
||||
list_two_title: editedItem.value.list_two_title,
|
||||
price: editedItem.value.price,
|
||||
currency: currencySign.value,
|
||||
excel:'', //ecelData,
|
||||
image:''//imageBase64.value
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
const deleteItemConfirm = () => {
|
||||
userList.value.splice(editedIndex.value, 1)
|
||||
|
||||
|
||||
// Handle the API response
|
||||
console.log(response.data)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
addDialog.value = false
|
||||
await store.dispatch('medicineList')
|
||||
let list = store.getters.getMedcineList
|
||||
medicineList.value = list
|
||||
close()
|
||||
}
|
||||
}
|
||||
const deleteItemConfirm = async () => {
|
||||
|
||||
await store.dispatch('medicineDelete',{
|
||||
id: editedItem.value.id
|
||||
})
|
||||
medicineList.value.splice(editedIndex.value, 1)
|
||||
closeDelete()
|
||||
}
|
||||
|
||||
defaultItem.value.id= null
|
||||
defaultItem.value.title= null
|
||||
defaultItem.value.slug= null
|
||||
defaultItem.value.list_one_title= null
|
||||
defaultItem.value.list_sub_title= null
|
||||
defaultItem.value.list_two_title= null
|
||||
defaultItem.value.price =null
|
||||
defaultItem.value.currency=null
|
||||
|
||||
}
|
||||
const generateSlug = () => {
|
||||
console.log(editedItem.title)
|
||||
if (editedItem.value.title) {
|
||||
editedItem.value.slug = editedItem.value.title
|
||||
.toString()
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
.replace(/\s+/g, '-')
|
||||
.replace(/[^\w-]+/g, '')
|
||||
.replace(/--+/g, '-')
|
||||
.replace(/^-+/, '')
|
||||
.replace(/-+$/, '')
|
||||
} else if (defaultItem.value.title) {
|
||||
defaultItem.value.slug = defaultItem.value.title
|
||||
.toString()
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
.replace(/\s+/g, '-')
|
||||
.replace(/[^\w-]+/g, '')
|
||||
.replace(/--+/g, '-')
|
||||
.replace(/^-+/, '')
|
||||
.replace(/-+$/, '')
|
||||
} else {
|
||||
editedItem.slug = ''
|
||||
}
|
||||
}
|
||||
onMounted(() => {
|
||||
userList.value = JSON.parse(JSON.stringify(data))
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VOverlay
|
||||
v-model="isLoading"
|
||||
contained
|
||||
persistent
|
||||
scroll-strategy="none"
|
||||
class="align-center justify-center"
|
||||
>
|
||||
<VProgressCircular indeterminate />
|
||||
</VOverlay>
|
||||
<VCardText>
|
||||
<VRow>
|
||||
<VCol
|
||||
cols="12"
|
||||
offset-md="8"
|
||||
md="4"
|
||||
>
|
||||
<v-row>
|
||||
<v-col cols="12" md="12" v-if="getmedicineList">
|
||||
<VCardText >
|
||||
<VRow>
|
||||
|
||||
<VCol cols="12" md="8" class="d-flex align-center">
|
||||
<VBtn color="primary" prepend-icon="ri-add-line" @click="addDialog = true">
|
||||
New Medicine
|
||||
</VBtn>
|
||||
</VCol>
|
||||
<VCol cols="12" md="4" class="d-flex justify-end">
|
||||
<VTextField
|
||||
v-model="search"
|
||||
label="Search"
|
||||
@ -178,16 +392,16 @@ onMounted(() => {
|
||||
/>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</VCardText>
|
||||
</VCardText>
|
||||
<VDataTable
|
||||
:headers="headers"
|
||||
:items="userList"
|
||||
:items="medicineList"
|
||||
:search="search"
|
||||
:items-per-page="5"
|
||||
class="text-no-wrap"
|
||||
>
|
||||
<!-- full name -->
|
||||
<template #item.fullName="{ item }">
|
||||
<template #item.name="{ item }">
|
||||
<div class="d-flex align-center">
|
||||
<!-- avatar -->
|
||||
<VAvatar
|
||||
@ -203,12 +417,12 @@ onMounted(() => {
|
||||
<span
|
||||
v-else
|
||||
class="text-sm"
|
||||
>{{ avatarText(item.fullName) }}</span>
|
||||
>{{ avatarText(item.name) }}</span>
|
||||
</VAvatar>
|
||||
|
||||
<div class="d-flex flex-column ms-3">
|
||||
<span class="d-block font-weight-medium text-high-emphasis text-truncate">{{ item.fullName }}</span>
|
||||
<small>{{ item.post }}</small>
|
||||
<span class="d-block font-weight-medium text-high-emphasis text-truncate">{{ item.name }}</span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -241,155 +455,360 @@ onMounted(() => {
|
||||
</div>
|
||||
</template>
|
||||
</VDataTable>
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
<!-- 👉 Edit Dialog -->
|
||||
<VDialog
|
||||
v-model="editDialog"
|
||||
max-width="600px"
|
||||
>
|
||||
<VCard>
|
||||
<VCardTitle>
|
||||
<span class="headline">Edit Item</span>
|
||||
</VCardTitle>
|
||||
<VForm ref="refVForm" >
|
||||
<VCard>
|
||||
<VCardTitle>
|
||||
<span class="headline">Edit Medicine</span>
|
||||
</VCardTitle>
|
||||
|
||||
<VCardText>
|
||||
<VContainer>
|
||||
<VRow>
|
||||
<!-- fullName -->
|
||||
<VCol
|
||||
cols="12"
|
||||
sm="6"
|
||||
md="4"
|
||||
>
|
||||
<VCardText>
|
||||
<VContainer >
|
||||
|
||||
<VRow>
|
||||
<!-- fullName -->
|
||||
<VCol cols="12" md="12">
|
||||
<VTextField
|
||||
v-model="editedItem.title"
|
||||
label="Title"
|
||||
:rules="[requiredValidator]"
|
||||
@input="generateSlug"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="12" md="12">
|
||||
<VTextField
|
||||
v-model="editedItem.slug"
|
||||
label="Slug"
|
||||
:rules="[requiredValidator]"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<VCol cols="12" sm="6" md="12">
|
||||
<VTextField
|
||||
v-model="editedItem.fullName"
|
||||
label="User name"
|
||||
v-model="editedItem.price"
|
||||
label="Price"
|
||||
:rules="[requiredValidator]"
|
||||
prepend-inner-icon
|
||||
>
|
||||
<template v-slot:prepend-inner>
|
||||
<VMenu
|
||||
offset-y
|
||||
transition="slide-y-transition"
|
||||
:close-on-content-click="false"
|
||||
>
|
||||
<template v-slot:activator="{ props }">
|
||||
<span v-bind="props">{{ currencySign || '$money' }}</span>
|
||||
</template>
|
||||
<VList>
|
||||
<VListItem
|
||||
v-for="currency in currencies"
|
||||
:key="currency.code"
|
||||
@click.prevent="setCurrency(currency.code, currency.sign)"
|
||||
>
|
||||
<VListItemTitle>{{ currency.name }}</VListItemTitle>
|
||||
</VListItem>
|
||||
</VList>
|
||||
</VMenu>
|
||||
</template>
|
||||
</VTextField>
|
||||
</VCol>
|
||||
|
||||
<VCol cols="12" sm="6" md="12">
|
||||
<VTextField
|
||||
v-model="editedItem.list_one_title"
|
||||
label="Short Detail"
|
||||
:rules="[requiredValidator]"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="12" sm="6" md="12">
|
||||
<VTextField
|
||||
v-model="editedItem.list_sub_title"
|
||||
label="Short Description"
|
||||
:rules="[requiredValidator]"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<VCol cols="12" sm="6" md="12">
|
||||
<VTextarea
|
||||
v-model="editedItem.list_two_title"
|
||||
label="Full Description"
|
||||
:rules="[requiredValidator]"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<!-- email -->
|
||||
<VCol
|
||||
cols="12"
|
||||
sm="6"
|
||||
md="4"
|
||||
>
|
||||
<VTextField
|
||||
v-model="editedItem.email"
|
||||
label="Email"
|
||||
/>
|
||||
<VCol cols="12" md="8">
|
||||
<div v-if="selectDropdown==false">
|
||||
|
||||
<VFileInput
|
||||
v-model="excelFile"
|
||||
accept=".xlsx,.xls"
|
||||
show-size
|
||||
counter
|
||||
label="Select an Excel file to upload"
|
||||
@change="convertExcelToBase64"
|
||||
|
||||
/>
|
||||
</div>
|
||||
<div v-if="selectDropdown==true">
|
||||
<VSelect
|
||||
v-model="selectdataList"
|
||||
:items="store.getters.getQuestioneriesList"
|
||||
item-title="product_file_path"
|
||||
item-value="product_file_path"
|
||||
label="Select File"
|
||||
prepend-icon="ri-file-line"
|
||||
variant="outlined"
|
||||
/>
|
||||
</div>
|
||||
</VCol>
|
||||
|
||||
<!-- salary -->
|
||||
<VCol
|
||||
cols="12"
|
||||
sm="6"
|
||||
md="4"
|
||||
>
|
||||
<VTextField
|
||||
v-model="editedItem.salary"
|
||||
label="Salary"
|
||||
prefix="$"
|
||||
type="number"
|
||||
/>
|
||||
<VCol cols="12" md="4">
|
||||
<VBtn color="success" variant="outlined" @click="selectfile('dropdown')" class="custom-button" v-if="selectDropdown==false">Select File</VBtn>
|
||||
<VBtn color="success" variant="outlined" @click="selectfile('upload')" class="custom-button" v-if="selectDropdown==true">Upload File</VBtn>
|
||||
</VCol>
|
||||
<VCol cols="12" md="12">
|
||||
<div>
|
||||
|
||||
<VFileInput
|
||||
v-model="imageFile"
|
||||
accept="image/*"
|
||||
show-size
|
||||
counter
|
||||
label="Select an image to upload"
|
||||
@change="convertImageToBase64"
|
||||
/>
|
||||
</div>
|
||||
</VCol>
|
||||
|
||||
</VRow>
|
||||
</VContainer>
|
||||
</VCardText>
|
||||
|
||||
<!-- age -->
|
||||
<VCol
|
||||
cols="12"
|
||||
sm="6"
|
||||
md="4"
|
||||
>
|
||||
<VTextField
|
||||
v-model="editedItem.age"
|
||||
label="Age"
|
||||
type="number"
|
||||
/>
|
||||
</VCol>
|
||||
<VCardActions>
|
||||
<VSpacer />
|
||||
|
||||
<!-- start date -->
|
||||
<VCol
|
||||
cols="12"
|
||||
sm="6"
|
||||
md="4"
|
||||
>
|
||||
<VTextField
|
||||
v-model="editedItem.startDate"
|
||||
label="Date"
|
||||
/>
|
||||
</VCol>
|
||||
<VBtn
|
||||
color="error"
|
||||
variant="outlined"
|
||||
@click="close"
|
||||
>
|
||||
Cancel
|
||||
</VBtn>
|
||||
|
||||
<!-- status -->
|
||||
<VCol
|
||||
cols="12"
|
||||
sm="6"
|
||||
md="4"
|
||||
>
|
||||
<VSelect
|
||||
v-model="editedItem.status"
|
||||
:items="selectedOptions"
|
||||
item-title="text"
|
||||
item-value="value"
|
||||
label="Status"
|
||||
variant="outlined"
|
||||
/>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</VContainer>
|
||||
</VCardText>
|
||||
|
||||
<VCardActions>
|
||||
<VSpacer />
|
||||
|
||||
<VBtn
|
||||
color="error"
|
||||
variant="outlined"
|
||||
@click="close"
|
||||
>
|
||||
Cancel
|
||||
</VBtn>
|
||||
|
||||
<VBtn
|
||||
color="success"
|
||||
variant="elevated"
|
||||
@click="save"
|
||||
>
|
||||
Save
|
||||
</VBtn>
|
||||
</VCardActions>
|
||||
</VCard>
|
||||
<VBtn
|
||||
color="success"
|
||||
variant="elevated"
|
||||
@click="update"
|
||||
>
|
||||
Save
|
||||
</VBtn>
|
||||
|
||||
</VCardActions>
|
||||
</VCard>
|
||||
</VForm>
|
||||
</VDialog>
|
||||
|
||||
<!-- 👉 Delete Dialog -->
|
||||
<!-- 👉 Delete Dialog -->
|
||||
<VDialog
|
||||
v-model="deleteDialog"
|
||||
max-width="500px"
|
||||
>
|
||||
<VCard>
|
||||
<VCardTitle>
|
||||
Are you sure you want to delete this item?
|
||||
</VCardTitle>
|
||||
|
||||
<VCardActions>
|
||||
<VSpacer />
|
||||
|
||||
<VBtn
|
||||
color="error"
|
||||
variant="outlined"
|
||||
@click="closeDelete"
|
||||
>
|
||||
Cancel
|
||||
</VBtn>
|
||||
|
||||
<VBtn
|
||||
color="success"
|
||||
variant="elevated"
|
||||
@click="deleteItemConfirm"
|
||||
>
|
||||
OK
|
||||
</VBtn>
|
||||
|
||||
<VSpacer />
|
||||
</VCardActions>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
|
||||
|
||||
<!-- 👉 Add Dialog -->
|
||||
<VDialog
|
||||
v-model="deleteDialog"
|
||||
max-width="500px"
|
||||
v-model="addDialog"
|
||||
max-width="600px"
|
||||
>
|
||||
<VCard>
|
||||
<VCardTitle>
|
||||
Are you sure you want to delete this item?
|
||||
</VCardTitle>
|
||||
<VForm ref="refVFormAdd" >
|
||||
<VCard>
|
||||
<VCardTitle>
|
||||
<span class="headline">Add Medicine</span>
|
||||
</VCardTitle>
|
||||
|
||||
<VCardActions>
|
||||
<VSpacer />
|
||||
<VCardText>
|
||||
<VContainer >
|
||||
|
||||
<VRow>
|
||||
<!-- fullName -->
|
||||
<VCol cols="12" md="12">
|
||||
<VTextField
|
||||
v-model="defaultItem.title"
|
||||
label="Title"
|
||||
:rules="[requiredValidator]"
|
||||
@input="generateSlug"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="12" md="12">
|
||||
<VTextField
|
||||
v-model="defaultItem.slug"
|
||||
label="Slug"
|
||||
:rules="[requiredValidator]"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<VBtn
|
||||
color="error"
|
||||
variant="outlined"
|
||||
@click="closeDelete"
|
||||
>
|
||||
Cancel
|
||||
</VBtn>
|
||||
<VCol cols="12" sm="6" md="12">
|
||||
<VTextField
|
||||
v-model="defaultItem.price"
|
||||
label="Price"
|
||||
:rules="[requiredValidator]"
|
||||
prepend-inner-icon
|
||||
>
|
||||
<template v-slot:prepend-inner>
|
||||
<VMenu
|
||||
offset-y
|
||||
transition="slide-y-transition"
|
||||
:close-on-content-click="false"
|
||||
>
|
||||
<template v-slot:activator="{ props }">
|
||||
<span v-bind="props">{{ currencySign || '$money' }}</span>
|
||||
</template>
|
||||
<VList>
|
||||
<VListItem
|
||||
v-for="currency in currencies"
|
||||
:key="currency.code"
|
||||
@click.prevent="setCurrency(currency.code, currency.sign)"
|
||||
>
|
||||
<VListItemTitle>{{ currency.name }}</VListItemTitle>
|
||||
</VListItem>
|
||||
</VList>
|
||||
</VMenu>
|
||||
</template>
|
||||
</VTextField>
|
||||
</VCol>
|
||||
|
||||
<VBtn
|
||||
color="success"
|
||||
variant="elevated"
|
||||
@click="deleteItemConfirm"
|
||||
>
|
||||
OK
|
||||
</VBtn>
|
||||
<VCol cols="12" sm="6" md="12">
|
||||
<VTextField
|
||||
v-model="defaultItem.list_one_title"
|
||||
label="Short Detail"
|
||||
:rules="[requiredValidator]"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="12" sm="6" md="12">
|
||||
<VTextField
|
||||
v-model="defaultItem.list_sub_title"
|
||||
label="Short Description"
|
||||
:rules="[requiredValidator]"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<VCol cols="12" sm="6" md="12">
|
||||
<VTextarea
|
||||
v-model="defaultItem.list_two_title"
|
||||
label="Full Description"
|
||||
:rules="[requiredValidator]"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<VSpacer />
|
||||
</VCardActions>
|
||||
</VCard>
|
||||
<VCol cols="12" md="8">
|
||||
<div v-if="selectDropdown==false">
|
||||
|
||||
<VFileInput
|
||||
v-model="excelFile"
|
||||
accept=".xlsx,.xls"
|
||||
:rules="[requiredExcelValidator]"
|
||||
show-size
|
||||
counter
|
||||
label="Select an Excel file to upload"
|
||||
@change="convertExcelToBase64"
|
||||
|
||||
/>
|
||||
</div>
|
||||
<div v-if="selectDropdown==true">
|
||||
<VSelect
|
||||
v-model="selectdataList"
|
||||
:items="store.getters.getQuestioneriesList"
|
||||
item-title="product_file_path"
|
||||
item-value="product_file_path"
|
||||
label="Select File"
|
||||
prepend-icon="ri-file-line"
|
||||
variant="outlined"
|
||||
/>
|
||||
</div>
|
||||
</VCol>
|
||||
<VCol cols="12" md="4">
|
||||
<VBtn color="success" variant="outlined" @click="selectfile('dropdown')" class="custom-button" v-if="selectDropdown==false">Select File</VBtn>
|
||||
<VBtn color="success" variant="outlined" @click="selectfile('upload')" class="custom-button" v-if="selectDropdown==true">Upload File</VBtn>
|
||||
</VCol>
|
||||
<VCol cols="12" md="12">
|
||||
<div>
|
||||
|
||||
<VFileInput
|
||||
v-model="imageFile"
|
||||
accept="image/*"
|
||||
:rules="[requiredImageValidator]"
|
||||
show-size
|
||||
counter
|
||||
label="Select an image to upload"
|
||||
@change="convertImageToBase64"
|
||||
/>
|
||||
</div>
|
||||
</VCol>
|
||||
|
||||
</VRow>
|
||||
</VContainer>
|
||||
</VCardText>
|
||||
|
||||
<VCardActions>
|
||||
<VSpacer />
|
||||
|
||||
<VBtn
|
||||
color="error"
|
||||
variant="outlined"
|
||||
@click="closeAdd"
|
||||
>
|
||||
Cancel
|
||||
</VBtn>
|
||||
|
||||
<VBtn
|
||||
color="success"
|
||||
variant="elevated"
|
||||
@click="save"
|
||||
>
|
||||
Save
|
||||
</VBtn>
|
||||
|
||||
</VCardActions>
|
||||
</VCard>
|
||||
</VForm>
|
||||
</VDialog>
|
||||
</template>
|
||||
<style scoped>
|
||||
.custom-button {
|
||||
width: 100%;
|
||||
height: 48px; /* This value should match the height of your input fields */
|
||||
}
|
||||
</style>
|
||||
|
@ -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
|
||||
},
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user