Ajout du champ identification du TC pour user

Tri par TC dans les objectifs
This commit is contained in:
Olivier Legat 2021-05-26 11:35:15 +02:00
parent 7ddf2eaecc
commit f9fddbd2c6
5 changed files with 55 additions and 8 deletions

View file

@ -67,6 +67,11 @@ class ObjectivesController extends Controller
case 'user_id':
$objectives = $objectives->orderBy('user_id', Session::get('objectives.sort_way'));
break;
case 'tc_id':
$objectives = $objectives->select('objectives.*');
$objectives = $objectives->leftJoin('users', 'users.id', '=', 'objectives.user_id');
$objectives = $objectives->orderBy('users.tc_id', Session::get('objectives.sort_way'));
break;
}
}

View file

@ -184,6 +184,7 @@ class UsersController extends Controller
$adress_chargement = filter_var($request->adress_chargement, FILTER_SANITIZE_STRING);
$optional_contact = filter_var($request->optional_contact, FILTER_SANITIZE_STRING);
$num_client = filter_var($request->client_number, FILTER_SANITIZE_STRING);
$tc_id = $request->tc_id;
//check if num client has been filled
if (empty($user->client_number) && !empty($num_client)) {
@ -203,6 +204,7 @@ class UsersController extends Controller
$user->adress_chargement = $adress_chargement;
$user->optional_contact = $optional_contact;
$user->client_number = $num_client;
$user->tc_id = $tc_id;
$phone = $request->phone;
$user->apiData->phone = $phone;

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddTcFieldToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->unsignedInteger('tc_id')->nullable()->after('tech_commercial');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('tc_id');
});
}
}

View file

@ -10,28 +10,31 @@
<table class="table table-striped table-sm no-wrap-header">
<thead class="thead-light">
<tr>
<th scope="col">Produit&nbsp;
<th scope="col" title="Produit">Prod.<br/>
@include('bo.modules.sorter', ['colname' => 'produit', 'list' => 'objectives'])
</th>
<th scope="col">Qualité&nbsp;
<th scope="col">Qualité<br/>
@include('bo.modules.sorter', ['colname' => 'qualite', 'list' => 'objectives'])
</th>
<th scope="col">Campagne&nbsp;
<th scope="col" title="Campagne">Camp.<br/>
@include('bo.modules.sorter', ['colname' => 'campagne', 'list' => 'objectives'])
</th>
<th scope="col">Qté&nbsp;
<th scope="col">Qté<br/>
@include('bo.modules.sorter', ['colname' => 'quantite', 'list' => 'objectives'])
</th>
<th scope="col">Prix&nbsp;
<th scope="col">Prix<br/>
@include('bo.modules.sorter', ['colname' => 'prix', 'list' => 'objectives'])
</th>
<th scope="col">Echeance&nbsp;
<th scope="col">Echeance<br/>
@include('bo.modules.sorter', ['colname' => 'echeance', 'list' => 'objectives'])
</th>
<th scope="col">Client&nbsp;
<th scope="col">Client<br/>
@include('bo.modules.sorter', ['colname' => 'user_id', 'list' => 'objectives'])
</th>
<th scope="col">Status&nbsp;
<th scope="col" title="Technico-Commercial">TC<br/>
@include('bo.modules.sorter', ['colname' => 'tc_id', 'list' => 'objectives'])
</th>
<th scope="col">Status<br/>
@include('bo.modules.sorter', ['colname' => 'status_id', 'list' => 'objectives'])
</th>
<th><a href="{{ route(Route::currentRouteName(), ['rst' => 1]) }}" class="float-right btn btn-sm btn-dark">Réinitialiser le tri</a></th>
@ -47,6 +50,7 @@
<td>{{$objectif->prix}}</td>
<td>{{$objectif->echeance}}</td>
<td><a href="{{route('bo.users.edit', $objectif->user_id)}}">{{$objectif->user->lastname}}</a></td>
<td>{{$objectif->user->tc_id}}</td>
<td>
{{$objectif->status->label}}
@if(!empty($objectif->goal_at))

View file

@ -189,6 +189,10 @@
<label class="font-weight-bold" for="client_number">Numéro client :</label>
<input type="text" class="form-control" name="client_number" placeholder="Numéro Client" value="{{$user->client_number}}">
</div>
<div class="form-group">
<label class="font-weight-bold" for="client_number">Identification Technico-commercial :</label>
<input type="number" class="form-control" name="tc_id" placeholder="0" value="{{$user->tc_id}}">
</div>
<div class="form-group text-center">
<input type="submit" class="btn btn-secondary" value="Modifier">