<?php

namespace App\Admin\Controllers;

use App\Models\DailyCareReport;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;

class DailyCareReportController extends AdminController
{
    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(new DailyCareReport(), function (Grid $grid) {
            $grid->column('student_id');
            $grid->column('log_type')->using(config('map.log_type'));
            $grid->column('situation');
            $grid->column('log_user_id');
            $grid->filter(function (Grid\Filter $filter) {
                $filter->equal('id');
        
            });
        });
    }

    /**
     * Make a show builder.
     *
     * @param mixed $id
     *
     * @return Show
     */
    protected function detail($id)
    {
        return Show::make($id, new DailyCareReport(), function (Show $show) {
            $show->field('id');
            $show->field('student_id');
            $show->field('log_type');
            $show->field('situation');
            $show->field('log_user_id');
            $show->field('diet_json');
            $show->field('drink_json');
            $show->field('nurse_json');
            $show->field('defecation_json');
            $show->field('change_clothes_json');
            $show->field('emotion_json');
            $show->field('sleep_json');
            $show->field('clean_json');
            $show->field('health_json');
            $show->field('medication_json');
            $show->field('temperature_json');
            $show->field('created_at');
            $show->field('updated_at');
        });
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        return Form::make(new DailyCareReport(), function (Form $form) {
            $form->display('id');
            $form->text('student_id');
            $form->text('log_type');
            $form->text('situation');
            $form->text('log_user_id');
            $form->text('diet_json');
            $form->text('drink_json');
            $form->text('nurse_json');
            $form->text('defecation_json');
            $form->text('change_clothes_json');
            $form->text('emotion_json');
            $form->text('sleep_json');
            $form->text('clean_json');
            $form->text('health_json');
            $form->text('medication_json');
            $form->text('temperature_json');
        
            $form->display('created_at');
            $form->display('updated_at');
        });
    }
}
