31 Commits

Author SHA1 Message Date
e6d99ba9d6 Update dependency alperenersoy/filament-export to v4
Some checks failed
renovate/artifacts Artifact file update failure
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 9s
Gemini PR Review / review (pull_request) Failing after 48s
Laravel Larastan / larastan (pull_request) Failing after 2m5s
Laravel Pint / pint (pull_request) Failing after 1m47s
2025-11-30 00:00:51 +00:00
e20915ca82 Merge pull request 'Refactor content method in InvoiceDataMail to use null-safe operator for document_date check' (#29) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Reviewed-on: #29
2025-11-29 12:58:25 +00:00
dhanabalan
5f4494f5aa Refactor content method in InvoiceDataMail to use null-safe operator for document_date check
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / review (pull_request) Failing after 29s
Laravel Larastan / larastan (pull_request) Failing after 2m44s
Laravel Pint / pint (pull_request) Failing after 2m34s
2025-11-29 18:27:56 +05:30
58e6cbfac0 Merge pull request 'Added proper imports for mail' (#28) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #28
2025-11-29 12:57:53 +00:00
dhanabalan
9fa73b2ecc Added proper imports for mail
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 29s
Laravel Pint / pint (pull_request) Failing after 2m19s
Laravel Larastan / larastan (pull_request) Failing after 2m39s
2025-11-29 18:27:23 +05:30
1ace049687 Merge pull request 'Uncommented the mail schedule logic' (#27) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #27
2025-11-29 12:33:52 +00:00
dhanabalan
d75d435456 Uncommented the mail schedule logic
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Laravel Larastan / larastan (pull_request) Failing after 2m1s
Laravel Pint / pint (pull_request) Failing after 2m0s
Gemini PR Review / review (pull_request) Failing after 26s
2025-11-29 18:02:25 +05:30
e5e85a8eea Merge pull request 'ranjith-dev' (#26) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #26
2025-11-29 12:28:01 +00:00
dhanabalan
ff8aa8b536 Update startDate logic in InvoiceDataMail content method to handle null document_date
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / review (pull_request) Failing after 21s
Laravel Pint / pint (pull_request) Successful in 2m15s
Laravel Larastan / larastan (pull_request) Failing after 3m7s
2025-11-29 17:54:12 +05:30
dhanabalan
53f0a7bfdf Refactor InvoiceDataMail class for improved readability and consistency and __construct arg passing $tableData instead of $tableData = []
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
2025-11-29 17:37:16 +05:30
555802ab35 Merge pull request 'Updated warning message against tube_sticker and pack_slip master data' (#25) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Reviewed-on: #25
2025-11-29 11:53:18 +00:00
dhanabalan
1aa1937b39 Updated warning message against tube_sticker and pack_slip master data
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / review (pull_request) Failing after 29s
Laravel Pint / pint (pull_request) Successful in 2m16s
Laravel Larastan / larastan (pull_request) Failing after 3m17s
2025-11-29 17:20:07 +05:30
587b743f12 Merge pull request 'Clear process_order if plant not selected' (#24) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #24
2025-11-29 10:47:24 +00:00
dhanabalan
0812484926 Clear process_order if plant not selected
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 29s
Laravel Pint / pint (pull_request) Successful in 2m17s
Laravel Larastan / larastan (pull_request) Failing after 2m47s
2025-11-29 16:16:57 +05:30
42555d4a81 Merge pull request 'Added reactive validation for plant selection and duplicate checks for coil and SFG numbers in ProcessOrder form' (#23) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Reviewed-on: #23
2025-11-29 10:43:17 +00:00
dhanabalan
2d4700c9b2 Added reactive validation for plant selection and duplicate checks for coil and SFG numbers in ProcessOrder form
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 29s
Laravel Pint / pint (pull_request) Successful in 2m0s
Laravel Larastan / larastan (pull_request) Failing after 2m57s
2025-11-29 16:11:41 +05:30
fd1e554076 Merge pull request 'commented out machine ID validation logic in storeProcessOrderData method' (#22) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Reviewed-on: #22
2025-11-29 10:07:18 +00:00
dhanabalan
eb38f4ddcf commented out machine ID validation logic in storeProcessOrderData method
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 31s
Laravel Pint / pint (pull_request) Successful in 2m46s
Laravel Larastan / larastan (pull_request) Failing after 14m10s
2025-11-29 15:36:54 +05:30
022654f192 Merge pull request 'Updated get hasPumpQr status from pack_slip_pump if it does not exist in tube_sticker_pump' (#21) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Reviewed-on: #21
2025-11-29 09:00:31 +00:00
dhanabalan
faaaa88e8f Updated get hasPumpQr status from pack_slip_pump if it does not exist in tube_sticker_pump
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 31s
Laravel Pint / pint (pull_request) Successful in 3m37s
Laravel Larastan / larastan (pull_request) Failing after 7m56s
2025-11-29 14:29:52 +05:30
55f1088fda Merge pull request 'Updated sfg_number validations as optional and check duplcate only if it exist' (#20) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Reviewed-on: #20
2025-11-29 06:52:08 +00:00
dhanabalan
d6c7e43715 Updated sfg_number validations as optional and check duplcate only if it exist
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 21s
Laravel Pint / pint (pull_request) Successful in 2m48s
Laravel Larastan / larastan (pull_request) Failing after 4m30s
2025-11-29 12:21:17 +05:30
f9233f44d8 Merge pull request 'commented alert mail rules logic from boot method' (#19) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #19
2025-11-29 06:19:01 +00:00
dhanabalan
f45bb7b74b commented alert mail rules logic from boot method
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / review (pull_request) Failing after 25s
Laravel Pint / pint (pull_request) Successful in 2m18s
Laravel Larastan / larastan (pull_request) Failing after 2m46s
2025-11-29 11:45:37 +05:30
e0fec6b07c Merge pull request 'Added schedule method logic in app service provider' (#18) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Reviewed-on: #18
2025-11-29 05:35:04 +00:00
dhanabalan
80806d0f17 Added schedule method logic in app service provider
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / review (pull_request) Failing after 33s
Laravel Larastan / larastan (pull_request) Failing after 2m12s
Laravel Pint / pint (pull_request) Failing after 2m14s
2025-11-29 10:42:20 +05:30
6bda9c1459 Merge pull request 'Added LogClear command and Updated log message' (#17) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Reviewed-on: #17
2025-11-27 06:34:58 +00:00
dhanabalan
2b3db1cde1 feat: Add LogClear command to clear Laravel log files
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / review (pull_request) Failing after 27s
Laravel Larastan / larastan (pull_request) Failing after 2m1s
Laravel Pint / pint (pull_request) Failing after 2m25s
2025-11-27 11:55:21 +05:30
dhanabalan
bf1ae76334 Updated POST API log message
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
2025-11-27 11:53:50 +05:30
39bdd3df57 Merge pull request 'Updated report view logic' (#16) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Reviewed-on: #16
2025-11-27 05:41:34 +00:00
dhanabalan
01783c4fc7 Updated report view logic
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 20s
Laravel Larastan / larastan (pull_request) Failing after 1m59s
Laravel Pint / pint (pull_request) Failing after 2m18s
2025-11-27 11:07:04 +05:30
11 changed files with 1228 additions and 1305 deletions

View 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!');
}
}

View File

@@ -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()

View File

@@ -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()

View File

@@ -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'])

View File

@@ -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)

View File

@@ -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');
}
}

View File

@@ -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',
],
);
}

View File

@@ -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;
// }
// }
}
}

View File

@@ -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",

View File

@@ -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;
}
}
}
});