share doc and sorting, next email & calender

original
ajikamaludin 2 years ago
parent 6576de5b89
commit 112955a782
Signed by: ajikamaludin
GPG Key ID: 476C9A2B4B794EBB

@ -22,6 +22,7 @@ class DocumentController extends Controller
} else { } else {
$query->orderBy('created_at'); $query->orderBy('created_at');
} }
if ($request->q != null || $request->q != '') { if ($request->q != null || $request->q != '') {
$query->where(function ($query) use ($request) { $query->where(function ($query) use ($request) {
$query->where('no_doc', 'like', '%'.$request->q.'%') $query->where('no_doc', 'like', '%'.$request->q.'%')
@ -252,9 +253,9 @@ class DocumentController extends Controller
foreach ($request->shares as $share) { foreach ($request->shares as $share) {
$user = User::where('email', $share['share_to'])->first(); $user = User::where('email', $share['share_to'])->first();
if ($user != null) { if ($user != null) {
$doc->shares()->create(['user_id' => $user->id, 'share_to' => $share['share_to']]); $doc->shares()->updateOrCreate(['user_id' => $user->id, 'share_to' => $share['share_to']]);
} else { } else {
$doc->shares()->create(['share_to' => $share['share_to']]); $doc->shares()->updateOrCreate(['share_to' => $share['share_to']]);
} }
// TODO: plase send email here // TODO: plase send email here
} }

@ -13,6 +13,8 @@ export default function Dashboard(props) {
const calenderEvents = events.map(e => { return {title: `${e.document.no_doc} - ${e.document.pic_name}`, date: e.date} }) 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 const handleDateClick = (arg) => { // bind with an arrow function
// apa yang harus di handle: tampilkan saja modal yang ada event pada date ini kemudian bisa tambah reminder atau hapus reminder pada data ini,
// untuk tambah reminder pilih form doc id saja kemudian tambah , untuk delete cukup confirm kemudian hilang
alert(arg.dateStr) alert(arg.dateStr)
} }
@ -50,7 +52,7 @@ export default function Dashboard(props) {
</div> </div>
</div> </div>
</div> </div>
<div className='bg-base-100 mx-8 mt-4 p-2 md:p-4 lg:p-8'> <div className='bg-base-100 mx-2 md:mx-8 mt-4 p-2 md:p-4 lg:p-8 h-auto'>
<FullCalendar <FullCalendar
plugins={[ dayGridPlugin, interactionPlugin ]} plugins={[ dayGridPlugin, interactionPlugin ]}
initialView="dayGridMonth" initialView="dayGridMonth"

@ -159,7 +159,7 @@ export default function FormDocument(props) {
</div> </div>
<div className="grid grid-cols-2 md:grid-cols-4 gap-1 mt-4"> <div className="grid grid-cols-2 md:grid-cols-4 gap-1 mt-4">
{doc.reminders.map((reminder, index) => ( {doc.reminders.map((reminder, index) => (
<div className='card text-center shadow-md pt-2 pb-4 px-2' key={index}> <div className='card text-center shadow-md pt-2 pb-2 px-2 bg-blue-300' key={index}>
<div> <div>
{reminder.date} {reminder.date}
</div> </div>

@ -282,15 +282,15 @@ export default function FormDocument(props) {
</div> </div>
<div className="grid grid-cols-2 md:grid-cols-4 gap-1 mt-4"> <div className="grid grid-cols-2 md:grid-cols-4 gap-1 mt-4">
{reminders.map((reminder, index) => ( {reminders.map((reminder, index) => (
<div className='card text-center shadow-md pt-2 pb-4 px-2' key={index}> <div className='card text-center shadow-md pt-2 pb-2 px-2 bg-blue-300' key={index}>
<div className="card-actions justify-end"> <div className='flex'>
<div className='flex-1'>
{reminder}
</div>
<div className="btn btn-square btn-error btn-xs" onClick={() => handleRemoveReminder(index)}> <div className="btn btn-square btn-error btn-xs" onClick={() => handleRemoveReminder(index)}>
<IconCross/> <IconCross/>
</div> </div>
</div> </div>
<div>
{reminder}
</div>
</div> </div>
))} ))}
</div> </div>

Loading…
Cancel
Save