Skip to content

Commit

Permalink
Story /issues/321
Browse files Browse the repository at this point in the history
  • Loading branch information
SMEWebify committed Mar 3, 2024
1 parent 52a79c6 commit 985c7a8
Show file tree
Hide file tree
Showing 5 changed files with 368 additions and 243 deletions.
1 change: 1 addition & 0 deletions app/Http/Controllers/Products/StockController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use App\Models\User;
use Illuminate\Http\Request;
use App\Models\Products\Stocks;
use App\Models\Products\Products;
use Illuminate\Support\Facades\DB;
use App\Models\Workflow\OrderLines;
use App\Services\SelectDataService;
Expand Down
32 changes: 32 additions & 0 deletions app/Livewire/StockCurrent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace App\Livewire;

use Livewire\Component;
use App\Models\Products\Products;

class StockCurrent extends Component
{

public $produitsAvecStock = [];
public $showProductsWithStock = false;

public function mount()
{

}

public function render()
{

return view('livewire.stock-current');
}

public function showStock()
{
// Définissez $showStock sur vrai pour afficher la liste des stocks
$this->produitsAvecStock = Products::with('Stock_location_product')->get();
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function up()
$table->integer('delivery_status')->default(1);
#1 = Not delivered
#2 = Partly delivered
#3 = Delivered
#3 = Delivered or Stock
$table->integer('invoice_status')->default(1);
#1 = Not invoiced
#2 = Partly invoiced
Expand Down
71 changes: 71 additions & 0 deletions resources/views/livewire/stock-current.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<div>
<div class="card">
<div class="card-body">
<div class="form-row">
<div class="form-group col-md-2">
<button class="btn btn-success" wire:click="showStock">Afficher la liste des stocks</button>
</div>
<div class="form-group col-md-4">
<label for="showProductsWithStock">Afficher les produits avec stock</label>
<input type="checkbox" id="showProductsWithStock" wire:model.live="showProductsWithStock" style=" display:flex; align-items:center;">
</div>
</div>
</div>
</div>

<table class="table table-hover">
<thead>
<tr>
<th>{{ __('general_content.product_trans_key') }}</th>
<th></th>
<th></th>
<th></th>
<th>{{ __('general_content.qty_trans_key') }}</th>
</tr>
</thead>
<tbody>
@foreach($produitsAvecStock as $produit)
<tr>
<td><x-ButtonTextView route="{{ route('products.show', ['id' => $produit->id]) }}" /></td>
<td>{{ $produit->label }}</td>
<td>Stock total: {{ $produit->StockLocationProductCount() }}</td>
<td>
@if($showProductsWithStock)
@foreach($produit->Stock_location_product as $StockLocationsProduct)
<a href="{{ route('products.stockline.show', ['id' => $StockLocationsProduct->id])}}" class="btn btn-sm btn-success">{{ $StockLocationsProduct->code}} </a><br/>
@endforeach
@endif
</td>

<td>
@if($showProductsWithStock)
@foreach($produit->Stock_location_product as $StockLocationsProduct)
@if($StockLocationsProduct->getCurrentStockMove() > $StockLocationsProduct->mini_qty)
<li class="bg-success color-palette">
@elseif($StockLocationsProduct->getCurrentStockMove() < $StockLocationsProduct->mini_qty)
<li class="bg-danger color-palette">
@elseif($StockLocationsProduct->getCurrentStockMove() == $StockLocationsProduct->mini_qty)
<li class="bg-warning color-palette">
@endif
{{ $StockLocationsProduct->getCurrentStockMove() }}
</li>
@endforeach
@else
{{ $produit->getTotalStockMove() }} / {{ $produit->getTotalUndeliveredQtyAttribute() }}
@endif
</td>
</tr>
@endforeach

</tbody>
<tfoot>
<tr>
<th>{{ __('general_content.product_trans_key') }}</th>
<th></th>
<th></th>
<th></th>
<th>{{ __('general_content.qty_trans_key') }}</th>
</tr>
</tfoot>
</table>
</div>
Loading

0 comments on commit 985c7a8

Please sign in to comment.