first commit
This commit is contained in:
43
src/stores/auth.ts
Normal file
43
src/stores/auth.ts
Normal file
@ -0,0 +1,43 @@
|
||||
import { ref, computed } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
import { dispatchNotification } from '@/components/Notification'
|
||||
import router from '@/router'
|
||||
|
||||
export const useAuthStore = defineStore('auth', () => {
|
||||
// token from localStorage
|
||||
const token = ref(localStorage.getItem('token') || '')
|
||||
// create a shared state
|
||||
const username = ref('')
|
||||
const password = ref('')
|
||||
const isLoading = ref(false)
|
||||
const isLoggedIn = computed(() => token.value !== '')
|
||||
|
||||
// define your actions
|
||||
function login() {
|
||||
if (username.value == '' || password.value == '') {
|
||||
dispatchNotification({ title: 'Perhatian', content: 'Username atau password tidak boleh kosong', type: 'warning' })
|
||||
} else {
|
||||
isLoading.value = true
|
||||
setTimeout(() => {
|
||||
isLoading.value = false
|
||||
if (username.value == 'demo' && password.value == 'demo') {
|
||||
// store token in localStorage
|
||||
localStorage.setItem('token', 'secret-token')
|
||||
dispatchNotification({ title: 'Berhasil', content: 'Login berhasil, selamat datang kembali!', type: 'success' })
|
||||
// redirect to home page after login
|
||||
// router.replace('/')
|
||||
router.go(0)
|
||||
} else {
|
||||
dispatchNotification({ title: 'Login Gagal', content: 'Username atau password salah', type: 'error' })
|
||||
}
|
||||
}, 3000)
|
||||
}
|
||||
}
|
||||
|
||||
function logout() {
|
||||
localStorage.removeItem('token')
|
||||
}
|
||||
|
||||
// expose everything
|
||||
return { token, username, password, isLoggedIn, login, logout, isLoading }
|
||||
})
|
47
src/stores/command.ts
Normal file
47
src/stores/command.ts
Normal file
@ -0,0 +1,47 @@
|
||||
import { ref } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
export const useCommandPalattesStore = defineStore('command_palettes', () => {
|
||||
const open = ref(false);
|
||||
|
||||
const controlStatus = ref(false)
|
||||
const keyFStatus = ref(false)
|
||||
|
||||
function showCommandPalettes() {
|
||||
open.value = true;
|
||||
}
|
||||
|
||||
function handleOnDismissCommandPalettes() {
|
||||
open.value = false;
|
||||
}
|
||||
|
||||
function onKeyPressed(event: KeyboardEvent) {
|
||||
if (event.key === 'Control') {
|
||||
console.log('control pressed');
|
||||
controlStatus.value = true
|
||||
}
|
||||
|
||||
if (event.key === 'f') {
|
||||
console.log('f pressed');
|
||||
keyFStatus.value = true
|
||||
}
|
||||
|
||||
if (controlStatus.value && keyFStatus.value) {
|
||||
showCommandPalettes()
|
||||
}
|
||||
}
|
||||
|
||||
function onKeyUp(event: KeyboardEvent) {
|
||||
if (event.key === 'Control') {
|
||||
console.log('control released');
|
||||
controlStatus.value = false
|
||||
}
|
||||
|
||||
if (event.key === 'f') {
|
||||
console.log('f released');
|
||||
keyFStatus.value = false
|
||||
}
|
||||
}
|
||||
|
||||
return { open, showCommandPalettes, handleOnDismissCommandPalettes, onKeyPressed, onKeyUp }
|
||||
})
|
259
src/stores/menu.ts
Normal file
259
src/stores/menu.ts
Normal file
@ -0,0 +1,259 @@
|
||||
import { ref, computed } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
import {
|
||||
BoltIcon,
|
||||
Cog6ToothIcon,
|
||||
ComputerDesktopIcon,
|
||||
DocumentDuplicateIcon,
|
||||
DocumentTextIcon,
|
||||
FolderArrowDownIcon,
|
||||
FolderOpenIcon,
|
||||
ShieldCheckIcon,
|
||||
} from '@heroicons/vue/24/outline'
|
||||
|
||||
|
||||
export const useMenuStore = defineStore('menu', () => {
|
||||
const navigation = [
|
||||
{
|
||||
name: 'Daftar Transaksi',
|
||||
icon: DocumentDuplicateIcon,
|
||||
href: '/daftar-transaksi',
|
||||
children: [
|
||||
{ name: 'Transaksi Aktif Individual', href: '/daftar-transaksi/aktif-individual', icon: DocumentDuplicateIcon, children: [], },
|
||||
{ name: 'Transaksi Aktif PLN Mobile', href: '/daftar-transaksi/aktif-pln-mobile', icon: DocumentDuplicateIcon, children: [], },
|
||||
{ name: 'Transaksi Aktif Periksa dan Return Order', href: '/daftar-transaksi/periksa-return-order', icon: DocumentDuplicateIcon, children: [], },
|
||||
{ name: 'Transaksi Aktif TM', href: '/daftar-transaksi/aktif-tm', icon: DocumentDuplicateIcon, children: [], },
|
||||
{ name: 'Transaksi Aktif Historis', href: '/daftar-transaksi/aktif-historis', icon: DocumentDuplicateIcon, children: [], },
|
||||
{ name: 'Monitoring Alih Unit', href: '/daftar-transaksi/monitoring-alih-unit', icon: DocumentDuplicateIcon, children: [], },
|
||||
{ name: 'Monitoring All', href: '/daftar-transaksi/monitoring-all', icon: DocumentDuplicateIcon, children: [], },
|
||||
{ name: 'Monitoring Tiket', href: '/daftar-transaksi/monitoring-tiket', icon: DocumentDuplicateIcon, children: [], },
|
||||
{ name: 'Monitoring History', href: '/daftar-transaksi/monitoring-history', icon: DocumentDuplicateIcon, children: [], },
|
||||
{ name: 'Monitoring Aktif', href: '/daftar-transaksi/monitoring-aktif', icon: DocumentDuplicateIcon, children: [], },
|
||||
{ name: 'Monitoring Close di CC', href: '/daftar-transaksi/monitoring-close-cc', icon: DocumentDuplicateIcon, children: [], },
|
||||
{ name: 'Monitoring Log AutoDispatch', href: '/daftar-transaksi/monitoring-log-autodispatch', icon: DocumentDuplicateIcon, children: [], },
|
||||
{ name: 'Monitoring Yang Perlu Diperhatikan', href: '/daftar-transaksi/monitoring-perlu-diperhatikan', icon: DocumentDuplicateIcon, children: [], },
|
||||
{ name: 'Monitoring Log Break Regu', href: '/daftar-transaksi/monitoring-log-break-regu', icon: DocumentDuplicateIcon, children: [], },
|
||||
{ name: 'Monitoring Log Alih Regu', href: '/daftar-transaksi/monitoring-log-alih-regu', icon: DocumentDuplicateIcon, children: [], },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Administration',
|
||||
icon: ShieldCheckIcon,
|
||||
href: '/administration',
|
||||
children: [
|
||||
{
|
||||
name: 'Audit Trails',
|
||||
icon: ShieldCheckIcon,
|
||||
href: '/administration/audit-trails',
|
||||
children: [
|
||||
{
|
||||
name: 'Log Login',
|
||||
href: '/administration/audit-trails/log-login',
|
||||
icon: ShieldCheckIcon,
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
name: 'Log Activity',
|
||||
href: '/administration/audit-trails/log-aktivity',
|
||||
icon: ShieldCheckIcon,
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
name: 'Log Error',
|
||||
href: '/administration/audit-trails/log-error',
|
||||
icon: ShieldCheckIcon,
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Task Management',
|
||||
icon: ShieldCheckIcon,
|
||||
href: '/administration/task-management',
|
||||
children: [
|
||||
{ name: 'Menu Management', href: '/administration/task-management/menu-management', icon: ShieldCheckIcon, children: [], },
|
||||
{ name: 'System Parameter', href: '/administration/task-management/system-parameter', icon: ShieldCheckIcon, children: [], },
|
||||
{ name: 'User Profile Manager', href: '/administration/task-management/ubah-profile-manager', icon: ShieldCheckIcon, children: [], },
|
||||
{ name: 'Security Projek', href: '/administration/task-management/security-projek', icon: ShieldCheckIcon, children: [], },
|
||||
{ name: 'User Role Manager', href: '/administration/task-management/user-role-manager', icon: ShieldCheckIcon, children: [], },
|
||||
{ name: 'Menu Authorization', href: '/administration/task-management/menu-authorization', icon: ShieldCheckIcon, children: [], },
|
||||
{ name: 'Workflow Designer', href: '/administration/task-management/workflow-designer', icon: ShieldCheckIcon, children: [], },
|
||||
{ name: 'APKT News', href: '/administration/task-management/apkt-news', icon: ShieldCheckIcon, children: [], },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Master Borderless',
|
||||
icon: ShieldCheckIcon,
|
||||
href: '/administration/master-borderless',
|
||||
children: [
|
||||
{ name: 'Zone Borderless', href: '/administration/master-borderless/zone-borderless', icon: ShieldCheckIcon, children: [], },
|
||||
{ name: 'User Zone Borderless', href: '/administration/master-borderless/user-zone-borderless', icon: ShieldCheckIcon, children: [], },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Master Yantek',
|
||||
icon: FolderOpenIcon,
|
||||
href: '/master-yantek',
|
||||
children: [
|
||||
{ name: 'Unit', href: '/master-yantek/unit', icon: FolderOpenIcon, children: [], },
|
||||
{ name: 'Unit Jaringan', href: '/master-yantek/unit-jaringan', icon: FolderOpenIcon, children: [], },
|
||||
{ name: 'Unit Pelayanan', href: '/master-yantek/unit-pelayanan', icon: FolderOpenIcon, children: [], },
|
||||
{ name: 'Regu Yantek', href: '/master-yantek/regu-yantek', icon: FolderOpenIcon, children: [], },
|
||||
{ name: 'Gardu Induk', href: '/master-yantek/gardu-induk', icon: FolderOpenIcon, children: [], },
|
||||
{ name: 'Gardu Penyulang TM', href: '/master-yantek/gardu-penyulang-tm', icon: FolderOpenIcon, children: [], },
|
||||
{ name: 'Gardu Distribusi', href: '/master-yantek/gardu-distribusi', icon: FolderOpenIcon, children: [], },
|
||||
{ name: 'Group Gangguan', href: '/master-yantek/group-gangguan', icon: FolderOpenIcon, children: [], },
|
||||
{ name: 'Wilayah Yantek', href: '/master-yantek/wilayah-yantek', icon: FolderOpenIcon, children: [], },
|
||||
{ name: 'Material', href: '/master-yantek/material', icon: FolderOpenIcon, children: [], },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Transaksi',
|
||||
icon: DocumentTextIcon,
|
||||
href: '/transaksi',
|
||||
children: [
|
||||
{ name: 'Gangguan dan Keluhan', href: '/transaksi/gangguan-dan-keluhan', icon: DocumentTextIcon, children: [], },
|
||||
{ name: 'Gangguan Tegangan Menengah', href: '/transaksi/gangguan-tegangan-menengah', icon: DocumentTextIcon, children: [], },
|
||||
{ name: 'Pemadaman Terencana', href: '/transaksi/pemadaman-terencana', icon: DocumentTextIcon, children: [], },
|
||||
{ name: 'Aplikasi Off-Line', href: '/transaksi/aplikasi-off-line', icon: DocumentTextIcon, children: [], },
|
||||
{ name: 'Penugasan Khusus', href: '/transaksi/penugasan-khusus', icon: DocumentTextIcon, children: [], },
|
||||
{ name: 'Mutasi Pengaduan', href: '/transaksi/mutasi-pengaduan', icon: DocumentTextIcon, children: [], },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Saidi Saifi',
|
||||
icon: ComputerDesktopIcon,
|
||||
href: '/saidi-saifi',
|
||||
children: [
|
||||
{
|
||||
name: 'Monitor Jaringan',
|
||||
icon: ComputerDesktopIcon,
|
||||
href: '/saidi-saifi/monitor-jaringan',
|
||||
children: [
|
||||
{
|
||||
name: 'Dashboard Asset',
|
||||
href: '/saidi-saifi/monitor-jaringan/dashboard-asset',
|
||||
icon: ComputerDesktopIcon,
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
name: 'Manuver Topologi Jaringan',
|
||||
href: '/saidi-saifi/monitor-jaringan/manuver-topologi-jaringan',
|
||||
icon: ComputerDesktopIcon,
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
name: 'Pencarian Segment Jaringan',
|
||||
href: '/saidi-saifi/monitor-jaringan/pencarian-segment-jaringan',
|
||||
icon: ComputerDesktopIcon,
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
name: 'Penormalan Manuver Jaringan',
|
||||
href: '/saidi-saifi/monitor-jaringan/penormalan-manuver-jaringan',
|
||||
icon: ComputerDesktopIcon,
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
name: 'Pindah Jaringan',
|
||||
href: '/saidi-saifi/monitor-jaringan/pindah-jaringan',
|
||||
icon: ComputerDesktopIcon,
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Monitoring SCADA',
|
||||
icon: ComputerDesktopIcon,
|
||||
href: '/saidi-saifi/monitor-scada/',
|
||||
children: [
|
||||
{ name: 'Monitoring Mapping Database', href: '/saidi-saifi/monitor-scada/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Monitoring Log SCADA', href: '/saidi-saifi/monitor-scada/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Mapping Gardu Induk', href: '/saidi-saifi/monitor-scada/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Mapping Feeder', href: '/saidi-saifi/monitor-scada/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Mapping Zona', href: '/saidi-saifi/monitor-scada/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Mapping Lateral', href: '/saidi-saifi/monitor-scada/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Mapping Section', href: '/saidi-saifi/monitor-scada/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Mapping Segment', href: '/saidi-saifi/monitor-scada/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Mapping Sub Lateral', href: '/saidi-saifi/monitor-scada/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Mapping Gardu Distribusi', href: '/saidi-saifi/monitor-scada/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Mapping Trafo', href: '/saidi-saifi/monitor-scada/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Mapping Jurusan', href: '/saidi-saifi/monitor-scada/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Monitoring Integrasi ????', href: '/saidi-saifi/monitor-scada/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Monitoring Integrasi per No Tiang', href: '/saidi-saifi/monitor-scada/', icon: ComputerDesktopIcon, children: [], },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Master Jaringan',
|
||||
icon: ComputerDesktopIcon,
|
||||
href: '/saidi-saifi/master-jaringan/',
|
||||
children: [
|
||||
{ name: 'Master Gardu Induk', href: '/saidi-saifi/master-jaringan/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Master Feeder', href: '/saidi-saifi/master-jaringan/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Master Zona', href: '/saidi-saifi/master-jaringan/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Master Section', href: '/saidi-saifi/master-jaringan/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Master Segement', href: '/saidi-saifi/master-jaringan/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Master Lateral', href: '/saidi-saifi/master-jaringan/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Master Gardu Distribusi', href: '/saidi-saifi/master-jaringan/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Master Switch', href: '/saidi-saifi/master-jaringan/', icon: ComputerDesktopIcon, children: [], },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Master Perhitungan',
|
||||
icon: ComputerDesktopIcon,
|
||||
href: '/saidi-saifi/master-perhitungan/',
|
||||
children: [
|
||||
{ name: 'Master Asumsi', href: '/saidi-saifi/master-perhitungan/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Master Asumsi Salatiga', href: '/saidi-saifi/master-perhitungan/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Master Faktor Daya & Beban', href: '/saidi-saifi/master-perhitungan/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Data III-09', href: '/saidi-saifi/master-perhitungan/', icon: ComputerDesktopIcon, children: [], },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Laporan Saidi Saifi',
|
||||
icon: ComputerDesktopIcon,
|
||||
href: '/saidi-saifi/laporan-saidi-saifi/',
|
||||
children: [
|
||||
{ name: 'Laporan Saidi Saifi per Penyulang', href: '/saidi-saifi/laporan-saidi-saifi/', icon: ComputerDesktopIcon, children: [], },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Pelanggan Prioritas',
|
||||
icon: ComputerDesktopIcon,
|
||||
href: '/saidi-saifi/pelanggan-prioritas/',
|
||||
children: [
|
||||
{ name: 'Daftar Pelanggan Prioritas', href: '/saidi-saifi/pelanggan-prioritas/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Monitoring Pelanggan Prioritas', href: '/saidi-saifi/pelanggan-prioritas/', icon: ComputerDesktopIcon, children: [], },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Koreksi dan Cleansing',
|
||||
icon: ComputerDesktopIcon,
|
||||
href: '/saidi-saifi/koreksi-dan-cleansing/',
|
||||
children: [
|
||||
{ name: 'Monitoring Koreksi dan Cleansing', href: '/saidi-saifi/koreksi-dan-cleansing/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Koreksi Transaksi Individual', href: '/saidi-saifi/koreksi-dan-cleansing/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Koreksi dan Cleansing TM', href: '/saidi-saifi/koreksi-dan-cleansing/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Koreksi Kode Gangguan dan ANEV', href: '/saidi-saifi/koreksi-dan-cleansing/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Laporan Koreksi dan Cleansing', href: '/saidi-saifi/koreksi-dan-cleansing/', icon: ComputerDesktopIcon, children: [], },
|
||||
{ name: 'Delegasi Koreksi dan Cleansing', href: '/saidi-saifi/koreksi-dan-cleansing/', icon: ComputerDesktopIcon, children: [], },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Utility',
|
||||
icon: BoltIcon,
|
||||
href: '/utility',
|
||||
children: [
|
||||
{ name: 'Piket Obank', href: '/utility/piket-obank', icon: BoltIcon, children: [], },
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
// expose everything
|
||||
return { navigation }
|
||||
})
|
24
src/stores/message.ts
Normal file
24
src/stores/message.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { ref, computed } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
import { dispatchNotification } from '@/components/Notification'
|
||||
import router from '@/router'
|
||||
|
||||
export const useMessageStore = defineStore('message_box', () => {
|
||||
const message = ref('')
|
||||
const isSending = ref(false)
|
||||
const open = ref(false)
|
||||
|
||||
function handleOnDismissMessageBox() {
|
||||
open.value = false;
|
||||
}
|
||||
|
||||
function showDialogMessageBox() {
|
||||
open.value = true;
|
||||
}
|
||||
|
||||
function send() {
|
||||
|
||||
}
|
||||
|
||||
return { message, send, isSending, open, handleOnDismissMessageBox, showDialogMessageBox }
|
||||
})
|
10
src/stores/user.ts
Normal file
10
src/stores/user.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { ref, computed } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
export const useUserStore = defineStore('user', () => {
|
||||
const user_name = computed(() => localStorage.getItem('user_name') || 'Demo User')
|
||||
const user_access = computed(() => localStorage.getItem('user_access') || 'Super Admin')
|
||||
const user_image = computed(() => localStorage.getItem('user_image') || 'https://iidamidamerica.org/wp-content/uploads/2020/12/male-placeholder-image.jpeg')
|
||||
|
||||
return { user_name, user_access, user_image }
|
||||
})
|
Reference in New Issue
Block a user