| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php
- namespace App\Admin\Controllers;
- use App\Models\MedicationEntrustment;
- use Dcat\Admin\Form;
- use Dcat\Admin\Grid;
- use Dcat\Admin\Show;
- use Dcat\Admin\Http\Controllers\AdminController;
- class MedicationEntrustmentController extends AdminController
- {
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- return Grid::make(new MedicationEntrustment(), function (Grid $grid) {
-
- $grid->column('student_id')->using(config('map.students'));
- $grid->column('reason');
- $grid->column('use_time');
- $grid->column('detail');
- $grid->column('desc');
- $grid->column('photos')->image('',80);
- $grid->column('sign');
- $grid->filter(function (Grid\Filter $filter) {
- $filter->panel();
- $filter->date('created_at')->datetime()->width(4);
- $filter->equal('student_id','输入/选择学生')->select(config('map.students'))->width(4);
- });
- });
- }
- /**
- * Make a show builder.
- *
- * @param mixed $id
- *
- * @return Show
- */
- protected function detail($id)
- {
- return Show::make($id, new MedicationEntrustment(), function (Show $show) {
- $show->row(function (Show\Row $show) {
- $show->field('content','用药委托详情')
- ->width(8)
- ->unescape()
- ->as(function () {
- $html = '';
- $html .= '<div style="text-align:left">';
- $html .= '<div style="margin-top:5px">用药对象:' . config('map.students')[$this->student_id] . '</div>';
- $html .= '<div style="margin-top:5px">用药时间:' . $this->use_time . '</div>';
- $html .= '<div style="margin-top:5px">用药明细:' . $this->detail . '</div>';
- $html .= '<div style="margin-top:5px">用药说明:' . $this->desc . '</div>';
- $html .= '<div style="margin-top:5px">接回照片:</div>';
- $html .= '<img data-action="preview-img" src="' . $this->photos . '" style="height:50px;width:50px;cursor:pointer;margin-right:10px;" class="img img-thumbnail">';
- $html .= '<div style="margin-top:5px">签名:' . $this->sign . '</div>';
- $html .= '</div>';
- return $html;
- });
- });
- });
- }
- /**
- * Make a form builder.
- *
- * @return Form
- */
- protected function form()
- {
- return Form::make(new MedicationEntrustment(), function (Form $form) {
-
- $form->text('student_id');
- $form->text('reason');
- $form->text('use_time');
- $form->text('detail');
- $form->text('desc');
- $form->text('photos');
- $form->text('sign');
- });
- }
- }
|