海南旅游SAAS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

48 lines
1.4 KiB

<?php
namespace App\AdminSupplier\Lazys;
use App\AdminAgent\Extensions\Grid\ChooseDemand;
use App\AdminAgent\Repositories\DemandBidding;
use App\Models\Demand;
use App\Traits\DemandTraits;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;
use Illuminate\Support\Arr;
class DemandBiddingLazys extends LazyRenderable
{
public function grid(): Grid
{
return Grid::make(new DemandBidding(['biddingUser']), function (Grid $grid) {
$demandId = request('demand_id','');
$demand = Demand::find($demandId);
$grid->model()->where('demand_id',$demandId);
$grid->column('id');
$grid->column('price','出价')->sortable();
$grid->column('comment','内容');
$grid->column('biddingUser.name','竞拍人');
$grid->column('bidding','竞标')
->if(function () use ($demand){
return $demand->state == 1;
})
->then(function (Grid\Column $column) {
$column->append(new ChooseDemand($this->id));
})
->if(function () use ($demand){
return $demand->state == 2;
})
->then(function (Grid\Column $column) use ($demand){
if ($demand->bidding_id == $this->id) {
$column->append('<span class="text-success">已中标</span>');
} else {
$column->append('<span class="text-danger">未中标</span>');
}
});
$grid->column('created_at');
$grid->disableActions();
$grid->disableRowSelector();
});
}
}