From 617bddefa13eb127e44f35f7716d10d6020bca5c Mon Sep 17 00:00:00 2001
From: Moein Moradi
Date: Wed, 24 Sep 2025 12:12:33 +0330
Subject: [PATCH] refactor: demo page
---
config/cors.php | 33 ++
.../js/@core/components/TheCustomizer.vue | 2 +-
resources/js/pages/dashboards/demo.vue | 45 +-
resources/js/pages/dashboards/wbs.vue | 27 +-
.../ecommerce/EcommerceGeneratedLeads.vue | 450 ++++++++++++++----
resources/styles/overview.scss | 44 +-
6 files changed, 479 insertions(+), 122 deletions(-)
create mode 100644 config/cors.php
diff --git a/config/cors.php b/config/cors.php
new file mode 100644
index 0000000..10ec499
--- /dev/null
+++ b/config/cors.php
@@ -0,0 +1,33 @@
+ ['api/*', 'dev/*', 'sanctum/csrf-cookie'],
+
+ 'allowed_methods' => ['*'],
+
+ 'allowed_origins' => [
+ 'http://localhost:8000',
+ 'http://megategra.com:8001'
+ ],
+
+ 'allowed_origins_patterns' => [],
+
+ 'allowed_headers' => ['*'],
+
+ 'exposed_headers' => [],
+
+ 'max_age' => 0,
+
+ 'supports_credentials' => true,
+
+];
diff --git a/resources/js/@core/components/TheCustomizer.vue b/resources/js/@core/components/TheCustomizer.vue
index 7cd3aa5..6586dfa 100644
--- a/resources/js/@core/components/TheCustomizer.vue
+++ b/resources/js/@core/components/TheCustomizer.vue
@@ -40,7 +40,7 @@ const vuetifyTheme = useTheme()
const route = useRoute()
const isCrmRoute = computed(() => {
- return route.path === '/dashboards/crm'
+ return route.path === '/dashboards/crm' || route.path === '/dashboards/demo'
})
const colors = [
diff --git a/resources/js/pages/dashboards/demo.vue b/resources/js/pages/dashboards/demo.vue
index 58adf05..d6b8d2a 100644
--- a/resources/js/pages/dashboards/demo.vue
+++ b/resources/js/pages/dashboards/demo.vue
@@ -10,8 +10,8 @@ import TasksTable from "./task.vue";
import ResourcesTable from "./resource.vue";
import GanttChart from './gantt.vue'
-
const isEditMode = ref(false)
+const autoCompact = ref(true)
let grid = null
const handleEditModeChange = (event) => {
@@ -33,6 +33,9 @@ const handleDeleteCard = (cardId) => {
const element = document.querySelector(`[data-card-id="${cardId}"]`)
if (element && grid) {
grid.removeWidget(element)
+ if (autoCompact.value) {
+ grid.compact()
+ }
}
}
@@ -45,6 +48,12 @@ onMounted(async () => {
resizable: true,
disableOneColumnMode: true,
animate: true,
+ columnOpts: {
+ breakpoints: [
+ { w: 768, c: 1 },
+ { w: 992, c: 12 }
+ ]
+ }
})
grid.enableMove(false)
@@ -60,22 +69,6 @@ onUnmounted(() => {
if (grid) {
grid.destroy(false)
}
-
- setTimeout(() => {
- if (gridContainer.value) {
- grid = GridStack.init({
- column: 12,
- cellHeight: 50,
- float: true,
- draggable: {
- handle: '.grid-stack-item-content'
- },
- resizable: {
- handles: 'e, se, s, sw, w'
- }
- }, gridContainer.value)
- }
- }, 100)
})
@@ -101,6 +94,16 @@ onUnmounted(() => {
+
+
+
+
@@ -203,13 +206,13 @@ onUnmounted(() => {
+ data-card-id="analysis2">
-
+
mdi-drag-horizontal-variant
+ title="Delete analysis2" @click.stop="handleDeleteCard('analysis2')">
Delete
@@ -247,7 +250,7 @@ onUnmounted(() => {
-
diff --git a/resources/js/pages/dashboards/wbs.vue b/resources/js/pages/dashboards/wbs.vue
index ab1422d..a5a6aff 100644
--- a/resources/js/pages/dashboards/wbs.vue
+++ b/resources/js/pages/dashboards/wbs.vue
@@ -2,6 +2,22 @@
import HC from "highcharts"
import { ref, onMounted } from "vue"
+// Props for component reusability
+const props = defineProps({
+ title: {
+ type: String,
+ default: "The Germanic Language Tree"
+ },
+ backgroundColor: {
+ type: String,
+ default: ""
+ },
+ showBackground: {
+ type: Boolean,
+ default: true
+ }
+})
+
const cssRGB = name => getComputedStyle(document.documentElement).getPropertyValue(name).trim()
const toHex = rgb => {
const [r,g,b] = rgb.split(",").map(v => parseInt(v,10))
@@ -62,7 +78,7 @@ onMounted(() => {
const chartOptions = ref({
chart: { inverted: true, height: 1200, backgroundColor: 'transparent' },
- title: { text: "The Germanic Language Tree" },
+ title: { text: props.title },
accessibility: { point: { descriptionFormat: "{add index 1}. {toNode.id} comes from {fromNode.id}" } },
tooltip: { outside: true },
series: [{
@@ -133,7 +149,12 @@ const chartOptions = ref({
-
+
@@ -141,7 +162,7 @@ const chartOptions = ref({
\ No newline at end of file
diff --git a/resources/js/views/dashboards/ecommerce/EcommerceGeneratedLeads.vue b/resources/js/views/dashboards/ecommerce/EcommerceGeneratedLeads.vue
index 183db67..a5a0c9f 100644
--- a/resources/js/views/dashboards/ecommerce/EcommerceGeneratedLeads.vue
+++ b/resources/js/views/dashboards/ecommerce/EcommerceGeneratedLeads.vue
@@ -1,45 +1,276 @@
-
-
-
+
+
+
-
- Generated Leads
+
+ {{ title }}
-
- Monthly Report
+
+ {{ subtitle }}
-
- 4,350
-
-
-
-
- 15.8%
-
-
+
+
+
+
+
+
+
+ Error
+
+
+
+
+ Failed to load
+
+
+
+
+
+
+ {{ formattedTotal }}
+
+
+
+
+
+ {{ item.label }}:
+
+
+ {{ item.formatted }}
+
+
+
+
+
+
+
+
+ {{ percentageChange.value }}%
+
+
+
+
+
+ {{ apiData.length }} leads
+
+
+
-
-
-
+
+
diff --git a/resources/styles/overview.scss b/resources/styles/overview.scss
index a944d30..191febf 100644
--- a/resources/styles/overview.scss
+++ b/resources/styles/overview.scss
@@ -1,6 +1,5 @@
.grid-stack-container {
position: relative;
- transition: all 0.3s ease;
}
.grid-stack-container.edit-mode-active {
@@ -11,7 +10,6 @@
.grid-stack-item {
position: relative;
- transition: all 0.3s ease;
}
.grid-stack-item.edit-mode {
@@ -260,6 +258,32 @@
opacity: 1;
}
+.custom-toggle {
+ .v-selection-control__input {
+ .v-switch__track {
+ background-color: rgba(255, 255, 255, 0.3) !important;
+ opacity: 1 !important;
+ }
+ }
+
+ &.v-switch--on .v-selection-control__input {
+ .v-switch__track {
+ background-color: rgba(255, 255, 255, 0.8) !important;
+ }
+
+ .v-switch__thumb {
+ background-color: rgba(var(--v-theme-primary), 1) !important;
+ }
+ }
+
+ .v-label {
+ color: rgba(255, 255, 255, 0.95) !important;
+ font-weight: 500;
+ font-size: 0.9rem;
+ text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
+ }
+}
+
@media (max-width: 768px) {
.banner-content {
flex-direction: column;
@@ -291,4 +315,20 @@
padding: 3px 6px !important;
height: 24px !important;
}
+
+ .auto-compact-switch {
+ .v-switch__track {
+ width: 44px !important;
+ height: 22px !important;
+ }
+
+ .v-switch__thumb {
+ width: 18px !important;
+ height: 18px !important;
+ }
+
+ .v-label {
+ font-size: 0.85rem;
+ }
+ }
}
\ No newline at end of file