-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-> fixed dumb dumb mistakes
- Loading branch information
Showing
10 changed files
with
419 additions
and
404 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 was deleted.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -50,4 +50,4 @@ | |
"vite-plugin-vue-devtools": "^7.5.4", | ||
"vue-tsc": "^2.1.10" | ||
} | ||
} | ||
} |
113 changes: 72 additions & 41 deletions
113
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 |
---|---|---|
@@ -1,45 +1,76 @@ | ||
<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'; | ||
import Tickets from '@/mythicalclient/Tickets'; | ||
import { ref, onMounted } from 'vue'; | ||
import { useI18n } from 'vue-i18n'; | ||
interface Ticket { | ||
id: number; | ||
title: string; | ||
date: string; | ||
status: string; | ||
} | ||
const { t } = useI18n(); | ||
const recentTickets = ref<Ticket[]>([]); | ||
import { format } from 'date-fns'; | ||
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' }, | ||
]); | ||
const fetchRecentTickets = async () => { | ||
try { | ||
const response = await Tickets.getTickets(); | ||
if (response.success && Array.isArray(response.tickets)) { | ||
recentTickets.value = response.tickets.slice(0, 3).map((ticket: { date: string | number | Date; status: string; }) => ({ | ||
...ticket, | ||
date: format(new Date(ticket.date), 'PPP'), | ||
status: ticket.status | ||
.split(' ') | ||
.map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) | ||
.join(' ') | ||
.replace('Inprogress', 'In Progress') | ||
})); | ||
} else { | ||
throw new Error(response.error || 'Failed to fetch tickets'); | ||
} | ||
} catch (err) { | ||
console.error('Error fetching recent tickets:', err); | ||
} | ||
}; | ||
onMounted(fetchRecentTickets); | ||
</script> | ||
|
||
<template> | ||
<!-- Recent Tickets --> | ||
<CardComponent> | ||
<h2 class="text-lg font-semibold text-white mb-4">{{ t('Components.Tickets.title') }}</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-green-500/20 text-green-400' | ||
: ticket.status === 'Closed' | ||
? 'bg-red-500/20 text-red-400' | ||
: ticket.status === 'Waiting' | ||
? 'bg-orange-500/20 text-orange-400' | ||
: ticket.status === 'Replied' | ||
? 'bg-blue-500/20 text-blue-400' | ||
: ticket.status === 'In Progress' | ||
? 'bg-purple-500/20 text-purple-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"> | ||
{{ t('Components.Tickets.viewMore') }} | ||
</RouterLink> | ||
</CardComponent> | ||
</template> |
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
Oops, something went wrong.