| xqd
@@ -31,6 +31,7 @@ class VaccineController extends AdminController
|
|
|
protected function grid()
|
|
|
{
|
|
|
$grid = new Grid(new Vaccine());
|
|
|
+ $grid->model()->orderByDesc('stock');
|
|
|
$grid->model()->orderByDesc('id');
|
|
|
$org_id = Admin::user()->org_id;
|
|
|
if(!empty($org_id)){
|
| xqd
@@ -41,7 +42,7 @@ class VaccineController extends AdminController
|
|
|
$grid->column('id', __('ID'));
|
|
|
$grid->column('name', __('疫苗名称'));
|
|
|
|
|
|
- $grid->column('type', __('疫苗类型'))->using(OrganizationVaccine::getType())->label('info');
|
|
|
+ $grid->column('type', __('疫苗类型'))->using(Vaccine::getType())->label('info');
|
|
|
$grid->column('price', __('价格'))->display(function ($p){
|
|
|
$t = $this->type;
|
|
|
if($t == 1)return '免费';
|
| xqd
@@ -52,16 +53,10 @@ class VaccineController extends AdminController
|
|
|
$actions->disableDelete();
|
|
|
});
|
|
|
|
|
|
-// $grid->column('stock', __('库存'));
|
|
|
-
|
|
|
$grid->column('stock', __('剩余库存'))->display(function ($w){
|
|
|
return !empty($w) ? $w : 0;
|
|
|
});
|
|
|
-// $grid->column('org_id', __('已使用量'))->display(function () {
|
|
|
-// return Order::where(['product_type'=>4])->wherehas('orderVaccine',function ($query){
|
|
|
-// $query->where('vaccine_id',$this->id);
|
|
|
-// })->count();
|
|
|
-// });
|
|
|
+// $grid->column('use_count', __('已使用量'));
|
|
|
// $grid->column('today_num', __('今日预约'))->display(function () {
|
|
|
// return Order::where(['product_type'=>4])->wherehas('orderVaccine',function ($query){
|
|
|
// $query->where('vaccine_id',$this->id);
|
| xqd
@@ -71,6 +66,7 @@ class VaccineController extends AdminController
|
|
|
$grid->column('remark', __('备注'));
|
|
|
$grid->filter(function ($fliter){
|
|
|
$fliter->like('name','疫苗');
|
|
|
+ $fliter->equal('type','疫苗类型')->select(Vaccine::getType());
|
|
|
});
|
|
|
|
|
|
$grid->column('created_at', __('创建时间'));
|
| xqd
@@ -95,7 +91,7 @@ class VaccineController extends AdminController
|
|
|
|
|
|
$show->field('id', __('Id'));
|
|
|
$show->field('name', __('疫苗'));
|
|
|
- $show->field('type', __('疫苗类型'))->using(OrganizationVaccine::getType());
|
|
|
+ $show->field('type', __('疫苗类型'))->using(Vaccine::getType());
|
|
|
$show->field('price', __('价格'))->as(function ($w){
|
|
|
return round($w/100, 2).'元';
|
|
|
});
|
| xqd
@@ -131,7 +127,7 @@ class VaccineController extends AdminController
|
|
|
$form->hidden('org_id', __('类型'))->value($org_id);
|
|
|
}
|
|
|
$form->text('name', __('疫苗名称'))->rules('required',['required'=>'请输入疫苗']);
|
|
|
- $form->select('type', __('疫苗类型'))->options(OrganizationVaccine::getType())->when(1,function () use($form){
|
|
|
+ $form->select('type', __('疫苗类型'))->options(Vaccine::getType())->when(1,function () use($form){
|
|
|
$form->hidden('price','价格')->value(0);
|
|
|
})->when(2,function () use($form){
|
|
|
$form->text('price','价格');
|