header('申报列表') ->description(' ') ->body(view('admin.content.buy_house_zj')->with(['grid' => $this->grid()])); } /** * Make a grid builder. * * @return Grid */ protected function grid() { $grid = new Grid(new TalentHouseApply()); $grid->model()->with('house')->where('is_back',2)->where('rs_check_status',2)->orderBy('zj_check_status', 'ASC'); $status_text = $this->status; $grid->id('ID'); $grid->name('姓名'); $grid->mobile('联系电话'); $grid->talent_level('人才层次'); $grid->column('房源')->display(function () { return $this->house->name; }); $grid->zj_check_status('状态')->display(function () use ($status_text) { return $status_text[$this->zj_check_status]; }); $grid->zj_check_comment('备注'); $grid->actions(function ($actions) { if ($actions->row['zj_check_status'] == 1) { $actions->append(""); } $actions->append(" "); }); $grid->filter(function ($filter) { $filter->disableIdFilter(); $filter->equal('house_id', '房源')->select(TalentHouse::all()->pluck('name', 'id')); $status_option = ['全部', '待审核', '审核通过', '审核不通过']; $filter->where(function ($query) { if ($this->input > 0) { $query->where('status', '=', $this->input); } }, '状态', 'status')->radio($status_option); }); return $grid; } /** * 审核 */ public function audit(Request $request) { $id = $request->id; $status = $request->status; $reason = $request->reason; $url = empty($request->url) ? admin_base_path('content/buy_house_zj') : $request->url; if (empty($id)) { admin_toastr('数据异常', 'error'); return redirect(admin_base_path('content/buy_house_zj')); } $result = TalentHouseApply::where('id', '=', $id) ->update([ 'zj_check_status' => $status, 'zj_check_comment' => $reason, 'zj_check_time' => date('Y-m-d H:i:s'), 'status' => $status, ]); if ($result) { admin_toastr('审核成功', 'success'); } else { admin_toastr('该信息不存在或已审核', 'error'); } return redirect($url); } /** * 详情 */ public function detail(Request $request) { $id = $request->id; $info = TalentHouseApply::find($id);; $info->family = json_decode($info->family); $info->marry_text = $this->marry[$info->marry]; //layer相册层 $photos = [ 'certificates' => [], 'marry_prove' => [], 'household_register' => [], 'work_prove' => [], ]; if (!empty(json_decode($info->certificates))) { $info->certificates = json_decode($info->certificates); $photo_data = []; foreach ($info->certificates as $k => $v) { $photo_data[] = [ 'alt' => $v->name, 'pid' => $v->uid, 'src' => $v->response->path, ]; } $photos['certificates'] = [ 'title' => '证件信息', 'id' => 1, 'start' => 0, 'data' => $photo_data, ]; } else { $info->certificates = []; } if (!empty(json_decode($info->marry_prove))) { $info->marry_prove = json_decode($info->marry_prove); $photo_data = []; foreach ($info->marry_prove as $k => $v) { $photo_data[] = [ 'alt' => $v->name, 'pid' => $v->uid, 'src' => $v->response->path, ]; } $photos['marry_prove'] = [ 'title' => '婚姻证明', 'id' => 1, 'start' => 0, 'data' => $photo_data, ]; } else { $info->marry_prove = []; } if (!empty(json_decode($info->household_register))) { $info->household_register = json_decode($info->household_register); $photo_data = []; foreach ($info->household_register as $k => $v) { $photo_data[] = [ 'alt' => $v->name, 'pid' => $v->uid, 'src' => $v->response->path, ]; } $photos['household_register'] = [ 'title' => '户口本', 'id' => 1, 'start' => 0, 'data' => $photo_data, ]; } else { $info->household_register = []; } if (!empty(json_decode($info->work_prove))) { $info->work_prove = json_decode($info->work_prove); $photo_data = []; foreach ($info->work_prove as $k => $v) { $photo_data[] = [ 'alt' => $v->name, 'pid' => $v->uid, 'src' => $v->response->path, ]; } $photos['work_prove'] = [ 'title' => '在职证明', 'id' => 1, 'start' => 0, 'data' => $photo_data, ]; } else { $info->work_prove = []; } $html = view('admin.ajax.buy_house_detail')->with(['info' => $info, 'photos' => $photos])->render(); return response()->json(['code' => 1, 'data' => $html]); } }