feat: VNC, reload store

refactor/issue-1/first-setup
Frédérik Benoist 2023-12-19 00:19:00 +01:00
parent c3f497b4d2
commit 04cb589401
5 changed files with 56 additions and 10 deletions

View File

@ -6,6 +6,7 @@ const { t } = useI18n()
const headers = computed(() => [ const headers = computed(() => [
{ title: 'ID', key: 'id_structure' }, { title: 'ID', key: 'id_structure' },
{ title: t('Name'), key: 'nom' }, { title: t('Name'), key: 'nom' },
{ title: t('Migration'), key: 'date_migration' },
{ title: 'Pos', key: 'nbcaisses' }, { title: 'Pos', key: 'nbcaisses' },
{ title: 'IP', key: 'ip_master', sortable: false }, { title: 'IP', key: 'ip_master', sortable: false },
{ title: t('Phone'), key: 'telephone', sortable: false }, { title: t('Phone'), key: 'telephone', sortable: false },
@ -17,10 +18,16 @@ const headers = computed(() => [
const selectedCountry = ref() const selectedCountry = ref()
const selectedBrand = ref() const selectedBrand = ref()
const selectedNbPos = ref() const selectedNbPos = ref()
const searchQuery = ref('')
const storesList = ref<any>('')
const searchQuery = ref<any>('')
// Data table options // Data table options
const { data: storesList } = await useApi<any>(createUrl('/stores')) const { data: storesListData } = await useApi<any>(createUrl('/stores'))
const isLoading = ref(false)
storesList.value = storesListData.value
const options = ref({ page: 1, itemsPerPage: 10, sortBy: [''], sortDesc: [false] }) const options = ref({ page: 1, itemsPerPage: 10, sortBy: [''], sortDesc: [false] })
const brand = computed(() => { const brand = computed(() => {
@ -93,6 +100,25 @@ interface Caisse {
id_caisse: number id_caisse: number
ip: string ip: string
} }
const reloadStores = async () => {
isLoading.value = true
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { data, error } = await useApi<any>(createUrl('/stores/reload'))
if (!isEmpty(error.value))
console.error('Error loading store data:', error.value)
// Reload the store data
const { data: storeData, error: storeError } = await useApi<any>(createUrl('/stores'))
if (!isEmpty(storeError.value))
console.error('Error loading store data:', storeError.value)
else
storesList.value = storeData.value
isLoading.value = false
}
</script> </script>
<template> <template>
@ -166,9 +192,9 @@ interface Caisse {
<VBtn <VBtn
color="primary" color="primary"
prepend-icon="tabler-reload" prepend-icon="tabler-reload"
@click="$router.push('/apps/ecommerce/product/add')" @click="reloadStores"
> >
Reload {{ t("Reload") }}
</VBtn> </VBtn>
</div> </div>
</div> </div>
@ -176,8 +202,15 @@ interface Caisse {
<VDivider class="mt-4" /> <VDivider class="mt-4" />
<VCol cols="12"> <VCol cols="12">
<div v-if="isLoading">
<VProgressCircular
indeterminate
color="primary"
/>
</div>
<!-- 👉 Datatable --> <!-- 👉 Datatable -->
<VDataTable <VDataTable
v-else
:headers="headers" :headers="headers"
:items="filteredStoresList" :items="filteredStoresList"
:items-per-page="options.itemsPerPage" :items-per-page="options.itemsPerPage"

View File

@ -20,6 +20,7 @@
"TYPE": "TYPE", "TYPE": "TYPE",
"PARENT": "PARENT", "PARENT": "PARENT",
"LEVEL": "LEVEL", "LEVEL": "LEVEL",
"Migration": "MIGRATION",
"EFFECTIVE DATE": "EFFECTIVE DATE", "EFFECTIVE DATE": "EFFECTIVE DATE",
"EXPIRATION DATE": "EXPIRATION DATE", "EXPIRATION DATE": "EXPIRATION DATE",
"DATE_CREATE": "CREATE DATE", "DATE_CREATE": "CREATE DATE",

View File

@ -20,6 +20,7 @@
"TYPE": "TYPE", "TYPE": "TYPE",
"PARENT": "PARENT", "PARENT": "PARENT",
"LEVEL": "LEVEL", "LEVEL": "LEVEL",
"Migration": "MIGRATION",
"EFFECTIVE DATE": "EFFECTIVE DATE", "EFFECTIVE DATE": "EFFECTIVE DATE",
"EXPIRATION DATE": "EXPIRATION DATE", "EXPIRATION DATE": "EXPIRATION DATE",
"DATE_CREATE": "CREATE DATE", "DATE_CREATE": "CREATE DATE",

View File

@ -20,6 +20,7 @@
"TYPE": "TYPE", "TYPE": "TYPE",
"PARENT": "PARENT", "PARENT": "PARENT",
"LEVEL": "NIVEAU", "LEVEL": "NIVEAU",
"Migration": "MIGRATION",
"EFFECTIVE DATE": "DATE EFFECTIVE", "EFFECTIVE DATE": "DATE EFFECTIVE",
"EXPIRATION DATE": "DATE EXPIRATION", "EXPIRATION DATE": "DATE EXPIRATION",
"DATE_CREATE": "DATE CREATION", "DATE_CREATE": "DATE CREATION",

View File

@ -6,6 +6,8 @@ import logoVNC from '@images/misc/remote_128.png'
const props = defineProps<Props>() const props = defineProps<Props>()
const drive = ['M:', 'N:', 'O:', 'P:', 'Q:', 'R:', 'S:', 'T:'] const drive = ['M:', 'N:', 'O:', 'P:', 'Q:', 'R:', 'S:', 'T:']
const selectedProtocol = ref('hdpos')
interface Props { interface Props {
storeData: StoreData storeData: StoreData
} }
@ -22,7 +24,7 @@ onMounted(() => {
}) })
const openVnc = (ip: string) => { const openVnc = (ip: string) => {
const url = `vnc://${ip}` const url = `${selectedProtocol.value}://${ip}`
window.open(url, '_blank') window.open(url, '_blank')
} }
@ -45,11 +47,19 @@ const mountDrive = (ip: string, drive: string) => {
flat flat
border border
> >
<VCardText class="text-center"> <VCardText>
<VCardText class="text-center d-flex align-center justify-left">
<img <img
:src="logoVNC" :src="logoVNC"
size="128" size="128"
> >
<AppSelect
v-model="selectedProtocol"
:items="['hdpos', 'vnc']"
class="me-3"
style="max-inline-size: 130px"
/>
</VCardText>
<div v-if="localStoreData && localStoreData.store.caisses"> <div v-if="localStoreData && localStoreData.store.caisses">
<div <div
v-for="(caisse, index) in localStoreData.store.caisses" v-for="(caisse, index) in localStoreData.store.caisses"