<?php

namespace App\Admin\Controllers;

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

class AssessmentReportController extends AdminController
{
    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(new AssessmentReport(), function (Grid $grid) {
            $grid->column('student_id')->using(config('map.students'));
            $grid->column('school_year')->using(config('map.school_year'));
            $grid->column('semester')->using(config('map.semester'));
            $grid->column('title');
            $grid->column('report_type')->using(config('map.report_type'));
            $grid->column('add_user_id')->using(config('map.teachers'));
            $grid->column('is_pdf')->using(config('map.is_pdf'));
            $grid->column('is_publish')->using(config('map.is_publish'));
            $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 AssessmentReport(), function (Show $show) {
            $show->field('id');
            $show->field('id');
            $show->field('student_id');
            $show->field('school_year');
            $show->field('semester');
            $show->field('title');
            $show->field('report_type');
            $show->field('add_user_id');
            $show->field('is_pdf');
            $show->field('is_publish');
            $show->field('created_at');
            $show->field('updated_at');
        });
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        return Form::make(new AssessmentReport(), function (Form $form) {
            $form->display('id');
            $form->text('student_id');
            $form->text('school_year');
            $form->text('semester');
            $form->text('title');
            $form->text('report_type');
            $form->text('add_user_id');
            $form->text('is_pdf');
            $form->text('is_publish');
        
            $form->display('created_at');
            $form->display('updated_at');
        });
    }
}
