12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- namespace App\Community\Controllers;
- use App\Admin\Actions\Cdmuser;
- use App\Admin\Actions\UpdateCdms;
- use App\Models\Area;
- use App\Models\Order;
- use App\Models\Organization;
- use Encore\Admin\Controllers\AdminController;
- use Encore\Admin\Form;
- use Encore\Admin\Grid;
- use Encore\Admin\Show;
- class OrganizationController 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->model()->orderByDesc('id');
- $grid->column('name', __('社区医院'));
- $type = request('product_type',4);
- $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')->toArray());
- });
- $grid->actions(function ($actions) {
- $actions->disableEdit();
- $actions->disableView();
- $actions->disableDelete();
- });
- return $grid;
- }
- }
|