| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386 | 
							- <?php
 
- namespace App\Admin\Controllers\Health;
 
- use App\Admin\Extensions\Form\ValidateForm;
 
- use App\Http\Controllers\Controller;
 
- use App\Models\ArticleCategory;
 
- use App\Models\PostAppoint;
 
- use App\Models\Presentation;
 
- use App\Models\PresentationAppoint;
 
- use Encore\Admin\Auth\Permission;
 
- use Encore\Admin\Form;
 
- use Encore\Admin\Grid;
 
- use Encore\Admin\Layout\Content;
 
- use Encore\Admin\Facades\Admin;
 
- use Illuminate\Http\Request;
 
- use Illuminate\Support\Facades\DB;
 
- use App\Models\QjwjAppoint;
 
- use App\Models\JyyxAppoint;
 
- class IndexController extends Controller
 
- {
 
-     /**
 
-      * 宣讲会管理
 
-      * @param Content $content
 
-      * @return Content
 
-      */
 
-     public function index(Content $content)
 
-     {
 
-         Permission::check('presentation');
 
-         return $content
 
-             ->header('宣讲会管理')
 
-             ->description('')
 
-             ->body($this->grid());
 
-     }
 
-     protected function grid()
 
-     {
 
-         $grid = new Grid(new Presentation);
 
-         $grid->model()->orderBy('created_at', 'DESC');
 
-         $grid->model()->paginate(20);
 
-         if (Admin::user()->can('recruit_manager_create')) {
 
-             $grid->disableCreateButton(false);
 
-         }
 
-         $grid->perPages([10, 20, 30, 40, 50, 100]);
 
-         $grid->id('ID');
 
-         $grid->name('名称');
 
-         $grid->time('时间');
 
-         $grid->address('地址');
 
-         $grid->contact_info('联系方式');
 
-         $grid->column('status','状态')->display(function ($status) {
 
-             return $status ? '显示' : '隐藏';
 
-         });
 
-         $grid->created_at('创建时间');
 
-         $grid->actions(function ($actions) {
 
-             $actions->append('<a href="/ST3IXxKlOa4eGEv0eTw0CfORI9444Mgj/health/presentation_appoint_list?id=' . $actions->row['id'] . '"  class="btn btn-primary btn-xs" >报名管理</a>');
 
-             $actions->disableEdit(false);
 
-             $actions->disableDelete(false);
 
-             $actions->disableView();
 
-         });
 
-         return $grid;
 
-     }
 
-     public function create(Content $content)
 
-     {
 
-         return $content
 
-             ->header('宣讲会创建')
 
-             ->description('带*号必填项')
 
-             ->body($this->form());
 
-     }
 
-     public function edit($id, Content $content)
 
-     {
 
-         return $content
 
-             ->header('宣讲会编辑')
 
-             ->description('')
 
-             ->body($this->editForm($id)->edit($id));
 
-     }
 
-     protected function editForm($id){
 
-         $info = Presentation::find($id);
 
-         $form = new ValidateForm(new Presentation);
 
-         $form->text('name', '宣讲会标题')->rules('required|max:100', array('required'=>'标题不能为空。','max'=>'标题长度不能大于100。'))->setMustMark();
 
-         $form->text('time', '宣讲时间段')->rules('required', array('required'=>'时间段不能为空。'))->setMustMark();
 
-         $form->text('address', '宣讲会地址')->rules('required', array('required'=>'宣讲会地址不能为空。'))->setMustMark();
 
-         $form->text('contact_info', '联系方式')->rules('required', array('required'=>'联系方式不能为空。'))->setMustMark();
 
-         $display_option = [
 
-             'on'  => ['value' => 1, 'text' => '是', 'color' => 'success'],
 
-             'off' => ['value' => 0, 'text' => '否', 'color' => 'danger'],
 
-         ];
 
-         $form->switch('status', '是否显示')->states($display_option)->default('1')->setMustMark();
 
-         return $form;
 
-     }
 
-     protected function form()
 
-     {
 
-         $form = new ValidateForm(new Presentation);
 
-         $form->text('name', '宣讲会标题')->rules('required|max:100', array('required'=>'标题不能为空。','max'=>'标题长度不能大于100。'))->setMustMark();
 
-         $form->text('time', '宣讲时间段')->rules('required', array('required'=>'时间段不能为空。'))->setMustMark();
 
-         $form->text('address', '宣讲会地址')->rules('required', array('required'=>'宣讲会地址不能为空。'))->setMustMark();
 
-         $form->text('contact_info', '联系方式')->rules('required', array('required'=>'联系方式不能为空。'))->setMustMark();
 
-         $display_option = [
 
-             'on'  => ['value' => 1, 'text' => '是', 'color' => 'success'],
 
-             'off' => ['value' => 0, 'text' => '否', 'color' => 'danger'],
 
-         ];
 
-         $form->switch('status', '是否显示')->states($display_option)->default('1')->setMustMark();
 
-         return $form;
 
-     }
 
-     public function store(Request $request){
 
-         $verify = $this->form()->getValidateInput();
 
-         $data = [
 
-             'name' => $verify['name'],
 
-             'time'  => $verify['time'],
 
-             'address' => $verify['address'],
 
-             'contact_info' => $verify['contact_info'],
 
-             'status' => $verify['status']
 
-         ];
 
-         try {
 
-             Presentation::create($data);
 
-             DB::commit();
 
-         }catch (\Exception $e) {
 
-             DB::rollback();
 
-             return admin_toastr($e->getMessage(), 'error');
 
-         }
 
-     }
 
-     public function update($id)
 
-     {
 
-         return $this->editForm($id)->update($id);
 
-     }
 
-     public function destroy($id)
 
-     {
 
-         if ($this->form()->destroy($id)) {
 
-             $data = [
 
-                 'status'  => true,
 
-                 'message' => trans('admin.delete_succeeded'),
 
-             ];
 
-         } else {
 
-             $data = [
 
-                 'status'  => false,
 
-                 'message' => trans('admin.delete_failed'),
 
-             ];
 
-         }
 
-         return response()->json($data);
 
-     }
 
-     public function appointList(Content $content, Request $request)
 
-     {
 
-         Permission::check('health_appoint_list');
 
-         $id = $request->id;
 
-         $presentation = Presentation::find($id);
 
-         if (empty($presentation)) {
 
-             return back();
 
-         }
 
-         $search_data = $request->all();
 
-         $where = [];
 
-         $where[] = ['pid','=',$presentation->id];
 
-         if (isset($search_data['id'])) {
 
-             foreach ($search_data as $k => $v) {
 
-                 if ($k == 'realname') {
 
-                     $where[] = [$k, 'like', "%$v%"];
 
-                 } elseif ($k != '_pjax' and $k != 'page' && $k != 'perpage') {
 
-                     $where[] = [$k, '=', $v];
 
-                 }
 
-             }
 
-         }
 
-         $perpage = 20;
 
-         $list = PresentationAppoint::where($where)
 
-             ->select('*')
 
-             ->orderBy('updated_at','desc')
 
-             ->paginate($perpage);
 
-         foreach ($list as $k => $v){
 
-             if($v->sex == 1){
 
-                 $list[$k]['sex'] = '男';
 
-             }else{
 
-                 $list[$k]['sex'] = '女';
 
-             }
 
-             if($v->fresh == 0){
 
-                 $list[$k]['fresh'] = '否';
 
-             }else{
 
-                 $list[$k]['fresh'] = '是';
 
-             }
 
-             if($v->status == 0){
 
-                 $list[$k]['status'] = '未下载';
 
-             }else{
 
-                 $list[$k]['status'] = '已下载';
 
-             }
 
-         }
 
-         return $content
 
-             ->header('报名管理')
 
-             ->description('人员信息列表')
 
-             ->body(view('admin.health.appoint_list')->with([
 
-                 'list' => $list,
 
-                 'search_data' => $search_data,
 
-                 'recruit' => $presentation
 
-             ]));
 
-     }
 
-     public function qjwjInfoList(Content $content, Request $request){
 
-         Permission::check('qjwjInfoList');
 
-         $search_data = $request->all();
 
-         $where = [];
 
-         if (isset($search_data['id'])) {
 
-             foreach ($search_data as $k => $v) {
 
-                 if ($k == 'realname') {
 
-                     $where[] = [$k, 'like', "%$v%"];
 
-                 } elseif ($k != '_pjax' and $k != 'page' && $k != 'perpage') {
 
-                     $where[] = [$k, '=', $v];
 
-                 }
 
-             }
 
-         }
 
-         $perpage = 20;
 
-         $list = QjwjAppoint::where($where)
 
-             ->select('*')
 
-             ->orderBy('updated_at','desc')
 
-             ->paginate($perpage);
 
-         foreach ($list as $k => $v){
 
-             $v->native_place_cn = get_district_cn($v->native_place);
 
-             $v->education = get_category($v->education);
 
-             $v->pro_type = get_category_major($v->pro_type);
 
-             if($v->sex == 1){
 
-                 $list[$k]['sex'] = '男';
 
-             }else{
 
-                 $list[$k]['sex'] = '女';
 
-             }
 
-             if($v->status == 0){
 
-                 $list[$k]['status'] = '未下载';
 
-             }else{
 
-                 $list[$k]['status'] = '已下载';
 
-             }
 
-         }
 
-         return $content
 
-             ->header('信息管理')
 
-             ->description('泉籍卫技人员信息列表')
 
-             ->body(view('admin.health.qjwj_appoint_list')->with([
 
-                 'list' => $list,
 
-                 'search_data' => $search_data
 
-             ]));
 
-     }
 
-     public function qjwjStatus(Request $request){
 
-         $info = QjwjAppoint::where(['id' => $request->id])->first();
 
-         if($info){
 
-             $info->status = 1;
 
-             $info->save();
 
-             return response()->json(['status' => 1, 'msg' => '跳转下载中!', 'data' => 'ok', 'url' => $info->attachment]);
 
-         }else{
 
-             return response()->json(['status' => 0, 'msg' => '找不到记录!', 'data' => 'fail']);
 
-         }
 
-         //return "/storage/recruit/word/" . $recruit->name_en . '/' .$appoint->audit .$word_url;
 
-     }
 
-     public function jyyxInfoList(Content $content, Request $request){
 
-         Permission::check('jyyxInfoList');
 
-         $search_data = $request->all();
 
-         $where = [];
 
-         if (isset($search_data['id'])) {
 
-             foreach ($search_data as $k => $v) {
 
-                 if ($k == 'realname') {
 
-                     $where[] = [$k, 'like', "%$v%"];
 
-                 } elseif ($k != '_pjax' and $k != 'page' && $k != 'perpage') {
 
-                     $where[] = [$k, '=', $v];
 
-                 }
 
-             }
 
-         }
 
-         $perpage = 20;
 
-         $list = JyyxAppoint::where($where)
 
-             ->select('*')
 
-             ->orderBy('updated_at','desc')
 
-             ->paginate($perpage);
 
-         foreach ($list as $k => $v){
 
-             if($v->status == 0){
 
-                 $list[$k]['status'] = '未下载';
 
-             }else{
 
-                 $list[$k]['status'] = '已下载';
 
-             }
 
-         }
 
-         return $content
 
-             ->header('信息管理')
 
-             ->description('就业意向人员信息列表')
 
-             ->body(view('admin.health.jyyx_appoint_list')->with([
 
-                 'list' => $list,
 
-                 'search_data' => $search_data
 
-             ]));
 
-     }
 
-     public function jyyxStatus(Request $request){
 
-         $info = JyyxAppoint::where(['id' => $request->id])->first();
 
-         if($info){
 
-             $info->status = 1;
 
-             $info->save();
 
-             return response()->json(['status' => 1, 'msg' => '跳转下载中!', 'data' => 'ok', 'url' => $info->attachment]);
 
-         }else{
 
-             return response()->json(['status' => 0, 'msg' => '找不到记录!', 'data' => 'fail']);
 
-         }
 
-         //return "/storage/recruit/word/" . $recruit->name_en . '/' .$appoint->audit .$word_url;
 
-     }
 
-     public function postInfoList(Content $content, Request $request){
 
-         Permission::check('postInfoList');
 
-         $search_data = $request->all();
 
-         $where = [];
 
-         if (isset($search_data['id'])) {
 
-             foreach ($search_data as $k => $v) {
 
-                 if ($k == 'realname') {
 
-                     $where[] = [$k, 'like', "%$v%"];
 
-                 } elseif ($k != '_pjax' and $k != 'page' && $k != 'perpage') {
 
-                     $where[] = [$k, '=', $v];
 
-                 }
 
-             }
 
-         }
 
-         $perpage = 20;
 
-         $list = PostAppoint::where($where)
 
-             ->leftJoin("jobs","jobs.id",'=','post_appoint.job_id')
 
-             ->select('post_appoint.*','jobs.jobs_name','jobs.company_name')
 
-             ->orderBy('updated_at','desc')
 
-             ->paginate($perpage);
 
-         foreach ($list as $k => $v){
 
-             $v->native_place_cn = get_district_cn($v->native_place);
 
-             $v->education = get_category($v->education);
 
-             if($v->sex == 1){
 
-                 $list[$k]['sex'] = '男';
 
-             }else{
 
-                 $list[$k]['sex'] = '女';
 
-             }
 
-             if($v->status == 0){
 
-                 $list[$k]['status'] = '未下载';
 
-             }else{
 
-                 $list[$k]['status'] = '已下载';
 
-             }
 
-         }
 
-         return $content
 
-             ->header('信息管理')
 
-             ->description('投递岗位人员信息列表')
 
-             ->body(view('admin.health.post_appoint_list')->with([
 
-                 'list' => $list,
 
-                 'search_data' => $search_data
 
-             ]));
 
-     }
 
-     public function postStatus(Request $request){
 
-         $info = PostAppoint::where(['id' => $request->id])->first();
 
-         if($info){
 
-             $info->status = 1;
 
-             $info->save();
 
-             return response()->json(['status' => 1, 'msg' => '跳转下载中!', 'data' => 'ok', 'url' => $info->attachment]);
 
-         }else{
 
-             return response()->json(['status' => 0, 'msg' => '找不到记录!', 'data' => 'fail']);
 
-         }
 
-         //return "/storage/recruit/word/" . $recruit->name_en . '/' .$appoint->audit .$word_url;
 
-     }
 
- }
 
 
  |