-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-> Support pin -> Components for homepage
- Loading branch information
Showing
17 changed files
with
601 additions
and
436 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE `mythicalclient_users` ADD `support_pin` TEXT NULL DEFAULT NULL AFTER `verified`; |
27 changes: 27 additions & 0 deletions
27
frontend/src/components/client/Dashboard/Main/BillingInfo.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<template> | ||
<CardComponent> | ||
<h2 class="text-white text-lg font-semibold mb-4">Billing Summary</h2> | ||
<div class="space-y-2 text-sm"> | ||
<div class="flex justify-between"> | ||
<span class="text-purple-200">Current Balance:</span> | ||
<span class="text-white font-medium">$250.00</span> | ||
</div> | ||
<div class="flex justify-between"> | ||
<span class="text-purple-200">Next Invoice:</span> | ||
<span class="text-white font-medium">$120.00</span> | ||
</div> | ||
<div class="flex justify-between"> | ||
<span class="text-purple-200">Due Date:</span> | ||
<span class="text-white font-medium">15 Jul 2023</span> | ||
</div> | ||
</div> | ||
<RouterLink to="/billing" | ||
class="mt-4 block w-full px-4 py-2 bg-purple-600 hover:bg-purple-500 text-white rounded transition-colors text-center text-sm"> | ||
View Invoices | ||
</RouterLink> | ||
</CardComponent> | ||
</template> | ||
<script lang="ts" setup> | ||
import CardComponent from '@/components/client/ui/Card/CardComponent.vue'; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<template> | ||
<div class="flex justify-between items-center"> | ||
<div> | ||
<h1 class="text-3xl font-bold text-white mb-2">My Dashboard</h1> | ||
<div class="text-purple-200 text-sm"> | ||
<RouterLink to="/" class="hover:text-white transition-colors">Portal Home</RouterLink> | ||
<span class="mx-2">/</span> | ||
<span>Client Area</span> | ||
</div> | ||
</div> | ||
<div class="flex items-center space-x-4"> | ||
<div class="text-right"> | ||
<p class="text-purple-200 text-sm">Welcome back,</p> | ||
<p class="text-white font-semibold">{{ Session.getInfo('first_name') }}</p> | ||
</div> | ||
<img :src="`${Session.getInfo('avatar')}?height=40&width=40`" alt="Profile" | ||
class="w-10 h-10 rounded-full border-2 border-purple-500" /> | ||
</div> | ||
</div> | ||
</template> | ||
<script setup lang="ts"> | ||
import Session from '@/mythicalclient/Session'; | ||
</script> |
45 changes: 45 additions & 0 deletions
45
frontend/src/components/client/Dashboard/Main/ProductList.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<template> | ||
<CardComponent> | ||
<div class="flex items-center justify-between mb-4"> | ||
<h2 class="text-lg font-semibold text-white">Your Active Products/Services</h2> | ||
<button class="text-purple-500 hover:text-white transition-colors"> | ||
<MenuIcon class="w-5 h-5" /> | ||
</button> | ||
</div> | ||
<div class="space-y-4"> | ||
<div v-for="(server, index) in servers" :key="index" | ||
class="flex items-center justify-between py-3 border-b border-purple-700 last:border-0"> | ||
<div> | ||
<div class="font-medium text-white">{{ server.name }}</div> | ||
<div class="text-sm text-purple-500">{{ server.hostname }}</div> | ||
</div> | ||
<div class="flex items-center gap-3"> | ||
<span class="px-2 py-1 bg-emerald-500/20 text-emerald-400 rounded text-xs font-medium"> | ||
Active | ||
</span> | ||
<button | ||
class="px-3 py-1 bg-purple-600 hover:bg-purple-500 text-white rounded transition-colors text-sm"> | ||
Manage | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</CardComponent> | ||
|
||
</template> | ||
<script setup lang="ts"> | ||
import CardComponent from '@/components/client/ui/Card/CardComponent.vue'; | ||
import { ref } from 'vue'; | ||
import { MenuIcon } from 'lucide-vue-next'; | ||
const servers = ref([ | ||
{ | ||
name: 'Storage Root Server Frankfurt - Storage KVM S', | ||
hostname: 'backup2.mythical.systems', | ||
}, | ||
{ | ||
name: 'Storage Root Server Frankfurt - Storage KVM S', | ||
hostname: 'backup.mythical.systems', | ||
}, | ||
]); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<template> | ||
<div class="grid grid-cols-3 gap-4"> | ||
<CardComponent v-for="(stat, index) in stats" :key="index"> | ||
<component :is="stat.icon" class="w-6 h-6 text-purple-500 mb-2" /> | ||
<div class="text-3xl font-bold text-white mb-1">{{ stat.value }}</div> | ||
<div class="text-purple-200 text-sm">{{ stat.label }}</div> | ||
</CardComponent> | ||
</div> | ||
</template> | ||
<script lang="ts" setup> | ||
import CardComponent from '@/components/client/ui/Card/CardComponent.vue'; | ||
import { | ||
Server as ServerIcon, | ||
FileText as FileTextIcon, | ||
Ticket as TicketIcon, | ||
} from 'lucide-vue-next'; | ||
const stats = [ | ||
{ icon: ServerIcon, value: '2', label: 'Services' }, | ||
{ icon: FileTextIcon, value: '0', label: 'Unpaid Invoices' }, | ||
{ icon: TicketIcon, value: '1', label: 'Tickets' }, | ||
]; | ||
</script> |
78 changes: 78 additions & 0 deletions
78
frontend/src/components/client/Dashboard/Main/SupportPin.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<template> | ||
<!-- Support PIN --> | ||
<CardComponent> | ||
<h2 class="text-purple-200 text-sm font-medium mb-2">{{ t('Components.SupportPin.title') }}</h2> | ||
<div class="flex items-center gap-2"> | ||
<span class="text-emerald-400 text-2xl font-mono font-bold">{{ Session.getInfo('support_pin') }}</span> | ||
<button @click="copyPin" class="text-purple-500 hover:text-white transition-colors"> | ||
<CopyIcon class="w-4 h-4" /> | ||
</button> | ||
<button @click="resetPin" class="text-purple-500 hover:text-white transition-colors"> | ||
<RefreshCcwIcon class="w-4 h-4 transition-transform duration-500 hover:rotate-180" /> | ||
</button> | ||
|
||
</div> | ||
</CardComponent> | ||
</template> | ||
<script setup lang="ts"> | ||
import CardComponent from '@/components/client/ui/Card/CardComponent.vue'; | ||
import Auth from '@/mythicalclient/Auth'; | ||
import Session from '@/mythicalclient/Session'; | ||
import Swal from 'sweetalert2'; | ||
import { useI18n } from 'vue-i18n'; | ||
import { | ||
RefreshCcw as RefreshCcwIcon, | ||
Copy as CopyIcon, | ||
} from 'lucide-vue-next'; | ||
const { t } = useI18n(); | ||
const copyPin = async () => { | ||
const pin = Session.getInfo('support_pin'); | ||
try { | ||
if (!navigator.clipboard) { | ||
const textArea = document.createElement('textarea') | ||
textArea.value = pin | ||
document.body.appendChild(textArea) | ||
textArea.select() | ||
document.execCommand('copy') | ||
document.body.removeChild(textArea) | ||
} else { | ||
await navigator.clipboard.writeText(pin) | ||
} | ||
Swal.fire({ | ||
icon: 'success', | ||
title: t('Components.Global.Navigation.Copy.Title'), | ||
text: t('Components.Global.Navigation.Copy.Success'), | ||
footer: t('Components.Global.Navigation.Copy.Footer'), | ||
}) | ||
} catch (err) { | ||
console.error('Failed to copy command to clipboard', err) | ||
} | ||
}; | ||
const resetPin = async () => { | ||
try { | ||
const ping = await Auth.resetPin(); | ||
const pinElement = document.querySelector('span.text-emerald-400'); | ||
if (pinElement) { | ||
pinElement.textContent = ping.toString(); | ||
Swal.fire({ | ||
title: t('Components.SupportPin.alerts.success.title'), | ||
text: t('Components.SupportPin.alerts.success.pin_success'), | ||
icon: 'success', | ||
footer: t('Components.SupportPin.alerts.success.footer'), | ||
}); | ||
} | ||
} catch (error) { | ||
console.error('Failed to reset support pin:', error); | ||
Swal.fire({ | ||
title: t('Components.SupportPin.alerts.error.title'), | ||
text: t('Components.SupportPin.alerts.error.generic'), | ||
icon: 'error', | ||
footer: t('Components.SupportPin.alerts.error.footer'), | ||
}); | ||
} | ||
}; | ||
</script> |
40 changes: 40 additions & 0 deletions
40
frontend/src/components/client/Dashboard/Main/TicketList.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<template> | ||
<!-- Recent Tickets --> | ||
<CardComponent> | ||
<h2 class="text-lg font-semibold text-white mb-4">Recent Tickets</h2> | ||
<div class="space-y-3"> | ||
<div v-for="ticket in recentTickets" :key="ticket.id" | ||
class="flex items-center justify-between py-2 border-b border-purple-700 last:border-0"> | ||
<div> | ||
<div class="font-medium text-white">{{ ticket.title }}</div> | ||
<div class="text-sm text-purple-500">{{ ticket.date }}</div> | ||
</div> | ||
<span :class="[ | ||
'px-2 py-1 rounded text-xs font-medium', | ||
ticket.status === 'Open' | ||
? 'bg-yellow-500/20 text-yellow-400' | ||
: 'bg-emerald-500/20 text-emerald-400', | ||
]"> | ||
{{ ticket.status }} | ||
</span> | ||
</div> | ||
</div> | ||
<RouterLink to="/support" | ||
class="mt-4 block w-full px-4 py-2 bg-purple-600 hover:bg-purple-500 text-white rounded transition-colors text-center text-sm"> | ||
View All Tickets | ||
</RouterLink> | ||
</CardComponent> | ||
|
||
</template> | ||
|
||
<script setup lang="ts"> | ||
import CardComponent from '@/components/client/ui/Card/CardComponent.vue'; | ||
import { ref } from 'vue'; | ||
const recentTickets = ref([ | ||
{ id: 1, title: 'Server Performance Issue', date: '2023-07-01', status: 'Open' }, | ||
{ id: 2, title: 'Billing Inquiry', date: '2023-06-28', status: 'Closed' }, | ||
{ id: 3, title: 'Domain Transfer Request', date: '2023-06-25', status: 'Open' }, | ||
]); | ||
</script> |
Oops, something went wrong.