17 Commits

Author SHA1 Message Date
dhanabalan
cbbf35eec9 Added operator_id on update to capacitor scanning 2025-04-28 00:47:14 +05:30
dhanabalan
550792372a Hide update_invoice button on scanning and Added operate_id on update and Added material_type 3 func. 2025-04-28 00:43:30 +05:30
dhanabalan
be9457c4e2 Added ProductionQuantity data grid 2025-04-28 00:41:07 +05:30
dhanabalan
09acb4453c Added admin seeder and Updated User seeder 2025-04-28 00:35:28 +05:30
dhanabalan
0971c25a5c Added material_type 3 2025-04-28 00:33:03 +05:30
dhanabalan
04c44ae416 Added import time and size limit 2025-04-28 00:32:28 +05:30
dhanabalan
85329ff557 Updated code visible func. and '3->quantity' in material type 2025-04-28 00:30:53 +05:30
dhanabalan
f014d9fd42 Updated navigation order / label and Added export pdf func. and commented chart func. 2025-04-28 00:28:42 +05:30
dhanabalan
4633066b13 Updated navigation order and Added export pdf func. 2025-04-28 00:23:04 +05:30
dhanabalan
79b889ec39 Updated navigation order and filter report and Added export pdf func. 2025-04-28 00:22:44 +05:30
dhanabalan
a6b9f88101 Hide update_invoice toggle button on scanning 2025-04-28 00:19:43 +05:30
dhanabalan
a275e18d0b Added production_order, operate_id column and skip insert when invalid plant-line-shift-item on import 2025-04-28 00:18:03 +05:30
dhanabalan
9aacf25eb5 Added operate_id on import 2025-04-28 00:15:29 +05:30
dhanabalan
2c1efb1bf0 Updated skip logic if duplicate plant found 2025-04-28 00:14:33 +05:30
dhanabalan
c8e2a9c7b9 Updated skip logic if plant not found 2025-04-28 00:14:18 +05:30
dhanabalan
38c37c74ed Updated skip logic if plant not found 2025-04-28 00:12:29 +05:30
dhanabalan
e328569cc1 Package for export pdf 2025-04-28 00:11:34 +05:30
24 changed files with 1392 additions and 144 deletions

View File

@@ -34,6 +34,9 @@ class BlockImporter extends Importer
public function resolveRecord(): ?Block
{
$plant = \App\Models\Plant::where('name', $this->data['plant'])->first();
if (!$plant) {
return null;
}
return Block::updateOrCreate([
'name' => $this->data['name'],
'plant_id' => $plant->id

View File

@@ -46,6 +46,9 @@ class ItemImporter extends Importer
public function resolveRecord(): ?Item
{
$plant = \App\Models\Plant::where('name', $this->data['plant'])->first();
if (!$plant) {
return null;
}
return Item::updateOrCreate([
'code' => $this->data['code'],
'plant_id' => $plant->id

View File

@@ -39,6 +39,9 @@ class LineImporter extends Importer
public function resolveRecord(): ?Line
{
$plant = \App\Models\Plant::where('name', $this->data['plant'])->first();
if (!$plant) {
return null;
}
return Line::updateOrCreate([
'name' => $this->data['name'],
'plant_id' => $plant->id

View File

@@ -46,6 +46,19 @@ class PlantImporter extends Importer
public function resolveRecord(): ?Plant
{
$company = \App\Models\Company::where('name', $this->data['company'])->first();
if (!$company) {
return null;
}
$plantCN = \App\Models\Plant::where('code', $this->data['code'])->where('name', $this->data['name'])->first();
if (!$plantCN) {
$plantCode = \App\Models\Plant::where('code', $this->data['code'])->first();
$plantName = \App\Models\Plant::where('name', $this->data['name'])->first();
if ($plantCode || $plantName) {
return null;
}
}
return Plant::updateOrCreate([
'code' => $this->data['code'],
'name' => $this->data['name'],

View File

@@ -68,6 +68,12 @@ class ProductionLineStopImporter extends Importer
->label('Plant Name')
->relationship(resolveUsing:'name')
->rules(['required']),
ImportColumn::make('operator_id')
->requiredMapping()
->exampleHeader('Operator ID')
->example('admin')
->label('Operator ID')
->rules(['required']),
];
}

View File

@@ -61,6 +61,12 @@ class ProductionPlanImporter extends Importer
->example('30-01-2025 19:11:00')
->label('Updated DateTime')
->rules(['required']),
ImportColumn::make('operator_id')
->requiredMapping()
->exampleHeader('Operator ID')
->example('admin')
->label('Operator ID')
->rules(['required']),
];
}

View File

@@ -21,12 +21,12 @@ class ProductionQuantityImporter extends Importer
->example('12-02-2025 15:51:00')
->label('Created DateTime')
->rules(['required']),
// ImportColumn::make('hourly_quantity')
// ->requiredMapping()
// ->exampleHeader('Hourly Quantity')
// ->label('Hourly Quantity')
// ->numeric()
// ->rules(['required', 'integer']),
ImportColumn::make('production_order')
->requiredMapping()
->exampleHeader('Production Order')
->example('1234567')
->label('Production Order')
->numeric(),
ImportColumn::make('item')
->requiredMapping()
->exampleHeader('Item Code')
@@ -67,17 +67,44 @@ class ProductionQuantityImporter extends Importer
->example('12-02-2025 15:51:00')
->label('Updated DateTime')
->rules(['required']),
ImportColumn::make('operator_id')
->requiredMapping()
->exampleHeader('Operator ID')
->example('admin')
->label('Operator ID')
->rules(['required']),
];
}
public function resolveRecord(): ?ProductionQuantity
{
$plant = \App\Models\Plant::where('name', $this->data['plant'])->first();
$item = \App\Models\Item::where('code', $this->data['item'])->where('plant_id', $plant->id)->first();
$line = \App\Models\Line::where('name', $this->data['line'])->where('plant_id', $plant->id)->first();
$shift = \App\Models\Shift::where('name', $this->data['shift'])->where('plant_id', $plant->id)->first();
if (!$plant || !$item || !$line || !$shift) {
// Optionally handle missing plant/item/line/shift
return null;
}
return ProductionQuantity::updateOrCreate([
'serial_number' => $this->data['serial_number'],
'plant_id' => $plant->id,
],
[
'shift_id' => $shift->id,
'line_id' => $line->id,
'item_id' => $item->id,
'production_order' => $this->data['production_order'] ?? null,
'created_at' => $this->data['created_at'],
'updated_at' => $this->data['updated_at']
]
);
// return ProductionQuantity::firstOrNew([
// // Update existing records, matching them by `$this->data['column_name']`
// 'email' => $this->data['email'],
// ]);
return new ProductionQuantity();
// return new ProductionQuantity();
}
public static function getCompletedNotificationBody(Import $import): string

View File

@@ -2,6 +2,7 @@
namespace App\Filament\Resources;
use AlperenErsoy\FilamentExport\Actions\FilamentExportBulkAction;
use App\Filament\Exports\InvoiceValidationExporter;
use App\Filament\Resources\InvoiceValidationResource\Pages;
use App\Models\InvoiceValidation;
@@ -122,6 +123,10 @@ class InvoiceValidationResource extends Resource
'x-model' => 'value',
'wire:keydown.enter.prevent' => 'processSerialNumber(value)', // Using wire:keydown
])
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('update_invoice', 0);
// if (!$invNo) { return; } else { }
})
->columnSpan(1),
Forms\Components\TextInput::make('total_quantity')
->label('Total Quantity')
@@ -136,7 +141,7 @@ class InvoiceValidationResource extends Resource
->boolean()
->grouped()
->reactive()
->hidden(fn (callable $get) => ($get('invoice_number') == null || $get('update_invoice') === '0') || !empty($get('serial_number')))
->hidden(fn (callable $get) => ($get('invoice_number') == null || $get('update_invoice') == '0') || !empty($get('serial_number')))
->afterStateUpdated(function ($state, callable $set, callable $get) {
if(!$get('plant_id'))
{
@@ -904,6 +909,7 @@ class InvoiceValidationResource extends Resource
Tables\Actions\DeleteBulkAction::make(),
Tables\Actions\ForceDeleteBulkAction::make(),
Tables\Actions\RestoreBulkAction::make(),
FilamentExportBulkAction::make('export')
]),
]);
}

View File

