| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <?php
- namespace App\Admin\Controllers;
- use App\Models\Student;
- use Dcat\Admin\Form;
- use Dcat\Admin\Grid;
- use Dcat\Admin\Show;
- use Dcat\Admin\Http\Controllers\AdminController;
- use App\Admin\Actions\Form\ToothLog;
- class StudentController extends AdminController
- {
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- return Grid::make(new Student(), function (Grid $grid) {
- //$grid->column('id')->sortable();
- $grid->column('name');
- $grid->column('sex')->using(config('map.sex'));
- $grid->column('month_old');
- $grid->column('join_garden_time');
- $grid->column('parent_name');
- $grid->column('class_id')->using(config('map.class'));
- $grid->disableCreateButton();
- $grid->actions(function (Grid\Displayers\Actions $actions){
- //$actions->append(new Send(Order::class,$actions->row->id));
- $actions->append('成长数据');
- $actions->append('疫苗接种记录');
- $actions->append('考勤登记');
- $actions->append('相册');
- //$actions->append(new ToothLog(Student::class,$actions->row->id));
- $actions->append('<a href="' . admin_url('toothlog/' . $actions->row->id.'/index') . '">长牙记录</i></a>');
- });
- $grid->filter(function (Grid\Filter $filter) {
- $filter->panel();
- $filter->like('name')->width(4);
- });
- });
- }
- /**
- * Make a show builder.
- *
- * @param mixed $id
- *
- * @return Show
- */
- protected function detail($id)
- {
- return Show::make($id, new Student(), function (Show $show) {
- $show->field('id');
- $show->field('name');
- $show->field('sex');
- $show->field('month_old');
- $show->field('join_garden_time');
- $show->field('parent_name');
- $show->field('class_id');
- $show->field('name_en');
- $show->field('blood_type');
- $show->field('hypersensitive_source');
- $show->field('past_medical_history');
- $show->field('birthday');
- $show->field('exclusive_consultant_name');
- $show->field('exclusive_consultant_phone');
- $show->field('home_address');
- $show->field('hobby');
- $show->field('family_lang');
- $show->field('sleep_habits_and_others');
- $show->field('first_communication_of_parents');
- $show->field('created_at');
- $show->field('updated_at');
- });
- }
- /**
- * Make a form builder.
- *
- * @return Form
- */
- protected function form()
- {
- return Form::make(new Student(), function (Form $form) {
- //$form->display('id');
- $form->row(function (Form\Row $row) {
- $row->width(6)->text('name')->required()->placeholder('请输入中文名');
- $row->width(6)->text('name_en')->placeholder('请输入英文名');
- });
- $form->row(function (Form\Row $row) {
- $row->width(6)->select('sex')->options(config('map.sex'));
- $row->width(6)->select('blood_type')->options(config('map.blood_type'));
- });
- $form->row(function (Form\Row $row) {
- $row->width(12)->text('hypersensitive_source');
- });
- $form->row(function (Form\Row $row) {
- $row->textarea('past_medical_history')->required();
- });
- $form->row(function (Form\Row $row) {
- $row->width(6)->text('birthday')->required();
- $row->width(6)->text('join_garden_time');
- });
- $form->row(function (Form\Row $row) {
- $row->width(6)->text('exclusive_consultant_name')->placeholder('请输入专属顾问名');
- $row->width(6)->text('exclusive_consultant_phone')->placeholder('请输入专属顾问联系方式');
- });
- $form->row(function (Form\Row $row) {
- $row->width(6)->text('parent_name')->placeholder('请输入家长名');
- });
- $form->row(function (Form\Row $row) {
- $row->text('home_address');
- });
- $form->row(function (Form\Row $row) {
- $row->width(6)->text('hobby')->placeholder('请输入喜好');
- $row->width(6)->text('family_lang')->placeholder('请输入家庭语言');
- });
- $form->row(function (Form\Row $row) {
- $row->text('sleep_habits_and_others');
- });
- $form->row(function (Form\Row $row) {
- $row->textarea('first_communication_of_parents');
- });
- // $form->text('month_old');
- // $form->text('class_id');
- });
- }
- }
|