Skip to content

Commit 8cea67f

Browse files
committed
1 parent af4c178 commit 8cea67f

File tree

5 files changed

+224
-319
lines changed

5 files changed

+224
-319
lines changed

app/Livewire/TaskStatu.php

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace App\Livewire;
44

55
use Carbon\Carbon;
6+
use App\Models\User;
67
use Livewire\Component;
78
use Livewire\WithPagination;
89
use App\Models\Admin\Factory;
@@ -41,23 +42,29 @@ class TaskStatu extends Component
4142

4243
public $tasksOpen, $tasksInProgress, $tasksPending, $tasksOngoing, $tasksCompleted, $averageProcessingTime, $userProductivity, $totalResourcesAllocated, $resourceHours;
4344

45+
public $StockLocationsProducts = null;
46+
47+
public $userSelect;
4448

4549
// Validation Rules
4650
protected $rules = [
4751
'addGoodQt' =>'required|numeric|min:0',
4852
'addBadQt' =>'required|numeric|min:0',
4953
];
5054

51-
public function mount($TaskId, $tasksOpen, $tasksInProgress, $tasksPending, $tasksOngoing, $tasksCompleted, $averageProcessingTime, $userProductivity, $totalResourcesAllocated, $resourceHours)
55+
public function mount($TaskId)
5256
{
5357
$this->user_id = Auth::id();
5458
$this->search = $TaskId;
5559
$this->taskStockMoves = StockMove::where('task_id', $this->search)->get();
5660
$this->lastTaskActivities = TaskActivities::where('task_id', $this->search)->latest()->first();
5761
$this->taskActivities = TaskActivities::where('task_id', $this->search)->get();
5862
$this->Task = Task::with('OrderLines.order')->find($this->search);
63+
$this->userSelect = User::select('id', 'name')->get();
5964
// $this->end_date = $this->Task->end_date;
60-
65+
if($this->Task->component_id){
66+
$this->StockLocationsProducts = StockLocationProducts::where('products_id', $this->Task->component_id)->get();
67+
}
6168
// Organiser les données pour la timeline
6269
$this->timelineData = [];
6370

@@ -193,11 +200,16 @@ public function render()
193200
->first();
194201
}
195202
}
196-
203+
204+
if($this->Task->component_id){
205+
$this->StockLocationsProducts = StockLocationProducts::where('products_id', $this->Task->component_id)->get();
206+
}
207+
197208
return view('livewire.task-statu', [
198209
'Task' => $this->Task,
199210
'taskActivities' => $this->taskActivities,
200211
'lastTaskActivities' => $this->lastTaskActivities,
212+
'StockLocationsProducts' => $this->StockLocationsProducts,
201213
]);
202214
}
203215

@@ -379,4 +391,9 @@ public function createNC($id, $companie_id, $id_service){
379391
return redirect()->route('quality')->with('success', 'Successfully created non conformitie.');
380392
}
381393