@@ -43,6 +43,8 @@ class CreateInvoiceValidation extends CreateRecord
public $plantId;
public $hasQuanTyp = false;
public $invoiceNumber;
public bool $hasSearched = false;
@@ -137,6 +139,7 @@ class CreateInvoiceValidation extends CreateRecord
Notification::make()
->title("Start the scanning process!")
->info()
->seconds(1)
->send();
// $hasRecords = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
// $this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId); //$this->invoiceNumber
@@ -174,6 +177,7 @@ class CreateInvoiceValidation extends CreateRecord
$materialCodes = [];
$missingQuantities = [];
$invalidMatQuan = [];
$hasQuanTypIds = [];
$validRowsFound = false;
foreach ($rows as $index => $row)
@@ -234,7 +238,7 @@ class CreateInvoiceValidation extends CreateRecord
if (!empty($uniqueInvalidCodes)) {
Notification::make()
->title('Invalid Item Codes')
->title('Invalid: Item Codes')
->body('The following item codes should contain minimum 6 digit alpha numeric values:<br>' . implode(', ', $uniqueInvalidCodes))
->danger()
->send();
@@ -348,10 +352,10 @@ class CreateInvoiceValidation extends CreateRecord
$message = $missingCount > 10 ? "'$missingCount' Serial Invoice item codes found." : "'Serial Invoice' item codes found:<br>" . implode(', ', $invalidCodes);
Notification::make()
->title('Invalid Item Codes')
->body($message)
->danger()
->send();
->title('Invalid: Item Codes')
->body($message)
->danger()
->send();
if ($disk->exists($filePath)) {
$disk->delete($filePath);
@@ -362,6 +366,7 @@ class CreateInvoiceValidation extends CreateRecord
$nonNumericQtyCodes = [];
$zeroQtyCodes = [];
$notDivisibleCodes = [];
$hasQuanTyp = false;
foreach ($matchedItems as $sticker)
{
@@ -380,6 +385,9 @@ class CreateInvoiceValidation extends CreateRecord
$excelCode = trim($row[0]);
$excelMatQty = trim($row[1]);
if (empty($excelCode) || empty($excelMatQty)) {
continue;
}
if ($excelCode === $code && is_numeric($excelMatQty)) {
$totalExcelQty += $excelMatQty; // Sum up the quantities
@@ -394,6 +402,11 @@ class CreateInvoiceValidation extends CreateRecord
$notDivisibleCodes[] = $code;
}
}
else if ($materialType == 3)
{
$hasQuanTyp = true;
$hasQuanTypIds[] = $sticker->id;
}
}
$showValidationNotification = function(array $codes, string $message) {
@@ -428,7 +441,7 @@ class CreateInvoiceValidation extends CreateRecord
$inserted = 0;
foreach ($matchedItems as $sticker)
{
if ($newQuan === -1)
if ($newQuan === -1 && !$hasQuanTyp)
{
InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->where(function($query) {
$query->whereNull('serial_number')->orWhere('serial_number', '');
@@ -436,7 +449,15 @@ class CreateInvoiceValidation extends CreateRecord
->delete();
$newQuan = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count();
continue;
}
else if ($newQuan === -1 && $hasQuanTyp)
{
InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->where(function($query) {
$query->whereNull('serial_number')->orWhere('serial_number', '');
})->whereNotIn('sticker_master_id', $hasQuanTypIds)
->delete();
$newQuan = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count();
}
$code = $sticker->item->code;
@@ -454,6 +475,10 @@ class CreateInvoiceValidation extends CreateRecord
$excelCode = trim($row[0]);
$excelMatQty = trim($row[1]);
if (empty($excelCode) || empty($excelMatQty)) {
continue;
}
if ($excelCode === $code && is_numeric($excelMatQty)) {
$totalExcelQty += $excelMatQty; // Sum up the quantities
}
@@ -491,6 +516,10 @@ class CreateInvoiceValidation extends CreateRecord
$excelCode = trim($row[0]);
$excelMatQty = trim($row[1]);
if (empty($excelCode) || empty($excelMatQty)) {
continue;
}
if ($excelCode === $code && is_numeric($excelMatQty)) {
$totalExcelQty += $excelMatQty; // Sum up the quantities
}
@@ -518,6 +547,115 @@ class CreateInvoiceValidation extends CreateRecord
}
}
}
else if ($materialType == 3)
{
$totalExcelQty = 0;
foreach ($rows as $index => $row)
{
if ($index === 0) continue; // Skip header
$excelCode = trim($row[0]);
$excelMatQty = trim($row[1]);
if (empty($excelCode) || empty($excelMatQty)) {
continue;
}
if ($excelCode === $code && is_numeric($excelMatQty)) {
$totalExcelQty += $excelMatQty;
}
}
$existEmpRecQty = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->where(function($query) {
$query->whereNull('serial_number')->orWhere('serial_number', '');
})->where('sticker_master_id', $sticker->id)->first();
$existEmpQty = $existEmpRecQty ? $existEmpRecQty->quantity : 0;
$existComQty = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->where(function($query) {
$query->whereNotNull('serial_number')->where('serial_number', '!=', '');
})
->where('sticker_master_id', $sticker->id)
->sum(column: 'quantity');
$existComQty = $existComQty ? $existComQty : 0;
// 8 = 3 + 5 // 8 = 5 + 3 // 8 = 0 + 8 // 8 = 8 + 0
// 8 = 3 + 5 // 8 = 5 + 3 // 8 = 0 + 8 // 8 = 8 + 0
// 0 = 0 + 0
$existQty = $existEmpQty + $existComQty;
// 8 <= 11 // 8 <= 8 // 8 <= 11 // 8 <= 9
// 8 <= 7 // 8 <= 7 // 8 <= 7 // 8 <= 7
// 0 <= 5
if ($existQty <= $totalExcelQty)
{
// 6 = 11 - 5 // 5 = 8 - 3 // 3 = 11 - 8 // 9 = 9 - 0
// 5 = 5 - 0
$newInsQty = $totalExcelQty - $existComQty;
// 3 > 0 // 5 > 0 // 0 > 0 // 8 > 0
// 0 > 0
if($existEmpQty > 0) // update
{
// 3 = 6 // 5 = 5 // 0 = 3 // 8 = 9
// 0 = 5
if($existEmpQty == $newInsQty) { continue; }
// $existEmpRecQty->delete();
$existEmpRecQty->update([
'quantity' => $newInsQty,
'operator_id'=> $operatorName,
'updated_at' => now(),
]);
$newQuan--;
$inserted++;
}
else if ($newInsQty > 0) // if ($sticker) // create
{
InvoiceValidation::create([
'sticker_master_id' => $sticker->id,
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
'quantity' => $newInsQty,
'operator_id'=> $operatorName,
]);
$inserted++;
}
}
// 8 > 7 // 8 > 7 // 8 > 7 // 8 > 7
else
{
// 2 = 7 - 5 // 4 = 7 - 3 // -1 = 7 - 8 // 7 = 7 - 0
$newInsQty = $totalExcelQty - $existComQty;
// 3 > 0 // 5 > 0 // 0 > 0 // 8 > 0
if($existEmpQty > 0) // update
{
// 3 = 2 // 5 = 4 // 0 = -1 // 8 = 7
if($existEmpQty == $newInsQty) { continue; }
// $existEmpRecQty->delete();
$existEmpRecQty->update([
'quantity' => $newInsQty,
'operator_id'=> $operatorName,
'updated_at' => now(),
]);
$newQuan--;
$inserted++;
}
else if ($newInsQty > 0) // create
{
InvoiceValidation::create([
'sticker_master_id' => $sticker->id,
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
'quantity' => $newInsQty,
'operator_id'=> $operatorName,
]);
$inserted++;
}
}
}
}
if ($inserted > 0 || $oldQuan !== $newQuan)
@@ -754,7 +892,7 @@ class CreateInvoiceValidation extends CreateRecord
if (!empty($uniqueInvalidCodes)) {
Notification::make()
->title('Invalid Item Codes')
->title('Invalid: Item Codes')
->body('The following item codes should contain minimum 6 digit alpha numeric values:<br>' . implode(', ', $uniqueInvalidCodes))
->danger()
->send();
@@ -825,7 +963,6 @@ class CreateInvoiceValidation extends CreateRecord
return;
}
$invalidCodes = $matchedItems
->filter(fn ($sticker) => !empty($sticker->material_type)) //filter invalid
->pluck('item.code')
@@ -838,7 +975,30 @@ class CreateInvoiceValidation extends CreateRecord
$message = $missingCount > 10 ? "'$missingCount' Material Invoice item codes found." : "'Material Invoice' item codes found:<br>" . implode(', ', $invalidCodes);
Notification::make()
->title('Invalid Item Codes')
->title('Invalid: Item Codes')
->body($message)
->danger()
->send();
if ($disk->exists($filePath)) {
$disk->delete($filePath);
}
return;
}
$missPackCodes = $matchedItems
->filter(fn ($sticker) => empty($sticker->tube_sticker_motor) && empty($sticker->tube_sticker_pump) && empty($sticker->tube_sticker_pumpset) && empty($sticker->panel_box_code)) //filter invalid
->pluck('item.code')
->toArray();
if (!empty($missPackCodes))
{
$missingCount = count($missPackCodes);
$message = $missingCount > 10 ? "'$missingCount' item codes doesn't have valid package type to proceed!" : "The following 'Item Code' doesn't have valid package type:<br>" . implode(', ', $missPackCodes);
Notification::make()
->title('Invalid: Item Codes')
->body($message)
->danger()
->send();
@@ -1235,7 +1395,7 @@ class CreateInvoiceValidation extends CreateRecord
if (!empty($uniqueInvalidCodes)) {
Notification::make()
->title('Invalid Item Codes')
->title('Invalid: Item Codes')
->body('The following item codes should contain minimum 6 digit alpha numeric values:<br>' . implode(', ', $uniqueInvalidCodes))
->danger()
->send();
@@ -1348,7 +1508,7 @@ class CreateInvoiceValidation extends CreateRecord
$message = $missingCount > 10 ? "'$missingCount' Serial Invoice item codes found." : "'Serial Invoice' item codes found:<br>" . implode(', ', $invalidCodes);
Notification::make()
->title('Invalid Item Codes')
->title('Invalid: Item Codes')
->body($message)
->danger()
->send();
@@ -1380,6 +1540,9 @@ class CreateInvoiceValidation extends CreateRecord
$excelCode = trim($row[0]);
$excelMatQty = trim($row[1]);
if (empty($excelCode) || empty($excelMatQty)) {
continue;
}
if ($excelCode === $code && is_numeric($excelMatQty)) {
$totalExcelQty += $excelMatQty; // Sum up the quantities
@@ -1440,6 +1603,10 @@ class CreateInvoiceValidation extends CreateRecord
$excelCode = trim($row[0]);
$excelMatQty = trim($row[1]);
if (empty($excelCode) || empty($excelMatQty)) {
continue;
}
if ($excelCode === $code && is_numeric($excelMatQty)) {
$totalExcelQty += $excelMatQty; // Sum up the quantities
}
@@ -1471,6 +1638,10 @@ class CreateInvoiceValidation extends CreateRecord
$excelCode = trim($row[0]);
$excelMatQty = trim($row[1]);
if (empty($excelCode) || empty($excelMatQty)) {
continue;
}
if ($excelCode === $code && is_numeric($excelMatQty)) {
$totalExcelQty += $excelMatQty; // Sum up the quantities
}
@@ -1490,6 +1661,37 @@ class CreateInvoiceValidation extends CreateRecord
}
}
}
else if ($materialType == 3)
{
$totalExcelQty = 0;
foreach ($rows as $index => $row)
{
if ($index === 0) continue; // Skip header
$excelCode = trim($row[0]);
$excelMatQty = trim($row[1]);
if (empty($excelCode) || empty($excelMatQty)) {
continue;
}
if ($excelCode === $code && is_numeric($excelMatQty)) {
$totalExcelQty += $excelMatQty; // Sum up the quantities
}
}
if ($sticker) {
InvoiceValidation::create([
'sticker_master_id' => $sticker->id,
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
'quantity' => $totalExcelQty,
'operator_id'=> $operatorName,
]);
$inserted++;
}
}
}
if ($inserted > 0)
@@ -1628,7 +1830,7 @@ class CreateInvoiceValidation extends CreateRecord
if (!empty($uniqueInvalidCodes)) {
Notification::make()
->title('Invalid Item Codes')
->title('Invalid: Item Codes')
->body('The following item codes should contain minimum 6 digit alpha numeric values:<br>' . implode(', ', $uniqueInvalidCodes))
->danger()
->send();
@@ -1721,7 +1923,30 @@ class CreateInvoiceValidation extends CreateRecord
$message = $missingCount > 10 ? "'$missingCount' Material Invoice item codes found." : "'Material Invoice' item codes found:<br>" . implode(', ', $invalidCodes);
Notification::make()
->title('Invalid Item Codes')
->title('Invalid: Item Codes')
->body($message)
->danger()
->send();
if ($disk->exists($filePath)) {
$disk->delete($filePath);
}
return;
}
$missPackCodes = $matchedItems
->filter(fn ($sticker) => empty($sticker->tube_sticker_motor) && empty($sticker->tube_sticker_pump) && empty($sticker->tube_sticker_pumpset) && empty($sticker->panel_box_code))
->pluck('item.code')
->toArray();
if (!empty($missPackCodes))
{
$missingCount = count($missPackCodes);
$message = $missingCount > 10 ? "'$missingCount' item codes doesn't have valid package type to proceed!" : "The following 'Item Code' doesn't have valid package type:<br>" . implode(', ', $missPackCodes);
Notification::make()
->title('Invalid: Item Codes')
->body($message)
->danger()
->send();
@@ -1932,6 +2157,9 @@ class CreateInvoiceValidation extends CreateRecord
public function processSerialNumber($serNo)
{
$user = Filament::auth()->user();
$operatorName = $user->name;
$serialNumber = null;
$plantId = $this->form->getState()['plant_id'];
$this->plantId = $plantId;
@@ -1956,6 +2184,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => 0, //$totQuan
'update_invoice' => false,
'scanned_quantity'=> 0, //($totMQuan > 0) ? $scanMQuan : $scanSQuan
]);
$this->dispatch('refreshEmptyInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId);
@@ -1978,6 +2207,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanMQuan,
]);
@@ -2000,29 +2230,93 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanMQuan,
]);
//$hasRecords = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
$this->dispatch( 'refreshMaterialInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
}
$pattern1 = '/^(?<item_code>[^|]+)\|(?<batch_number>[^|]+)\|(?<batch_id>[^|]+)\|(?<batch_count>.+)$/i';
$pattern2 = '/^(?<item_code>[^|]+)\|(?<batch_id>[^|]+)-(?<batch_count>.+)$/i';
$pattern1 = '/^(?<item_code>[^|]+)\|(?<batch_number>[^|]+)\|(?<batch_id>[^|]+)\|(?<batch_count>[^|]+)\/(?<batch_quantity>.+)$/i';
$pattern2 = '/^(?<item_code>[^|]+)\|(?<batch_number>[^|]+)\|(?<batch_id>[^|]+)\|(?<batch_count>.+)$/i';
$pattern3 = '/^(?<item_code>[^|]+)\|(?<batch_id>[^|]+)-(?<batch_count>.+)$/i';
$itemCode = '';
$batchNumber = '';
$curScanQty = '';
if (preg_match($pattern1, $serNo, $matches)) {
$itemCode = $matches['item_code'];
$this->currentItemCode = $itemCode;
$batchNumber = $matches['batch_number'];
$serialNumber = $matches['batch_id'] . '-' . $matches['batch_count'];
$curScanQty = $matches['batch_quantity'];
if(empty($matches['batch_id']) || !$matches['batch_id'])
{
Notification::make()
->danger()
->title('Invalid Material QR Format')
->body('Scan valid Material QR code proceed!<br>Sample formats are:<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
->send();
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanMQuan,
]);
return;
}
elseif (empty($matches['batch_count']) || !$matches['batch_count'])
{
Notification::make()
->danger()
->title('Invalid Material QR Format')
->body('Scan valid Material QR code proceed!<br>Sample formats are:<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
->send();
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanMQuan,
]);
return;
}
elseif(!is_numeric($curScanQty))
{
Notification::make()
->danger()
->title('Invalid Material QR Format')
->body('Scan valid Material QR code proceed!<br>Sample formats are:<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
->send();
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanMQuan,
]);
return;
}
} elseif (preg_match($pattern2, $serNo, $matches)) {
$itemCode = $matches['item_code'];
$this->currentItemCode = $itemCode;
$batchNumber = $matches['batch_number'];
$serialNumber = $matches['batch_id'] . '-' . $matches['batch_count'];
if(empty($matches['batch_id']) || !$matches['batch_id'])
{
Notification::make()
->danger()
->title('Invalid Material QR Format')
->body('Scan valid Material QR code proceed!<br>Sample formats are:<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
->body('Scan valid Material QR code proceed!<br>Sample formats are:<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
->send();
$this->form->fill([
@@ -2030,6 +2324,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanMQuan,
]);
return;
@@ -2039,7 +2334,7 @@ class CreateInvoiceValidation extends CreateRecord
Notification::make()
->danger()
->title('Invalid Material QR Format')
->body('Scan valid Material QR code proceed!<br>Sample formats are:<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
->body('Scan valid Material QR code proceed!<br>Sample formats are:<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
->send();
$this->form->fill([
@@ -2047,11 +2342,12 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanMQuan,
]);
return;
}
} elseif (preg_match($pattern2, $serNo, $matches)) {
} elseif (preg_match($pattern3, $serNo, $matches)) {
$itemCode = $matches['item_code'];
$this->currentItemCode = $itemCode;
$batchNumber = null; // batch_number not present in this pattern
@@ -2062,7 +2358,7 @@ class CreateInvoiceValidation extends CreateRecord
Notification::make()
->danger()
->title('Invalid Material QR Format')
->body('Scan valid Material QR code proceed!<br>Sample formats are:<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
->body('Scan valid Material QR code proceed!<br>Sample formats are:<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
->send();
$this->form->fill([
@@ -2070,6 +2366,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanMQuan,
]);
return;
@@ -2079,7 +2376,7 @@ class CreateInvoiceValidation extends CreateRecord
Notification::make()
->danger()
->title('Invalid Material QR Format')
->body('Scan valid Material QR code proceed!<br>Sample formats are:<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
->body('Scan valid Material QR code proceed!<br>Sample formats are:<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
->send();
$this->form->fill([
@@ -2087,12 +2384,14 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanMQuan,
]);
return;
}
} else {
$itemCode = null;
$this->currentItemCode = '';
$batchNumber = null;
$serNo = null;
$serialNumber = null;
@@ -2100,7 +2399,7 @@ class CreateInvoiceValidation extends CreateRecord
Notification::make()
->danger()
->title('Invalid Material QR Format')
->body('Scan valid Material QR code proceed!<br>Sample formats are:<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
->body('Scan valid Material QR code proceed!<br>Sample formats are:<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
->send();
$this->form->fill([
@@ -2108,6 +2407,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanMQuan,
]);
return;
@@ -2130,6 +2430,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanMQuan,
]);
return;
@@ -2151,6 +2452,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanMQuan,
]);
return;
@@ -2171,11 +2473,14 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanMQuan,
]);
return;
}
$hasQuanTyp = ($record->material_type == 3) ? true : false;
$record = InvoiceValidation::where('invoice_number', $invoiceNumber)
->where('plant_id', $plantId)
->whereHas('stickerMasterRelation.item', function ($query) use ($itemCode) {
@@ -2194,16 +2499,16 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanMQuan,
]);
return;
}
//->where('serial_number', '!=', '')
$record = InvoiceValidation::where('invoice_number', $invoiceNumber)
->where('serial_number', null)
->where('plant_id', $plantId)
->whereHas('stickerMasterRelation.item', function ($query) use ($itemCode) {
// ->whereNotNull('serial_number')->where('serial_number', '!=', '')
$record = InvoiceValidation::where('invoice_number', $invoiceNumber)->where(function($query) {
$query->whereNull('serial_number')->orWhere('serial_number', '');
})->where('plant_id', $plantId)->whereHas('stickerMasterRelation.item', function ($query) use ($itemCode) {
$query->where('plant_id', $this->plantId)->where('code', $itemCode);
})
->first();
@@ -2219,6 +2524,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanMQuan,
]);
return;
@@ -2238,17 +2544,83 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanMQuan,
]);
return;
}
$record->serial_number = $serialNumber;
if($batchNumber && !empty($batchNumber))
if($hasQuanTyp)
{
$record->batch_number = $batchNumber;
$createdDt = $record->created_at;
$stickMasterId = $record->sticker_master_id;
$curExistQty = $record->quantity;
// $curScanQty = 2;
if($curExistQty > $curScanQty) // 5 > 2
{
$record->quantity = $curExistQty - $curScanQty; // 5 - 2
$record->operator_id = $operatorName;
// $record->updated_at = now();
$record->save();
InvoiceValidation::create([
'sticker_master_id' => $stickMasterId,
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
'serial_number' => $serialNumber,
'batch_number' => $batchNumber,
'quantity' => $curScanQty,
'created_at' => $createdDt,
'operator_id'=> $operatorName,
]);
}
else if($curExistQty == $curScanQty) // 2 = 2
{
// $record->delete();
$record->serial_number = $serialNumber;
$record->batch_number = $batchNumber;
$record->operator_id = $operatorName;
// $record->updated_at = now();
$record->save();
// InvoiceValidation::create([
// 'sticker_master_id' => $stickMasterId,
// 'plant_id' => $plantId,
// 'invoice_number' => $invoiceNumber,
// 'quantity' => $curScanQty,
// 'created_at' => $createdDt,
// 'operator_id'=> $operatorName,
// ]);
}
else
{
Notification::make()
->title('Item Code Limit Exceeds')
->body("Scanned item code '$itemCode' has '$curScanQty' quantity.<br>But, '$curExistQty' quantity only available for the invoice '$invoiceNumber'.")
->danger()
->send();
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanMQuan,
]);
return;
}
}
else
{
$record->serial_number = $serialNumber;
// if($batchNumber && !empty($batchNumber)) {}
$record->batch_number = $batchNumber;
// $record->updated_at = now();
$record->operator_id = $operatorName;
$record->save();
}
$record->save();
Notification::make()
->title('Success: Material QR')
@@ -2256,6 +2628,8 @@ class CreateInvoiceValidation extends CreateRecord
->success()
->send();
$totQuan = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count();
$scannedMQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->whereNotNull('serial_number')->where('serial_number', '!=', '')->where('plant_id', $plantId)->count();
if($totQuan === $scannedMQuantity)
@@ -2271,6 +2645,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scannedMQuantity,
]);
@@ -2292,6 +2667,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scannedMQuantity,
]);
$this->dispatch( 'refreshMaterialInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
@@ -2313,6 +2689,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanSQuan,
]);
@@ -2335,6 +2712,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanSQuan,
]);
//$hasRecords = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
@@ -2353,6 +2731,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanSQuan,
]);
return;
@@ -2376,7 +2755,7 @@ class CreateInvoiceValidation extends CreateRecord
if (!$record) {
Notification::make()
->title('Serial Number Not Found')
->body("Serial '$serialNumber' not found in database.")
->body("Serial '$serialNumber' not found in database for choosed plant.")
->danger()
->send();
@@ -2385,6 +2764,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanSQuan,
]);
return;
@@ -2405,6 +2785,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanSQuan,
]);
return;
@@ -2429,6 +2810,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanSQuan,
]);
return;
@@ -2444,6 +2826,25 @@ class CreateInvoiceValidation extends CreateRecord
$hadPumpSetQr = $record->scanned_status_set ?? null;
$hadCapacitorQr = $record->capacitor_scanned_status ?? null;
if (!$hasMotorQr && !$hasPumpQr && !$hasPumpSetQr && !$hasCapacitorQr)
{
Notification::make()
->title('Invalid: Item Code')
->body("Scanned 'Item Code' doesn't have valid package type to proceed!")
->danger()
->send();
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanSQuan,
]);
return;
}
if ($isMarkM) {
if (!$hasMotorQr)
{
@@ -2458,6 +2859,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanSQuan,
]);
return;
@@ -2475,6 +2877,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanSQuan,
]);
return;
@@ -2503,6 +2906,7 @@ class CreateInvoiceValidation extends CreateRecord
{
$record->scanned_status = 'Scanned';
}
$record->operator_id = $operatorName;
$record->save();
Notification::make()
@@ -2517,6 +2921,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scannedQuantity,
]);
@@ -2560,6 +2965,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanSQuan,
]);
return;
@@ -2577,6 +2983,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanSQuan,
]);
return;
@@ -2605,6 +3012,7 @@ class CreateInvoiceValidation extends CreateRecord
{
$record->scanned_status = 'Scanned';
}
$record->operator_id = $operatorName;
$record->save();
Notification::make()
@@ -2619,6 +3027,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scannedQuantity,
]);
@@ -2664,6 +3073,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanSQuan,
]);
return;
@@ -2681,6 +3091,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanSQuan,
]);
return;
@@ -2696,6 +3107,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scannedQuantity,
]);
$this->dispatch( 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
@@ -2717,6 +3129,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanSQuan,
]);
return;
@@ -2734,6 +3147,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanSQuan,
]);
return;
@@ -2762,6 +3176,7 @@ class CreateInvoiceValidation extends CreateRecord
{
$record->scanned_status = 'Scanned';
}
$record->operator_id = $operatorName;
$record->save();
Notification::make()
@@ -2776,6 +3191,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scannedQuantity,
]);

