clone code

This commit is contained in:
Kittapath 2023-06-01 12:54:58 +07:00
parent c9597d1e38
commit d57bcd1719
362 changed files with 104804 additions and 0 deletions

259
src/views/Dashboard.vue Normal file
View file

@ -0,0 +1,259 @@
<script setup lang="ts">
import { ref } from "vue";
const iteminbox = ref<any>([]);
const splitterModel = ref<number>(30);
const link = ref<number>(1);
const inboxList = ref<any>([
{
no: 1,
sender: "เจ้าหน้าที่ทะเบียนประวัติ",
subject: "ขอแก้ไขข้อมูลทะเบียนประวัติ",
timereceive: "13/12/2565",
body: "ขอแก้ไขข้อมูลทะเบียนประวัติ เรื่อง ชื่อ-นามสกุล",
ratingModel: 0,
},
{
no: 2,
sender: "เจ้าหน้าที่ทะเบียนประวัติ",
subject: "ขอแก้ไขข้อมูลทะเบียนประวัติ",
timereceive: "13/12/2565",
body: "ขอแก้ไขข้อมูลทะเบียนประวัติ เรื่อง ชื่อ-นามสกุล",
ratingModel: 1,
},
]);
const data = ref<any>([
{
no: 1,
sender: "เจ้าหน้าที่ทะเบียนประวัติ",
subject: "ขอแก้ไขข้อมูลทะเบียนประวัติ",
timereceive: "13/12/2565",
body: "ขอแก้ไขข้อมูลทะเบียนประวัติ เรื่อง ชื่อ-นามสกุล",
},
]);
const btnReply = ref<boolean>(true);
const listpayload = ref<any>([]);
const listpayloadNolink = ref<any>([]);
const smgreplaytitle = ref<string>("");
const smgreplay = ref<string>("");
const userName = ref<any>(localStorage.getItem("userName"));
const thumbStyle = ref<any>({
right: "4px",
borderRadius: "5px",
backgroundColor: "#a8bbbf",
width: "5px",
opacity: 0.5,
});
const barStyle = ref<any>({
right: "2px",
borderRadius: "9px",
backgroundColor: "#d6dee1",
width: "9px",
opacity: 0.2,
});
</script>
<!-- page:หนาแรก -->
<template>
<div class="toptitle text-dark">หนาแรก</div>
<q-splitter
v-model="splitterModel"
:horizontal="$q.screen.lt.sm"
separator-class="bg-grey-2 row"
separator-style="width: 12px"
class="text-dark"
:style="$q.screen.gt.xs ? 'height: 80vh' : 'height:100%;'"
>
<template v-slot:before>
<q-card
flat
bordered
:style="$q.screen.gt.xs ? 'height: 80vh' : 'height: auto;'"
>
<div class="col-12 q-pt-sm q-px-md">
<div class="text-subtitle1 text-weight-medium">กลองขอความ</div>
</div>
<q-scroll-area
:style="$q.screen.gt.xs ? 'height: 74vh' : 'height: 40vh;'"
class="bg-white rounded-borders q-px-md row col-12"
>
<q-list
v-for="(contact, index) in inboxList"
:key="index"
class="q-pt-sm"
>
<q-item
clickable
v-ripple
class="mytry"
:active="link === contact.no"
active-class="my-menu-link"
>
<q-item-section>
<q-item-label caption class="text-weight-light">{{
contact.timereceive
}}</q-item-label>
<q-item-label class="text-weight-medium">{{
contact.sender
}}</q-item-label>
<q-item-label caption lines="2">{{
contact.subject
}}</q-item-label>
</q-item-section>
<q-item-section side top>
<q-rating
v-model="contact.ratingModel"
size="1.4em"
:max="1"
color="grey"
color-selected="yellow-13"
/>
<q-icon
class="q-mt-md"
name="mdi-paperclip"
color="grey-5"
size="xs"
/>
</q-item-section>
</q-item>
<q-separator
v-if="index + 1 < inboxList.length"
:key="index"
color="grey-3 q-mt-sm"
/>
</q-list>
<q-banner
rounded
class="bg-amber-1 text-center q-mt-sm"
v-if="inboxList.length < 1"
>
<div class="text-yellow-10">
<q-icon
name="mdi-alert-box"
class="q-mx-xs"
size="sm"
color="yellow-10"
/>
ไมพบขอความ
</div>
</q-banner>
</q-scroll-area>
</q-card>
</template>
<template v-slot:after>
<q-card
v-if="data != null"
class="q-pa-none rounded-borders"
flat
bordered
:style="$q.screen.gt.xs ? 'height: 80vh' : 'height: auto;'"
>
<div class="eow col-12" v-for="(d, index) in data" :key="index">
<div class="col-12 q-pa-xs">
<q-item>
<q-item-section top avatar>
<q-avatar
size="40px"
rounded
color="primary"
class="text-white"
>
<q-icon name="mdi-account" size="28px" />
</q-avatar>
</q-item-section>
<q-item-section>
<q-item-label class="text-weight-medium">{{
d.subject
}}</q-item-label>
<q-item-label caption lines="2"
>จาก : {{ d.sender }}</q-item-label
>
</q-item-section>
<q-item-section side top>
<q-item-label caption>{{ d.timereceive }}</q-item-label>
<div class="text-grey-8 q-gutter-xs q-pt-sm">
<q-btn
flat
round
dense
icon="mdi-reply"
size="10px"
color="grey-7"
/>
<q-btn
flat
round
dense
icon="mdi-trash-can"
size="10px"
color="grey-7"
/>
<q-btn
flat
round
dense
icon="mdi-dots-vertical"
size="10px"
color="grey-7"
/>
</div>
</q-item-section>
</q-item>
</div>
<div flat class="q-mb-md">
<q-card
flat
bordered
class="text-dark q-mx-md q-pa-md bg-grey-1"
:style="$q.screen.gt.xs ? 'height: 64vh' : ''"
>{{ d.body }}</q-card
>
<div :class="$q.screen.gt.xs ? 'absolute-bottom q-mb-md' : ''">
<div class="row col-12 self-center q-px-md q-pt-md">
<div class="row self-center">
<q-icon name="mdi-paperclip" color="grey" size="xs" />
<div class="text-grey-8 q-pl-sm text-weight-light">
เอกสารแนบ (10 MB)
</div>
</div>
<q-btn
unelevated
size="12px"
dense
class="q-ml-md q-px-sm bg-blue-1 text-blue-7"
label="ดาวน์โหลดทั้งหมด"
/>
</div>
</div>
</div>
</div>
</q-card>
</template>
</q-splitter>
</template>
<style>
.my-menu-link {
background: #ebf9f7 !important;
border-radius: 5px;
border: 1px solid #1bb19ab8;
color: #1bb19ab8 !important;
}
.my-menu-link .q-hoverable {
border-radius: 5px;
}
.mytry {
font-size: 0.75rem;
padding: 12px;
}
.mytry:hover {
border-radius: 5px;
}
</style>

