initial commit
This commit is contained in:
273
resources/js/@core/components/AppBarSearch.vue
Normal file
273
resources/js/@core/components/AppBarSearch.vue
Normal file
@@ -0,0 +1,273 @@
|
||||
<script setup>
|
||||
import { PerfectScrollbar } from 'vue3-perfect-scrollbar'
|
||||
import {
|
||||
VList,
|
||||
VListItem,
|
||||
} from 'vuetify/components/VList'
|
||||
|
||||
const props = defineProps({
|
||||
isDialogVisible: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
searchResults: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits([
|
||||
'update:isDialogVisible',
|
||||
'search',
|
||||
])
|
||||
|
||||
|
||||
// 👉 Hotkey
|
||||
|
||||
// eslint-disable-next-line camelcase
|
||||
const { ctrl_k, meta_k } = useMagicKeys({
|
||||
passive: false,
|
||||
onEventFired(e) {
|
||||
if (e.ctrlKey && e.key === 'k' && e.type === 'keydown')
|
||||
e.preventDefault()
|
||||
},
|
||||
})
|
||||
|
||||
const refSearchList = ref()
|
||||
const refSearchInput = ref()
|
||||
const searchQueryLocal = ref('')
|
||||
|
||||
// 👉 watching control + / to open dialog
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
watch([
|
||||
ctrl_k,
|
||||
meta_k,
|
||||
], () => {
|
||||
emit('update:isDialogVisible', true)
|
||||
})
|
||||
|
||||
/* eslint-enable */
|
||||
|
||||
// 👉 clear search result and close the dialog
|
||||
const clearSearchAndCloseDialog = () => {
|
||||
searchQueryLocal.value = ''
|
||||
emit('update:isDialogVisible', false)
|
||||
}
|
||||
|
||||
const getFocusOnSearchList = e => {
|
||||
if (e.key === 'ArrowDown') {
|
||||
e.preventDefault()
|
||||
refSearchList.value?.focus('next')
|
||||
} else if (e.key === 'ArrowUp') {
|
||||
e.preventDefault()
|
||||
refSearchList.value?.focus('prev')
|
||||
}
|
||||
}
|
||||
|
||||
const dialogModelValueUpdate = val => {
|
||||
searchQueryLocal.value = ''
|
||||
emit('update:isDialogVisible', val)
|
||||
}
|
||||
|
||||
watch(() => props.isDialogVisible, () => {
|
||||
searchQueryLocal.value = ''
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VDialog
|
||||
max-width="600"
|
||||
:model-value="props.isDialogVisible"
|
||||
:height="$vuetify.display.smAndUp ? '537' : '100%'"
|
||||
:fullscreen="$vuetify.display.width < 600"
|
||||
class="app-bar-search-dialog"
|
||||
@update:model-value="dialogModelValueUpdate"
|
||||
@keyup.esc="clearSearchAndCloseDialog"
|
||||
>
|
||||
<VCard
|
||||
height="100%"
|
||||
width="100%"
|
||||
class="position-relative"
|
||||
>
|
||||
<VCardText class="py-3 px-4">
|
||||
<!-- 👉 Search Input -->
|
||||
<VTextField
|
||||
ref="refSearchInput"
|
||||
v-model="searchQueryLocal"
|
||||
autofocus
|
||||
density="compact"
|
||||
variant="plain"
|
||||
class="app-bar-search-input"
|
||||
@keyup.esc="clearSearchAndCloseDialog"
|
||||
@keydown="getFocusOnSearchList"
|
||||
@update:model-value="$emit('search', searchQueryLocal)"
|
||||
>
|
||||
<!-- 👉 Prepend Inner -->
|
||||
<template #prepend-inner>
|
||||
<div class="d-flex align-center text-high-emphasis me-1">
|
||||
<VIcon
|
||||
size="24"
|
||||
icon="ri-search-line"
|
||||
style=" margin-block-start:1px; opacity: 1;"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 👉 Append Inner -->
|
||||
<template #append-inner>
|
||||
<div class="d-flex align-start">
|
||||
<div
|
||||
class="text-base text-disabled cursor-pointer me-1"
|
||||
@click="clearSearchAndCloseDialog"
|
||||
>
|
||||
[esc]
|
||||
</div>
|
||||
|
||||
<IconBtn
|
||||
class="mt-n2"
|
||||
color="medium-emphasis"
|
||||
@click="clearSearchAndCloseDialog"
|
||||
>
|
||||
<VIcon icon="ri-close-line" />
|
||||
</IconBtn>
|
||||
</div>
|
||||
</template>
|
||||
</VTextField>
|
||||
</VCardText>
|
||||
|
||||
<!-- 👉 Divider -->
|
||||
<VDivider />
|
||||
|
||||
<!-- 👉 Perfect Scrollbar -->
|
||||
<PerfectScrollbar
|
||||
:options="{ wheelPropagation: false, suppressScrollX: true }"
|
||||
class="h-100"
|
||||
>
|
||||
<!-- 👉 Search List -->
|
||||
<VList
|
||||
v-show="searchQueryLocal.length && !!props.searchResults.length"
|
||||
ref="refSearchList"
|
||||
density="compact"
|
||||
class="app-bar-search-list py-0"
|
||||
>
|
||||
<!-- 👉 list Item /List Sub header -->
|
||||
<template
|
||||
v-for="item in props.searchResults"
|
||||
:key="item"
|
||||
>
|
||||
<slot
|
||||
name="searchResult"
|
||||
:item="item"
|
||||
>
|
||||
<VListItem>
|
||||
{{ item }}
|
||||
</VListItem>
|
||||
</slot>
|
||||
</template>
|
||||
</VList>
|
||||
|
||||
<!-- 👉 Suggestions -->
|
||||
<div
|
||||
v-show="!!props.searchResults && !searchQueryLocal && $slots.suggestions"
|
||||
class="h-100"
|
||||
>
|
||||
<slot name="suggestions" />
|
||||
</div>
|
||||
|
||||
<!-- 👉 No Data found -->
|
||||
<div
|
||||
v-show="!props.searchResults.length && searchQueryLocal.length"
|
||||
class="h-100"
|
||||
>
|
||||
<slot name="noData">
|
||||
<VCardText class="h-100">
|
||||
<div class="app-bar-search-suggestions d-flex flex-column align-center justify-center text-high-emphasis pa-12">
|
||||
<VIcon
|
||||
size="64"
|
||||
icon="ri-file-forbid-line"
|
||||
/>
|
||||
<div class="d-flex align-center flex-wrap justify-center gap-2 text-h5 my-3">
|
||||
<span>No Result For </span>
|
||||
<span>"{{ searchQueryLocal }}"</span>
|
||||
</div>
|
||||
|
||||
<slot name="noDataSuggestion" />
|
||||
</div>
|
||||
</VCardText>
|
||||
</slot>
|
||||
</div>
|
||||
</PerfectScrollbar>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.app-bar-search-suggestions {
|
||||
.app-bar-search-suggestion {
|
||||
&:hover {
|
||||
color: rgb(var(--v-theme-primary));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.app-bar-search-dialog {
|
||||
.app-bar-search-input{
|
||||
.v-field__input{
|
||||
padding-block-start: 0.2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.v-overlay__scrim {
|
||||
backdrop-filter: blur(4px);
|
||||
}
|
||||
|
||||
.app-bar-search-list {
|
||||
.v-list-item,
|
||||
.v-list-subheader {
|
||||
font-size: 0.75rem;
|
||||
padding-inline: 1rem;
|
||||
}
|
||||
|
||||
.v-list-item {
|
||||
.v-list-item__append {
|
||||
.enter-icon {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover,
|
||||
&:active,
|
||||
&:focus {
|
||||
.v-list-item__append {
|
||||
.enter-icon {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.v-list-subheader {
|
||||
line-height: 1;
|
||||
min-block-size: auto;
|
||||
padding-block: 16px 8px;
|
||||
padding-inline-start: 1rem;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@supports selector(:focus-visible){
|
||||
.app-bar-search-dialog {
|
||||
.v-list-item:focus-visible::after {
|
||||
content: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.card-list {
|
||||
--v-card-list-gap: 16px;
|
||||
}
|
||||
</style>
|
32
resources/js/@core/components/AppDrawerHeaderSection.vue
Normal file
32
resources/js/@core/components/AppDrawerHeaderSection.vue
Normal file
@@ -0,0 +1,32 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits(['cancel'])
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="pa-5 d-flex align-center">
|
||||
<h5 class="text-h5">
|
||||
{{ props.title }}
|
||||
</h5>
|
||||
<VSpacer />
|
||||
|
||||
<slot name="beforeClose" />
|
||||
|
||||
<IconBtn
|
||||
class="text-medium-emphasis"
|
||||
size="x-small"
|
||||
@click="$emit('cancel', $event)"
|
||||
>
|
||||
<VIcon
|
||||
icon="ri-close-line"
|
||||
size="24"
|
||||
/>
|
||||
</IconBtn>
|
||||
</div>
|
||||
</template>
|
390
resources/js/@core/components/AppStepper.vue
Normal file
390
resources/js/@core/components/AppStepper.vue
Normal file
@@ -0,0 +1,390 @@
|
||||
<script setup>
|
||||
import stepperCheck from '@images/svg/stepper-check.svg'
|
||||
|
||||
const props = defineProps({
|
||||
items: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
currentStep: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 0,
|
||||
},
|
||||
direction: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: 'horizontal',
|
||||
},
|
||||
iconSize: {
|
||||
type: [
|
||||
String,
|
||||
Number,
|
||||
],
|
||||
required: false,
|
||||
default: 52,
|
||||
},
|
||||
isActiveStepValid: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: undefined,
|
||||
},
|
||||
align: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: 'default',
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:currentStep'])
|
||||
|
||||
const currentStep = ref(props.currentStep || 0)
|
||||
const activeOrCompletedStepsClasses = computed(() => index => index < currentStep.value ? 'stepper-steps-completed' : index === currentStep.value ? 'stepper-steps-active' : '')
|
||||
const isHorizontalAndNotLastStep = computed(() => index => props.direction === 'horizontal' && props.items.length - 1 !== index)
|
||||
|
||||
// check if validation is enabled
|
||||
const isValidationEnabled = computed(() => {
|
||||
return props.isActiveStepValid !== undefined
|
||||
})
|
||||
|
||||
watchEffect(() => {
|
||||
if (props.currentStep !== undefined && props.currentStep < props.items.length && props.currentStep >= 0)
|
||||
currentStep.value = props.currentStep
|
||||
emit('update:currentStep', currentStep.value)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VSlideGroup
|
||||
v-model="currentStep"
|
||||
class="app-stepper"
|
||||
show-arrows
|
||||
:direction="props.direction"
|
||||
:class="`app-stepper-${props.align} ${props.items[0].icon ? 'app-stepper-icons' : ''}`"
|
||||
>
|
||||
<VSlideGroupItem
|
||||
v-for="(item, index) in props.items"
|
||||
:key="item.title"
|
||||
:value="index"
|
||||
>
|
||||
<div
|
||||
class="cursor-pointer app-stepper-step mx-1"
|
||||
:class="[
|
||||
(!props.isActiveStepValid && (isValidationEnabled)) && 'stepper-steps-invalid',
|
||||
activeOrCompletedStepsClasses(index),
|
||||
]"
|
||||
@click="!isValidationEnabled && emit('update:currentStep', index)"
|
||||
>
|
||||
<!-- SECTION stepper step with icon -->
|
||||
<template v-if="item.icon">
|
||||
<div class="stepper-icon-step text-high-emphasis d-flex align-center gap-2">
|
||||
<!-- 👉 icon and title -->
|
||||
<div
|
||||
class="d-flex align-center gap-3 step-wrapper"
|
||||
:class="[props.direction === 'horizontal' && 'flex-column']"
|
||||
>
|
||||
<div class="stepper-icon">
|
||||
<template v-if="typeof item.icon === 'object'">
|
||||
<Component :is="item.icon" />
|
||||
</template>
|
||||
|
||||
<VIcon
|
||||
v-else
|
||||
:icon="item.icon"
|
||||
:size="item.size || props.iconSize"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p class="stepper-title font-weight-medium text-base mb-1">
|
||||
{{ item.title }}
|
||||
</p>
|
||||
<p
|
||||
v-if="item.subtitle"
|
||||
class="stepper-subtitle text-sm mb-0"
|
||||
>
|
||||
{{ item.subtitle }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 👉 append chevron -->
|
||||
<VIcon
|
||||
v-if="isHorizontalAndNotLastStep(index)"
|
||||
class="flip-in-rtl stepper-chevron-indicator mx-6"
|
||||
size="18"
|
||||
icon="ri-arrow-right-s-line"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<!-- !SECTION -->
|
||||
|
||||
<!-- SECTION stepper step without icon -->
|
||||
<template v-else>
|
||||
<div class="d-flex align-center gap-x-2">
|
||||
<div class="d-flex align-center gap-2">
|
||||
<div
|
||||
class="d-flex align-center justify-center"
|
||||
style="block-size: 24px; inline-size: 24px;"
|
||||
>
|
||||
<!-- 👉 custom circle icon -->
|
||||
<template v-if="index >= currentStep">
|
||||
<div
|
||||
v-if="(!isValidationEnabled || props.isActiveStepValid || index !== currentStep)"
|
||||
class="stepper-step-indicator"
|
||||
/>
|
||||
|
||||
<VIcon
|
||||
v-else
|
||||
icon="ri-error-warning-line"
|
||||
size="24"
|
||||
color="error"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<!-- 👉 step completed icon -->
|
||||
|
||||
<component
|
||||
:is="stepperCheck"
|
||||
v-else
|
||||
class="stepper-step-icon"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 👉 Step Number -->
|
||||
<h4 :class="`${!item.subtitle ? 'text-h6' : 'text-h4'} step-number`">
|
||||
{{ (index + 1).toString().padStart(2, '0') }}
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<!-- 👉 title and subtitle -->
|
||||
<div
|
||||
class="app-stepper-title-wrapper"
|
||||
style="line-height: 0;"
|
||||
>
|
||||
<h6 class="text-base font-weight-medium step-title">
|
||||
{{ item.title }}
|
||||
</h6>
|
||||
|
||||
<p
|
||||
v-if="item.subtitle"
|
||||
class="text-sm step-subtitle mb-0"
|
||||
>
|
||||
{{ item.subtitle }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- 👉 stepper step line -->
|
||||
<div
|
||||
v-if="isHorizontalAndNotLastStep(index)"
|
||||
class="stepper-step-line"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="props.direction === 'vertical' && props.items.length - 1 !== index"
|
||||
class="stepper-step-line vertical"
|
||||
/>
|
||||
</template>
|
||||
<!-- !SECTION -->
|
||||
</div>
|
||||
</VSlideGroupItem>
|
||||
</VSlideGroup>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
@use "@core-scss/base/mixins.scss";
|
||||
|
||||
/* stylelint-disable no-descending-specificity */
|
||||
.app-stepper {
|
||||
&.app-stepper-default:not(.app-stepper-icons) .app-stepper-step:not(:last-child) {
|
||||
inline-size: 100%;
|
||||
}
|
||||
|
||||
// 👉 stepper step with icon and default
|
||||
.v-slide-group__content {
|
||||
.stepper-step-indicator {
|
||||
border: .1875rem solid rgb(var(--v-theme-primary));
|
||||
border-radius: 50%;
|
||||
background-color: rgb(var(--v-theme-surface));
|
||||
block-size: 1.25rem;
|
||||
inline-size: 1.25rem;
|
||||
opacity: var(--v-activated-opacity);
|
||||
}
|
||||
|
||||
.stepper-step-line {
|
||||
border-radius: 0.1875rem;
|
||||
background-color: rgb(var(--v-theme-primary));
|
||||
block-size: 0.1875rem;
|
||||
opacity: var(--v-activated-opacity);
|
||||
}
|
||||
|
||||
.stepper-step-line:not(.vertical) {
|
||||
inline-size: 100%;
|
||||
min-inline-size: 3rem;
|
||||
}
|
||||
|
||||
.stepper-step-line.vertical {
|
||||
border-radius: 1.25rem;
|
||||
block-size: 1.25rem;
|
||||
inline-size: 0.1875rem;
|
||||
margin-inline-start: 0.625rem;
|
||||
}
|
||||
|
||||
.stepper-chevron-indicator {
|
||||
color: rgba(var(--v-theme-on-surface), var(--v-disabled-opacity));
|
||||
}
|
||||
|
||||
.stepper-steps-completed,
|
||||
.stepper-steps-active {
|
||||
.stepper-icon-step,
|
||||
.stepper-step-icon {
|
||||
color: rgb(var(--v-theme-primary)) !important;
|
||||
}
|
||||
|
||||
.stepper-step-indicator {
|
||||
border-width: 0.3125rem;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.stepper-steps-completed {
|
||||
.stepper-step-line {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.stepper-chevron-indicator {
|
||||
color: rgb(var(--v-theme-primary));
|
||||
}
|
||||
}
|
||||
|
||||
.stepper-steps-invalid.stepper-steps-active {
|
||||
.stepper-icon-step,
|
||||
.step-number,
|
||||
.step-title,
|
||||
.step-subtitle {
|
||||
color: rgb(var(--v-theme-error)) !important;
|
||||
}
|
||||
}
|
||||
|
||||
.app-stepper-step:not(.stepper-steps-active,.stepper-steps-completed) {
|
||||
.step-number{
|
||||
color: rgba(var(--v-theme-on-surface), var(--v-disabled-opacity));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.app-stepper-title-wrapper{
|
||||
text-wrap: nowrap;
|
||||
}
|
||||
|
||||
// 👉 stepper step with bg color
|
||||
&.stepper-icon-step-bg {
|
||||
.v-slide-group__content{
|
||||
row-gap: 1.5rem;
|
||||
}
|
||||
|
||||
.stepper-icon-step {
|
||||
.step-wrapper {
|
||||
flex-direction: row !important;
|
||||
}
|
||||
|
||||
.stepper-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 0.3125rem;
|
||||
background-color: rgba(var(--v-theme-on-surface), var(--v-hover-opacity));
|
||||
block-size: 2.5rem;
|
||||
color: rgba(var(--v-theme-on-surface), var(--v-high-emphasis-opacity));
|
||||
inline-size: 2.5rem;
|
||||
margin-inline-end: 0.3rem;
|
||||
}
|
||||
|
||||
.stepper-title,
|
||||
.stepper-subtitle {
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.stepper-title {
|
||||
color: rgba(var(--v-theme-on-surface), var(--v-high-emphasis-opacity));
|
||||
font-size: 0.9375rem;
|
||||
line-height: 1.375rem;
|
||||
}
|
||||
|
||||
.stepper-subtitle {
|
||||
color: rgba(var(--v-theme-on-surface), var(--v-medium-emphasis-opacity));
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 400;
|
||||
line-height: 1.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
.stepper-steps-active {
|
||||
.stepper-icon-step {
|
||||
.stepper-icon {
|
||||
background-color: rgb(var(--v-theme-primary));
|
||||
color: rgba(var(--v-theme-on-primary));
|
||||
|
||||
@include mixins.elevation(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.stepper-steps-completed {
|
||||
.stepper-icon-step {
|
||||
.stepper-icon {
|
||||
background: rgba(var(--v-theme-primary), 0.16);
|
||||
color: rgba(var(--v-theme-primary));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 👉 stepper alignment
|
||||
&.app-stepper-default {
|
||||
.v-slide-group__content {
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
|
||||
&.app-stepper-center {
|
||||
.v-slide-group__content {
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
&.app-stepper- {
|
||||
.v-slide-group__content {
|
||||
justify-content: start;
|
||||
}
|
||||
}
|
||||
|
||||
&.app-stepper-end {
|
||||
.v-slide-group__content {
|
||||
justify-content: end;
|
||||
}
|
||||
}
|
||||
|
||||
&.app-stepper-icons {
|
||||
.app-stepper-step:not(.stepper-steps-active,.stepper-steps-completed) {
|
||||
.stepper-title {
|
||||
color: rgba(var(--v-theme-on-surface), var(--v-high-emphasis-opacity));
|
||||
}
|
||||
}
|
||||
|
||||
&:not(.stepper-icon-step-bg) {
|
||||
.step-wrapper {
|
||||
padding-block: 1.25rem;
|
||||
padding-inline: 1.875rem;
|
||||
}
|
||||
}
|
||||
|
||||
&.v-slide-group--vertical{
|
||||
.step-wrapper {
|
||||
padding-inline: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
85
resources/js/@core/components/BuyNow.vue
Normal file
85
resources/js/@core/components/BuyNow.vue
Normal file
@@ -0,0 +1,85 @@
|
||||
<script setup>
|
||||
const buyNowUrl = typeof window !== 'undefined' && 'isMarketplace' in window && window.isMarketplace ? 'https://store.vuetifyjs.com/products/materio-vuetify-vuejs-admin-template' : 'https://themeselection.com/item/materio-vuetify-vuejs-laravel-admin-template/'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a
|
||||
className="buy-now-button"
|
||||
role="button"
|
||||
rel="noopener noreferrer"
|
||||
:href="buyNowUrl"
|
||||
target="_blank"
|
||||
>
|
||||
Buy Now
|
||||
<span className="button-inner" />
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.buy-now-button,
|
||||
.button-inner {
|
||||
display: inline-flex;
|
||||
box-sizing: border-box;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 0;
|
||||
border-radius: 6px;
|
||||
margin: 0;
|
||||
animation: anime 12s linear infinite;
|
||||
appearance: none;
|
||||
background: linear-gradient(-45deg, #ffa63d, #ff3d77, #338aff, #3cf0c5);
|
||||
background-size: 600%;
|
||||
color: rgba(255, 255, 255, 90%);
|
||||
cursor: pointer;
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.43px;
|
||||
line-height: 1.2;
|
||||
min-inline-size: 50px;
|
||||
outline: 0;
|
||||
padding-block: 0.625rem;
|
||||
padding-inline: 1.25rem;
|
||||
text-decoration: none;
|
||||
text-transform: none;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.buy-now-button {
|
||||
position: fixed;
|
||||
z-index: 999;
|
||||
inset-block-end: 5%;
|
||||
inset-inline-end: 87px;
|
||||
|
||||
&:hover {
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.button-inner {
|
||||
position: absolute;
|
||||
z-index: -1;
|
||||
filter: blur(12px);
|
||||
inset: 0;
|
||||
opacity: 0;
|
||||
transition: opacity 200ms ease-in-out;
|
||||
}
|
||||
|
||||
&:not(:hover) .button-inner {
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes anime {
|
||||
0% {
|
||||
background-position: 0% 50%;
|
||||
}
|
||||
|
||||
50% {
|
||||
background-position: 100% 50%;
|
||||
}
|
||||
|
||||
100% {
|
||||
background-position: 0% 50%;
|
||||
}
|
||||
}
|
||||
</style>
|
32
resources/js/@core/components/CustomizerSection.vue
Normal file
32
resources/js/@core/components/CustomizerSection.vue
Normal file
@@ -0,0 +1,32 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
divider: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: true,
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VDivider v-if="props.divider" />
|
||||
|
||||
<div class="customizer-section">
|
||||
<div>
|
||||
<VChip
|
||||
label
|
||||
size="small"
|
||||
color="primary"
|
||||
rounded="sm"
|
||||
>
|
||||
{{ props.title }}
|
||||
</VChip>
|
||||
</div>
|
||||
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
23
resources/js/@core/components/DialogCloseBtn.vue
Normal file
23
resources/js/@core/components/DialogCloseBtn.vue
Normal file
@@ -0,0 +1,23 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
icon: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: 'ri-close-line',
|
||||
},
|
||||
iconSize: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: '24',
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<IconBtn class="v-dialog-close-btn">
|
||||
<VIcon
|
||||
:icon="props.icon"
|
||||
:size="props.iconSize"
|
||||
/>
|
||||
</IconBtn>
|
||||
</template>
|
47
resources/js/@core/components/I18n.vue
Normal file
47
resources/js/@core/components/I18n.vue
Normal file
@@ -0,0 +1,47 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
languages: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
location: {
|
||||
type: null,
|
||||
required: false,
|
||||
default: 'bottom end',
|
||||
},
|
||||
})
|
||||
|
||||
const { locale } = useI18n({ useScope: 'global' })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<IconBtn>
|
||||
<VIcon icon="ri-translate-2" />
|
||||
|
||||
<!-- Menu -->
|
||||
<VMenu
|
||||
activator="parent"
|
||||
:location="props.location"
|
||||
offset="15px"
|
||||
width="160"
|
||||
>
|
||||
<!-- List -->
|
||||
<VList
|
||||
:selected="[locale]"
|
||||
color="primary"
|
||||
mandatory
|
||||
>
|
||||
<!-- List item -->
|
||||
<VListItem
|
||||
v-for="lang in props.languages"
|
||||
:key="lang.i18nLang"
|
||||
:value="lang.i18nLang"
|
||||
@click="locale = lang.i18nLang"
|
||||
>
|
||||
<!-- Language label -->
|
||||
<VListItemTitle>{{ lang.label }}</VListItemTitle>
|
||||
</VListItem>
|
||||
</VList>
|
||||
</VMenu>
|
||||
</IconBtn>
|
||||
</template>
|
28
resources/js/@core/components/MoreBtn.vue
Normal file
28
resources/js/@core/components/MoreBtn.vue
Normal file
@@ -0,0 +1,28 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
menuList: {
|
||||
type: Array,
|
||||
required: false,
|
||||
},
|
||||
itemProps: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<IconBtn>
|
||||
<VIcon icon="ri-more-2-line" />
|
||||
|
||||
<VMenu
|
||||
v-if="props.menuList"
|
||||
activator="parent"
|
||||
>
|
||||
<VList
|
||||
:items="props.menuList"
|
||||
:item-props="props.itemProps"
|
||||
/>
|
||||
</VMenu>
|
||||
</IconBtn>
|
||||
</template>
|
220
resources/js/@core/components/Notifications.vue
Normal file
220
resources/js/@core/components/Notifications.vue
Normal file
@@ -0,0 +1,220 @@
|
||||
<script setup>
|
||||
import { PerfectScrollbar } from 'vue3-perfect-scrollbar'
|
||||
|
||||
const props = defineProps({
|
||||
notifications: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
badgeProps: {
|
||||
type: Object,
|
||||
required: false,
|
||||
default: undefined,
|
||||
},
|
||||
location: {
|
||||
type: null,
|
||||
required: false,
|
||||
default: 'bottom end',
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits([
|
||||
'read',
|
||||
'unread',
|
||||
'remove',
|
||||
'click:notification',
|
||||
])
|
||||
|
||||
const isAllMarkRead = computed(() => props.notifications.some(item => item.isSeen === false))
|
||||
|
||||
const markAllReadOrUnread = () => {
|
||||
const allNotificationsIds = props.notifications.map(item => item.id)
|
||||
if (!isAllMarkRead.value)
|
||||
emit('unread', allNotificationsIds)
|
||||
else
|
||||
emit('read', allNotificationsIds)
|
||||
}
|
||||
|
||||
const totalUnreadNotifications = computed(() => props.notifications.filter(item => !item.isSeen).length)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<IconBtn id="notification-btn">
|
||||
<VBadge
|
||||
dot
|
||||
v-bind="props.badgeProps"
|
||||
:model-value="props.notifications.some(n => !n.isSeen)"
|
||||
color="error"
|
||||
bordered
|
||||
offset-x="1"
|
||||
offset-y="1"
|
||||
>
|
||||
<VIcon icon="ri-notification-2-line" />
|
||||
</VBadge>
|
||||
|
||||
<VMenu
|
||||
activator="parent"
|
||||
width="380"
|
||||
:location="props.location"
|
||||
offset="15px"
|
||||
:close-on-content-click="false"
|
||||
>
|
||||
<VCard class="d-flex flex-column">
|
||||
<!-- 👉 Header -->
|
||||
<VCardItem class="notification-section">
|
||||
<h5 class="text-h5 text-truncate">
|
||||
Notifications
|
||||
</h5>
|
||||
|
||||
<template #append>
|
||||
<VChip
|
||||
v-show="!!isAllMarkRead"
|
||||
size="small"
|
||||
class="me-3"
|
||||
variant="tonal"
|
||||
color="primary"
|
||||
>
|
||||
{{ totalUnreadNotifications }} new
|
||||
</VChip>
|
||||
|
||||
<IconBtn
|
||||
v-show="props.notifications.length"
|
||||
@click="markAllReadOrUnread"
|
||||
>
|
||||
<VIcon
|
||||
color="high-emphasis"
|
||||
:icon="!isAllMarkRead ? 'ri-mail-line' : 'ri-mail-open-line' "
|
||||
/>
|
||||
|
||||
<VTooltip
|
||||
activator="parent"
|
||||
location="start"
|
||||
>
|
||||
{{ !isAllMarkRead ? 'Mark all as unread' : 'Mark all as read' }}
|
||||
</VTooltip>
|
||||
</IconBtn>
|
||||
</template>
|
||||
</VCardItem>
|
||||
|
||||
<VDivider />
|
||||
|
||||
<!-- 👉 Notifications list -->
|
||||
<PerfectScrollbar
|
||||
:options="{ wheelPropagation: false }"
|
||||
style="max-block-size: 27rem"
|
||||
>
|
||||
<VList class="py-0">
|
||||
<template
|
||||
v-for="(notification, index) in props.notifications"
|
||||
:key="notification.title"
|
||||
>
|
||||
<VDivider v-if="index > 0" />
|
||||
<VListItem
|
||||
link
|
||||
lines="one"
|
||||
min-height="66px"
|
||||
class="list-item-hover-class py-3"
|
||||
@click="$emit('click:notification', notification)"
|
||||
>
|
||||
<!-- Slot: Prepend -->
|
||||
<!-- Handles Avatar: Image, Icon, Text -->
|
||||
<div class="d-flex align-start gap-3">
|
||||
<VAvatar
|
||||
size="40"
|
||||
:color="notification.color && !notification.img ? notification.color : undefined"
|
||||
:image="notification.img || undefined"
|
||||
:icon="notification.icon || undefined"
|
||||
:variant="notification.img ? undefined : 'tonal' "
|
||||
>
|
||||
<span v-if="notification.text">{{ avatarText(notification.text) }}</span>
|
||||
</VAvatar>
|
||||
|
||||
<div>
|
||||
<h6 class="text-h6 mb-1">
|
||||
{{ notification.title }}
|
||||
</h6>
|
||||
<p
|
||||
class="text-body-2 mb-2"
|
||||
style="letter-spacing: 0.4px !important; line-height: 18px;"
|
||||
>
|
||||
{{ notification.subtitle }}
|
||||
</p>
|
||||
<p
|
||||
class="text-sm text-disabled mb-0"
|
||||
style="letter-spacing: 0.4px !important; line-height: 18px;"
|
||||
>
|
||||
{{ notification.time }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<VSpacer />
|
||||
|
||||
<div class="d-flex flex-column align-end gap-2">
|
||||
<VIcon
|
||||
:color="!notification.isSeen ? 'primary' : '#a8aaae'"
|
||||
:class="`${notification.isSeen ? 'visible-in-hover' : ''} ms-1`"
|
||||
size="10"
|
||||
icon="ri-circle-fill"
|
||||
@click.stop="$emit(notification.isSeen ? 'unread' : 'read', [notification.id])"
|
||||
/>
|
||||
|
||||
<div style="block-size: 20px; inline-size: 20px;">
|
||||
<VIcon
|
||||
size="20"
|
||||
icon="ri-close-line"
|
||||
color="secondary"
|
||||
class="visible-in-hover"
|
||||
@click="$emit('remove', notification.id)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</VListItem>
|
||||
</template>
|
||||
|
||||
<VListItem
|
||||
v-show="!props.notifications.length"
|
||||
class="text-center text-medium-emphasis"
|
||||
style="block-size: 56px;"
|
||||
>
|
||||
<VListItemTitle>No Notification Found!</VListItemTitle>
|
||||
</VListItem>
|
||||
</VList>
|
||||
</PerfectScrollbar>
|
||||
|
||||
<VDivider />
|
||||
|
||||
<!-- 👉 Footer -->
|
||||
<VCardText
|
||||
v-show="props.notifications.length"
|
||||
class="pa-4"
|
||||
>
|
||||
<VBtn
|
||||
block
|
||||
size="small"
|
||||
>
|
||||
View All Notifications
|
||||
</VBtn>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VMenu>
|
||||
</IconBtn>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.notification-section {
|
||||
padding: 14px !important;
|
||||
}
|
||||
|
||||
.list-item-hover-class {
|
||||
.visible-in-hover {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.visible-in-hover {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
40
resources/js/@core/components/ScrollToTop.vue
Normal file
40
resources/js/@core/components/ScrollToTop.vue
Normal file
@@ -0,0 +1,40 @@
|
||||
<script setup>
|
||||
const { y } = useWindowScroll()
|
||||
|
||||
const scrollToTop = () => {
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
behavior: 'smooth',
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VScaleTransition
|
||||
style="transform-origin: center;"
|
||||
class="scroll-to-top d-print-none"
|
||||
>
|
||||
<VBtn
|
||||
v-show="y > 200"
|
||||
icon
|
||||
density="comfortable"
|
||||
@click="scrollToTop"
|
||||
>
|
||||
<VIcon
|
||||
size="22"
|
||||
icon="ri-arrow-up-line"
|
||||
/>
|
||||
</VBtn>
|
||||
</VScaleTransition>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.scroll-to-top {
|
||||
position: fixed !important;
|
||||
|
||||
// To keep button on top of v-layout. E.g. Email app
|
||||
z-index: 999;
|
||||
inset-block-end: 5%;
|
||||
inset-inline-end: 25px;
|
||||
}
|
||||
</style>
|
95
resources/js/@core/components/Shortcuts.vue
Normal file
95
resources/js/@core/components/Shortcuts.vue
Normal file
@@ -0,0 +1,95 @@
|
||||
<script setup>
|
||||
import { PerfectScrollbar } from 'vue3-perfect-scrollbar'
|
||||
|
||||
const props = defineProps({
|
||||
togglerIcon: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: 'ri-star-smile-line',
|
||||
},
|
||||
shortcuts: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const router = useRouter()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<IconBtn>
|
||||
<VIcon :icon="props.togglerIcon" />
|
||||
|
||||
<VMenu
|
||||
activator="parent"
|
||||
offset="15px"
|
||||
location="bottom end"
|
||||
>
|
||||
<VCard
|
||||
max-width="380"
|
||||
max-height="560"
|
||||
class="d-flex flex-column"
|
||||
>
|
||||
<VCardItem class="px-4 py-2">
|
||||
<h5 class="text-h5">
|
||||
Shortcuts
|
||||
</h5>
|
||||
|
||||
<template #append>
|
||||
<IconBtn>
|
||||
<VIcon
|
||||
icon="ri-add-line"
|
||||
color="high-emphasis"
|
||||
/>
|
||||
<VTooltip
|
||||
activator="parent"
|
||||
location="start"
|
||||
>
|
||||
Add Shortcut
|
||||
</VTooltip>
|
||||
</IconBtn>
|
||||
</template>
|
||||
</VCardItem>
|
||||
|
||||
<VDivider />
|
||||
|
||||
<PerfectScrollbar :options="{ wheelPropagation: false }">
|
||||
<VRow class="ma-0 mt-n1">
|
||||
<VCol
|
||||
v-for="(shortcut, index) in props.shortcuts"
|
||||
:key="shortcut.title"
|
||||
cols="6"
|
||||
class="text-center border-t cursor-pointer pa-6 shortcut-icon"
|
||||
:class="(index + 1) % 2 ? 'border-e' : ''"
|
||||
@click="router.push(shortcut.to)"
|
||||
>
|
||||
<VAvatar
|
||||
variant="tonal"
|
||||
size="50"
|
||||
>
|
||||
<VIcon
|
||||
color="high-emphasis"
|
||||
size="26"
|
||||
:icon="shortcut.icon"
|
||||
/>
|
||||
</VAvatar>
|
||||
|
||||
<h6 class="text-h6 mt-3">
|
||||
{{ shortcut.title }}
|
||||
</h6>
|
||||
<p class="text-sm text-medium-emphasis mb-0">
|
||||
{{ shortcut.subtitle }}
|
||||
</p>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</PerfectScrollbar>
|
||||
</VCard>
|
||||
</VMenu>
|
||||
</IconBtn>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.shortcut-icon:hover {
|
||||
background-color: rgba(var(--v-theme-on-surface), var(--v-hover-opacity));
|
||||
}
|
||||
</style>
|
621
resources/js/@core/components/TheCustomizer.vue
Normal file
621
resources/js/@core/components/TheCustomizer.vue
Normal file
@@ -0,0 +1,621 @@
|
||||
<script setup>
|
||||
import { useStorage } from '@vueuse/core'
|
||||
import { PerfectScrollbar } from 'vue3-perfect-scrollbar'
|
||||
import { useTheme } from 'vuetify'
|
||||
import {
|
||||
staticPrimaryColor,
|
||||
staticPrimaryDarkenColor,
|
||||
} from '@/plugins/vuetify/theme'
|
||||
import {
|
||||
Direction,
|
||||
Layout,
|
||||
Skins,
|
||||
Theme,
|
||||
} from '@core/enums'
|
||||
import { useConfigStore } from '@core/stores/config'
|
||||
import {
|
||||
AppContentLayoutNav,
|
||||
ContentWidth,
|
||||
} from '@layouts/enums'
|
||||
import {
|
||||
cookieRef,
|
||||
namespaceConfig,
|
||||
} from '@layouts/stores/config'
|
||||
import { themeConfig } from '@themeConfig'
|
||||
import borderSkinDark from '@images/customizer-icons/border-dark.svg'
|
||||
import borderSkinLight from '@images/customizer-icons/border-light.svg'
|
||||
import collapsedDark from '@images/customizer-icons/collapsed-dark.svg'
|
||||
import collapsedLight from '@images/customizer-icons/collapsed-light.svg'
|
||||
import compactDark from '@images/customizer-icons/compact-dark.svg'
|
||||
import compactLight from '@images/customizer-icons/compact-light.svg'
|
||||
import defaultSkinDark from '@images/customizer-icons/default-dark.svg'
|
||||
import defaultSkinLight from '@images/customizer-icons/default-light.svg'
|
||||
import horizontalDark from '@images/customizer-icons/horizontal-dark.svg'
|
||||
import horizontalLight from '@images/customizer-icons/horizontal-light.svg'
|
||||
import ltrDark from '@images/customizer-icons/ltr-dark.svg'
|
||||
import ltrLight from '@images/customizer-icons/ltr-light.svg'
|
||||
import rtlDark from '@images/customizer-icons/rtl-dark.svg'
|
||||
import rtlLight from '@images/customizer-icons/rtl-light.svg'
|
||||
import wideDark from '@images/customizer-icons/wide-dark.svg'
|
||||
import wideLight from '@images/customizer-icons/wide-light.svg'
|
||||
|
||||
const isNavDrawerOpen = ref(false)
|
||||
const configStore = useConfigStore()
|
||||
const vuetifyTheme = useTheme()
|
||||
|
||||
const colors = [
|
||||
{
|
||||
main: staticPrimaryColor,
|
||||
darken: '#7E4EE6',
|
||||
},
|
||||
{
|
||||
main: '#0D9394',
|
||||
darken: '#0C8485',
|
||||
},
|
||||
{
|
||||
main: '#FFB400',
|
||||
darken: '#E6A200',
|
||||
},
|
||||
{
|
||||
main: '#FF4C51',
|
||||
darken: '#E64449',
|
||||
},
|
||||
{
|
||||
main: '#16B1FF',
|
||||
darken: '#149FE6',
|
||||
},
|
||||
]
|
||||
|
||||
const customPrimaryColor = ref('#ffffff')
|
||||
|
||||
watch(() => configStore.theme, () => {
|
||||
const cookiePrimaryColor = cookieRef(`${ vuetifyTheme.name.value }ThemePrimaryColor`, null).value
|
||||
if (cookiePrimaryColor && !colors.some(color => color.main === cookiePrimaryColor))
|
||||
customPrimaryColor.value = cookiePrimaryColor
|
||||
}, { immediate: true })
|
||||
|
||||
const setPrimaryColor = useDebounceFn(color => {
|
||||
vuetifyTheme.themes.value[vuetifyTheme.name.value].colors.primary = color.main
|
||||
vuetifyTheme.themes.value[vuetifyTheme.name.value].colors['primary-darken-1'] = color.darken
|
||||
cookieRef(`${ vuetifyTheme.name.value }ThemePrimaryColor`, null).value = color.main
|
||||
cookieRef(`${ vuetifyTheme.name.value }ThemePrimaryDarkenColor`, null).value = color.darken
|
||||
useStorage(namespaceConfig('initial-loader-color'), null).value = color.main
|
||||
}, 100)
|
||||
|
||||
const defaultSkin = useGenerateImageVariant(defaultSkinLight, defaultSkinDark)
|
||||
const borderSkin = useGenerateImageVariant(borderSkinLight, borderSkinDark)
|
||||
const collapsed = useGenerateImageVariant(collapsedLight, collapsedDark)
|
||||
const compactContent = useGenerateImageVariant(compactLight, compactDark)
|
||||
const wideContent = useGenerateImageVariant(wideLight, wideDark)
|
||||
const ltrImg = useGenerateImageVariant(ltrLight, ltrDark)
|
||||
const rtlImg = useGenerateImageVariant(rtlLight, rtlDark)
|
||||
const horizontalImg = useGenerateImageVariant(horizontalLight, horizontalDark)
|
||||
|
||||
const themeMode = computed(() => {
|
||||
return [
|
||||
{
|
||||
bgImage: 'ri-sun-line',
|
||||
value: Theme.Light,
|
||||
label: 'Light',
|
||||
},
|
||||
{
|
||||
bgImage: 'ri-moon-clear-line',
|
||||
value: Theme.Dark,
|
||||
label: 'Dark',
|
||||
},
|
||||
{
|
||||
bgImage: 'ri-computer-line',
|
||||
value: Theme.System,
|
||||
label: 'System',
|
||||
},
|
||||
]
|
||||
})
|
||||
|
||||
const themeSkin = computed(() => {
|
||||
return [
|
||||
{
|
||||
bgImage: defaultSkin.value,
|
||||
value: Skins.Default,
|
||||
label: 'Default',
|
||||
},
|
||||
{
|
||||
bgImage: borderSkin.value,
|
||||
value: Skins.Bordered,
|
||||
label: 'Bordered',
|
||||
},
|
||||
]
|
||||
})
|
||||
|
||||
const currentLayout = ref(configStore.isVerticalNavCollapsed ? 'collapsed' : configStore.appContentLayoutNav)
|
||||
|
||||
const layouts = computed(() => {
|
||||
return [
|
||||
{
|
||||
bgImage: defaultSkin.value,
|
||||
value: Layout.Vertical,
|
||||
label: 'Vertical',
|
||||
},
|
||||
{
|
||||
bgImage: collapsed.value,
|
||||
value: Layout.Collapsed,
|
||||
label: 'Collapsed',
|
||||
},
|
||||
{
|
||||
bgImage: horizontalImg.value,
|
||||
value: Layout.Horizontal,
|
||||
label: 'Horizontal',
|
||||
},
|
||||
]
|
||||
})
|
||||
|
||||
watch(currentLayout, () => {
|
||||
if (currentLayout.value === 'collapsed') {
|
||||
configStore.isVerticalNavCollapsed = true
|
||||
configStore.appContentLayoutNav = AppContentLayoutNav.Vertical
|
||||
} else {
|
||||
configStore.isVerticalNavCollapsed = false
|
||||
configStore.appContentLayoutNav = currentLayout.value
|
||||
}
|
||||
})
|
||||
watch(() => configStore.isVerticalNavCollapsed, () => {
|
||||
currentLayout.value = configStore.isVerticalNavCollapsed ? 'collapsed' : configStore.appContentLayoutNav
|
||||
})
|
||||
|
||||
const contentWidth = computed(() => {
|
||||
return [
|
||||
{
|
||||
bgImage: compactContent.value,
|
||||
value: ContentWidth.Boxed,
|
||||
label: 'Compact',
|
||||
},
|
||||
{
|
||||
bgImage: wideContent.value,
|
||||
value: ContentWidth.Fluid,
|
||||
label: 'Wide',
|
||||
},
|
||||
]
|
||||
})
|
||||
|
||||
const currentDir = ref(configStore.isAppRTL ? 'rtl' : 'ltr')
|
||||
|
||||
const direction = computed(() => {
|
||||
return [
|
||||
{
|
||||
bgImage: ltrImg.value,
|
||||
value: Direction.Ltr,
|
||||
label: 'Left to right',
|
||||
},
|
||||
{
|
||||
bgImage: rtlImg.value,
|
||||
value: Direction.Rtl,
|
||||
label: 'Right to left',
|
||||
},
|
||||
]
|
||||
})
|
||||
|
||||
watch(currentDir, () => {
|
||||
if (currentDir.value === 'rtl')
|
||||
configStore.isAppRTL = true
|
||||
else
|
||||
configStore.isAppRTL = false
|
||||
})
|
||||
|
||||
const isCookieHasAnyValue = ref(false)
|
||||
const { locale } = useI18n({ useScope: 'global' })
|
||||
|
||||
const isActiveLangRTL = computed(() => {
|
||||
const lang = themeConfig.app.i18n.langConfig.find(l => l.i18nLang === locale.value)
|
||||
|
||||
return lang?.isRTL ?? false
|
||||
})
|
||||
|
||||
watch([
|
||||
() => vuetifyTheme.current.value.colors.primary,
|
||||
configStore.$state,
|
||||
locale,
|
||||
], () => {
|
||||
const initialConfigValue = [
|
||||
staticPrimaryColor,
|
||||
staticPrimaryColor,
|
||||
themeConfig.app.theme,
|
||||
themeConfig.app.skin,
|
||||
themeConfig.verticalNav.isVerticalNavSemiDark,
|
||||
themeConfig.verticalNav.isVerticalNavCollapsed,
|
||||
themeConfig.app.contentWidth,
|
||||
isActiveLangRTL.value,
|
||||
themeConfig.app.contentLayoutNav,
|
||||
]
|
||||
|
||||
const themeConfigValue = [
|
||||
vuetifyTheme.themes.value.light.colors.primary,
|
||||
vuetifyTheme.themes.value.dark.colors.primary,
|
||||
configStore.theme,
|
||||
configStore.skin,
|
||||
configStore.isVerticalNavSemiDark,
|
||||
configStore.isVerticalNavCollapsed,
|
||||
configStore.appContentWidth,
|
||||
configStore.isAppRTL,
|
||||
configStore.appContentLayoutNav,
|
||||
]
|
||||
|
||||
currentDir.value = configStore.isAppRTL ? 'rtl' : 'ltr'
|
||||
isCookieHasAnyValue.value = JSON.stringify(themeConfigValue) !== JSON.stringify(initialConfigValue)
|
||||
}, {
|
||||
deep: true,
|
||||
immediate: true,
|
||||
})
|
||||
|
||||
const resetCustomizer = async () => {
|
||||
if (isCookieHasAnyValue.value) {
|
||||
vuetifyTheme.themes.value.light.colors.primary = staticPrimaryColor
|
||||
vuetifyTheme.themes.value.dark.colors.primary = staticPrimaryColor
|
||||
vuetifyTheme.themes.value.light.colors['primary-darken-1'] = staticPrimaryDarkenColor
|
||||
vuetifyTheme.themes.value.dark.colors['primary-darken-1'] = staticPrimaryDarkenColor
|
||||
configStore.theme = themeConfig.app.theme
|
||||
configStore.skin = themeConfig.app.skin
|
||||
configStore.isVerticalNavSemiDark = themeConfig.verticalNav.isVerticalNavSemiDark
|
||||
configStore.appContentLayoutNav = themeConfig.app.contentLayoutNav
|
||||
configStore.appContentWidth = themeConfig.app.contentWidth
|
||||
configStore.isAppRTL = isActiveLangRTL.value
|
||||
configStore.isVerticalNavCollapsed = themeConfig.verticalNav.isVerticalNavCollapsed
|
||||
useStorage(namespaceConfig('initial-loader-color'), null).value = staticPrimaryColor
|
||||
currentLayout.value = themeConfig.app.contentLayoutNav
|
||||
configStore.theme = themeConfig.app.theme
|
||||
configStore.skin = themeConfig.app.skin
|
||||
configStore.isVerticalNavSemiDark = themeConfig.verticalNav.isVerticalNavSemiDark
|
||||
configStore.appContentLayoutNav = themeConfig.app.contentLayoutNav
|
||||
configStore.appContentWidth = themeConfig.app.contentWidth
|
||||
configStore.isAppRTL = isActiveLangRTL.value
|
||||
configStore.isVerticalNavCollapsed = themeConfig.verticalNav.isVerticalNavCollapsed
|
||||
useStorage(namespaceConfig('initial-loader-color'), null).value = staticPrimaryColor
|
||||
currentLayout.value = themeConfig.app.contentLayoutNav
|
||||
cookieRef('lightThemePrimaryColor', null).value = null
|
||||
cookieRef('darkThemePrimaryColor', null).value = null
|
||||
cookieRef('lightThemePrimaryDarkenColor', null).value = null
|
||||
cookieRef('darkThemePrimaryDarkenColor', null).value = null
|
||||
await nextTick()
|
||||
await nextTick()
|
||||
isCookieHasAnyValue.value = false
|
||||
customPrimaryColor.value = '#ffffff'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="d-lg-block d-none">
|
||||
<VBtn
|
||||
icon
|
||||
class="app-customizer-toggler rounded-s-xl rounded-0"
|
||||
style="z-index: 1001;"
|
||||
@click="isNavDrawerOpen = true"
|
||||
>
|
||||
<VIcon icon="ri-settings-3-line" />
|
||||
</VBtn>
|
||||
|
||||
<VNavigationDrawer
|
||||
v-model="isNavDrawerOpen"
|
||||
temporary
|
||||
touchless
|
||||
border="none"
|
||||
location="end"
|
||||
width="400"
|
||||
:scrim="false"
|
||||
class="app-customizer"
|
||||
>
|
||||
<!-- 👉 Header -->
|
||||
<div class="customizer-heading d-flex align-center justify-space-between">
|
||||
<div>
|
||||
<h6 class="text-h6">
|
||||
Theme Customizer
|
||||
</h6>
|
||||
<p class="text-body-2 mb-0">
|
||||
Customize & Preview in Real Time
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="d-flex align-center gap-1">
|
||||
<VBtn
|
||||
icon
|
||||
variant="text"
|
||||
size="small"
|
||||
color="medium-emphasis"
|
||||
@click="resetCustomizer"
|
||||
>
|
||||
<VBadge
|
||||
v-show="isCookieHasAnyValue"
|
||||
dot
|
||||
color="error"
|
||||
offset-x="-29"
|
||||
offset-y="-14"
|
||||
/>
|
||||
|
||||
<VIcon
|
||||
size="22"
|
||||
icon="ri-refresh-line"
|
||||
/>
|
||||
</VBtn>
|
||||
|
||||
<VBtn
|
||||
icon
|
||||
variant="text"
|
||||
color="medium-emphasis"
|
||||
size="small"
|
||||
@click="isNavDrawerOpen = false"
|
||||
>
|
||||
<VIcon
|
||||
icon="ri-close-line"
|
||||
size="22"
|
||||
/>
|
||||
</VBtn>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<VDivider />
|
||||
|
||||
<PerfectScrollbar
|
||||
tag="ul"
|
||||
:options="{ wheelPropagation: false }"
|
||||
>
|
||||
<!-- SECTION Theming -->
|
||||
<CustomizerSection
|
||||
title="Theming"
|
||||
:divider="false"
|
||||
>
|
||||
<!-- 👉 Primary Color -->
|
||||
<div class="d-flex flex-column gap-2">
|
||||
<h6 class="text-h6">
|
||||
Primary Color
|
||||
</h6>
|
||||
|
||||
<div
|
||||
class="d-flex app-customizer-primary-colors"
|
||||
style="column-gap: 0.7rem; margin-block-start: 2px;"
|
||||
>
|
||||
<div
|
||||
v-for="color in colors"
|
||||
:key="color.main"
|
||||
style="
|
||||
border-radius: 0.375rem;
|
||||
outline: 1px solid rgba(var(--v-border-color), var(--v-border-opacity));
|
||||
padding-block: 0.5rem;
|
||||
padding-inline: 0.625rem;"
|
||||
class="primary-color-wrapper cursor-pointer"
|
||||
:class="vuetifyTheme.current.value.colors.primary === color.main ? 'active' : ''"
|
||||
:style="vuetifyTheme.current.value.colors.primary === color.main ? `outline-color: ${color.main}; outline-width:2px;` : `--v-color:${color.main}`"
|
||||
@click="setPrimaryColor(color)"
|
||||
>
|
||||
<div
|
||||
style="border-radius: 0.375rem;block-size: 2.125rem; inline-size: 1.9375rem;"
|
||||
:style="{ backgroundColor: color.main }"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="primary-color-wrapper cursor-pointer"
|
||||
style="
|
||||
border-radius: 0.375rem;
|
||||
outline: 1px solid rgba(var(--v-border-color), var(--v-border-opacity));
|
||||
padding-block: 0.5rem;
|
||||
padding-inline: 0.625rem;"
|
||||
:class="vuetifyTheme.current.value.colors.primary === customPrimaryColor ? 'active' : ''"
|
||||
:style="vuetifyTheme.current.value.colors.primary === customPrimaryColor ? `outline-color: ${customPrimaryColor}; outline-width:2px;` : ''"
|
||||
>
|
||||
<VBtn
|
||||
icon
|
||||
size="small"
|
||||
:color="vuetifyTheme.current.value.colors.primary === customPrimaryColor ? customPrimaryColor : $vuetify.theme.current.dark ? '#8692d029' : '#4b465c29'"
|
||||
variant="flat"
|
||||
style="border-radius: 0.375rem;"
|
||||
>
|
||||
<VIcon
|
||||
size="20"
|
||||
icon="ri-palette-line"
|
||||
/>
|
||||
</VBtn>
|
||||
|
||||
<VMenu
|
||||
activator="parent"
|
||||
:close-on-content-click="false"
|
||||
>
|
||||
<VList>
|
||||
<VListItem>
|
||||
<VColorPicker
|
||||
v-model="customPrimaryColor"
|
||||
mode="hex"
|
||||
:modes="['hex']"
|
||||
@update:model-value="setPrimaryColor({ main: customPrimaryColor, darken: customPrimaryColor })"
|
||||
/>
|
||||
</VListItem>
|
||||
</VList>
|
||||
</VMenu>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 👉 Theme -->
|
||||
<div class="d-flex flex-column gap-3">
|
||||
<h6 class="text-h6">
|
||||
Theme
|
||||
</h6>
|
||||
|
||||
<CustomRadiosWithImage
|
||||
:key="configStore.theme"
|
||||
v-model:selected-radio="configStore.theme"
|
||||
:radio-content="themeMode"
|
||||
:grid-column="{ cols: '4' }"
|
||||
class="customizer-skins"
|
||||
>
|
||||
<template #label="item">
|
||||
<span class="text-sm text-medium-emphasis mt-1">{{ item?.label }}</span>
|
||||
</template>
|
||||
|
||||
<template #content="{ item }">
|
||||
<div
|
||||
class="customizer-skins-icon-wrapper d-flex align-center justify-center py-3 w-100"
|
||||
style="min-inline-size: 100%;"
|
||||
>
|
||||
<VIcon
|
||||
size="30"
|
||||
:icon="item.bgImage"
|
||||
color="high-emphasis"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</CustomRadiosWithImage>
|
||||
</div>
|
||||
|
||||
<!-- 👉 Skin -->
|
||||
<div class="d-flex flex-column gap-3">
|
||||
<h6 class="text-h6">
|
||||
Skins
|
||||
</h6>
|
||||
|
||||
<CustomRadiosWithImage
|
||||
:key="configStore.skin"
|
||||
v-model:selected-radio="configStore.skin"
|
||||
:radio-content="themeSkin"
|
||||
:grid-column="{ cols: '4' }"
|
||||
>
|
||||
<template #label="item">
|
||||
<span class="text-sm text-medium-emphasis">{{ item?.label }}</span>
|
||||
</template>
|
||||
</CustomRadiosWithImage>
|
||||
</div>
|
||||
|
||||
<!-- 👉 Semi Dark -->
|
||||
<div
|
||||
class="align-center justify-space-between"
|
||||
:class="vuetifyTheme.global.name.value === 'light' && configStore.appContentLayoutNav === AppContentLayoutNav.Vertical ? 'd-flex' : 'd-none'"
|
||||
>
|
||||
<VLabel
|
||||
for="customizer-semi-dark"
|
||||
class="text-h6 text-high-emphasis"
|
||||
>
|
||||
Semi Dark Menu
|
||||
</VLabel>
|
||||
|
||||
<div>
|
||||
<VSwitch
|
||||
id="customizer-semi-dark"
|
||||
v-model="configStore.isVerticalNavSemiDark"
|
||||
class="ms-2"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</CustomizerSection>
|
||||
<!-- !SECTION -->
|
||||
|
||||
<!-- SECTION LAYOUT -->
|
||||
<CustomizerSection title="Layout">
|
||||
<!-- 👉 Layouts -->
|
||||
<div class="d-flex flex-column gap-3">
|
||||
<h6 class="text-base font-weight-medium">
|
||||
Layout
|
||||
</h6>
|
||||
|
||||
<CustomRadiosWithImage
|
||||
:key="currentLayout"
|
||||
v-model:selected-radio="currentLayout"
|
||||
:radio-content="layouts"
|
||||
:grid-column="{ cols: '4' }"
|
||||
>
|
||||
<template #label="item">
|
||||
<span class="text-sm text-medium-emphasis">{{ item.label }}</span>
|
||||
</template>
|
||||
</CustomRadiosWithImage>
|
||||
</div>
|
||||
|
||||
<!-- 👉 Content Width -->
|
||||
<div class="d-flex flex-column gap-3">
|
||||
<h6 class="text-base font-weight-medium">
|
||||
Content
|
||||
</h6>
|
||||
|
||||
<CustomRadiosWithImage
|
||||
:key="configStore.appContentWidth"
|
||||
v-model:selected-radio="configStore.appContentWidth"
|
||||
:radio-content="contentWidth"
|
||||
:grid-column="{ cols: '4' }"
|
||||
>
|
||||
<template #label="item">
|
||||
<span class="text-sm text-medium-emphasis">{{ item.label }}</span>
|
||||
</template>
|
||||
</CustomRadiosWithImage>
|
||||
</div>
|
||||
|
||||
<!-- 👉 Direction -->
|
||||
<div class="d-flex flex-column gap-3">
|
||||
<h6 class="text-base font-weight-medium">
|
||||
Direction
|
||||
</h6>
|
||||
|
||||
<CustomRadiosWithImage
|
||||
:key="currentDir"
|
||||
v-model:selected-radio="currentDir"
|
||||
:radio-content="direction"
|
||||
:grid-column="{ cols: '4' }"
|
||||
>
|
||||
<template #label="item">
|
||||
<span class="text-sm text-medium-emphasis">{{ item?.label }}</span>
|
||||
</template>
|
||||
</CustomRadiosWithImage>
|
||||
</div>
|
||||
</CustomizerSection>
|
||||
<!-- !SECTION -->
|
||||
</PerfectScrollbar>
|
||||
</VNavigationDrawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.app-customizer {
|
||||
.customizer-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 1.25rem;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
.customizer-heading {
|
||||
padding-block: 1rem;
|
||||
padding-inline: 1.5rem;
|
||||
}
|
||||
|
||||
.v-navigation-drawer__content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.v-label.custom-input.active {
|
||||
border-color: transparent;
|
||||
outline: 2px solid rgb(var(--v-theme-primary));
|
||||
}
|
||||
|
||||
.v-label.custom-input:not(.active):hover{
|
||||
border-color: rgba(var(--v-border-color), 0.22);
|
||||
}
|
||||
|
||||
.customizer-skins{
|
||||
.custom-input.active{
|
||||
.customizer-skins-icon-wrapper {
|
||||
background-color: rgba(var(--v-global-theme-primary), var(--v-selected-opacity));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.app-customizer-primary-colors {
|
||||
.primary-color-wrapper:not(.active) {
|
||||
&:hover{
|
||||
outline-color: rgba(var(--v-border-color), 0.22) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.app-customizer-toggler {
|
||||
position: fixed !important;
|
||||
inset-block-start: 20%;
|
||||
inset-inline-end: 0;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
</style>
|
54
resources/js/@core/components/ThemeSwitcher.vue
Normal file
54
resources/js/@core/components/ThemeSwitcher.vue
Normal file
@@ -0,0 +1,54 @@
|
||||
<script setup>
|
||||
import { useConfigStore } from '@core/stores/config'
|
||||
|
||||
const props = defineProps({
|
||||
themes: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const configStore = useConfigStore()
|
||||
const selectedItem = ref([configStore.theme])
|
||||
|
||||
// Update icon if theme is changed from other sources
|
||||
watch(() => configStore.theme, () => {
|
||||
selectedItem.value = [configStore.theme]
|
||||
}, { deep: true })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<IconBtn>
|
||||
<VIcon :icon="props.themes.find(t => t.name === configStore.theme)?.icon" />
|
||||
|
||||
<VTooltip
|
||||
activator="parent"
|
||||
open-delay="1000"
|
||||
scroll-strategy="close"
|
||||
>
|
||||
<span class="text-capitalize">{{ configStore.theme }}</span>
|
||||
</VTooltip>
|
||||
<VMenu
|
||||
activator="parent"
|
||||
offset="15px"
|
||||
width="160"
|
||||
>
|
||||
<VList
|
||||
v-model:selected="selectedItem"
|
||||
mandatory
|
||||
>
|
||||
<VListItem
|
||||
v-for="{ name, icon } in props.themes"
|
||||
:key="name"
|
||||
:value="name"
|
||||
:prepend-icon="icon"
|
||||
color="primary"
|
||||
class="text-capitalize"
|
||||
@click="() => { configStore.theme = name }"
|
||||
>
|
||||
{{ name }}
|
||||
</VListItem>
|
||||
</VList>
|
||||
</VMenu>
|
||||
</IconBtn>
|
||||
</template>
|
162
resources/js/@core/components/TiptapEditor.vue
Normal file
162
resources/js/@core/components/TiptapEditor.vue
Normal file
@@ -0,0 +1,162 @@
|
||||
<script setup>
|
||||
import { Placeholder } from '@tiptap/extension-placeholder'
|
||||
import { TextAlign } from '@tiptap/extension-text-align'
|
||||
import { Underline } from '@tiptap/extension-underline'
|
||||
import { StarterKit } from '@tiptap/starter-kit'
|
||||
import {
|
||||
EditorContent,
|
||||
useEditor,
|
||||
} from '@tiptap/vue-3'
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
|
||||
const editorRef = ref()
|
||||
|
||||
const editor = useEditor({
|
||||
content: props.modelValue,
|
||||
extensions: [
|
||||
StarterKit,
|
||||
TextAlign.configure({
|
||||
types: [
|
||||
'heading',
|
||||
'paragraph',
|
||||
],
|
||||
}),
|
||||
Placeholder.configure({ placeholder: 'Write something here...' }),
|
||||
Underline,
|
||||
],
|
||||
onUpdate() {
|
||||
if (!editor.value)
|
||||
return
|
||||
emit('update:modelValue', editor.value.getHTML())
|
||||
},
|
||||
})
|
||||
|
||||
watch(() => props.modelValue, () => {
|
||||
const isSame = editor.value?.getHTML() === props.modelValue
|
||||
if (isSame)
|
||||
return
|
||||
editor.value?.commands.setContent(props.modelValue)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="pa-5">
|
||||
<div
|
||||
v-if="editor"
|
||||
class="d-flex gap-1 flex-wrap"
|
||||
>
|
||||
<VBtn
|
||||
:class="{ 'is-active': editor.isActive('bold') }"
|
||||
icon="ri-bold"
|
||||
class="rounded"
|
||||
size="small"
|
||||
variant="text"
|
||||
color="default"
|
||||
@click="editor.chain().focus().toggleBold().run()"
|
||||
/>
|
||||
<VBtn
|
||||
:class="{ 'is-active': editor.isActive('underline') }"
|
||||
icon="ri-underline"
|
||||
class="rounded"
|
||||
size="small"
|
||||
variant="text"
|
||||
color="default"
|
||||
@click="editor.commands.toggleUnderline()"
|
||||
/>
|
||||
<VBtn
|
||||
icon="ri-italic"
|
||||
class="rounded"
|
||||
size="small"
|
||||
variant="text"
|
||||
color="default"
|
||||
:class="{ 'is-active': editor.isActive('italic') }"
|
||||
@click="editor.chain().focus().toggleItalic().run()"
|
||||
/>
|
||||
<VBtn
|
||||
icon="ri-strikethrough"
|
||||
class="rounded"
|
||||
size="small"
|
||||
variant="text"
|
||||
color="default"
|
||||
:class="{ 'is-active': editor.isActive('strike') }"
|
||||
@click="editor.chain().focus().toggleStrike().run()"
|
||||
/>
|
||||
<VBtn
|
||||
icon="ri-align-left"
|
||||
class="rounded"
|
||||
size="small"
|
||||
variant="text"
|
||||
color="default"
|
||||
:class="{ 'is-active': editor.isActive({ textAlign: 'left' }) }"
|
||||
@click="editor.chain().focus().setTextAlign('left').run()"
|
||||
/>
|
||||
<VBtn
|
||||
icon="ri-align-center"
|
||||
class="rounded"
|
||||
size="small"
|
||||
variant="text"
|
||||
color="default"
|
||||
:class="{ 'is-active': editor.isActive({ textAlign: 'center' }) }"
|
||||
@click="editor.chain().focus().setTextAlign('center').run()"
|
||||
/>
|
||||
<VBtn
|
||||
icon="ri-align-right"
|
||||
class="rounded"
|
||||
size="small"
|
||||
variant="text"
|
||||
color="default"
|
||||
:class="{ 'is-active': editor.isActive({ textAlign: 'right' }) }"
|
||||
@click="editor.chain().focus().setTextAlign('right').run()"
|
||||
/>
|
||||
<VBtn
|
||||
icon="ri-align-justify"
|
||||
class="rounded"
|
||||
size="small"
|
||||
variant="text"
|
||||
color="default"
|
||||
:class="{ 'is-active': editor.isActive({ textAlign: 'justify' }) }"
|
||||
@click="editor.chain().focus().setTextAlign('justify').run()"
|
||||
/>
|
||||
</div>
|
||||
<VDivider class="my-4" />
|
||||
<EditorContent
|
||||
ref="editorRef"
|
||||
:editor="editor"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.ProseMirror {
|
||||
padding: 0.5rem;
|
||||
min-block-size: 15vh;
|
||||
|
||||
p {
|
||||
margin-block-end: 0;
|
||||
}
|
||||
|
||||
p.is-editor-empty:first-child::before {
|
||||
block-size: 0;
|
||||
color: #adb5bd;
|
||||
content: attr(data-placeholder);
|
||||
float: inline-start;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
.is-active {
|
||||
border-color: rgba(var(--v-theme-primary), var(--v-border-opacity)) !important;
|
||||
background-color: rgba(var(--v-theme-primary), var(--v-activated-opacity));
|
||||
color: rgb(var(--v-theme-primary));
|
||||
}
|
||||
</style>
|
@@ -0,0 +1,472 @@
|
||||
<script setup>
|
||||
import FlatPickr from 'vue-flatpickr-component'
|
||||
import { useTheme } from 'vuetify'
|
||||
import {
|
||||
VField,
|
||||
filterFieldProps,
|
||||
makeVFieldProps,
|
||||
} from 'vuetify/lib/components/VField/VField'
|
||||
import {
|
||||
VInput,
|
||||
makeVInputProps,
|
||||
} from 'vuetify/lib/components/VInput/VInput'
|
||||
|
||||
import { filterInputAttrs } from 'vuetify/lib/util/helpers'
|
||||
import { useConfigStore } from '@core/stores/config'
|
||||
|
||||
const props = defineProps({
|
||||
autofocus: Boolean,
|
||||
counter: [
|
||||
Boolean,
|
||||
Number,
|
||||
String,
|
||||
],
|
||||
counterValue: Function,
|
||||
prefix: String,
|
||||
placeholder: String,
|
||||
persistentPlaceholder: Boolean,
|
||||
persistentCounter: Boolean,
|
||||
suffix: String,
|
||||
type: {
|
||||
type: String,
|
||||
default: 'text',
|
||||
},
|
||||
modelModifiers: Object,
|
||||
...makeVInputProps({
|
||||
density: 'comfortable',
|
||||
hideDetails: 'auto',
|
||||
}),
|
||||
...makeVFieldProps({
|
||||
variant: 'outlined',
|
||||
color: 'primary',
|
||||
}),
|
||||
})
|
||||
|
||||
const emit = defineEmits([
|
||||
'click:control',
|
||||
'mousedown:control',
|
||||
'update:focused',
|
||||
'update:modelValue',
|
||||
'click:clear',
|
||||
])
|
||||
|
||||
defineOptions({
|
||||
inheritAttrs: false,
|
||||
})
|
||||
|
||||
const configStore = useConfigStore()
|
||||
const attrs = useAttrs()
|
||||
const [rootAttrs, compAttrs] = filterInputAttrs(attrs)
|
||||
|
||||
const {
|
||||
modelValue: _,
|
||||
...inputProps
|
||||
} = VInput.filterProps(props)
|
||||
|
||||
const fieldProps = filterFieldProps(props)
|
||||
const refFlatPicker = ref()
|
||||
const { focused } = useFocus(refFlatPicker)
|
||||
const isCalendarOpen = ref(false)
|
||||
const isInlinePicker = ref(false)
|
||||
|
||||
// flat picker prop manipulation
|
||||
if (compAttrs.config && compAttrs.config.inline) {
|
||||
isInlinePicker.value = compAttrs.config.inline
|
||||
Object.assign(compAttrs, { altInputClass: 'inlinePicker' })
|
||||
}
|
||||
|
||||
const onClear = el => {
|
||||
el.stopPropagation()
|
||||
nextTick(() => {
|
||||
emit('update:modelValue', '')
|
||||
emit('click:clear', el)
|
||||
})
|
||||
}
|
||||
|
||||
const vuetifyTheme = useTheme()
|
||||
const vuetifyThemesName = Object.keys(vuetifyTheme.themes.value)
|
||||
|
||||
// Themes class added to flat-picker component for light and dark support
|
||||
const updateThemeClassInCalendar = () => {
|
||||
|
||||
// ℹ️ Flatpickr don't render it's instance in mobile and device simulator
|
||||
if (!refFlatPicker.value.fp.calendarContainer)
|
||||
return
|
||||
vuetifyThemesName.forEach(t => {
|
||||
refFlatPicker.value.fp.calendarContainer.classList.remove(`v-theme--${ t }`)
|
||||
})
|
||||
refFlatPicker.value.fp.calendarContainer.classList.add(`v-theme--${ vuetifyTheme.global.name.value }`)
|
||||
}
|
||||
|
||||
watch(() => configStore.theme, updateThemeClassInCalendar)
|
||||
onMounted(() => {
|
||||
updateThemeClassInCalendar()
|
||||
})
|
||||
|
||||
const emitModelValue = val => {
|
||||
emit('update:modelValue', val)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="app-picker-field">
|
||||
<VInput
|
||||
v-bind="{ ...inputProps, ...rootAttrs }"
|
||||
:model-value="modelValue"
|
||||
:hide-details="props.hideDetails"
|
||||
:class="[{
|
||||
'v-text-field--prefixed': props.prefix,
|
||||
'v-text-field--suffixed': props.suffix,
|
||||
'v-text-field--flush-details': ['plain', 'underlined'].includes(props.variant),
|
||||
}, props.class]"
|
||||
class="position-relative v-text-field"
|
||||
:style="props.style"
|
||||
>
|
||||
<template #default="{ id, isDirty, isValid, isDisabled, isReadonly }">
|
||||
<!-- v-field -->
|
||||
<VField
|
||||
v-bind="{ ...fieldProps }"
|
||||
:id="id.value"
|
||||
role="textbox"
|
||||
:active="focused || isDirty.value || isCalendarOpen"
|
||||
:focused="focused || isCalendarOpen"
|
||||
:dirty="isDirty.value || props.dirty"
|
||||
:error="isValid.value === false"
|
||||
:disabled="isDisabled.value"
|
||||
@click:clear="onClear"
|
||||
>
|
||||
<template #default="{ props: vFieldProps }">
|
||||
<div v-bind="vFieldProps">
|
||||
<!-- flat-picker -->
|
||||
<FlatPickr
|
||||
v-if="!isInlinePicker"
|
||||
v-bind="compAttrs"
|
||||
ref="refFlatPicker"
|
||||
:model-value="modelValue"
|
||||
:placeholder="props.placeholder"
|
||||
:readonly="isReadonly.value"
|
||||
class="flat-picker-custom-style"
|
||||
:disabled="isReadonly.value"
|
||||
@on-open="isCalendarOpen = true"
|
||||
@on-close="isCalendarOpen = false"
|
||||
@update:model-value="emitModelValue"
|
||||
/>
|
||||
|
||||
<!-- simple input for inline prop -->
|
||||
<input
|
||||
v-if="isInlinePicker"
|
||||
:value="modelValue"
|
||||
:placeholder="props.placeholder"
|
||||
:readonly="isReadonly.value"
|
||||
class="flat-picker-custom-style"
|
||||
type="text"
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
</VField>
|
||||
</template>
|
||||
</VInput>
|
||||
|
||||
<!-- flat picker for inline props -->
|
||||
<FlatPickr
|
||||
v-if="isInlinePicker"
|
||||
v-bind="compAttrs"
|
||||
ref="refFlatPicker"
|
||||
:model-value="modelValue"
|
||||
@update:model-value="emitModelValue"
|
||||
@on-open="isCalendarOpen = true"
|
||||
@on-close="isCalendarOpen = false"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
/* stylelint-disable no-descending-specificity */
|
||||
@use "flatpickr/dist/flatpickr.css";
|
||||
@use "@core-scss/base/mixins";
|
||||
@use "@styles/variables/_vuetify.scss" as vuetify;
|
||||
|
||||
.flat-picker-custom-style {
|
||||
position: absolute;
|
||||
color: inherit;
|
||||
inline-size: 100%;
|
||||
inset: 0;
|
||||
outline: none;
|
||||
padding-block: 0;
|
||||
padding-inline: var(--v-field-padding-start);
|
||||
}
|
||||
|
||||
$heading-color: rgba(var(--v-theme-on-background), var(--v-high-emphasis-opacity));
|
||||
$body-color: rgba(var(--v-theme-on-background), var(--v-medium-emphasis-opacity));
|
||||
|
||||
// hide the input when your picker is inline
|
||||
input[altinputclass="inlinePicker"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.flatpickr-calendar {
|
||||
border-radius: vuetify.$border-radius-root;
|
||||
background-color: rgb(var(--v-theme-surface));
|
||||
inline-size: 16.875rem;
|
||||
|
||||
@include mixins.elevation(6);
|
||||
|
||||
.flatpickr-rContainer {
|
||||
inline-size: 16.875rem;
|
||||
|
||||
.flatpickr-weekdays {
|
||||
padding-inline: 0.5rem;
|
||||
}
|
||||
|
||||
.flatpickr-days {
|
||||
font-size: .9375rem;
|
||||
min-inline-size: 16.875rem;
|
||||
|
||||
.dayContainer {
|
||||
justify-content: center !important;
|
||||
inline-size: 16.875rem !important;
|
||||
min-inline-size: 16.875rem !important;
|
||||
padding-block: 0 0.5rem;
|
||||
|
||||
.flatpickr-day {
|
||||
block-size: 36px;
|
||||
line-height: 36px;
|
||||
margin-block-start: 0 !important;
|
||||
max-inline-size: 36px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.flatpickr-day {
|
||||
color: $heading-color;
|
||||
|
||||
&.today {
|
||||
border-color: transparent;
|
||||
background-color: rgb(var(--v-theme-primary), var(--v-border-opacity));
|
||||
color: rgba(var(--v-theme-primary));
|
||||
|
||||
&:hover {
|
||||
border-color: transparent;
|
||||
background-color: rgb(var(--v-theme-primary), var(--v-border-opacity));
|
||||
color: rgba(var(--v-theme-primary));
|
||||
}
|
||||
}
|
||||
|
||||
&.selected,
|
||||
&.selected:hover {
|
||||
border-color: rgb(var(--v-theme-primary));
|
||||
background: rgb(var(--v-theme-primary));
|
||||
color: rgb(var(--v-theme-on-primary));
|
||||
|
||||
@include mixins.elevation(2);
|
||||
}
|
||||
|
||||
&.inRange,
|
||||
&.inRange:hover {
|
||||
border: none;
|
||||
background: rgba(var(--v-theme-primary), 0.1) !important;
|
||||
box-shadow: none !important;
|
||||
color: rgb(var(--v-theme-primary));
|
||||
}
|
||||
|
||||
&.inRange.today {
|
||||
background: rgba(var(--v-theme-primary), 0.24) !important;
|
||||
}
|
||||
|
||||
&.startRange {
|
||||
@include mixins.elevation(2);
|
||||
|
||||
}
|
||||
|
||||
&.endRange {
|
||||
@include mixins.elevation(2);
|
||||
}
|
||||
|
||||
&.startRange,
|
||||
&.endRange,
|
||||
&.startRange:hover,
|
||||
&.endRange:hover {
|
||||
border-color: rgb(var(--v-theme-primary));
|
||||
background: rgb(var(--v-theme-primary));
|
||||
color: rgb(var(--v-theme-on-primary));
|
||||
}
|
||||
|
||||
&.selected.startRange + .endRange:not(:nth-child(7n + 1)),
|
||||
&.startRange.startRange + .endRange:not(:nth-child(7n + 1)),
|
||||
&.endRange.startRange + .endRange:not(:nth-child(7n + 1)) {
|
||||
box-shadow: -10px 0 0 rgb(var(--v-theme-primary));
|
||||
}
|
||||
|
||||
&.flatpickr-disabled,
|
||||
&.prevMonthDay:not(.startRange,.inRange),
|
||||
&.nextMonthDay:not(.endRange,.inRange) {
|
||||
color: rgba(var(--v-theme-on-background), var(--v-disabled-opacity));
|
||||
}
|
||||
|
||||
&:hover {
|
||||
border-color: transparent;
|
||||
background: rgba(var(--v-theme-on-surface), var(--v-hover-opacity));
|
||||
color: rgba(var(--v-theme-on-surface), var(--v-medium-emphasis-opacity));
|
||||
}
|
||||
}
|
||||
|
||||
.flatpickr-weekday {
|
||||
color: $heading-color;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
&::after,
|
||||
&::before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.flatpickr-months {
|
||||
padding-block-start: 0.5rem;
|
||||
|
||||
.flatpickr-prev-month,
|
||||
.flatpickr-next-month {
|
||||
fill: rgba(var(--v-theme-on-surface), var(--v-medium-emphasis-opacity));
|
||||
|
||||
svg {
|
||||
block-size: 13px;
|
||||
inline-size: 13px;
|
||||
stroke: rgba(var(--v-theme-on-surface), var(--v-medium-emphasis-opacity));
|
||||
}
|
||||
|
||||
&:hover i,
|
||||
&:hover svg {
|
||||
fill: $body-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.flatpickr-current-month {
|
||||
padding-block: 4px 0;
|
||||
padding-inline: 0;
|
||||
|
||||
span.cur-month {
|
||||
font-weight: 400;
|
||||
}
|
||||
}
|
||||
|
||||
&.open {
|
||||
// Open calendar above overlay
|
||||
z-index: 2401;
|
||||
}
|
||||
|
||||
&.hasTime.open {
|
||||
.flatpickr-time {
|
||||
border-color: rgba(var(--v-border-color), var(--v-border-opacity));
|
||||
block-size: auto;
|
||||
}
|
||||
}
|
||||
|
||||
&.hasTime .flatpickr-time:first-child {
|
||||
border-color: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
// Time picker hover & focus bg color
|
||||
.flatpickr-time input:hover,
|
||||
.flatpickr-time .flatpickr-am-pm:hover,
|
||||
.flatpickr-time input:focus,
|
||||
.flatpickr-time .flatpickr-am-pm:focus {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
// Time picker
|
||||
.flatpickr-time {
|
||||
input.flatpickr-hour {
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.flatpickr-am-pm,
|
||||
.flatpickr-time-separator,
|
||||
input {
|
||||
color: $heading-color;
|
||||
}
|
||||
|
||||
.numInputWrapper {
|
||||
span {
|
||||
&.arrowUp {
|
||||
&::after {
|
||||
border-block-end-color: rgb(var(--v-border-color));
|
||||
}
|
||||
}
|
||||
|
||||
&.arrowDown {
|
||||
&::after {
|
||||
border-block-start-color: rgb(var(--v-border-color));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Added bg color for flatpickr input only as it has default readonly attribute
|
||||
.flatpickr-input[readonly],
|
||||
.flatpickr-input ~ .form-control[readonly],
|
||||
.flatpickr-human-friendly[readonly] {
|
||||
background-color: inherit;
|
||||
}
|
||||
|
||||
// week sections
|
||||
.flatpickr-weekdays {
|
||||
margin-block: 8px;
|
||||
}
|
||||
|
||||
// Month and year section
|
||||
.flatpickr-current-month {
|
||||
.flatpickr-monthDropdown-months {
|
||||
appearance: none;
|
||||
block-size: 24px;
|
||||
}
|
||||
|
||||
.flatpickr-monthDropdown-months,
|
||||
.numInputWrapper {
|
||||
padding: 2px;
|
||||
border-radius: 4px;
|
||||
color: $heading-color;
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 400;
|
||||
transition: all 0.15s ease-out;
|
||||
|
||||
span {
|
||||
display: none;
|
||||
}
|
||||
|
||||
input.cur-year {
|
||||
font-weight: 400 !important;
|
||||
}
|
||||
|
||||
.flatpickr-monthDropdown-month {
|
||||
background-color: rgb(var(--v-theme-surface));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.flatpickr-day.flatpickr-disabled,
|
||||
.flatpickr-day.flatpickr-disabled:hover {
|
||||
color: $body-color;
|
||||
}
|
||||
|
||||
.flatpickr-months {
|
||||
padding-block: 0.3rem;
|
||||
padding-inline: 0;
|
||||
|
||||
.flatpickr-prev-month,
|
||||
.flatpickr-next-month {
|
||||
inset-block-start: .2rem !important;
|
||||
}
|
||||
|
||||
.flatpickr-next-month {
|
||||
inset-inline-end: 0.375rem !important;
|
||||
}
|
||||
|
||||
.flatpickr-prev-month {
|
||||
inset-inline-start: 0.25rem !important;
|
||||
}
|
||||
}
|
||||
</style>
|
@@ -0,0 +1,79 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
selectedCheckbox: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
checkboxContent: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
gridColumn: {
|
||||
type: null,
|
||||
required: false,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:selectedCheckbox'])
|
||||
|
||||
const updateSelectedOption = value => {
|
||||
if (typeof value !== 'boolean' && value !== null)
|
||||
emit('update:selectedCheckbox', value)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VRow v-if="props.checkboxContent && props.selectedCheckbox">
|
||||
<VCol
|
||||
v-for="item in props.checkboxContent"
|
||||
:key="item.title"
|
||||
v-bind="gridColumn"
|
||||
>
|
||||
<VLabel
|
||||
class="custom-input custom-checkbox rounded cursor-pointer"
|
||||
:class="props.selectedCheckbox.includes(item.value) ? 'active' : ''"
|
||||
>
|
||||
<div>
|
||||
<VCheckbox
|
||||
:model-value="props.selectedCheckbox"
|
||||
:value="item.value"
|
||||
@update:model-value="updateSelectedOption"
|
||||
/>
|
||||
</div>
|
||||
<slot :item="item">
|
||||
<div class="flex-grow-1">
|
||||
<div class="d-flex align-center mb-2">
|
||||
<h6 class="cr-title text-base">
|
||||
{{ item.title }}
|
||||
</h6>
|
||||
<VSpacer />
|
||||
<span
|
||||
v-if="item.subtitle"
|
||||
class="text-sm text-disabled"
|
||||
>{{ item.subtitle }}</span>
|
||||
</div>
|
||||
<p class="text-sm text-medium-emphasis mb-0">
|
||||
{{ item.desc }}
|
||||
</p>
|
||||
</div>
|
||||
</slot>
|
||||
</VLabel>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.custom-checkbox {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 0.25rem;
|
||||
|
||||
.v-checkbox {
|
||||
margin-block-start: -0.375rem;
|
||||
}
|
||||
|
||||
.cr-title {
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
</style>
|
@@ -0,0 +1,94 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
selectedCheckbox: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
checkboxContent: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
gridColumn: {
|
||||
type: null,
|
||||
required: false,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:selectedCheckbox'])
|
||||
|
||||
const updateSelectedOption = value => {
|
||||
if (typeof value !== 'boolean' && value !== null)
|
||||
emit('update:selectedCheckbox', value)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VRow v-if="props.checkboxContent && props.selectedCheckbox">
|
||||
<VCol
|
||||
v-for="item in props.checkboxContent"
|
||||
:key="item.title"
|
||||
v-bind="gridColumn"
|
||||
>
|
||||
<VLabel
|
||||
class="custom-input custom-checkbox-icon rounded cursor-pointer"
|
||||
:class="props.selectedCheckbox.includes(item.value) ? 'active' : ''"
|
||||
>
|
||||
<slot :item="item">
|
||||
<div class="d-flex flex-column align-center text-center gap-2">
|
||||
<VIcon
|
||||
size="28"
|
||||
:icon="item.icon"
|
||||
class="text-high-emphasis"
|
||||
/>
|
||||
|
||||
<h6 class="cr-title text-base">
|
||||
{{ item.title }}
|
||||
</h6>
|
||||
<p class="text-sm text-medium-emphasis clamp-text mb-0">
|
||||
{{ item.desc }}
|
||||
</p>
|
||||
</div>
|
||||
</slot>
|
||||
<div>
|
||||
<VCheckbox
|
||||
:model-value="props.selectedCheckbox"
|
||||
:value="item.value"
|
||||
@update:model-value="updateSelectedOption"
|
||||
/>
|
||||
</div>
|
||||
</VLabel>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.custom-checkbox-icon {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
|
||||
.v-checkbox {
|
||||
margin-block-end: -0.375rem;
|
||||
|
||||
.v-selection-control__wrapper {
|
||||
margin-inline-start: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.cr-title {
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
.custom-checkbox-icon {
|
||||
.v-checkbox {
|
||||
margin-block-end: -0.375rem;
|
||||
|
||||
.v-selection-control__wrapper {
|
||||
margin-inline-start: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@@ -0,0 +1,96 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
selectedCheckbox: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
checkboxContent: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
gridColumn: {
|
||||
type: null,
|
||||
required: false,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:selectedCheckbox'])
|
||||
|
||||
const updateSelectedOption = value => {
|
||||
if (typeof value !== 'boolean' && value !== null)
|
||||
emit('update:selectedCheckbox', value)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VRow v-if="props.checkboxContent && props.selectedCheckbox">
|
||||
<VCol
|
||||
v-for="item in props.checkboxContent"
|
||||
:key="item.value"
|
||||
v-bind="gridColumn"
|
||||
>
|
||||
<VLabel
|
||||
class="custom-input custom-checkbox rounded cursor-pointer w-100"
|
||||
:class="props.selectedCheckbox.includes(item.value) ? 'active' : ''"
|
||||
>
|
||||
<div>
|
||||
<VCheckbox
|
||||
:id="`custom-checkbox-with-img-${item.value}`"
|
||||
:model-value="props.selectedCheckbox"
|
||||
:value="item.value"
|
||||
@update:model-value="updateSelectedOption"
|
||||
/>
|
||||
</div>
|
||||
<img
|
||||
:src="item.bgImage"
|
||||
alt="bg-img"
|
||||
class="custom-checkbox-image"
|
||||
>
|
||||
</VLabel>
|
||||
|
||||
<VLabel
|
||||
v-if="item.label || $slots.label"
|
||||
:for="`custom-checkbox-with-img-${item.value}`"
|
||||
class="cursor-pointer"
|
||||
>
|
||||
<slot
|
||||
name="label"
|
||||
:label="item.label"
|
||||
>
|
||||
{{ item.label }}
|
||||
</slot>
|
||||
</VLabel>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.custom-checkbox {
|
||||
position: relative;
|
||||
padding: 0;
|
||||
|
||||
.custom-checkbox-image {
|
||||
block-size: 100%;
|
||||
inline-size: 100%;
|
||||
min-inline-size: 100%;
|
||||
}
|
||||
|
||||
.v-checkbox {
|
||||
position: absolute;
|
||||
inset-block-start: 0;
|
||||
inset-inline-end: 0;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-width: 1px;
|
||||
}
|
||||
|
||||
&:hover,
|
||||
&.active {
|
||||
.v-checkbox {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@@ -0,0 +1,81 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
selectedRadio: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
radioContent: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
gridColumn: {
|
||||
type: null,
|
||||
required: false,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:selectedRadio'])
|
||||
|
||||
const updateSelectedOption = value => {
|
||||
if (value !== null)
|
||||
emit('update:selectedRadio', value)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VRadioGroup
|
||||
v-if="props.radioContent"
|
||||
:model-value="props.selectedRadio"
|
||||
@update:model-value="updateSelectedOption"
|
||||
>
|
||||
<VRow>
|
||||
<VCol
|
||||
v-for="item in props.radioContent"
|
||||
:key="item.title"
|
||||
v-bind="gridColumn"
|
||||
>
|
||||
<VLabel
|
||||
class="custom-input custom-radio rounded cursor-pointer"
|
||||
:class="props.selectedRadio === item.value ? 'active' : ''"
|
||||
>
|
||||
<div>
|
||||
<VRadio :value="item.value" />
|
||||
</div>
|
||||
<slot :item="item">
|
||||
<div class="flex-grow-1">
|
||||
<div class="d-flex align-center mb-2">
|
||||
<h6 class="cr-title text-base">
|
||||
{{ item.title }}
|
||||
</h6>
|
||||
<VSpacer />
|
||||
<span
|
||||
v-if="item.subtitle"
|
||||
class="text-disabled text-sm"
|
||||
>{{ item.subtitle }}</span>
|
||||
</div>
|
||||
<p class="text-sm text-medium-emphasis mb-0">
|
||||
{{ item.desc }}
|
||||
</p>
|
||||
</div>
|
||||
</slot>
|
||||
</VLabel>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</VRadioGroup>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.custom-radio {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 0.25rem;
|
||||
|
||||
.v-radio {
|
||||
margin-block-start: -0.45rem;
|
||||
}
|
||||
|
||||
.cr-title {
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
</style>
|
@@ -0,0 +1,93 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
selectedRadio: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
radioContent: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
gridColumn: {
|
||||
type: null,
|
||||
required: false,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:selectedRadio'])
|
||||
|
||||
const updateSelectedOption = value => {
|
||||
if (value !== null)
|
||||
emit('update:selectedRadio', value)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VRadioGroup
|
||||
v-if="props.radioContent"
|
||||
:model-value="props.selectedRadio"
|
||||
@update:model-value="updateSelectedOption"
|
||||
>
|
||||
<VRow>
|
||||
<VCol
|
||||
v-for="item in props.radioContent"
|
||||
:key="item.title"
|
||||
v-bind="gridColumn"
|
||||
>
|
||||
<VLabel
|
||||
class="custom-input custom-radio-icon rounded cursor-pointer"
|
||||
:class="props.selectedRadio === item.value ? 'active' : ''"
|
||||
>
|
||||
<slot :item="item">
|
||||
<div class="d-flex flex-column align-center text-center gap-2">
|
||||
<VIcon
|
||||
size="28"
|
||||
:icon="item.icon"
|
||||
class="text-high-emphasis"
|
||||
/>
|
||||
<h6 class="cr-title text-base">
|
||||
{{ item.title }}
|
||||
</h6>
|
||||
|
||||
<p class="text-sm text-medium-emphasis mb-0 clamp-text">
|
||||
{{ item.desc }}
|
||||
</p>
|
||||
</div>
|
||||
</slot>
|
||||
|
||||
<div>
|
||||
<VRadio :value="item.value" />
|
||||
</div>
|
||||
</VLabel>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</VRadioGroup>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.custom-radio-icon {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
|
||||
.v-radio {
|
||||
margin-block-end: -0.25rem;
|
||||
}
|
||||
|
||||
.cr-title {
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
.custom-radio-icon {
|
||||
.v-radio {
|
||||
margin-block-end: -0.25rem;
|
||||
|
||||
.v-selection-control__wrapper {
|
||||
margin-inline-start: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@@ -0,0 +1,100 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
selectedRadio: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
radioContent: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
gridColumn: {
|
||||
type: null,
|
||||
required: false,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:selectedRadio'])
|
||||
|
||||
const updateSelectedOption = value => {
|
||||
if (value !== null)
|
||||
emit('update:selectedRadio', value)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VRadioGroup
|
||||
v-if="props.radioContent"
|
||||
:model-value="props.selectedRadio"
|
||||
@update:model-value="updateSelectedOption"
|
||||
>
|
||||
<VRow>
|
||||
<VCol
|
||||
v-for="item in props.radioContent"
|
||||
:key="item.bgImage"
|
||||
v-bind="gridColumn"
|
||||
>
|
||||
<VLabel
|
||||
class="custom-input custom-radio rounded cursor-pointer w-100"
|
||||
:class="props.selectedRadio === item.value ? 'active' : ''"
|
||||
>
|
||||
<slot
|
||||
name="content"
|
||||
:item="item"
|
||||
>
|
||||
<template v-if="typeof item.bgImage === 'object'">
|
||||
<Component
|
||||
:is="item.bgImage"
|
||||
class="custom-radio-image"
|
||||
/>
|
||||
</template>
|
||||
<img
|
||||
v-else
|
||||
:src="item.bgImage"
|
||||
alt="bg-img"
|
||||
class="custom-radio-image"
|
||||
>
|
||||
</slot>
|
||||
|
||||
<VRadio
|
||||
:id="`custom-radio-with-img-${item.value}`"
|
||||
:value="item.value"
|
||||
/>
|
||||
</VLabel>
|
||||
|
||||
<VLabel
|
||||
v-if="item.label || $slots.label"
|
||||
:for="`custom-radio-with-img-${item.value}`"
|
||||
class="cursor-pointer"
|
||||
>
|
||||
<slot
|
||||
name="label"
|
||||
:label="item.label"
|
||||
>
|
||||
{{ item.label }}
|
||||
</slot>
|
||||
</VLabel>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</VRadioGroup>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.custom-radio {
|
||||
padding: 0 !important;
|
||||
|
||||
&.active {
|
||||
border-width: 1px;
|
||||
}
|
||||
|
||||
.custom-radio-image {
|
||||
block-size: 100%;
|
||||
inline-size: 100%;
|
||||
min-inline-size: 100%;
|
||||
}
|
||||
|
||||
.v-radio {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
</style>
|
183
resources/js/@core/components/cards/AppCardActions.vue
Normal file
183
resources/js/@core/components/cards/AppCardActions.vue
Normal file
@@ -0,0 +1,183 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
collapsed: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
noActions: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
actionCollapsed: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
actionRefresh: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
actionRemove: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
loading: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
skipCheck: true,
|
||||
default: undefined,
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: undefined,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits([
|
||||
'collapsed',
|
||||
'refresh',
|
||||
'trash',
|
||||
'initialLoad',
|
||||
'update:loading',
|
||||
])
|
||||
|
||||
defineOptions({
|
||||
inheritAttrs: false,
|
||||
})
|
||||
|
||||
const _loading = ref(false)
|
||||
|
||||
const $loading = computed({
|
||||
get() {
|
||||
return props.loading !== undefined ? props.loading : _loading.value
|
||||
},
|
||||
set(value) {
|
||||
props.loading !== undefined ? emit('update:loading', value) : _loading.value = value
|
||||
},
|
||||
})
|
||||
|
||||
const isContentCollapsed = ref(props.collapsed)
|
||||
const isCardRemoved = ref(false)
|
||||
|
||||
// stop loading
|
||||
const stopLoading = () => {
|
||||
$loading.value = false
|
||||
}
|
||||
|
||||
// trigger collapse
|
||||
const triggerCollapse = () => {
|
||||
isContentCollapsed.value = !isContentCollapsed.value
|
||||
emit('collapsed', isContentCollapsed.value)
|
||||
}
|
||||
|
||||
// trigger refresh
|
||||
const triggerRefresh = () => {
|
||||
$loading.value = true
|
||||
emit('refresh', stopLoading)
|
||||
}
|
||||
|
||||
// trigger removal
|
||||
const triggeredRemove = () => {
|
||||
isCardRemoved.value = true
|
||||
emit('trash')
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VExpandTransition>
|
||||
<!-- TODO remove div when transition work with v-card components: https://github.com/vuetifyjs/vuetify/issues/15111 -->
|
||||
<div v-if="!isCardRemoved">
|
||||
<VCard v-bind="$attrs">
|
||||
<VCardItem>
|
||||
<VCardTitle v-if="props.title || $slots.title">
|
||||
<!-- 👉 Title slot and prop -->
|
||||
<slot name="title">
|
||||
{{ props.title }}
|
||||
</slot>
|
||||
</VCardTitle>
|
||||
|
||||
<template #append>
|
||||
<!-- 👉 Before actions slot -->
|
||||
<div>
|
||||
<slot name="before-actions" />
|
||||
|
||||
<!-- SECTION Actions buttons -->
|
||||
|
||||
<!-- 👉 Collapse button -->
|
||||
<IconBtn
|
||||
v-if="(!(actionRemove || actionRefresh) || actionCollapsed) && !noActions"
|
||||
@click="triggerCollapse"
|
||||
>
|
||||
<VIcon
|
||||
size="20"
|
||||
icon="ri-arrow-up-s-line"
|
||||
:style="{ transform: isContentCollapsed ? 'rotate(-180deg)' : undefined }"
|
||||
style="transition-duration: 0.28s;"
|
||||
/>
|
||||
</IconBtn>
|
||||
|
||||
<!-- 👉 Overlay button -->
|
||||
<IconBtn
|
||||
v-if="(!(actionRemove || actionCollapsed) || actionRefresh) && !noActions"
|
||||
@click="triggerRefresh"
|
||||
>
|
||||
<VIcon
|
||||
size="20"
|
||||
icon="ri-refresh-line"
|
||||
/>
|
||||
</IconBtn>
|
||||
|
||||
<!-- 👉 Close button -->
|
||||
<IconBtn
|
||||
v-if="(!(actionRefresh || actionCollapsed) || actionRemove) && !noActions"
|
||||
@click="triggeredRemove"
|
||||
>
|
||||
<VIcon
|
||||
size="20"
|
||||
icon="ri-close-line"
|
||||
/>
|
||||
</IconBtn>
|
||||
</div>
|
||||
<!-- !SECTION -->
|
||||
</template>
|
||||
</VCardItem>
|
||||
|
||||
<!-- 👉 card content -->
|
||||
<VExpandTransition>
|
||||
<div
|
||||
v-show="!isContentCollapsed"
|
||||
class="v-card-content"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
</VExpandTransition>
|
||||
|
||||
<!-- 👉 Overlay -->
|
||||
<VOverlay
|
||||
v-model="$loading"
|
||||
contained
|
||||
persistent
|
||||
scroll-strategy="none"
|
||||
class="align-center justify-center"
|
||||
>
|
||||
<VProgressCircular indeterminate />
|
||||
</VOverlay>
|
||||
</VCard>
|
||||
</div>
|
||||
</VExpandTransition>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.v-card-item {
|
||||
+.v-card-content {
|
||||
.v-card-text:first-child {
|
||||
padding-block-start: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
116
resources/js/@core/components/cards/AppCardCode.vue
Normal file
116
resources/js/@core/components/cards/AppCardCode.vue
Normal file
@@ -0,0 +1,116 @@
|
||||
<script setup>
|
||||
import 'prismjs'
|
||||
import 'prismjs/themes/prism-tomorrow.css'
|
||||
import Prism from 'vue-prism-component'
|
||||
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
code: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
codeLanguage: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: 'markup',
|
||||
},
|
||||
noPadding: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
})
|
||||
|
||||
const preferredCodeLanguage = useCookie('preferredCodeLanguage', {
|
||||
default: () => 'ts',
|
||||
maxAge: COOKIE_MAX_AGE_1_YEAR,
|
||||
})
|
||||
|
||||
const isCodeShown = ref(false)
|
||||
const { copy, copied } = useClipboard({ source: computed(() => props.code[preferredCodeLanguage.value]) })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VCard>
|
||||
<VCardItem>
|
||||
<VCardTitle>{{ props.title }}</VCardTitle>
|
||||
<template #append>
|
||||
<IconBtn
|
||||
:color="isCodeShown ? 'primary' : 'default'"
|
||||
:class="isCodeShown ? '' : 'text-disabled'"
|
||||
@click="isCodeShown = !isCodeShown"
|
||||
>
|
||||
<VIcon
|
||||
size="20"
|
||||
icon="ri-code-s-line"
|
||||
/>
|
||||
</IconBtn>
|
||||
</template>
|
||||
</VCardItem>
|
||||
<slot v-if="noPadding" />
|
||||
<VCardText v-else>
|
||||
<slot />
|
||||
</VCardText>
|
||||
<VExpandTransition>
|
||||
<div v-show="isCodeShown">
|
||||
<VDivider />
|
||||
|
||||
<VCardText class="d-flex gap-y-3 flex-column">
|
||||
<div class="d-flex justify-end">
|
||||
<VBtnToggle
|
||||
v-model="preferredCodeLanguage"
|
||||
mandatory
|
||||
density="compact"
|
||||
>
|
||||
<VBtn value="ts">
|
||||
<!-- eslint-disable-next-line regex/invalid -->
|
||||
<VIcon icon="mdi-language-typescript" />
|
||||
</VBtn>
|
||||
<VBtn value="js">
|
||||
<!-- eslint-disable-next-line regex/invalid -->
|
||||
<VIcon icon="mdi-language-javascript" />
|
||||
</VBtn>
|
||||
</VBtnToggle>
|
||||
</div>
|
||||
|
||||
<div class="position-relative">
|
||||
<Prism
|
||||
:key="props.code[preferredCodeLanguage]"
|
||||
:language="props.codeLanguage"
|
||||
:style="$vuetify.locale.isRtl ? 'text-align: right' : 'text-align: left'"
|
||||
>
|
||||
{{ props.code[preferredCodeLanguage] }}
|
||||
</Prism>
|
||||
<IconBtn
|
||||
class="position-absolute app-card-code-copy-icon"
|
||||
color="white"
|
||||
@click="() => { copy() }"
|
||||
>
|
||||
<VIcon
|
||||
:icon="copied ? 'ri-check-line' : 'ri-file-copy-line'"
|
||||
size="20"
|
||||
/>
|
||||
</IconBtn>
|
||||
</div>
|
||||
</VCardText>
|
||||
</div>
|
||||
</VExpandTransition>
|
||||
</VCard>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
@use "@styles/variables/vuetify.scss";
|
||||
|
||||
:not(pre) > code[class*="language-"],
|
||||
pre[class*="language-"] {
|
||||
border-radius: vuetify.$card-border-radius;
|
||||
}
|
||||
|
||||
.app-card-code-copy-icon {
|
||||
inset-block-start: 1.2em;
|
||||
inset-inline-end: 0.8em;
|
||||
}
|
||||
</style>
|
@@ -0,0 +1,84 @@
|
||||
<script setup>
|
||||
import { kFormatter } from '@core/utils/formatters'
|
||||
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: 'primary',
|
||||
},
|
||||
icon: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
stats: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
change: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const isPositive = computed(() => Math.sign(props.change) === 1)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VCard
|
||||
variant="text"
|
||||
border
|
||||
>
|
||||
<VCardText class="d-flex align-center">
|
||||
<VAvatar
|
||||
size="40"
|
||||
rounded
|
||||
class="elevation-2 me-4"
|
||||
style="background-color: rgb(var(--v-theme-surface));"
|
||||
>
|
||||
<VIcon
|
||||
:color="props.color"
|
||||
:icon="props.icon"
|
||||
:size="24"
|
||||
/>
|
||||
</VAvatar>
|
||||
|
||||
<div>
|
||||
<div class="text-body-1">
|
||||
{{ props.title }}
|
||||
</div>
|
||||
<div class="d-flex align-center flex-wrap">
|
||||
<h5 class="text-h5">
|
||||
{{ kFormatter(props.stats) }}
|
||||
</h5>
|
||||
|
||||
<div
|
||||
v-if="props.change"
|
||||
:class="`${isPositive ? 'text-success' : 'text-error'} mt-1`"
|
||||
>
|
||||
<VIcon
|
||||
:icon="isPositive ? 'ri-arrow-up-s-line' : 'ri-arrow-down-s-line'"
|
||||
size="24"
|
||||
/>
|
||||
<span class="text-base">
|
||||
{{ Math.abs(props.change) }}%
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.skin--bordered {
|
||||
.v-avatar {
|
||||
border: 1px solid rgba(var(--v-border-color), var(--v-border-opacity)) !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
}
|
||||
</style>
|
@@ -0,0 +1,77 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: 'primary',
|
||||
},
|
||||
icon: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
stats: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
change: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
subtitle: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const isPositive = computed(() => Math.sign(props.change) === 1)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VCard>
|
||||
<VCardText class="d-flex align-center">
|
||||
<VAvatar
|
||||
v-if="props.icon"
|
||||
size="40"
|
||||
:color="props.color"
|
||||
class="elevation-2"
|
||||
>
|
||||
<VIcon
|
||||
:icon="props.icon"
|
||||
size="24"
|
||||
/>
|
||||
</VAvatar>
|
||||
|
||||
<VSpacer />
|
||||
|
||||
<MoreBtn class="me-n3 mt-n1" />
|
||||
</VCardText>
|
||||
|
||||
<VCardText>
|
||||
<h6 class="text-h6 mb-1">
|
||||
{{ props.title }}
|
||||
</h6>
|
||||
|
||||
<div
|
||||
v-if="props.change"
|
||||
class="d-flex align-center mb-1 flex-wrap"
|
||||
>
|
||||
<h4 class="text-h4 me-2">
|
||||
{{ props.stats }}
|
||||
</h4>
|
||||
<div
|
||||
:class="isPositive ? 'text-success' : 'text-error'"
|
||||
class="text-body-1"
|
||||
>
|
||||
{{ isPositive ? `+${props.change}` : props.change }}%
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-body-2">
|
||||
{{ props.subtitle }}
|
||||
</div>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</template>
|
@@ -0,0 +1,65 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
value: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
change: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
desc: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
icon: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
iconColor: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VCard>
|
||||
<VCardText>
|
||||
<div class="d-flex justify-space-between">
|
||||
<div class="d-flex flex-column gap-y-1">
|
||||
<div class="text-body-1 text-high-emphasis">
|
||||
{{ title }}
|
||||
</div>
|
||||
<div>
|
||||
<h5 class="text-h5">
|
||||
{{ value }}
|
||||
<span
|
||||
class="text-base"
|
||||
:class="change > 0 ? 'text-success' : 'text-error'"
|
||||
>({{ prefixWithPlus(change) }}%)</span>
|
||||
</h5>
|
||||
</div>
|
||||
<div class="text-body-2">
|
||||
{{ desc }}
|
||||
</div>
|
||||
</div>
|
||||
<VAvatar
|
||||
:color="iconColor"
|
||||
variant="tonal"
|
||||
rounded
|
||||
size="42"
|
||||
>
|
||||
<VIcon
|
||||
:icon="icon"
|
||||
size="26"
|
||||
/>
|
||||
</VAvatar>
|
||||
</div>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</template>
|
@@ -0,0 +1,89 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
subtitle: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
stats: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
change: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
image: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: 'primary',
|
||||
},
|
||||
})
|
||||
|
||||
const isPositive = computed(() => Math.sign(props.change) === 1)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VCard class="overflow-visible position-relative">
|
||||
<div class="d-flex">
|
||||
<VCardText>
|
||||
<h6 class="text-h6 mb-5">
|
||||
{{ props.title }}
|
||||
</h6>
|
||||
<div class="d-flex align-center flex-wrap mb-3">
|
||||
<h4 class="text-h4 me-2">
|
||||
{{ props.stats }}
|
||||
</h4>
|
||||
<div
|
||||
class="text-body-1"
|
||||
:class="isPositive ? 'text-success' : 'text-error'"
|
||||
>
|
||||
{{ isPositive ? `+${props.change}` : props.change }}%
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<VChip
|
||||
v-if="props.subtitle"
|
||||
:color="props.color"
|
||||
size="small"
|
||||
>
|
||||
{{ props.subtitle }}
|
||||
</VChip>
|
||||
</VCardText>
|
||||
|
||||
<VSpacer />
|
||||
|
||||
<div class="illustrator-img">
|
||||
<VImg
|
||||
v-if="props.image"
|
||||
:src="props.image"
|
||||
:width="110"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</VCard>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.illustrator-img {
|
||||
position: absolute;
|
||||
inset-block-end: 0;
|
||||
inset-inline-end: 5%;
|
||||
}
|
||||
|
||||
@media (max-width: 1200px) and (min-width: 960px) {
|
||||
.illustrator-img {
|
||||
inset-block-end: 0;
|
||||
inset-inline-end: 0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
11
resources/js/@core/composable/createUrl.js
Normal file
11
resources/js/@core/composable/createUrl.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import { stringifyQuery } from 'ufo'
|
||||
|
||||
export const createUrl = (url, options) => computed(() => {
|
||||
if (!options?.query)
|
||||
return toValue(url)
|
||||
const _url = toValue(url)
|
||||
const _query = toValue(options?.query)
|
||||
const queryObj = Object.fromEntries(Object.entries(_query).map(([key, val]) => [key, toValue(val)]))
|
||||
|
||||
return `${_url}${queryObj ? `?${stringifyQuery(queryObj)}` : ''}`
|
||||
})
|
28
resources/js/@core/composable/useCookie.js
Normal file
28
resources/js/@core/composable/useCookie.js
Normal file
@@ -0,0 +1,28 @@
|
||||
// Ported from [Nuxt](https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/app/composables/cookie.ts)
|
||||
import { parse, serialize } from 'cookie-es'
|
||||
import { destr } from 'destr'
|
||||
|
||||
const CookieDefaults = {
|
||||
path: '/',
|
||||
watch: true,
|
||||
decode: val => destr(decodeURIComponent(val)),
|
||||
encode: val => encodeURIComponent(typeof val === 'string' ? val : JSON.stringify(val)),
|
||||
}
|
||||
|
||||
export const useCookie = (name, _opts) => {
|
||||
const opts = { ...CookieDefaults, ..._opts || {} }
|
||||
const cookies = parse(document.cookie, opts)
|
||||
const cookie = ref(cookies[name] ?? opts.default?.())
|
||||
|
||||
watch(cookie, () => {
|
||||
document.cookie = serializeCookie(name, cookie.value, opts)
|
||||
})
|
||||
|
||||
return cookie
|
||||
}
|
||||
function serializeCookie(name, value, opts = {}) {
|
||||
if (value === null || value === undefined)
|
||||
return serialize(name, value, { ...opts, maxAge: -1 })
|
||||
|
||||
return serialize(name, value, opts)
|
||||
}
|
23
resources/js/@core/composable/useGenerateImageVariant.js
Normal file
23
resources/js/@core/composable/useGenerateImageVariant.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import { useTheme } from 'vuetify'
|
||||
import { useConfigStore } from '@core/stores/config'
|
||||
|
||||
// composable function to return the image variant as per the current theme and skin
|
||||
export const useGenerateImageVariant = (imgLight, imgDark, imgLightBordered, imgDarkBordered, bordered = false) => {
|
||||
const configStore = useConfigStore()
|
||||
const { global } = useTheme()
|
||||
|
||||
return computed(() => {
|
||||
if (global.name.value === 'light') {
|
||||
if (configStore.skin === 'bordered' && bordered)
|
||||
return imgLightBordered
|
||||
else
|
||||
return imgLight
|
||||
}
|
||||
if (global.name.value === 'dark') {
|
||||
if (configStore.skin === 'bordered' && bordered)
|
||||
return imgDarkBordered
|
||||
else
|
||||
return imgDark
|
||||
}
|
||||
})
|
||||
}
|
23
resources/js/@core/composable/useResponsiveSidebar.js
Normal file
23
resources/js/@core/composable/useResponsiveSidebar.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import { useDisplay } from 'vuetify'
|
||||
|
||||
export const useResponsiveLeftSidebar = (mobileBreakpoint = undefined) => {
|
||||
const { mdAndDown, name: currentBreakpoint } = useDisplay()
|
||||
const _mobileBreakpoint = mobileBreakpoint || mdAndDown
|
||||
const isLeftSidebarOpen = ref(true)
|
||||
|
||||
const setInitialValue = () => {
|
||||
isLeftSidebarOpen.value = !_mobileBreakpoint.value
|
||||
}
|
||||
|
||||
|
||||
// Set the initial value of sidebar
|
||||
setInitialValue()
|
||||
watch(currentBreakpoint, () => {
|
||||
// Reset left sidebar
|
||||
isLeftSidebarOpen.value = !_mobileBreakpoint.value
|
||||
})
|
||||
|
||||
return {
|
||||
isLeftSidebarOpen,
|
||||
}
|
||||
}
|
37
resources/js/@core/composable/useSkins.js
Normal file
37
resources/js/@core/composable/useSkins.js
Normal file
@@ -0,0 +1,37 @@
|
||||
import { VThemeProvider } from 'vuetify/components/VThemeProvider'
|
||||
import { useConfigStore } from '@core/stores/config'
|
||||
import { AppContentLayoutNav } from '@layouts/enums'
|
||||
|
||||
// TODO: Use `VThemeProvider` from dist instead of lib (Using this component from dist causes navbar to loose sticky positioning)
|
||||
export const useSkins = () => {
|
||||
const configStore = useConfigStore()
|
||||
|
||||
const layoutAttrs = computed(() => ({
|
||||
verticalNavAttrs: {
|
||||
wrapper: h(VThemeProvider, { tag: 'aside' }),
|
||||
wrapperProps: {
|
||||
withBackground: true,
|
||||
theme: (configStore.isVerticalNavSemiDark && configStore.appContentLayoutNav === AppContentLayoutNav.Vertical)
|
||||
? 'dark'
|
||||
: undefined,
|
||||
},
|
||||
},
|
||||
}))
|
||||
|
||||
const injectSkinClasses = () => {
|
||||
if (typeof document !== 'undefined') {
|
||||
const bodyClasses = document.body.classList
|
||||
const genSkinClass = _skin => `skin--${_skin}`
|
||||
|
||||
watch(() => configStore.skin, (val, oldVal) => {
|
||||
bodyClasses.remove(genSkinClass(oldVal))
|
||||
bodyClasses.add(genSkinClass(val))
|
||||
}, { immediate: true })
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
injectSkinClasses,
|
||||
layoutAttrs,
|
||||
}
|
||||
}
|
18
resources/js/@core/enums.js
Normal file
18
resources/js/@core/enums.js
Normal file
@@ -0,0 +1,18 @@
|
||||
export const Skins = {
|
||||
Default: 'default',
|
||||
Bordered: 'bordered',
|
||||
}
|
||||
export const Theme = {
|
||||
Light: 'light',
|
||||
Dark: 'dark',
|
||||
System: 'system',
|
||||
}
|
||||
export const Layout = {
|
||||
Vertical: 'vertical',
|
||||
Horizontal: 'horizontal',
|
||||
Collapsed: 'collapsed',
|
||||
}
|
||||
export const Direction = {
|
||||
Ltr: 'ltr',
|
||||
Rtl: 'rtl',
|
||||
}
|
40
resources/js/@core/index.js
Normal file
40
resources/js/@core/index.js
Normal file
@@ -0,0 +1,40 @@
|
||||
export const defineThemeConfig = userConfig => {
|
||||
return {
|
||||
themeConfig: userConfig,
|
||||
layoutConfig: {
|
||||
app: {
|
||||
title: userConfig.app.title,
|
||||
logo: userConfig.app.logo,
|
||||
contentWidth: userConfig.app.contentWidth,
|
||||
contentLayoutNav: userConfig.app.contentLayoutNav,
|
||||
overlayNavFromBreakpoint: userConfig.app.overlayNavFromBreakpoint,
|
||||
i18n: {
|
||||
enable: userConfig.app.i18n.enable,
|
||||
},
|
||||
iconRenderer: userConfig.app.iconRenderer,
|
||||
},
|
||||
navbar: {
|
||||
type: userConfig.navbar.type,
|
||||
navbarBlur: userConfig.navbar.navbarBlur,
|
||||
},
|
||||
footer: { type: userConfig.footer.type },
|
||||
verticalNav: {
|
||||
isVerticalNavCollapsed: userConfig.verticalNav.isVerticalNavCollapsed,
|
||||
defaultNavItemIconProps: userConfig.verticalNav.defaultNavItemIconProps,
|
||||
},
|
||||
horizontalNav: {
|
||||
type: userConfig.horizontalNav.type,
|
||||
transition: userConfig.horizontalNav.transition,
|
||||
popoverOffset: userConfig.horizontalNav.popoverOffset,
|
||||
},
|
||||
icons: {
|
||||
chevronDown: userConfig.icons.chevronDown,
|
||||
chevronRight: userConfig.icons.chevronRight,
|
||||
close: userConfig.icons.close,
|
||||
verticalNavPinned: userConfig.icons.verticalNavPinned,
|
||||
verticalNavUnPinned: userConfig.icons.verticalNavUnPinned,
|
||||
sectionTitlePlaceholder: userConfig.icons.sectionTitlePlaceholder,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
81
resources/js/@core/initCore.js
Normal file
81
resources/js/@core/initCore.js
Normal file
@@ -0,0 +1,81 @@
|
||||
import { useStorage } from '@vueuse/core'
|
||||
import { useTheme } from 'vuetify'
|
||||
import { useConfigStore } from '@core/stores/config'
|
||||
import { cookieRef, namespaceConfig } from '@layouts/stores/config'
|
||||
import { themeConfig } from '@themeConfig'
|
||||
|
||||
const _syncAppRtl = () => {
|
||||
const configStore = useConfigStore()
|
||||
const storedLang = cookieRef('language', null)
|
||||
const { locale } = useI18n({ useScope: 'global' })
|
||||
|
||||
// TODO: Handle case where i18n can't read persisted value
|
||||
if (locale.value !== storedLang.value && storedLang.value)
|
||||
locale.value = storedLang.value
|
||||
|
||||
// watch and change lang attribute of html on language change
|
||||
watch(locale, val => {
|
||||
// Update lang attribute of html tag
|
||||
if (typeof document !== 'undefined')
|
||||
document.documentElement.setAttribute('lang', val)
|
||||
|
||||
// Store selected language in cookie
|
||||
storedLang.value = val
|
||||
|
||||
// set isAppRtl value based on selected language
|
||||
if (themeConfig.app.i18n.langConfig && themeConfig.app.i18n.langConfig.length) {
|
||||
themeConfig.app.i18n.langConfig.forEach(lang => {
|
||||
if (lang.i18nLang === storedLang.value)
|
||||
configStore.isAppRTL = lang.isRTL
|
||||
})
|
||||
}
|
||||
}, { immediate: true })
|
||||
}
|
||||
|
||||
const _handleSkinChanges = () => {
|
||||
const { themes } = useTheme()
|
||||
const configStore = useConfigStore()
|
||||
|
||||
|
||||
// Create skin default color so that we can revert back to original (default skin) color when switch to default skin from bordered skin
|
||||
Object.values(themes.value).forEach(t => {
|
||||
t.colors['skin-default-background'] = t.colors.background
|
||||
t.colors['skin-default-surface'] = t.colors.surface
|
||||
})
|
||||
watch(() => configStore.skin, val => {
|
||||
Object.values(themes.value).forEach(t => {
|
||||
t.colors.background = t.colors[`skin-${val}-background`]
|
||||
t.colors.surface = t.colors[`skin-${val}-surface`]
|
||||
})
|
||||
}, { immediate: true })
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
ℹ️ Set current theme's surface color in localStorage
|
||||
|
||||
Why? Because when initial loader is shown (before vue is ready) we need to what's the current theme's surface color.
|
||||
We will use color stored in localStorage to set the initial loader's background color.
|
||||
|
||||
With this we will be able to show correct background color for the initial loader even before vue identify the current theme.
|
||||
*/
|
||||
const _syncInitialLoaderTheme = () => {
|
||||
const vuetifyTheme = useTheme()
|
||||
|
||||
watch(() => useConfigStore().theme, () => {
|
||||
// ℹ️ We are not using theme.current.colors.surface because watcher is independent and when this watcher is ran `theme` computed is not updated
|
||||
useStorage(namespaceConfig('initial-loader-bg'), null).value = vuetifyTheme.current.value.colors.surface
|
||||
useStorage(namespaceConfig('initial-loader-color'), null).value = vuetifyTheme.current.value.colors.primary
|
||||
}, { immediate: true })
|
||||
}
|
||||
|
||||
const initCore = () => {
|
||||
_syncInitialLoaderTheme()
|
||||
_handleSkinChanges()
|
||||
|
||||
// ℹ️ We don't want to trigger i18n in SK
|
||||
if (themeConfig.app.i18n.enable)
|
||||
_syncAppRtl()
|
||||
}
|
||||
|
||||
export default initCore
|
666
resources/js/@core/libs/apex-chart/apexCharConfig.js
Normal file
666
resources/js/@core/libs/apex-chart/apexCharConfig.js
Normal file
@@ -0,0 +1,666 @@
|
||||
import store from '@/store';
|
||||
import { hexToRgb } from '@layouts/utils';
|
||||
|
||||
|
||||
// 👉 Colors variables
|
||||
const colorVariables = themeColors => {
|
||||
const themeSecondaryTextColor = `rgba(${hexToRgb(themeColors.colors['on-surface'])},${themeColors.variables['medium-emphasis-opacity']})`
|
||||
const themeDisabledTextColor = `rgba(${hexToRgb(themeColors.colors['on-surface'])},${themeColors.variables['disabled-opacity']})`
|
||||
const themeBorderColor = `rgba(${hexToRgb(String(themeColors.variables['border-color']))},${themeColors.variables['border-opacity']})`
|
||||
const themePrimaryTextColor = `rgba(${hexToRgb(themeColors.colors['on-surface'])},${themeColors.variables['high-emphasis-opacity']})`
|
||||
|
||||
return { themeSecondaryTextColor, themeDisabledTextColor, themeBorderColor, themePrimaryTextColor }
|
||||
}
|
||||
|
||||
export const getScatterChartConfig = themeColors => {
|
||||
const scatterColors = {
|
||||
series1: '#ff9f43',
|
||||
series2: '#7367f0',
|
||||
series3: '#28c76f',
|
||||
}
|
||||
|
||||
const { themeSecondaryTextColor, themeBorderColor, themeDisabledTextColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
chart: {
|
||||
parentHeightOffset: 0,
|
||||
toolbar: { show: false },
|
||||
zoom: {
|
||||
type: 'xy',
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
position: 'top',
|
||||
horizontalAlign: 'left',
|
||||
markers: { offsetX: -3 },
|
||||
labels: { colors: themeSecondaryTextColor },
|
||||
itemMargin: {
|
||||
vertical: 3,
|
||||
horizontal: 10,
|
||||
},
|
||||
},
|
||||
colors: [scatterColors.series1, scatterColors.series2, scatterColors.series3],
|
||||
grid: {
|
||||
borderColor: themeBorderColor,
|
||||
xaxis: {
|
||||
lines: { show: true },
|
||||
},
|
||||
},
|
||||
yaxis: {
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
},
|
||||
},
|
||||
xaxis: {
|
||||
tickAmount: 10,
|
||||
axisBorder: { show: false },
|
||||
axisTicks: { color: themeBorderColor },
|
||||
crosshairs: {
|
||||
stroke: { color: themeBorderColor },
|
||||
},
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
formatter: val => Number.parseFloat(val).toFixed(1),
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
export const getLineChartSimpleConfig = themeColors => {
|
||||
console.log("apxchar",store.getters.getOverviewChartDate);
|
||||
const { themeBorderColor, themeDisabledTextColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
chart: {
|
||||
parentHeightOffset: 0,
|
||||
zoom: { enabled: false },
|
||||
toolbar: { show: false },
|
||||
},
|
||||
colors: ['#ff9f43'],
|
||||
stroke: { curve: 'straight' },
|
||||
dataLabels: { enabled: false },
|
||||
markers: {
|
||||
strokeWidth: 7,
|
||||
strokeOpacity: 1,
|
||||
colors: ['#ff9f43'],
|
||||
strokeColors: ['#fff'],
|
||||
},
|
||||
grid: {
|
||||
padding: { top: -10 },
|
||||
borderColor: themeBorderColor,
|
||||
xaxis: {
|
||||
lines: { show: true },
|
||||
},
|
||||
},
|
||||
tooltip: {
|
||||
custom(data) {
|
||||
return `<div class='bar-chart pa-2'>
|
||||
<span>$${data.series[data.seriesIndex][data.dataPointIndex]}</span>
|
||||
</div>`
|
||||
},
|
||||
},
|
||||
yaxis: {
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
},
|
||||
},
|
||||
xaxis: {
|
||||
axisBorder: { show: false },
|
||||
axisTicks: { color: themeBorderColor },
|
||||
crosshairs: {
|
||||
stroke: { color: themeBorderColor },
|
||||
},
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
},
|
||||
categories:store.getters.getAnalyticsOverview.chart.chart_dates,
|
||||
},
|
||||
}
|
||||
}
|
||||
export const getBarChartConfig = themeColors => {
|
||||
const { themeBorderColor, themeDisabledTextColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
chart: {
|
||||
parentHeightOffset: 0,
|
||||
toolbar: { show: false },
|
||||
},
|
||||
colors: ['#00cfe8'],
|
||||
dataLabels: { enabled: false },
|
||||
plotOptions: {
|
||||
bar: {
|
||||
borderRadius: 8,
|
||||
barHeight: '30%',
|
||||
horizontal: true,
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
borderColor: themeBorderColor,
|
||||
xaxis: {
|
||||
lines: { show: false },
|
||||
},
|
||||
padding: {
|
||||
top: -10,
|
||||
},
|
||||
},
|
||||
yaxis: {
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
},
|
||||
},
|
||||
xaxis: {
|
||||
axisBorder: { show: false },
|
||||
axisTicks: { color: themeBorderColor },
|
||||
categories: ['MON, 11', 'THU, 14', 'FRI, 15', 'MON, 18', 'WED, 20', 'FRI, 21', 'MON, 23'],
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
export const getCandlestickChartConfig = themeColors => {
|
||||
const candlestickColors = {
|
||||
series1: '#28c76f',
|
||||
series2: '#ea5455',
|
||||
}
|
||||
|
||||
const { themeBorderColor, themeDisabledTextColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
chart: {
|
||||
parentHeightOffset: 0,
|
||||
toolbar: { show: false },
|
||||
},
|
||||
plotOptions: {
|
||||
bar: { columnWidth: '40%' },
|
||||
candlestick: {
|
||||
colors: {
|
||||
upward: candlestickColors.series1,
|
||||
downward: candlestickColors.series2,
|
||||
},
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
padding: { top: -10 },
|
||||
borderColor: themeBorderColor,
|
||||
xaxis: {
|
||||
lines: { show: true },
|
||||
},
|
||||
},
|
||||
yaxis: {
|
||||
tooltip: { enabled: true },
|
||||
crosshairs: {
|
||||
stroke: { color: themeBorderColor },
|
||||
},
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
},
|
||||
},
|
||||
xaxis: {
|
||||
type: 'datetime',
|
||||
axisBorder: { show: false },
|
||||
axisTicks: { color: themeBorderColor },
|
||||
crosshairs: {
|
||||
stroke: { color: themeBorderColor },
|
||||
},
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
export const getRadialBarChartConfig = themeColors => {
|
||||
const radialBarColors = {
|
||||
series1: '#fdd835',
|
||||
series2: '#32baff',
|
||||
series3: '#00d4bd',
|
||||
series4: '#7367f0',
|
||||
series5: '#FFA1A1',
|
||||
}
|
||||
|
||||
const { themeSecondaryTextColor, themePrimaryTextColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
stroke: { lineCap: 'round' },
|
||||
labels: ['Comments', 'Replies', 'Shares'],
|
||||
legend: {
|
||||
show: true,
|
||||
position: 'bottom',
|
||||
labels: {
|
||||
colors: themeSecondaryTextColor,
|
||||
},
|
||||
markers: {
|
||||
offsetX: -3,
|
||||
},
|
||||
itemMargin: {
|
||||
vertical: 3,
|
||||
horizontal: 10,
|
||||
},
|
||||
},
|
||||
colors: [radialBarColors.series1, radialBarColors.series2, radialBarColors.series4],
|
||||
plotOptions: {
|
||||
radialBar: {
|
||||
hollow: { size: '30%' },
|
||||
track: {
|
||||
margin: 15,
|
||||
background: themeColors.colors['grey-100'],
|
||||
},
|
||||
dataLabels: {
|
||||
name: {
|
||||
fontSize: '2rem',
|
||||
},
|
||||
value: {
|
||||
fontSize: '1rem',
|
||||
color: themeSecondaryTextColor,
|
||||
},
|
||||
total: {
|
||||
show: true,
|
||||
fontWeight: 400,
|
||||
label: 'Comments',
|
||||
fontSize: '1.125rem',
|
||||
color: themePrimaryTextColor,
|
||||
formatter(w) {
|
||||
const totalValue = w.globals.seriesTotals.reduce((a, b) => {
|
||||
return a + b
|
||||
}, 0) / w.globals.series.length
|
||||
|
||||
if (totalValue % 1 === 0)
|
||||
return `${totalValue}%`
|
||||
else
|
||||
return `${totalValue.toFixed(2)}%`
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
padding: {
|
||||
top: -30,
|
||||
bottom: -25,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
export const getDonutChartConfig = themeColors => {
|
||||
const donutColors = {
|
||||
series1: '#fdd835',
|
||||
series2: '#00d4bd',
|
||||
series3: '#826bf8',
|
||||
series4: '#32baff',
|
||||
series5: '#ffa1a1',
|
||||
}
|
||||
|
||||
const { themeSecondaryTextColor, themePrimaryTextColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
stroke: { width: 0 },
|
||||
labels: ['Operational', 'Networking', 'Hiring', 'R&D'],
|
||||
colors: [donutColors.series1, donutColors.series5, donutColors.series3, donutColors.series2],
|
||||
dataLabels: {
|
||||
enabled: true,
|
||||
formatter: val => `${Number.parseInt(val, 10)}%`,
|
||||
},
|
||||
legend: {
|
||||
position: 'bottom',
|
||||
markers: { offsetX: -3 },
|
||||
labels: { colors: themeSecondaryTextColor },
|
||||
itemMargin: {
|
||||
vertical: 3,
|
||||
horizontal: 10,
|
||||
},
|
||||
},
|
||||
plotOptions: {
|
||||
pie: {
|
||||
donut: {
|
||||
labels: {
|
||||
show: true,
|
||||
name: {
|
||||
fontSize: '1.5rem',
|
||||
},
|
||||
value: {
|
||||
fontSize: '1.5rem',
|
||||
color: themeSecondaryTextColor,
|
||||
formatter: val => `${Number.parseInt(val, 10)}`,
|
||||
},
|
||||
total: {
|
||||
show: true,
|
||||
fontSize: '1.5rem',
|
||||
label: 'Operational',
|
||||
formatter: () => '31%',
|
||||
color: themePrimaryTextColor,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
responsive: [
|
||||
{
|
||||
breakpoint: 992,
|
||||
options: {
|
||||
chart: {
|
||||
height: 380,
|
||||
},
|
||||
legend: {
|
||||
position: 'bottom',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
breakpoint: 576,
|
||||
options: {
|
||||
chart: {
|
||||
height: 320,
|
||||
},
|
||||
plotOptions: {
|
||||
pie: {
|
||||
donut: {
|
||||
labels: {
|
||||
show: true,
|
||||
name: {
|
||||
fontSize: '1rem',
|
||||
},
|
||||
value: {
|
||||
fontSize: '1rem',
|
||||
},
|
||||
total: {
|
||||
fontSize: '1rem',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
export const getAreaChartSplineConfig = themeColors => {
|
||||
const areaColors = {
|
||||
series3: '#e0cffe',
|
||||
series2: '#b992fe',
|
||||
series1: '#ab7efd',
|
||||
}
|
||||
|
||||
const { themeSecondaryTextColor, themeBorderColor, themeDisabledTextColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
chart: {
|
||||
parentHeightOffset: 0,
|
||||
toolbar: { show: false },
|
||||
},
|
||||
tooltip: { shared: false },
|
||||
dataLabels: { enabled: false },
|
||||
stroke: {
|
||||
show: false,
|
||||
curve: 'straight',
|
||||
},
|
||||
legend: {
|
||||
position: 'top',
|
||||
horizontalAlign: 'left',
|
||||
labels: { colors: themeSecondaryTextColor },
|
||||
markers: {
|
||||
offsetY: 1,
|
||||
offsetX: -3,
|
||||
},
|
||||
itemMargin: {
|
||||
vertical: 3,
|
||||
horizontal: 10,
|
||||
},
|
||||
},
|
||||
colors: [areaColors.series3, areaColors.series2, areaColors.series1],
|
||||
fill: {
|
||||
opacity: 1,
|
||||
type: 'solid',
|
||||
},
|
||||
grid: {
|
||||
show: true,
|
||||
borderColor: themeBorderColor,
|
||||
xaxis: {
|
||||
lines: { show: true },
|
||||
},
|
||||
},
|
||||
yaxis: {
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
},
|
||||
},
|
||||
xaxis: {
|
||||
axisBorder: { show: false },
|
||||
axisTicks: { color: themeBorderColor },
|
||||
crosshairs: {
|
||||
stroke: { color: themeBorderColor },
|
||||
},
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
},
|
||||
categories: [
|
||||
'7/12',
|
||||
'8/12',
|
||||
'9/12',
|
||||
'10/12',
|
||||
'11/12',
|
||||
'12/12',
|
||||
'13/12',
|
||||
'14/12',
|
||||
'15/12',
|
||||
'16/12',
|
||||
'17/12',
|
||||
'18/12',
|
||||
'19/12',
|
||||
],
|
||||
},
|
||||
}
|
||||
}
|
||||
export const getColumnChartConfig = themeColors => {
|
||||
const columnColors = {
|
||||
series1: '#826af9',
|
||||
series2: '#d2b0ff',
|
||||
bg: '#f8d3ff',
|
||||
}
|
||||
|
||||
const { themeSecondaryTextColor, themeBorderColor, themeDisabledTextColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
chart: {
|
||||
offsetX: -10,
|
||||
stacked: true,
|
||||
parentHeightOffset: 0,
|
||||
toolbar: { show: false },
|
||||
},
|
||||
fill: { opacity: 1 },
|
||||
dataLabels: { enabled: false },
|
||||
colors: [columnColors.series1, columnColors.series2],
|
||||
legend: {
|
||||
position: 'top',
|
||||
horizontalAlign: 'left',
|
||||
labels: { colors: themeSecondaryTextColor },
|
||||
markers: {
|
||||
offsetY: 1,
|
||||
offsetX: -3,
|
||||
},
|
||||
itemMargin: {
|
||||
vertical: 3,
|
||||
horizontal: 10,
|
||||
},
|
||||
},
|
||||
stroke: {
|
||||
show: true,
|
||||
colors: ['transparent'],
|
||||
},
|
||||
plotOptions: {
|
||||
bar: {
|
||||
columnWidth: '15%',
|
||||
colors: {
|
||||
backgroundBarRadius: 10,
|
||||
backgroundBarColors: [columnColors.bg, columnColors.bg, columnColors.bg, columnColors.bg, columnColors.bg],
|
||||
},
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
borderColor: themeBorderColor,
|
||||
xaxis: {
|
||||
lines: { show: true },
|
||||
},
|
||||
},
|
||||
yaxis: {
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
},
|
||||
},
|
||||
xaxis: {
|
||||
axisBorder: { show: false },
|
||||
axisTicks: { color: themeBorderColor },
|
||||
categories: ['7/12', '8/12', '9/12', '10/12', '11/12', '12/12', '13/12', '14/12', '15/12'],
|
||||
crosshairs: {
|
||||
stroke: { color: themeBorderColor },
|
||||
},
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
},
|
||||
},
|
||||
responsive: [
|
||||
{
|
||||
breakpoint: 600,
|
||||
options: {
|
||||
plotOptions: {
|
||||
bar: {
|
||||
columnWidth: '35%',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
export const getHeatMapChartConfig = themeColors => {
|
||||
const { themeSecondaryTextColor, themeDisabledTextColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
chart: {
|
||||
parentHeightOffset: 0,
|
||||
toolbar: { show: false },
|
||||
},
|
||||
dataLabels: { enabled: false },
|
||||
stroke: {
|
||||
colors: [themeColors.colors.surface],
|
||||
},
|
||||
legend: {
|
||||
position: 'bottom',
|
||||
labels: {
|
||||
colors: themeSecondaryTextColor,
|
||||
},
|
||||
markers: {
|
||||
offsetY: 0,
|
||||
offsetX: -3,
|
||||
},
|
||||
itemMargin: {
|
||||
vertical: 3,
|
||||
horizontal: 10,
|
||||
},
|
||||
},
|
||||
plotOptions: {
|
||||
heatmap: {
|
||||
enableShades: false,
|
||||
colorScale: {
|
||||
ranges: [
|
||||
{ to: 10, from: 0, name: '0-10', color: '#b9b3f8' },
|
||||
{ to: 20, from: 11, name: '10-20', color: '#aba4f6' },
|
||||
{ to: 30, from: 21, name: '20-30', color: '#9d95f5' },
|
||||
{ to: 40, from: 31, name: '30-40', color: '#8f85f3' },
|
||||
{ to: 50, from: 41, name: '40-50', color: '#8176f2' },
|
||||
{ to: 60, from: 51, name: '50-60', color: '#7367f0' },
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
padding: { top: -20 },
|
||||
},
|
||||
yaxis: {
|
||||
labels: {
|
||||
style: {
|
||||
colors: themeDisabledTextColor,
|
||||
},
|
||||
},
|
||||
},
|
||||
xaxis: {
|
||||
labels: { show: false },
|
||||
axisTicks: { show: false },
|
||||
axisBorder: { show: false },
|
||||
},
|
||||
}
|
||||
}
|
||||
export const getRadarChartConfig = themeColors => {
|
||||
const radarColors = {
|
||||
series1: '#9b88fa',
|
||||
series2: '#ffa1a1',
|
||||
}
|
||||
|
||||
const { themeSecondaryTextColor, themeBorderColor, themeDisabledTextColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
chart: {
|
||||
parentHeightOffset: 0,
|
||||
toolbar: { show: false },
|
||||
dropShadow: {
|
||||
top: 1,
|
||||
blur: 8,
|
||||
left: 1,
|
||||
opacity: 0.2,
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
markers: { size: 0 },
|
||||
fill: { opacity: [1, 0.8] },
|
||||
colors: [radarColors.series1, radarColors.series2],
|
||||
stroke: {
|
||||
width: 0,
|
||||
show: false,
|
||||
},
|
||||
legend: {
|
||||
labels: {
|
||||
colors: themeSecondaryTextColor,
|
||||
},
|
||||
markers: {
|
||||
offsetX: -3,
|
||||
},
|
||||
itemMargin: {
|
||||
vertical: 3,
|
||||
horizontal: 10,
|
||||
},
|
||||
},
|
||||
plotOptions: {
|
||||
radar: {
|
||||
polygons: {
|
||||
strokeColors: themeBorderColor,
|
||||
connectorColors: themeBorderColor,
|
||||
},
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
show: false,
|
||||
padding: {
|
||||
top: -20,
|
||||
bottom: -20,
|
||||
},
|
||||
},
|
||||
yaxis: { show: false },
|
||||
xaxis: {
|
||||
categories: ['Battery', 'Brand', 'Camera', 'Memory', 'Storage', 'Display', 'OS', 'Price'],
|
||||
labels: {
|
||||
style: {
|
||||
colors: [
|
||||
themeDisabledTextColor,
|
||||
themeDisabledTextColor,
|
||||
themeDisabledTextColor,
|
||||
themeDisabledTextColor,
|
||||
themeDisabledTextColor,
|
||||
themeDisabledTextColor,
|
||||
themeDisabledTextColor,
|
||||
themeDisabledTextColor,
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
666
resources/js/@core/libs/apex-chart/apexCharOrderConfig.js
Normal file
666
resources/js/@core/libs/apex-chart/apexCharOrderConfig.js
Normal file
@@ -0,0 +1,666 @@
|
||||
import store from '@/store';
|
||||
import { hexToRgb } from '@layouts/utils';
|
||||
|
||||
|
||||
// 👉 Colors variables
|
||||
const colorVariables = themeColors => {
|
||||
const themeSecondaryTextColor = `rgba(${hexToRgb(themeColors.colors['on-surface'])},${themeColors.variables['medium-emphasis-opacity']})`
|
||||
const themeDisabledTextColor = `rgba(${hexToRgb(themeColors.colors['on-surface'])},${themeColors.variables['disabled-opacity']})`
|
||||
const themeBorderColor = `rgba(${hexToRgb(String(themeColors.variables['border-color']))},${themeColors.variables['border-opacity']})`
|
||||
const themePrimaryTextColor = `rgba(${hexToRgb(themeColors.colors['on-surface'])},${themeColors.variables['high-emphasis-opacity']})`
|
||||
|
||||
return { themeSecondaryTextColor, themeDisabledTextColor, themeBorderColor, themePrimaryTextColor }
|
||||
}
|
||||
|
||||
export const getScatterChartConfig = themeColors => {
|
||||
const scatterColors = {
|
||||
series1: '#ff9f43',
|
||||
series2: '#7367f0',
|
||||
series3: '#28c76f',
|
||||
}
|
||||
|
||||
const { themeSecondaryTextColor, themeBorderColor, themeDisabledTextColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
chart: {
|
||||
parentHeightOffset: 0,
|
||||
toolbar: { show: false },
|
||||
zoom: {
|
||||
type: 'xy',
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
position: 'top',
|
||||
horizontalAlign: 'left',
|
||||
markers: { offsetX: -3 },
|
||||
labels: { colors: themeSecondaryTextColor },
|
||||
itemMargin: {
|
||||
vertical: 3,
|
||||
horizontal: 10,
|
||||
},
|
||||
},
|
||||
colors: [scatterColors.series1, scatterColors.series2, scatterColors.series3],
|
||||
grid: {
|
||||
borderColor: themeBorderColor,
|
||||
xaxis: {
|
||||
lines: { show: true },
|
||||
},
|
||||
},
|
||||
yaxis: {
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
},
|
||||
},
|
||||
xaxis: {
|
||||
tickAmount: 10,
|
||||
axisBorder: { show: false },
|
||||
axisTicks: { color: themeBorderColor },
|
||||
crosshairs: {
|
||||
stroke: { color: themeBorderColor },
|
||||
},
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
formatter: val => Number.parseFloat(val).toFixed(1),
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
export const getLineChartSimpleOrderConfig = themeColors => {
|
||||
console.log("apxchar",store.getters.getOverviewOrderChartDate);
|
||||
const { themeBorderColor, themeDisabledTextColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
chart: {
|
||||
parentHeightOffset: 0,
|
||||
zoom: { enabled: false },
|
||||
toolbar: { show: false },
|
||||
},
|
||||
colors: ['#ff9f43'],
|
||||
stroke: { curve: 'straight' },
|
||||
dataLabels: { enabled: false },
|
||||
markers: {
|
||||
strokeWidth: 7,
|
||||
strokeOpacity: 1,
|
||||
colors: ['#ff9f43'],
|
||||
strokeColors: ['#fff'],
|
||||
},
|
||||
grid: {
|
||||
padding: { top: -10 },
|
||||
borderColor: themeBorderColor,
|
||||
xaxis: {
|
||||
lines: { show: true },
|
||||
},
|
||||
},
|
||||
tooltip: {
|
||||
custom(data) {
|
||||
return `<div class='bar-chart pa-2'>
|
||||
<span>$${data.series[data.seriesIndex][data.dataPointIndex]}</span>
|
||||
</div>`
|
||||
},
|
||||
},
|
||||
yaxis: {
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
},
|
||||
},
|
||||
xaxis: {
|
||||
axisBorder: { show: false },
|
||||
axisTicks: { color: themeBorderColor },
|
||||
crosshairs: {
|
||||
stroke: { color: themeBorderColor },
|
||||
},
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
},
|
||||
categories:store.getters.getOverviewOrderChartDate,
|
||||
},
|
||||
}
|
||||
}
|
||||
export const getBarChartConfig = themeColors => {
|
||||
const { themeBorderColor, themeDisabledTextColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
chart: {
|
||||
parentHeightOffset: 0,
|
||||
toolbar: { show: false },
|
||||
},
|
||||
colors: ['#00cfe8'],
|
||||
dataLabels: { enabled: false },
|
||||
plotOptions: {
|
||||
bar: {
|
||||
borderRadius: 8,
|
||||
barHeight: '30%',
|
||||
horizontal: true,
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
borderColor: themeBorderColor,
|
||||
xaxis: {
|
||||
lines: { show: false },
|
||||
},
|
||||
padding: {
|
||||
top: -10,
|
||||
},
|
||||
},
|
||||
yaxis: {
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
},
|
||||
},
|
||||
xaxis: {
|
||||
axisBorder: { show: false },
|
||||
axisTicks: { color: themeBorderColor },
|
||||
categories: ['MON, 11', 'THU, 14', 'FRI, 15', 'MON, 18', 'WED, 20', 'FRI, 21', 'MON, 23'],
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
export const getCandlestickChartConfig = themeColors => {
|
||||
const candlestickColors = {
|
||||
series1: '#28c76f',
|
||||
series2: '#ea5455',
|
||||
}
|
||||
|
||||
const { themeBorderColor, themeDisabledTextColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
chart: {
|
||||
parentHeightOffset: 0,
|
||||
toolbar: { show: false },
|
||||
},
|
||||
plotOptions: {
|
||||
bar: { columnWidth: '40%' },
|
||||
candlestick: {
|
||||
colors: {
|
||||
upward: candlestickColors.series1,
|
||||
downward: candlestickColors.series2,
|
||||
},
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
padding: { top: -10 },
|
||||
borderColor: themeBorderColor,
|
||||
xaxis: {
|
||||
lines: { show: true },
|
||||
},
|
||||
},
|
||||
yaxis: {
|
||||
tooltip: { enabled: true },
|
||||
crosshairs: {
|
||||
stroke: { color: themeBorderColor },
|
||||
},
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
},
|
||||
},
|
||||
xaxis: {
|
||||
type: 'datetime',
|
||||
axisBorder: { show: false },
|
||||
axisTicks: { color: themeBorderColor },
|
||||
crosshairs: {
|
||||
stroke: { color: themeBorderColor },
|
||||
},
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
export const getRadialBarChartConfig = themeColors => {
|
||||
const radialBarColors = {
|
||||
series1: '#fdd835',
|
||||
series2: '#32baff',
|
||||
series3: '#00d4bd',
|
||||
series4: '#7367f0',
|
||||
series5: '#FFA1A1',
|
||||
}
|
||||
|
||||
const { themeSecondaryTextColor, themePrimaryTextColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
stroke: { lineCap: 'round' },
|
||||
labels: ['Comments', 'Replies', 'Shares'],
|
||||
legend: {
|
||||
show: true,
|
||||
position: 'bottom',
|
||||
labels: {
|
||||
colors: themeSecondaryTextColor,
|
||||
},
|
||||
markers: {
|
||||
offsetX: -3,
|
||||
},
|
||||
itemMargin: {
|
||||
vertical: 3,
|
||||
horizontal: 10,
|
||||
},
|
||||
},
|
||||
colors: [radialBarColors.series1, radialBarColors.series2, radialBarColors.series4],
|
||||
plotOptions: {
|
||||
radialBar: {
|
||||
hollow: { size: '30%' },
|
||||
track: {
|
||||
margin: 15,
|
||||
background: themeColors.colors['grey-100'],
|
||||
},
|
||||
dataLabels: {
|
||||
name: {
|
||||
fontSize: '2rem',
|
||||
},
|
||||
value: {
|
||||
fontSize: '1rem',
|
||||
color: themeSecondaryTextColor,
|
||||
},
|
||||
total: {
|
||||
show: true,
|
||||
fontWeight: 400,
|
||||
label: 'Comments',
|
||||
fontSize: '1.125rem',
|
||||
color: themePrimaryTextColor,
|
||||
formatter(w) {
|
||||
const totalValue = w.globals.seriesTotals.reduce((a, b) => {
|
||||
return a + b
|
||||
}, 0) / w.globals.series.length
|
||||
|
||||
if (totalValue % 1 === 0)
|
||||
return `${totalValue}%`
|
||||
else
|
||||
return `${totalValue.toFixed(2)}%`
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
padding: {
|
||||
top: -30,
|
||||
bottom: -25,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
export const getDonutChartConfig = themeColors => {
|
||||
const donutColors = {
|
||||
series1: '#fdd835',
|
||||
series2: '#00d4bd',
|
||||
series3: '#826bf8',
|
||||
series4: '#32baff',
|
||||
series5: '#ffa1a1',
|
||||
}
|
||||
|
||||
const { themeSecondaryTextColor, themePrimaryTextColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
stroke: { width: 0 },
|
||||
labels: ['Operational', 'Networking', 'Hiring', 'R&D'],
|
||||
colors: [donutColors.series1, donutColors.series5, donutColors.series3, donutColors.series2],
|
||||
dataLabels: {
|
||||
enabled: true,
|
||||
formatter: val => `${Number.parseInt(val, 10)}%`,
|
||||
},
|
||||
legend: {
|
||||
position: 'bottom',
|
||||
markers: { offsetX: -3 },
|
||||
labels: { colors: themeSecondaryTextColor },
|
||||
itemMargin: {
|
||||
vertical: 3,
|
||||
horizontal: 10,
|
||||
},
|
||||
},
|
||||
plotOptions: {
|
||||
pie: {
|
||||
donut: {
|
||||
labels: {
|
||||
show: true,
|
||||
name: {
|
||||
fontSize: '1.5rem',
|
||||
},
|
||||
value: {
|
||||
fontSize: '1.5rem',
|
||||
color: themeSecondaryTextColor,
|
||||
formatter: val => `${Number.parseInt(val, 10)}`,
|
||||
},
|
||||
total: {
|
||||
show: true,
|
||||
fontSize: '1.5rem',
|
||||
label: 'Operational',
|
||||
formatter: () => '31%',
|
||||
color: themePrimaryTextColor,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
responsive: [
|
||||
{
|
||||
breakpoint: 992,
|
||||
options: {
|
||||
chart: {
|
||||
height: 380,
|
||||
},
|
||||
legend: {
|
||||
position: 'bottom',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
breakpoint: 576,
|
||||
options: {
|
||||
chart: {
|
||||
height: 320,
|
||||
},
|
||||
plotOptions: {
|
||||
pie: {
|
||||
donut: {
|
||||
labels: {
|
||||
show: true,
|
||||
name: {
|
||||
fontSize: '1rem',
|
||||
},
|
||||
value: {
|
||||
fontSize: '1rem',
|
||||
},
|
||||
total: {
|
||||
fontSize: '1rem',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
export const getAreaChartSplineConfig = themeColors => {
|
||||
const areaColors = {
|
||||
series3: '#e0cffe',
|
||||
series2: '#b992fe',
|
||||
series1: '#ab7efd',
|
||||
}
|
||||
|
||||
const { themeSecondaryTextColor, themeBorderColor, themeDisabledTextColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
chart: {
|
||||
parentHeightOffset: 0,
|
||||
toolbar: { show: false },
|
||||
},
|
||||
tooltip: { shared: false },
|
||||
dataLabels: { enabled: false },
|
||||
stroke: {
|
||||
show: false,
|
||||
curve: 'straight',
|
||||
},
|
||||
legend: {
|
||||
position: 'top',
|
||||
horizontalAlign: 'left',
|
||||
labels: { colors: themeSecondaryTextColor },
|
||||
markers: {
|
||||
offsetY: 1,
|
||||
offsetX: -3,
|
||||
},
|
||||
itemMargin: {
|
||||
vertical: 3,
|
||||
horizontal: 10,
|
||||
},
|
||||
},
|
||||
colors: [areaColors.series3, areaColors.series2, areaColors.series1],
|
||||
fill: {
|
||||
opacity: 1,
|
||||
type: 'solid',
|
||||
},
|
||||
grid: {
|
||||
show: true,
|
||||
borderColor: themeBorderColor,
|
||||
xaxis: {
|
||||
lines: { show: true },
|
||||
},
|
||||
},
|
||||
yaxis: {
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
},
|
||||
},
|
||||
xaxis: {
|
||||
axisBorder: { show: false },
|
||||
axisTicks: { color: themeBorderColor },
|
||||
crosshairs: {
|
||||
stroke: { color: themeBorderColor },
|
||||
},
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
},
|
||||
categories: [
|
||||
'7/12',
|
||||
'8/12',
|
||||
'9/12',
|
||||
'10/12',
|
||||
'11/12',
|
||||
'12/12',
|
||||
'13/12',
|
||||
'14/12',
|
||||
'15/12',
|
||||
'16/12',
|
||||
'17/12',
|
||||
'18/12',
|
||||
'19/12',
|
||||
],
|
||||
},
|
||||
}
|
||||
}
|
||||
export const getColumnChartConfig = themeColors => {
|
||||
const columnColors = {
|
||||
series1: '#826af9',
|
||||
series2: '#d2b0ff',
|
||||
bg: '#f8d3ff',
|
||||
}
|
||||
|
||||
const { themeSecondaryTextColor, themeBorderColor, themeDisabledTextColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
chart: {
|
||||
offsetX: -10,
|
||||
stacked: true,
|
||||
parentHeightOffset: 0,
|
||||
toolbar: { show: false },
|
||||
},
|
||||
fill: { opacity: 1 },
|
||||
dataLabels: { enabled: false },
|
||||
colors: [columnColors.series1, columnColors.series2],
|
||||
legend: {
|
||||
position: 'top',
|
||||
horizontalAlign: 'left',
|
||||
labels: { colors: themeSecondaryTextColor },
|
||||
markers: {
|
||||
offsetY: 1,
|
||||
offsetX: -3,
|
||||
},
|
||||
itemMargin: {
|
||||
vertical: 3,
|
||||
horizontal: 10,
|
||||
},
|
||||
},
|
||||
stroke: {
|
||||
show: true,
|
||||
colors: ['transparent'],
|
||||
},
|
||||
plotOptions: {
|
||||
bar: {
|
||||
columnWidth: '15%',
|
||||
colors: {
|
||||
backgroundBarRadius: 10,
|
||||
backgroundBarColors: [columnColors.bg, columnColors.bg, columnColors.bg, columnColors.bg, columnColors.bg],
|
||||
},
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
borderColor: themeBorderColor,
|
||||
xaxis: {
|
||||
lines: { show: true },
|
||||
},
|
||||
},
|
||||
yaxis: {
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
},
|
||||
},
|
||||
xaxis: {
|
||||
axisBorder: { show: false },
|
||||
axisTicks: { color: themeBorderColor },
|
||||
categories: ['7/12', '8/12', '9/12', '10/12', '11/12', '12/12', '13/12', '14/12', '15/12'],
|
||||
crosshairs: {
|
||||
stroke: { color: themeBorderColor },
|
||||
},
|
||||
labels: {
|
||||
style: { colors: themeDisabledTextColor },
|
||||
},
|
||||
},
|
||||
responsive: [
|
||||
{
|
||||
breakpoint: 600,
|
||||
options: {
|
||||
plotOptions: {
|
||||
bar: {
|
||||
columnWidth: '35%',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
export const getHeatMapChartConfig = themeColors => {
|
||||
const { themeSecondaryTextColor, themeDisabledTextColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
chart: {
|
||||
parentHeightOffset: 0,
|
||||
toolbar: { show: false },
|
||||
},
|
||||
dataLabels: { enabled: false },
|
||||
stroke: {
|
||||
colors: [themeColors.colors.surface],
|
||||
},
|
||||
legend: {
|
||||
position: 'bottom',
|
||||
labels: {
|
||||
colors: themeSecondaryTextColor,
|
||||
},
|
||||
markers: {
|
||||
offsetY: 0,
|
||||
offsetX: -3,
|
||||
},
|
||||
itemMargin: {
|
||||
vertical: 3,
|
||||
horizontal: 10,
|
||||
},
|
||||
},
|
||||
plotOptions: {
|
||||
heatmap: {
|
||||
enableShades: false,
|
||||
colorScale: {
|
||||
ranges: [
|
||||
{ to: 10, from: 0, name: '0-10', color: '#b9b3f8' },
|
||||
{ to: 20, from: 11, name: '10-20', color: '#aba4f6' },
|
||||
{ to: 30, from: 21, name: '20-30', color: '#9d95f5' },
|
||||
{ to: 40, from: 31, name: '30-40', color: '#8f85f3' },
|
||||
{ to: 50, from: 41, name: '40-50', color: '#8176f2' },
|
||||
{ to: 60, from: 51, name: '50-60', color: '#7367f0' },
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
padding: { top: -20 },
|
||||
},
|
||||
yaxis: {
|
||||
labels: {
|
||||
style: {
|
||||
colors: themeDisabledTextColor,
|
||||
},
|
||||
},
|
||||
},
|
||||
xaxis: {
|
||||
labels: { show: false },
|
||||
axisTicks: { show: false },
|
||||
axisBorder: { show: false },
|
||||
},
|
||||
}
|
||||
}
|
||||
export const getRadarChartConfig = themeColors => {
|
||||
const radarColors = {
|
||||
series1: '#9b88fa',
|
||||
series2: '#ffa1a1',
|
||||
}
|
||||
|
||||
const { themeSecondaryTextColor, themeBorderColor, themeDisabledTextColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
chart: {
|
||||
parentHeightOffset: 0,
|
||||
toolbar: { show: false },
|
||||
dropShadow: {
|
||||
top: 1,
|
||||
blur: 8,
|
||||
left: 1,
|
||||
opacity: 0.2,
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
markers: { size: 0 },
|
||||
fill: { opacity: [1, 0.8] },
|
||||
colors: [radarColors.series1, radarColors.series2],
|
||||
stroke: {
|
||||
width: 0,
|
||||
show: false,
|
||||
},
|
||||
legend: {
|
||||
labels: {
|
||||
colors: themeSecondaryTextColor,
|
||||
},
|
||||
markers: {
|
||||
offsetX: -3,
|
||||
},
|
||||
itemMargin: {
|
||||
vertical: 3,
|
||||
horizontal: 10,
|
||||
},
|
||||
},
|
||||
plotOptions: {
|
||||
radar: {
|
||||
polygons: {
|
||||
strokeColors: themeBorderColor,
|
||||
connectorColors: themeBorderColor,
|
||||
},
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
show: false,
|
||||
padding: {
|
||||
top: -20,
|
||||
bottom: -20,
|
||||
},
|
||||
},
|
||||
yaxis: { show: false },
|
||||
xaxis: {
|
||||
categories: ['Battery', 'Brand', 'Camera', 'Memory', 'Storage', 'Display', 'OS', 'Price'],
|
||||
labels: {
|
||||
style: {
|
||||
colors: [
|
||||
themeDisabledTextColor,
|
||||
themeDisabledTextColor,
|
||||
themeDisabledTextColor,
|
||||
themeDisabledTextColor,
|
||||
themeDisabledTextColor,
|
||||
themeDisabledTextColor,
|
||||
themeDisabledTextColor,
|
||||
themeDisabledTextColor,
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
372
resources/js/@core/libs/chartjs/chartjsConfig.js
Normal file
372
resources/js/@core/libs/chartjs/chartjsConfig.js
Normal file
@@ -0,0 +1,372 @@
|
||||
import { hexToRgb } from '@layouts/utils'
|
||||
|
||||
|
||||
// 👉 Colors variables
|
||||
const colorVariables = themeColors => {
|
||||
const themeSecondaryTextColor = `rgba(${hexToRgb(themeColors.colors['on-surface'])},${themeColors.variables['medium-emphasis-opacity']})`
|
||||
const themeDisabledTextColor = `rgba(${hexToRgb(themeColors.colors['on-surface'])},${themeColors.variables['disabled-opacity']})`
|
||||
const themeBorderColor = `rgba(${hexToRgb(String(themeColors.variables['border-color']))},${themeColors.variables['border-opacity']})`
|
||||
|
||||
return { labelColor: themeDisabledTextColor, borderColor: themeBorderColor, legendColor: themeSecondaryTextColor }
|
||||
}
|
||||
|
||||
|
||||
// SECTION config
|
||||
// 👉 Latest Bar Chart Config
|
||||
export const getLatestBarChartConfig = themeColors => {
|
||||
const { borderColor, labelColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
animation: { duration: 500 },
|
||||
scales: {
|
||||
x: {
|
||||
grid: {
|
||||
borderColor,
|
||||
drawBorder: false,
|
||||
color: borderColor,
|
||||
},
|
||||
ticks: { color: labelColor },
|
||||
},
|
||||
y: {
|
||||
min: 0,
|
||||
max: 400,
|
||||
grid: {
|
||||
borderColor,
|
||||
drawBorder: false,
|
||||
color: borderColor,
|
||||
},
|
||||
ticks: {
|
||||
stepSize: 100,
|
||||
color: labelColor,
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
legend: { display: false },
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// 👉 Horizontal Bar Chart Config
|
||||
export const getHorizontalBarChartConfig = themeColors => {
|
||||
const { borderColor, labelColor, legendColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
indexAxis: 'y',
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
animation: { duration: 500 },
|
||||
elements: {
|
||||
bar: {
|
||||
borderRadius: {
|
||||
topRight: 15,
|
||||
bottomRight: 15,
|
||||
},
|
||||
},
|
||||
},
|
||||
layout: {
|
||||
padding: { top: -4 },
|
||||
},
|
||||
scales: {
|
||||
x: {
|
||||
min: 0,
|
||||
grid: {
|
||||
drawTicks: false,
|
||||
drawBorder: false,
|
||||
color: borderColor,
|
||||
},
|
||||
ticks: { color: labelColor },
|
||||
},
|
||||
y: {
|
||||
grid: {
|
||||
borderColor,
|
||||
display: false,
|
||||
drawBorder: false,
|
||||
},
|
||||
ticks: { color: labelColor },
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
legend: {
|
||||
align: 'end',
|
||||
position: 'top',
|
||||
labels: { color: legendColor },
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// 👉 Line Chart Config
|
||||
export const getLineChartConfig = themeColors => {
|
||||
const { borderColor, labelColor, legendColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
scales: {
|
||||
x: {
|
||||
ticks: { color: labelColor },
|
||||
grid: {
|
||||
borderColor,
|
||||
drawBorder: false,
|
||||
color: borderColor,
|
||||
},
|
||||
},
|
||||
y: {
|
||||
min: 0,
|
||||
// max: 400,
|
||||
ticks: {
|
||||
stepSize: 100,
|
||||
color: labelColor,
|
||||
},
|
||||
grid: {
|
||||
borderColor,
|
||||
drawBorder: false,
|
||||
color: borderColor,
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
legend: {
|
||||
align: 'end',
|
||||
position: 'top',
|
||||
labels: {
|
||||
padding: 25,
|
||||
boxWidth: 10,
|
||||
color: legendColor,
|
||||
usePointStyle: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// 👉 Radar Chart Config
|
||||
export const getRadarChartConfig = themeColors => {
|
||||
const { borderColor, labelColor, legendColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
animation: { duration: 500 },
|
||||
layout: {
|
||||
padding: { top: -20 },
|
||||
},
|
||||
scales: {
|
||||
r: {
|
||||
ticks: {
|
||||
display: false,
|
||||
maxTicksLimit: 1,
|
||||
color: labelColor,
|
||||
},
|
||||
grid: { color: borderColor },
|
||||
pointLabels: { color: labelColor },
|
||||
angleLines: { color: borderColor },
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
legend: {
|
||||
position: 'top',
|
||||
labels: {
|
||||
padding: 25,
|
||||
color: legendColor,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// 👉 Polar Chart Config
|
||||
export const getPolarChartConfig = themeColors => {
|
||||
const { legendColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
animation: { duration: 500 },
|
||||
layout: {
|
||||
padding: {
|
||||
top: -5,
|
||||
bottom: -45,
|
||||
},
|
||||
},
|
||||
scales: {
|
||||
r: {
|
||||
grid: { display: false },
|
||||
ticks: { display: false },
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
legend: {
|
||||
position: 'right',
|
||||
labels: {
|
||||
padding: 25,
|
||||
boxWidth: 9,
|
||||
color: legendColor,
|
||||
usePointStyle: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// 👉 Bubble Chart Config
|
||||
export const getBubbleChartConfig = themeColors => {
|
||||
const { borderColor, labelColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
scales: {
|
||||
x: {
|
||||
min: 0,
|
||||
max: 140,
|
||||
grid: {
|
||||
borderColor,
|
||||
drawBorder: false,
|
||||
color: borderColor,
|
||||
},
|
||||
ticks: {
|
||||
stepSize: 10,
|
||||
color: labelColor,
|
||||
},
|
||||
},
|
||||
y: {
|
||||
min: 0,
|
||||
max: 400,
|
||||
grid: {
|
||||
borderColor,
|
||||
drawBorder: false,
|
||||
color: borderColor,
|
||||
},
|
||||
ticks: {
|
||||
stepSize: 100,
|
||||
color: labelColor,
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
legend: { display: false },
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// 👉 Doughnut Chart Config
|
||||
export const getDoughnutChartConfig = () => {
|
||||
return {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
animation: { duration: 500 },
|
||||
cutout: 80,
|
||||
plugins: {
|
||||
legend: {
|
||||
display: false,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// 👉 Scatter Chart Config
|
||||
export const getScatterChartConfig = themeColors => {
|
||||
const { borderColor, labelColor, legendColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
animation: { duration: 800 },
|
||||
layout: {
|
||||
padding: { top: -20 },
|
||||
},
|
||||
scales: {
|
||||
x: {
|
||||
min: 0,
|
||||
max: 140,
|
||||
grid: {
|
||||
borderColor,
|
||||
drawTicks: false,
|
||||
drawBorder: false,
|
||||
color: borderColor,
|
||||
},
|
||||
ticks: {
|
||||
stepSize: 10,
|
||||
color: labelColor,
|
||||
},
|
||||
},
|
||||
y: {
|
||||
min: 0,
|
||||
max: 400,
|
||||
grid: {
|
||||
borderColor,
|
||||
drawTicks: false,
|
||||
drawBorder: false,
|
||||
color: borderColor,
|
||||
},
|
||||
ticks: {
|
||||
stepSize: 100,
|
||||
color: labelColor,
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
legend: {
|
||||
align: 'start',
|
||||
position: 'top',
|
||||
labels: {
|
||||
padding: 25,
|
||||
boxWidth: 9,
|
||||
color: legendColor,
|
||||
usePointStyle: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// 👉 Line Area Chart Config
|
||||
export const getLineAreaChartConfig = themeColors => {
|
||||
const { borderColor, labelColor, legendColor } = colorVariables(themeColors)
|
||||
|
||||
return {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
layout: {
|
||||
padding: { top: -20 },
|
||||
},
|
||||
scales: {
|
||||
x: {
|
||||
grid: {
|
||||
borderColor,
|
||||
color: 'transparent',
|
||||
},
|
||||
ticks: { color: labelColor },
|
||||
},
|
||||
y: {
|
||||
min: 0,
|
||||
max: 400,
|
||||
grid: {
|
||||
borderColor,
|
||||
color: 'transparent',
|
||||
},
|
||||
ticks: {
|
||||
stepSize: 100,
|
||||
color: labelColor,
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
legend: {
|
||||
align: 'start',
|
||||
position: 'top',
|
||||
labels: {
|
||||
padding: 25,
|
||||
boxWidth: 9,
|
||||
color: legendColor,
|
||||
usePointStyle: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
// !SECTION
|
54
resources/js/@core/libs/chartjs/components/BarChart.js
Normal file
54
resources/js/@core/libs/chartjs/components/BarChart.js
Normal file
@@ -0,0 +1,54 @@
|
||||
import { BarElement, CategoryScale, Chart as ChartJS, Legend, LinearScale, Title, Tooltip } from 'chart.js'
|
||||
import { defineComponent } from 'vue'
|
||||
import { Bar } from 'vue-chartjs'
|
||||
|
||||
ChartJS.register(Title, Tooltip, Legend, BarElement, CategoryScale, LinearScale)
|
||||
export default defineComponent({
|
||||
name: 'BarChart',
|
||||
props: {
|
||||
chartId: {
|
||||
type: String,
|
||||
default: 'bar-chart',
|
||||
},
|
||||
width: {
|
||||
type: Number,
|
||||
default: 400,
|
||||
},
|
||||
height: {
|
||||
type: Number,
|
||||
default: 400,
|
||||
},
|
||||
cssClasses: {
|
||||
default: '',
|
||||
type: String,
|
||||
},
|
||||
styles: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
plugins: {
|
||||
type: Array,
|
||||
default: () => ([]),
|
||||
},
|
||||
chartData: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
chartOptions: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
return () => h(h(Bar), {
|
||||
data: props.chartData,
|
||||
options: props.chartOptions,
|
||||
chartId: props.chartId,
|
||||
width: props.width,
|
||||
height: props.height,
|
||||
cssClasses: props.cssClasses,
|
||||
styles: props.styles,
|
||||
plugins: props.plugins,
|
||||
})
|
||||
},
|
||||
})
|
54
resources/js/@core/libs/chartjs/components/BubbleChart.js
Normal file
54
resources/js/@core/libs/chartjs/components/BubbleChart.js
Normal file
@@ -0,0 +1,54 @@
|
||||
import { Chart as ChartJS, Legend, LinearScale, PointElement, Title, Tooltip } from 'chart.js'
|
||||
import { defineComponent } from 'vue'
|
||||
import { Bubble } from 'vue-chartjs'
|
||||
|
||||
ChartJS.register(Title, Tooltip, Legend, PointElement, LinearScale)
|
||||
export default defineComponent({
|
||||
name: 'BubbleChart',
|
||||
props: {
|
||||
chartId: {
|
||||
type: String,
|
||||
default: 'bubble-chart',
|
||||
},
|
||||
width: {
|
||||
type: Number,
|
||||
default: 400,
|
||||
},
|
||||
height: {
|
||||
type: Number,
|
||||
default: 400,
|
||||
},
|
||||
cssClasses: {
|
||||
default: '',
|
||||
type: String,
|
||||
},
|
||||
styles: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
plugins: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
chartData: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
chartOptions: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
return () => h(h(Bubble), {
|
||||
data: props.chartData,
|
||||
options: props.chartOptions,
|
||||
chartId: props.chartId,
|
||||
width: props.width,
|
||||
height: props.height,
|
||||
cssClasses: props.cssClasses,
|
||||
styles: props.styles,
|
||||
plugins: props.plugins,
|
||||
})
|
||||
},
|
||||
})
|
54
resources/js/@core/libs/chartjs/components/DoughnutChart.js
Normal file
54
resources/js/@core/libs/chartjs/components/DoughnutChart.js
Normal file
@@ -0,0 +1,54 @@
|
||||
import { ArcElement, CategoryScale, Chart as ChartJS, Legend, Title, Tooltip } from 'chart.js'
|
||||
import { defineComponent } from 'vue'
|
||||
import { Doughnut } from 'vue-chartjs'
|
||||
|
||||
ChartJS.register(Title, Tooltip, Legend, ArcElement, CategoryScale)
|
||||
export default defineComponent({
|
||||
name: 'DoughnutChart',
|
||||
props: {
|
||||
chartId: {
|
||||
type: String,
|
||||
default: 'doughnut-chart',
|
||||
},
|
||||
width: {
|
||||
type: Number,
|
||||
default: 400,
|
||||
},
|
||||
height: {
|
||||
type: Number,
|
||||
default: 400,
|
||||
},
|
||||
cssClasses: {
|
||||
default: '',
|
||||
type: String,
|
||||
},
|
||||
styles: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
plugins: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
chartData: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
chartOptions: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
return () => h(h(Doughnut), {
|
||||
data: props.chartData,
|
||||
options: props.chartOptions,
|
||||
chartId: props.chartId,
|
||||
width: props.width,
|
||||
height: props.height,
|
||||
cssClasses: props.cssClasses,
|
||||
styles: props.styles,
|
||||
plugins: props.plugins,
|
||||
})
|
||||
},
|
||||
})
|
54
resources/js/@core/libs/chartjs/components/LineChart.js
Normal file
54
resources/js/@core/libs/chartjs/components/LineChart.js
Normal file
@@ -0,0 +1,54 @@
|
||||
import { CategoryScale, Chart as ChartJS, Legend, LineElement, LinearScale, PointElement, Title, Tooltip } from 'chart.js'
|
||||
import { defineComponent } from 'vue'
|
||||
import { Line } from 'vue-chartjs'
|
||||
|
||||
ChartJS.register(Title, Tooltip, Legend, LineElement, LinearScale, PointElement, CategoryScale)
|
||||
export default defineComponent({
|
||||
name: 'LineChart',
|
||||
props: {
|
||||
chartId: {
|
||||
type: String,
|
||||
default: 'line-chart',
|
||||
},
|
||||
width: {
|
||||
type: Number,
|
||||
default: 400,
|
||||
},
|
||||
height: {
|
||||
type: Number,
|
||||
default: 400,
|
||||
},
|
||||
cssClasses: {
|
||||
default: '',
|
||||
type: String,
|
||||
},
|
||||
styles: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
plugins: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
chartData: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
chartOptions: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
return () => h(h(Line), {
|
||||
chartId: props.chartId,
|
||||
width: props.width,
|
||||
height: props.height,
|
||||
cssClasses: props.cssClasses,
|
||||
styles: props.styles,
|
||||
plugins: props.plugins,
|
||||
options: props.chartOptions,
|
||||
data: props.chartData,
|
||||
})
|
||||
},
|
||||
})
|
54
resources/js/@core/libs/chartjs/components/PolarAreaChart.js
Normal file
54
resources/js/@core/libs/chartjs/components/PolarAreaChart.js
Normal file
@@ -0,0 +1,54 @@
|
||||
import { ArcElement, Chart as ChartJS, Legend, RadialLinearScale, Title, Tooltip } from 'chart.js'
|
||||
import { defineComponent } from 'vue'
|
||||
import { PolarArea } from 'vue-chartjs'
|
||||
|
||||
ChartJS.register(Title, Tooltip, Legend, ArcElement, RadialLinearScale)
|
||||
export default defineComponent({
|
||||
name: 'PolarAreaChart',
|
||||
props: {
|
||||
chartId: {
|
||||
type: String,
|
||||
default: 'line-chart',
|
||||
},
|
||||
width: {
|
||||
type: Number,
|
||||
default: 400,
|
||||
},
|
||||
height: {
|
||||
type: Number,
|
||||
default: 400,
|
||||
},
|
||||
cssClasses: {
|
||||
default: '',
|
||||
type: String,
|
||||
},
|
||||
styles: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
plugins: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
chartData: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
chartOptions: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
return () => h(h(PolarArea), {
|
||||
data: props.chartData,
|
||||
options: props.chartOptions,
|
||||
chartId: props.chartId,
|
||||
width: props.width,
|
||||
height: props.height,
|
||||
cssClasses: props.cssClasses,
|
||||
styles: props.styles,
|
||||
plugins: props.plugins,
|
||||
})
|
||||
},
|
||||
})
|
54
resources/js/@core/libs/chartjs/components/RadarChart.js
Normal file
54
resources/js/@core/libs/chartjs/components/RadarChart.js
Normal file
@@ -0,0 +1,54 @@
|
||||
import { Chart as ChartJS, Filler, Legend, LineElement, PointElement, RadialLinearScale, Title, Tooltip } from 'chart.js'
|
||||
import { defineComponent } from 'vue'
|
||||
import { Radar } from 'vue-chartjs'
|
||||
|
||||
ChartJS.register(Title, Tooltip, Legend, PointElement, RadialLinearScale, LineElement, Filler)
|
||||
export default defineComponent({
|
||||
name: 'RadarChart',
|
||||
props: {
|
||||
chartId: {
|
||||
type: String,
|
||||
default: 'radar-chart',
|
||||
},
|
||||
width: {
|
||||
type: Number,
|
||||
default: 400,
|
||||
},
|
||||
height: {
|
||||
type: Number,
|
||||
default: 400,
|
||||
},
|
||||
cssClasses: {
|
||||
default: '',
|
||||
type: String,
|
||||
},
|
||||
styles: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
plugins: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
chartData: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
chartOptions: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
return () => h(h(Radar), {
|
||||
data: props.chartData,
|
||||
options: props.chartOptions,
|
||||
chartId: props.chartId,
|
||||
width: props.width,
|
||||
height: props.height,
|
||||
cssClasses: props.cssClasses,
|
||||
styles: props.styles,
|
||||
plugins: props.plugins,
|
||||
})
|
||||
},
|
||||
})
|
54
resources/js/@core/libs/chartjs/components/ScatterChart.js
Normal file
54
resources/js/@core/libs/chartjs/components/ScatterChart.js
Normal file
@@ -0,0 +1,54 @@
|
||||
import { CategoryScale, Chart as ChartJS, Legend, LineElement, LinearScale, PointElement, Title, Tooltip } from 'chart.js'
|
||||
import { defineComponent } from 'vue'
|
||||
import { Scatter } from 'vue-chartjs'
|
||||
|
||||
ChartJS.register(Title, Tooltip, Legend, PointElement, LineElement, CategoryScale, LinearScale)
|
||||
export default defineComponent({
|
||||
name: 'ScatterChart',
|
||||
props: {
|
||||
chartId: {
|
||||
type: String,
|
||||
default: 'scatter-chart',
|
||||
},
|
||||
width: {
|
||||
type: Number,
|
||||
default: 400,
|
||||
},
|
||||
height: {
|
||||
type: Number,
|
||||
default: 400,
|
||||
},
|
||||
cssClasses: {
|
||||
default: '',
|
||||
type: String,
|
||||
},
|
||||
styles: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
plugins: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
chartData: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
chartOptions: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
return () => h(h(Scatter), {
|
||||
data: props.chartData,
|
||||
options: props.chartOptions,
|
||||
chartId: props.chartId,
|
||||
width: props.width,
|
||||
height: props.height,
|
||||
cssClasses: props.cssClasses,
|
||||
styles: props.styles,
|
||||
plugins: props.plugins,
|
||||
})
|
||||
},
|
||||
})
|
63
resources/js/@core/stores/config.js
Normal file
63
resources/js/@core/stores/config.js
Normal file
@@ -0,0 +1,63 @@
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useTheme } from 'vuetify'
|
||||
import { cookieRef, useLayoutConfigStore } from '@layouts/stores/config'
|
||||
import { themeConfig } from '@themeConfig'
|
||||
|
||||
// SECTION Store
|
||||
export const useConfigStore = defineStore('config', () => {
|
||||
// 👉 Theme
|
||||
const userPreferredColorScheme = usePreferredColorScheme()
|
||||
const cookieColorScheme = cookieRef('color-scheme', 'light')
|
||||
|
||||
watch(userPreferredColorScheme, val => {
|
||||
if (val !== 'no-preference')
|
||||
cookieColorScheme.value = val
|
||||
}, { immediate: true })
|
||||
|
||||
const theme = cookieRef('theme', themeConfig.app.theme)
|
||||
|
||||
// 👉 isVerticalNavSemiDark
|
||||
const isVerticalNavSemiDark = cookieRef('isVerticalNavSemiDark', themeConfig.verticalNav.isVerticalNavSemiDark)
|
||||
|
||||
// 👉 isVerticalNavSemiDark
|
||||
const skin = cookieRef('skin', themeConfig.app.skin)
|
||||
|
||||
// ℹ️ We need to use `storeToRefs` to forward the state
|
||||
const { isLessThanOverlayNavBreakpoint, appContentWidth, navbarType, isNavbarBlurEnabled, appContentLayoutNav, isVerticalNavCollapsed, footerType, isAppRTL } = storeToRefs(useLayoutConfigStore())
|
||||
|
||||
return {
|
||||
theme,
|
||||
isVerticalNavSemiDark,
|
||||
skin,
|
||||
|
||||
// @layouts exports
|
||||
isLessThanOverlayNavBreakpoint,
|
||||
appContentWidth,
|
||||
navbarType,
|
||||
isNavbarBlurEnabled,
|
||||
appContentLayoutNav,
|
||||
isVerticalNavCollapsed,
|
||||
footerType,
|
||||
isAppRTL,
|
||||
}
|
||||
})
|
||||
// !SECTION
|
||||
// SECTION Init
|
||||
export const initConfigStore = () => {
|
||||
const userPreferredColorScheme = usePreferredColorScheme()
|
||||
const vuetifyTheme = useTheme()
|
||||
const configStore = useConfigStore()
|
||||
|
||||
watch([() => configStore.theme, userPreferredColorScheme], () => {
|
||||
vuetifyTheme.global.name.value = configStore.theme === 'system'
|
||||
? userPreferredColorScheme.value === 'dark'
|
||||
? 'dark'
|
||||
: 'light'
|
||||
: configStore.theme
|
||||
})
|
||||
onMounted(() => {
|
||||
if (configStore.theme === 'system')
|
||||
vuetifyTheme.global.name.value = userPreferredColorScheme.value
|
||||
})
|
||||
}
|
||||
// !SECTION
|
1
resources/js/@core/types.js
Normal file
1
resources/js/@core/types.js
Normal file
@@ -0,0 +1 @@
|
||||
export {}
|
46
resources/js/@core/utils/formatters.js
Normal file
46
resources/js/@core/utils/formatters.js
Normal file
@@ -0,0 +1,46 @@
|
||||
import { isToday } from './helpers'
|
||||
|
||||
export const avatarText = value => {
|
||||
if (!value)
|
||||
return ''
|
||||
const nameArray = value.split(' ')
|
||||
|
||||
return nameArray.map(word => word.charAt(0).toUpperCase()).join('')
|
||||
}
|
||||
|
||||
// TODO: Try to implement this: https://twitter.com/fireship_dev/status/1565424801216311297
|
||||
export const kFormatter = num => {
|
||||
const regex = /\B(?=(\d{3})+(?!\d))/g
|
||||
|
||||
return Math.abs(num) > 9999 ? `${Math.sign(num) * +((Math.abs(num) / 1000).toFixed(1))}k` : Math.abs(num).toFixed(0).replace(regex, ',')
|
||||
}
|
||||
|
||||
/**
|
||||
* Format and return date in Humanize format
|
||||
* Intl docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/format
|
||||
* Intl Constructor: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat
|
||||
* @param {string} value date to format
|
||||
* @param {Intl.DateTimeFormatOptions} formatting Intl object to format with
|
||||
*/
|
||||
export const formatDate = (value, formatting = { month: 'short', day: 'numeric', year: 'numeric' }) => {
|
||||
if (!value)
|
||||
return value
|
||||
|
||||
return new Intl.DateTimeFormat('en-US', formatting).format(new Date(value))
|
||||
}
|
||||
|
||||
/**
|
||||
* Return short human friendly month representation of date
|
||||
* Can also convert date to only time if date is of today (Better UX)
|
||||
* @param {string} value date to format
|
||||
* @param {boolean} toTimeForCurrentDay Shall convert to time if day is today/current
|
||||
*/
|
||||
export const formatDateToMonthShort = (value, toTimeForCurrentDay = true) => {
|
||||
const date = new Date(value)
|
||||
let formatting = { month: 'short', day: 'numeric' }
|
||||
if (toTimeForCurrentDay && isToday(date))
|
||||
formatting = { hour: 'numeric', minute: 'numeric' }
|
||||
|
||||
return new Intl.DateTimeFormat('en-US', formatting).format(new Date(value))
|
||||
}
|
||||
export const prefixWithPlus = value => value > 0 ? `+${value}` : value
|
29
resources/js/@core/utils/helpers.js
Normal file
29
resources/js/@core/utils/helpers.js
Normal file
@@ -0,0 +1,29 @@
|
||||
// 👉 IsEmpty
|
||||
export const isEmpty = value => {
|
||||
if (value === null || value === undefined || value === '')
|
||||
return true
|
||||
|
||||
return !!(Array.isArray(value) && value.length === 0)
|
||||
}
|
||||
|
||||
// 👉 IsNullOrUndefined
|
||||
export const isNullOrUndefined = value => {
|
||||
return value === null || value === undefined
|
||||
}
|
||||
|
||||
// 👉 IsEmptyArray
|
||||
export const isEmptyArray = arr => {
|
||||
return Array.isArray(arr) && arr.length === 0
|
||||
}
|
||||
|
||||
// 👉 IsObject
|
||||
export const isObject = obj => obj !== null && !!obj && typeof obj === 'object' && !Array.isArray(obj)
|
||||
|
||||
// 👉 IsToday
|
||||
export const isToday = date => {
|
||||
const today = new Date()
|
||||
|
||||
return (date.getDate() === today.getDate()
|
||||
&& date.getMonth() === today.getMonth()
|
||||
&& date.getFullYear() === today.getFullYear())
|
||||
}
|
50
resources/js/@core/utils/plugins.js
Normal file
50
resources/js/@core/utils/plugins.js
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* This is helper function to register plugins like a nuxt
|
||||
* To register a plugin just export a const function `defineVuePlugin` that takes `app` as argument and call `app.use`
|
||||
* For Scanning plugins it will include all files in `src/plugins` and `src/plugins/**\/index.ts`
|
||||
*
|
||||
*
|
||||
* @param {App} app Vue app instance
|
||||
* @returns void
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* // File: src/plugins/vuetify/index.ts
|
||||
*
|
||||
* import type { App } from 'vue'
|
||||
* import { createVuetify } from 'vuetify'
|
||||
*
|
||||
* const vuetify = createVuetify({ ... })
|
||||
*
|
||||
* export default function (app: App) {
|
||||
* app.use(vuetify)
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* All you have to do is use this helper function in `main.ts` file like below:
|
||||
* ```ts
|
||||
* // File: src/main.ts
|
||||
* import { registerPlugins } from '@core/utils/plugins'
|
||||
* import { createApp } from 'vue'
|
||||
* import App from '@/App.vue'
|
||||
*
|
||||
* // Create vue app
|
||||
* const app = createApp(App)
|
||||
*
|
||||
* // Register plugins
|
||||
* registerPlugins(app) // [!code focus]
|
||||
*
|
||||
* // Mount vue app
|
||||
* app.mount('#app')
|
||||
* ```
|
||||
*/
|
||||
export const registerPlugins = app => {
|
||||
const imports = import.meta.glob(['../../plugins/*.{ts,js}', '../../plugins/*/index.{ts,js}'], { eager: true })
|
||||
const importPaths = Object.keys(imports).sort()
|
||||
|
||||
importPaths.forEach(path => {
|
||||
const pluginImportModule = imports[path]
|
||||
|
||||
pluginImportModule.default?.(app)
|
||||
})
|
||||
}
|
237
resources/js/@core/utils/validators.js
Normal file
237
resources/js/@core/utils/validators.js
Normal file
@@ -0,0 +1,237 @@
|
||||
import { isEmpty, isEmptyArray, isNullOrUndefined } from './helpers'
|
||||
|
||||
// 👉 Required Validator
|
||||
export const requiredValidator = value => {
|
||||
if (isNullOrUndefined(value) || isEmptyArray(value) || value === false)
|
||||
return 'This field is required'
|
||||
|
||||
return !!String(value).trim().length || 'This field is required'
|
||||
}
|
||||
|
||||
// 👉 Email Validator
|
||||
export const emailValidator = value => {
|
||||
if (isEmpty(value))
|
||||
return true
|
||||
const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
||||
if (Array.isArray(value))
|
||||
return value.every(val => re.test(String(val))) || 'The Email field must be a valid email'
|
||||
|
||||
return re.test(String(value)) || 'The Email field must be a valid email'
|
||||
}
|
||||
|
||||
// 👉 Password Validator
|
||||
export const passwordValidator = password => {
|
||||
const regExp = /(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%&*()]).{8,}/
|
||||
const validPassword = regExp.test(password)
|
||||
|
||||
return validPassword || 'Field must contain at least one uppercase, lowercase, special character and digit with min 8 chars'
|
||||
}
|
||||
|
||||
// 👉 Confirm Password Validator
|
||||
export const confirmedValidator = (value, target) => value === target || 'The Confirm Password field confirmation does not match'
|
||||
|
||||
// 👉 Between Validator
|
||||
export const betweenValidator = (value, min, max) => {
|
||||
const valueAsNumber = Number(value)
|
||||
|
||||
return (Number(min) <= valueAsNumber && Number(max) >= valueAsNumber) || `Enter number between ${min} and ${max}`
|
||||
}
|
||||
|
||||
// 👉 Integer Validator
|
||||
export const integerValidator = value => {
|
||||
if (isEmpty(value))
|
||||
return true
|
||||
if (Array.isArray(value))
|
||||
return value.every(val => /^-?[0-9]+$/.test(String(val))) || 'This field must be an integer'
|
||||
|
||||
return /^-?[0-9]+$/.test(String(value)) || 'This field must be an integer'
|
||||
}
|
||||
|
||||
// 👉 Regex Validator
|
||||
export const regexValidator = (value, regex) => {
|
||||
if (isEmpty(value))
|
||||
return true
|
||||
let regeX = regex
|
||||
if (typeof regeX === 'string')
|
||||
regeX = new RegExp(regeX)
|
||||
if (Array.isArray(value))
|
||||
return value.every(val => regexValidator(val, regeX))
|
||||
|
||||
return regeX.test(String(value)) || 'The Regex field format is invalid'
|
||||
}
|
||||
|
||||
// 👉 Alpha Validator
|
||||
export const alphaValidator = value => {
|
||||
if (isEmpty(value))
|
||||
return true
|
||||
|
||||
return /^[A-Z]*$/i.test(String(value)) || 'The Alpha field may only contain alphabetic characters'
|
||||
}
|
||||
|
||||
// 👉 URL Validator
|
||||
export const urlValidator = value => {
|
||||
if (isEmpty(value))
|
||||
return true
|
||||
const re = /^(https?):\/\/[^\s$.?#].[^\s]*$/
|
||||
|
||||
return re.test(String(value)) || 'URL is invalid'
|
||||
}
|
||||
|
||||
// 👉 Length Validator
|
||||
export const lengthValidator = (value, length) => {
|
||||
if (isEmpty(value))
|
||||
return true
|
||||
|
||||
return String(value).length === length || `The Min Character field must be at least ${length} characters`
|
||||
}
|
||||
|
||||
// 👉 Alpha-dash Validator
|
||||
export const alphaDashValidator = value => {
|
||||
if (isEmpty(value))
|
||||
return true
|
||||
const valueAsString = String(value)
|
||||
|
||||
return /^[0-9A-Z_-]*$/i.test(valueAsString) || 'All Character are not valid'
|
||||
}
|
||||
export const validUSAPhone = value => {
|
||||
if (isEmpty(value))
|
||||
return true
|
||||
const valueAsString = String(value)
|
||||
|
||||
return /^\(\d{3}\)\s\d{3}-\d{4}$/i.test(valueAsString) || 'Phone are not valid'
|
||||
}
|
||||
export const requiredPhone = value => {
|
||||
if (isNullOrUndefined(value) || isEmptyArray(value) || value === false)
|
||||
return 'Phone is required'
|
||||
|
||||
return !!String(value).trim().length || ' Phone is required'
|
||||
}
|
||||
export const requiredFirstName = value => {
|
||||
if (isNullOrUndefined(value) || isEmptyArray(value) || value === false)
|
||||
return 'First Name field is required'
|
||||
|
||||
return !!String(value).trim().length || 'Name is required'
|
||||
}
|
||||
export const requiredName = value => {
|
||||
if (isNullOrUndefined(value) || isEmptyArray(value) || value === false)
|
||||
return 'Name field is required'
|
||||
|
||||
return !!String(value).trim().length || 'Name is required'
|
||||
}
|
||||
export const requiredLastName = value => {
|
||||
if (isNullOrUndefined(value) || isEmptyArray(value) || value === false)
|
||||
return 'Last Name field is required'
|
||||
|
||||
return !!String(value).trim().length || ' Last Name is required'
|
||||
}
|
||||
export const requiredEmail = value => {
|
||||
if (isNullOrUndefined(value) || isEmptyArray(value) || value === false)
|
||||
return 'Email field is required'
|
||||
|
||||
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'
|
||||
}
|
||||
export const requiredAmountFloat = (value) => {
|
||||
// Check if the value is null, undefined, an empty array, or false
|
||||
if (isNullOrUndefined(value) || isEmptyArray(value) || value === false) {
|
||||
return 'Amount field is required';
|
||||
}
|
||||
|
||||
// Check if the value is a valid float number
|
||||
if (!isFloat(value)) {
|
||||
return 'Please enter a valid amount';
|
||||
}
|
||||
|
||||
// Additional checks as needed...
|
||||
|
||||
// Return true if the value passes validation
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// Check if a value is a valid float number
|
||||
const isFloat = (value) => {
|
||||
if (typeof value !== 'number' && typeof value !== 'string') {
|
||||
return false;
|
||||
}
|
||||
// Use regex to match a valid float number (including negatives and decimals)
|
||||
return /^-?\d*\.?\d+$/.test(value);
|
||||
};
|
||||
export const requiredState = value => {
|
||||
if (isNullOrUndefined(value) || isEmptyArray(value) || value === false)
|
||||
return 'State field is required'
|
||||
|
||||
return !!String(value).trim().length || 'State is required'
|
||||
}
|
||||
export const requiredAddress = value => {
|
||||
if (isNullOrUndefined(value) || isEmptyArray(value) || value === false)
|
||||
return 'Address is required'
|
||||
|
||||
return !!String(value).trim().length || 'Address is required'
|
||||
}
|
||||
export const requiredGender = (value) => !!value || 'Gender is required'
|
||||
export const requiredLicenseNumber = (value) => !!value || 'Medical License Number is required'
|
||||
export const requiredYearsofExperience = (value) => !!value || 'Years of Experience is required'
|
||||
export const requiredSpecialty = (value) => !!value || 'Practice or Provider of Specialty is required'
|
||||
|
||||
export const requiredZip = (value) => !!value || 'Zip Code is required'
|
||||
export const requiredCity = value => {
|
||||
if (isNullOrUndefined(value) || isEmptyArray(value) || value === false)
|
||||
return 'City is required'
|
||||
|
||||
return !!String(value).trim().length || 'City is required'
|
||||
}
|
||||
export const requiredPassword = value => {
|
||||
if (isNullOrUndefined(value) || isEmptyArray(value) || value === false)
|
||||
return 'Password field is required'
|
||||
|
||||
return !!String(value).trim().length || 'Password field is required'
|
||||
}
|
||||
export const formatPrice = (price, currency = 'USD', locale = 'en-US') => {
|
||||
return new Intl.NumberFormat(locale, {
|
||||
style: 'currency',
|
||||
currency: currency,
|
||||
}).format(price);
|
||||
};
|
||||
export const expiryValidator = value => {
|
||||
// Check if the format is MM/YY
|
||||
const formatRegex = /^(0[1-9]|1[0-2])\/\d{2}$/;
|
||||
if (!formatRegex.test(value)) {
|
||||
return 'Invalid date format. Please use MM/YY';
|
||||
}
|
||||
|
||||
// Check if the date is not expired (assuming the current date is 01/24 for example)
|
||||
const currentDate = new Date();
|
||||
const currentYear = currentDate.getFullYear() % 100;
|
||||
const currentMonth = currentDate.getMonth() + 1;
|
||||
|
||||
const [inputMonth, inputYear] = value.split('/').map(Number);
|
||||
|
||||
if (inputYear < currentYear || (inputYear === currentYear && inputMonth < currentMonth)) {
|
||||
return 'The card has expired';
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
export const cvvValidator = value => {
|
||||
return /^\d{3}$/.test(value) || 'Must be a 3-digit number';
|
||||
};
|
||||
export const cardNumberValidator = value => {
|
||||
// Adjust the regex based on your credit card number pattern
|
||||
const cardNumberPattern = /^(\d{15}|\d{16})$/;
|
||||
|
||||
return cardNumberPattern.test(value) || 'Invalid credit card number';
|
||||
};
|
13
resources/js/@core/utils/vuetify.js
Normal file
13
resources/js/@core/utils/vuetify.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import { cookieRef } from '@layouts/stores/config'
|
||||
import { themeConfig } from '@themeConfig'
|
||||
|
||||
export const resolveVuetifyTheme = () => {
|
||||
const cookieColorScheme = cookieRef('color-scheme', usePreferredDark().value ? 'dark' : 'light')
|
||||
const storedTheme = cookieRef('theme', themeConfig.app.theme).value
|
||||
|
||||
return storedTheme === 'system'
|
||||
? cookieColorScheme.value === 'dark'
|
||||
? 'dark'
|
||||
: 'light'
|
||||
: storedTheme
|
||||
}
|
11
resources/js/@layouts/components.js
Normal file
11
resources/js/@layouts/components.js
Normal file
@@ -0,0 +1,11 @@
|
||||
export { default as HorizontalNav } from './components/HorizontalNav.vue'
|
||||
export { default as HorizontalNavGroup } from './components/HorizontalNavGroup.vue'
|
||||
export { default as HorizontalNavLayout } from './components/HorizontalNavLayout.vue'
|
||||
export { default as HorizontalNavLink } from './components/HorizontalNavLink.vue'
|
||||
export { default as HorizontalNavPopper } from './components/HorizontalNavPopper.vue'
|
||||
export { default as TransitionExpand } from './components/TransitionExpand.vue'
|
||||
export { default as VerticalNav } from './components/VerticalNav.vue'
|
||||
export { default as VerticalNavGroup } from './components/VerticalNavGroup.vue'
|
||||
export { default as VerticalNavLayout } from './components/VerticalNavLayout.vue'
|
||||
export { default as VerticalNavLink } from './components/VerticalNavLink.vue'
|
||||
export { default as VerticalNavSectionTitle } from './components/VerticalNavSectionTitle.vue'
|
40
resources/js/@layouts/components/HorizontalNav.vue
Normal file
40
resources/js/@layouts/components/HorizontalNav.vue
Normal file
@@ -0,0 +1,40 @@
|
||||
<script setup>
|
||||
import {
|
||||
HorizontalNavGroup,
|
||||
HorizontalNavLink,
|
||||
} from '@layouts/components'
|
||||
|
||||
const props = defineProps({
|
||||
navItems: {
|
||||
type: null,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const resolveNavItemComponent = item => {
|
||||
if ('children' in item)
|
||||
return HorizontalNavGroup
|
||||
|
||||
return HorizontalNavLink
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ul class="nav-items">
|
||||
<Component
|
||||
:is="resolveNavItemComponent(item)"
|
||||
v-for="(item, index) in navItems"
|
||||
:key="index"
|
||||
:item="item"
|
||||
/>
|
||||
</ul>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.layout-wrapper.layout-nav-type-horizontal {
|
||||
.nav-items {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
</style>
|
117
resources/js/@layouts/components/HorizontalNavGroup.vue
Normal file
117
resources/js/@layouts/components/HorizontalNavGroup.vue
Normal file
@@ -0,0 +1,117 @@
|
||||
<script setup>
|
||||
import { layoutConfig } from '@layouts'
|
||||
import {
|
||||
HorizontalNavLink,
|
||||
HorizontalNavPopper,
|
||||
} from '@layouts/components'
|
||||
import { canViewNavMenuGroup } from '@layouts/plugins/casl'
|
||||
import { useLayoutConfigStore } from '@layouts/stores/config'
|
||||
import {
|
||||
getDynamicI18nProps,
|
||||
isNavGroupActive,
|
||||
} from '@layouts/utils'
|
||||
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: null,
|
||||
required: true,
|
||||
},
|
||||
childrenAtEnd: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
isSubItem: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
})
|
||||
|
||||
defineOptions({
|
||||
name: 'HorizontalNavGroup',
|
||||
})
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const configStore = useLayoutConfigStore()
|
||||
const isGroupActive = ref(false)
|
||||
|
||||
/*Watch for route changes, more specifically route path. Do note that this won't trigger if route's query is updated.
|
||||
|
||||
updates isActive & isOpen based on active state of group.
|
||||
*/
|
||||
watch(() => route.path, () => {
|
||||
const isActive = isNavGroupActive(props.item.children, router)
|
||||
|
||||
isGroupActive.value = isActive
|
||||
}, { immediate: true })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<HorizontalNavPopper
|
||||
v-if="canViewNavMenuGroup(item)"
|
||||
:is-rtl="configStore.isAppRTL"
|
||||
class="nav-group"
|
||||
tag="li"
|
||||
content-container-tag="ul"
|
||||
:class="[{
|
||||
'active': isGroupActive,
|
||||
'children-at-end': childrenAtEnd,
|
||||
'sub-item': isSubItem,
|
||||
'disabled': item.disable,
|
||||
}]"
|
||||
:popper-inline-end="childrenAtEnd"
|
||||
>
|
||||
<div class="nav-group-label">
|
||||
<Component
|
||||
:is="layoutConfig.app.iconRenderer || 'div'"
|
||||
class="nav-item-icon"
|
||||
v-bind="item.icon || layoutConfig.verticalNav.defaultNavItemIconProps"
|
||||
/>
|
||||
<Component
|
||||
:is="layoutConfig.app.i18n.enable ? 'i18n-t' : 'span'"
|
||||
v-bind="getDynamicI18nProps(item.title, 'span')"
|
||||
class="nav-item-title"
|
||||
>
|
||||
{{ item.title }}
|
||||
</Component>
|
||||
<Component
|
||||
v-bind="layoutConfig.icons.chevronDown"
|
||||
:is="layoutConfig.app.iconRenderer || 'div'"
|
||||
class="nav-group-arrow"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<template #content>
|
||||
<Component
|
||||
:is="'children' in child ? 'HorizontalNavGroup' : HorizontalNavLink"
|
||||
v-for="child in item.children"
|
||||
:key="child.title"
|
||||
:item="child"
|
||||
children-at-end
|
||||
is-sub-item
|
||||
/>
|
||||
</template>
|
||||
</HorizontalNavPopper>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.layout-horizontal-nav {
|
||||
.nav-group {
|
||||
.nav-group-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.popper-content {
|
||||
z-index: 1;
|
||||
|
||||
> div {
|
||||
overflow: hidden auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
153
resources/js/@layouts/components/HorizontalNavLayout.vue
Normal file
153
resources/js/@layouts/components/HorizontalNavLayout.vue
Normal file
@@ -0,0 +1,153 @@
|
||||
<script setup>
|
||||
import { HorizontalNav } from '@layouts/components'
|
||||
|
||||
// ℹ️ Using import from `@layouts` causing build to hangup
|
||||
|
||||
// import { useLayouts } from '@layouts'
|
||||
import { useLayoutConfigStore } from '@layouts/stores/config'
|
||||
|
||||
const props = defineProps({
|
||||
navItems: {
|
||||
type: null,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const configStore = useLayoutConfigStore()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="layout-wrapper"
|
||||
:class="configStore._layoutClasses"
|
||||
>
|
||||
<div
|
||||
class="layout-navbar-and-nav-container"
|
||||
:class="configStore.isNavbarBlurEnabled && 'header-blur'"
|
||||
>
|
||||
<!-- 👉 Navbar -->
|
||||
<div class="layout-navbar">
|
||||
<div class="navbar-content-container">
|
||||
<slot name="navbar" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- 👉 Navigation -->
|
||||
<div class="layout-horizontal-nav">
|
||||
<div class="horizontal-nav-content-container">
|
||||
<HorizontalNav :nav-items="navItems" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<main class="layout-page-content">
|
||||
<slot />
|
||||
</main>
|
||||
|
||||
<!-- 👉 Footer -->
|
||||
<footer class="layout-footer">
|
||||
<div class="footer-content-container">
|
||||
<slot name="footer" />
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
@use "@configured-variables" as variables;
|
||||
@use "@layouts/styles/placeholders";
|
||||
@use "@layouts/styles/mixins";
|
||||
|
||||
.layout-wrapper {
|
||||
&.layout-nav-type-horizontal {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
// // TODO(v2): Check why we need height in vertical nav & min-height in horizontal nav
|
||||
// min-height: 100%;
|
||||
min-block-size: 100dvh;
|
||||
|
||||
.layout-navbar-and-nav-container {
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.layout-navbar {
|
||||
z-index: variables.$layout-horizontal-nav-layout-navbar-z-index;
|
||||
block-size: variables.$layout-horizontal-nav-navbar-height;
|
||||
|
||||
// ℹ️ For now we are not independently managing navbar and horizontal nav so we won't use below style to avoid conflicting with combo style of navbar and horizontal nav
|
||||
// If we add independent style of navbar & horizontal nav then we have to add :not for avoiding conflict with combo styles
|
||||
// .layout-navbar-sticky & {
|
||||
// @extend %layout-navbar-sticky;
|
||||
// }
|
||||
|
||||
// ℹ️ For now we are not independently managing navbar and horizontal nav so we won't use below style to avoid conflicting with combo style of navbar and horizontal nav
|
||||
// If we add independent style of navbar & horizontal nav then we have to add :not for avoiding conflict with combo styles
|
||||
// .layout-navbar-hidden & {
|
||||
// @extend %layout-navbar-hidden;
|
||||
// }
|
||||
}
|
||||
|
||||
// 👉 Navbar
|
||||
.navbar-content-container {
|
||||
@include mixins.boxed-content;
|
||||
}
|
||||
|
||||
// 👉 Content height fixed
|
||||
&.layout-content-height-fixed {
|
||||
max-block-size: 100dvh;
|
||||
|
||||
.layout-page-content {
|
||||
overflow: hidden;
|
||||
|
||||
> :first-child {
|
||||
max-block-size: 100%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 👉 Footer
|
||||
// Boxed content
|
||||
.layout-footer {
|
||||
.footer-content-container {
|
||||
@include mixins.boxed-content;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If both navbar & horizontal nav sticky
|
||||
&.layout-navbar-sticky.horizontal-nav-sticky {
|
||||
.layout-navbar-and-nav-container {
|
||||
position: sticky;
|
||||
inset-block-start: 0;
|
||||
will-change: transform;
|
||||
}
|
||||
}
|
||||
|
||||
&.layout-navbar-hidden.horizontal-nav-hidden {
|
||||
.layout-navbar-and-nav-container {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 👉 Horizontal nav nav
|
||||
.layout-horizontal-nav {
|
||||
z-index: variables.$layout-horizontal-nav-z-index;
|
||||
|
||||
// .horizontal-nav-sticky & {
|
||||
// width: 100%;
|
||||
// will-change: transform;
|
||||
// position: sticky;
|
||||
// top: 0;
|
||||
// }
|
||||
|
||||
// .horizontal-nav-hidden & {
|
||||
// display: none;
|
||||
// }
|
||||
|
||||
.horizontal-nav-content-container {
|
||||
@include mixins.boxed-content(true);
|
||||
}
|
||||
}
|
||||
</style>
|
60
resources/js/@layouts/components/HorizontalNavLink.vue
Normal file
60
resources/js/@layouts/components/HorizontalNavLink.vue
Normal file
@@ -0,0 +1,60 @@
|
||||
<script setup>
|
||||
import { layoutConfig } from '@layouts'
|
||||
import { can } from '@layouts/plugins/casl'
|
||||
import {
|
||||
getComputedNavLinkToProp,
|
||||
getDynamicI18nProps,
|
||||
isNavLinkActive,
|
||||
} from '@layouts/utils'
|
||||
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: null,
|
||||
required: true,
|
||||
},
|
||||
isSubItem: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<li
|
||||
v-if="can(item.action, item.subject)"
|
||||
class="nav-link"
|
||||
:class="[{
|
||||
'sub-item': props.isSubItem,
|
||||
'disabled': item.disable,
|
||||
}]"
|
||||
>
|
||||
<Component
|
||||
:is="item.to ? 'RouterLink' : 'a'"
|
||||
v-bind="getComputedNavLinkToProp(item)"
|
||||
:class="{ 'router-link-active router-link-exact-active': isNavLinkActive(item, $router) }"
|
||||
>
|
||||
<Component
|
||||
:is="layoutConfig.app.iconRenderer || 'div'"
|
||||
class="nav-item-icon"
|
||||
v-bind="item.icon || layoutConfig.verticalNav.defaultNavItemIconProps"
|
||||
/>
|
||||
<Component
|
||||
:is="layoutConfig.app.i18n.enable ? 'i18n-t' : 'span'"
|
||||
class="nav-item-title"
|
||||
v-bind="getDynamicI18nProps(item.title, 'span')"
|
||||
>
|
||||
{{ item.title }}
|
||||
</Component>
|
||||
</Component>
|
||||
</li>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.layout-horizontal-nav {
|
||||
.nav-link a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
</style>
|
208
resources/js/@layouts/components/HorizontalNavPopper.vue
Normal file
208
resources/js/@layouts/components/HorizontalNavPopper.vue
Normal file
@@ -0,0 +1,208 @@
|
||||
<script setup>
|
||||
import {
|
||||
computePosition,
|
||||
flip,
|
||||
offset,
|
||||
shift,
|
||||
} from '@floating-ui/dom'
|
||||
import { useLayoutConfigStore } from '@layouts/stores/config'
|
||||
import { themeConfig } from '@themeConfig'
|
||||
|
||||
const props = defineProps({
|
||||
popperInlineEnd: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
tag: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: 'div',
|
||||
},
|
||||
contentContainerTag: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: 'div',
|
||||
},
|
||||
isRtl: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
},
|
||||
})
|
||||
|
||||
const configStore = useLayoutConfigStore()
|
||||
const refPopperContainer = ref()
|
||||
const refPopper = ref()
|
||||
|
||||
const popperContentStyles = ref({
|
||||
left: '0px',
|
||||
top: '0px',
|
||||
|
||||
/*ℹ️ Why we are not using fixed positioning?
|
||||
|
||||
`position: fixed` doesn't work as expected when some CSS properties like `transform` is applied on its parent element.
|
||||
Docs: https://developer.mozilla.org/en-US/docs/Web/CSS/position#values <= See `fixed` value description
|
||||
|
||||
Hence, when we use transitions where transition apply `transform` on its parent element, fixed positioning will not work.
|
||||
(Popper content moves away from the element when parent element transition)
|
||||
|
||||
To avoid this, we use `position: absolute` instead of `position: fixed`.
|
||||
|
||||
NOTE: This issue starts from third level children (Top Level > Sub item > Sub item).
|
||||
*/
|
||||
|
||||
// strategy: 'fixed',
|
||||
})
|
||||
|
||||
const updatePopper = async () => {
|
||||
if (refPopperContainer.value !== undefined && refPopper.value !== undefined) {
|
||||
const { x, y } = await computePosition(refPopperContainer.value, refPopper.value, {
|
||||
placement: props.popperInlineEnd ? props.isRtl ? 'left-start' : 'right-start' : 'bottom-start',
|
||||
middleware: [
|
||||
...configStore.horizontalNavPopoverOffset ? [offset(configStore.horizontalNavPopoverOffset)] : [],
|
||||
flip({ boundary: document.querySelector('body') }),
|
||||
shift({ boundary: document.querySelector('body') }),
|
||||
],
|
||||
|
||||
/*ℹ️ Why we are not using fixed positioning?
|
||||
|
||||
`position: fixed` doesn't work as expected when some CSS properties like `transform` is applied on its parent element.
|
||||
Docs: https://developer.mozilla.org/en-US/docs/Web/CSS/position#values <= See `fixed` value description
|
||||
|
||||
Hence, when we use transitions where transition apply `transform` on its parent element, fixed positioning will not work.
|
||||
(Popper content moves away from the element when parent element transition)
|
||||
|
||||
To avoid this, we use `position: absolute` instead of `position: fixed`.
|
||||
|
||||
NOTE: This issue starts from third level children (Top Level > Sub item > Sub item).
|
||||
*/
|
||||
|
||||
// strategy: 'fixed',
|
||||
})
|
||||
|
||||
popperContentStyles.value.left = `${ x }px`
|
||||
popperContentStyles.value.top = `${ y }px`
|
||||
}
|
||||
}
|
||||
|
||||
until(() => configStore.horizontalNavType).toMatch(type => type === 'static').then(() => {
|
||||
useEventListener('scroll', updatePopper)
|
||||
|
||||
/*ℹ️ Why we are not using fixed positioning?
|
||||
|
||||
`position: fixed` doesn't work as expected when some CSS properties like `transform` is applied on its parent element.
|
||||
Docs: https://developer.mozilla.org/en-US/docs/Web/CSS/position#values <= See `fixed` value description
|
||||
|
||||
Hence, when we use transitions where transition apply `transform` on its parent element, fixed positioning will not work.
|
||||
(Popper content moves away from the element when parent element transition)
|
||||
|
||||
To avoid this, we use `position: absolute` instead of `position: fixed`.
|
||||
|
||||
NOTE: This issue starts from third level children (Top Level > Sub item > Sub item).
|
||||
*/
|
||||
|
||||
// strategy: 'fixed',
|
||||
})
|
||||
|
||||
const isContentShown = ref(false)
|
||||
|
||||
const showContent = () => {
|
||||
isContentShown.value = true
|
||||
updatePopper()
|
||||
}
|
||||
|
||||
const hideContent = () => {
|
||||
isContentShown.value = false
|
||||
}
|
||||
|
||||
onMounted(updatePopper)
|
||||
|
||||
// ℹ️ Recalculate popper position when it's triggerer changes its position
|
||||
watch([
|
||||
() => configStore.isAppRTL,
|
||||
() => configStore.appContentWidth,
|
||||
], updatePopper)
|
||||
|
||||
// Watch for route changes and close popper content if route is changed
|
||||
const route = useRoute()
|
||||
|
||||
watch(() => route.fullPath, hideContent)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="nav-popper"
|
||||
:class="[{
|
||||
'popper-inline-end': popperInlineEnd,
|
||||
'show-content': isContentShown,
|
||||
}]"
|
||||
>
|
||||
<div
|
||||
ref="refPopperContainer"
|
||||
class="popper-triggerer"
|
||||
@mouseenter="showContent"
|
||||
@mouseleave="hideContent"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
<!-- SECTION Popper Content -->
|
||||
<!-- 👉 Without transition -->
|
||||
<template v-if="!themeConfig.horizontalNav.transition">
|
||||
<div
|
||||
ref="refPopper"
|
||||
class="popper-content"
|
||||
:style="popperContentStyles"
|
||||
@mouseenter="showContent"
|
||||
@mouseleave="hideContent"
|
||||
>
|
||||
<div>
|
||||
<slot name="content" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 👉 CSS Transition -->
|
||||
<template v-else-if="typeof themeConfig.horizontalNav.transition === 'string'">
|
||||
<Transition :name="themeConfig.horizontalNav.transition">
|
||||
<div
|
||||
v-show="isContentShown"
|
||||
ref="refPopper"
|
||||
class="popper-content"
|
||||
:style="popperContentStyles"
|
||||
@mouseenter="showContent"
|
||||
@mouseleave="hideContent"
|
||||
>
|
||||
<div>
|
||||
<slot name="content" />
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</template>
|
||||
|
||||
<!-- 👉 Transition Component -->
|
||||
<template v-else>
|
||||
<Component :is="themeConfig.horizontalNav.transition">
|
||||
<div
|
||||
v-show="isContentShown"
|
||||
ref="refPopper"
|
||||
class="popper-content"
|
||||
:style="popperContentStyles"
|
||||
@mouseenter="showContent"
|
||||
@mouseleave="hideContent"
|
||||
>
|
||||
<div>
|
||||
<slot name="content" />
|
||||
</div>
|
||||
</div>
|
||||
</Component>
|
||||
</template>
|
||||
<!-- !SECTION -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.popper-content {
|
||||
position: absolute;
|
||||
}
|
||||
</style>
|
87
resources/js/@layouts/components/TransitionExpand.vue
Normal file
87
resources/js/@layouts/components/TransitionExpand.vue
Normal file
@@ -0,0 +1,87 @@
|
||||
<!-- Thanks: https://markus.oberlehner.net/blog/transition-to-height-auto-with-vue/ -->
|
||||
|
||||
<script>
|
||||
import { Transition } from 'vue'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'TransitionExpand',
|
||||
setup(_, { slots }) {
|
||||
const onEnter = element => {
|
||||
const width = getComputedStyle(element).width
|
||||
|
||||
element.style.width = width
|
||||
element.style.position = 'absolute'
|
||||
element.style.visibility = 'hidden'
|
||||
element.style.height = 'auto'
|
||||
|
||||
const height = getComputedStyle(element).height
|
||||
|
||||
element.style.width = ''
|
||||
element.style.position = ''
|
||||
element.style.visibility = ''
|
||||
element.style.height = '0px'
|
||||
|
||||
// Force repaint to make sure the
|
||||
// animation is triggered correctly.
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
getComputedStyle(element).height
|
||||
|
||||
// Trigger the animation.
|
||||
// We use `requestAnimationFrame` because we need
|
||||
// to make sure the browser has finished
|
||||
// painting after setting the `height`
|
||||
// to `0` in the line above.
|
||||
requestAnimationFrame(() => {
|
||||
element.style.height = height
|
||||
})
|
||||
}
|
||||
|
||||
const onAfterEnter = element => {
|
||||
element.style.height = 'auto'
|
||||
}
|
||||
|
||||
const onLeave = element => {
|
||||
const height = getComputedStyle(element).height
|
||||
|
||||
element.style.height = height
|
||||
|
||||
// Force repaint to make sure the
|
||||
// animation is triggered correctly.
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
getComputedStyle(element).height
|
||||
requestAnimationFrame(() => {
|
||||
element.style.height = '0px'
|
||||
})
|
||||
}
|
||||
|
||||
return () => h(h(Transition), {
|
||||
name: 'expand',
|
||||
onEnter,
|
||||
onAfterEnter,
|
||||
onLeave,
|
||||
}, () => slots.default?.())
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.expand-enter-active,
|
||||
.expand-leave-active {
|
||||
overflow: hidden;
|
||||
transition: block-size var(--expand-transition-duration, 0.25s) ease;
|
||||
}
|
||||
|
||||
.expand-enter-from,
|
||||
.expand-leave-to {
|
||||
block-size: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style scoped>
|
||||
* {
|
||||
backface-visibility: hidden;
|
||||
perspective: 1000px;
|
||||
transform: translateZ(0);
|
||||
will-change: block-size;
|
||||
}
|
||||
</style>
|
12
resources/js/@layouts/components/VNodeRenderer.jsx
Normal file
12
resources/js/@layouts/components/VNodeRenderer.jsx
Normal file
@@ -0,0 +1,12 @@
|
||||
export const VNodeRenderer = defineComponent({
|
||||
name: 'VNodeRenderer',
|
||||
props: {
|
||||
nodes: {
|
||||
type: [Array, Object],
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
return () => props.nodes
|
||||
},
|
||||
})
|
330
resources/js/@layouts/components/VerticalNav.vue
Normal file
330
resources/js/@layouts/components/VerticalNav.vue
Normal file
@@ -0,0 +1,330 @@
|
||||
<script setup>
|
||||
import { useAbility } from '@casl/vue'
|
||||
import { layoutConfig } from '@layouts'
|
||||
import {
|
||||
VerticalNavGroup,
|
||||
VerticalNavLink,
|
||||
VerticalNavSectionTitle,
|
||||
} from '@layouts/components'
|
||||
import VerticalNavDropdown from '@layouts/components/VerticalNavDropdown.vue'
|
||||
import { useLayoutConfigStore } from '@layouts/stores/config'
|
||||
import { injectionKeyIsVerticalNavHovered } from '@layouts/symbols'
|
||||
|
||||
import { PerfectScrollbar } from 'vue3-perfect-scrollbar'
|
||||
import { useStore } from 'vuex'
|
||||
import { VNodeRenderer } from './VNodeRenderer'
|
||||
const store = useStore();
|
||||
const router = useRouter()
|
||||
const ability = useAbility()
|
||||
const props = defineProps({
|
||||
tag: {
|
||||
type: null,
|
||||
required: false,
|
||||
default: 'aside',
|
||||
},
|
||||
navItems: {
|
||||
type: null,
|
||||
required: true,
|
||||
},
|
||||
isOverlayNavActive: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
toggleIsOverlayNavActive: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const refNav = ref()
|
||||
const isHovered = useElementHover(refNav)
|
||||
const permissions = ref()
|
||||
provide(injectionKeyIsVerticalNavHovered, isHovered)
|
||||
|
||||
const configStore = useLayoutConfigStore()
|
||||
|
||||
const resolveNavItemComponent = item => {
|
||||
if ('heading' in item)
|
||||
return VerticalNavSectionTitle
|
||||
if ('children' in item && item.isDropdownButton)
|
||||
return VerticalNavDropdown
|
||||
if ('children' in item)
|
||||
return VerticalNavGroup
|
||||
return VerticalNavLink
|
||||
|
||||
}
|
||||
|
||||
/*ℹ️ Close overlay side when route is changed
|
||||
Close overlay vertical nav when link is clicked
|
||||
*/
|
||||
const route = useRoute()
|
||||
|
||||
watch(() => route.name, async () => {
|
||||
|
||||
|
||||
await store.dispatch('checkLogin')
|
||||
const isLoggedIn = await store.getters.getCheckLoginExpire
|
||||
console.log('check login', isLoggedIn)
|
||||
permissions.value = store.getters.getPermissionUser
|
||||
|
||||
const userAbilities = transformPermissions(store.getters.getPermissionUser);
|
||||
console.log('userAbilityRules cookie', userAbilities);
|
||||
localStorage.setItem('userAbilityRules',JSON.stringify(userAbilities))
|
||||
ability.update(userAbilities);
|
||||
console.log('userAbilityRules cookie', useCookie('userAbilityRules').value);
|
||||
|
||||
if (isLoggedIn) {
|
||||
await store.dispatch('updateCheckToken',false)
|
||||
|
||||
// Redirect to login page or perform any other action
|
||||
useCookie('accessToken').value = null
|
||||
|
||||
localStorage.removeItem('admin_access_token');
|
||||
useCookie('userAbilityRules').value = null
|
||||
ability.update([])
|
||||
router.push({ name: 'login' })
|
||||
}
|
||||
|
||||
props.toggleIsOverlayNavActive(false)
|
||||
})
|
||||
const transformPermissions = (permissionsData) => {
|
||||
const transformedPermissions = [];
|
||||
|
||||
const processPermissions = (permissions) => {
|
||||
for (const permission of permissions) {
|
||||
if (permission.ability === true) {
|
||||
transformedPermissions.push({
|
||||
action: 'read', // Adjust based on your permission model
|
||||
subject: permission.text,
|
||||
});
|
||||
}
|
||||
|
||||
if (permission.children) {
|
||||
for (const child of permission.children) {
|
||||
if (child.ability === true) {
|
||||
transformedPermissions.push({
|
||||
action: 'read', // Adjust based on your permission model
|
||||
subject: child.text,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
for (const group of permissionsData) {
|
||||
processPermissions(group.permissions);
|
||||
}
|
||||
|
||||
return transformedPermissions;
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
await store.dispatch('checkLogin')
|
||||
const isLoggedIn = await store.getters.getCheckLoginExpire
|
||||
console.log('check login', isLoggedIn)
|
||||
permissions.value = store.getters.getPermissionUser
|
||||
const userAbilities = transformPermissions(store.getters.getPermissionUser);
|
||||
console.log('userAbilityRules cookie', userAbilities);
|
||||
localStorage.setItem('userAbilityRules',JSON.stringify(userAbilities))
|
||||
ability.update(userAbilities);
|
||||
console.log('ability', ability);
|
||||
console.log('userAbilityRules cookie', useCookie('userAbilityRules').value);
|
||||
|
||||
})
|
||||
const isVerticalNavScrolled = ref(false)
|
||||
const updateIsVerticalNavScrolled = val => isVerticalNavScrolled.value = val
|
||||
|
||||
const handleNavScroll = evt => {
|
||||
isVerticalNavScrolled.value = evt.target.scrollTop > 0
|
||||
}
|
||||
|
||||
const hideTitleAndIcon = configStore.isVerticalNavMini(isHovered)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Component
|
||||
:is="props.tag"
|
||||
ref="refNav"
|
||||
class="layout-vertical-nav"
|
||||
:class="[
|
||||
{
|
||||
'overlay-nav': configStore.isLessThanOverlayNavBreakpoint,
|
||||
'hovered': isHovered,
|
||||
'visible': isOverlayNavActive,
|
||||
'scrolled': isVerticalNavScrolled,
|
||||
},
|
||||
]"
|
||||
>
|
||||
<!-- 👉 Header -->
|
||||
<div class="nav-header">
|
||||
<slot name="nav-header">
|
||||
<RouterLink
|
||||
to="/"
|
||||
class="app-logo app-title-wrapper"
|
||||
>
|
||||
<VNodeRenderer :nodes="layoutConfig.app.logo" />
|
||||
|
||||
<Transition name="vertical-nav-app-title">
|
||||
<h1
|
||||
v-show="!hideTitleAndIcon"
|
||||
class="app-logo-title leading-normal"
|
||||
>
|
||||
{{ layoutConfig.app.title }}
|
||||
</h1>
|
||||
</Transition>
|
||||
</RouterLink>
|
||||
<!-- 👉 Vertical nav actions -->
|
||||
<!-- Show toggle collapsible in >md and close button in <md -->
|
||||
<Component
|
||||
:is="layoutConfig.app.iconRenderer || 'div'"
|
||||
v-show="configStore.isVerticalNavCollapsed"
|
||||
class="header-action d-none nav-unpin"
|
||||
:class="configStore.isVerticalNavCollapsed && 'd-lg-block'"
|
||||
v-bind="layoutConfig.icons.verticalNavUnPinned"
|
||||
@click="configStore.isVerticalNavCollapsed = !configStore.isVerticalNavCollapsed"
|
||||
/>
|
||||
<Component
|
||||
:is="layoutConfig.app.iconRenderer || 'div'"
|
||||
v-show="!configStore.isVerticalNavCollapsed"
|
||||
class="header-action d-none nav-pin"
|
||||
:class="!configStore.isVerticalNavCollapsed && 'd-lg-block'"
|
||||
v-bind="layoutConfig.icons.verticalNavPinned"
|
||||
@click="configStore.isVerticalNavCollapsed = !configStore.isVerticalNavCollapsed"
|
||||
/>
|
||||
<Component
|
||||
:is="layoutConfig.app.iconRenderer || 'div'"
|
||||
class="header-action d-lg-none"
|
||||
v-bind="layoutConfig.icons.close"
|
||||
@click="toggleIsOverlayNavActive(false)"
|
||||
/>
|
||||
</slot>
|
||||
</div>
|
||||
<slot name="before-nav-items">
|
||||
<div class="vertical-nav-items-shadow" />
|
||||
</slot>
|
||||
<slot
|
||||
name="nav-items"
|
||||
:update-is-vertical-nav-scrolled="updateIsVerticalNavScrolled"
|
||||
>
|
||||
<PerfectScrollbar
|
||||
:key="configStore.isAppRTL"
|
||||
tag="ul"
|
||||
class="nav-items"
|
||||
:options="{ wheelPropagation: false }"
|
||||
@ps-scroll-y="handleNavScroll"
|
||||
>
|
||||
<Component
|
||||
:is="resolveNavItemComponent(item)"
|
||||
v-for="(item, index) in navItems"
|
||||
:key="index"
|
||||
:item="item"
|
||||
/>
|
||||
</PerfectScrollbar>
|
||||
</slot>
|
||||
|
||||
<slot name="after-nav-items" />
|
||||
</Component>
|
||||
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-logo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
column-gap: 0.75rem;
|
||||
|
||||
.app-logo-title {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 600;
|
||||
line-height: 1.75rem;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
@use "@configured-variables" as variables;
|
||||
@use "@layouts/styles/mixins";
|
||||
|
||||
// 👉 Vertical Nav
|
||||
.layout-vertical-nav {
|
||||
position: fixed;
|
||||
z-index: variables.$layout-vertical-nav-z-index;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
block-size: 100%;
|
||||
inline-size: variables.$layout-vertical-nav-width;
|
||||
inset-block-start: 0;
|
||||
inset-inline-start: 0;
|
||||
transition: inline-size 0.25s ease-in-out, box-shadow 0.25s ease-in-out;
|
||||
will-change: transform, inline-size;
|
||||
|
||||
.nav-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.header-action {
|
||||
cursor: pointer;
|
||||
|
||||
@at-root {
|
||||
#{variables.$selector-vertical-nav-mini} .nav-header .header-action {
|
||||
&.nav-pin,
|
||||
&.nav-unpin {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.app-title-wrapper {
|
||||
margin-inline-end: auto;
|
||||
}
|
||||
|
||||
.nav-items {
|
||||
block-size: 100%;
|
||||
|
||||
// ℹ️ We no loner needs this overflow styles as perfect scrollbar applies it
|
||||
// overflow-x: hidden;
|
||||
|
||||
// // ℹ️ We used `overflow-y` instead of `overflow` to mitigate overflow x. Revert back if any issue found.
|
||||
// overflow-y: auto;
|
||||
}
|
||||
|
||||
.nav-item-title {
|
||||
overflow: hidden;
|
||||
margin-inline-end: auto;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
// 👉 Collapsed
|
||||
.layout-vertical-nav-collapsed & {
|
||||
&:not(.hovered) {
|
||||
inline-size: variables.$layout-vertical-nav-collapsed-width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Small screen vertical nav transition
|
||||
@media (max-width:1279px) {
|
||||
.layout-vertical-nav {
|
||||
&:not(.visible) {
|
||||
transform: translateX(-#{variables.$layout-vertical-nav-width});
|
||||
|
||||
@include mixins.rtl {
|
||||
transform: translateX(variables.$layout-vertical-nav-width);
|
||||
}
|
||||
}
|
||||
|
||||
transition: transform 0.25s ease-in-out;
|
||||
}
|
||||
}
|
||||
.v-icon {
|
||||
margin-right: 8px; /* Adds space between the icon and the text */
|
||||
}
|
||||
.list-item-reset a {
|
||||
color: rgb(46,38,61) !important;
|
||||
}
|
||||
</style>
|
97
resources/js/@layouts/components/VerticalNavDropdown.vue
Normal file
97
resources/js/@layouts/components/VerticalNavDropdown.vue
Normal file
@@ -0,0 +1,97 @@
|
||||
<template>
|
||||
<li class="nav-item" :class="item.class?item.class:''">
|
||||
|
||||
<div class="demo-space-x">
|
||||
<VMenu transition="scale-transition">
|
||||
<template #activator="{ props }">
|
||||
<Component
|
||||
:is="itemIcon(item)"
|
||||
v-if="!hideTitleAndIcon && item.icon"
|
||||
:class="itemIconClass(item)"
|
||||
/>
|
||||
<VBtn v-bind="props" block variant="text"
|
||||
color="rgb(46,38,61)">
|
||||
<VIcon v-if="item.icon" :icon="item.icon.icon" class="mr-2" size="20"/>{{ item.title }}
|
||||
</VBtn>
|
||||
</template>
|
||||
|
||||
<VList class="list-reset">
|
||||
<VListItem
|
||||
v-for="(child, index) in item.children"
|
||||
:key="index"
|
||||
class="list-item-reset"
|
||||
>
|
||||
|
||||
<VerticalNavLink :item="child" :hideTitleAndIcon="hideTitleAndIcon" />
|
||||
</VListItem>
|
||||
</VList>
|
||||
</VMenu>
|
||||
</div>
|
||||
</li>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup>
|
||||
import VerticalNavLink from './VerticalNavLink.vue';
|
||||
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
hideTitleAndIcon: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
hideMarker: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
})
|
||||
|
||||
const itemIcon = (item) => {
|
||||
return item.icon.icon ? item.icon.icon : ''
|
||||
}
|
||||
|
||||
const itemIconClass = (item) => {
|
||||
return item.icon ? item.icon.class : ''
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.nav-item {
|
||||
list-style-type: none; /* Removes default list styling */
|
||||
padding: 0; /* Removes default padding */
|
||||
}
|
||||
|
||||
.list-reset {
|
||||
list-style: none; /* Removes bullets or numbers from the list */
|
||||
padding: 0; /* Removes default padding */
|
||||
margin: 0; /* Removes default margin */
|
||||
}
|
||||
|
||||
.list-item-reset {
|
||||
list-style: none; /* Ensures each list item has no bullets or numbers */
|
||||
padding: 0; /* Removes default padding */
|
||||
margin: 0; /* Removes default margin */
|
||||
}
|
||||
|
||||
.nav-item > .v-menu {
|
||||
width: 100%; /* Ensures the menu takes the full width */
|
||||
}
|
||||
|
||||
.v-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.bottom-end {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
bottom: 20px;
|
||||
padding-inline: 18px;
|
||||
|
||||
}
|
||||
|
||||
</style>
|
218
resources/js/@layouts/components/VerticalNavGroup.vue
Normal file
218
resources/js/@layouts/components/VerticalNavGroup.vue
Normal file
@@ -0,0 +1,218 @@
|
||||
<script setup>
|
||||
import { TransitionGroup } from 'vue'
|
||||
import { layoutConfig } from '@layouts'
|
||||
import {
|
||||
TransitionExpand,
|
||||
VerticalNavLink,
|
||||
} from '@layouts/components'
|
||||
import { canViewNavMenuGroup } from '@layouts/plugins/casl'
|
||||
import { useLayoutConfigStore } from '@layouts/stores/config'
|
||||
import { injectionKeyIsVerticalNavHovered } from '@layouts/symbols'
|
||||
import {
|
||||
getDynamicI18nProps,
|
||||
isNavGroupActive,
|
||||
openGroups,
|
||||
} from '@layouts/utils'
|
||||
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: null,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
defineOptions({
|
||||
name: 'VerticalNavGroup',
|
||||
})
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const configStore = useLayoutConfigStore()
|
||||
const hideTitleAndBadge = configStore.isVerticalNavMini()
|
||||
|
||||
/*ℹ️ We provided default value `ref(false)` because inject will return `T | undefined`
|
||||
Docs: https://vuejs.org/api/composition-api-dependency-injection.html#inject
|
||||
*/
|
||||
const isVerticalNavHovered = inject(injectionKeyIsVerticalNavHovered, ref(false))
|
||||
|
||||
// isGroupOpen.value = value ? false : isGroupActive.value
|
||||
|
||||
// })
|
||||
const isGroupActive = ref(false)
|
||||
const isGroupOpen = ref(false)
|
||||
|
||||
const isAnyChildOpen = children => {
|
||||
return children.some(child => {
|
||||
let result = openGroups.value.includes(child.title)
|
||||
if ('children' in child)
|
||||
result = isAnyChildOpen(child.children) || result
|
||||
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
const collapseChildren = children => {
|
||||
children.forEach(child => {
|
||||
if ('children' in child)
|
||||
collapseChildren(child.children)
|
||||
openGroups.value = openGroups.value.filter(group => group !== child.title)
|
||||
})
|
||||
}
|
||||
|
||||
/*Watch for route changes, more specifically route path. Do note that this won't trigger if route's query is updated.
|
||||
|
||||
updates isActive & isOpen based on active state of group.
|
||||
*/
|
||||
watch(() => route.path, () => {
|
||||
const isActive = isNavGroupActive(props.item.children, router)
|
||||
|
||||
// Don't open group if vertical nav is collapsed and window size is more than overlay nav breakpoint
|
||||
isGroupOpen.value = isActive && !configStore.isVerticalNavMini(isVerticalNavHovered).value
|
||||
isGroupActive.value = isActive
|
||||
}, { immediate: true })
|
||||
watch(isGroupOpen, val => {
|
||||
|
||||
// Find group index for adding/removing group from openGroups array
|
||||
const grpIndex = openGroups.value.indexOf(props.item.title)
|
||||
|
||||
// update openGroups array for addition/removal of current group
|
||||
|
||||
// If group is opened => Add it to `openGroups` array
|
||||
if (val && grpIndex === -1) {
|
||||
openGroups.value.push(props.item.title)
|
||||
} else if (!val && grpIndex !== -1) {
|
||||
openGroups.value.splice(grpIndex, 1)
|
||||
collapseChildren(props.item.children)
|
||||
}
|
||||
}, { immediate: true })
|
||||
|
||||
/*Watch for openGroups
|
||||
|
||||
It will help in making vertical nav adapting the behavior of accordion.
|
||||
If we open multiple groups without navigating to any route we must close the inactive or temporarily opened groups.
|
||||
|
||||
😵💫 Gotchas:
|
||||
* If we open inactive group then it will auto close that group because we close groups based on active state.
|
||||
Goal of this watcher is auto close groups which are not active when openGroups array is updated.
|
||||
So, we have to find a way to do not close recently opened inactive group.
|
||||
For this we will fetch recently added group in openGroups array and won't perform closing operation if recently added group is current group
|
||||
*/
|
||||
watch(openGroups, val => {
|
||||
|
||||
// Prevent closing recently opened inactive group.
|
||||
const lastOpenedGroup = val.at(-1)
|
||||
if (lastOpenedGroup === props.item.title)
|
||||
return
|
||||
const isActive = isNavGroupActive(props.item.children, router)
|
||||
|
||||
// Goal of this watcher is to close inactive groups. So don't do anything for active groups.
|
||||
if (isActive)
|
||||
return
|
||||
|
||||
// We won't close group if any of child group is open in current group
|
||||
if (isAnyChildOpen(props.item.children))
|
||||
return
|
||||
isGroupOpen.value = isActive
|
||||
isGroupActive.value = isActive
|
||||
}, { deep: true })
|
||||
|
||||
// ℹ️ Previously instead of below watcher we were using two individual watcher for `isVerticalNavHovered`, `isVerticalNavCollapsed` & `isLessThanOverlayNavBreakpoint`
|
||||
watch(configStore.isVerticalNavMini(isVerticalNavHovered), val => {
|
||||
isGroupOpen.value = val ? false : isGroupActive.value
|
||||
})
|
||||
|
||||
// isGroupOpen.value = value ? false : isGroupActive.value
|
||||
|
||||
// })
|
||||
const isMounted = useMounted()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<li
|
||||
v-if="canViewNavMenuGroup(item)"
|
||||
class="nav-group"
|
||||
:class="[
|
||||
{
|
||||
active: isGroupActive,
|
||||
open: isGroupOpen,
|
||||
disabled: item.disable,
|
||||
},
|
||||
]"
|
||||
>
|
||||
<div
|
||||
class="nav-group-label"
|
||||
@click="isGroupOpen = !isGroupOpen"
|
||||
>
|
||||
<Component
|
||||
:is="layoutConfig.app.iconRenderer || 'div'"
|
||||
v-bind="item.icon || layoutConfig.verticalNav.defaultNavItemIconProps"
|
||||
class="nav-item-icon"
|
||||
/>
|
||||
<!--
|
||||
ℹ️ isMounted is workaround of nuxt's hydration issue:
|
||||
https://github.com/vuejs/core/issues/6715
|
||||
-->
|
||||
<Component
|
||||
:is="isMounted ? TransitionGroup : 'div'"
|
||||
name="transition-slide-x"
|
||||
v-bind="!isMounted ? { class: 'd-flex align-center flex-grow-1' } : undefined"
|
||||
>
|
||||
<!-- 👉 Title -->
|
||||
<Component
|
||||
:is=" layoutConfig.app.i18n.enable ? 'i18n-t' : 'span'"
|
||||
v-bind="getDynamicI18nProps(item.title, 'span')"
|
||||
v-show="!hideTitleAndBadge"
|
||||
key="title"
|
||||
class="nav-item-title"
|
||||
>
|
||||
{{ item.title }}
|
||||
</Component>
|
||||
|
||||
<!-- 👉 Badge -->
|
||||
<Component
|
||||
:is="layoutConfig.app.i18n.enable ? 'i18n-t' : 'span'"
|
||||
v-bind="getDynamicI18nProps(item.badgeContent, 'span')"
|
||||
v-show="!hideTitleAndBadge"
|
||||
v-if="item.badgeContent"
|
||||
key="badge"
|
||||
class="nav-item-badge"
|
||||
:class="item.badgeClass"
|
||||
>
|
||||
{{ item.badgeContent }}
|
||||
</Component>
|
||||
<Component
|
||||
:is="layoutConfig.app.iconRenderer || 'div'"
|
||||
v-show="!hideTitleAndBadge"
|
||||
v-bind="layoutConfig.icons.chevronRight"
|
||||
key="arrow"
|
||||
class="nav-group-arrow"
|
||||
/>
|
||||
</Component>
|
||||
</div>
|
||||
<TransitionExpand>
|
||||
<ul
|
||||
v-show="isGroupOpen"
|
||||
class="nav-group-children"
|
||||
>
|
||||
<Component
|
||||
:is="'children' in child ? 'VerticalNavGroup' : VerticalNavLink"
|
||||
v-for="child in item.children"
|
||||
:key="child.title"
|
||||
:item="child"
|
||||
/>
|
||||
</ul>
|
||||
</TransitionExpand>
|
||||
</li>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.layout-vertical-nav {
|
||||
.nav-group {
|
||||
&-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
193
resources/js/@layouts/components/VerticalNavLayout.vue
Normal file
193
resources/js/@layouts/components/VerticalNavLayout.vue
Normal file
@@ -0,0 +1,193 @@
|
||||
<script>
|
||||
import { VerticalNav } from '@layouts/components'
|
||||
import { useLayoutConfigStore } from '@layouts/stores/config'
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
navItems: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
verticalNavAttrs: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
setup(props, { slots }) {
|
||||
const { width: windowWidth } = useWindowSize()
|
||||
const configStore = useLayoutConfigStore()
|
||||
const isOverlayNavActive = ref(false)
|
||||
const isLayoutOverlayVisible = ref(false)
|
||||
const toggleIsOverlayNavActive = useToggle(isOverlayNavActive)
|
||||
|
||||
|
||||
// ℹ️ This is alternative to below two commented watcher
|
||||
// We want to show overlay if overlay nav is visible and want to hide overlay if overlay is hidden and vice versa.
|
||||
syncRef(isOverlayNavActive, isLayoutOverlayVisible)
|
||||
|
||||
// watch(isOverlayNavActive, value => {
|
||||
// // Sync layout overlay with overlay nav
|
||||
// isLayoutOverlayVisible.value = value
|
||||
// })
|
||||
// watch(isLayoutOverlayVisible, value => {
|
||||
// // If overlay is closed via click, close hide overlay nav
|
||||
// if (!value) isOverlayNavActive.value = false
|
||||
// })
|
||||
// ℹ️ Hide overlay if user open overlay nav in <md and increase the window width without closing overlay nav
|
||||
watch(windowWidth, () => {
|
||||
if (!configStore.isLessThanOverlayNavBreakpoint && isLayoutOverlayVisible.value)
|
||||
isLayoutOverlayVisible.value = false
|
||||
})
|
||||
|
||||
return () => {
|
||||
const verticalNavAttrs = toRef(props, 'verticalNavAttrs')
|
||||
const { wrapper: verticalNavWrapper, wrapperProps: verticalNavWrapperProps, ...additionalVerticalNavAttrs } = verticalNavAttrs.value
|
||||
|
||||
|
||||
// 👉 Vertical nav
|
||||
const verticalNav = h(VerticalNav, { isOverlayNavActive: isOverlayNavActive.value, toggleIsOverlayNavActive, navItems: props.navItems, ...additionalVerticalNavAttrs }, {
|
||||
'nav-header': () => slots['vertical-nav-header']?.(),
|
||||
'before-nav-items': () => slots['before-vertical-nav-items']?.(),
|
||||
})
|
||||
|
||||
|
||||
// 👉 Navbar
|
||||
const navbar = h('header', { class: ['layout-navbar', { 'navbar-blur': configStore.isNavbarBlurEnabled }] }, [
|
||||
h('div', { class: 'navbar-content-container' }, slots.navbar?.({
|
||||
toggleVerticalOverlayNavActive: toggleIsOverlayNavActive,
|
||||
})),
|
||||
])
|
||||
|
||||
|
||||
// 👉 Content area
|
||||
const main = h('main', { class: 'layout-page-content' }, h('div', { class: 'page-content-container' }, slots.default?.()))
|
||||
|
||||
|
||||
// 👉 Footer
|
||||
const footer = h('footer', { class: 'layout-footer' }, [
|
||||
h('div', { class: 'footer-content-container' }, slots.footer?.()),
|
||||
])
|
||||
|
||||
|
||||
// 👉 Overlay
|
||||
const layoutOverlay = h('div', {
|
||||
class: ['layout-overlay', { visible: isLayoutOverlayVisible.value }],
|
||||
onClick: () => { isLayoutOverlayVisible.value = !isLayoutOverlayVisible.value },
|
||||
})
|
||||
|
||||
return h('div', { class: ['layout-wrapper', ...configStore._layoutClasses] }, [
|
||||
verticalNavWrapper ? h(verticalNavWrapper, verticalNavWrapperProps, { default: () => verticalNav }) : verticalNav,
|
||||
h('div', { class: 'layout-content-wrapper' }, [
|
||||
navbar,
|
||||
main,
|
||||
footer,
|
||||
]),
|
||||
layoutOverlay,
|
||||
])
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@use "@configured-variables" as variables;
|
||||
@use "@layouts/styles/placeholders";
|
||||
@use "@layouts/styles/mixins";
|
||||
|
||||
.layout-wrapper.layout-nav-type-vertical {
|
||||
// TODO(v2): Check why we need height in vertical nav & min-height in horizontal nav
|
||||
block-size: 100%;
|
||||
|
||||
.layout-content-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-grow: 1;
|
||||
min-block-size: 100dvh;
|
||||
transition: padding-inline-start 0.2s ease-in-out;
|
||||
will-change: padding-inline-start;
|
||||
|
||||
@media screen and (min-width: 1280px) {
|
||||
padding-inline-start: variables.$layout-vertical-nav-width;
|
||||
}
|
||||
}
|
||||
|
||||
.layout-navbar {
|
||||
z-index: variables.$layout-vertical-nav-layout-navbar-z-index;
|
||||
|
||||
.navbar-content-container {
|
||||
block-size: variables.$layout-vertical-nav-navbar-height;
|
||||
}
|
||||
|
||||
@at-root {
|
||||
.layout-wrapper.layout-nav-type-vertical {
|
||||
.layout-navbar {
|
||||
@if variables.$layout-vertical-nav-navbar-is-contained {
|
||||
@include mixins.boxed-content;
|
||||
} @else {
|
||||
.navbar-content-container {
|
||||
@include mixins.boxed-content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.layout-navbar-sticky .layout-navbar {
|
||||
@extend %layout-navbar-sticky;
|
||||
}
|
||||
|
||||
&.layout-navbar-hidden .layout-navbar {
|
||||
@extend %layout-navbar-hidden;
|
||||
}
|
||||
|
||||
// 👉 Footer
|
||||
.layout-footer {
|
||||
@include mixins.boxed-content;
|
||||
}
|
||||
|
||||
// 👉 Layout overlay
|
||||
.layout-overlay {
|
||||
position: fixed;
|
||||
z-index: variables.$layout-overlay-z-index;
|
||||
background-color: rgb(0 0 0 / 60%);
|
||||
cursor: pointer;
|
||||
inset: 0;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.25s ease-in-out;
|
||||
will-change: transform;
|
||||
|
||||
&.visible {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
}
|
||||
|
||||
// Adjust right column pl when vertical nav is collapsed
|
||||
&.layout-vertical-nav-collapsed .layout-content-wrapper {
|
||||
padding-inline-start: variables.$layout-vertical-nav-collapsed-width;
|
||||
}
|
||||
|
||||
// 👉 Content height fixed
|
||||
&.layout-content-height-fixed {
|
||||
.layout-content-wrapper {
|
||||
max-block-size: 100dvh;
|
||||
}
|
||||
|
||||
.layout-page-content {
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
|
||||
.page-content-container {
|
||||
inline-size: 100%;
|
||||
|
||||
> :first-child {
|
||||
max-block-size: 100%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
75
resources/js/@layouts/components/VerticalNavLink.vue
Normal file
75
resources/js/@layouts/components/VerticalNavLink.vue
Normal file
@@ -0,0 +1,75 @@
|
||||
<script setup>
|
||||
import { layoutConfig } from '@layouts';
|
||||
import { can } from '@layouts/plugins/casl';
|
||||
import { useLayoutConfigStore } from '@layouts/stores/config';
|
||||
import {
|
||||
getComputedNavLinkToProp,
|
||||
getDynamicI18nProps,
|
||||
isNavLinkActive,
|
||||
} from '@layouts/utils';
|
||||
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: null,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const configStore = useLayoutConfigStore()
|
||||
const hideTitleAndBadge = configStore.isVerticalNavMini()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<li
|
||||
v-if="can(item.action, item.subject)"
|
||||
class="nav-link"
|
||||
:class="{ disabled: item.disable }"
|
||||
>
|
||||
<Component
|
||||
:is="item.to ? 'RouterLink' : 'a'"
|
||||
v-bind="getComputedNavLinkToProp(item)"
|
||||
:class="{ 'router-link-active router-link-exact-active': isNavLinkActive(item, $router) }"
|
||||
|
||||
>
|
||||
<Component
|
||||
:is="layoutConfig.app.iconRenderer || 'div'"
|
||||
v-bind="item.icon || layoutConfig.verticalNav.defaultNavItemIconProps"
|
||||
class="nav-item-icon"
|
||||
/>
|
||||
<TransitionGroup name="transition-slide-x">
|
||||
<!-- 👉 Title -->
|
||||
<Component
|
||||
:is="layoutConfig.app.i18n.enable ? 'i18n-t' : 'span'"
|
||||
v-show="!hideTitleAndBadge"
|
||||
key="title"
|
||||
class="nav-item-title"
|
||||
v-bind="getDynamicI18nProps(item.title, 'span')"
|
||||
>
|
||||
{{ item.title }}
|
||||
</Component>
|
||||
|
||||
<!-- 👉 Badge -->
|
||||
<Component
|
||||
:is="layoutConfig.app.i18n.enable ? 'i18n-t' : 'span'"
|
||||
v-if="item.badgeContent"
|
||||
v-show="!hideTitleAndBadge"
|
||||
key="badge"
|
||||
class="nav-item-badge"
|
||||
:class="item.badgeClass"
|
||||
v-bind="getDynamicI18nProps(item.badgeContent, 'span')"
|
||||
>
|
||||
{{ item.badgeContent }}
|
||||
</Component>
|
||||
</TransitionGroup>
|
||||
</Component>
|
||||
</li>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.layout-vertical-nav {
|
||||
.nav-link a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
</style>
|
39
resources/js/@layouts/components/VerticalNavSectionTitle.vue
Normal file
39
resources/js/@layouts/components/VerticalNavSectionTitle.vue
Normal file
@@ -0,0 +1,39 @@
|
||||
<script setup>
|
||||
import { layoutConfig } from '@layouts'
|
||||
import { can } from '@layouts/plugins/casl'
|
||||
import { useLayoutConfigStore } from '@layouts/stores/config'
|
||||
import { getDynamicI18nProps } from '@layouts/utils'
|
||||
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: null,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const configStore = useLayoutConfigStore()
|
||||
const shallRenderIcon = configStore.isVerticalNavMini()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<li
|
||||
v-if="can(item.action, item.subject)"
|
||||
class="nav-section-title"
|
||||
>
|
||||
<div class="title-wrapper">
|
||||
<Transition
|
||||
name="vertical-nav-section-title"
|
||||
mode="out-in"
|
||||
>
|
||||
<Component
|
||||
:is="shallRenderIcon ? layoutConfig.app.iconRenderer : layoutConfig.app.i18n.enable ? 'i18n-t' : 'span'"
|
||||
:key="shallRenderIcon"
|
||||
:class="shallRenderIcon ? 'placeholder-icon' : 'title-text'"
|
||||
v-bind="{ ...layoutConfig.icons.sectionTitlePlaceholder, ...getDynamicI18nProps(item.heading, 'span') }"
|
||||
>
|
||||
{{ !shallRenderIcon ? item.heading : null }}
|
||||
</Component>
|
||||
</Transition>
|
||||
</div>
|
||||
</li>
|
||||
</template>
|
42
resources/js/@layouts/config.js
Normal file
42
resources/js/@layouts/config.js
Normal file
@@ -0,0 +1,42 @@
|
||||
import { breakpointsVuetify } from '@vueuse/core'
|
||||
import { AppContentLayoutNav, ContentWidth, FooterType, HorizontalNavType, NavbarType } from '@layouts/enums'
|
||||
|
||||
export const layoutConfig = {
|
||||
app: {
|
||||
title: 'my-layout',
|
||||
logo: h('img', { src: '/src/assets/logo.svg' }),
|
||||
contentWidth: ContentWidth.Boxed,
|
||||
contentLayoutNav: AppContentLayoutNav.Vertical,
|
||||
overlayNavFromBreakpoint: breakpointsVuetify.md,
|
||||
|
||||
// isRTL: false,
|
||||
i18n: {
|
||||
enable: true,
|
||||
},
|
||||
iconRenderer: h('div'),
|
||||
},
|
||||
navbar: {
|
||||
type: NavbarType.Sticky,
|
||||
navbarBlur: true,
|
||||
},
|
||||
footer: {
|
||||
type: FooterType.Static,
|
||||
},
|
||||
verticalNav: {
|
||||
isVerticalNavCollapsed: false,
|
||||
defaultNavItemIconProps: { icon: 'ri-circle-line' },
|
||||
},
|
||||
horizontalNav: {
|
||||
type: HorizontalNavType.Sticky,
|
||||
transition: 'none',
|
||||
popoverOffset: 0,
|
||||
},
|
||||
icons: {
|
||||
chevronDown: { icon: 'ri-arrow-down-line' },
|
||||
chevronRight: { icon: 'ri-arrow-right-line' },
|
||||
close: { icon: 'ri-close-line' },
|
||||
verticalNavPinned: { icon: 'ri-record-circle-line' },
|
||||
verticalNavUnPinned: { icon: 'ri-circle-line' },
|
||||
sectionTitlePlaceholder: { icon: 'ri-subtract-line' },
|
||||
},
|
||||
}
|
23
resources/js/@layouts/enums.js
Normal file
23
resources/js/@layouts/enums.js
Normal file
@@ -0,0 +1,23 @@
|
||||
export const ContentWidth = {
|
||||
Fluid: 'fluid',
|
||||
Boxed: 'boxed',
|
||||
}
|
||||
export const NavbarType = {
|
||||
Sticky: 'sticky',
|
||||
Static: 'static',
|
||||
Hidden: 'hidden',
|
||||
}
|
||||
export const FooterType = {
|
||||
Sticky: 'sticky',
|
||||
Static: 'static',
|
||||
Hidden: 'hidden',
|
||||
}
|
||||
export const AppContentLayoutNav = {
|
||||
Vertical: 'vertical',
|
||||
Horizontal: 'horizontal',
|
||||
}
|
||||
export const HorizontalNavType = {
|
||||
Sticky: 'sticky',
|
||||
Static: 'static',
|
||||
Hidden: 'hidden',
|
||||
}
|
44
resources/js/@layouts/index.js
Normal file
44
resources/js/@layouts/index.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import { layoutConfig } from '@layouts/config'
|
||||
import { cookieRef, useLayoutConfigStore } from '@layouts/stores/config'
|
||||
import { _setDirAttr } from '@layouts/utils'
|
||||
|
||||
// 🔌 Plugin
|
||||
export const createLayouts = userConfig => {
|
||||
return () => {
|
||||
const configStore = useLayoutConfigStore()
|
||||
|
||||
|
||||
// Non reactive Values
|
||||
layoutConfig.app.title = userConfig.app?.title ?? layoutConfig.app.title
|
||||
layoutConfig.app.logo = userConfig.app?.logo ?? layoutConfig.app.logo
|
||||
layoutConfig.app.overlayNavFromBreakpoint = userConfig.app?.overlayNavFromBreakpoint ?? layoutConfig.app.overlayNavFromBreakpoint
|
||||
layoutConfig.app.i18n.enable = userConfig.app?.i18n?.enable ?? layoutConfig.app.i18n.enable
|
||||
layoutConfig.app.iconRenderer = userConfig.app?.iconRenderer ?? layoutConfig.app.iconRenderer
|
||||
layoutConfig.verticalNav.defaultNavItemIconProps = userConfig.verticalNav?.defaultNavItemIconProps ?? layoutConfig.verticalNav.defaultNavItemIconProps
|
||||
layoutConfig.icons.chevronDown = userConfig.icons?.chevronDown ?? layoutConfig.icons.chevronDown
|
||||
layoutConfig.icons.chevronRight = userConfig.icons?.chevronRight ?? layoutConfig.icons.chevronRight
|
||||
layoutConfig.icons.close = userConfig.icons?.close ?? layoutConfig.icons.close
|
||||
layoutConfig.icons.verticalNavPinned = userConfig.icons?.verticalNavPinned ?? layoutConfig.icons.verticalNavPinned
|
||||
layoutConfig.icons.verticalNavUnPinned = userConfig.icons?.verticalNavUnPinned ?? layoutConfig.icons.verticalNavUnPinned
|
||||
layoutConfig.icons.sectionTitlePlaceholder = userConfig.icons?.sectionTitlePlaceholder ?? layoutConfig.icons.sectionTitlePlaceholder
|
||||
|
||||
// Reactive Values (Store)
|
||||
configStore.$patch({
|
||||
appContentLayoutNav: cookieRef('appContentLayoutNav', userConfig.app?.contentLayoutNav ?? layoutConfig.app.contentLayoutNav).value,
|
||||
appContentWidth: cookieRef('appContentWidth', userConfig.app?.contentWidth ?? layoutConfig.app.contentWidth).value,
|
||||
footerType: cookieRef('footerType', userConfig.footer?.type ?? layoutConfig.footer.type).value,
|
||||
navbarType: cookieRef('navbarType', userConfig.navbar?.type ?? layoutConfig.navbar.type).value,
|
||||
isNavbarBlurEnabled: cookieRef('isNavbarBlurEnabled', userConfig.navbar?.navbarBlur ?? layoutConfig.navbar.navbarBlur).value,
|
||||
isVerticalNavCollapsed: cookieRef('isVerticalNavCollapsed', userConfig.verticalNav?.isVerticalNavCollapsed ?? layoutConfig.verticalNav.isVerticalNavCollapsed).value,
|
||||
|
||||
// isAppRTL: userConfig.app?.isRTL ?? config.app.isRTL,
|
||||
// isLessThanOverlayNavBreakpoint: false,
|
||||
horizontalNavType: cookieRef('horizontalNavType', userConfig.horizontalNav?.type ?? layoutConfig.horizontalNav.type).value,
|
||||
})
|
||||
|
||||
// _setDirAttr(config.app.isRTL ? 'rtl' : 'ltr')
|
||||
_setDirAttr(configStore.isAppRTL ? 'rtl' : 'ltr')
|
||||
}
|
||||
}
|
||||
export * from './components'
|
||||
export { layoutConfig }
|
41
resources/js/@layouts/plugins/casl.js
Normal file
41
resources/js/@layouts/plugins/casl.js
Normal file
@@ -0,0 +1,41 @@
|
||||
import { useAbility } from '@casl/vue'
|
||||
|
||||
/**
|
||||
* Returns ability result if ACL is configured or else just return true
|
||||
* We should allow passing string | undefined to can because for admin ability we omit defining action & subject
|
||||
*
|
||||
* Useful if you don't know if ACL is configured or not
|
||||
* Used in @core files to handle absence of ACL without errors
|
||||
*
|
||||
* @param {string} action CASL Actions // https://casl.js.org/v4/en/guide/intro#basics
|
||||
* @param {string} subject CASL Subject // https://casl.js.org/v4/en/guide/intro#basics
|
||||
*/
|
||||
export const can = (action, subject) => {
|
||||
const vm = getCurrentInstance()
|
||||
if (!vm)
|
||||
return false
|
||||
const localCan = vm.proxy && '$can' in vm.proxy
|
||||
|
||||
return localCan ? vm.proxy?.$can(action, subject) : true
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user can view item based on it's ability
|
||||
* Based on item's action and subject & Hide group if all of it's children are hidden
|
||||
* @param {object} item navigation object item
|
||||
*/
|
||||
export const canViewNavMenuGroup = item => {
|
||||
const hasAnyVisibleChild = item.children.some(i => can(i.action, i.subject))
|
||||
|
||||
// If subject and action is defined in item => Return based on children visibility (Hide group if no child is visible)
|
||||
// Else check for ability using provided subject and action along with checking if has any visible child
|
||||
if (!(item.action && item.subject))
|
||||
return hasAnyVisibleChild
|
||||
|
||||
return can(item.action, item.subject) && hasAnyVisibleChild
|
||||
}
|
||||
export const canNavigate = to => {
|
||||
const ability = useAbility()
|
||||
console.log('rout test ==== ',to.matched.some(route => ability.can(route.meta.action, route.meta.subject)),to,ability)
|
||||
return to.matched.some(route => ability.can(route.meta.action, route.meta.subject))
|
||||
}
|
115
resources/js/@layouts/stores/config.js
Normal file
115
resources/js/@layouts/stores/config.js
Normal file
@@ -0,0 +1,115 @@
|
||||
import { AppContentLayoutNav, NavbarType } from '@layouts/enums'
|
||||
import { injectionKeyIsVerticalNavHovered } from '@layouts/symbols'
|
||||
import { _setDirAttr } from '@layouts/utils'
|
||||
|
||||
// ℹ️ We should not import themeConfig here but in urgency we are doing it for now
|
||||
import { layoutConfig } from '@themeConfig'
|
||||
|
||||
export const namespaceConfig = str => `${layoutConfig.app.title}-${str}`
|
||||
export const cookieRef = (key, defaultValue) => {
|
||||
return useCookie(namespaceConfig(key), { default: () => defaultValue })
|
||||
}
|
||||
export const useLayoutConfigStore = defineStore('layoutConfig', () => {
|
||||
const route = useRoute()
|
||||
|
||||
// 👉 Navbar Type
|
||||
const navbarType = ref(layoutConfig.navbar.type)
|
||||
|
||||
// 👉 Navbar Type
|
||||
const isNavbarBlurEnabled = cookieRef('isNavbarBlurEnabled', layoutConfig.navbar.navbarBlur)
|
||||
|
||||
// 👉 Vertical Nav Collapsed
|
||||
const isVerticalNavCollapsed = cookieRef('isVerticalNavCollapsed', layoutConfig.verticalNav.isVerticalNavCollapsed)
|
||||
|
||||
// 👉 App Content Width
|
||||
const appContentWidth = cookieRef('appContentWidth', layoutConfig.app.contentWidth)
|
||||
|
||||
// 👉 App Content Layout Nav
|
||||
const appContentLayoutNav = ref(layoutConfig.app.contentLayoutNav)
|
||||
|
||||
watch(appContentLayoutNav, val => {
|
||||
// If Navbar type is hidden while switching to horizontal nav => Reset it to sticky
|
||||
if (val === AppContentLayoutNav.Horizontal) {
|
||||
if (navbarType.value === NavbarType.Hidden)
|
||||
navbarType.value = NavbarType.Sticky
|
||||
isVerticalNavCollapsed.value = false
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// 👉 Horizontal Nav Type
|
||||
const horizontalNavType = ref(layoutConfig.horizontalNav.type)
|
||||
|
||||
// 👉 Horizontal Nav Popover Offset
|
||||
const horizontalNavPopoverOffset = ref(layoutConfig.horizontalNav.popoverOffset)
|
||||
|
||||
// 👉 Footer Type
|
||||
const footerType = ref(layoutConfig.footer.type)
|
||||
|
||||
// 👉 Misc
|
||||
const isLessThanOverlayNavBreakpoint = computed(() => useMediaQuery(`(max-width: ${layoutConfig.app.overlayNavFromBreakpoint}px)`).value)
|
||||
|
||||
|
||||
// 👉 Layout Classes
|
||||
const _layoutClasses = computed(() => {
|
||||
const { y: windowScrollY } = useWindowScroll()
|
||||
|
||||
return [
|
||||
`layout-nav-type-${appContentLayoutNav.value}`,
|
||||
`layout-navbar-${navbarType.value}`,
|
||||
`layout-footer-${footerType.value}`,
|
||||
{
|
||||
'layout-vertical-nav-collapsed': isVerticalNavCollapsed.value
|
||||
&& appContentLayoutNav.value === 'vertical'
|
||||
&& !isLessThanOverlayNavBreakpoint.value,
|
||||
},
|
||||
{ [`horizontal-nav-${horizontalNavType.value}`]: appContentLayoutNav.value === 'horizontal' },
|
||||
`layout-content-width-${appContentWidth.value}`,
|
||||
{ 'layout-overlay-nav': isLessThanOverlayNavBreakpoint.value },
|
||||
{ 'window-scrolled': unref(windowScrollY) },
|
||||
route.meta.layoutWrapperClasses ? route.meta.layoutWrapperClasses : null,
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
// 👉 RTL
|
||||
// const isAppRTL = ref(layoutConfig.app.isRTL)
|
||||
const isAppRTL = ref(false)
|
||||
|
||||
watch(isAppRTL, val => {
|
||||
_setDirAttr(val ? 'rtl' : 'ltr')
|
||||
})
|
||||
|
||||
|
||||
// 👉 Is Vertical Nav Mini
|
||||
/*
|
||||
This function will return true if current state is mini. Mini state means vertical nav is:
|
||||
- Collapsed
|
||||
- Isn't hovered by mouse
|
||||
- nav is not less than overlay breakpoint (hence, isn't overlay menu)
|
||||
|
||||
ℹ️ We are getting `isVerticalNavHovered` as param instead of via `inject` because
|
||||
we are using this in `VerticalNav.vue` component which provide it and I guess because
|
||||
same component is providing & injecting we are getting undefined error
|
||||
*/
|
||||
const isVerticalNavMini = (isVerticalNavHovered = null) => {
|
||||
const isVerticalNavHoveredLocal = isVerticalNavHovered || inject(injectionKeyIsVerticalNavHovered) || ref(false)
|
||||
|
||||
return computed(() => isVerticalNavCollapsed.value && !isVerticalNavHoveredLocal.value && !isLessThanOverlayNavBreakpoint.value)
|
||||
}
|
||||
|
||||
return {
|
||||
appContentWidth,
|
||||
appContentLayoutNav,
|
||||
navbarType,
|
||||
isNavbarBlurEnabled,
|
||||
isVerticalNavCollapsed,
|
||||
horizontalNavType,
|
||||
horizontalNavPopoverOffset,
|
||||
footerType,
|
||||
isLessThanOverlayNavBreakpoint,
|
||||
isAppRTL,
|
||||
_layoutClasses,
|
||||
isVerticalNavMini,
|
||||
}
|
||||
})
|
3
resources/js/@layouts/styles/_classes.scss
Normal file
3
resources/js/@layouts/styles/_classes.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
.cursor-pointer {
|
||||
cursor: pointer;
|
||||
}
|
35
resources/js/@layouts/styles/_default-layout.scss
Normal file
35
resources/js/@layouts/styles/_default-layout.scss
Normal file
@@ -0,0 +1,35 @@
|
||||
// These are styles which are both common in layout w/ vertical nav & horizontal nav
|
||||
@use "@layouts/styles/rtl";
|
||||
@use "@layouts/styles/placeholders";
|
||||
@use "@layouts/styles/mixins";
|
||||
@use "@configured-variables" as variables;
|
||||
|
||||
html,
|
||||
body {
|
||||
min-block-size: 100%;
|
||||
}
|
||||
|
||||
.layout-page-content {
|
||||
@include mixins.boxed-content(true);
|
||||
|
||||
flex-grow: 1;
|
||||
|
||||
// TODO: Use grid gutter variable here
|
||||
padding-block: 1.5rem;
|
||||
}
|
||||
|
||||
.layout-footer {
|
||||
.footer-content-container {
|
||||
block-size: variables.$layout-vertical-nav-footer-height;
|
||||
}
|
||||
|
||||
.layout-footer-sticky & {
|
||||
position: sticky;
|
||||
inset-block-end: 0;
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
.layout-footer-hidden & {
|
||||
display: none;
|
||||
}
|
||||
}
|
10
resources/js/@layouts/styles/_global.scss
Normal file
10
resources/js/@layouts/styles/_global.scss
Normal file
@@ -0,0 +1,10 @@
|
||||
*,
|
||||
::before,
|
||||
::after {
|
||||
box-sizing: inherit;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
html {
|
||||
box-sizing: border-box;
|
||||
}
|
28
resources/js/@layouts/styles/_mixins.scss
Normal file
28
resources/js/@layouts/styles/_mixins.scss
Normal file
@@ -0,0 +1,28 @@
|
||||
@use "placeholders";
|
||||
@use "@configured-variables" as variables;
|
||||
|
||||
@mixin rtl {
|
||||
@if variables.$enable-rtl-styles {
|
||||
[dir="rtl"] & {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@mixin boxed-content($nest-selector: false) {
|
||||
& {
|
||||
@extend %boxed-content-spacing;
|
||||
|
||||
@at-root {
|
||||
@if $nest-selector == false {
|
||||
.layout-content-width-boxed#{&} {
|
||||
@extend %boxed-content;
|
||||
}
|
||||
} @else {
|
||||
.layout-content-width-boxed & {
|
||||
@extend %boxed-content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
53
resources/js/@layouts/styles/_placeholders.scss
Normal file
53
resources/js/@layouts/styles/_placeholders.scss
Normal file
@@ -0,0 +1,53 @@
|
||||
// placeholders
|
||||
@use "@configured-variables" as variables;
|
||||
|
||||
%boxed-content {
|
||||
@at-root #{&}-spacing {
|
||||
// TODO: Use grid gutter variable here
|
||||
padding-inline: 1.5rem;
|
||||
}
|
||||
|
||||
inline-size: 100%;
|
||||
margin-inline: auto;
|
||||
max-inline-size: variables.$layout-boxed-content-width;
|
||||
}
|
||||
|
||||
%layout-navbar-hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
// ℹ️ We created this placeholder even it is being used in just layout w/ vertical nav because in future we might apply style to both navbar & horizontal nav separately
|
||||
%layout-navbar-sticky {
|
||||
position: sticky;
|
||||
inset-block-start: 0;
|
||||
|
||||
// will-change: transform;
|
||||
// inline-size: 100%;
|
||||
}
|
||||
|
||||
%style-scroll-bar {
|
||||
/* width */
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
background: rgb(var(--v-theme-surface));
|
||||
block-size: 8px;
|
||||
border-end-end-radius: 14px;
|
||||
border-start-end-radius: 14px;
|
||||
inline-size: 4px;
|
||||
}
|
||||
|
||||
/* Track */
|
||||
&::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
/* Handle */
|
||||
&::-webkit-scrollbar-thumb {
|
||||
border-radius: 0.5rem;
|
||||
background: rgb(var(--v-theme-perfect-scrollbar-thumb));
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-corner {
|
||||
display: none;
|
||||
}
|
||||
}
|
7
resources/js/@layouts/styles/_rtl.scss
Normal file
7
resources/js/@layouts/styles/_rtl.scss
Normal file
@@ -0,0 +1,7 @@
|
||||
@use "./mixins";
|
||||
|
||||
.layout-vertical-nav .nav-group-arrow {
|
||||
@include mixins.rtl {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
}
|
29
resources/js/@layouts/styles/_variables.scss
Normal file
29
resources/js/@layouts/styles/_variables.scss
Normal file
@@ -0,0 +1,29 @@
|
||||
// @use "@styles/style.scss";
|
||||
|
||||
// 👉 Vertical nav
|
||||
$layout-vertical-nav-z-index: 12 !default;
|
||||
$layout-vertical-nav-width: 260px !default;
|
||||
$layout-vertical-nav-collapsed-width: 80px !default;
|
||||
$selector-vertical-nav-mini: '.layout-vertical-nav-collapsed .layout-vertical-nav:not(:hover)';
|
||||
|
||||
// 👉 Horizontal nav
|
||||
$layout-horizontal-nav-z-index: 11 !default;
|
||||
$layout-horizontal-nav-navbar-height: 64px !default;
|
||||
|
||||
// 👉 Navbar
|
||||
$layout-vertical-nav-navbar-height: 64px !default;
|
||||
$layout-vertical-nav-navbar-is-contained: true !default;
|
||||
$layout-vertical-nav-layout-navbar-z-index: 11 !default;
|
||||
$layout-horizontal-nav-layout-navbar-z-index: 11 !default;
|
||||
|
||||
// 👉 Main content
|
||||
$layout-boxed-content-width: 1440px !default;
|
||||
|
||||
// 👉Footer
|
||||
$layout-vertical-nav-footer-height: 56px !default;
|
||||
|
||||
// 👉 Layout overlay
|
||||
$layout-overlay-z-index: 11 !default;
|
||||
|
||||
// 👉 RTL
|
||||
$enable-rtl-styles: true !default;
|
3
resources/js/@layouts/styles/index.scss
Normal file
3
resources/js/@layouts/styles/index.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
@use "_global";
|
||||
@use "vue3-perfect-scrollbar/dist/vue3-perfect-scrollbar.min.css";
|
||||
@use "_classes";
|
1
resources/js/@layouts/symbols.js
Normal file
1
resources/js/@layouts/symbols.js
Normal file
@@ -0,0 +1 @@
|
||||
export const injectionKeyIsVerticalNavHovered = Symbol('isVerticalNavHovered')
|
1
resources/js/@layouts/types.js
Normal file
1
resources/js/@layouts/types.js
Normal file
@@ -0,0 +1 @@
|
||||
export {}
|
197
resources/js/@layouts/utils.js
Normal file
197
resources/js/@layouts/utils.js
Normal file
@@ -0,0 +1,197 @@
|
||||
import { layoutConfig } from '@layouts/config'
|
||||
import { AppContentLayoutNav } from '@layouts/enums'
|
||||
import { useLayoutConfigStore } from '@layouts/stores/config'
|
||||
|
||||
export const openGroups = ref([])
|
||||
|
||||
/**
|
||||
* Return nav link props to use
|
||||
// @param {Object, String} item navigation routeName or route Object provided in navigation data
|
||||
*/
|
||||
export const getComputedNavLinkToProp = computed(() => link => {
|
||||
const props = {
|
||||
target: link.target,
|
||||
rel: link.rel,
|
||||
}
|
||||
|
||||
|
||||
// If route is string => it assumes string is route name => Create route object from route name
|
||||
// If route is not string => It assumes it's route object => returns passed route object
|
||||
if (link.to)
|
||||
props.to = typeof link.to === 'string' ? { name: link.to } : link.to
|
||||
else
|
||||
props.href = link.href
|
||||
|
||||
return props
|
||||
})
|
||||
|
||||
/**
|
||||
* Return route name for navigation link
|
||||
* If link is string then it will assume it is route-name
|
||||
* IF link is object it will resolve the object and will return the link
|
||||
// @param {Object, String} link navigation link object/string
|
||||
*/
|
||||
export const resolveNavLinkRouteName = (link, router) => {
|
||||
if (!link.to)
|
||||
return null
|
||||
if (typeof link.to === 'string')
|
||||
return link.to
|
||||
|
||||
return router.resolve(link.to).name
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if nav-link is active
|
||||
* @param {object} link nav-link object
|
||||
*/
|
||||
export const isNavLinkActive = (link, router) => {
|
||||
// Matched routes array of current route
|
||||
const matchedRoutes = router.currentRoute.value.matched;
|
||||
const currentRoute = router.currentRoute.value;
|
||||
|
||||
// Check if the parent menu item should be active
|
||||
|
||||
if (isParentActive(currentRoute,router,link)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if provided route matches route's matched route
|
||||
const resolveRoutedName = resolveNavLinkRouteName(link, router);
|
||||
if (!resolveRoutedName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return matchedRoutes.some(route => {
|
||||
return route.name === resolveRoutedName || route.meta.navActiveLink === resolveRoutedName;
|
||||
});
|
||||
};
|
||||
const ParentMenuItemName = 'admin-patients';
|
||||
|
||||
export const isParentActive = (route, router,link) => {
|
||||
// Get the current route's activeParent meta property
|
||||
const activeParent = route.meta.activeParent;
|
||||
|
||||
// Check if the activeParent is defined and not an empty string
|
||||
if (activeParent && activeParent.trim().length > 0) {
|
||||
// Find the parent route configuration
|
||||
const parentRoute = router.options.routes.find(r => r.name === activeParent);
|
||||
console.log('fffff', link.to)
|
||||
// Check if the parent route configuration exists
|
||||
if (link.to) {
|
||||
// Use the parent route's name or any other property as the parent menu item name
|
||||
return link.to === activeParent;
|
||||
}
|
||||
}
|
||||
|
||||
// If the activeParent is not defined, an empty string, or the parent route configuration is not found, return false
|
||||
return false;
|
||||
};
|
||||
/**
|
||||
* Check if nav group is active
|
||||
* @param {Array} children Group children
|
||||
*/
|
||||
export const isNavGroupActive = (children, router) => children.some(child => {
|
||||
// If child have children => It's group => Go deeper(recursive)
|
||||
if ('children' in child)
|
||||
return isNavGroupActive(child.children, router)
|
||||
|
||||
// else it's link => Check for matched Route
|
||||
return isNavLinkActive(child, router)
|
||||
})
|
||||
|
||||
/**
|
||||
* Change `dir` attribute based on direction
|
||||
* @param dir 'ltr' | 'rtl'
|
||||
*/
|
||||
export const _setDirAttr = dir => {
|
||||
// Check if document exists for SSR
|
||||
if (typeof document !== 'undefined')
|
||||
document.documentElement.setAttribute('dir', dir)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return dynamic i18n props based on i18n plugin is enabled or not
|
||||
* @param key i18n translation key
|
||||
* @param tag tag to wrap the translation with
|
||||
*/
|
||||
export const getDynamicI18nProps = (key, tag = 'span') => {
|
||||
if (!layoutConfig.app.i18n.enable)
|
||||
return {}
|
||||
|
||||
return {
|
||||
keypath: key,
|
||||
tag,
|
||||
scope: 'global',
|
||||
}
|
||||
}
|
||||
export const switchToVerticalNavOnLtOverlayNavBreakpoint = () => {
|
||||
const configStore = useLayoutConfigStore()
|
||||
|
||||
/*
|
||||
ℹ️ This is flag will hold nav type need to render when switching between lgAndUp from mdAndDown window width
|
||||
|
||||
Requirement: When we nav is set to `horizontal` and we hit the `mdAndDown` breakpoint nav type shall change to `vertical` nav
|
||||
Now if we go back to `lgAndUp` breakpoint from `mdAndDown` how we will know which was previous nav type in large device?
|
||||
|
||||
Let's assign value of `appContentLayoutNav` as default value of lgAndUpNav. Why 🤔?
|
||||
If template is viewed in lgAndUp
|
||||
We will assign `appContentLayoutNav` value to `lgAndUpNav` because at this point both constant is same
|
||||
Hence, for `lgAndUpNav` it will take value from theme config file
|
||||
else
|
||||
It will always show vertical nav and if user increase the window width it will fallback to `appContentLayoutNav` value
|
||||
But `appContentLayoutNav` will be value set in theme config file
|
||||
*/
|
||||
const lgAndUpNav = ref(configStore.appContentLayoutNav)
|
||||
|
||||
|
||||
/*
|
||||
There might be case where we manually switch from vertical to horizontal nav and vice versa in `lgAndUp` screen
|
||||
So when user comes back from `mdAndDown` to `lgAndUp` we can set updated nav type
|
||||
For this we need to update the `lgAndUpNav` value if screen is `lgAndUp`
|
||||
*/
|
||||
watch(() => configStore.appContentLayoutNav, value => {
|
||||
if (!configStore.isLessThanOverlayNavBreakpoint)
|
||||
lgAndUpNav.value = value
|
||||
})
|
||||
|
||||
/*
|
||||
This is layout switching part
|
||||
If it's `mdAndDown` => We will use vertical nav no matter what previous nav type was
|
||||
Or if it's `lgAndUp` we need to switch back to `lgAndUp` nav type. For this we will tracker property `lgAndUpNav`
|
||||
*/
|
||||
watch(() => configStore.isLessThanOverlayNavBreakpoint, val => {
|
||||
configStore.appContentLayoutNav = val ? AppContentLayoutNav.Vertical : lgAndUpNav.value
|
||||
}, { immediate: true })
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Hex color to rgb
|
||||
* @param hex
|
||||
*/
|
||||
export const hexToRgb = hex => {
|
||||
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
|
||||
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i
|
||||
|
||||
hex = hex.replace(shorthandRegex, (m, r, g, b) => {
|
||||
return r + r + g + g + b + b
|
||||
})
|
||||
|
||||
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)
|
||||
|
||||
return result ? `${Number.parseInt(result[1], 16)},${Number.parseInt(result[2], 16)},${Number.parseInt(result[3], 16)}` : null
|
||||
}
|
||||
|
||||
/**
|
||||
*RGBA color to Hex color with / without opacity
|
||||
*/
|
||||
export const rgbaToHex = (rgba, forceRemoveAlpha = false) => {
|
||||
return (`#${rgba
|
||||
.replace(/^rgba?\(|\s+|\)$/g, '') // Get's rgba / rgb string values
|
||||
.split(',') // splits them at ","
|
||||
.filter((string, index) => !forceRemoveAlpha || index !== 3)
|
||||
.map(string => Number.parseFloat(string)) // Converts them to numbers
|
||||
.map((number, index) => (index === 3 ? Math.round(number * 255) : number)) // Converts alpha to 255 number
|
||||
.map(number => number.toString(16)) // Converts numbers to hex
|
||||
.map(string => (string.length === 1 ? `0${string}` : string)) // Adds 0 when length of one number is 1
|
||||
.join('')}`)
|
||||
}
|
50
resources/js/App.vue
Normal file
50
resources/js/App.vue
Normal file
@@ -0,0 +1,50 @@
|
||||
<script setup>
|
||||
import ScrollToTop from '@core/components/ScrollToTop.vue'
|
||||
import initCore from '@core/initCore'
|
||||
import {
|
||||
initConfigStore,
|
||||
useConfigStore,
|
||||
} from '@core/stores/config'
|
||||
import { hexToRgb } from '@layouts/utils'
|
||||
import { useTheme } from 'vuetify'
|
||||
import { useStore } from 'vuex'
|
||||
const store = useStore()
|
||||
const { global } = useTheme()
|
||||
|
||||
// ℹ️ Sync current theme with initial loader theme
|
||||
initCore()
|
||||
initConfigStore()
|
||||
|
||||
const configStore = useConfigStore()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VOverlay
|
||||
v-model="store.getters.getIsLoading"
|
||||
contained
|
||||
persistent
|
||||
scroll-strategy="none"
|
||||
class="align-center justify-center"
|
||||
>
|
||||
<VProgressCircular indeterminate />
|
||||
</VOverlay>
|
||||
<VSnackbar v-model="store.getters.getSuccessMsg" :timeout="5000" location="top end" variant="flat"
|
||||
color="success">
|
||||
<VIcon
|
||||
class="ri-checkbox-circle-line"
|
||||
/> {{ store.getters.getShowMsg }}
|
||||
</VSnackbar>
|
||||
<VSnackbar v-model="store.getters.getErrorMsg" :timeout="5000" location="top end" variant="flat"
|
||||
color="error">
|
||||
<VIcon
|
||||
class="ri-spam-2-line"
|
||||
/> {{ store.getters.getShowMsg }}
|
||||
</VSnackbar>
|
||||
<VLocaleProvider :rtl="configStore.isAppRTL">
|
||||
<!-- ℹ️ This is required to set the background color of active nav link based on currently active global theme's primary -->
|
||||
<VApp :style="`--v-global-theme-primary: ${hexToRgb(global.current.value.colors.primary)}`">
|
||||
<RouterView />
|
||||
<ScrollToTop />
|
||||
</VApp>
|
||||
</VLocaleProvider>
|
||||
</template>
|
58
resources/js/api.js
Normal file
58
resources/js/api.js
Normal file
@@ -0,0 +1,58 @@
|
||||
import axios from 'axios';
|
||||
import qs from 'qs';
|
||||
export default {
|
||||
async get(url, headers={}){
|
||||
headers.Authorization= `Bearer ${localStorage.getItem('admin_access_token')}`;
|
||||
const res = await axios.get(url, { headers:headers });
|
||||
return res.data;
|
||||
},
|
||||
async post(url, data, headers={}){
|
||||
headers.Authorization= `Bearer ${localStorage.getItem('admin_access_token')}`;
|
||||
|
||||
const res = await axios.post(url, data, { headers:headers });
|
||||
return res.data;
|
||||
},
|
||||
|
||||
async getDataTableRecord(url, payload, columns) {
|
||||
|
||||
const defaultQuery = {
|
||||
draw:0,
|
||||
columns:[],
|
||||
order:[],
|
||||
start:(payload.page - 1) * payload.itemsPerPage,
|
||||
length:payload.itemsPerPage,
|
||||
search:{
|
||||
value: payload.search,
|
||||
|
||||
},
|
||||
...payload.filters,
|
||||
|
||||
}
|
||||
const i=0;
|
||||
for( let column of columns){
|
||||
defaultQuery.columns.push(
|
||||
{
|
||||
data:column.key,
|
||||
searchable:column.searchable == undefined ? true:column.searchable,
|
||||
orderable:column.orderable == undefined ? true:column.orderable,
|
||||
name:'',
|
||||
}
|
||||
)
|
||||
}
|
||||
for(let sort of payload.sortBy){
|
||||
const index= columns.findIndex(column=>column.key==sort.key)
|
||||
defaultQuery.order.push({
|
||||
column:index,
|
||||
dir:sort.order,
|
||||
name:'',
|
||||
|
||||
})
|
||||
}
|
||||
const data = await this.post(url, qs.stringify(defaultQuery));
|
||||
return {
|
||||
items:data.data,
|
||||
total:data.recordsTotal,
|
||||
}
|
||||
},
|
||||
|
||||
}
|
63
resources/js/components/AppLoadingIndicator.vue
Normal file
63
resources/js/components/AppLoadingIndicator.vue
Normal file
@@ -0,0 +1,63 @@
|
||||
<script setup>
|
||||
const bufferValue = ref(20)
|
||||
const progressValue = ref(10)
|
||||
const isFallbackState = ref(false)
|
||||
const interval = ref()
|
||||
const showProgress = ref(false)
|
||||
|
||||
watch([
|
||||
progressValue,
|
||||
isFallbackState,
|
||||
], () => {
|
||||
if (progressValue.value > 80 && isFallbackState.value)
|
||||
progressValue.value = 82
|
||||
startBuffer()
|
||||
})
|
||||
function startBuffer() {
|
||||
clearInterval(interval.value)
|
||||
interval.value = setInterval(() => {
|
||||
progressValue.value += Math.random() * (15 - 5) + 5
|
||||
bufferValue.value += Math.random() * (15 - 5) + 6
|
||||
}, 800)
|
||||
}
|
||||
|
||||
const fallbackHandle = () => {
|
||||
showProgress.value = true
|
||||
progressValue.value = 10
|
||||
isFallbackState.value = true
|
||||
startBuffer()
|
||||
}
|
||||
|
||||
const resolveHandle = () => {
|
||||
isFallbackState.value = false
|
||||
progressValue.value = 100
|
||||
setTimeout(() => {
|
||||
clearInterval(interval.value)
|
||||
progressValue.value = 0
|
||||
bufferValue.value = 20
|
||||
showProgress.value = false
|
||||
}, 300)
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
fallbackHandle,
|
||||
resolveHandle,
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- loading state via #fallback slot -->
|
||||
<div
|
||||
v-if="showProgress"
|
||||
class="position-fixed"
|
||||
style="z-index: 9999; inset-block-start: 0; inset-inline: 0 0;"
|
||||
>
|
||||
<VProgressLinear
|
||||
v-model="progressValue"
|
||||
:buffer-value="bufferValue"
|
||||
color="primary"
|
||||
height="2"
|
||||
bg-color="background"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
272
resources/js/components/AppPricing.vue
Normal file
272
resources/js/components/AppPricing.vue
Normal file
@@ -0,0 +1,272 @@
|
||||
<script setup>
|
||||
import tree1 from '@images/misc/pricing-tree-1.png'
|
||||
import tree2 from '@images/misc/pricing-tree-2.png'
|
||||
import tree3 from '@images/misc/pricing-tree-3.png'
|
||||
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
cols: {
|
||||
type: [
|
||||
Number,
|
||||
String,
|
||||
],
|
||||
required: false,
|
||||
},
|
||||
sm: {
|
||||
type: [
|
||||
Number,
|
||||
String,
|
||||
],
|
||||
required: false,
|
||||
},
|
||||
md: {
|
||||
type: [
|
||||
String,
|
||||
Number,
|
||||
],
|
||||
required: false,
|
||||
},
|
||||
lg: {
|
||||
type: [
|
||||
String,
|
||||
Number,
|
||||
],
|
||||
required: false,
|
||||
},
|
||||
xl: {
|
||||
type: [
|
||||
String,
|
||||
Number,
|
||||
],
|
||||
required: false,
|
||||
},
|
||||
})
|
||||
|
||||
const annualMonthlyPlanPriceToggler = ref(true)
|
||||
|
||||
const pricingPlans = [
|
||||
{
|
||||
name: 'Basic',
|
||||
tagLine: 'A simple start for everyone',
|
||||
logo: tree1,
|
||||
monthlyPrice: 0,
|
||||
yearlyPrice: 0,
|
||||
isPopular: false,
|
||||
current: true,
|
||||
features: [
|
||||
'100 responses a month',
|
||||
'Unlimited forms and surveys',
|
||||
'Unlimited fields',
|
||||
'Basic form creation tools',
|
||||
'Up to 2 subdomains',
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Standard',
|
||||
tagLine: 'For small to medium businesses',
|
||||
logo: tree2,
|
||||
monthlyPrice: 42,
|
||||
yearlyPrice: 460,
|
||||
isPopular: true,
|
||||
current: false,
|
||||
features: [
|
||||
'Unlimited responses',
|
||||
'Unlimited forms and surveys',
|
||||
'Instagram profile page',
|
||||
'Google Docs integration',
|
||||
'Custom “Thank you” page',
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Enterprise',
|
||||
tagLine: 'Solution for big organizations',
|
||||
logo: tree3,
|
||||
monthlyPrice: 84,
|
||||
yearlyPrice: 690,
|
||||
isPopular: false,
|
||||
current: false,
|
||||
features: [
|
||||
'PayPal payments',
|
||||
'Logic Jumps',
|
||||
'File upload with 5GB storage',
|
||||
'Custom domain support',
|
||||
'Stripe integration',
|
||||
],
|
||||
},
|
||||
]
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 👉 Title and subtitle -->
|
||||
<div class="text-center mb-6">
|
||||
<slot name="heading">
|
||||
<h3 class="text-h3 pricing-title pb-2">
|
||||
{{ props.title ? props.title : 'Pricing Plans' }}
|
||||
</h3>
|
||||
</slot>
|
||||
<slot name="subtitle">
|
||||
<p class="mb-0">
|
||||
All plans include 40+ advanced tools and features to boost your product.
|
||||
<br>
|
||||
Choose the best plan to fit your needs.
|
||||
</p>
|
||||
</slot>
|
||||
</div>
|
||||
|
||||
<!-- 👉 Annual and monthly price toggler -->
|
||||
<div class="d-flex align-center justify-center mx-auto pt-sm-9 pb-sm-8 py-4">
|
||||
<VLabel
|
||||
for="pricing-plan-toggle"
|
||||
class="me-2 font-weight-medium"
|
||||
>
|
||||
Monthly
|
||||
</VLabel>
|
||||
|
||||
<div class="position-relative">
|
||||
<div class="pricing-save-chip position-absolute d-sm-block d-none">
|
||||
<VIcon
|
||||
start
|
||||
icon="ri-corner-left-down-fill"
|
||||
size="24"
|
||||
class="text-disabled flip-in-rtl mt-1"
|
||||
/>
|
||||
<VChip
|
||||
size="small"
|
||||
color="primary"
|
||||
class="mt-n2"
|
||||
>
|
||||
Save up to 10%
|
||||
</VChip>
|
||||
</div>
|
||||
|
||||
<VSwitch
|
||||
id="pricing-plan-toggle"
|
||||
v-model="annualMonthlyPlanPriceToggler"
|
||||
>
|
||||
<template #label>
|
||||
<div class="text-body-1 font-weight-medium">
|
||||
Annually
|
||||
</div>
|
||||
</template>
|
||||
</VSwitch>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- SECTION pricing plans -->
|
||||
<VRow>
|
||||
<VCol
|
||||
v-for="plan in pricingPlans"
|
||||
:key="plan.logo"
|
||||
v-bind="props"
|
||||
>
|
||||
<!-- 👉 Card -->
|
||||
<VCard
|
||||
flat
|
||||
border
|
||||
:class="plan.isPopular ? 'border-primary border-opacity-100' : ''"
|
||||
>
|
||||
<VCardText
|
||||
class="text-end pt-4"
|
||||
style="block-size: 3.75rem;"
|
||||
>
|
||||
<!-- 👉 Popular -->
|
||||
<VChip
|
||||
v-show="plan.isPopular"
|
||||
color="primary"
|
||||
size="small"
|
||||
>
|
||||
Popular
|
||||
</VChip>
|
||||
</VCardText>
|
||||
|
||||
<!-- 👉 Plan logo -->
|
||||
<VCardText class="text-center">
|
||||
<VImg
|
||||
:height="120"
|
||||
:src="plan.logo"
|
||||
class="mx-auto mb-5"
|
||||
/>
|
||||
|
||||
<!-- 👉 Plan name -->
|
||||
<h4 class="text-h4 mb-1">
|
||||
{{ plan.name }}
|
||||
</h4>
|
||||
<p class="mb-0 text-body-1">
|
||||
{{ plan.tagLine }}
|
||||
</p>
|
||||
</VCardText>
|
||||
|
||||
<!-- 👉 Plan price -->
|
||||
<VCardText class="position-relative text-center">
|
||||
<div>
|
||||
<div class="d-flex justify-center align-center">
|
||||
<span class="text-body-1 font-weight-medium align-self-start">$</span>
|
||||
<h1 class="text-h1 font-weight-medium text-primary">
|
||||
{{ annualMonthlyPlanPriceToggler ? Math.floor(Number(plan.yearlyPrice) / 12) : plan.monthlyPrice }}
|
||||
</h1>
|
||||
<span class="text-body-1 font-weight-medium align-self-end">/month</span>
|
||||
</div>
|
||||
|
||||
<!-- 👉 Annual Price -->
|
||||
<div
|
||||
v-show="annualMonthlyPlanPriceToggler"
|
||||
class="text-caption"
|
||||
>
|
||||
{{ plan.yearlyPrice === 0 ? 'free' : `USD ${plan.yearlyPrice}/Year` }}
|
||||
</div>
|
||||
</div>
|
||||
</VCardText>
|
||||
|
||||
<!-- 👉 Plan features -->
|
||||
<VCardText class="pt-2">
|
||||
<VList class="card-list pb-5">
|
||||
<VListItem
|
||||
v-for="feature in plan.features"
|
||||
:key="feature"
|
||||
>
|
||||
<template #prepend />
|
||||
|
||||
<VListItemTitle class="text-body-1 d-flex align-center">
|
||||
<VIcon
|
||||
:size="14"
|
||||
icon="ri-circle-line"
|
||||
class="me-2"
|
||||
/>
|
||||
<div class="text-truncate">
|
||||
{{ feature }}
|
||||
</div>
|
||||
</VListItemTitle>
|
||||
</VListItem>
|
||||
</VList>
|
||||
|
||||
<!-- 👉 Plan actions -->
|
||||
<VBtn
|
||||
:active="false"
|
||||
block
|
||||
:color="plan.current ? 'success' : 'primary'"
|
||||
:variant="plan.isPopular ? 'elevated' : 'outlined'"
|
||||
:to="{ name: 'front-pages-payment' }"
|
||||
>
|
||||
{{ plan.yearlyPrice === 0 ? 'Your Current Plan' : 'Upgrade' }}
|
||||
</VBtn>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VCol>
|
||||
</VRow>
|
||||
<!-- !SECTION -->
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.card-list {
|
||||
--v-card-list-gap: 1rem;
|
||||
}
|
||||
|
||||
.pricing-save-chip {
|
||||
display: flex;
|
||||
inset-block-start: -2.625rem;
|
||||
inset-inline-end: -6.5rem;
|
||||
}
|
||||
</style>
|
86
resources/js/components/AppSearchHeader.vue
Normal file
86
resources/js/components/AppSearchHeader.vue
Normal file
@@ -0,0 +1,86 @@
|
||||
<script setup>
|
||||
import AppSearchHeaderBgDark from '@images/pages/app-search-header-bg-dark.png'
|
||||
import AppSearchHeaderBgLight from '@images/pages/app-search-header-bg-light.png'
|
||||
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
subtitle: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
customClass: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: 'Ask a question..',
|
||||
},
|
||||
})
|
||||
|
||||
defineOptions({
|
||||
inheritAttrs: false,
|
||||
})
|
||||
|
||||
const themeBackgroundImg = useGenerateImageVariant(AppSearchHeaderBgLight, AppSearchHeaderBgDark)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 👉 Search Banner -->
|
||||
<VCard
|
||||
flat
|
||||
class="text-center search-header"
|
||||
:class="customClass"
|
||||
:style="`background: url(${themeBackgroundImg});`"
|
||||
>
|
||||
<VCardText>
|
||||
<slot>
|
||||
<h4 class="text-h4 text-primary">
|
||||
{{ title }}
|
||||
</h4>
|
||||
|
||||
<!-- 👉 Search Input -->
|
||||
<VTextField
|
||||
v-bind="$attrs"
|
||||
:placeholder="placeholder"
|
||||
class="search-header-input mx-auto my-4"
|
||||
>
|
||||
<template #prepend-inner>
|
||||
<VIcon
|
||||
icon="ri-search-line"
|
||||
size="18"
|
||||
/>
|
||||
</template>
|
||||
</VTextField>
|
||||
|
||||
<p class="text-body-1">
|
||||
{{ subtitle }}
|
||||
</p>
|
||||
</slot>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.search-header {
|
||||
padding: 4rem !important;
|
||||
background-size: cover !important;
|
||||
}
|
||||
|
||||
// search input
|
||||
.search-header-input {
|
||||
border-radius: 0.25rem !important;
|
||||
background-color: rgb(var(--v-theme-surface));
|
||||
max-inline-size: 32.125rem;
|
||||
}
|
||||
|
||||
@media (max-width: 37.5rem) {
|
||||
.search-header {
|
||||
padding: 1.5rem !important;
|
||||
}
|
||||
}
|
||||
</style>
|
53
resources/js/components/ErrorHeader.vue
Normal file
53
resources/js/components/ErrorHeader.vue
Normal file
@@ -0,0 +1,53 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
statusCode: {
|
||||
type: [
|
||||
String,
|
||||
Number,
|
||||
],
|
||||
required: false,
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="text-center mb-4">
|
||||
<!-- 👉 Title and subtitle -->
|
||||
<h1
|
||||
v-if="props.statusCode"
|
||||
class="error-title mb-2"
|
||||
>
|
||||
{{ props.statusCode }}
|
||||
</h1>
|
||||
|
||||
<h4
|
||||
v-if="props.title"
|
||||
class="text-h4 mb-2"
|
||||
>
|
||||
{{ props.title }}
|
||||
</h4>
|
||||
|
||||
<p
|
||||
v-if="props.description"
|
||||
class="mb-0 text-body-1"
|
||||
>
|
||||
{{ props.description }}
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.error-title {
|
||||
font-size: 6rem;
|
||||
font-weight: 500;
|
||||
line-height: 1;
|
||||
}
|
||||
</style>
|
114
resources/js/components/dialogs/AddAuthenticatorAppDialog.vue
Normal file
114
resources/js/components/dialogs/AddAuthenticatorAppDialog.vue
Normal file
@@ -0,0 +1,114 @@
|
||||
<script setup>
|
||||
import themeselectionQr from '@images/pages/themeselection-qr.png'
|
||||
|
||||
const props = defineProps({
|
||||
authCode: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
isDialogVisible: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits([
|
||||
'update:isDialogVisible',
|
||||
'submit',
|
||||
])
|
||||
|
||||
const authCode = ref(structuredClone(toRaw(props.authCode)))
|
||||
|
||||
const formSubmit = () => {
|
||||
if (authCode.value) {
|
||||
emit('submit', authCode.value)
|
||||
emit('update:isDialogVisible', false)
|
||||
}
|
||||
}
|
||||
|
||||
const resetAuthCode = () => {
|
||||
authCode.value = structuredClone(toRaw(props.authCode))
|
||||
emit('update:isDialogVisible', false)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VDialog
|
||||
max-width="900"
|
||||
:model-value="props.isDialogVisible"
|
||||
@update:model-value="(val) => $emit('update:isDialogVisible', val)"
|
||||
>
|
||||
<VCard class="pa-sm-11 pa-3">
|
||||
<!-- 👉 dialog close btn -->
|
||||
<DialogCloseBtn
|
||||
variant="text"
|
||||
size="default"
|
||||
@click="resetAuthCode"
|
||||
/>
|
||||
|
||||
<VCardText class="pt-5">
|
||||
<h4 class="text-h4 text-center mb-6">
|
||||
Add Authenticator App
|
||||
</h4>
|
||||
<h5 class="text-h5 font-weight-medium mb-2">
|
||||
Authenticator Apps
|
||||
</h5>
|
||||
|
||||
<p class="mb-6">
|
||||
Using an authenticator app like Google Authenticator, Microsoft Authenticator, Authy, or 1Password, scan the QR code. It will generate a 6 digit code for you to enter below.
|
||||
</p>
|
||||
|
||||
<div class="my-6">
|
||||
<VImg
|
||||
width="150"
|
||||
:src="themeselectionQr"
|
||||
class="mx-auto"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<VAlert
|
||||
color="warning"
|
||||
variant="tonal"
|
||||
class="my-4"
|
||||
>
|
||||
<template #title>
|
||||
ASDLKNASDA9AHS678dGhASD78AB
|
||||
</template>
|
||||
If you're having trouble using the QR code, select manual entry on your app
|
||||
</VAlert>
|
||||
|
||||
<VForm @submit.prevent="() => {}">
|
||||
<VTextField
|
||||
v-model="authCode"
|
||||
name="auth-code"
|
||||
label="Enter Authentication Code"
|
||||
placeholder="123 456"
|
||||
class="mb-8"
|
||||
/>
|
||||
|
||||
<div class="d-flex justify-end flex-wrap gap-4">
|
||||
<VBtn
|
||||
color="secondary"
|
||||
variant="outlined"
|
||||
@click="resetAuthCode"
|
||||
>
|
||||
Cancel
|
||||
</VBtn>
|
||||
|
||||
<VBtn
|
||||
type="submit"
|
||||
@click="formSubmit"
|
||||
>
|
||||
Submit
|
||||
<VIcon
|
||||
end
|
||||
icon="ri-check-line"
|
||||
class="flip-in-rtl"
|
||||
/>
|
||||
</VBtn>
|
||||
</div>
|
||||
</VForm>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
</template>
|
230
resources/js/components/dialogs/AddEditAddressDialog.vue
Normal file
230
resources/js/components/dialogs/AddEditAddressDialog.vue
Normal file
@@ -0,0 +1,230 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
billingAddress: {
|
||||
type: Object,
|
||||
required: false,
|
||||
default: () => ({
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
selectedCountry: null,
|
||||
addressLine1: '',
|
||||
addressLine2: '',
|
||||
landmark: '',
|
||||
contact: '',
|
||||
country: null,
|
||||
state: '',
|
||||
zipCode: null,
|
||||
}),
|
||||
},
|
||||
isDialogVisible: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits([
|
||||
'update:isDialogVisible',
|
||||
'submit',
|
||||
])
|
||||
|
||||
const billingAddress = ref(structuredClone(toRaw(props.billingAddress)))
|
||||
|
||||
const resetForm = () => {
|
||||
emit('update:isDialogVisible', false)
|
||||
billingAddress.value = structuredClone(toRaw(props.billingAddress))
|
||||
}
|
||||
|
||||
const onFormSubmit = () => {
|
||||
emit('update:isDialogVisible', false)
|
||||
emit('submit', billingAddress.value)
|
||||
}
|
||||
|
||||
const selectedAddress = ref('Home')
|
||||
|
||||
const addressTypes = [
|
||||
{
|
||||
title: 'Home',
|
||||
desc: 'Delivery Time (7am - 9pm)',
|
||||
value: 'Home',
|
||||
icon: 'ri-home-smile-2-line',
|
||||
},
|
||||
{
|
||||
title: 'Office',
|
||||
desc: 'Delivery Time (10am - 6pm)',
|
||||
value: 'Office',
|
||||
icon: 'ri-building-line',
|
||||
},
|
||||
]
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VDialog
|
||||
:width="$vuetify.display.smAndDown ? 'auto' : 900 "
|
||||
:model-value="props.isDialogVisible"
|
||||
@update:model-value="val => $emit('update:isDialogVisible', val)"
|
||||
>
|
||||
<VCard
|
||||
v-if="props.billingAddress"
|
||||
class="pa-sm-11 pa-3"
|
||||
>
|
||||
<VCardText class="pt-5">
|
||||
<!-- 👉 dialog close btn -->
|
||||
|
||||
|
||||
<!-- 👉 Title -->
|
||||
<div class="text-center mb-6">
|
||||
<h4 class="text-h4 mb-2">
|
||||
{{ props.billingAddress.firstName ? 'Edit' : 'Add New' }} Address
|
||||
</h4>
|
||||
|
||||
<p class="text-body-1">
|
||||
Add Address for future billing
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<CustomRadios
|
||||
v-model:selected-radio="selectedAddress"
|
||||
:radio-content="addressTypes"
|
||||
:grid-column="{ sm: '6', cols: '12' }"
|
||||
class="mb-5"
|
||||
>
|
||||
<template #default="items">
|
||||
<div class="d-flex flex-column">
|
||||
<div class="d-flex mb-2 align-center gap-x-1">
|
||||
<VIcon
|
||||
:icon="items.item.icon"
|
||||
size="20"
|
||||
/>
|
||||
<div class="text-body-1 font-weight-medium text-high-emphasis">
|
||||
{{ items.item.title }}
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-body-2 mb-0">
|
||||
{{ items.item.desc }}
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
</CustomRadios>
|
||||
<!-- 👉 Form -->
|
||||
<VForm @submit.prevent="onFormSubmit">
|
||||
<VRow>
|
||||
<!-- 👉 First Name -->
|
||||
<VCol
|
||||
cols="12"
|
||||
md="6"
|
||||
>
|
||||
<VTextField
|
||||
v-model="billingAddress.firstName"
|
||||
label="First Name"
|
||||
placeholder="John"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<!-- 👉 Last Name -->
|
||||
<VCol
|
||||
cols="12"
|
||||
md="6"
|
||||
>
|
||||
<VTextField
|
||||
v-model="billingAddress.lastName"
|
||||
label="Last Name"
|
||||
placeholder="Doe"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<!-- 👉 Select country -->
|
||||
|
||||
<VCol cols="12">
|
||||
<VSelect
|
||||
v-model="billingAddress.selectedCountry"
|
||||
label="Select Country"
|
||||
placeholder="Select Country"
|
||||
:items="['USA', 'Canada', 'NZ', 'Aus']"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<!-- 👉 Address Line 1 -->
|
||||
|
||||
<VCol cols="12">
|
||||
<VTextField
|
||||
v-model="billingAddress.addressLine1"
|
||||
label="Address Line 1"
|
||||
placeholder="1, New Street"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<!-- 👉 Address Line 2 -->
|
||||
|
||||
<VCol cols="12">
|
||||
<VTextField
|
||||
v-model="billingAddress.addressLine2"
|
||||
label="Address Line 2"
|
||||
placeholder="Near hospital"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<!-- 👉 Landmark -->
|
||||
|
||||
<VCol cols="12">
|
||||
<VTextField
|
||||
v-model="billingAddress.landmark"
|
||||
label="Landmark & City"
|
||||
placeholder="Near hospital, New York"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<!-- 👉 State -->
|
||||
<VCol
|
||||
cols="12"
|
||||
md="6"
|
||||
>
|
||||
<VTextField
|
||||
v-model="billingAddress.state"
|
||||
label="State/Province"
|
||||
placeholder="New York"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<!-- 👉 Zip Code -->
|
||||
<VCol
|
||||
cols="12"
|
||||
md="6"
|
||||
>
|
||||
<VTextField
|
||||
v-model="billingAddress.zipCode"
|
||||
label="Zip Code"
|
||||
placeholder="123123"
|
||||
type="number"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<VCol cols="12">
|
||||
<VSwitch label="Make this default shipping address" />
|
||||
</VCol>
|
||||
|
||||
<!-- 👉 Submit and Cancel button -->
|
||||
<VCol
|
||||
cols="12"
|
||||
class="text-center"
|
||||
>
|
||||
<VBtn
|
||||
type="submit"
|
||||
class="me-3"
|
||||
>
|
||||
submit
|
||||
</VBtn>
|
||||
|
||||
<VBtn
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
@click="resetForm"
|
||||
>
|
||||
Cancel
|
||||
</VBtn>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</VForm>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
</template>
|
101
resources/js/components/dialogs/AddEditPermissionDialog.vue
Normal file
101
resources/js/components/dialogs/AddEditPermissionDialog.vue
Normal file
@@ -0,0 +1,101 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
isDialogVisible: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
permissionName: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: '',
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits([
|
||||
'update:isDialogVisible',
|
||||
'update:permissionName',
|
||||
])
|
||||
|
||||
const currentPermissionName = ref('')
|
||||
|
||||
const onReset = () => {
|
||||
emit('update:isDialogVisible', false)
|
||||
currentPermissionName.value = ''
|
||||
}
|
||||
|
||||
const onSubmit = () => {
|
||||
emit('update:isDialogVisible', false)
|
||||
emit('update:permissionName', currentPermissionName.value)
|
||||
}
|
||||
|
||||
watch(props, () => {
|
||||
currentPermissionName.value = props.permissionName
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VDialog
|
||||
:width="$vuetify.display.smAndDown ? 'auto' : 600"
|
||||
:model-value="props.isDialogVisible"
|
||||
@update:model-value="onReset"
|
||||
>
|
||||
<VCard class="pa-sm-8 pa-5">
|
||||
<!-- 👉 dialog close btn -->
|
||||
<DialogCloseBtn
|
||||
variant="text"
|
||||
size="default"
|
||||
@click="onReset"
|
||||
/>
|
||||
|
||||
<VCardText class="mt-5">
|
||||
<!-- 👉 Title -->
|
||||
<div class="text-center mb-6">
|
||||
<h4 class="text-h4 mb-2">
|
||||
{{ props.permissionName ? 'Edit' : 'Add' }} Permission
|
||||
</h4>
|
||||
|
||||
<p class="text-body-1">
|
||||
{{ props.permissionName ? 'Edit' : 'Add' }} permission as per your requirements.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- 👉 Form -->
|
||||
<VForm>
|
||||
<VAlert
|
||||
type="warning"
|
||||
title="Warning!"
|
||||
variant="tonal"
|
||||
class="mb-6"
|
||||
>
|
||||
By editing the permission name, you might break the system permissions functionality. Please ensure you're absolutely certain before proceeding.
|
||||
</VAlert>
|
||||
|
||||
<!-- 👉 Role name -->
|
||||
<div class="d-flex align-center gap-4 mb-4">
|
||||
<VTextField
|
||||
v-model="currentPermissionName"
|
||||
density="compact"
|
||||
placeholder="Enter Permission Name"
|
||||
/>
|
||||
|
||||
<VBtn @click="onSubmit">
|
||||
Update
|
||||
</VBtn>
|
||||
</div>
|
||||
|
||||
<VCheckbox label="Set as core permission" />
|
||||
</VForm>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.permission-table {
|
||||
td {
|
||||
border-block-end: 1px solid rgba(var(--v-border-color), var(--v-border-opacity));
|
||||
padding-block: 0.5rem;
|
||||
padding-inline: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
294
resources/js/components/dialogs/AddEditRoleDialog.vue
Normal file
294
resources/js/components/dialogs/AddEditRoleDialog.vue
Normal file
@@ -0,0 +1,294 @@
|
||||
<script setup>
|
||||
import { VForm } from 'vuetify/components/VForm'
|
||||
|
||||
const props = defineProps({
|
||||
rolePermissions: {
|
||||
type: Object,
|
||||
required: false,
|
||||
default: () => ({
|
||||
name: '',
|
||||
permissions: [],
|
||||
}),
|
||||
},
|
||||
isDialogVisible: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits([
|
||||
'update:isDialogVisible',
|
||||
'update:rolePermissions',
|
||||
])
|
||||
|
||||
|
||||
// 👉 Permission List
|
||||
const permissions = ref([
|
||||
{
|
||||
name: 'User Management',
|
||||
read: false,
|
||||
write: false,
|
||||
create: false,
|
||||
},
|
||||
{
|
||||
name: 'Content Management',
|
||||
read: false,
|
||||
write: false,
|
||||
create: false,
|
||||
},
|
||||
{
|
||||
name: 'Disputes Management',
|
||||
read: false,
|
||||
write: false,
|
||||
create: false,
|
||||
},
|
||||
{
|
||||
name: 'Database Management',
|
||||
read: false,
|
||||
write: false,
|
||||
create: false,
|
||||
},
|
||||
{
|
||||
name: 'Financial Management',
|
||||
read: false,
|
||||
write: false,
|
||||
create: false,
|
||||
},
|
||||
{
|
||||
name: 'Reporting',
|
||||
read: false,
|
||||
write: false,
|
||||
create: false,
|
||||
},
|
||||
{
|
||||
name: 'API Control',
|
||||
read: false,
|
||||
write: false,
|
||||
create: false,
|
||||
},
|
||||
{
|
||||
name: 'Repository Management',
|
||||
read: false,
|
||||
write: false,
|
||||
create: false,
|
||||
},
|
||||
{
|
||||
name: 'Payroll',
|
||||
read: false,
|
||||
write: false,
|
||||
create: false,
|
||||
},
|
||||
])
|
||||
|
||||
const isSelectAll = ref(false)
|
||||
const role = ref('')
|
||||
const refPermissionForm = ref()
|
||||
|
||||
const checkedCount = computed(() => {
|
||||
let counter = 0
|
||||
permissions.value.forEach(permission => {
|
||||
Object.entries(permission).forEach(([key, value]) => {
|
||||
if (key !== 'name' && value)
|
||||
counter++
|
||||
})
|
||||
})
|
||||
|
||||
return counter
|
||||
})
|
||||
|
||||
const isIndeterminate = computed(() => checkedCount.value > 0 && checkedCount.value < permissions.value.length * 3)
|
||||
|
||||
// select all
|
||||
watch(isSelectAll, val => {
|
||||
permissions.value = permissions.value.map(permission => ({
|
||||
...permission,
|
||||
read: val,
|
||||
write: val,
|
||||
create: val,
|
||||
}))
|
||||
})
|
||||
|
||||
// if Indeterminate is false, then set isSelectAll to false
|
||||
watch(isIndeterminate, () => {
|
||||
if (!isIndeterminate.value)
|
||||
isSelectAll.value = false
|
||||
})
|
||||
|
||||
// if all permissions are checked, then set isSelectAll to true
|
||||
watch(permissions, () => {
|
||||
if (checkedCount.value === permissions.value.length * 3)
|
||||
isSelectAll.value = true
|
||||
}, { deep: true })
|
||||
|
||||
// if rolePermissions is not empty, then set permissions
|
||||
watch(props, () => {
|
||||
if (props.rolePermissions && props.rolePermissions.permissions.length) {
|
||||
role.value = props.rolePermissions.name
|
||||
permissions.value = permissions.value.map(permission => {
|
||||
const rolePermission = props.rolePermissions?.permissions.find(item => item.name === permission.name)
|
||||
if (rolePermission) {
|
||||
return {
|
||||
...permission,
|
||||
...rolePermission,
|
||||
}
|
||||
}
|
||||
|
||||
return permission
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const onSubmit = () => {
|
||||
const rolePermissions = {
|
||||
name: role.value,
|
||||
permissions: permissions.value,
|
||||
}
|
||||
|
||||
emit('update:rolePermissions', rolePermissions)
|
||||
emit('update:isDialogVisible', false)
|
||||
isSelectAll.value = false
|
||||
refPermissionForm.value?.reset()
|
||||
}
|
||||
|
||||
const onReset = () => {
|
||||
emit('update:isDialogVisible', false)
|
||||
isSelectAll.value = false
|
||||
refPermissionForm.value?.reset()
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VDialog
|
||||
:width="$vuetify.display.smAndDown ? 'auto' : 900"
|
||||
:model-value="props.isDialogVisible"
|
||||
@update:model-value="onReset"
|
||||
>
|
||||
<VCard class="pa-sm-8 pa-5">
|
||||
<!-- 👉 dialog close btn -->
|
||||
<DialogCloseBtn
|
||||
variant="text"
|
||||
size="default"
|
||||
@click="onReset"
|
||||
/>
|
||||
|
||||
<VCardText class="mt-5">
|
||||
<!-- 👉 Title -->
|
||||
<div class="text-center mb-6">
|
||||
<h4 class="text-h4 mb-2">
|
||||
{{ props.rolePermissions.name ? 'Edit' : 'Add' }} Role
|
||||
</h4>
|
||||
|
||||
<p class="text-body-1">
|
||||
{{ props.rolePermissions.name ? 'Edit' : 'Add' }} Role
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- 👉 Form -->
|
||||
<VForm ref="refPermissionForm">
|
||||
<!-- 👉 Role name -->
|
||||
<VTextField
|
||||
v-model="role"
|
||||
label="Role Name"
|
||||
placeholder="Enter Role Name"
|
||||
/>
|
||||
|
||||
<h5 class="text-h5 my-6">
|
||||
Role Permissions
|
||||
</h5>
|
||||
|
||||
<!-- 👉 Role Permissions -->
|
||||
|
||||
<VTable class="permission-table text-no-wrap">
|
||||
<!-- 👉 Admin -->
|
||||
<tr>
|
||||
<td class="text-h6">
|
||||
Administrator Access
|
||||
</td>
|
||||
<td colspan="3">
|
||||
<div class="d-flex justify-end">
|
||||
<VCheckbox
|
||||
v-model="isSelectAll"
|
||||
v-model:indeterminate="isIndeterminate"
|
||||
label="Select All"
|
||||
/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- 👉 Other permission loop -->
|
||||
<template
|
||||
v-for="permission in permissions"
|
||||
:key="permission.name"
|
||||
>
|
||||
<tr>
|
||||
<td class="text-h6">
|
||||
{{ permission.name }}
|
||||
</td>
|
||||
<td style="inline-size: 5.75rem;">
|
||||
<div class="d-flex justify-end">
|
||||
<VCheckbox
|
||||
v-model="permission.read"
|
||||
label="Read"
|
||||
/>
|
||||
</div>
|
||||
</td>
|
||||
<td style="inline-size: 5.75rem;">
|
||||
<div class="d-flex justify-end">
|
||||
<VCheckbox
|
||||
v-model="permission.write"
|
||||
label="Write"
|
||||
/>
|
||||
</div>
|
||||
</td>
|
||||
<td style="inline-size: 5.75rem;">
|
||||
<div class="d-flex justify-end">
|
||||
<VCheckbox
|
||||
v-model="permission.create"
|
||||
label="Create"
|
||||
/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</VTable>
|
||||
|
||||
<!-- 👉 Actions button -->
|
||||
<div class="d-flex align-center justify-center gap-3 mt-6">
|
||||
<VBtn @click="onSubmit">
|
||||
Submit
|
||||
</VBtn>
|
||||
|
||||
<VBtn
|
||||
color="secondary"
|
||||
variant="outlined"
|
||||
@click="onReset"
|
||||
>
|
||||
Cancel
|
||||
</VBtn>
|
||||
</div>
|
||||
</VForm>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.permission-table {
|
||||
td {
|
||||
border-block-end: 1px solid rgba(var(--v-border-color), var(--v-border-opacity));
|
||||
padding-block: 0.5rem;
|
||||
|
||||
.v-checkbox {
|
||||
min-inline-size: 4.75rem;
|
||||
}
|
||||
|
||||
&:not(:first-child) {
|
||||
padding-inline: 0.5rem;
|
||||
}
|
||||
|
||||
.v-label {
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
122
resources/js/components/dialogs/AddPaymentMethodDialog.vue
Normal file
122
resources/js/components/dialogs/AddPaymentMethodDialog.vue
Normal file
@@ -0,0 +1,122 @@
|
||||
<script setup>
|
||||
import americanExDark from '@images/icons/payments/img/ae-dark.png'
|
||||
import americanExLight from '@images/icons/payments/img/american-express.png'
|
||||
import dcDark from '@images/icons/payments/img/dc-dark.png'
|
||||
import dcLight from '@images/icons/payments/img/dc-light.png'
|
||||
import jcbDark from '@images/icons/payments/img/jcb-dark.png'
|
||||
import jcbLight from '@images/icons/payments/img/jcb-light.png'
|
||||
import masterCardDark from '@images/icons/payments/img/master-dark.png'
|
||||
import masterCardLight from '@images/icons/payments/img/mastercard.png'
|
||||
import visaDark from '@images/icons/payments/img/visa-dark.png'
|
||||
import visaLight from '@images/icons/payments/img/visa-light.png'
|
||||
|
||||
const props = defineProps({
|
||||
isDialogVisible: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:isDialogVisible'])
|
||||
|
||||
const visa = useGenerateImageVariant(visaLight, visaDark)
|
||||
const masterCard = useGenerateImageVariant(masterCardLight, masterCardDark)
|
||||
const americanEx = useGenerateImageVariant(americanExLight, americanExDark)
|
||||
const jcb = useGenerateImageVariant(jcbLight, jcbDark)
|
||||
const dc = useGenerateImageVariant(dcLight, dcDark)
|
||||
|
||||
const dialogVisibleUpdate = val => {
|
||||
emit('update:isDialogVisible', val)
|
||||
}
|
||||
|
||||
const paymentMethodsData = [
|
||||
{
|
||||
title: 'Visa',
|
||||
type: 'Credit Card',
|
||||
img: visa,
|
||||
},
|
||||
{
|
||||
title: 'American Express',
|
||||
type: 'Credit Card',
|
||||
img: americanEx,
|
||||
},
|
||||
{
|
||||
title: 'Mastercard',
|
||||
type: 'Credit Card',
|
||||
img: masterCard,
|
||||
},
|
||||
{
|
||||
title: 'JCB',
|
||||
type: 'Credit Card',
|
||||
img: jcb,
|
||||
},
|
||||
{
|
||||
title: 'Diners Club',
|
||||
type: 'Credit Card',
|
||||
img: dc,
|
||||
},
|
||||
]
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VDialog
|
||||
:model-value="props.isDialogVisible"
|
||||
max-width="900"
|
||||
@update:model-value="dialogVisibleUpdate"
|
||||
>
|
||||
<VCard class="refer-and-earn-dialog">
|
||||
<!-- 👉 dialog close btn -->
|
||||
<DialogCloseBtn
|
||||
variant="text"
|
||||
size="default"
|
||||
@click="emit('update:isDialogVisible', false)"
|
||||
/>
|
||||
|
||||
<VCardText class="pa-8 pa-sm-16">
|
||||
<div class="mb-6">
|
||||
<h4 class="text-h4 text-center mb-2">
|
||||
Add payment methods
|
||||
</h4>
|
||||
<p class="text-sm-body-1 text-center">
|
||||
Supported payment methods
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-for="(item, index) in paymentMethodsData"
|
||||
:key="index"
|
||||
>
|
||||
<div class="d-flex justify-space-between align-center py-4 gap-x-4">
|
||||
<div class="d-flex align-center">
|
||||
<VImg
|
||||
:src="item.img.value"
|
||||
height="30"
|
||||
width="50"
|
||||
class="me-4"
|
||||
/>
|
||||
<div class="text-body-1 font-weight-medium text-high-emphasis">
|
||||
{{ item.title }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-none d-sm-block text-body-1">
|
||||
{{ item.type }}
|
||||
</div>
|
||||
</div>
|
||||
<VDivider v-show="index !== paymentMethodsData.length - 1" />
|
||||
</div>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.refer-link-input {
|
||||
.v-field--appended {
|
||||
padding-inline-end: 0;
|
||||
}
|
||||
|
||||
.v-field__append-inner {
|
||||
padding-block-start: 0.125rem;
|
||||
}
|
||||
}
|
||||
</style>
|
143
resources/js/components/dialogs/CardAddEditDialog.vue
Normal file
143
resources/js/components/dialogs/CardAddEditDialog.vue
Normal file
@@ -0,0 +1,143 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
cardDetails: {
|
||||
type: Object,
|
||||
required: false,
|
||||
default: () => ({
|
||||
number: '',
|
||||
name: '',
|
||||
expiry: '',
|
||||
cvv: '',
|
||||
isPrimary: false,
|
||||
type: '',
|
||||
}),
|
||||
},
|
||||
isDialogVisible: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits([
|
||||
'submit',
|
||||
'update:isDialogVisible',
|
||||
])
|
||||
|
||||
const cardDetails = ref(structuredClone(toRaw(props.cardDetails)))
|
||||
|
||||
watch(props, () => {
|
||||
cardDetails.value = structuredClone(toRaw(props.cardDetails))
|
||||
})
|
||||
|
||||
const formSubmit = () => {
|
||||
emit('submit', cardDetails.value)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VDialog
|
||||
:width="$vuetify.display.smAndDown ? 'auto' : 600"
|
||||
:model-value="props.isDialogVisible"
|
||||
@update:model-value="val => $emit('update:isDialogVisible', val)"
|
||||
>
|
||||
<VCard class="pa-sm-11 pa-3">
|
||||
<!-- 👉 dialog close btn -->
|
||||
<DialogCloseBtn
|
||||
variant="text"
|
||||
size="default"
|
||||
@click="$emit('update:isDialogVisible', false)"
|
||||
/>
|
||||
|
||||
<VCardText class="pt-5">
|
||||
<!-- 👉 Title -->
|
||||
<div class="text-center mb-6">
|
||||
<h4 class="text-h4 mb-2">
|
||||
{{ props.cardDetails.name ? 'Edit Card' : 'Add New Card' }}
|
||||
</h4>
|
||||
<div class="text-body-1">
|
||||
{{ props.cardDetails.name ? 'Edit your saved card details' : 'Add your saved card details' }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<VForm @submit.prevent="() => {}">
|
||||
<VRow>
|
||||
<!-- 👉 Card Number -->
|
||||
<VCol cols="12">
|
||||
<VTextField
|
||||
v-model="cardDetails.number"
|
||||
label="Card Number"
|
||||
placeholder="1234 1234 1234 1234"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<!-- 👉 Card Name -->
|
||||
<VCol
|
||||
cols="12"
|
||||
md="6"
|
||||
>
|
||||
<VTextField
|
||||
v-model="cardDetails.name"
|
||||
label="Name"
|
||||
placeholder="John Doe"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<!-- 👉 Card Expiry -->
|
||||
<VCol
|
||||
cols="6"
|
||||
md="3"
|
||||
>
|
||||
<VTextField
|
||||
v-model="cardDetails.expiry"
|
||||
label="Expiry"
|
||||
placeholder="MM/YY"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<!-- 👉 Card CVV -->
|
||||
<VCol
|
||||
cols="6"
|
||||
md="3"
|
||||
>
|
||||
<VTextField
|
||||
v-model="cardDetails.cvv"
|
||||
type="number"
|
||||
label="CVV"
|
||||
placeholder="123"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<!-- 👉 Card Primary Set -->
|
||||
<VCol cols="12">
|
||||
<VSwitch
|
||||
v-model="cardDetails.isPrimary"
|
||||
label="Save Card for future billing?"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<!-- 👉 Card actions -->
|
||||
<VCol
|
||||
cols="12"
|
||||
class="text-center"
|
||||
>
|
||||
<VBtn
|
||||
class="me-4"
|
||||
type="submit"
|
||||
@click="formSubmit"
|
||||
>
|
||||
Submit
|
||||
</VBtn>
|
||||
<VBtn
|
||||
color="secondary"
|
||||
variant="outlined"
|
||||
@click="$emit('update:isDialogVisible', false)"
|
||||
>
|
||||
Cancel
|
||||
</VBtn>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</VForm>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
</template>
|
164
resources/js/components/dialogs/ConfirmDialog.vue
Normal file
164
resources/js/components/dialogs/ConfirmDialog.vue
Normal file
@@ -0,0 +1,164 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
confirmationQuestion: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
isDialogVisible: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
confirmTitle: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
confirmMsg: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
cancelTitle: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
cancelMsg: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits([
|
||||
'update:isDialogVisible',
|
||||
'confirm',
|
||||
])
|
||||
|
||||
const unsubscribed = ref(false)
|
||||
const cancelled = ref(false)
|
||||
|
||||
const updateModelValue = val => {
|
||||
emit('update:isDialogVisible', val)
|
||||
}
|
||||
|
||||
const onConfirmation = () => {
|
||||
emit('confirm', true)
|
||||
updateModelValue(false)
|
||||
unsubscribed.value = true
|
||||
}
|
||||
|
||||
const onCancel = () => {
|
||||
emit('confirm', false)
|
||||
emit('update:isDialogVisible', false)
|
||||
cancelled.value = true
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 👉 Confirm Dialog -->
|
||||
<VDialog
|
||||
max-width="500"
|
||||
:model-value="props.isDialogVisible"
|
||||
@update:model-value="updateModelValue"
|
||||
>
|
||||
<VCard class="text-center px-10 py-6">
|
||||
<VCardText>
|
||||
<VBtn
|
||||
icon
|
||||
variant="outlined"
|
||||
color="warning"
|
||||
class="my-4"
|
||||
size="x-large"
|
||||
>
|
||||
<span class="text-4xl">!</span>
|
||||
</VBtn>
|
||||
|
||||
<h6 class="text-lg font-weight-medium">
|
||||
{{ props.confirmationQuestion }}
|
||||
</h6>
|
||||
</VCardText>
|
||||
|
||||
<VCardText class="d-flex align-center justify-center gap-4">
|
||||
<VBtn
|
||||
variant="elevated"
|
||||
@click="onConfirmation"
|
||||
>
|
||||
Confirm
|
||||
</VBtn>
|
||||
|
||||
<VBtn
|
||||
color="secondary"
|
||||
variant="outlined"
|
||||
@click="onCancel"
|
||||
>
|
||||
Cancel
|
||||
</VBtn>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
|
||||
<!-- Unsubscribed -->
|
||||
<VDialog
|
||||
v-model="unsubscribed"
|
||||
max-width="500"
|
||||
>
|
||||
<VCard>
|
||||
<VCardText class="text-center px-10 py-6">
|
||||
<VBtn
|
||||
icon
|
||||
variant="outlined"
|
||||
color="success"
|
||||
class="my-4"
|
||||
size="x-large"
|
||||
>
|
||||
<span class="text-xl">
|
||||
<VIcon icon="ri-check-line" />
|
||||
</span>
|
||||
</VBtn>
|
||||
|
||||
<h1 class="text-h4 mb-4">
|
||||
{{ props.confirmTitle }}
|
||||
</h1>
|
||||
|
||||
<p>{{ props.confirmMsg }}</p>
|
||||
|
||||
<VBtn
|
||||
color="success"
|
||||
@click="unsubscribed = false"
|
||||
>
|
||||
Ok
|
||||
</VBtn>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
|
||||
<!-- Cancelled -->
|
||||
<VDialog
|
||||
v-model="cancelled"
|
||||
max-width="500"
|
||||
>
|
||||
<VCard>
|
||||
<VCardText class="text-center px-10 py-6">
|
||||
<VBtn
|
||||
icon
|
||||
variant="outlined"
|
||||
color="error"
|
||||
class="my-4"
|
||||
size="x-large"
|
||||
>
|
||||
<span class="text-2xl font-weight-light">X</span>
|
||||
</VBtn>
|
||||
|
||||
<h1 class="text-h4 mb-4">
|
||||
{{ props.cancelTitle }}
|
||||
</h1>
|
||||
|
||||
<p>{{ props.cancelMsg }}</p>
|
||||
|
||||
<VBtn
|
||||
color="success"
|
||||
@click="cancelled = false"
|
||||
>
|
||||
Ok
|
||||
</VBtn>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
</template>
|
446
resources/js/components/dialogs/CreateAppDialog.vue
Normal file
446
resources/js/components/dialogs/CreateAppDialog.vue
Normal file
@@ -0,0 +1,446 @@
|
||||
<script setup>
|
||||
import illustrationJohn from '@images/pages/illustration-john.png'
|
||||
import angularIcon from '@images/icons/brands/angular.png'
|
||||
import laravelIcon from '@images/icons/brands/laravel.png'
|
||||
import reactIcon from '@images/icons/brands/react.png'
|
||||
import vueIcon from '@images/icons/brands/vue.png'
|
||||
import awsIcon from '@images/icons/brands/aws.png'
|
||||
import firebaseIcon from '@images/icons/brands/firebase.png'
|
||||
import mysqlIcon from '@images/icons/brands/mysql.png'
|
||||
|
||||
const props = defineProps({
|
||||
isDialogVisible: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits([
|
||||
'update:isDialogVisible',
|
||||
'updatedData',
|
||||
])
|
||||
|
||||
const currentStep = ref(0)
|
||||
|
||||
const createApp = [
|
||||
{
|
||||
icon: 'ri-file-text-line',
|
||||
title: 'Details',
|
||||
subtitle: 'Enter Details',
|
||||
},
|
||||
{
|
||||
icon: 'ri-star-smile-line',
|
||||
title: 'Frameworks',
|
||||
subtitle: 'Select Framework',
|
||||
},
|
||||
{
|
||||
icon: 'ri-pie-chart-2-line',
|
||||
title: 'Database',
|
||||
subtitle: 'Select Database',
|
||||
},
|
||||
{
|
||||
icon: 'ri-bank-card-line',
|
||||
title: 'Billing',
|
||||
subtitle: 'Payment Details',
|
||||
},
|
||||
{
|
||||
icon: 'ri-check-double-line',
|
||||
title: 'Submit',
|
||||
subtitle: 'submit',
|
||||
},
|
||||
]
|
||||
|
||||
const categories = [
|
||||
{
|
||||
icon: 'ri-bar-chart-box-line',
|
||||
color: 'info',
|
||||
title: 'CRM Application',
|
||||
subtitle: 'Scales with any business',
|
||||
slug: 'crm-application',
|
||||
},
|
||||
{
|
||||
icon: 'ri-shopping-cart-line',
|
||||
color: 'success',
|
||||
title: 'Ecommerce Platforms',
|
||||
subtitle: 'Grow Your Business With App',
|
||||
slug: 'ecommerce-application',
|
||||
},
|
||||
{
|
||||
icon: 'ri-video-upload-line',
|
||||
color: 'error',
|
||||
title: 'Online Learning platform',
|
||||
subtitle: 'Start learning today',
|
||||
slug: 'online-learning-application',
|
||||
},
|
||||
]
|
||||
|
||||
const frameworks = [
|
||||
{
|
||||
icon: reactIcon,
|
||||
color: 'info',
|
||||
title: 'React Native',
|
||||
subtitle: 'Create truly native apps',
|
||||
slug: 'react-framework',
|
||||
},
|
||||
{
|
||||
icon: angularIcon,
|
||||
color: 'error',
|
||||
title: 'Angular',
|
||||
subtitle: 'Most suited for your application',
|
||||
slug: 'angular-framework',
|
||||
},
|
||||
{
|
||||
icon: vueIcon,
|
||||
color: 'success',
|
||||
title: 'Vue',
|
||||
subtitle: 'Progressive Framework',
|
||||
slug: 'vue-framework',
|
||||
},
|
||||
{
|
||||
icon: laravelIcon,
|
||||
color: 'warning',
|
||||
title: 'Laravel',
|
||||
subtitle: 'PHP web frameworks',
|
||||
slug: 'laravel-framework',
|
||||
},
|
||||
]
|
||||
|
||||
const databases = [
|
||||
{
|
||||
icon: firebaseIcon,
|
||||
color: 'warning',
|
||||
title: 'Firebase',
|
||||
subtitle: 'Cloud Firestore',
|
||||
slug: 'firebase-database',
|
||||
},
|
||||
{
|
||||
icon: awsIcon,
|
||||
color: 'secondary',
|
||||
title: 'AWS',
|
||||
subtitle: 'Amazon Fast NoSQL Database',
|
||||
slug: 'aws-database',
|
||||
},
|
||||
{
|
||||
icon: mysqlIcon,
|
||||
color: 'info',
|
||||
title: 'MySQL',
|
||||
subtitle: 'Basic MySQL database',
|
||||
slug: 'mysql-database',
|
||||
},
|
||||
]
|
||||
|
||||
const createAppData = ref({
|
||||
category: 'crm-application',
|
||||
framework: 'vue-framework',
|
||||
database: 'firebase-database',
|
||||
cardNumber: null,
|
||||
cardName: '',
|
||||
cardExpiry: '',
|
||||
cardCvv: '',
|
||||
isSave: false,
|
||||
})
|
||||
|
||||
const dialogVisibleUpdate = val => {
|
||||
emit('update:isDialogVisible', val)
|
||||
currentStep.value = 0
|
||||
}
|
||||
|
||||
watch(props, () => {
|
||||
if (!props.isDialogVisible)
|
||||
currentStep.value = 0
|
||||
})
|
||||
|
||||
const onSubmit = () => {
|
||||
alert('submitted...!!')
|
||||
emit('updatedData', createAppData.value)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VDialog
|
||||
:model-value="props.isDialogVisible"
|
||||
max-width="900"
|
||||
@update:model-value="dialogVisibleUpdate"
|
||||
>
|
||||
<VCard class="create-app-dialog pa-sm-11 pa-3">
|
||||
<!-- 👉 dialog close btn -->
|
||||
<DialogCloseBtn
|
||||
variant="text"
|
||||
size="default"
|
||||
@click="emit('update:isDialogVisible', false)"
|
||||
/>
|
||||
|
||||
<VCardText class="pt-5">
|
||||
<div class="text-center mb-6">
|
||||
<h4 class="text-h4 text-center mb-2">
|
||||
Create App
|
||||
</h4>
|
||||
<div class="text-body-1">
|
||||
Provide data with this form to create your app.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<VRow>
|
||||
<VCol
|
||||
cols="12"
|
||||
sm="5"
|
||||
md="4"
|
||||
>
|
||||
<AppStepper
|
||||
v-model:current-step="currentStep"
|
||||
direction="vertical"
|
||||
:items="createApp"
|
||||
icon-size="24"
|
||||
class="stepper-icon-step-bg"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<VCol
|
||||
cols="12"
|
||||
sm="7"
|
||||
md="8"
|
||||
>
|
||||
<VWindow
|
||||
v-model="currentStep"
|
||||
class="disable-tab-transition stepper-content"
|
||||
>
|
||||
<!-- 👉 category -->
|
||||
<VWindowItem>
|
||||
<VTextField
|
||||
label="Application Name"
|
||||
placeholder="myRider"
|
||||
/>
|
||||
|
||||
<h5 class="text-h5 mb-4 mt-8">
|
||||
Category
|
||||
</h5>
|
||||
<VRadioGroup v-model="createAppData.category">
|
||||
<VList class="card-list">
|
||||
<VListItem
|
||||
v-for="category in categories"
|
||||
:key="category.title"
|
||||
@click="createAppData.category = category.slug"
|
||||
>
|
||||
<template #prepend>
|
||||
<VAvatar
|
||||
size="46"
|
||||
rounded
|
||||
variant="tonal"
|
||||
:color="category.color"
|
||||
:icon="category.icon"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<VListItemTitle class="font-weight-medium mb-1">
|
||||
{{ category.title }}
|
||||
</VListItemTitle>
|
||||
<VListItemSubtitle class="text-body-2 me-2">
|
||||
{{ category.subtitle }}
|
||||
</VListItemSubtitle>
|
||||
|
||||
<template #append>
|
||||
<VRadio :value="category.slug" />
|
||||
</template>
|
||||
</VListItem>
|
||||
</VList>
|
||||
</VRadioGroup>
|
||||
</VWindowItem>
|
||||
|
||||
<!-- 👉 Frameworks -->
|
||||
<VWindowItem>
|
||||
<h5 class="text-h5 mb-4">
|
||||
Select Framework
|
||||
</h5>
|
||||
<VRadioGroup v-model="createAppData.framework">
|
||||
<VList class="card-list">
|
||||
<VListItem
|
||||
v-for="framework in frameworks"
|
||||
:key="framework.title"
|
||||
@click="createAppData.framework = framework.slug"
|
||||
>
|
||||
<template #prepend>
|
||||
<VAvatar
|
||||
size="46"
|
||||
rounded
|
||||
variant="tonal"
|
||||
:color="framework.color"
|
||||
>
|
||||
<img :src="framework.icon">
|
||||
</VAvatar>
|
||||
</template>
|
||||
<VListItemTitle class="mb-1 font-weight-medium">
|
||||
{{ framework.title }}
|
||||
</VListItemTitle>
|
||||
<VListItemSubtitle class="me-2">
|
||||
{{ framework.subtitle }}
|
||||
</VListItemSubtitle>
|
||||
<template #append>
|
||||
<VRadio :value="framework.slug" />
|
||||
</template>
|
||||
</VListItem>
|
||||
</VList>
|
||||
</VRadioGroup>
|
||||
</VWindowItem>
|
||||
|
||||
<!-- 👉 Database Engine -->
|
||||
<VWindowItem>
|
||||
<VTextField
|
||||
label="Database Name"
|
||||
placeholder="userDB"
|
||||
/>
|
||||
|
||||
<h5 class="text-h5 mt-8 mb-4">
|
||||
Select Database Engine
|
||||
</h5>
|
||||
<VRadioGroup v-model="createAppData.database">
|
||||
<VList class="card-list">
|
||||
<VListItem
|
||||
v-for="database in databases"
|
||||
:key="database.title"
|
||||
@click="createAppData.database = database.slug"
|
||||
>
|
||||
<template #prepend>
|
||||
<VAvatar
|
||||
size="46"
|
||||
rounded
|
||||
variant="tonal"
|
||||
:color="database.color"
|
||||
>
|
||||
<img :src="database.icon">
|
||||
</VAvatar>
|
||||
</template>
|
||||
<VListItemTitle class="mb-1 font-weight-medium">
|
||||
{{ database.title }}
|
||||
</VListItemTitle>
|
||||
<VListItemSubtitle class="me-2">
|
||||
{{ database.subtitle }}
|
||||
</VListItemSubtitle>
|
||||
<template #append>
|
||||
<VRadio :value="database.slug" />
|
||||
</template>
|
||||
</VListItem>
|
||||
</VList>
|
||||
</VRadioGroup>
|
||||
</VWindowItem>
|
||||
|
||||
<!-- 👉 Billing form -->
|
||||
<VWindowItem>
|
||||
<VForm>
|
||||
<VRow>
|
||||
<VCol cols="12">
|
||||
<VTextField
|
||||
v-model="createAppData.cardNumber"
|
||||
label="Card Number"
|
||||
placeholder="1234 1234 1234 1234"
|
||||
type="number"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<VCol
|
||||
cols="12"
|
||||
md="6"
|
||||
>
|
||||
<VTextField
|
||||
v-model="createAppData.cardName"
|
||||
label="Name on Card"
|
||||
placeholder="John Doe"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<VCol
|
||||
cols="6"
|
||||
md="3"
|
||||
>
|
||||
<VTextField
|
||||
v-model="createAppData.cardExpiry"
|
||||
label="Expiry"
|
||||
placeholder="MM/YY"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<VCol
|
||||
cols="6"
|
||||
md="3"
|
||||
>
|
||||
<VTextField
|
||||
v-model="createAppData.cardCvv"
|
||||
label="CVV"
|
||||
placeholder="123"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<VCol cols="12">
|
||||
<VSwitch
|
||||
v-model="createAppData.isSave"
|
||||
label="Save Card for future billing?"
|
||||
/>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</VForm>
|
||||
</VWindowItem>
|
||||
|
||||
<VWindowItem class="text-center">
|
||||
<h5 class="text-h5 mb-2">
|
||||
Submit 🥳
|
||||
</h5>
|
||||
<p class="text-body-2 mb-4">
|
||||
Submit to kickstart your project.
|
||||
</p>
|
||||
|
||||
<VImg
|
||||
:src="illustrationJohn"
|
||||
width="252"
|
||||
class="mx-auto"
|
||||
/>
|
||||
</VWindowItem>
|
||||
</VWindow>
|
||||
|
||||
<div class="d-flex justify-space-between mt-6">
|
||||
<VBtn
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
:disabled="currentStep === 0"
|
||||
@click="currentStep--"
|
||||
>
|
||||
<VIcon
|
||||
icon="ri-arrow-left-line"
|
||||
start
|
||||
class="flip-in-rtl"
|
||||
/>
|
||||
Previous
|
||||
</VBtn>
|
||||
|
||||
<VBtn
|
||||
v-if="createApp.length - 1 === currentStep"
|
||||
color="success"
|
||||
append-icon="ri-check-line"
|
||||
@click="onSubmit"
|
||||
>
|
||||
submit
|
||||
</VBtn>
|
||||
|
||||
<VBtn
|
||||
v-else
|
||||
@click="currentStep++"
|
||||
>
|
||||
Next
|
||||
|
||||
<VIcon
|
||||
icon="ri-arrow-right-line"
|
||||
end
|
||||
class="flip-in-rtl"
|
||||
/>
|
||||
</VBtn>
|
||||
</div>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.stepper-content .card-list {
|
||||
--v-card-list-gap: 1rem;
|
||||
}
|
||||
</style>
|
@@ -0,0 +1,91 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
mobileNumber: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
isDialogVisible: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits([
|
||||
'update:isDialogVisible',
|
||||
'submit',
|
||||
])
|
||||
|
||||
const phoneNumber = ref(structuredClone(toRaw(props.mobileNumber)))
|
||||
|
||||
const formSubmit = () => {
|
||||
if (phoneNumber.value) {
|
||||
emit('submit', phoneNumber.value)
|
||||
emit('update:isDialogVisible', false)
|
||||
}
|
||||
}
|
||||
|
||||
const resetPhoneNumber = () => {
|
||||
phoneNumber.value = structuredClone(toRaw(props.mobileNumber))
|
||||
emit('update:isDialogVisible', false)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VDialog
|
||||
max-width="900"
|
||||
:model-value="props.isDialogVisible"
|
||||
@update:model-value="(val) => $emit('update:isDialogVisible', val)"
|
||||
>
|
||||
<VCard class="pa-5 pa-sm-11">
|
||||
<!-- 👉 dialog close btn -->
|
||||
<DialogCloseBtn
|
||||
variant="text"
|
||||
size="default"
|
||||
@click="resetPhoneNumber"
|
||||
/>
|
||||
|
||||
<VCardText class="pt-5">
|
||||
<div class="mb-6">
|
||||
<h5 class="text-h5 mb-2">
|
||||
Verify Your Mobile Number for SMS
|
||||
</h5>
|
||||
|
||||
<div>
|
||||
Enter your mobile phone number with country code and we will send you a verification code.
|
||||
</div>
|
||||
</div>
|
||||
<VForm @submit.prevent="() => {}">
|
||||
<VTextField
|
||||
v-model="phoneNumber"
|
||||
name="mobile"
|
||||
label="Phone Number"
|
||||
placeholder="+1 123 456 7890"
|
||||
class="mb-8"
|
||||
/>
|
||||
|
||||
<div class="d-flex flex-wrap justify-end gap-3">
|
||||
<VBtn
|
||||
color="secondary"
|
||||
variant="outlined"
|
||||
@click="resetPhoneNumber"
|
||||
>
|
||||
Cancel
|
||||
</VBtn>
|
||||
<VBtn
|
||||
color="success"
|
||||
type="submit"
|
||||
@click="formSubmit"
|
||||
>
|
||||
Submit
|
||||
<VIcon
|
||||
end
|
||||
icon="ri-check-line"
|
||||
class="flip-in-rtl"
|
||||
/>
|
||||
</VBtn>
|
||||
</div>
|
||||
</VForm>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
</template>
|
165
resources/js/components/dialogs/PaymentProvidersDialog.vue
Normal file
165
resources/js/components/dialogs/PaymentProvidersDialog.vue
Normal file
@@ -0,0 +1,165 @@
|
||||
<script setup>
|
||||
import americanExDark from '@images/icons/payments/img/ae-dark.png'
|
||||
import americanExLight from '@images/icons/payments/img/american-express.png'
|
||||
import dcDark from '@images/icons/payments/img/dc-dark.png'
|
||||
import dcLight from '@images/icons/payments/img/dc-light.png'
|
||||
import jcbDark from '@images/icons/payments/img/jcb-dark.png'
|
||||
import jcbLight from '@images/icons/payments/img/jcb-light.png'
|
||||
import masterCardDark from '@images/icons/payments/img/master-dark.png'
|
||||
import masterCardLight from '@images/icons/payments/img/mastercard.png'
|
||||
import visaDark from '@images/icons/payments/img/visa-dark.png'
|
||||
import visaLight from '@images/icons/payments/img/visa-light.png'
|
||||
|
||||
const props = defineProps({
|
||||
isDialogVisible: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:isDialogVisible'])
|
||||
|
||||
const visa = useGenerateImageVariant(visaLight, visaDark)
|
||||
const masterCard = useGenerateImageVariant(masterCardLight, masterCardDark)
|
||||
const americanEx = useGenerateImageVariant(americanExLight, americanExDark)
|
||||
const jcb = useGenerateImageVariant(jcbLight, jcbDark)
|
||||
const dc = useGenerateImageVariant(dcLight, dcDark)
|
||||
|
||||
const dialogVisibleUpdate = val => {
|
||||
emit('update:isDialogVisible', val)
|
||||
}
|
||||
|
||||
const paymentProvidersData = [
|
||||
{
|
||||
title: 'Adyen',
|
||||
providers: [
|
||||
visa,
|
||||
masterCard,
|
||||
americanEx,
|
||||
jcb,
|
||||
dc,
|
||||
],
|
||||
},
|
||||
{
|
||||
title: '2Checkout',
|
||||
providers: [
|
||||
visa,
|
||||
americanEx,
|
||||
jcb,
|
||||
dc,
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Airpay',
|
||||
providers: [
|
||||
visa,
|
||||
americanEx,
|
||||
masterCard,
|
||||
jcb,
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Authorize.net',
|
||||
providers: [
|
||||
americanEx,
|
||||
jcb,
|
||||
dc,
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Bambora',
|
||||
providers: [
|
||||
masterCard,
|
||||
americanEx,
|
||||
jcb,
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Bambora',
|
||||
providers: [
|
||||
visa,
|
||||
masterCard,
|
||||
americanEx,
|
||||
jcb,
|
||||
dc,
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Chase Paymentech (Orbital)',
|
||||
providers: [
|
||||
visa,
|
||||
americanEx,
|
||||
jcb,
|
||||
dc,
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Checkout.com',
|
||||
providers: [
|
||||
visa,
|
||||
masterCard,
|
||||
],
|
||||
},
|
||||
]
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VDialog
|
||||
:model-value="props.isDialogVisible"
|
||||
max-width="900"
|
||||
@update:model-value="dialogVisibleUpdate"
|
||||
>
|
||||
<VCard class="refer-and-earn-dialog pa-3 pa-sm-11">
|
||||
<!-- 👉 dialog close btn -->
|
||||
<DialogCloseBtn
|
||||
variant="text"
|
||||
size="default"
|
||||
@click="emit('update:isDialogVisible', false)"
|
||||
/>
|
||||
|
||||
<VCardText class="pt-5">
|
||||
<div class="mb-6">
|
||||
<h4 class="text-h4 text-center mb-2">
|
||||
Select Payment Providers
|
||||
</h4>
|
||||
<p class="text-sm-body-1 text-center">
|
||||
Third-party payment providers
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-for="(item, index) in paymentProvidersData"
|
||||
:key="index"
|
||||
>
|
||||
<div class="d-flex flex-column flex-sm-row justify-space-between align-sm-center align-start gap-4 flex-wrap py-4">
|
||||
<div class="text-high-emphasis font-weight-medium">
|
||||
{{ item.title }}
|
||||
</div>
|
||||
<div class="d-flex gap-x-4 gap-y-2 flex-wrap">
|
||||
<img
|
||||
v-for="(img, iterator) in item.providers"
|
||||
:key="iterator"
|
||||
:src="img.value"
|
||||
height="30"
|
||||
width="50"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<VDivider v-show="index !== paymentProvidersData.length - 1" />
|
||||
</div>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.refer-link-input {
|
||||
.v-field--appended {
|
||||
padding-inline-end: 0;
|
||||
}
|
||||
|
||||
.v-field__append-inner {
|
||||
padding-block-start: 0.125rem;
|
||||
}
|
||||
}
|
||||
</style>
|
50
resources/js/components/dialogs/PricingPlanDialog.vue
Normal file
50
resources/js/components/dialogs/PricingPlanDialog.vue
Normal file
@@ -0,0 +1,50 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
isDialogVisible: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:isDialogVisible'])
|
||||
|
||||
const dialogVisibleUpdate = val => {
|
||||
emit('update:isDialogVisible', val)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VDialog
|
||||
:model-value="props.isDialogVisible"
|
||||
class="v-dialog-xl"
|
||||
@update:model-value="dialogVisibleUpdate"
|
||||
>
|
||||
<VCard class="pricing-dialog pa-2 pa-sm-11">
|
||||
<!-- 👉 dialog close btn -->
|
||||
<DialogCloseBtn
|
||||
variant="text"
|
||||
size="default"
|
||||
@click="emit('update:isDialogVisible', false)"
|
||||
/>
|
||||
|
||||
<VCardText class="pt-5">
|
||||
<AppPricing
|
||||
title="Pricing Plan"
|
||||
md="4"
|
||||
cols="12"
|
||||
>
|
||||
<template #heading>
|
||||
<h4 class="text-h4 pb-2">
|
||||
Pricing Plans
|
||||
</h4>
|
||||
</template>
|
||||
<template #subtitle>
|
||||
<div class="text-body-1">
|
||||
All plans include 40+ advanced tools and features to boost your product. Choose the best plan to fit your needs.
|
||||
</div>
|
||||
</template>
|
||||
</AppPricing>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
</template>
|
186
resources/js/components/dialogs/ReferAndEarnDialog.vue
Normal file
186
resources/js/components/dialogs/ReferAndEarnDialog.vue
Normal file
@@ -0,0 +1,186 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
isDialogVisible: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:isDialogVisible'])
|
||||
|
||||
const dialogVisibleUpdate = val => {
|
||||
emit('update:isDialogVisible', val)
|
||||
}
|
||||
|
||||
const referAndEarnSteps = [
|
||||
{
|
||||
icon: 'ri-send-plane-2-line',
|
||||
title: 'Send Invitation 👍🏻',
|
||||
subtitle: 'Send your referral link to your friend',
|
||||
},
|
||||
{
|
||||
icon: 'ri-pages-line',
|
||||
title: 'Registration 😎',
|
||||
subtitle: 'Let them register to our services',
|
||||
},
|
||||
{
|
||||
icon: 'ri-gift-line',
|
||||
title: 'Free Trial 🎉',
|
||||
subtitle: 'Your friend will get 30 days free trial',
|
||||
},
|
||||
]
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VDialog
|
||||
:model-value="props.isDialogVisible"
|
||||
max-width="900"
|
||||
@update:model-value="dialogVisibleUpdate"
|
||||
>
|
||||
<VCard class="refer-and-earn-dialog pa-sm-11 pa-3">
|
||||
<!-- 👉 dialog close btn -->
|
||||
<DialogCloseBtn
|
||||
variant="text"
|
||||
size="default"
|
||||
@click="emit('update:isDialogVisible', false)"
|
||||
/>
|
||||
|
||||
<VCardText class="pt-5">
|
||||
<div class="text-center pb-3">
|
||||
<h4 class="text-h4 pb-2">
|
||||
Refer & Earn
|
||||
</h4>
|
||||
|
||||
<div class="text-body-1">
|
||||
Invite your friend to Materio, if they sign up, you and your friend will get 30 days free trial
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<VRow class="text-center my-6">
|
||||
<VCol
|
||||
v-for="step in referAndEarnSteps"
|
||||
:key="step.title"
|
||||
cols="12"
|
||||
sm="4"
|
||||
>
|
||||
<div>
|
||||
<VAvatar
|
||||
variant="tonal"
|
||||
size="88"
|
||||
color="primary"
|
||||
class="mb-4"
|
||||
>
|
||||
<VIcon
|
||||
size="40"
|
||||
:icon="step.icon"
|
||||
/>
|
||||
</VAvatar>
|
||||
|
||||
<div class="text-body-1 font-weight-medium mb-2 text-high-emphasis">
|
||||
{{ step.title }}
|
||||
</div>
|
||||
|
||||
<div class="text-body-1">
|
||||
{{ step.subtitle }}
|
||||
</div>
|
||||
</div>
|
||||
</VCol>
|
||||
</VRow>
|
||||
|
||||
<VDivider class="mt-9 mb-6" />
|
||||
|
||||
<h5 class="text-h5 mb-5">
|
||||
Invite your friends
|
||||
</h5>
|
||||
|
||||
<p class="mb-2">
|
||||
Enter your friend's email address and invite them to join Materio 😍
|
||||
</p>
|
||||
<VForm
|
||||
class="d-flex align-center gap-4 mb-6"
|
||||
@submit.prevent="() => {}"
|
||||
>
|
||||
<VTextField
|
||||
placeholder="johnDoe@gmail.com"
|
||||
density="compact"
|
||||
/>
|
||||
|
||||
<VBtn type="submit">
|
||||
Submit
|
||||
</VBtn>
|
||||
</VForm>
|
||||
|
||||
<h5 class="text-h5 mb-5">
|
||||
Share the referral link
|
||||
</h5>
|
||||
|
||||
<p class="mb-2">
|
||||
You can also copy and send it or share it on your social media. 🚀
|
||||
</p>
|
||||
<VForm
|
||||
class="d-flex align-center flex-wrap gap-4"
|
||||
@submit.prevent="() => {}"
|
||||
>
|
||||
<VTextField
|
||||
placeholder="http://referral.link"
|
||||
class="refer-link-input"
|
||||
density="compact"
|
||||
>
|
||||
<template #append-inner>
|
||||
<VBtn variant="text">
|
||||
COPY LINK
|
||||
</VBtn>
|
||||
</template>
|
||||
</VTextField>
|
||||
|
||||
<div class="d-flex gap-1">
|
||||
<VBtn
|
||||
icon
|
||||
class="rounded"
|
||||
color="#3B5998"
|
||||
>
|
||||
<VIcon
|
||||
color="white"
|
||||
icon="ri-facebook-circle-line"
|
||||
/>
|
||||
</VBtn>
|
||||
|
||||
<VBtn
|
||||
icon
|
||||
class="rounded"
|
||||
color="#55ACEE"
|
||||
>
|
||||
<VIcon
|
||||
color="white"
|
||||
icon="ri-twitter-line"
|
||||
/>
|
||||
</VBtn>
|
||||
|
||||
<VBtn
|
||||
icon
|
||||
class="rounded"
|
||||
color="#007BB6"
|
||||
>
|
||||
<VIcon
|
||||
color="white"
|
||||
icon="ri-linkedin-line"
|
||||
/>
|
||||
</VBtn>
|
||||
</div>
|
||||
</VForm>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.refer-link-input {
|
||||
.v-field--appended {
|
||||
padding-inline-end: 0;
|
||||
}
|
||||
|
||||
.v-field__append-inner {
|
||||
padding-block-start: 0.125rem;
|
||||
}
|
||||
}
|
||||
</style>
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user