You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
monitor-doc/resources/js/Pages/Dashboard.jsx

65 lines
2.7 KiB
React

2 years ago
import React from 'react';
2 years ago
import "@fullcalendar/react/dist/vdom";
import FullCalendar from '@fullcalendar/react' // must go before plugins
import dayGridPlugin from '@fullcalendar/daygrid' // a plugin!
import interactionPlugin from "@fullcalendar/interaction" // needed for dayClick
2 years ago
import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout';
import { Head } from '@inertiajs/inertia-react';
export default function Dashboard(props) {
2 years ago
const { count_active, count_update, count_expired, count_total, events } = props
console.log(events)
const calenderEvents = events.map(e => { return {title: `${e.document.no_doc} - ${e.document.pic_name}`, date: e.date} })
const handleDateClick = (arg) => { // bind with an arrow function
alert(arg.dateStr)
}
2 years ago
return (
<AuthenticatedLayout
auth={props.auth}
errors={props.errors}
flash={props.flash}
2 years ago
>
<Head title="Dashboard" />
<div className='mx-auto px-2 md:px-4 lg:px-8 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-1'>
<div className="stats bg-base-100 shadow-md w-full">
<div className="stat">
<div className="stat-title">Dokumen Aktif</div>
<div className="stat-value">{count_active}</div>
2 years ago
</div>
</div>
<div className="stats bg-base-100 shadow-md w-full">
<div className="stat">
<div className="stat-title">Dokumen Diperbarui</div>
<div className="stat-value">{count_update}</div>
</div>
</div>
<div className="stats bg-base-100 shadow-md w-full">
<div className="stat">
<div className="stat-title">Dokumen Berakhir</div>
<div className="stat-value">{count_expired}</div>
</div>
</div>
<div className="stats bg-base-100 shadow-md w-full">
<div className="stat">
<div className="stat-title">Total Dokumen</div>
<div className="stat-value">{count_total}</div>
</div>
</div>
</div>
2 years ago
<div className='bg-base-100 mx-8 mt-4 p-2 md:p-4 lg:p-8'>
<FullCalendar
plugins={[ dayGridPlugin, interactionPlugin ]}
initialView="dayGridMonth"
dateClick={handleDateClick}
eventClick={(arg) => console.log(arg)}
events={calenderEvents}
/>
</div>
2 years ago
</AuthenticatedLayout>
);
}