View file

@ -0,0 +1,27 @@
<script lang="ts">
import { defineComponent } from "vue";
export default defineComponent({
name: "Error404NotFound",
});
</script>
<template>
<div
class="fullscreen bg-blue-10 text-white text-center q-pa-md flex flex-center"
>
<div>
<div class="text-h1">ไมพบหนาทองการ</div>
<div class="text-h2">(404 Page Not Found)</div>
<q-btn
class="q-mt-xl"
color="white"
text-color="blue"
unelevated
to="/"
label="กลับไปหน้าหลัก"
no-caps
/>
</div>
</div>
</template>

888
src/views/MainLayout.vue Normal file
View file

@ -0,0 +1,888 @@
<script setup lang="ts">
import { ref, onMounted, onUnmounted } from "vue";
import keycloak from "@/plugins/keycloak";
import { useRoute, useRouter } from "vue-router";
import { useDataStore } from "@/stores/data";
import { storeToRefs } from "pinia";
import { scroll, useQuasar } from "quasar";
import type {
ScrollType,
notiType,
optionType,
} from "../interface/request/main/main";
import { menuList, tabList } from "../interface/request/main/main";
const { setVerticalScrollPosition, getVerticalScrollPosition } = scroll;
const store = useDataStore();
const route = useRoute();
const router = useRouter();
const link = ref<string>("");
const $q = useQuasar();
const { tabData, loader } = storeToRefs(store);
const { changeTab } = store;
const miniState = ref<boolean>(false);
const drawerR = ref<boolean>(false);
const rightActive = ref<boolean>(false);
const resize = ref<number>(0);
const active = ref<number>(0);
const drawerL = ref<boolean>(false);
const fullname = ref<string>("");
const role = ref<string[]>([]);
const notiTrigger = ref<boolean>(false);
const text = ref<string>("");
const notiList = ref<notiType[]>([
{
id: 1,
sender: "ท",
body: "ขอแก้ไขข้อมูลทะเบียนประวัติ",
timereceive: "13/12/2565",
},
]);
const options = ref<optionType[]>([
{
icon: "mdi-account-cog",
label: "ผู้ดูแลระบบ",
value: "op1",
color: "primary",
},
{
icon: "mdi-account-group",
label: "เจ้าหน้าที่",
value: "op2",
color: "blue",
},
{
icon: "mdi-account-circle",
label: "บุคคล",
value: "op3",
color: "indigo",
},
]);
/**
* ใหแสดง แทปดานขวา เมอเขาหน รายละเอยดทะเบยนประว
*/
const tabScroll = () => {
return route.name == "registryDetail";
};
/**
* toggleBtnRight มย ขยาย drawer ขวา
*/
const toggleBtnRight = () => {
drawerR.value = !drawerR.value;
};
/**
* toggleBtnLeft มย ขยาย drawer าย เมอหนาจอ อถงขนาด 1024 px
* ปกตเปนการยอโดยใช Ministate
*/
const toggleBtnLeft = () => {
if (window.innerWidth < 1024) {
drawerL.value = !drawerL.value;
} else {
miniState.value = !miniState.value;
}
};
/**
* Event onScroll นำ ตำแหน top scroll
* ใช function updateScroll
*/
const onScroll = (scroll: ScrollType) => {
const { position } = scroll;
updateScroll(position);
};
/**
* updateScroll เป function active แทปดานขวา
*/
const updateScroll = (position: number) => {
// position undifind position top scroll
if (position === void 0) {
position = document.documentElement.scrollTop || document.body.scrollTop;
}
let last;
/**
* วนหา id ของ div
*/
for (const i in tabList) {
const section = tabList[i];
const item = document.getElementById(section.tag);
/**
* วนหา id ของ div หนาน
* เมอหาไมเจอใหไปตอตวตอไป
* เมอเจอแล ให ตำแหนงบนสดของ div มากกวาหรอเทาก ตำแหน top scroll บวกก แทปดานบน 155
* last เป undifind ให last เทาก tag แล หยดล
* าไมใช undifind ให last เทาก tag แล ปหาต กรณ div นยาว
*/
if (item === null) {
continue;
}
if (item.offsetTop >= position + 155) {
if (last === void 0) {
last = section.tag;
}
break;
} else {
last = section.tag;
}
}
/**
* last ไมเทาก undifind
* ใช เซ active ใหเปนแทปส
* และใช scrollIntoView ายตำแหน activeโดยการเลอนไปหา
*/
if (last !== void 0) {
changeTab(last);
const tocEl = document.getElementById("tab--" + last);
if (tocEl) {
tocEl.scrollIntoView({ block: "nearest" });
}
}
};
/**
* ใหแสดง แทปดานขวา เมอเขาหน รายละเอยดทะเบยนประว และ rightActive เทาก true
*/
const activeBtn = () => {
return route.name == "registryDetail" && rightActive.value;
};
/**
* เมอเรมตนโปรแกรมให event resize และ function myEventHandler
* set function myEventHandler เพราะ state งไมเซ , state เซทเม หนาจอเร ขยบหนาจอ
* เรมเขามา state rightActive เป state โชว มขวา
* งจ boolean งตอง set
*/
onMounted(() => {
myEventHandler(null, false);
window.addEventListener("resize", (e: any) => {
myEventHandler(e, true);
});
});
/**
* เมอออกจากโปรแกรม ให ยกเลกการฟ event resize
*/
onUnmounted(() => {
window.removeEventListener("resize", (e: any) => {
myEventHandler(e, true);
});
});
/**
* @param e event ของ resize
* @param setSCroll เชความาจาก event หรอปาว
* set state resize = ความกวางหนาเว
* เมอความกวาง อยกว 1024( เทาก อยกว 1023) ให rightActive เป true แต rightActive true อยแลวไมอง set
* เมอความกวาง มากกวาหรอเทาก 1024 และเม rightActive เป true
* และ drawerR เป true ให rightActive เป true drawerR เป false ให rightActive เป false
* rightActive = true ; แสดงป drawer าน ขวา
* rightActive = false; ไมแสดงป drawer าน ขวา
*/
const myEventHandler = (e: any, setSCroll: boolean) => {
if (setSCroll) {
resize.value = e.target.innerWidth;
} else {
resize.value = window.innerWidth;
}
if (resize.value < 1024) {
if (!rightActive.value) {
rightActive.value = true;
}
} else {
if (rightActive.value) {
if (drawerR.value) {
rightActive.value = true;
} else {
rightActive.value = false;
}
}
}
};
/**
* ตรวจสอบ path นๆ ายงอย path แมจะเป path child แทปกงจะ active อยเช
* ปกต path จะ active เม path นม ตรงตวมนเช /main
* แตจะไม active เม path child path /main/นๆ
* @param path string
*/
const activeMenu = (path: string) => {
if (path == "dashboard" && route.fullPath == "/") return true;
const bool = route.fullPath.includes(path);
return bool;
};
/**
* เปนฟงกนทนตลอด เพอให active ตรงตามเงอนไขใหเป true
* @param tag string เปนชอของ วนนๆ
*/
const activeTab = (tag: string) => {
return tabData.value == tag;
};
/**
* คลกเพอให router หร scroll ไปยงตำแหนงนนๆ
* @param tag string เปนชอของ วนนๆ
*/
const tagClick = (tag: string) => {
const hash = `#${tag}`;
const items = document.getElementById(tag);
const offset = Math.max(0, items == null ? 0 : items.offsetTop - 84);
// router.replace({ hash });
if (route.hash !== hash) {
const check = activeBtn();
if (check) {
// router.replace({ hash, position: { x: 0, y: 0 } });
// router.replace({ hash }).then(() => {
// setVerticalScrollPosition(window, offset, 300);
// });
drawerR.value = !drawerR.value;
setVerticalScrollPosition(window, offset, 300);
} else {
setVerticalScrollPosition(window, offset, 300);
}
} else {
setVerticalScrollPosition(window, offset, 300);
}
};
/**
* logout keycloak
* confirm อนออกจากระบบ
*/
const doLogout = () => {
$q.dialog({
title: "ยืนยันการออกจากระบบ",
message: `ต้องการออกจากระบบใช้หรือไม่?`,
cancel: "ยกเลิก",
ok: "ยืนยัน",
persistent: true,
}).onOk(() => {
keycloak.logout();
});
};
/**
* งชอผใชงานจาก keycloak
*/
if (keycloak.tokenParsed != null) {
fullname.value = keycloak.tokenParsed.name;
role.value = keycloak.tokenParsed.role;
}
</script>
<!-- โครงเว -->
<template>
<!-- แบบเก design แรก -->
<!-- <q-layout view="lHh Lpr lff"> -->
<!-- ปรบใหบหน รายละเอยดทะเบยนประว -->
<q-layout view="lHh LpR lff" @scroll="onScroll">
<!-- header -->
<q-header flat class="bg-grey-2 text-dark" height-hint="7">
<q-toolbar style="padding: 0 2%">
<q-btn
size="13px"
class="bg-grey-3"
flat
dense
round
@click="toggleBtnLeft"
aria-label="Menu"
>
<q-icon
:name="miniState == false ? 'mdi-backburger' : 'mdi-menu-open'"
size="20px"
color="grey-7"
/>
</q-btn>
<q-space />
<!-- Search -->
<!-- <q-input dense rounded standout v-model="text" placeholder="ค้นหา">
<template v-slot:prepend>
<q-icon name="mdi-magnify" size="20px" color="grey-7" />
</template>
</q-input> -->
<!-- <q-btn class="bg-grey-3" flat dense round>
<q-icon name="mdi-magnify" size="20px" color="grey-7" />
</q-btn>
-->
<!-- Notification -->
<q-btn
round
dense
flat
size="13px"
class="q-mx-md bg-grey-3"
:color="notiList.length === 0 ? 'grey-6' : 'grey-8'"
:disable="notiList.length === 0"
>
<q-icon name="mdi-bell" size="18px" color="grey-7" />
<q-badge
rounded
v-show="notiList.length > 0"
color="negative"
text-color="white"
floating
>{{ notiList.length }}</q-badge
>
<q-menu v-model="notiTrigger" max-width="480px" :offset="[0, 10]">
<div class="q-px-md q-py-sm row col-12 items-center">
<div class="text-subtitle1 text-weight-medium">การแจงเตอน</div>
</div>
<q-list style="min-width: 300px" v-for="n in notiList" :key="n.id">
<q-item v-ripple class="mytry" dense>
<q-item-section avatar top style="min-width: 40px">
<q-avatar color="primary" size="22px" text-color="white">
<span class="text-weight-medium text-uppercase">{{
n.sender
}}</span>
</q-avatar>
</q-item-section>
<q-item-section>
<q-item-label caption class="text-black">{{
n.body
}}</q-item-label>
<q-item-label caption class="row items-center text-grey-7">{{
n.timereceive
}}</q-item-label>
</q-item-section>
<q-btn
size="sm"
unelevated
dense
icon="mdi-close"
class="mybtn q-mx-xs"
></q-btn>
</q-item>
<q-separator color="grey-2" />
</q-list>
</q-menu>
</q-btn>
<div class="row items-center no-wrap">
<q-btn-dropdown size="md" dropdown-color="grey" flat>
<template v-slot:label>
<q-item v-close-popup class="q-pa-none">
<q-item-section :avatar="$q.screen.gt.xs">
<q-avatar color="grey-3">
<!-- <img src="https://cdn.quasar.dev/img/avatar.png" /> -->
<q-icon name="mdi-account" size="22px" color="grey-7" />
</q-avatar>
</q-item-section>
<q-item-section class="text-left gt-xs">
<q-item-label class="text-caption text-weight-medium">{{
fullname
}}</q-item-label>
<!-- <q-item-label caption>เจาหนาท ..</q-item-label> -->
</q-item-section>
</q-item>
</template>
<div
class="row justify-center"
style="border-top: solid 3px #1bb19b !important; width: 273.797px"
>
<div class="column items-center col-12 q-py-md" color="grey-3">
<q-avatar size="72px" color="grey-4">
<q-icon name="mdi-account" color="grey-7" />
<!-- <img :src="require('@/assets/logo.png')" /> -->
</q-avatar>
<div class="text-subtitle2 q-mt-md q-mb-xs text-center">
{{ fullname }}
</div>
<q-btn
color="primary"
label="ออกจากระบบ"
push
size="sm"
v-close-popup
@click="doLogout"
/><!-- -->
</div>
<div class="column col-12">
<q-separator />
<div class="column q-pb-md justify-center">
<div class="text-overline text-grey q-px-md q-pt-sm">
เลอกโหมด
</div>
<!-- <q-option-group v-model="group" :options="options" color="primary"/> -->
<q-list dense v-for="op in options" :key="op.label">
<q-item clickable>
<q-item-section avatar>
<q-avatar
:color="op.color"
text-color="white"
:icon="op.icon"
size="20px"
font-size="12px"
/>
</q-item-section>
<q-item-section class="q-py-sm">{{
op.label
}}</q-item-section>
</q-item>
</q-list>
</div>
</div>
</div>
</q-btn-dropdown>
</div>
<q-btn
size="13px"
class="bg-blue-1"
v-if="activeBtn()"
flat
dense
round
@click="toggleBtnRight"
aria-label="Menu"
>
<q-icon name="mdi-menu" class="rotate-180" size="20px" color="blue" />
</q-btn>
</q-toolbar>
</q-header>
<!-- end header -->
<!-- drawer -->
<q-drawer
side="left"
class="text-white"
style="background: #273238"
v-model="drawerL"
show-if-above
:width="260"
:breakpoint="1023"
:mini="miniState"
>
<!-- วนของเมน mini -->
<template v-slot:mini>
<q-scroll-area class="fit mini-slot cursor-pointer">
<q-toolbar class="q-py-md">
<q-img
src="@/assets/logo.png"
spinner-color="white"
style="height: 32px; max-width: 32px"
/>
</q-toolbar>
<q-separator color="grey-9" />
<!-- เมนอย ตอนย -->
<q-list padding>
<div v-for="(menuItem, index) in menuList" :key="index">
<div v-if="role.includes(menuItem.role)">
<q-item
clickable
v-ripple
:active="link === menuItem.label"
@click="link = menuItem.label"
active-class="text-primary menuActiveMini"
v-if="menuItem.key == 3 || menuItem.key == 5"
>
<div class="row items-center no-wrap">
<q-icon :name="menuItem.icon" size="20px" class="q-ml-md" />
<q-icon
name="mdi-dots-vertical"
size="13px"
color="grey-6"
/>
</div>
<q-tooltip
anchor="center right"
self="center left"
:offset="[10, 10]"
>
{{ menuItem.label }}
</q-tooltip>
<q-menu
anchor="top right"
self="top left"
:offset="[5, 0]"
style="background: #273238; z-index: 9000"
>
<q-list class="text-white q-py-sm">
<div
v-for="(subMenu, i) in menuItem.children"
:key="i"
:to="{ name: `${subMenu.path}` }"
>
<!-- เมนอย 2 -->
<div v-if="menuItem.key == 5">
<q-item dense clickable v-if="subMenu.key !== 5.1">
<q-item-section
>{{ subMenu.label }}
</q-item-section>
<q-item-section side>
<q-icon name="keyboard_arrow_right" />
</q-item-section>
<q-menu
anchor="top end"
self="top start"
:offset="[5, 0]"
style="background: #273238; z-index: 9000"
>
<q-list class="text-white q-py-sm">
<q-item
v-for="subMenu2 in subMenu.children"
:key="subMenu2.label"
:to="{ name: `${subMenu2.path}` }"
dense
class="q-pl-md text-body2"
active-class="text-primary active-item text-weight-medium"
clickable
>
<q-item-section>
<q-item-label>{{
subMenu2.label
}}</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-item>
<q-item
v-else
dense
class="q-pl-md q-pr-xl text-body2"
active-class="text-primary active-item text-weight-medium"
clickable
:to="{ name: `${subMenu.path}` }"
>
<q-item-section>
<q-item-label>{{ subMenu.label }}</q-item-label>
</q-item-section>
</q-item>
</div>
<!-- เมนอย 1 -->
<div v-else>
<q-item
dense
class="q-pl-md q-pr-xl text-body2"
active-class="text-primary active-item text-weight-medium"
clickable
:to="{ name: `${subMenu.path}` }"
>
<q-item-section>
<q-item-label>{{ subMenu.label }}</q-item-label>
</q-item-section>
</q-item>
</div>
</div>
</q-list>
</q-menu>
</q-item>
<q-item
clickable
v-ripple
:to="{ name: `${menuItem.path}` }"
:active="link === menuItem.label"
@click="link = menuItem.label"
active-class="text-primary menuActiveMini"
v-else
>
<q-item-section avatar>
<q-avatar size="md" font-size="20px">
<q-icon :name="menuItem.icon" />
</q-avatar>
</q-item-section>
<q-tooltip
anchor="center right"
self="center left"
:offset="[10, 10]"
>
{{ menuItem.label }}
</q-tooltip>
</q-item>
</div>
</div>
</q-list>
</q-scroll-area>
</template>
<!-- จบสวนของเมน mini -->
<!-- วนของเมน -->
<q-scroll-area class="fit">
<q-toolbar class="q-py-md">
<q-toolbar-title shrink class="row items-center no-wrap">
<q-img
src="@/assets/logo.png"
spinner-color="white"
style="height: 40px; max-width: 40px"
/>
<div class="row q-ml-md">
<div
style="color: #ffffff; letter-spacing: 1px"
class="text-body2 text-weight-bolder"
>
ระบบ<span class="text-primary">ทรพยากรบคคล</span>
</div>
<div class="text-caption text-white">&nbsp;กรงเทพมหานคร</div>
</div>
</q-toolbar-title>
</q-toolbar>
<q-separator inset color="grey-9" />
<q-list padding>
<div v-for="(menuItem, index) in menuList" :key="index">
<!-- เมนอย -->
<div v-if="role.includes(menuItem.role)">
<q-expansion-item
group="somegroup"
class="menuSub"
expand-icon="mdi-chevron-down"
expanded-icon="mdi-chevron-up"
v-if="menuItem.key == 3 || menuItem.key == 5"
>
<template v-slot:header>
<q-item-section avatar>
<q-avatar
:icon="menuItem.icon"
size="md"
font-size="20px"
/>
</q-item-section>
<q-item-section>{{ menuItem.label }}</q-item-section>
</template>
<!-- เมนอย 2 (สรรหา) -->
<div v-if="menuItem.key == 5">
<div v-for="(subMenu, i) in menuItem.children" :key="i">
<q-expansion-item
switch-toggle-side
dense-toggle
:label="subMenu.label"
v-if="subMenu.key !== 5.1"
dense
>
<q-item
dense
class="menuSubHover"
active-class="text-primary active-item text-weight-bold menuSubAct"
clickable
v-for="subMenu2 in subMenu.children"
:key="subMenu2.key"
:to="{ name: `${subMenu2.path}` }"
>
<q-item-section>
<q-item-label>{{ subMenu2.label }} </q-item-label>
</q-item-section>
</q-item>
</q-expansion-item>
<q-item
v-else
dense
class="menuSubHover"
active-class="text-primary active-item text-weight-bold menuSubAct"
clickable
:to="{ name: `${subMenu.path}` }"
>
<q-item-section>
<q-item-label>{{ subMenu.label }}</q-item-label>
</q-item-section>
</q-item>
</div>
</div>
<!-- เมนอย 1 -->
<q-item
v-else
dense
class="menuSubHover"
active-class="text-primary active-item text-weight-bold menuSubAct"
clickable
v-for="(subMenu, j) in menuItem.children"
:key="j"
:to="{ name: `${subMenu.path}` }"
>
<q-item-section>
<q-item-label>{{ subMenu.label }}</q-item-label>
</q-item-section>
</q-item>
</q-expansion-item>
<!-- เมนปกต -->
<q-item
class="text-weight-medium menu"
active-class="text-primary active-item text-weight-bold menuActive"
:to="{ name: `${menuItem.path}` }"
:active="activeMenu(menuItem.path)"
clickable
v-ripple
dense
exact
v-else
>
<q-item-section avatar>
<q-avatar size="md" font-size="20px">
<q-icon
:name="
menuItem.key === active
? menuItem.activeIcon
: menuItem.icon
"
/>
</q-avatar>
</q-item-section>
<q-item-section>
<q-item-label>{{ menuItem.label }}</q-item-label>
</q-item-section>
</q-item>
</div>
</div>
</q-list>
</q-scroll-area>
</q-drawer>
<!-- drawer page registry/:id -->
<q-drawer
side="right"
class="bg-grey-2"
show-if-above
v-if="tabScroll()"
v-model="drawerR"
:width="220"
:breakpoint="1023"
>
<q-scroll-area class="fit">
<q-list padding>
<q-item
v-for="(tabItem, index) in tabList"
:key="index"
:id="'tab--' + tabItem.tag"
class="tabNative"
active-class="text-blue-7 active-item text-weight-medium tabActive"
:active="activeTab(tabItem.tag)"
clickable
v-ripple
dense
exact
@click="tagClick(tabItem.tag)"
>
<q-item-section>
<q-item-label
><q-icon size="11px" name="mdi-circle-medium" /><span
class="q-pl-xs"
>{{ tabItem.label }}</span
></q-item-label
>
</q-item-section>
</q-item>
</q-list>
</q-scroll-area>
</q-drawer>
<!-- drawer -->
<q-page-container class="bg-grey-2">
<q-page style="padding: 0 2%">
<router-view :key="$route.fullPath" />
</q-page>
</q-page-container>
<full-loader :visibility="loader" />
</q-layout>
</template>
<style>
.menu {
padding-bottom: 5px;
padding-top: 5px;
border-radius: 0 100px 100px 0;
margin-right: 4%;
}
.menuActive {
background: #212a2f;
border-radius: 0 100px 100px 0;
margin-right: 4%;
}
.menuActiveMini {
background: #212a2f;
}
.menuSub .q-item {
border-radius: 0 100px 100px 0;
margin-right: 4%;
}
/* .menuSubAct {
background: #1e2529d9;
} */
.menuSubHover {
padding-left: 30%;
border-radius: 20px;
}
.menuSub .q-expansion-item__content {
background: #212a2f;
padding: 5px 0px;
margin-bottom: 5px;
}
.tabNative {
color: grey;
padding-left: 8%;
border-radius: 100px 0px 0px 100px;
}
.tabActive {
padding-left: 8%;
background: #e4f2ff;
border-radius: 100px 0px 0px 100px;
}
.q-card {
box-shadow: 3px 3px 20px -10px rgba(151, 150, 150, 0.261) !important;
}
.q-card--bordered {
border: 1px solid #ededed;
box-shadow: none !important;
}
.q-menu {
box-shadow: 3px 3px 10px 1px rgba(95, 95, 95, 0.15) !important;
}
.toptitle {
font-size: 1.2rem;
font-weight: bold;
margin-bottom: 1%;
}
.q-field--outlined .q-field__control {
border-radius: 5px;
}
.q-field--outlined .q-field__control:before {
border-color: #c8d3db;
}
.btnManu {
min-height: 48px;
border-radius: 0px 100px 100px 0px;
}
.q-field--outlined .q-icon {
color: #7474747f;
}
/* custom scrollbar */
::-webkit-scrollbar {
width: 20px;
height: 20px;
}
::-webkit-scrollbar-track {
background-color: transparent;
}
::-webkit-scrollbar-thumb {
background-color: #d6dee1;
border-radius: 20px;
border: 6px solid transparent;
background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
background-color: #a8bbbf;
}
</style>