View File

@@ -2,6 +2,7 @@
namespace App\Filament\Resources;
use AlperenErsoy\FilamentExport\Actions\FilamentExportBulkAction;
use App\Filament\Exports\ProductionLineStopExporter;
use App\Filament\Imports\ProductionLineStopImporter;
use App\Filament\Resources\ProductionLineStopResource\Pages;
@@ -39,6 +40,8 @@ class ProductionLineStopResource extends Resource
protected static ?string $navigationGroup = 'Production';
protected static ?int $navigationSort = 2;
public static function form(Form $form): Form
{
@@ -343,6 +346,7 @@ class ProductionLineStopResource extends Resource
public static function table(Table $table): Table
{
return $table
->query(ProductionLineStop::query())
->columns([
Tables\Columns\TextColumn::make('id')
->label('ID')
@@ -456,14 +460,14 @@ class ProductionLineStopResource extends Resource
TextInput::make('Line Stop Code'),
Select::make('reason')
->label('Filter by Stop Reason')
->options(function () {
return \App\Models\Item::whereHas('stickerMasters', function ($query) {
$query->whereHas('qualityValidations');
})->pluck('code', 'id');
})
->searchable(),
// Select::make('reason')
// ->label('Filter by Stop Reason')
// ->options(function () {
// return \App\Models\Item::whereHas('stickerMasters', function ($query) {
// $query->whereHas('qualityValidations');
// })->pluck('code', 'id');
// })
// ->searchable(),
DateTimePicker::make(name: 'created_from')
->label('Created From')
@@ -474,8 +478,59 @@ class ProductionLineStopResource extends Resource
->label('Created To')
->reactive()
->native(false),
]),
])
->query(function ($query, array $data) {
if ($plant = $data['Plant'] ?? null) {
$query->where('plant_id', $plant);
}
// Filter by Shift
if ($shift = $data['Shift'] ?? null) {
// Get shift data here, if needed, but no block_id filtering yet
$query->where('shift_id', $shift);
}
if ($block = $data['Block'] ?? null) {
// Use whereHas to filter by block_id in the Shift table
$query->whereHas('shift', function ($query) use ($block) {
$query->where('block_id', $block);
});
}
if ($line = $data['line'] ?? null) {
$query->where('line_id', $line);
}
if ($code = $data['Line Stop Code'] ?? null) {
// Find the linestop_id by code entered
$lineStop = \App\Models\LineStop::where('code', 'like', "%{$code}%")->first();
// If we find a matching LineStop, use its id to filter production_line_stops
if ($lineStop) {
$query->where('linestop_id', $lineStop->id);
} else {
// If no match found, you can either handle it as an error or return no results
$query->where('linestop_id', null); // This will return no results if no match
}
}
if ($reason = $data['reason'] ?? null) {
$query->where('reason_id', $reason);
}
if ($from = $data['created_from'] ?? null) {
$query->where('created_at', '>=', $from);
}
if ($to = $data['created_to'] ?? null) {
$query->where('created_at', '<=', $to);
}
return $query;
})
])
->filtersFormMaxHeight('280px')
->actions([
Tables\Actions\ViewAction::make(),
@@ -486,6 +541,7 @@ class ProductionLineStopResource extends Resource
Tables\Actions\DeleteBulkAction::make(),
Tables\Actions\ForceDeleteBulkAction::make(),
Tables\Actions\RestoreBulkAction::make(),
FilamentExportBulkAction::make('export')
]),
])
->headerActions([

View File

@@ -2,6 +2,7 @@
namespace App\Filament\Resources;
use AlperenErsoy\FilamentExport\Actions\FilamentExportBulkAction;
use App\Filament\Exports\ProductionPlanExporter;
use App\Filament\Imports\ProductionPlanImporter;
use App\Filament\Resources\ProductionPlanResource\Pages;
@@ -33,6 +34,8 @@ class ProductionPlanResource extends Resource
protected static ?string $navigationGroup = 'Production';
protected static ?int $navigationSort = 3;
public static function form(Form $form): Form
{
return $form
@@ -553,6 +556,7 @@ class ProductionPlanResource extends Resource
Tables\Actions\DeleteBulkAction::make(),
Tables\Actions\ForceDeleteBulkAction::make(),
Tables\Actions\RestoreBulkAction::make(),
FilamentExportBulkAction::make('export')
]),
])
->headerActions([

View File

@@ -2,16 +2,19 @@
namespace App\Filament\Resources;
use AlperenErsoy\FilamentExport\Actions\FilamentExportBulkAction as ActionsFilamentExportBulkAction;
use App\Filament\Exports\ProductionQuantityExporter;
use App\Filament\Imports\ProductionQuantityImporter;
use App\Filament\Resources\ProductionQuantityResource\Pages;
use App\Filament\Resources\ProductionQuantityResource\RelationManagers;
use App\Forms\Components\PlantSelect;
use App\Models\Item;
use App\Models\ProductionQuantity;
use App\Models\Shift;
use Carbon\Carbon;
use Filament\Facades\Filament;
use Filament\Forms;
use Filament\Forms\Components\Hidden;
use Filament\Forms\Form;
use Filament\Forms\Get;
use Filament\Resources\Resource;
@@ -21,21 +24,30 @@ use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Notifications\Notification;
use Filament\Tables\Actions\ExportAction;
use Livewire\Livewire;
// use Filament\Forms\Components\View;
use Filament\Tables\Actions\FilamentExportBulkAction;
class ProductionQuantityResource extends Resource
{
protected static ?string $model = ProductionQuantity::class;
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
// protected static ?string $navigationParentItem = 'Display Transactions';
// protected static string $view = 'filament.pages.hourly-production';
protected static ?string $navigationGroup = 'Production';
protected static ?int $navigationSort = 1;
// public $plant_id;
public static function form(Form $form): Form
{
@@ -48,6 +60,7 @@ class ProductionQuantityResource extends Resource
->required()
// ->nullable()
->reactive()
// ->statePath('filters')
->columnSpan(2) //1
// ->default(fn () => optional(ProductionQuantity::latest()->first())->plant_id)
->default(function () {
@@ -55,16 +68,9 @@ class ProductionQuantityResource extends Resource
})
->disabled(fn (Get $get) => !empty($get('id')))
// ->afterStateUpdated(fn ($set) => $set('block_name', null))
->afterStateUpdated(function ($state, callable $set, callable $get) {
->afterStateUpdated(function ($state, $set, callable $get,$livewire) {
$plantId = $get('plant_id');
//...
session(['select_plant' => $state]);
session()->forget('select_line'); // Reset line filter
//...
$set('block_name', null);
if (!$plantId)
{
@@ -78,13 +84,14 @@ class ProductionQuantityResource extends Resource
}
})
->extraAttributes([
'x-on:change' => "
if (\$event.target.value) {
\$wire.dispatch('filtersUpdated', { plantId: \$event.target.value });
}
",
])
// ->extraAttributes([
// 'x-on:change' => "
// if (\$event.target.value) {
// \$wire.dispatch('plant-updated', { plantId: \$event.target.value });
// }
// ",
// ])
// ->extraAttributes([
// 'x-on:change' => "\$wire.dispatch('filtersUpdated', { plantId: \$event.target.value })"
@@ -93,12 +100,25 @@ class ProductionQuantityResource extends Resource
// 'x-on:change' => "\$wire.set('plantId', \$event.target.value)"
// ])
// ->extraAttributes([
// 'x-on:change' => '$dispatch("plant-updated", { plantId: $event.target.value })',
// // Dispatch Alpine event
// ])
// ->extraAttributes([
// 'x-on:change' => '$dispatch("plant-updated", { plantId: $event.target.value }); console.log("Plant updated:", $event.target.value);',
// ])
->extraAttributes(fn ($get) => [
'class' => $get('pqPlantError') ? 'border-red-500' : '',
])
// ->extraAttributes([
// 'x-data' => '{ value: "" }',
// 'x-model' => 'value',
// 'wire:keydown.enter.prevent' => 'processSelectedPlant(value)', // Call Livewire method
// ])
->hint(fn ($get) => $get('pqPlantError') ? $get('pqPlantError') : null)
->hintColor('danger'),
Forms\Components\Select::make('block_name')
->label('Block')
->required()
@@ -133,8 +153,8 @@ class ProductionQuantityResource extends Resource
$blockId = $get('block_name');
$set('shift_id', null);
session(['select_plant' => $get('plant_id')]);
session()->forget('select_line');
// session(['select_plant' => $get('plant_id')]);
// session()->forget('select_line');
if (!$blockId) {
$set('pqBlockError', 'Please select a block first.');
@@ -185,9 +205,6 @@ class ProductionQuantityResource extends Resource
$curShiftId = $get('shift_id');
$set('line_id', null);
session(['select_plant' => $get('plant_id')]);
session()->forget('select_line');
if (!$curShiftId) {
$set('pqShiftError', 'Please select a shift first.');
return;
@@ -240,8 +257,8 @@ class ProductionQuantityResource extends Resource
$lineId = $get('line_id');
$set('item_code', null);
session(['select_plant' => $get('plant_id')]);
session()->forget('select_line');
// session(['select_line' => $get('line_id')]);
session(['select_line' => $state]);
if (!$lineId) {
@@ -873,35 +890,6 @@ class ProductionQuantityResource extends Resource
'x-data' => '{ value: "" }',
'x-model' => 'value',
'wire:keydown.enter.prevent' => 'processAllValues(value)',
// 'x-data' => '{ value: "" }',
// 'x-model' => 'value',
// 'x-on:keydown.enter.prevent' => '$wire.processQr(value)',
//'wire:keydown.enter.prevent' => 'processQr(value)',
//working fine on text enter
// 'x-data' => '{}',
// 'x-on:keydown.enter.prevent' => '
// const formData = new FormData($event.target.form);
// const data = Object.fromEntries(formData.entries());
// $wire.processAllValues(data)
// ',
// 'x-data' => '{}',
// 'x-on:change' => '
// const formData = new FormData($event.target.form);
// const data = Object.fromEntries(formData.entries());
// $wire.processAllValues(data)
// ',
// 'x-data' => '{}',
// 'x-on:keydown.enter.prevent' => '
// $event.target.blur(); // Ensures value is updated
// setTimeout(() => {
// const formData = new FormData($event.target.form);
// const data = Object.fromEntries(formData.entries());
// $wire.processAllValues(data)
// }, 10); // Small delay to allow value update
// ',
]),
Forms\Components\Hidden::make('serial_number')
->required(),
@@ -940,8 +928,6 @@ class ProductionQuantityResource extends Resource
->default(Filament::auth()->user()->name),
])
->columns(12), //6
//View::make('filament.pages.hourly-production'),
]);
}
@@ -996,6 +982,7 @@ class ProductionQuantityResource extends Resource
Tables\Actions\DeleteBulkAction::make(),
Tables\Actions\ForceDeleteBulkAction::make(),
Tables\Actions\RestoreBulkAction::make(),
ActionsFilamentExportBulkAction::make('export')
]),
])
->headerActions([
@@ -1014,6 +1001,12 @@ class ProductionQuantityResource extends Resource
]);
}
// public function updatedDataPlantId($value)
// {
// session(['select_plant' => $value]);
// $this->dispatch('filtersUpdated', $value);
// }
public static function getRelations(): array
{
return [
@@ -1039,6 +1032,26 @@ class ProductionQuantityResource extends Resource
]);
}
public static function getNavigationLabel(): string
{
return 'Production Reports';
}
// public function triggerChartUpdate(): void
// {
// if (session()->has('select_plant') && session()->has('select_line')) {
// $this->dispatch('filtersUpdated');
// }
// }
// public function updatedDataPlantId($newPlantId)
// {
// session(['select_plant' => $newPlantId]);
// $this->emit('filtersUpdated', $newPlantId);
// }
// public function mount(): void
// {
// // Fetch the value from the database based on your conditions

