1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace App\Community\Controllers;
- use App\Models\Order;
- use App\Models\Organization;
- use Encore\Admin\Controllers\AdminController;
- use Encore\Admin\Grid;
- class NurseServiceController extends AdminController
- {
- /**
- * Title for current resource.
- *
- * @var string
- */
- protected $title = '儿保服务';
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- $grid = new Grid(new Organization());
- $grid->column('name', __('社区医院'));
- $type = request('product_type',5);
- $grid->column('orders', __('总订单数'))->display(function () use ($type) {
- return Order::where('organization_id',$this->id)->where('product_type',$type)->count();
- });
- $grid->column('ordering', __('进行中订单'))->where('product_type',$type)->display(function () use ($type) {
- return Order::where(['organization_id'=>$this->id,'order_status'=>3])->count();
- });
- $grid->column('is_ok', __('完成数量'))->display(function () use ($type) {
- return Order::where(['organization_id'=>$this->id,'order_status'=>4])->where('product_type',$type)->count();
- });
- $grid->column('anomaly', __('异常数量'))->display(function () use ($type) {
- return Order::where(['organization_id'=>$this->id])->where('product_type',$type)->orWhere('order_status',5)->orWhere('payment_status','>',2)->count();
- });
- $grid->filter(function ($filter){
- $filter->disableIdFilter();
- $filter->equal('id','机构')->select(Organization::pluck('name','id'));
- });
- $grid->actions(function ($actions) {
- $actions->disableEdit();
- $actions->disableView();
- $actions->disableDelete();
- });
- return $grid;
- }
- }
|