Teren-app/resources/js/Pages/Dashboard.vue
2024-11-13 22:11:07 +01:00

87 lines
2.9 KiB
Vue

<script setup>
import BasicTable from '@/Components/BasicTable.vue';
import SectionTitle from '@/Components/SectionTitle.vue';
import AppLayout from '@/Layouts/AppLayout.vue';
import { LinkOptions as C_LINK, TableColumn as C_TD, TableRow as C_TR} from '@/Shared/AppObjects';
const props = defineProps({
chart: Object,
people: Array
});
console.log(props.people)
const tablePersonHeader = [
C_TD.make('Nu.', 'header'),
C_TD.make('Name', 'header'),
C_TD.make('Group', 'header')
];
let tablePersonBody = [];
const getRoute = (person) => {
if( person.client ){
return {route: 'client.show', options: person.client};
}
return {route: 'clientCase.show', options: person.client_case};
}
props.people.forEach((p) => {
const forLink = getRoute(p);
const cols = [
C_TD.make(Number(p.nu), 'body', {}, C_LINK.make(forLink.route, forLink.options, `font-bold hover:text-${p.group.color_tag}`)),
C_TD.make(p.full_name, 'body'),
C_TD.make(p.group.name)
];
tablePersonBody.push(C_TR.make(cols, {class: `border-l-4 border-${p.group.color_tag}`}))
});
</script>
<template>
<AppLayout title="Dashboard">
<template #header>
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
Dashboard
</h2>
</template>
<div class="pt-12 hidden md:block">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg p-2">
<apexchart :width="chart.width" :height="chart.height" :type="chart.type" :options="chart.options" :series="chart.series"></apexchart>
</div>
</div>
</div>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8 grid md:grid-cols-2 gap-6">
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg">
<SectionTitle class="p-4">
<template #title>
Terrain
</template>
<template #description>
List of new contracts for terrain work
</template>
</SectionTitle>
<BasicTable :header="tablePersonHeader" :body="tablePersonBody"></BasicTable>
</div>
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg">
<SectionTitle class="p-4">
<template #title>
Last added
</template>
<template #description>
List of new people
</template>
</SectionTitle>
<BasicTable :header="tablePersonHeader" :body="tablePersonBody"></BasicTable>
</div>
</div>
</div>
</AppLayout>
</template>