Compare commits
31 Commits
5bcf0703d9
...
renovate/a
| Author | SHA1 | Date | |
|---|---|---|---|
| e6d99ba9d6 | |||
| e20915ca82 | |||
|
|
5f4494f5aa | ||
| 58e6cbfac0 | |||
|
|
9fa73b2ecc | ||
| 1ace049687 | |||
|
|
d75d435456 | ||
| e5e85a8eea | |||
|
|
ff8aa8b536 | ||
|
|
53f0a7bfdf | ||
| 555802ab35 | |||
|
|
1aa1937b39 | ||
| 587b743f12 | |||
|
|
0812484926 | ||
| 42555d4a81 | |||
|
|
2d4700c9b2 | ||
| fd1e554076 | |||
|
|
eb38f4ddcf | ||
| 022654f192 | |||
|
|
faaaa88e8f | ||
| 55f1088fda | |||
|
|
d6c7e43715 | ||
| f9233f44d8 | |||
|
|
f45bb7b74b | ||
| e0fec6b07c | |||
|
|
80806d0f17 | ||
| 6bda9c1459 | |||
|
|
2b3db1cde1 | ||
|
|
bf1ae76334 | ||
| 39bdd3df57 | |||
|
|
01783c4fc7 |
31
app/Console/Commands/LogClear.php
Normal file
31
app/Console/Commands/LogClear.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class LogClear extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'app:log-clear';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
file_put_contents(storage_path('logs/laravel.log'), '');
|
||||
$this->info('Laravel log cleared!');
|
||||
}
|
||||
}
|
||||
@@ -140,13 +140,14 @@ class InvoiceDataValidationResource extends Resource
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->dateTime()
|
||||
->sortable(),
|
||||
// ->toggleable(isToggledHiddenByDefault: true),
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_by')
|
||||
->label('Updated By')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->alignCenter()
|
||||
|
||||
@@ -111,13 +111,14 @@ class InvoiceOutValidationResource extends Resource
|
||||
->dateTime()
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
// ->toggleable(isToggledHiddenByDefault: true),
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_by')
|
||||
->label('Updated By')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -46,6 +46,22 @@ class ProcessOrderResource extends Resource
|
||||
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||
})
|
||||
->afterStateUpdated(function ($state, $set, callable $get, $livewire) {
|
||||
$plantId = $get('plant_id');
|
||||
$set('coil_number', null);
|
||||
$set('sfg_number', null);
|
||||
$set('machine_name', null);
|
||||
if (! $plantId) {
|
||||
$set('poPlantError', 'Please select a plant first.');
|
||||
$set('coilNumberError', null);
|
||||
$set('sfgNumberError', null);
|
||||
}
|
||||
})
|
||||
->extraAttributes(fn ($get) => [
|
||||
'class' => $get('poPlantError') ? 'border-red-500' : '',
|
||||
])
|
||||
->hint(fn ($get) => $get('poPlantError') ? $get('poPlantError') : null)
|
||||
->hintColor('danger')
|
||||
->required(),
|
||||
Forms\Components\Select::make('item_id')
|
||||
->label('Item Code')
|
||||
@@ -108,10 +124,63 @@ class ProcessOrderResource extends Resource
|
||||
// ->readOnly(true),
|
||||
Forms\Components\TextInput::make('process_order')
|
||||
->label('Process Order')
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, $set, callable $get, $livewire) {
|
||||
$plantId = $get('plant_id');
|
||||
$set('coil_number', null);
|
||||
$set('sfg_number', null);
|
||||
$set('machine_name', null);
|
||||
if (! $plantId) {
|
||||
$set('poPlantError', 'Please select a plant first.');
|
||||
$set('process_order', null);
|
||||
$set('coilNumberError', null);
|
||||
$set('sfgNumberError', null);
|
||||
}
|
||||
})
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('coil_number')
|
||||
->label('Coil Number')
|
||||
->default('0')
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, $set, callable $get, $livewire) {
|
||||
$plantId = $get('plant_id');
|
||||
$processOrder = $get('process_order');
|
||||
$coilNo = $get('coil_number');
|
||||
if (! $plantId) {
|
||||
$set('poPlantError', 'Please select a plant first.');
|
||||
$set('coil_number', null);
|
||||
$set('sfg_number', null);
|
||||
$set('machine_name', null);
|
||||
$set('coilNumberError', null);
|
||||
$set('sfgNumberError', null);
|
||||
} elseif (! $processOrder) {
|
||||
$set('coil_number', null);
|
||||
$set('sfg_number', null);
|
||||
$set('machine_name', null);
|
||||
$set('poPlantError', null);
|
||||
$set('coilNumberError', null);
|
||||
$set('sfgNumberError', null);
|
||||
} elseif ($coilNo || $coilNo == '0') {
|
||||
$existing = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('coil_number', $coilNo)
|
||||
->first();
|
||||
|
||||
if ($existing) {
|
||||
$set('poPlantError', null);
|
||||
$set('coil_number', null);
|
||||
$set('coilNumberError', "Duplicate Coil : '{$coilNo}' found!");
|
||||
} else {
|
||||
$set('poPlantError', null);
|
||||
$set('coilNumberError', null);
|
||||
}
|
||||
}
|
||||
})
|
||||
->extraAttributes(fn ($get) => [
|
||||
'class' => $get('coilNumberError') ? 'border-red-500' : '',
|
||||
])
|
||||
->hint(fn ($get) => $get('coilNumberError') ? $get('coilNumberError') : null)
|
||||
->hintColor('danger')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('order_quantity')
|
||||
->label('Order Quantity')
|
||||
@@ -122,10 +191,38 @@ class ProcessOrderResource extends Resource
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('sfg_number')
|
||||
->label('SFG Number')
|
||||
->required(),
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, $set, callable $get, $livewire) {
|
||||
$plantId = $get('plant_id');
|
||||
$sfgNo = $get('sfg_number');
|
||||
if (! $plantId) {
|
||||
$set('poPlantError', 'Please select a plant first.');
|
||||
$set('sfg_number', null);
|
||||
$set('machine_name', null);
|
||||
$set('sfgNumberError', null); // 'Please select a plant first.'
|
||||
} elseif ($sfgNo) {
|
||||
$existing = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('sfg_number', $sfgNo)
|
||||
->first();
|
||||
|
||||
if ($existing) {
|
||||
$set('poPlantError', null);
|
||||
$set('sfg_number', null);
|
||||
$set('machine_name', null);
|
||||
$set('sfgNumberError', "Duplicate SFG : '{$sfgNo}' found!");
|
||||
} else {
|
||||
$set('poPlantError', null);
|
||||
$set('sfgNumberError', null);
|
||||
}
|
||||
}
|
||||
})
|
||||
->extraAttributes(fn ($get) => [
|
||||
'class' => $get('sfgNumberError') ? 'border-red-500' : '',
|
||||
])
|
||||
->hint(fn ($get) => $get('sfgNumberError') ? $get('sfgNumberError') : null)
|
||||
->hintColor('danger'),
|
||||
Forms\Components\TextInput::make('machine_name')
|
||||
->label('Machine ID')
|
||||
->required(),
|
||||
->label('Machine ID'),
|
||||
Forms\Components\FileUpload::make('attachment')
|
||||
->label('PDF Upload')
|
||||
->acceptedFileTypes(['application/pdf'])
|
||||
|
||||
@@ -631,10 +631,11 @@ class PdfController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
Log::info('Process Order POST API called >>', ['request_data' => $request->all()]);
|
||||
|
||||
$plantCode = $request->header('plant-code');
|
||||
$processOrder = $request->header('process-order');
|
||||
$data = $request->all();
|
||||
|
||||
Log::info('Process Order POST API >>', ['plant-code' => $plantCode, 'process-order' => $processOrder, 'post-data' => $data]);
|
||||
|
||||
if ($plantCode == null || $plantCode == '' || ! $plantCode) {
|
||||
return response()->json([
|
||||
@@ -665,8 +666,6 @@ class PdfController extends Controller
|
||||
|
||||
$plantId = $plant->id;
|
||||
|
||||
$data = $request->all();
|
||||
|
||||
$itemCode = $data['item_code'] ?? '';
|
||||
$coilNo = $data['coil_number'] ?? '';
|
||||
$orderQty = $data['order_quantity'] ?? 0;
|
||||
@@ -714,19 +713,19 @@ class PdfController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($sfgNo == null || $sfgNo == '' || ! $sfgNo) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "SFG number can't be empty!",
|
||||
], 404);
|
||||
}
|
||||
// if ($sfgNo == null || $sfgNo == '' || ! $sfgNo) {
|
||||
// return response()->json([
|
||||
// 'status_code' => 'ERROR',
|
||||
// 'status_description' => "SFG number can't be empty!",
|
||||
// ], 404);
|
||||
// }
|
||||
|
||||
if ($machineId == null || $machineId == '' || ! $machineId) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Machine ID can't be empty!",
|
||||
], 404);
|
||||
}
|
||||
// if ($machineId == null || $machineId == '' || ! $machineId) {
|
||||
// return response()->json([
|
||||
// 'status_code' => 'ERROR',
|
||||
// 'status_description' => "Machine ID can't be empty!",
|
||||
// ], 404);
|
||||
// }
|
||||
|
||||
if ($createdBy == null || $createdBy == '' || ! $createdBy) {
|
||||
return response()->json([
|
||||
@@ -778,19 +777,23 @@ class PdfController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
$existing = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('sfg_number', $sfgNo)
|
||||
->first();
|
||||
|
||||
if ($existing) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "SFG number '{$sfgNo}' already exist for the plant code '{$plantCode}'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$itemId = $itemPlant->id;
|
||||
|
||||
if ($sfgNo != null && $sfgNo != '' && Str::length($sfgNo) > 0 && $sfgNo) {
|
||||
$existing = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('sfg_number', $sfgNo)
|
||||
->first();
|
||||
|
||||
if ($existing) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "SFG number '{$sfgNo}' already exist for the plant code '{$plantCode}'!",
|
||||
], 404);
|
||||
}
|
||||
} else {
|
||||
$sfgNo = null;
|
||||
}
|
||||
|
||||
$existing = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('item_id', '!=', $itemId)
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Filament\Resources\InvoiceValidationResource\Pages\CreateInvoiceValidation;
|
||||
use App\Models\InvoiceValidation;
|
||||
use App\Models\StickerMaster;
|
||||
use Filament\Facades\Filament;
|
||||
@@ -34,14 +33,14 @@ class InvoiceDataTable extends Component
|
||||
|
||||
public bool $showCapacitorInput = false;
|
||||
|
||||
// protected $listeners = ['refreshInvoiceData' => 'loadData',];
|
||||
// protected $listeners = ['refreshInvoiceData' => 'loadData',];
|
||||
|
||||
protected $listeners = [
|
||||
'refreshCompletedInvoice' => 'loadCompletedData',
|
||||
'refreshEmptyInvoice' => 'loadEmptyData',
|
||||
'refreshInvoiceData' => 'loadData',
|
||||
'refreshMaterialInvoiceData' => 'loadMaterialData',
|
||||
'openCapacitorModal' => 'showCapacitorInputBox'
|
||||
'openCapacitorModal' => 'showCapacitorInputBox',
|
||||
];
|
||||
|
||||
public $capacitorInput = '';
|
||||
@@ -96,101 +95,83 @@ class InvoiceDataTable extends Component
|
||||
$this->materialInvoice = false;
|
||||
// $this->showCapacitorInput = false;
|
||||
|
||||
//->where('serial_number', '!=', '')
|
||||
// ->where('serial_number', '!=', '')
|
||||
$this->invoiceData = InvoiceValidation::where('invoice_number', $this->invoiceNumber)
|
||||
->where('plant_id', $plantId)->where('scanned_status', null)
|
||||
->get()
|
||||
->map(function ($record) {
|
||||
return [
|
||||
'sticker_master_id' => $record->sticker_master_id,
|
||||
'serial_number' => $record->serial_number,
|
||||
'motor_scanned_status' => $record->motor_scanned_status ?? '',
|
||||
'pump_scanned_status' => $record->pump_scanned_status ?? '',
|
||||
'capacitor_scanned_status' => $record->capacitor_scanned_status ?? '',
|
||||
'scanned_status_set' => $record->scanned_status_set ?? '',
|
||||
'scanned_status' => $record->scanned_status ?? '',
|
||||
'panel_box_supplier' => $record->panel_box_supplier ?? '',
|
||||
'panel_box_serial_number' => $record->panel_box_serial_number ?? '',
|
||||
'created_at' => $record->created_at,
|
||||
'operator_id' => $record->operator_id,
|
||||
];
|
||||
})
|
||||
->toArray();
|
||||
->where('plant_id', $plantId)->where('scanned_status', null)
|
||||
->get()
|
||||
->map(function ($record) {
|
||||
return [
|
||||
'sticker_master_id' => $record->sticker_master_id,
|
||||
'serial_number' => $record->serial_number,
|
||||
'motor_scanned_status' => $record->motor_scanned_status ?? '',
|
||||
'pump_scanned_status' => $record->pump_scanned_status ?? '',
|
||||
'capacitor_scanned_status' => $record->capacitor_scanned_status ?? '',
|
||||
'scanned_status_set' => $record->scanned_status_set ?? '',
|
||||
'scanned_status' => $record->scanned_status ?? '',
|
||||
'panel_box_supplier' => $record->panel_box_supplier ?? '',
|
||||
'panel_box_serial_number' => $record->panel_box_serial_number ?? '',
|
||||
'created_at' => $record->created_at,
|
||||
'operator_id' => $record->operator_id,
|
||||
];
|
||||
})
|
||||
->toArray();
|
||||
|
||||
$this->packageCount = 0;
|
||||
|
||||
//Loop through and replace 'code' using related StickerMaster > Item > code
|
||||
// Loop through and replace 'code' using related StickerMaster > Item > code
|
||||
foreach ($this->invoiceData as &$row) {
|
||||
$stickCount = 0;
|
||||
$scannedCount = 0;
|
||||
|
||||
// $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
|
||||
// $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
|
||||
$row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
|
||||
$curStick = StickerMaster::where('id', $row['sticker_master_id'])->first();
|
||||
if ($curStick)
|
||||
{
|
||||
if ($curStick->tube_sticker_motor == 1 || $curStick->tube_sticker_pump == 1 || $curStick->tube_sticker_pumpset == 1 || Str::length($curStick->panel_box_code) > 0)
|
||||
{
|
||||
if ($curStick->tube_sticker_motor == 1)
|
||||
{
|
||||
$stickCount++;
|
||||
}
|
||||
if ($curStick->tube_sticker_pump == 1)
|
||||
{
|
||||
$stickCount++;
|
||||
}
|
||||
if ($curStick->tube_sticker_pumpset == 1)
|
||||
{
|
||||
$stickCount++;
|
||||
}
|
||||
if (Str::length($curStick->panel_box_code) > 0)
|
||||
{
|
||||
$stickCount++;
|
||||
}
|
||||
if ($curStick) {
|
||||
if (Str::length($curStick->panel_box_code) > 0) {
|
||||
$stickCount++;
|
||||
}
|
||||
else if ($curStick->pack_slip_motor == 1 || $curStick->pack_slip_pump == 1 || $curStick->pack_slip_pumpset == 1)
|
||||
{
|
||||
if ($curStick->pack_slip_motor == 1)
|
||||
{
|
||||
if ($curStick->tube_sticker_motor == 1 || $curStick->tube_sticker_pump == 1 || $curStick->tube_sticker_pumpset == 1) {
|
||||
if ($curStick->tube_sticker_motor == 1) {
|
||||
$stickCount++;
|
||||
}
|
||||
if ($curStick->pack_slip_pump == 1)
|
||||
{
|
||||
if ($curStick->tube_sticker_pump == 1 || ($curStick->tube_sticker_pumpset != 1 && $curStick->tube_sticker_pump != 1 && $curStick->pack_slip_pump == 1)) {
|
||||
$stickCount++;
|
||||
}
|
||||
if ($curStick->pack_slip_pumpset == 1)
|
||||
{
|
||||
if ($curStick->tube_sticker_pumpset == 1) {
|
||||
$stickCount++;
|
||||
}
|
||||
} elseif ($curStick->pack_slip_motor == 1 || $curStick->pack_slip_pump == 1 || $curStick->pack_slip_pumpset == 1) {
|
||||
if ($curStick->pack_slip_motor == 1) {
|
||||
$stickCount++;
|
||||
}
|
||||
if ($curStick->pack_slip_pump == 1) {
|
||||
$stickCount++;
|
||||
}
|
||||
if ($curStick->pack_slip_pumpset == 1) {
|
||||
$stickCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($row['motor_scanned_status'] == 1)
|
||||
{
|
||||
if ($row['motor_scanned_status'] == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
if ($row['pump_scanned_status'] == 1)
|
||||
{
|
||||
if ($row['pump_scanned_status'] == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
if ($row['capacitor_scanned_status'] == 1)
|
||||
{
|
||||
if ($row['capacitor_scanned_status'] == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
if ($row['scanned_status_set'] == 1)
|
||||
{
|
||||
if ($row['scanned_status_set'] == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
|
||||
$this->packageCount += $stickCount - $scannedCount;
|
||||
}
|
||||
|
||||
if ($onCapFocus)
|
||||
{
|
||||
if ($onCapFocus) {
|
||||
$this->dispatch('focus-capacitor-input');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->dispatch('focus-serial-number');
|
||||
}
|
||||
}
|
||||
@@ -207,43 +188,36 @@ class InvoiceDataTable extends Component
|
||||
$this->materialInvoice = true;
|
||||
// $this->showCapacitorInput = false;
|
||||
|
||||
//->where('serial_number', '!=', '')
|
||||
// ->where('serial_number', '!=', '')
|
||||
$this->invoiceData = InvoiceValidation::where('invoice_number', $this->invoiceNumber)->where('plant_id', $plantId)->where('serial_number', null)
|
||||
->get()
|
||||
->map(function ($record) {
|
||||
return [
|
||||
'sticker_master_id' => $record->sticker_master_id,
|
||||
// 'material_type' => StickerMaster::where('id', $record->sticker_master_id)->first()->material_type ?? '',
|
||||
'quantity' => $record->quantity ?? '',
|
||||
'serial_number' => $record->serial_number ?? '',
|
||||
'batch_number' => $record->batch_number ?? '',
|
||||
'created_at' => $record->created_at,
|
||||
'operator_id' => $record->operator_id,
|
||||
];
|
||||
})
|
||||
->toArray();
|
||||
->get()
|
||||
->map(function ($record) {
|
||||
return [
|
||||
'sticker_master_id' => $record->sticker_master_id,
|
||||
// 'material_type' => StickerMaster::where('id', $record->sticker_master_id)->first()->material_type ?? '',
|
||||
'quantity' => $record->quantity ?? '',
|
||||
'serial_number' => $record->serial_number ?? '',
|
||||
'batch_number' => $record->batch_number ?? '',
|
||||
'created_at' => $record->created_at,
|
||||
'operator_id' => $record->operator_id,
|
||||
];
|
||||
})
|
||||
->toArray();
|
||||
|
||||
//Loop through and replace 'code' using related StickerMaster > Item > code
|
||||
// Loop through and replace 'code' using related StickerMaster > Item > code
|
||||
foreach ($this->invoiceData as &$row) {
|
||||
// $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
|
||||
$row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
|
||||
$matType = StickerMaster::where('id', $row['sticker_master_id'] ?? null)->first()->material_type ?? '';
|
||||
if ($matType === 1)
|
||||
{
|
||||
// $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
|
||||
$row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
|
||||
$matType = StickerMaster::where('id', $row['sticker_master_id'] ?? null)->first()->material_type ?? '';
|
||||
if ($matType === 1) {
|
||||
$row['material_type'] = 'Individual';
|
||||
}
|
||||
else if ($matType === 2)
|
||||
{
|
||||
} elseif ($matType === 2) {
|
||||
$row['material_type'] = 'Bundle';
|
||||
}
|
||||
else if ($matType === 3)
|
||||
{
|
||||
} elseif ($matType === 3) {
|
||||
$row['material_type'] = 'Quantity';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$row['material_type'] = 'N/A';
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->dispatch('focus-serial-number');
|
||||
}
|
||||
@@ -275,11 +249,11 @@ class InvoiceDataTable extends Component
|
||||
$user = Filament::auth()->user();
|
||||
$operatorName = $user->name;
|
||||
|
||||
if (!$this->capacitorInput) {
|
||||
if (! $this->capacitorInput) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!preg_match('/^[^\/]+\/[^\/]+\/.+$/', $this->capacitorInput)) {
|
||||
if (! preg_match('/^[^\/]+\/[^\/]+\/.+$/', $this->capacitorInput)) {
|
||||
Notification::make()
|
||||
->title('Invalid Panel Box QR Format:')
|
||||
->body('Scan the valid panel box QR code to proceed!')
|
||||
@@ -287,6 +261,7 @@ class InvoiceDataTable extends Component
|
||||
// ->duration(3000)
|
||||
->seconds(2)
|
||||
->send();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -298,9 +273,9 @@ class InvoiceDataTable extends Component
|
||||
$existsInStickerMaster = StickerMaster::where('panel_box_code', $itemCode)->where('plant_id', $this->plantId)->whereHas('item', function ($query) {
|
||||
$query->where('code', $this->currentItemCode);
|
||||
})
|
||||
->exists();
|
||||
->exists();
|
||||
|
||||
if (!$existsInStickerMaster) {
|
||||
if (! $existsInStickerMaster) {
|
||||
Notification::make()
|
||||
->title('Unknown: Panel Box Code')
|
||||
->body("Unknown panel box code: $itemCode found for item code: $this->currentItemCode")
|
||||
@@ -309,12 +284,12 @@ class InvoiceDataTable extends Component
|
||||
->seconds(2)
|
||||
->send();
|
||||
$this->capacitorInput = '';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($this->invoiceData as &$row) {
|
||||
if (($row['code'] ?? '') === $this->currentItemCode && ($row['serial_number'] ?? '') === $this->currentSerialNumber)
|
||||
{
|
||||
if (($row['code'] ?? '') === $this->currentItemCode && ($row['serial_number'] ?? '') === $this->currentSerialNumber) {
|
||||
$row['panel_box_supplier'] = $supplier;
|
||||
$row['panel_box_item_code'] = $itemCode;
|
||||
$row['panel_box_serial_number'] = $serialNumber;
|
||||
@@ -343,47 +318,41 @@ class InvoiceDataTable extends Component
|
||||
$packCnt = 1;
|
||||
$scanCnt = 1;
|
||||
// if ($hadMotorQr === $hasMotorQr && $hadPumpQr === $hasPumpQr && $hadPumpSetQr === $hasPumpSetQr)
|
||||
if ($hasMotorQr || $hasPumpQr || $hasPumpSetQr)
|
||||
{
|
||||
if ($hasMotorQr || $hasPumpQr || $hasPumpSetQr) {
|
||||
$packCnt = $hasMotorQr ? $packCnt + 1 : $packCnt;
|
||||
$packCnt = $hasPumpQr ? $packCnt + 1 : $packCnt;
|
||||
$packCnt = $hasPumpSetQr ? $packCnt + 1 : $packCnt;
|
||||
|
||||
$scanCnt = $hadMotorQr ? $scanCnt + 1: $scanCnt;
|
||||
$scanCnt = $hadPumpQr ? $scanCnt + 1: $scanCnt;
|
||||
$scanCnt = $hadPumpSetQr ? $scanCnt + 1: $scanCnt;
|
||||
$scanCnt = $hadMotorQr ? $scanCnt + 1 : $scanCnt;
|
||||
$scanCnt = $hadPumpQr ? $scanCnt + 1 : $scanCnt;
|
||||
$scanCnt = $hadPumpSetQr ? $scanCnt + 1 : $scanCnt;
|
||||
|
||||
if ($packCnt === $scanCnt)
|
||||
{
|
||||
if ($packCnt === $scanCnt) {
|
||||
$matchingValidation->update([
|
||||
'panel_box_supplier' => $supplier,
|
||||
'panel_box_item_code' => $itemCode,
|
||||
'panel_box_serial_number' => $serialNumber,
|
||||
'capacitor_scanned_status' => 1,
|
||||
'scanned_status' => 'Scanned',
|
||||
'operator_id'=> $operatorName,
|
||||
'operator_id' => $operatorName,
|
||||
]);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$matchingValidation->update([
|
||||
'panel_box_supplier' => $supplier,
|
||||
'panel_box_item_code' => $itemCode,
|
||||
'panel_box_serial_number' => $serialNumber,
|
||||
'capacitor_scanned_status' => 1,
|
||||
'operator_id'=> $operatorName,
|
||||
'operator_id' => $operatorName,
|
||||
]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$matchingValidation->update([
|
||||
'panel_box_supplier' => $supplier,
|
||||
'panel_box_item_code' => $itemCode,
|
||||
'panel_box_serial_number' => $serialNumber,
|
||||
'capacitor_scanned_status' => 1,
|
||||
'scanned_status' => 'Scanned',
|
||||
'operator_id'=> $operatorName,
|
||||
'operator_id' => $operatorName,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -398,15 +367,14 @@ class InvoiceDataTable extends Component
|
||||
$totalQuantity = InvoiceValidation::where('invoice_number', $matchingValidation->invoice_number)->where('plant_id', $this->plantId)->count();
|
||||
$scannedQuantity = InvoiceValidation::where('invoice_number', $matchingValidation->invoice_number)->where('plant_id', $this->plantId)->where('scanned_status', 'Scanned')->count();
|
||||
// $this->form->fill([
|
||||
// 'plant_id' => $matchingValidation->plant_id,
|
||||
// 'invoice_number' => $matchingValidation->invoice_number,
|
||||
// 'serial_number' => null,
|
||||
// 'total_quantity' => $totalQuantity,
|
||||
// 'scanned_quantity'=> $scannedQuantity,
|
||||
// ]);
|
||||
// 'plant_id' => $matchingValidation->plant_id,
|
||||
// 'invoice_number' => $matchingValidation->invoice_number,
|
||||
// 'serial_number' => null,
|
||||
// 'total_quantity' => $totalQuantity,
|
||||
// 'scanned_quantity'=> $scannedQuantity,
|
||||
// ]);
|
||||
|
||||
if ($totalQuantity === $scannedQuantity)
|
||||
{
|
||||
if ($totalQuantity === $scannedQuantity) {
|
||||
Notification::make()
|
||||
->title('Completed: Serial Invoice')
|
||||
->body("Serial invoice '$matchingValidation->invoice_number' completed the scanning process.<br>Scan the next 'Serial Invoice' to proceed!")
|
||||
@@ -414,9 +382,7 @@ class InvoiceDataTable extends Component
|
||||
->seconds(2)
|
||||
->send();
|
||||
$this->loadCompletedData($matchingValidation->invoice_number, $matchingValidation->plant_id, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->loadData($matchingValidation->invoice_number, $matchingValidation->plant_id, false);
|
||||
}
|
||||
}
|
||||
@@ -427,7 +393,7 @@ class InvoiceDataTable extends Component
|
||||
$this->showCapacitorInput = false;
|
||||
$this->capacitorInput = '';
|
||||
$this->dispatch('updateScannedQuantity');
|
||||
//$this->loadData($this->invoiceNumber, $this->plantId);
|
||||
// $this->loadData($this->invoiceNumber, $this->plantId);
|
||||
$this->dispatch('focus-serial-number');
|
||||
}
|
||||
|
||||
@@ -435,5 +401,4 @@ class InvoiceDataTable extends Component
|
||||
{
|
||||
return view('livewire.invoice-data-table');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Models\InvoiceDataValidation;
|
||||
use DateTime;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use DateTime;
|
||||
|
||||
class InvoiceDataMail extends Mailable
|
||||
{
|
||||
@@ -23,7 +23,7 @@ class InvoiceDataMail extends Mailable
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($scheduleType, $tableData = [], $mailSubject)
|
||||
public function __construct($scheduleType, $tableData, $mailSubject)
|
||||
{
|
||||
$this->scheduleType = $scheduleType;
|
||||
$this->tableData = $tableData ?? [];
|
||||
@@ -48,17 +48,19 @@ class InvoiceDataMail extends Mailable
|
||||
$greeting = 'Dear Sir/Madam,<br><br>We are sending here with list of "Despatch pending sale invoice & STO invoice as on date"';
|
||||
|
||||
if ($this->scheduleType == 'Daily') {
|
||||
$firstRecord = \App\Models\InvoiceDataValidation::orderBy('document_date', 'asc')->first();
|
||||
//$lastRecord = \App\Models\InvoiceDataValidation::orderBy('document_date', 'desc')->first();
|
||||
$firstRecord = InvoiceDataValidation::orderBy('document_date', 'asc')->first(); // 'desc'
|
||||
|
||||
if ($firstRecord) {
|
||||
$startDate = null;
|
||||
if ($firstRecord && $firstRecord?->document_date != null && $firstRecord?->document_date != '') {
|
||||
$startDate = \Carbon\Carbon::parse($firstRecord->document_date)->startOfDay();
|
||||
//$endDate = \Carbon\Carbon::parse($lastRecord->document_date)->endOfDay();
|
||||
// $endDate = \Carbon\Carbon::parse($lastRecord->document_date)->endOfDay();
|
||||
} else {
|
||||
$startDate = now()->subDay()->setTime(10, 0, 0);
|
||||
}
|
||||
$endDate = now()->setTime(10, 0, 0);
|
||||
|
||||
// $fromDate = (new DateTime('yesterday 10:00'))->format('d/m/Y H:i') . ':000';//08:00
|
||||
// $toDate = (new DateTime('today 09:59'))->format('d/m/Y H:i') . ':999';//07:59
|
||||
// $toDate = (new DateTime('today 09:59')) ->format('d/m/Y H:i') . ':999';//07:59
|
||||
$reportPeriod = "from: $startDate to $endDate\".<br><br>Please arrange to despatch the same immediately.";
|
||||
$greeting .= $reportPeriod;
|
||||
}
|
||||
@@ -74,17 +76,17 @@ class InvoiceDataMail extends Mailable
|
||||
if ($this->scheduleType == 'Live') {
|
||||
$now = now();
|
||||
$fromMinute = $now->copy()->subMinute()->format('d/m/Y H:i:s');
|
||||
$toMinute = $now->format('d/m/Y H:i:s');
|
||||
$toMinute = $now->format('d/m/Y H:i:s');
|
||||
$greeting .= "from: $fromMinute to $toMinute. <br><br>Please arrange to despatch the same immediately.";
|
||||
}
|
||||
|
||||
return new Content(
|
||||
view: 'mail.invoice_data_report',
|
||||
with: [
|
||||
'company' => "CRI Digital Manufacturing Solutions",
|
||||
'company' => 'CRI Digital Manufacturing Solutions',
|
||||
'greeting' => $greeting,
|
||||
'tableData' => $this->tableData,
|
||||
'wishes' => "Thanks & Regards,<br>CRI Digital Manufacturing Solutions"
|
||||
'wishes' => 'Thanks & Regards,<br>CRI Digital Manufacturing Solutions',
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,19 +2,19 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Models\AlertMailRule;
|
||||
use App\Models\User;
|
||||
use Filament\Facades\FilamentView;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use App\Policies\RolePolicy;
|
||||
use App\Policies\PermissionPolicy;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Filament\Support\Facades\FilamentAsset;
|
||||
use App\Policies\RolePolicy;
|
||||
use Filament\Support\Assets\Js;
|
||||
use Filament\Support\Facades\FilamentAsset;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Illuminate\Support\Facades\Vite;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
// use Doctrine\DBAL\Types\Type;
|
||||
|
||||
@@ -28,7 +28,6 @@ class AppServiceProvider extends ServiceProvider
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
@@ -42,21 +41,21 @@ class AppServiceProvider extends ServiceProvider
|
||||
// });
|
||||
|
||||
Gate::before(function (User $user, string $ability) {
|
||||
return $user->isSuperAdmin() ? true: null;
|
||||
return $user->isSuperAdmin() ? true : null;
|
||||
});
|
||||
|
||||
// FilamentAsset::register([
|
||||
// Js::make('chart-js-plugins', Vite::asset('resources/js/filament-chart-js-plugins.js'))->module(),
|
||||
// ]);
|
||||
FilamentAsset::register([
|
||||
Js::make('chart-js-plugins', Vite::asset('resources/js/filament-chart-js-plugins.js'))->module(),
|
||||
Js::make('chart-js-plugins', Vite::asset('resources/js/filament-chart-js-plugins.js'))->module(),
|
||||
]);
|
||||
// if (env('APP_MODE') === 'admin') {
|
||||
// FilamentAsset::register([
|
||||
// Js::make('chart-js-plugins', Vite::asset('resources/js/filament-chart-js-plugins.js'))->module(),
|
||||
// ]);
|
||||
// }
|
||||
|
||||
// if (env('APP_MODE') === 'admin') {
|
||||
// FilamentAsset::register([
|
||||
// Js::make('chart-js-plugins', Vite::asset('resources/js/filament-chart-js-plugins.js'))->module(),
|
||||
// ]);
|
||||
// }
|
||||
|
||||
// URL::forceScheme('https');
|
||||
|
||||
@@ -70,5 +69,82 @@ class AppServiceProvider extends ServiceProvider
|
||||
ini_set('max_execution_time', 300); // 300 seconds = 5 minutes
|
||||
ini_set('memory_limit', '512M'); // 512MB
|
||||
|
||||
// $schedule = app(Schedule::class);
|
||||
|
||||
// $productionRules = AlertMailRule::where('module', 'ProductionQuantities')
|
||||
// ->where('rule_name', 'ProductionMail')
|
||||
// ->select('plant', 'schedule_type')
|
||||
// ->distinct()
|
||||
// ->get();
|
||||
|
||||
// foreach ($productionRules as $rule) {
|
||||
// $type = $rule->schedule_type;
|
||||
// $plantId = $rule->plant;
|
||||
|
||||
// $command = $schedule->command('send:production-report', [$type, $plantId]);
|
||||
// // ->appendOutputTo(storage_path('logs/scheduler.log'));
|
||||
|
||||
// switch ($type) {
|
||||
// case 'Live':
|
||||
// $command->everyMinute();
|
||||
// break;
|
||||
// case 'Hourly':
|
||||
// $command->hourly();
|
||||
// break;
|
||||
// case 'Daily':
|
||||
// $command->dailyAt('07:59');
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Invoice report scheduling
|
||||
// $invoiceRules = AlertMailRule::where('module', 'InvoiceValidation')
|
||||
// ->select('plant', 'schedule_type')
|
||||
// ->distinct()
|
||||
// ->get();
|
||||
|
||||
// foreach ($invoiceRules as $rule) {
|
||||
// $type = $rule->schedule_type;
|
||||
// $plantId = $rule->plant;
|
||||
|
||||
// $command = $schedule->command('send:invoice-report', [$type, $plantId]);
|
||||
|
||||
// switch ($type) {
|
||||
// case 'Live':
|
||||
// $command->everyMinute();
|
||||
// break;
|
||||
// case 'Hourly':
|
||||
// $command->hourly();
|
||||
// break;
|
||||
// case 'Daily':
|
||||
// $command->dailyAt('07:59');
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Invoice Data Report Scheduling
|
||||
// $invoiceDataRules = AlertMailRule::where('module', 'InvoiceDataReport')
|
||||
// ->select('plant', 'schedule_type')
|
||||
// ->distinct()
|
||||
// ->get();
|
||||
|
||||
// foreach ($invoiceDataRules as $rule) {
|
||||
// $type = $rule->schedule_type;
|
||||
// $plantId = $rule->plant;
|
||||
|
||||
// $command = $schedule->command('send:invoice-data-report', [$type, $plantId]);
|
||||
|
||||
// switch ($type) {
|
||||
// case 'Live':
|
||||
// $command->everyMinute();
|
||||
// break;
|
||||
// case 'Hourly':
|
||||
// $command->hourly();
|
||||
// break;
|
||||
// case 'Daily':
|
||||
// $command->dailyAt('10:00');
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.2",
|
||||
"alperenersoy/filament-export": "^3.0",
|
||||
"alperenersoy/filament-export": "^4.0",
|
||||
"althinect/filament-spatie-roles-permissions": "^2.3",
|
||||
"erag/laravel-pwa": "^1.9",
|
||||
"filament/filament": "^3.3",
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<?php
|
||||
|
||||
use App\Models\AlertMailRule;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use App\Models\AlertMailRule;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
|
||||
|
||||
|
||||
Artisan::command('inspire', function () {
|
||||
$this->comment(Inspiring::quote());
|
||||
@@ -17,9 +18,6 @@ app()->booted(function () {
|
||||
$schedule = app(Schedule::class);
|
||||
|
||||
// $schedule->command('report:send-daily-production')->dailyAt('07:59');
|
||||
|
||||
if (Schema::hasTable('alert_mail_rules')) {
|
||||
|
||||
// Production report scheduling
|
||||
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
|
||||
->where('rule_name', 'ProductionMail')
|
||||
@@ -96,5 +94,4 @@ app()->booted(function () {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user