View File

@@ -82,7 +82,7 @@ class StickerMasterResource extends Resource
->nullable()
->searchable()
->reactive()
->disabled(fn (Get $get) => !empty($get('id')))
// ->disabled(fn (Get $get) => !empty($get('id')))
->live(debounce: 500) // Enable live updates
->afterStateUpdated(function ($state, callable $set, callable $get) {
@@ -179,6 +179,7 @@ class StickerMasterResource extends Resource
->options([
'1' => 'Individual',
'2' => 'Bundle',
'3' => 'Quantity',
])
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get) {
@@ -206,6 +207,7 @@ class StickerMasterResource extends Resource
->integer()
->readOnly(fn (callable $get) => $get('material_type') !== "2")
->nullable()
->minValue(2)
->reactive()
->afterStateUpdated(function ($state, callable $set,callable $get) {
if($get('material_type') !== "2")

View File

@@ -5,6 +5,7 @@ namespace App\Livewire;
use App\Filament\Resources\InvoiceValidationResource\Pages\CreateInvoiceValidation;
use App\Models\InvoiceValidation;
use App\Models\StickerMaster;
use Filament\Facades\Filament;
use Filament\Notifications\Notification;
use Livewire\Component;
@@ -147,6 +148,10 @@ class InvoiceDataTable extends Component
{
$row['material_type'] = 'Bundle';
}
else if($matType === 3)
{
$row['material_type'] = 'Quantity';
}
else
{
$row['material_type'] = 'N/A';
@@ -179,6 +184,9 @@ class InvoiceDataTable extends Component
public function processCapacitorInput()
{
$user = Filament::auth()->user();
$operatorName = $user->name;
if (!$this->capacitorInput) {
return;
}
@@ -265,6 +273,7 @@ class InvoiceDataTable extends Component
'panel_box_serial_number' => $serialNumber,
'capacitor_scanned_status' => 1,
'scanned_status' => 'Scanned',
'operator_id'=> $operatorName,
]);
}
else
@@ -274,6 +283,7 @@ class InvoiceDataTable extends Component
'panel_box_item_code' => $itemCode,
'panel_box_serial_number' => $serialNumber,
'capacitor_scanned_status' => 1,
'operator_id'=> $operatorName,
]);
}
}
@@ -285,6 +295,7 @@ class InvoiceDataTable extends Component
'panel_box_serial_number' => $serialNumber,
'capacitor_scanned_status' => 1,
'scanned_status' => 'Scanned',
'operator_id'=> $operatorName,
]);
}