394+
public function goToTask($taskId)
395+
{
396+
// Rédirection ou mise à jour de la vue avec la nouvelle tâche
397+
$this->mount($taskId);
398+
}
382399
}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<div class="table-responsive p-0">
2+
<table class="table table-hover">
3+
<thead>
4+
<tr>
5+
<th>{{__('general_content.id_trans_key') }}</th>
6+
<th>{{ __('general_content.user_management_trans_key') }}</th>
7+
<th>{{ __('general_content.product_trans_key') }}</th>
8+
<th></th>
9+
<th>{{ __('general_content.qty_trans_key') }}</th>
10+
<!--<th>Qty reserve</th>-->
11+
<th>{{ __('general_content.qty_mini_trans_key') }}</th>
12+
<th>{{ __('general_content.end_date_trans_key') }}</th>
13+
<th>{{ __('general_content.addressing_trans_key') }}</th>
14+
<th>{{__('general_content.action_trans_key') }}</th>
15+
</tr>
16+
</thead>
17+
<tbody>
18+
@forelse ($StockLocationsProducts as $StockLocationsProduct)
19+
20+
<tr>
21+
<td>{{ $StockLocationsProduct->code }}</td>
22+
<td>{{ $StockLocationsProduct->UserManagement['name'] }}</td>
23+
<td>{{ $StockLocationsProduct->Product['label'] }}</td>
24+
<td><x-ButtonTextView route="{{ route('products.show', ['id' => $StockLocationsProduct->Product['id']]) }}" /></td>
25+
@if($StockLocationsProduct->getCurrentStockMove() > $StockLocationsProduct->mini_qty)
26+
<td class="bg-success color-palette">
27+
@elseif($StockLocationsProduct->getCurrentStockMove() < $StockLocationsProduct->mini_qty)
28+
<td class="bg-danger color-palette">
29+
@elseif($StockLocationsProduct->getCurrentStockMove() == $StockLocationsProduct->mini_qty)
30+
<td class="bg-warning color-palette">
31+
@endif
32+
{{ $StockLocationsProduct->getCurrentStockMove() }}
33+
</td>
34+
<!--<td>{{ $StockLocationsProduct->reserve_qty }}</td>-->
35+
<td>{{ $StockLocationsProduct->mini_qty }}</td>
36+
<td>{{ $StockLocationsProduct->end_date }}</td>
37+
<td>{{ $StockLocationsProduct->addressing }}</td>
38+
<td class=" py-0 align-middle">
39+
<div class="btn-group btn-group-sm">
40+
<a href="{{ route('products.stockline.show', ['id' => $StockLocationsProduct->id])}}" class="btn btn-info"><i class="fa fa-lg fa-fw fa-eye"></i></a>
41+
</div>
42+
<!-- Button Modal -->
43+
<button type="button" class="btn bg-teal" data-toggle="modal" data-target="#StockLocationsProduct{{ $StockLocationsProduct->id }}">
44+
<i class="fa fa-lg fa-fw fa-edit"></i>
45+
</button>
46+
<!-- Modal {{ $StockLocationsProduct->id }} -->
47+
<x-adminlte-modal id="StockLocationsProduct{{ $StockLocationsProduct->id }}" title="Update {{ $StockLocationsProduct->label }}" theme="teal" icon="fa fa-pen" size='lg' disable-animations>
48+
<form method="POST" action="{{ route('products.stockline.update', ['id' => $StockLocationsProduct->id]) }}" >
49+
@csrf
50+
<div class="form-group">
51+
<label for="service_id">{{ __('general_content.user_management_trans_key') }}</label>
52+
<div class="input-group">
53+
<div class="input-group-prepend">
54+
<span class="input-group-text"><i class="fas fa-list"></i></span>
55+
</div>
56+
<select class="form-control" name="user_id" id="user_id">
57+
@foreach ($userSelect as $item)
58+
<option value="{{ $item->id }}" @if($StockLocationsProduct->user_id == $item->id ) Selected @endif>{{ $item->name }}</option>
59+
@endforeach
60+
</select>
61+
</div>
62+
</div>
63+
<div class="form-group">
64+
<label for="mini_qty">{{ __('general_content.qty_mini_trans_key') }} :</label>
65+
<div class="input-group">
66+
<div class="input-group-prepend">
67+
<span class="input-group-text"><i class="fas fa-times"></i></span>
68+
</div>
69+
<input type="number" class="form-control" name="mini_qty" id="mini_qty" placeholder="{{ __('general_content.qty_mini_trans_key') }} ex: 1" step="1" value="{{ $StockLocationsProduct->mini_qty }}">
70+
<input type="hidden" name="stock_locations_id" id="stock_locations_id" value="{{ $StockLocationsProduct->stock_locations_id }}">
71+
</div>
72+
</div>
73+
<div class="form-group">
74+
<label for="end_date">{{ __('general_content.end_date_trans_key') }}</label>
75+
<input type="date" class="form-control" name="end_date" id="end_date" value="{{ $StockLocationsProduct->end_date }}">
76+
</div>
77+
<div class="form-group">
78+
<label for="addressing">{{ __('general_content.addressing_trans_key') }}</label>
79+
<input type="text" class="form-control" name="addressing" id="addressing" placeholder="{{ __('general_content.addressing_trans_key') }}" value="{{ $StockLocationsProduct->addressing }}">
80+
</div>
81+
<div class="card-footer">
82+
<x-adminlte-button class="btn-flat" type="submit" label="{{ __('general_content.update_trans_key') }}" theme="info" icon="fas fa-lg fa-save"/>
83+
</div>
84+
</form>
85+
</x-adminlte-modal>
86+
</td>
87+
</tr>
88+
@empty
89+
<x-EmptyDataLine col="9" text="{{ __('general_content.no_data_trans_key') }}" />
90+
@endforelse
91+
</tbody>
92+
<tfoot>
93+
<tr>
94+
<th>{{__('general_content.id_trans_key') }}</th>
95+
<th>{{ __('general_content.user_management_trans_key') }}</th>
96+
<th>{{ __('general_content.product_trans_key') }}</th>
97+
<th></th>
98+
<th>{{ __('general_content.qty_trans_key') }}</th>
99+
<!--<th>Qty reserve</th>-->
100+
<th>{{ __('general_content.qty_mini_trans_key') }}</th>
101+
<th>{{ __('general_content.end_date_trans_key') }}</th>
102+
<th>{{ __('general_content.addressing_trans_key') }}</th>
103+
<th>{{__('general_content.action_trans_key') }}</th>
104+
</tr>
105+
</tfoot>
106+
</table>
107+
</div>

0 commit comments

Comments
 (0)