Bug-fix-patch-15

# Showing agents name in team create/edit page in alphbetical order
#  While edit team, showing only those agents who belongs to the team
This commit is contained in:
Manish Verma
2016-12-28 18:50:09 +05:30
parent 3ba7b8d30d
commit 3b0db46f2a
3 changed files with 8 additions and 5 deletions

View File

@@ -68,7 +68,7 @@ class TeamController extends Controller
public function create(User $user)
{
try {
$user = $user->where('role', '<>', 'user')->where('active', '=', 1)->get();
$user = $user->where('role', '<>', 'user')->where('active', '=', 1)->orderBy('first_name')->get();
return view('themes.default1.admin.helpdesk.agent.teams.create', compact('user'));
} catch (Exception $e) {
@@ -202,11 +202,16 @@ $users = DB::table('team_assign_agent')->select('team_assign_agent.id', 'team_as
public function edit($id, User $user, Assign_team_agent $assign_team_agent, Teams $team)
{
try {
$user = $user->where('role', '<>', 'user')->where('active', '=', 1)->get();
$a_id = [];
$teams = $team->whereId($id)->first();
$agent_team = $assign_team_agent->where('team_id', $id)->get();
$agent_id = $agent_team->lists('agent_id', 'agent_id');
foreach ($agent_id as $value) {
array_push($a_id, $value);
}
// dd($a_id);
$user = $user->whereIn('id', $a_id)->where('active', '=', 1)->orderBy('first_name')->get();
// dd($user);
return view('themes.default1.admin.helpdesk.agent.teams.edit', compact('agent_id', 'user', 'teams', 'allagents'));
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->getMessage());

View File

@@ -61,7 +61,6 @@ class="active"
<!-- team lead -->
<div class="col-xs-6 form-group {{ $errors->has('team_lead') ? 'has-error' : '' }}">
{!! Form::label('team_lead',Lang::get('lang.team_lead')) !!}
<?php $user = App\User::where('role', 'admin')->orWhere('role', 'agent')->get(); ?>
{!! Form::select('team_lead',[''=>Lang::get('lang.select_a_team_lead'), Lang::get('lang.members')=>$user->lists('full_name','id')->toArray()],null,['class' => 'form-control']) !!}
</div>
</div>

View File

@@ -60,7 +60,6 @@ class="active"
<!-- team lead -->
<div class="col-xs-6 form-group {{ $errors->has('team_lead') ? 'has-error' : '' }}">
{!! Form::label('team_lead',Lang::get('lang.team_lead')) !!}
<?php $user = App\User::where('role', 'admin')->orWhere('role', 'agent')->get(); ?>
{!! Form::select('team_lead',[''=>Lang::get('lang.select_a_team_lead'), Lang::get('lang.members')=>$user->lists('full_name','id')->toArray()],null,['class' => 'form-control']) !!}
</div>
</div>