tag through the object.
+ // credentials: {
+ // username: { label: 'Username', type: 'text', placeholder: '(hint: jsmith)' },
+ // password: { label: 'Password', type: 'password', placeholder: '(hint: hunter2)' }
+ // },
+ // authorize (credentials: any) {
+ // console.warn('ATTENTION: You should replace this with your real providers or credential provider logic! The current setup is not safe')
+ // // You need to provide your own logic here that takes the credentials
+ // // submitted and returns either a object representing a user or value
+ // // that is false/null if the credentials are invalid.
+ // // NOTE: THE BELOW LOGIC IS NOT SAFE OR PROPER FOR AUTHENTICATION!
+
+ // const user = { id: '1', name: 'J Smith', username: 'jsmith', password: 'hunter2' }
+
+ // if (credentials?.username === user.username && credentials?.password === user.password) {
+ // // Any object returned will be saved in `user` property of the JWT
+ // return user
+ // } else {
+ // console.error('Warning: Malicious login attempt registered, bad credentials provided')
+
+ // // If you return null then an error will be displayed advising the user to check their details.
+ // return null
+
+ // // You can also Reject this callback with an Error thus the user will be sent to the error page with the error message as a query parameter
+ // }
+ // }
+ // })
+ ],
+ callbacks: {
+ async jwt({ token, account, user }: { token: any; user: any, account: any }) {
+ try {
+ if (account && account.access_token) {
+ token.access_token_payload = JSON.parse(atob(account.access_token.split('.')[1]));
+ token.jwt = account.access_token;
+ }
+ } catch (err) {
+ console.error(err);
+ }
+ if (account) {
+ token.id_token = account.id_token;
+ token.refresh_token = account.refresh_token;
+ token.expires_at = account.expires_at;
+ token.scope = account.scope;
+ }
+ if (user) { token.user = user }
+ return token
+ },
+ async session({ token,session }:{token:any, session:any}) {
+ const user_payload=JSON.parse(atob(token.jwt.split('.')[1]));
+ try {
+ if (token && token.id_token) {
+ // session.session_user_payload = user_payload;
+ session.jwt = token.jwt;
+ }
+ } catch (err) {
+ console.error(err);
+ }
+ if (token) {
+ // session.id_token = token.id_token;
+ session.refresh_token = token.refresh_token;
+ // session.expires_at = token.expires_at;
+ // session.scope = token.scope;
+ session.isAuthenticated = true;
+ session.user_payload = {
+ userName:user_payload.preferred_username,
+ typeUser:user_payload.type_user||user_payload.resource_access[user_payload.azp].roles[0],
+ roleUser:user_payload.resource_access[user_payload.azp],
+ userInfo:{
+ id:user_payload.id,
+ full_name:user_payload.name,
+ givenName:user_payload.given_name,
+ familyName:user_payload.family_name,
+ email:user_payload.email,
+ group:user_payload.group,
+ },
+ expires:{
+ expires_at:token.expires_at,
+ timestamps:new Date(token.expires_at),
+ date:timestampToDate(token.expires_at,'id-ID'),
+ }
+ };
+ }
+ return session
+ }
+ },
+ pages: {
+ signIn: '/auth/Login',
+ // signOut: '/auth/logout',
+ // error: '/auth/error',
+ // verifyRequest: '/auth/verify-request',
+ // newUser: '/auth/new-user'
+ },
+})
diff --git a/server/api/session.get.ts b/server/api/session.get.ts
new file mode 100644
index 0000000..f06aae9
--- /dev/null
+++ b/server/api/session.get.ts
@@ -0,0 +1,8 @@
+import {getServerSession} from "#auth";
+
+export default eventHandler(async (event) => {
+ // console.log('sesion server');
+ const session = await getServerSession(event)
+ // console.log(session)
+ return session;
+})
\ No newline at end of file
diff --git a/server/api/token.get.ts b/server/api/token.get.ts
new file mode 100644
index 0000000..32f9d97
--- /dev/null
+++ b/server/api/token.get.ts
@@ -0,0 +1,10 @@
+import { getServerSession, getToken } from '#auth'
+
+export default eventHandler(async (event) => {
+ const session = await getServerSession(event)
+ if (!session) {
+ return { status: 'unauthenticated!' }
+ }
+ const token = await getToken({ event })
+ return token || { status: 'no token present' }
+})
\ No newline at end of file
diff --git a/stores/rolePages.ts b/stores/rolePages.ts
index 4a51bd2..94b61ed 100644
--- a/stores/rolePages.ts
+++ b/stores/rolePages.ts
@@ -5,7 +5,7 @@ const rolePages = [
email: "admin@company.com",
password: "123456",
full_name: "System Administrator",
- role: "admin",
+ role: "super_admin",
role_description: "Administrative access with most permissions",
pages: [
{
@@ -71,12 +71,12 @@ const rolePages = [
{
title: "Sample Page Copy",
path: "/sample-page-copy",
- permissions: ["create", "view", "update"],
+ permissions: ["view"],
},
{
title: "CRUD Table",
path: "/tables/datatables/crudtable",
- permissions: ["view"],
+ permissions: ["view", "delete"],
},
{
title: "Basic Table",
@@ -90,7 +90,7 @@ const rolePages = [
},
{
title: "Editable Table",
- permissions: ["view"],
+ permissions: ["view","update"],
path: "/tables/TableEditable",
},
{
@@ -98,6 +98,11 @@ const rolePages = [
permissions: ["view"],
path: "/tables/tableheight",
},
+ {
+ title: "Sample Page Login",
+ path: "/sample-page-login",
+ permissions: ["view"],
+ },
],
},
diff --git a/stores/sidebarMenuAkses/useCoba.ts b/stores/sidebarMenuAkses/useCoba.ts
new file mode 100644
index 0000000..e69de29
diff --git a/stores/sidebarMenuAkses/useMenuAksesStore.ts b/stores/sidebarMenuAkses/useMenuAksesStore.ts
index fa4078c..edd6913 100644
--- a/stores/sidebarMenuAkses/useMenuAksesStore.ts
+++ b/stores/sidebarMenuAkses/useMenuAksesStore.ts
@@ -1,35 +1,42 @@
-import { defineStore } from 'pinia'
-import type { PageAccess, minisidebar } from '@/types/menuAkses/access'
+import { defineStore } from "pinia";
+import type { PageAccess, minisidebar } from "@/types/menuAkses/access";
-export const useHakAksesStore = defineStore('hakAksesMenu', {
+export const useHakAksesStore = defineStore("hakAksesMenu", {
state: () => ({
- role: '',
- pageAccess: [] as PageAccess[], //Array halaman dari backend
- iconItem: [] as minisidebar[],
+ role: "",
+ pageAccess: [] as PageAccess[], //Array halaman dari backend
+ iconItem: [] as minisidebar[],
mergedSidebar: [],
- permissionPage: [] //hasil merge halaman dengan permissions
+ permissionPage: [], //hasil merge halaman dengan permissions
}),
actions: {
- setAccess(payload: { role: string; pages: PageAccess[]; icons: minisidebar[] }) {
- this.role = payload.role
- this.pageAccess = payload.pages
- this.iconItem = payload.icons
+ setAccess(payload: {
+ role: string;
+ pages: PageAccess[];
+ icons: minisidebar[];
+ }) {
+ this.role = payload.role;
+ this.pageAccess = payload.pages;
+ this.iconItem = payload.icons;
},
resetAccess() {
- this.role = ''
- this.pageAccess = []
+ this.role = "";
+ this.pageAccess = [];
+ this.mergedSidebar = [];
},
- setMergedSidebar(sidebar: any) {
- this.mergedSidebar = sidebar
+ setMergedSidebar(sidebar: any) {
+ this.mergedSidebar = sidebar;
},
setPermissionPage(permission: any) {
- this.permissionPage = permission
+ this.permissionPage = permission;
},
- }
-})
-
-
+ },
+ // persist: {
+ // storage: piniaPluginPersistedstate.localStorage(),
+ // },
+ // persist: true,
+});
diff --git a/tsconfig.json b/tsconfig.json
index a746f2a..943710d 100755
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -2,3 +2,4 @@
// https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json"
}
+
diff --git a/types/components/auth/login.ts b/types/components/auth/login.ts
new file mode 100644
index 0000000..cd145af
--- /dev/null
+++ b/types/components/auth/login.ts
@@ -0,0 +1,8 @@
+
+/*Auth*/
+type AuthCurosel={
+ title: string;
+ subtitle: string;
+};
+
+export type{AuthCurosel}
\ No newline at end of file
diff --git a/types/components/dashboard/dashboard1.ts b/types/components/dashboard/dashboard1.ts
new file mode 100644
index 0000000..114850d
--- /dev/null
+++ b/types/components/dashboard/dashboard1.ts
@@ -0,0 +1,21 @@
+/*Revenue Projects*/
+type RevenueProjects={
+ img: string;
+ leadname: string;
+ designation: string;
+ projectname: string;
+ statuscolor: string;
+ statustext: string;
+ money: string;
+};
+
+/*Performance*/
+type Performance={
+ icon: string;
+ subtitle: string;
+ title: string;
+ color: string;
+};
+
+
+export type{RevenueProjects,Performance}
\ No newline at end of file
diff --git a/types/components/dashboard/dashboard2.ts b/types/components/dashboard/dashboard2.ts
new file mode 100644
index 0000000..9e81469
--- /dev/null
+++ b/types/components/dashboard/dashboard2.ts
@@ -0,0 +1,45 @@
+
+
+/*Revenue Forecast Projects*/
+type RevenueForecast={
+ icon: string;
+ subtext: string;
+ profit: string;
+ bgcolor:string;
+ color: string;
+};
+
+/*Annual Profit*/
+type AnnualProfit={
+ title: string;
+ subtitle: string;
+ price: string;
+ percent:string;
+ color: string;
+};
+
+/*Sales from Locations*/
+type SalesFromLocation={
+ name: string;
+ percentage:string;
+ color: string;
+};
+
+// Daily Activities
+type DailyActivities = {
+ title: string;
+ subtitle: string;
+ textcolor: string;
+ boldtext: boolean;
+ line: boolean;
+ link: string;
+ url: string;
+};
+
+/*User cards*/
+type userCard ={
+ img: string;
+};
+
+
+export type{RevenueForecast ,AnnualProfit, SalesFromLocation,DailyActivities,userCard}
\ No newline at end of file
diff --git a/types/components/dashboard/dashboard3.ts b/types/components/dashboard/dashboard3.ts
new file mode 100644
index 0000000..4eaebc4
--- /dev/null
+++ b/types/components/dashboard/dashboard3.ts
@@ -0,0 +1,11 @@
+/*Revenue Forecast Projects*/
+type Iconcard={
+ bg: string;
+ icon: string;
+ color:string;
+ title:string;
+ price:string;
+ link:string;
+};
+
+export type{Iconcard}
\ No newline at end of file
diff --git a/types/components/datatables/index.ts b/types/components/datatables/index.ts
new file mode 100644
index 0000000..1f1f378
--- /dev/null
+++ b/types/components/datatables/index.ts
@@ -0,0 +1,28 @@
+
+type Datatables = {
+ name: string;
+ post: string;
+ project: string;
+ status: string;
+ budget: string;
+};
+
+type SelectedRowDatatable = {
+ name: string;
+ post: string;
+ project: string;
+ status: string;
+ budget: string;
+ selectable:boolean
+};
+
+type filtrable = {
+ name: string;
+ image: string,
+ price: number,
+ rating: number,
+ stock: boolean,
+};
+
+
+export type { Datatables, SelectedRowDatatable, filtrable };
\ No newline at end of file
diff --git a/types/components/front-pages/index.ts b/types/components/front-pages/index.ts
new file mode 100644
index 0000000..8b85b02
--- /dev/null
+++ b/types/components/front-pages/index.ts
@@ -0,0 +1,55 @@
+import type { TablerIconComponent } from "vue-tabler-icons";
+type LeaderType = {
+ img: string;
+ name: string;
+ position: string;
+};
+type TemplateType = {
+ title: string;
+ subtitle: string;
+};
+
+type UserReviews = {
+ img: string;
+ title: string;
+ review: string;
+};
+
+type ThemeFeatures = {
+ icon: any;
+ title: string;
+ color:string;
+};
+
+type PackagesPriceType={
+ listtitle: string;
+ status:boolean;
+ icon:boolean;
+ disable:boolean;
+};
+
+type PackageType = {
+ caption: string;
+ subtext:string;
+ price: number;
+ period:string;
+ buttontext: string;
+ url: string;
+ tagtext: boolean;
+ list:PackagesPriceType[];
+};
+
+type FooterType = {
+ menu:string;
+ link:string
+}
+
+type Feature={
+ icon:string;
+ title:string;
+ subtitle:string;
+ bgcolor:string;
+ color:string;
+}
+
+export type { LeaderType, TemplateType,UserReviews,ThemeFeatures,PackageType,FooterType,Feature};
\ No newline at end of file
diff --git a/types/components/pages/faqData.ts b/types/components/pages/faqData.ts
new file mode 100644
index 0000000..5507bd4
--- /dev/null
+++ b/types/components/pages/faqData.ts
@@ -0,0 +1,7 @@
+/*Faq page data*/
+type faqPageType = {
+ question:string;
+ answer: string;
+};
+
+export type { faqPageType };
\ No newline at end of file
diff --git a/types/components/pages/notificationTab.ts b/types/components/pages/notificationTab.ts
new file mode 100644
index 0000000..8c78fcf
--- /dev/null
+++ b/types/components/pages/notificationTab.ts
@@ -0,0 +1,8 @@
+import type { TablerIconComponent } from "vue-tabler-icons";
+type notificationTabType = {
+ title: string;
+ subtitle: string;
+ icon: TablerIconComponent;
+ switch: boolean;
+};
+export type { notificationTabType };
\ No newline at end of file
diff --git a/types/components/pages/pricingData.ts b/types/components/pages/pricingData.ts
new file mode 100644
index 0000000..4656be9
--- /dev/null
+++ b/types/components/pages/pricingData.ts
@@ -0,0 +1,18 @@
+import type { TablerIconComponent } from "vue-tabler-icons";
+type listPriceType={
+ icon: TablerIconComponent;
+ iconcolor: string;
+ listtitle: string;
+ status:boolean
+};
+type pricingType = {
+ caption: string;
+ image: string;
+ free: boolean;
+ buttontext: string;
+ tagtext: boolean;
+ price: number;
+ yearlyprice: number;
+ list:listPriceType[];
+};
+export type { pricingType };
\ No newline at end of file
diff --git a/types/components/pages/searchLinks.ts b/types/components/pages/searchLinks.ts
new file mode 100644
index 0000000..3b64091
--- /dev/null
+++ b/types/components/pages/searchLinks.ts
@@ -0,0 +1,7 @@
+type SearchLinkType = {
+ title: string;
+ linktitle: string;
+ url: string;
+ subtitle: string;
+};
+export type { SearchLinkType };
\ No newline at end of file
diff --git a/types/components/table/index.ts b/types/components/table/index.ts
new file mode 100644
index 0000000..e17321a
--- /dev/null
+++ b/types/components/table/index.ts
@@ -0,0 +1,142 @@
+import type { TablerIconComponent } from "vue-tabler-icons";
+
+/*Basic table 1 types*/
+type teamGroupType={
+ id: string;
+ color: string;
+ text: string;
+}
+type basicTable1 = {
+ avatar: string;
+ name: string;
+ post: string;
+ pname: string;
+ status: string;
+ statuscolor: string;
+ teams: teamGroupType[];
+ budget: string;
+};
+
+/*Basic table 2 types*/
+type userGroupType={
+ id: string;
+ icon: string;
+};
+type basicTable2 = {
+ avatar: string;
+ name: string;
+ post: string;
+ status: string;
+ statuscolor: string;
+ users: userGroupType[];
+};
+
+/*Basic table 3 types*/
+type teamsGType={
+ status: string;
+ statuscolor: string;
+};
+type basicTable3 ={
+ avatar: string;
+ name: string;
+ handle: string;
+ status: string;
+ statusoffline: boolean;
+ statuscolor: string;
+ email: string;
+ teams:teamsGType[];
+};
+
+/*Basic table 4 types*/
+type basicTable4 = {
+ invoice: string;
+ status: string;
+ statuscolor: string;
+ statusicon: TablerIconComponent;
+ avatar: string;
+ name: string;
+ handle: string;
+ progress: number;
+};
+
+/*Basic table 5 types*/
+type coursesType={
+ status: string;
+ statuscolor: string;
+};
+type basicTable5 ={
+ avatar: string;
+ name: string;
+ handle: string;
+ users: string;
+ courses:coursesType[];
+};
+
+/*Dark table types*/
+type darkTeamsType={
+ id: string;
+ color: string;
+ text: string;
+};
+type tableDark ={
+ avatar: string;
+ name: string;
+ post: string;
+ pname: string;
+ status: string;
+ statuscolor: string;
+ teams:darkTeamsType[];
+ budget: string;
+};
+
+/*Density table types*/
+type densUserType={
+ id: string;
+ icon: string;
+};
+type tableDensity= {
+ avatar: string;
+ name: string;
+ post: string;
+ status: string;
+ statuscolor: string;
+ users: densUserType[];
+};
+
+/*FixedHeader table types*/
+type fixedTeamType={
+ status: string;
+ statuscolor: string;
+};
+type tableFixedHeader ={
+ avatar: string;
+ name: string;
+ handle: string;
+ status: string;
+ statusoffline: boolean;
+ statuscolor: string;
+ email: string;
+ teams:fixedTeamType[];
+};
+
+/*Height table types*/
+type heightCourseType={
+ status: string;
+ statuscolor: string;
+}
+type heightTable ={
+ avatar: string;
+ name: string;
+ handle: string;
+ users: string;
+ email: string;
+ courses:heightCourseType[];
+};
+
+/*Table Action*/
+type tableAction = {
+ icon: TablerIconComponent;
+ listtitle: string;
+};
+
+export type { basicTable1, basicTable2, basicTable3, basicTable4, basicTable5, tableDark, tableDensity,tableFixedHeader, heightTable, tableAction };
\ No newline at end of file
diff --git a/types/components/widget/card.ts b/types/components/widget/card.ts
new file mode 100644
index 0000000..10e145d
--- /dev/null
+++ b/types/components/widget/card.ts
@@ -0,0 +1,85 @@
+import type { TablerIconComponent } from "vue-tabler-icons";
+
+/*Card types*/
+type cardsType = {
+ avatar: string;
+ coveravatar: string;
+ read: string;
+ title: string;
+ link: string;
+ category: string;
+ name: string;
+ view: string;
+ comments: string;
+ time: string;
+};
+
+/*Follow card types*/
+type followCard={
+ title: string;
+ location: string;
+ avatar: string;
+};
+
+/*Music card types*/
+type musicCards={
+ title: string;
+ subheader: string;
+ img: string;
+}
+
+/*Products card types*/
+type productsCards= {
+ title: string;
+ link: string;
+ photo: string;
+ salesPrice: number;
+ price: number;
+ rating: number;
+};
+
+/*Social Icon card types*/
+type socialiconCards={
+ name: string;
+ icon: TablerIconComponent;
+ color: string;
+};
+
+/*Profile card types*/
+type profileCard={
+ title: string;
+ subtitle: string;
+ avatar: string;
+};
+
+/*Upcomming List card types*/
+type upcommingLists={
+ icon: TablerIconComponent;
+ title: string;
+ subtitle: string;
+ rank: string;
+ bgcolor: string;
+};
+
+/*User card types*/
+type userGroupType={
+ icon:string;
+}
+type userCard ={
+ title: string;
+ subtitle: string;
+ avatar: string;
+ userGroup: userGroupType[]
+};
+
+/*Payment Gatway*/
+type paymentGateway = {
+ img: string;
+ title: string;
+ subtitle: string;
+ rank: string;
+ disable: string;
+ bgcolor: string;
+};
+
+export type{cardsType, followCard,musicCards,productsCards, socialiconCards,profileCard,upcommingLists,userCard,paymentGateway}
\ No newline at end of file
diff --git a/types/sessionUserTypes.ts b/types/sessionUserTypes.ts
new file mode 100644
index 0000000..25e51f1
--- /dev/null
+++ b/types/sessionUserTypes.ts
@@ -0,0 +1,20 @@
+export interface SessionUserTypes {
+ userName ?:string,
+ typeUser?:string,
+ roleUser?:string,
+ isAuthenticated?:boolean,
+ userInfo?:UserInfo,
+ expires_in?:ExpiresIn
+}
+interface ExpiresIn {
+ timestamps:number,
+ date:string,
+}
+interface UserInfo{
+ id?:string,
+ fullName?:string,
+ givenName?:string,
+ familyName?:string,
+ email?:string,
+ group?:string
+}
\ No newline at end of file
diff --git a/utils/helper.ts b/utils/helper.ts
new file mode 100644
index 0000000..1e2c27a
--- /dev/null
+++ b/utils/helper.ts
@@ -0,0 +1,30 @@
+export function capitalizeEachWord(text: string) {
+ // const lowercase = text.toLowerCase();
+ // return lowercase.charAt(0).toUpperCase() + lowercase.slice(1);
+ return text
+ .toLowerCase()
+ .split(' ')
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1))
+ .join(' ');
+}
+
+export function timestampToDate(timestamp: number, locale: string, options = {}) {
+ const date = new Date(timestamp * 1000);
+ // locale forma --> `id-ID`
+ return date.toLocaleString(locale, {
+ // timeZone: options.timeZone,
+ weekday: 'long',
+ year: 'numeric',
+ month: 'long',
+ day: 'numeric',
+ hour: '2-digit',
+ minute: '2-digit',
+ second: '2-digit',
+ timeZoneName: 'short',
+ ...options
+ });
+}
+
+export function getTimetoMilis() {
+ return Math.floor(Date.now() / 1000)
+}
\ No newline at end of file