예제 #1
0
 /**
  * Index Layout
  *
  * @return @Theme View
  */
 public function onPageUserInformation()
 {
     Meta::title(Lang::get('meta.user information'));
     Meta::meta('description', Lang::get('meta.user information description'));
     $query = \App\Models\User::leftJoin('roles', 'roles.id', '=', 'users.role_id')->leftJoin('companies', 'companies.id', '=', 'users.company_id')->select('users.*')->where('roles.authorize', '=', '0');
     if (Auth::user()->authorize() != 1) {
         $query = $query->where('users.company_id', '=', Auth::user()->company_id);
     }
     $query = $query->addSelect('roles.name as role_name')->addSelect('companies._id as company_id')->addSelect('companies.name as company_name');
     $grid = new Grid((new GridConfig())->setDataProvider(new EloquentDataProvider($query))->setName('grid')->setPageSize(15)->setColumns([(new FieldConfig())->setName('email')->setLabel(Lang::get('label.email'))->setSortable(true), (new FieldConfig())->setName('first_name')->setLabel(Lang::get('label.first name'))->setSortable(true), (new FieldConfig())->setName('last_name')->setLabel(Lang::get('label.last name'))->setSortable(true), (new FieldConfig())->setName('information')->setLabel(Lang::get('label.leave entitlement'))->setSortable(true), (new FieldConfig())->setName('active')->setLabel(Lang::get('label.active'))->setSortable(false)->setCallback(function ($val) {
         return '<a href="javascript:active(\'' . $val . '\')"><center><i class="fa ' . ($val ? 'fa-check' : 'fa-close') . '"></i></center></a>';
     })]));
     $grid2 = new Grid((new GridConfig())->setDataProvider(new EloquentDataProvider(\App\Models\Information::leftJoin('users', 'users.id', '=', 'informations.created_by')->leftJoin('information_companies', 'information_companies.information_id', '=', 'informations.id')->select('informations.*')->addSelect("users.first_name as upload_name")->where("information_companies.company_id", Auth::user()->company_id)->addSelect("informations.created_at as upload_at")))->setName('grid')->setPageSize(15)->setColumns([(new FieldConfig())->setName('name')->setLabel(Lang::get('label.name'))->setSortable(false)->setCallback(function ($val) {
         return '<a href="' . url('file/information/download/' . $val) . '">' . $val . '</a>';
     }), (new FieldConfig())->setName('description')->setLabel(Lang::get('label.description'))->setSortable(true), (new FieldConfig())->setName('upload_name')->setLabel(Lang::get('label.upload by'))->setSortable(true), (new FieldConfig())->setName('upload_at')->setLabel(Lang::get('label.upload at'))->setSortable(true)]));
     return Theme::view('users.pages.user-information', compact('grid', 'grid2', 'text'));
 }
예제 #2
0
    /**
     * Management Information
     *
     * @return @Theme View
     */
    public function onInformation()
    {
        Meta::title(Lang::get('meta.file information'));
        Meta::meta('description', Lang::get('meta.file informationt description'));
        $grid = new Grid((new GridConfig())->setDataProvider(new EloquentDataProvider(\App\Models\Information::leftJoin('users', 'users.id', '=', 'informations.created_by')->select('informations.*')->addSelect("users.first_name as upload_name")->addSelect("informations.created_at as upload_at")))->setName('grid')->setPageSize(15)->setColumns([(new FieldConfig())->setName('name')->setLabel(Lang::get('label.name'))->setSortable(false)->setCallback(function ($val) {
            return '<a href="' . url('file/information/download/' . $val) . '">' . $val . '</a>';
        }), (new FieldConfig())->setName('description')->setLabel(Lang::get('label.description'))->setSortable(true), (new FieldConfig())->setName('upload_name')->setLabel(Lang::get('label.upload by'))->setSortable(true), (new FieldConfig())->setName('upload_at')->setLabel(Lang::get('label.upload at'))->setSortable(true), (new FieldConfig())->setName('active')->setLabel(Lang::get('label.active'))->setSortable(false)->setCallback(function ($val) {
            return '<a href="javascript:active(\'' . $val . '\')"><center><i class="fa ' . ($val ? 'fa-check' : 'fa-close') . '"></i></center></a>';
        }), (new FieldConfig())->setName('id')->setLabel(Lang::get('menu.edit'))->setSortable(false)->setCallback(function ($val) {
            return '
								<div class="dropdown">
									<button class="btn btn-primary btn-sm dropdown-toggle" type="button" data-toggle="dropdown">
									<i class="glyphicon glyphicon-edit"></i>
									' . Lang::get('menu.edit') . '
									<span class="caret"></span></button>
									<ul class="dropdown-menu">
										<li><a href="' . url('management/information/form/' . $val) . '"><i class="remove glyphicon glyphicon-edit"></i> ' . Lang::get('menu.edit') . '</a></li>
										<li><a href="#" class="delete" id="' . $val . '" ><i class="glyphicon glyphicon-trash"></i> ' . Lang::get('menu.remove') . '</a></li>
									</ul>
								</div>';
        })]));
        return Theme::view('files.information', compact('grid', 'text'));
    }