up
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets;
|
||||
|
||||
use App\Models\OrdenProduccion;
|
||||
use Filament\Widgets\Widget;
|
||||
|
||||
class PipelineOrdersWidget extends Widget
|
||||
{
|
||||
protected static string $view = 'filament.widgets.pipeline-orders-widget';
|
||||
|
||||
public $states = [
|
||||
'en_corte' => 'En corte',
|
||||
'en_confeccion' => 'En confección',
|
||||
'en_tintoreria' => 'En tintorería',
|
||||
'en_acabados' => 'En acabados',
|
||||
'finalizada' => 'Finalizada',
|
||||
];
|
||||
|
||||
public $ordersByState = [];
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->loadOrders();
|
||||
}
|
||||
|
||||
public function loadOrders()
|
||||
{
|
||||
$this->ordersByState = [];
|
||||
foreach (array_keys($this->states) as $s) {
|
||||
$this->ordersByState[$s] = OrdenProduccion::where('estado', $s)
|
||||
->orderBy('fecha_entrega_estimada')
|
||||
->limit(12)
|
||||
->get();
|
||||
}
|
||||
}
|
||||
|
||||
// Allow external refresh
|
||||
protected function getListeners(): array
|
||||
{
|
||||
return [
|
||||
'pipelineUpdated' => 'loadOrders',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user