View File

@@ -43,5 +43,8 @@ class AppServiceProvider extends ServiceProvider
Gate::policy(Role::class, RolePolicy::class);
Gate::policy(Permission::class, PermissionPolicy::class);
ini_set('max_execution_time', 300); // 300 seconds = 5 minutes
ini_set('memory_limit', '512M'); // 512MB
}
}

View File

@@ -7,6 +7,7 @@
"license": "MIT",
"require": {
"php": "^8.2",
"alperenersoy/filament-export": "^3.0",
"althinect/filament-spatie-roles-permissions": "^2.3",
"filament/filament": "^3.3",
"laravel/framework": "^11.31",
@@ -16,6 +17,7 @@
"tpetry/laravel-postgresql-enhanced": "^2.3"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.15",
"barryvdh/laravel-ide-helper": "^3.5",
"fakerphp/faker": "^1.23",
"laravel/pail": "^1.1",

571
composer.lock generated
View File

@@ -4,8 +4,64 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "ac6e7ab9568c0715b7379e52b53f4456",
"content-hash": "cb43ec04264890f09fbcd10ab0cb790c",
"packages": [
{
"name": "alperenersoy/filament-export",
"version": "v3.0.10",
"source": {
"type": "git",
"url": "https://github.com/alperenersoy/filament-export.git",
"reference": "c755dcf4f4a46982ae35e93eba8ed42e2bf807f0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alperenersoy/filament-export/zipball/c755dcf4f4a46982ae35e93eba8ed42e2bf807f0",
"reference": "c755dcf4f4a46982ae35e93eba8ed42e2bf807f0",
"shasum": ""
},
"require": {
"barryvdh/laravel-dompdf": "^2.0|>=v3.1.1",
"filament/tables": "^3.0",
"php": "^8.0",
"spatie/simple-excel": ">=3.2.0"
},
"require-dev": {
"filament/filament": "^3.0",
"orchestra/testbench": "^8.5",
"pestphp/pest": "^2.1",
"pestphp/pest-plugin-livewire": "^2.1"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"AlperenErsoy\\FilamentExport\\FilamentExportServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"AlperenErsoy\\FilamentExport\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "alperen ersoy",
"email": "ersoyalperen@gmail.com"
}
],
"description": "Customizable export and print functionality for Filament Admin Panel",
"support": {
"issues": "https://github.com/alperenersoy/filament-export/issues",
"source": "https://github.com/alperenersoy/filament-export/tree/v3.0.10"
},
"time": "2025-03-25T10:05:26+00:00"
},
{
"name": "althinect/filament-spatie-roles-permissions",
"version": "v2.3",
@@ -135,6 +191,83 @@
},
"time": "2025-03-22T08:49:12+00:00"
},
{
"name": "barryvdh/laravel-dompdf",
"version": "v3.1.1",
"source": {
"type": "git",
"url": "https://github.com/barryvdh/laravel-dompdf.git",
"reference": "8e71b99fc53bb8eb77f316c3c452dd74ab7cb25d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/barryvdh/laravel-dompdf/zipball/8e71b99fc53bb8eb77f316c3c452dd74ab7cb25d",
"reference": "8e71b99fc53bb8eb77f316c3c452dd74ab7cb25d",
"shasum": ""
},
"require": {
"dompdf/dompdf": "^3.0",
"illuminate/support": "^9|^10|^11|^12",
"php": "^8.1"
},
"require-dev": {
"larastan/larastan": "^2.7|^3.0",
"orchestra/testbench": "^7|^8|^9|^10",
"phpro/grumphp": "^2.5",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
"extra": {
"laravel": {
"aliases": {
"PDF": "Barryvdh\\DomPDF\\Facade\\Pdf",
"Pdf": "Barryvdh\\DomPDF\\Facade\\Pdf"
},
"providers": [
"Barryvdh\\DomPDF\\ServiceProvider"
]
},
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"Barryvdh\\DomPDF\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
}
],
"description": "A DOMPDF Wrapper for Laravel",
"keywords": [
"dompdf",
"laravel",
"pdf"
],
"support": {
"issues": "https://github.com/barryvdh/laravel-dompdf/issues",
"source": "https://github.com/barryvdh/laravel-dompdf/tree/v3.1.1"
},
"funding": [
{
"url": "https://fruitcake.nl",
"type": "custom"
},
{
"url": "https://github.com/barryvdh",
"type": "github"
}
],
"time": "2025-02-13T15:07:54+00:00"
},
{
"name": "blade-ui-kit/blade-heroicons",
"version": "2.6.0",
@@ -1073,6 +1206,161 @@
],
"time": "2024-02-05T11:56:58+00:00"
},
{
"name": "dompdf/dompdf",
"version": "v3.1.0",
"source": {
"type": "git",
"url": "https://github.com/dompdf/dompdf.git",
"reference": "a51bd7a063a65499446919286fb18b518177155a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/dompdf/zipball/a51bd7a063a65499446919286fb18b518177155a",
"reference": "a51bd7a063a65499446919286fb18b518177155a",
"shasum": ""
},
"require": {
"dompdf/php-font-lib": "^1.0.0",
"dompdf/php-svg-lib": "^1.0.0",
"ext-dom": "*",
"ext-mbstring": "*",
"masterminds/html5": "^2.0",
"php": "^7.1 || ^8.0"
},
"require-dev": {
"ext-gd": "*",
"ext-json": "*",
"ext-zip": "*",
"mockery/mockery": "^1.3",
"phpunit/phpunit": "^7.5 || ^8 || ^9 || ^10 || ^11",
"squizlabs/php_codesniffer": "^3.5",
"symfony/process": "^4.4 || ^5.4 || ^6.2 || ^7.0"
},
"suggest": {
"ext-gd": "Needed to process images",
"ext-gmagick": "Improves image processing performance",
"ext-imagick": "Improves image processing performance",
"ext-zlib": "Needed for pdf stream compression"
},
"type": "library",
"autoload": {
"psr-4": {
"Dompdf\\": "src/"
},
"classmap": [
"lib/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1"
],
"authors": [
{
"name": "The Dompdf Community",
"homepage": "https://github.com/dompdf/dompdf/blob/master/AUTHORS.md"
}
],
"description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter",
"homepage": "https://github.com/dompdf/dompdf",
"support": {
"issues": "https://github.com/dompdf/dompdf/issues",
"source": "https://github.com/dompdf/dompdf/tree/v3.1.0"
},
"time": "2025-01-15T14:09:04+00:00"
},
{
"name": "dompdf/php-font-lib",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/dompdf/php-font-lib.git",
"reference": "6137b7d4232b7f16c882c75e4ca3991dbcf6fe2d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/php-font-lib/zipball/6137b7d4232b7f16c882c75e4ca3991dbcf6fe2d",
"reference": "6137b7d4232b7f16c882c75e4ca3991dbcf6fe2d",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": "^7.1 || ^8.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^3 || ^4 || ^5 || ^6"
},
"type": "library",
"autoload": {
"psr-4": {
"FontLib\\": "src/FontLib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1-or-later"
],
"authors": [
{
"name": "The FontLib Community",
"homepage": "https://github.com/dompdf/php-font-lib/blob/master/AUTHORS.md"
}
],
"description": "A library to read, parse, export and make subsets of different types of font files.",
"homepage": "https://github.com/dompdf/php-font-lib",
"support": {
"issues": "https://github.com/dompdf/php-font-lib/issues",
"source": "https://github.com/dompdf/php-font-lib/tree/1.0.1"
},
"time": "2024-12-02T14:37:59+00:00"
},
{
"name": "dompdf/php-svg-lib",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/dompdf/php-svg-lib.git",
"reference": "eb045e518185298eb6ff8d80d0d0c6b17aecd9af"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/php-svg-lib/zipball/eb045e518185298eb6ff8d80d0d0c6b17aecd9af",
"reference": "eb045e518185298eb6ff8d80d0d0c6b17aecd9af",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": "^7.1 || ^8.0",
"sabberworm/php-css-parser": "^8.4"
},
"require-dev": {
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5"
},
"type": "library",
"autoload": {
"psr-4": {
"Svg\\": "src/Svg"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0-or-later"
],
"authors": [
{
"name": "The SvgLib Community",
"homepage": "https://github.com/dompdf/php-svg-lib/blob/master/AUTHORS.md"
}
],
"description": "A library to read, parse and export to PDF SVG files.",
"homepage": "https://github.com/dompdf/php-svg-lib",
"support": {
"issues": "https://github.com/dompdf/php-svg-lib/issues",
"source": "https://github.com/dompdf/php-svg-lib/tree/1.0.0"
},
"time": "2024-04-29T13:26:35+00:00"
},
{
"name": "dragonmantank/cron-expression",
"version": "v3.4.0",
@@ -5363,6 +5651,71 @@
],
"time": "2025-02-25T09:09:36+00:00"
},
{
"name": "sabberworm/php-css-parser",
"version": "v8.8.0",
"source": {
"type": "git",
"url": "https://github.com/MyIntervals/PHP-CSS-Parser.git",
"reference": "3de493bdddfd1f051249af725c7e0d2c38fed740"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/MyIntervals/PHP-CSS-Parser/zipball/3de493bdddfd1f051249af725c7e0d2c38fed740",
"reference": "3de493bdddfd1f051249af725c7e0d2c38fed740",
"shasum": ""
},
"require": {
"ext-iconv": "*",
"php": "^5.6.20 || ^7.0.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0"
},
"require-dev": {
"phpunit/phpunit": "5.7.27 || 6.5.14 || 7.5.20 || 8.5.41"
},
"suggest": {
"ext-mbstring": "for parsing UTF-8 CSS"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "9.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Sabberworm\\CSS\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Raphael Schweikert"
},
{
"name": "Oliver Klee",
"email": "github@oliverklee.de"
},
{
"name": "Jake Hotson",
"email": "jake.github@qzdesign.co.uk"
}
],
"description": "Parser for CSS Files written in PHP",
"homepage": "https://www.sabberworm.com/blog/2010/6/10/php-css-parser",
"keywords": [
"css",
"parser",
"stylesheet"
],
"support": {
"issues": "https://github.com/MyIntervals/PHP-CSS-Parser/issues",
"source": "https://github.com/MyIntervals/PHP-CSS-Parser/tree/v8.8.0"
},
"time": "2025-03-23T17:59:05+00:00"
},
{
"name": "spatie/color",
"version": "1.8.0",
@@ -5687,6 +6040,67 @@
],
"time": "2021-11-30T21:13:59+00:00"
},
{
"name": "spatie/simple-excel",
"version": "3.7.2",
"source": {
"type": "git",
"url": "https://github.com/spatie/simple-excel.git",
"reference": "53546918bb480f7876c8ed295860408ded2e0ebf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/simple-excel/zipball/53546918bb480f7876c8ed295860408ded2e0ebf",
"reference": "53546918bb480f7876c8ed295860408ded2e0ebf",
"shasum": ""
},
"require": {
"illuminate/support": "^9.0|^10.0|^11.0|^12.0",
"openspout/openspout": "^4.19",
"php": "^8.1"
},
"require-dev": {
"pestphp/pest-plugin-laravel": "^1.3|^2.3|^3.0",
"phpunit/phpunit": "^9.4|^10.5|^11.0|^12.0",
"spatie/pest-plugin-snapshots": "^1.1|^2.1",
"spatie/phpunit-snapshot-assertions": "^4.0|^5.1",
"spatie/temporary-directory": "^1.2|^2.2"
},
"type": "library",
"autoload": {
"psr-4": {
"Spatie\\SimpleExcel\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"description": "Read and write simple Excel and CSV files",
"homepage": "https://github.com/spatie/simple-excel",
"keywords": [
"simple-excel",
"spatie"
],
"support": {
"source": "https://github.com/spatie/simple-excel/tree/3.7.2"
},
"funding": [
{
"url": "https://github.com/spatie",
"type": "github"
}
],
"time": "2025-02-14T12:47:34+00:00"
},
{
"name": "symfony/clock",
"version": "v7.2.0",
@@ -8331,6 +8745,91 @@
}
],
"packages-dev": [
{
"name": "barryvdh/laravel-debugbar",
"version": "v3.15.4",
"source": {
"type": "git",
"url": "https://github.com/barryvdh/laravel-debugbar.git",
"reference": "c0667ea91f7185f1e074402c5788195e96bf8106"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/c0667ea91f7185f1e074402c5788195e96bf8106",
"reference": "c0667ea91f7185f1e074402c5788195e96bf8106",
"shasum": ""
},
"require": {
"illuminate/routing": "^9|^10|^11|^12",
"illuminate/session": "^9|^10|^11|^12",
"illuminate/support": "^9|^10|^11|^12",
"php": "^8.1",
"php-debugbar/php-debugbar": "~2.1.1",
"symfony/finder": "^6|^7"
},
"require-dev": {
"mockery/mockery": "^1.3.3",
"orchestra/testbench-dusk": "^7|^8|^9|^10",
"phpunit/phpunit": "^9.5.10|^10|^11",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
"extra": {
"laravel": {
"aliases": {
"Debugbar": "Barryvdh\\Debugbar\\Facades\\Debugbar"
},
"providers": [
"Barryvdh\\Debugbar\\ServiceProvider"
]
},
"branch-alias": {
"dev-master": "3.15-dev"
}
},
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"Barryvdh\\Debugbar\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
}
],
"description": "PHP Debugbar integration for Laravel",
"keywords": [
"debug",
"debugbar",
"dev",
"laravel",
"profiler",
"webprofiler"
],
"support": {
"issues": "https://github.com/barryvdh/laravel-debugbar/issues",
"source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.15.4"
},
"funding": [
{
"url": "https://fruitcake.nl",
"type": "custom"
},
{
"url": "https://github.com/barryvdh",
"type": "github"
}
],
"time": "2025-04-16T06:32:06+00:00"
},
{
"name": "barryvdh/laravel-ide-helper",
"version": "v3.5.5",
@@ -9301,6 +9800,76 @@
},
"time": "2022-02-21T01:04:05+00:00"
},
{
"name": "php-debugbar/php-debugbar",
"version": "v2.1.6",
"source": {
"type": "git",
"url": "https://github.com/php-debugbar/php-debugbar.git",
"reference": "16fa68da5617220594aa5e33fa9de415f94784a0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-debugbar/php-debugbar/zipball/16fa68da5617220594aa5e33fa9de415f94784a0",
"reference": "16fa68da5617220594aa5e33fa9de415f94784a0",
"shasum": ""
},
"require": {
"php": "^8",
"psr/log": "^1|^2|^3",
"symfony/var-dumper": "^4|^5|^6|^7"
},
"require-dev": {
"dbrekelmans/bdi": "^1",
"phpunit/phpunit": "^8|^9",
"symfony/panther": "^1|^2.1",
"twig/twig": "^1.38|^2.7|^3.0"
},
"suggest": {
"kriswallsmith/assetic": "The best way to manage assets",
"monolog/monolog": "Log using Monolog",
"predis/predis": "Redis storage"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
}
},
"autoload": {
"psr-4": {
"DebugBar\\": "src/DebugBar/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Maxime Bouroumeau-Fuseau",
"email": "maxime.bouroumeau@gmail.com",
"homepage": "http://maximebf.com"
},
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
}
],
"description": "Debug bar in the browser for php application",
"homepage": "https://github.com/php-debugbar/php-debugbar",
"keywords": [
"debug",
"debug bar",
"debugbar",
"dev"
],
"support": {
"issues": "https://github.com/php-debugbar/php-debugbar/issues",
"source": "https://github.com/php-debugbar/php-debugbar/tree/v2.1.6"
},
"time": "2025-02-21T17:47:03+00:00"
},
{
"name": "phpunit/php-code-coverage",
"version": "11.0.9",

View File

@@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class AdminSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}

