Compare commits
31 Commits
5bcf0703d9
...
renovate/l
| Author | SHA1 | Date | |
|---|---|---|---|
| 9404492762 | |||
| 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()
|
->alignCenter()
|
||||||
->searchable()
|
->searchable()
|
||||||
->dateTime()
|
->dateTime()
|
||||||
->sortable(),
|
->sortable()
|
||||||
// ->toggleable(isToggledHiddenByDefault: true),
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
Tables\Columns\TextColumn::make('updated_by')
|
Tables\Columns\TextColumn::make('updated_by')
|
||||||
->label('Updated By')
|
->label('Updated By')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->searchable()
|
->searchable()
|
||||||
->sortable(),
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
Tables\Columns\TextColumn::make('deleted_at')
|
Tables\Columns\TextColumn::make('deleted_at')
|
||||||
->label('Deleted At')
|
->label('Deleted At')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
|
|||||||
@@ -111,13 +111,14 @@ class InvoiceOutValidationResource extends Resource
|
|||||||
->dateTime()
|
->dateTime()
|
||||||
->searchable()
|
->searchable()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable()
|
||||||
// ->toggleable(isToggledHiddenByDefault: true),
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
Tables\Columns\TextColumn::make('updated_by')
|
Tables\Columns\TextColumn::make('updated_by')
|
||||||
->label('Updated By')
|
->label('Updated By')
|
||||||
->searchable()
|
->searchable()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
Tables\Columns\TextColumn::make('deleted_at')
|
Tables\Columns\TextColumn::make('deleted_at')
|
||||||
->dateTime()
|
->dateTime()
|
||||||
->alignCenter()
|
->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();
|
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(),
|
->required(),
|
||||||
Forms\Components\Select::make('item_id')
|
Forms\Components\Select::make('item_id')
|
||||||
->label('Item Code')
|
->label('Item Code')
|
||||||
@@ -108,10 +124,63 @@ class ProcessOrderResource extends Resource
|
|||||||
// ->readOnly(true),
|
// ->readOnly(true),
|
||||||
Forms\Components\TextInput::make('process_order')
|
Forms\Components\TextInput::make('process_order')
|
||||||
->label('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(),
|
->required(),
|
||||||
Forms\Components\TextInput::make('coil_number')
|
Forms\Components\TextInput::make('coil_number')
|
||||||
->label('Coil Number')
|
->label('Coil Number')
|
||||||
->default('0')
|
->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(),
|
->required(),
|
||||||
Forms\Components\TextInput::make('order_quantity')
|
Forms\Components\TextInput::make('order_quantity')
|
||||||
->label('Order Quantity')
|
->label('Order Quantity')
|
||||||
@@ -122,10 +191,38 @@ class ProcessOrderResource extends Resource
|
|||||||
->required(),
|
->required(),
|
||||||
Forms\Components\TextInput::make('sfg_number')
|
Forms\Components\TextInput::make('sfg_number')
|
||||||
->label('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')
|
Forms\Components\TextInput::make('machine_name')
|
||||||
->label('Machine ID')
|
->label('Machine ID'),
|
||||||
->required(),
|
|
||||||
Forms\Components\FileUpload::make('attachment')
|
Forms\Components\FileUpload::make('attachment')
|
||||||
->label('PDF Upload')
|
->label('PDF Upload')
|
||||||
->acceptedFileTypes(['application/pdf'])
|
->acceptedFileTypes(['application/pdf'])
|
||||||
|
|||||||
@@ -631,10 +631,11 @@ class PdfController extends Controller
|
|||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
Log::info('Process Order POST API called >>', ['request_data' => $request->all()]);
|
|
||||||
|
|
||||||
$plantCode = $request->header('plant-code');
|
$plantCode = $request->header('plant-code');
|
||||||
$processOrder = $request->header('process-order');
|
$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) {
|
if ($plantCode == null || $plantCode == '' || ! $plantCode) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
@@ -665,8 +666,6 @@ class PdfController extends Controller
|
|||||||
|
|
||||||
$plantId = $plant->id;
|
$plantId = $plant->id;
|
||||||
|
|
||||||
$data = $request->all();
|
|
||||||
|
|
||||||
$itemCode = $data['item_code'] ?? '';
|
$itemCode = $data['item_code'] ?? '';
|
||||||
$coilNo = $data['coil_number'] ?? '';
|
$coilNo = $data['coil_number'] ?? '';
|
||||||
$orderQty = $data['order_quantity'] ?? 0;
|
$orderQty = $data['order_quantity'] ?? 0;
|
||||||
@@ -714,19 +713,19 @@ class PdfController extends Controller
|
|||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sfgNo == null || $sfgNo == '' || ! $sfgNo) {
|
// if ($sfgNo == null || $sfgNo == '' || ! $sfgNo) {
|
||||||
return response()->json([
|
// return response()->json([
|
||||||
'status_code' => 'ERROR',
|
// 'status_code' => 'ERROR',
|
||||||
'status_description' => "SFG number can't be empty!",
|
// 'status_description' => "SFG number can't be empty!",
|
||||||
], 404);
|
// ], 404);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if ($machineId == null || $machineId == '' || ! $machineId) {
|
// if ($machineId == null || $machineId == '' || ! $machineId) {
|
||||||
return response()->json([
|
// return response()->json([
|
||||||
'status_code' => 'ERROR',
|
// 'status_code' => 'ERROR',
|
||||||
'status_description' => "Machine ID can't be empty!",
|
// 'status_description' => "Machine ID can't be empty!",
|
||||||
], 404);
|
// ], 404);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if ($createdBy == null || $createdBy == '' || ! $createdBy) {
|
if ($createdBy == null || $createdBy == '' || ! $createdBy) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
@@ -778,19 +777,23 @@ class PdfController extends Controller
|
|||||||
], 404);
|
], 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;
|
$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)
|
$existing = ProcessOrder::where('plant_id', $plantId)
|
||||||
->where('process_order', $processOrder)
|
->where('process_order', $processOrder)
|
||||||
->where('item_id', '!=', $itemId)
|
->where('item_id', '!=', $itemId)
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Livewire;
|
namespace App\Livewire;
|
||||||
|
|
||||||
use App\Filament\Resources\InvoiceValidationResource\Pages\CreateInvoiceValidation;
|
|
||||||
use App\Models\InvoiceValidation;
|
use App\Models\InvoiceValidation;
|
||||||
use App\Models\StickerMaster;
|
use App\Models\StickerMaster;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
@@ -34,14 +33,14 @@ class InvoiceDataTable extends Component
|
|||||||
|
|
||||||
public bool $showCapacitorInput = false;
|
public bool $showCapacitorInput = false;
|
||||||
|
|
||||||
// protected $listeners = ['refreshInvoiceData' => 'loadData',];
|
// protected $listeners = ['refreshInvoiceData' => 'loadData',];
|
||||||
|
|
||||||
protected $listeners = [
|
protected $listeners = [
|
||||||
'refreshCompletedInvoice' => 'loadCompletedData',
|
'refreshCompletedInvoice' => 'loadCompletedData',
|
||||||
'refreshEmptyInvoice' => 'loadEmptyData',
|
'refreshEmptyInvoice' => 'loadEmptyData',
|
||||||
'refreshInvoiceData' => 'loadData',
|
'refreshInvoiceData' => 'loadData',
|
||||||
'refreshMaterialInvoiceData' => 'loadMaterialData',
|
'refreshMaterialInvoiceData' => 'loadMaterialData',
|
||||||
'openCapacitorModal' => 'showCapacitorInputBox'
|
'openCapacitorModal' => 'showCapacitorInputBox',
|
||||||
];
|
];
|
||||||
|
|
||||||
public $capacitorInput = '';
|
public $capacitorInput = '';
|
||||||
@@ -96,101 +95,83 @@ class InvoiceDataTable extends Component
|
|||||||
$this->materialInvoice = false;
|
$this->materialInvoice = false;
|
||||||
// $this->showCapacitorInput = false;
|
// $this->showCapacitorInput = false;
|
||||||
|
|
||||||
//->where('serial_number', '!=', '')
|
// ->where('serial_number', '!=', '')
|
||||||
$this->invoiceData = InvoiceValidation::where('invoice_number', $this->invoiceNumber)
|
$this->invoiceData = InvoiceValidation::where('invoice_number', $this->invoiceNumber)
|
||||||
->where('plant_id', $plantId)->where('scanned_status', null)
|
->where('plant_id', $plantId)->where('scanned_status', null)
|
||||||
->get()
|
->get()
|
||||||
->map(function ($record) {
|
->map(function ($record) {
|
||||||
return [
|
return [
|
||||||
'sticker_master_id' => $record->sticker_master_id,
|
'sticker_master_id' => $record->sticker_master_id,
|
||||||
'serial_number' => $record->serial_number,
|
'serial_number' => $record->serial_number,
|
||||||
'motor_scanned_status' => $record->motor_scanned_status ?? '',
|
'motor_scanned_status' => $record->motor_scanned_status ?? '',
|
||||||
'pump_scanned_status' => $record->pump_scanned_status ?? '',
|
'pump_scanned_status' => $record->pump_scanned_status ?? '',
|
||||||
'capacitor_scanned_status' => $record->capacitor_scanned_status ?? '',
|
'capacitor_scanned_status' => $record->capacitor_scanned_status ?? '',
|
||||||
'scanned_status_set' => $record->scanned_status_set ?? '',
|
'scanned_status_set' => $record->scanned_status_set ?? '',
|
||||||
'scanned_status' => $record->scanned_status ?? '',
|
'scanned_status' => $record->scanned_status ?? '',
|
||||||
'panel_box_supplier' => $record->panel_box_supplier ?? '',
|
'panel_box_supplier' => $record->panel_box_supplier ?? '',
|
||||||
'panel_box_serial_number' => $record->panel_box_serial_number ?? '',
|
'panel_box_serial_number' => $record->panel_box_serial_number ?? '',
|
||||||
'created_at' => $record->created_at,
|
'created_at' => $record->created_at,
|
||||||
'operator_id' => $record->operator_id,
|
'operator_id' => $record->operator_id,
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
$this->packageCount = 0;
|
$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) {
|
foreach ($this->invoiceData as &$row) {
|
||||||
$stickCount = 0;
|
$stickCount = 0;
|
||||||
$scannedCount = 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';
|
$row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
|
||||||
$curStick = StickerMaster::where('id', $row['sticker_master_id'])->first();
|
$curStick = StickerMaster::where('id', $row['sticker_master_id'])->first();
|
||||||
if ($curStick)
|
if ($curStick) {
|
||||||
{
|
if (Str::length($curStick->panel_box_code) > 0) {
|
||||||
if ($curStick->tube_sticker_motor == 1 || $curStick->tube_sticker_pump == 1 || $curStick->tube_sticker_pumpset == 1 || Str::length($curStick->panel_box_code) > 0)
|
$stickCount++;
|
||||||
{
|
|
||||||
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++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if ($curStick->pack_slip_motor == 1 || $curStick->pack_slip_pump == 1 || $curStick->pack_slip_pumpset == 1)
|
if ($curStick->tube_sticker_motor == 1 || $curStick->tube_sticker_pump == 1 || $curStick->tube_sticker_pumpset == 1) {
|
||||||
{
|
if ($curStick->tube_sticker_motor == 1) {
|
||||||
if ($curStick->pack_slip_motor == 1)
|
|
||||||
{
|
|
||||||
$stickCount++;
|
$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++;
|
$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++;
|
$stickCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row['motor_scanned_status'] == 1)
|
if ($row['motor_scanned_status'] == 1) {
|
||||||
{
|
|
||||||
$scannedCount++;
|
$scannedCount++;
|
||||||
}
|
}
|
||||||
if ($row['pump_scanned_status'] == 1)
|
if ($row['pump_scanned_status'] == 1) {
|
||||||
{
|
|
||||||
$scannedCount++;
|
$scannedCount++;
|
||||||
}
|
}
|
||||||
if ($row['capacitor_scanned_status'] == 1)
|
if ($row['capacitor_scanned_status'] == 1) {
|
||||||
{
|
|
||||||
$scannedCount++;
|
$scannedCount++;
|
||||||
}
|
}
|
||||||
if ($row['scanned_status_set'] == 1)
|
if ($row['scanned_status_set'] == 1) {
|
||||||
{
|
|
||||||
$scannedCount++;
|
$scannedCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->packageCount += $stickCount - $scannedCount;
|
$this->packageCount += $stickCount - $scannedCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($onCapFocus)
|
if ($onCapFocus) {
|
||||||
{
|
|
||||||
$this->dispatch('focus-capacitor-input');
|
$this->dispatch('focus-capacitor-input');
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->dispatch('focus-serial-number');
|
$this->dispatch('focus-serial-number');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,43 +188,36 @@ class InvoiceDataTable extends Component
|
|||||||
$this->materialInvoice = true;
|
$this->materialInvoice = true;
|
||||||
// $this->showCapacitorInput = false;
|
// $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)
|
$this->invoiceData = InvoiceValidation::where('invoice_number', $this->invoiceNumber)->where('plant_id', $plantId)->where('serial_number', null)
|
||||||
->get()
|
->get()
|
||||||
->map(function ($record) {
|
->map(function ($record) {
|
||||||
return [
|
return [
|
||||||
'sticker_master_id' => $record->sticker_master_id,
|
'sticker_master_id' => $record->sticker_master_id,
|
||||||
// 'material_type' => StickerMaster::where('id', $record->sticker_master_id)->first()->material_type ?? '',
|
// 'material_type' => StickerMaster::where('id', $record->sticker_master_id)->first()->material_type ?? '',
|
||||||
'quantity' => $record->quantity ?? '',
|
'quantity' => $record->quantity ?? '',
|
||||||
'serial_number' => $record->serial_number ?? '',
|
'serial_number' => $record->serial_number ?? '',
|
||||||
'batch_number' => $record->batch_number ?? '',
|
'batch_number' => $record->batch_number ?? '',
|
||||||
'created_at' => $record->created_at,
|
'created_at' => $record->created_at,
|
||||||
'operator_id' => $record->operator_id,
|
'operator_id' => $record->operator_id,
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
->toArray();
|
->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) {
|
foreach ($this->invoiceData as &$row) {
|
||||||
// $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';
|
$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 ?? '';
|
$matType = StickerMaster::where('id', $row['sticker_master_id'] ?? null)->first()->material_type ?? '';
|
||||||
if ($matType === 1)
|
if ($matType === 1) {
|
||||||
{
|
|
||||||
$row['material_type'] = 'Individual';
|
$row['material_type'] = 'Individual';
|
||||||
}
|
} elseif ($matType === 2) {
|
||||||
else if ($matType === 2)
|
|
||||||
{
|
|
||||||
$row['material_type'] = 'Bundle';
|
$row['material_type'] = 'Bundle';
|
||||||
}
|
} elseif ($matType === 3) {
|
||||||
else if ($matType === 3)
|
|
||||||
{
|
|
||||||
$row['material_type'] = 'Quantity';
|
$row['material_type'] = 'Quantity';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$row['material_type'] = 'N/A';
|
$row['material_type'] = 'N/A';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->dispatch('focus-serial-number');
|
$this->dispatch('focus-serial-number');
|
||||||
}
|
}
|
||||||
@@ -275,11 +249,11 @@ class InvoiceDataTable extends Component
|
|||||||
$user = Filament::auth()->user();
|
$user = Filament::auth()->user();
|
||||||
$operatorName = $user->name;
|
$operatorName = $user->name;
|
||||||
|
|
||||||
if (!$this->capacitorInput) {
|
if (! $this->capacitorInput) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preg_match('/^[^\/]+\/[^\/]+\/.+$/', $this->capacitorInput)) {
|
if (! preg_match('/^[^\/]+\/[^\/]+\/.+$/', $this->capacitorInput)) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid Panel Box QR Format:')
|
->title('Invalid Panel Box QR Format:')
|
||||||
->body('Scan the valid panel box QR code to proceed!')
|
->body('Scan the valid panel box QR code to proceed!')
|
||||||
@@ -287,6 +261,7 @@ class InvoiceDataTable extends Component
|
|||||||
// ->duration(3000)
|
// ->duration(3000)
|
||||||
->seconds(2)
|
->seconds(2)
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
return;
|
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) {
|
$existsInStickerMaster = StickerMaster::where('panel_box_code', $itemCode)->where('plant_id', $this->plantId)->whereHas('item', function ($query) {
|
||||||
$query->where('code', $this->currentItemCode);
|
$query->where('code', $this->currentItemCode);
|
||||||
})
|
})
|
||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
if (!$existsInStickerMaster) {
|
if (! $existsInStickerMaster) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Unknown: Panel Box Code')
|
->title('Unknown: Panel Box Code')
|
||||||
->body("Unknown panel box code: $itemCode found for item code: $this->currentItemCode")
|
->body("Unknown panel box code: $itemCode found for item code: $this->currentItemCode")
|
||||||
@@ -309,12 +284,12 @@ class InvoiceDataTable extends Component
|
|||||||
->seconds(2)
|
->seconds(2)
|
||||||
->send();
|
->send();
|
||||||
$this->capacitorInput = '';
|
$this->capacitorInput = '';
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->invoiceData as &$row) {
|
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_supplier'] = $supplier;
|
||||||
$row['panel_box_item_code'] = $itemCode;
|
$row['panel_box_item_code'] = $itemCode;
|
||||||
$row['panel_box_serial_number'] = $serialNumber;
|
$row['panel_box_serial_number'] = $serialNumber;
|
||||||
@@ -343,47 +318,41 @@ class InvoiceDataTable extends Component
|
|||||||
$packCnt = 1;
|
$packCnt = 1;
|
||||||
$scanCnt = 1;
|
$scanCnt = 1;
|
||||||
// if ($hadMotorQr === $hasMotorQr && $hadPumpQr === $hasPumpQr && $hadPumpSetQr === $hasPumpSetQr)
|
// if ($hadMotorQr === $hasMotorQr && $hadPumpQr === $hasPumpQr && $hadPumpSetQr === $hasPumpSetQr)
|
||||||
if ($hasMotorQr || $hasPumpQr || $hasPumpSetQr)
|
if ($hasMotorQr || $hasPumpQr || $hasPumpSetQr) {
|
||||||
{
|
|
||||||
$packCnt = $hasMotorQr ? $packCnt + 1 : $packCnt;
|
$packCnt = $hasMotorQr ? $packCnt + 1 : $packCnt;
|
||||||
$packCnt = $hasPumpQr ? $packCnt + 1 : $packCnt;
|
$packCnt = $hasPumpQr ? $packCnt + 1 : $packCnt;
|
||||||
$packCnt = $hasPumpSetQr ? $packCnt + 1 : $packCnt;
|
$packCnt = $hasPumpSetQr ? $packCnt + 1 : $packCnt;
|
||||||
|
|
||||||
$scanCnt = $hadMotorQr ? $scanCnt + 1: $scanCnt;
|
$scanCnt = $hadMotorQr ? $scanCnt + 1 : $scanCnt;
|
||||||
$scanCnt = $hadPumpQr ? $scanCnt + 1: $scanCnt;
|
$scanCnt = $hadPumpQr ? $scanCnt + 1 : $scanCnt;
|
||||||
$scanCnt = $hadPumpSetQr ? $scanCnt + 1: $scanCnt;
|
$scanCnt = $hadPumpSetQr ? $scanCnt + 1 : $scanCnt;
|
||||||
|
|
||||||
if ($packCnt === $scanCnt)
|
if ($packCnt === $scanCnt) {
|
||||||
{
|
|
||||||
$matchingValidation->update([
|
$matchingValidation->update([
|
||||||
'panel_box_supplier' => $supplier,
|
'panel_box_supplier' => $supplier,
|
||||||
'panel_box_item_code' => $itemCode,
|
'panel_box_item_code' => $itemCode,
|
||||||
'panel_box_serial_number' => $serialNumber,
|
'panel_box_serial_number' => $serialNumber,
|
||||||
'capacitor_scanned_status' => 1,
|
'capacitor_scanned_status' => 1,
|
||||||
'scanned_status' => 'Scanned',
|
'scanned_status' => 'Scanned',
|
||||||
'operator_id'=> $operatorName,
|
'operator_id' => $operatorName,
|
||||||
]);
|
]);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$matchingValidation->update([
|
$matchingValidation->update([
|
||||||
'panel_box_supplier' => $supplier,
|
'panel_box_supplier' => $supplier,
|
||||||
'panel_box_item_code' => $itemCode,
|
'panel_box_item_code' => $itemCode,
|
||||||
'panel_box_serial_number' => $serialNumber,
|
'panel_box_serial_number' => $serialNumber,
|
||||||
'capacitor_scanned_status' => 1,
|
'capacitor_scanned_status' => 1,
|
||||||
'operator_id'=> $operatorName,
|
'operator_id' => $operatorName,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$matchingValidation->update([
|
$matchingValidation->update([
|
||||||
'panel_box_supplier' => $supplier,
|
'panel_box_supplier' => $supplier,
|
||||||
'panel_box_item_code' => $itemCode,
|
'panel_box_item_code' => $itemCode,
|
||||||
'panel_box_serial_number' => $serialNumber,
|
'panel_box_serial_number' => $serialNumber,
|
||||||
'capacitor_scanned_status' => 1,
|
'capacitor_scanned_status' => 1,
|
||||||
'scanned_status' => 'Scanned',
|
'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();
|
$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();
|
$scannedQuantity = InvoiceValidation::where('invoice_number', $matchingValidation->invoice_number)->where('plant_id', $this->plantId)->where('scanned_status', 'Scanned')->count();
|
||||||
// $this->form->fill([
|
// $this->form->fill([
|
||||||
// 'plant_id' => $matchingValidation->plant_id,
|
// 'plant_id' => $matchingValidation->plant_id,
|
||||||
// 'invoice_number' => $matchingValidation->invoice_number,
|
// 'invoice_number' => $matchingValidation->invoice_number,
|
||||||
// 'serial_number' => null,
|
// 'serial_number' => null,
|
||||||
// 'total_quantity' => $totalQuantity,
|
// 'total_quantity' => $totalQuantity,
|
||||||
// 'scanned_quantity'=> $scannedQuantity,
|
// 'scanned_quantity'=> $scannedQuantity,
|
||||||
// ]);
|
// ]);
|
||||||
|
|
||||||
if ($totalQuantity === $scannedQuantity)
|
if ($totalQuantity === $scannedQuantity) {
|
||||||
{
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Completed: Serial Invoice')
|
->title('Completed: Serial Invoice')
|
||||||
->body("Serial invoice '$matchingValidation->invoice_number' completed the scanning process.<br>Scan the next 'Serial Invoice' to proceed!")
|
->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)
|
->seconds(2)
|
||||||
->send();
|
->send();
|
||||||
$this->loadCompletedData($matchingValidation->invoice_number, $matchingValidation->plant_id, true);
|
$this->loadCompletedData($matchingValidation->invoice_number, $matchingValidation->plant_id, true);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->loadData($matchingValidation->invoice_number, $matchingValidation->plant_id, false);
|
$this->loadData($matchingValidation->invoice_number, $matchingValidation->plant_id, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -427,7 +393,7 @@ class InvoiceDataTable extends Component
|
|||||||
$this->showCapacitorInput = false;
|
$this->showCapacitorInput = false;
|
||||||
$this->capacitorInput = '';
|
$this->capacitorInput = '';
|
||||||
$this->dispatch('updateScannedQuantity');
|
$this->dispatch('updateScannedQuantity');
|
||||||
//$this->loadData($this->invoiceNumber, $this->plantId);
|
// $this->loadData($this->invoiceNumber, $this->plantId);
|
||||||
$this->dispatch('focus-serial-number');
|
$this->dispatch('focus-serial-number');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,5 +401,4 @@ class InvoiceDataTable extends Component
|
|||||||
{
|
{
|
||||||
return view('livewire.invoice-data-table');
|
return view('livewire.invoice-data-table');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
namespace App\Mail;
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use App\Models\InvoiceDataValidation;
|
||||||
|
use DateTime;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Mail\Mailable;
|
use Illuminate\Mail\Mailable;
|
||||||
use Illuminate\Mail\Mailables\Content;
|
use Illuminate\Mail\Mailables\Content;
|
||||||
use Illuminate\Mail\Mailables\Envelope;
|
use Illuminate\Mail\Mailables\Envelope;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use DateTime;
|
|
||||||
|
|
||||||
class InvoiceDataMail extends Mailable
|
class InvoiceDataMail extends Mailable
|
||||||
{
|
{
|
||||||
@@ -23,7 +23,7 @@ class InvoiceDataMail extends Mailable
|
|||||||
/**
|
/**
|
||||||
* Create a new message instance.
|
* Create a new message instance.
|
||||||
*/
|
*/
|
||||||
public function __construct($scheduleType, $tableData = [], $mailSubject)
|
public function __construct($scheduleType, $tableData, $mailSubject)
|
||||||
{
|
{
|
||||||
$this->scheduleType = $scheduleType;
|
$this->scheduleType = $scheduleType;
|
||||||
$this->tableData = $tableData ?? [];
|
$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"';
|
$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') {
|
if ($this->scheduleType == 'Daily') {
|
||||||
$firstRecord = \App\Models\InvoiceDataValidation::orderBy('document_date', 'asc')->first();
|
$firstRecord = InvoiceDataValidation::orderBy('document_date', 'asc')->first(); // 'desc'
|
||||||
//$lastRecord = \App\Models\InvoiceDataValidation::orderBy('document_date', 'desc')->first();
|
|
||||||
|
|
||||||
if ($firstRecord) {
|
$startDate = null;
|
||||||
|
if ($firstRecord && $firstRecord?->document_date != null && $firstRecord?->document_date != '') {
|
||||||
$startDate = \Carbon\Carbon::parse($firstRecord->document_date)->startOfDay();
|
$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);
|
$endDate = now()->setTime(10, 0, 0);
|
||||||
|
|
||||||
// $fromDate = (new DateTime('yesterday 10:00'))->format('d/m/Y H:i') . ':000';//08:00
|
// $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.";
|
$reportPeriod = "from: $startDate to $endDate\".<br><br>Please arrange to despatch the same immediately.";
|
||||||
$greeting .= $reportPeriod;
|
$greeting .= $reportPeriod;
|
||||||
}
|
}
|
||||||
@@ -74,17 +76,17 @@ class InvoiceDataMail extends Mailable
|
|||||||
if ($this->scheduleType == 'Live') {
|
if ($this->scheduleType == 'Live') {
|
||||||
$now = now();
|
$now = now();
|
||||||
$fromMinute = $now->copy()->subMinute()->format('d/m/Y H:i:s');
|
$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.";
|
$greeting .= "from: $fromMinute to $toMinute. <br><br>Please arrange to despatch the same immediately.";
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Content(
|
return new Content(
|
||||||
view: 'mail.invoice_data_report',
|
view: 'mail.invoice_data_report',
|
||||||
with: [
|
with: [
|
||||||
'company' => "CRI Digital Manufacturing Solutions",
|
'company' => 'CRI Digital Manufacturing Solutions',
|
||||||
'greeting' => $greeting,
|
'greeting' => $greeting,
|
||||||
'tableData' => $this->tableData,
|
'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;
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use App\Models\AlertMailRule;
|
||||||
use App\Models\User;
|
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 App\Policies\PermissionPolicy;
|
||||||
use Spatie\Permission\Models\Role;
|
use App\Policies\RolePolicy;
|
||||||
use Spatie\Permission\Models\Permission;
|
|
||||||
use Filament\Support\Facades\FilamentAsset;
|
|
||||||
use Filament\Support\Assets\Js;
|
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\View;
|
||||||
use Illuminate\Support\Facades\Vite;
|
use Illuminate\Support\Facades\Vite;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Spatie\Permission\Models\Permission;
|
||||||
|
use Spatie\Permission\Models\Role;
|
||||||
|
|
||||||
// use Doctrine\DBAL\Types\Type;
|
// use Doctrine\DBAL\Types\Type;
|
||||||
|
|
||||||
@@ -28,7 +28,6 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bootstrap any application services.
|
* Bootstrap any application services.
|
||||||
*/
|
*/
|
||||||
@@ -42,21 +41,21 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
// });
|
// });
|
||||||
|
|
||||||
Gate::before(function (User $user, string $ability) {
|
Gate::before(function (User $user, string $ability) {
|
||||||
return $user->isSuperAdmin() ? true: null;
|
return $user->isSuperAdmin() ? true : null;
|
||||||
});
|
});
|
||||||
|
|
||||||
// FilamentAsset::register([
|
// 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(),
|
||||||
// ]);
|
// ]);
|
||||||
FilamentAsset::register([
|
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');
|
// URL::forceScheme('https');
|
||||||
|
|
||||||
@@ -70,5 +69,82 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
ini_set('max_execution_time', 300); // 300 seconds = 5 minutes
|
ini_set('max_execution_time', 300); // 300 seconds = 5 minutes
|
||||||
ini_set('memory_limit', '512M'); // 512MB
|
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;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
"axios": "^1.7.4",
|
"axios": "^1.7.4",
|
||||||
"chartjs-plugin-datalabels": "^2.2.0",
|
"chartjs-plugin-datalabels": "^2.2.0",
|
||||||
"concurrently": "^9.0.1",
|
"concurrently": "^9.0.1",
|
||||||
"laravel-vite-plugin": "^1.2.0",
|
"laravel-vite-plugin": "^2.0.0",
|
||||||
"postcss": "^8.4.47",
|
"postcss": "^8.4.47",
|
||||||
"tailwindcss": "^3.4.13",
|
"tailwindcss": "^3.4.13",
|
||||||
"vite": "^6.0.11"
|
"vite": "^6.0.11"
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Models\AlertMailRule;
|
|
||||||
use Illuminate\Console\Scheduling\Schedule;
|
|
||||||
use Illuminate\Foundation\Inspiring;
|
use Illuminate\Foundation\Inspiring;
|
||||||
use Illuminate\Support\Facades\Artisan;
|
use Illuminate\Support\Facades\Artisan;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use App\Models\AlertMailRule;
|
||||||
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Artisan::command('inspire', function () {
|
Artisan::command('inspire', function () {
|
||||||
$this->comment(Inspiring::quote());
|
$this->comment(Inspiring::quote());
|
||||||
@@ -17,9 +18,6 @@ app()->booted(function () {
|
|||||||
$schedule = app(Schedule::class);
|
$schedule = app(Schedule::class);
|
||||||
|
|
||||||
// $schedule->command('report:send-daily-production')->dailyAt('07:59');
|
// $schedule->command('report:send-daily-production')->dailyAt('07:59');
|
||||||
|
|
||||||
if (Schema::hasTable('alert_mail_rules')) {
|
|
||||||
|
|
||||||
// Production report scheduling
|
// Production report scheduling
|
||||||
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
|
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
|
||||||
->where('rule_name', 'ProductionMail')
|
->where('rule_name', 'ProductionMail')
|
||||||
@@ -96,5 +94,4 @@ app()->booted(function () {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user