249
src/views/TestView.vue Normal file
View file

@ -0,0 +1,249 @@
<template>
<div>
<div>TEST VIEW</div>
<q-btn color="primary" label="TEST" @click="testCancel" />
<data-table
:rows="rows"
:columns="columns"
:filter="filter"
:visible-columns="visibleColumns"
v-model:inputfilter="filter"
v-model:inputvisible="visibleColumns"
>
<!-- :nornmalData="true" -->
<template #columns="props">
<q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.name" :props="props">
{{ col.value }}
</q-td>
</q-tr>
</template>
</data-table>
<FullCalendar
ref="fullCalendar"
class="demo-app-calendar"
:options="calendarOptions"
>
<template v-slot:eventContent="arg">
<b>{{ arg.timeText }}</b>
<i>{{ arg.event.title }}</i>
</template>
</FullCalendar>
<!-- publicData เปนสถานะ "เผยแพร่" องใสตลอด(าไมใส จะเปนสถานะ"ยังไม่เผยแพร่") ดการท state child ไดเลย -->
</div>
</template>
<script setup lang="ts">
import { defineComponent, ref } from "vue";
import { useQuasar } from "quasar";
// import { useCounterStore } from "@/stores/data";
import { useCounterMixin } from "@/stores/mixin";
import FullCalendar from "@fullcalendar/vue3";
import dayGridPlugin from "@fullcalendar/daygrid";
import timeGridPlugin from "@fullcalendar/timegrid";
import interactionPlugin from "@fullcalendar/interaction";
import allLocales from "@fullcalendar/core/locales-all";
import listPlugin from "@fullcalendar/list";
const props = defineProps({});
const mixin = useCounterMixin();
const { success } = mixin;
const $q = useQuasar();
const columns = ref<any>([
{
name: "name",
label: "Dessert (100g serving)",
align: "left",
field: (row: any) => row.name,
format: (val: any) => `${val}`,
sortable: true,
},
{
name: "calories",
align: "center",
label: "Calories",
field: "calories",
sortable: true,
},
{ name: "fat", label: "Fat (g)", field: "fat", sortable: true },
{ name: "carbs", label: "Carbs (g)", field: "carbs" },
{ name: "protein", label: "Protein (g)", field: "protein" },
{ name: "sodium", label: "Sodium (mg)", field: "sodium" },
{
name: "calcium",
label: "Calcium (%)",
field: "calcium",
sortable: true,
sort: (a: any, b: any) => parseInt(a, 10) - parseInt(b, 10),
},
{
name: "iron",
label: "Iron (%)",
field: "iron",
sortable: true,
sort: (a: any, b: any) => parseInt(a, 10) - parseInt(b, 10),
},
]);
const rows = ref<any>([
{
name: "Frozen Yogurt",
calories: 159,
fat: 6.0,
carbs: 24,
protein: 4.0,
sodium: 87,
calcium: "14%",
iron: "1%",
},
{
name: "Ice cream sandwich",
calories: 237,
fat: 9.0,
carbs: 37,
protein: 4.3,
sodium: 129,
calcium: "8%",
iron: "1%",
},
{
name: "Eclair",
calories: 262,
fat: 16.0,
carbs: 23,
protein: 6.0,
sodium: 337,
calcium: "6%",
iron: "7%",
},
{
name: "Cupcake",
calories: 305,
fat: 3.7,
carbs: 67,
protein: 4.3,
sodium: 413,
calcium: "3%",
iron: "8%",
},
{
name: "Gingerbread",
calories: 356,
fat: 16.0,
carbs: 49,
protein: 3.9,
sodium: 327,
calcium: "7%",
iron: "16%",
},
{
name: "Jelly bean",
calories: 375,
fat: 0.0,
carbs: 94,
protein: 0.0,
sodium: 50,
calcium: "0%",
iron: "0%",
},
{
name: "Lollipop",
calories: 392,
fat: 0.2,
carbs: 98,
protein: 0,
sodium: 38,
calcium: "0%",
iron: "2%",
},
{
name: "Honeycomb",
calories: 408,
fat: 3.2,
carbs: 87,
protein: 6.5,
sodium: 562,
calcium: "0%",
iron: "45%",
},
{
name: "Donut",
calories: 452,
fat: 25.0,
carbs: 51,
protein: 4.9,
sodium: 326,
calcium: "2%",
iron: "22%",
},
{
name: "KitKat",
calories: 518,
fat: 26.0,
carbs: 65,
protein: 7,
sodium: 54,
calcium: "12%",
iron: "6%",
},
]);
const filter = ref<string>("");
const visibleColumns = ref<String[]>([]);
["name", "calories", "fat", "carbs", "protein", "sodium", "calcium", "iron"];
const edit = ref<boolean>(false);
const calendarOptions = ref<any>({
plugins: [
dayGridPlugin,
timeGridPlugin,
interactionPlugin, // needed for dateClick
],
headerToolbar: {
left: "prev,next today",
center: "title",
right: "dayGridMonth,timeGridWeek,timeGridDay",
},
initialView: "dayGridMonth",
initialEvents: [
{
id: 1,
title:
"All-day eventAll-day eventAll-day eventAll-day eventAll-day eventAll-day eventAll-day eventAll-day eventAll-day eventAll-day eventAll-day eventAll-day eventAll-day eventAll-day event",
start: new Date().toISOString().replace(/T.*$/, ""),
},
{
id: 2,
title:
"Timed event Timed eventTimed eventTimed eventTimed eventTimed eventTimed eventTimed eventTimed event Timed eventTimed eventTimed eventTimed event",
start: new Date().toISOString().replace(/T.*$/, "") + "T12:00:00",
},
], // alternatively, use the `events` setting to fetch from a feed
editable: true,
selectable: true,
selectMirror: true,
dayMaxEvents: true,
weekends: true,
// select: this.handleDateSelect,
// eventClick: this.handleEventClick,
// eventsSet: this.handleEvents
/* you can update a remote database when these fire:
eventAdd:
eventChange:
eventRemove:
*/
});
const testAdd = () => {
// console.log("test");
};
const testCancel = () => {
edit.value = false;
console.log("testCancel");
success($q, "asd");
};
</script>
<style>
.fc-event {
overflow: hidden;
}
</style>