View File

@@ -21,7 +21,7 @@ class UserSeeder extends Seeder
// Data to update/create
[
'name' => 'Admin',
'password' => Hash::make('admin'),
'password' => Hash::make('jOtHi$9000'),
'updated_at' => now(),
'created_at' => now()
]
@@ -35,79 +35,60 @@ class UserSeeder extends Seeder
$user2 = User::updateOrCreate(
// Unique identifier
['email' => 'jothi@cripumps.com'],
['email' => 'dhanabalan@cripumps.com'],
// Data to update/create
[
'name' => 'Jothi',
'password' => bcrypt('jothi@123'),
'name' => 'Dhanabalan S',
'password' => bcrypt('SdHaNa@123'),
'updated_at' => now(),
'created_at' => now()
]
);
// $user2 = User::firstOrCreate([
// 'name' => 'Jothi',
// 'email' => 'jothi@cripumps.com',
// 'password' => bcrypt('jothi@123'),
// 'name' => 'Dhana',
// 'email' => 'dhana@cripumps.com',
// 'password' => bcrypt('dhana@123'),
// ]);
$user2->assignRole('Super Admin');
$user3 = User::updateOrCreate(
// Unique identifier
['email' => 'dhana@cripumps.com'],
['email' => 'ranjith@cripumps.com'],
// Data to update/create
[
'name' => 'Dhana',
'password' => bcrypt('dhana@123'),
'name' => 'Ranjith B',
'password' => bcrypt('Ranjii@5503'),
'updated_at' => now(),
'created_at' => now()
]
);
// $user3 = User::firstOrCreate([
// 'name' => 'Dhana',
// 'email' => 'dhana@cripumps.com',
// 'password' => bcrypt('dhana@123'),
// 'name' => 'Ranjith',
// 'email' => 'ranjith@cripumps.com',
// 'password' => bcrypt('ranjith@123'),
// ]);
$user3->assignRole('Super Admin');
$user4 = User::updateOrCreate(
// Unique identifier
['email' => 'ranjith@cripumps.com'],
['email' => 'srimathi@cripumps.com'],
// Data to update/create
[
'name' => 'Ranjith',
'password' => bcrypt('ranjith@123'),
'name' => 'Srimathi M',
'password' => bcrypt('MsRi@123'),
'updated_at' => now(),
'created_at' => now()
]
);
// $user4 = User::firstOrCreate([
// 'name' => 'Ranjith',
// 'email' => 'ranjith@cripumps.com',
// 'password' => bcrypt('ranjith@123'),
// ]);
$user4->assignRole('Super Admin');
$user5 = User::updateOrCreate(
// Unique identifier
['email' => 'srimathi@cripumps.com'],
// Data to update/create
[
'name' => 'Srimathi',
'password' => bcrypt('srimathi@123'),
'updated_at' => now(),
'created_at' => now()
]
);
// $user5 = User::firstOrCreate([
// 'name' => 'Srimathi',
// 'email' => 'srimathi@cripumps.com',
// 'password' => bcrypt('srimathi@123'),
// ]);
$user5->assignRole('Super Admin');
$user4->assignRole('Super Admin');
// User::factory()->count(5)->create();
}
}

View File

@@ -0,0 +1,30 @@
.preview-table {
background: white;
color: black;
width: 100%;
border-collapse: collapse;
border-spacing: 0;
}
.preview-table td,
.preview-table th {
border-color: #ededed;
border-style: solid;
border-width: 1px;
font-size: 13px;
line-height: 2;
overflow: hidden;
padding-left: 6px;
word-break: normal;
}
.preview-table th {
font-weight: normal;
}
.preview-table-wrapper {
max-height: min(500px, 80vh);
overflow-y: auto;
}

View File

@@ -0,0 +1,36 @@
function onElementRemoved(element, callback) {
new MutationObserver(function (mutations) {
if (!document.body.contains(element)) {
callback();
this.disconnect();
}
}).observe(element.parentElement, { childList: true });
}
function triggerInputEvent(statePath, value) {
let input = document.getElementById(statePath);
input.value = value;
input.dispatchEvent(new Event('input', { bubbles: true }));
}
function printHTML(html, statePath, uniqueActionId) {
let iframe = document.createElement("iframe");
let random = Math.floor(Math.random() * 99999);
iframe.id = `print-${random}`;
iframe.srcdoc = html;
document.body.append(iframe);
onElementRemoved(iframe, () => triggerInputEvent(statePath, `afterprint-${uniqueActionId}`));
iframe.contentWindow.onafterprint = () => document.getElementById(iframe.id).remove();
iframe.contentWindow.onload = () => iframe.contentWindow.print();
}
window.triggerInputEvent = triggerInputEvent;
window.printHTML = printHTML;

View File

@@ -7,3 +7,20 @@
@livewire(\App\Filament\Widgets\ItemOverview::class)
</div>
</x-filament-panels::page>
{{-- <x-filament-panels::page>
<div x-data x-init="
window.addEventListener('filtersUpdated', () => {
Livewire.emit('filtersUpdated');
});
" class="space-y-4">
{{-- Filters form --}}
{{-- {{ $this->filtersForm($this->form) }} --}}
{{-- Chart Widget --}}
{{-- @livewire(\App\Filament\Widgets\ItemOverview::class)
</div>
</x-filament-panels::page> --}}

View File

@@ -0,0 +1,22 @@
<x-filament::page>
<form wire:submit.prevent="create" class="space-y-6">
{{-- Form Section --}}
<div class="filament-form space-y-6">
{{ $this->form }}
</div>
{{-- Livewire Component (Invoice Table) --}}
<div class="bg-white shadow rounded-xl p-4">
<livewire:select-plant />
</div>
{{-- Actions --}}
<div class="filament-actions mt-6">
<x-filament::actions>
@foreach ($this->getFormActions() as $action)
{{ $action }}
@endforeach
</x-filament::actions>
</div>
</form>
</x-filament::page>

2
storage/debugbar/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore