6 Commits

Author SHA1 Message Date
dhanabalan
9a73751e35 Refactored alignments and updated get_motor_master method
Some checks are pending
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Waiting to run
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
2026-03-24 16:18:07 +05:30
dhanabalan
3de43a9495 Updated warning message and added update has_work_flow_id on request approval creation
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-03-24 14:39:55 +05:30
dhanabalan
10081fd20e Removed plant select box in not in stock
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
2026-03-22 13:48:34 +05:30
dhanabalan
5d7b9d52f8 Added plant select box in not in stock for testing
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
2026-03-22 13:47:14 +05:30
dhanabalan
499fa0b2dd Changed dashboard logic as welcome page in dashboard page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
2026-03-22 09:31:00 +05:30
dhanabalan
27b5ad2cfe Updated laser cloud communication logics
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
2026-03-21 16:22:44 +05:30
7 changed files with 1661 additions and 675 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Filament\Pages;
use App\Filament\Widgets\CumulativeChart;
use App\Filament\Widgets\ProductionQuantityStat;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
@@ -9,6 +10,8 @@ use Filament\Pages\Dashboard\Concerns\HasFiltersForm;
use Filament\Tables\Filters\SelectFilter;
use Illuminate\Support\Facades\DB;
use App\Models\Plant;
use Filament\Facades\Filament;
use Filament\Forms\Components\DatePicker;
use Filament\Widgets\Widget;
use Illuminate\Support\Facades\Auth;
@@ -16,57 +19,108 @@ class Dashboard extends \Filament\Pages\Dashboard
{
use HasFiltersForm;
protected static ?string $navigationGroup = 'Production DashBoard';
protected static ?string $navigationIcon = 'heroicon-s-gift';
public function mount(): void
{
session()->forget(['selected_plant']);
$this->filtersForm->fill([
'plant' => null
]);
}
protected static string $view = 'filament.pages.dashboard';
public function filtersForm(Form $form): Form
{
return $form
->statePath('filters') // Store form state in 'filters'
->schema([
Select::make('plant')
->options(Plant::pluck('name', 'id'))
->label('Select Plant')
->reactive()
->afterStateUpdated(function ($state) {
session(['selected_plant' => $state]); // fixed typo
//$this->dispatch('cumulativeChart'); // custom Livewire event
}),
]);
// public function mount(): void
// {
// session()->forget(['selected_plant']);
// session()->forget(['from_date']);
// session()->forget(['to_date']);
// $this->filtersForm->fill([
// 'plant' => null,
// 'from_date' => null,
// 'to_date' => null,
// // 'success_status' => null
// ]);
// }
}
// public function filtersForm(Form $form): Form
// {
// return $form
// ->statePath('filters') // Store form state in 'filters'
// ->schema([
// Select::make('plant')
// ->label('Select Plant')
// ->reactive()
// // ->options(Plant::pluck('name', 'id'))
// ->options(function (callable $get) {
// $userHas = Filament::auth()->user()->plant_id;
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
// })
// ->afterStateUpdated(function ($state,callable $set) {
// session(['selected_plant' => $state]); // fixed typo
// //$this->dispatch('cumulativeChart'); // custom Livewire event
// // Reset success_status whenever plant changes
// $set('success_status', null);
// session()->forget('success_status');
// }),
// // Select::make('success_status')
// // ->label('Select Status')
// // ->options([
// // 'Ok' => 'Ok',
// // 'Not Ok' => 'Not Ok',
// // ])
// // ->reactive()
// // ->afterStateUpdated(function ($state) {
// // session(['success_status' => $state]);
// // }),
// DatePicker::make('created_from')
// ->label('Created From')
// ->reactive()
// ->afterStateUpdated(function ($state,callable $set) {
// session(['from_date' => $state]);
// }),
// DatePicker::make('created_to')
// ->label('Created To')
// ->reactive()
// ->afterStateUpdated(function ($state,callable $set) {
// session(['to_date' => $state]);
// }),
// ]);
// }
public static function getNavigationLabel(): string
{
return 'Production Line Count';
}
// public static function getNavigationLabel(): string
// {
// return 'Production Line Count';
// }
// public function getHeading(): string
// {
// return 'Production Line Count';
// }
// public function getWidgets(): array
// {
// $widgets = [];
// if (CumulativeChart::canView()) {
// $widgets[] = CumulativeChart::class;
// }
// return $widgets;
// }
// public static function canAccess(): bool
// {
// return Auth::check() && Auth::user()->can('view production line count dashboard');
// }
public function getHeading(): string
{
return 'Production Line Count';
return '';
}
public function getWidgets(): array
public static function getNavigationLabel(): string
{
$widgets = [];
if (CumulativeChart::canView()) {
$widgets[] = CumulativeChart::class;
}
return $widgets;
}
public static function canAccess(): bool
{
return Auth::check() && Auth::user()->can('view production line count dashboard');
return 'Welcome';
}
}

View File

@@ -1,23 +1,124 @@
<?php
namespace App\Filament\Pages;
use Filament\Pages\Page;
use App\Filament\Widgets\CumulativeChart;
use App\Filament\Widgets\ProductionQuantityStat;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Pages\Dashboard\Concerns\HasFiltersForm;
use Filament\Tables\Filters\SelectFilter;
use Illuminate\Support\Facades\DB;
use App\Models\Plant;
use Filament\Facades\Filament;
use Filament\Forms\Components\DatePicker;
use Filament\Widgets\Widget;
use Illuminate\Support\Facades\Auth;
use Filament\Pages\Page;
use Filament\Forms\Concerns\InteractsWithForms;
class Welcome extends Page
{
protected static ?string $navigationIcon = 'heroicon-s-gift'; // 'heroicon-o-document-text';
protected static string $view = 'filament.pages.welcome';
public function getHeading(): string
protected static ?string $navigationIcon = 'heroicon-o-document-text';
use HasFiltersForm;
use InteractsWithForms;
protected static ?string $navigationGroup = 'Production DashBoard';
protected static ?string $slug = 'production-line-count';
public function mount(): void
{
return '';
session()->forget(['selected_plant']);
// session()->forget(['from_date']);
// session()->forget(['to_date']);
$this->filtersForm->fill([
'plant' => null,
// 'from_date' => null,
// 'to_date' => null,
// 'success_status' => null
]);
}
// public static function canAccess(): bool
public function filtersForm(Form $form): Form
{
return $form
->statePath('filters')
->schema([
Select::make('plant')
->label('Select Plant')
->reactive()
// ->options(Plant::pluck('name', 'id'))
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
})
->afterStateUpdated(function ($state,callable $set) {
session(['selected_plant' => $state]);
//$this->dispatch('cumulativeChart'); // custom Livewire event
// Reset success_status whenever plant changes
// $set('success_status', null);
// session()->forget('success_status');
}),
// Select::make('success_status')
// ->label('Select Status')
// ->options([
// 'Ok' => 'Ok',
// 'Not Ok' => 'Not Ok',
// ])
// ->reactive()
// ->afterStateUpdated(function ($state) {
// session(['success_status' => $state]);
// }),
// DatePicker::make('created_from')
// ->label('Created From')
// ->reactive()
// ->afterStateUpdated(function ($state,callable $set) {
// session(['from_date' => $state]);
// }),
// DatePicker::make('created_to')
// ->label('Created To')
// ->reactive()
// ->afterStateUpdated(function ($state,callable $set) {
// session(['to_date' => $state]);
// }),
]);
}
public static function getNavigationLabel(): string
{
return 'Production Line Count';
}
public function getHeading(): string
{
return 'Production Line Count';
}
// public function getWidgets(): array
// {
// return Auth::check() && Auth::user()->can('view welcome page');
// $widgets = [];
// if (CumulativeChart::canView()) {
// $widgets[] = CumulativeChart::class;
// }
// return $widgets;
// }
public static function canAccess(): bool
{
return Auth::check() && Auth::user()->can('view production line count dashboard');
}
}

View File

@@ -2,6 +2,8 @@
namespace App\Filament\Resources;
use App\Filament\Exports\NotInStockExporter;
use App\Filament\Imports\NotInStockImporter;
use App\Filament\Resources\NotInStockResource\Pages;
use App\Models\NotInStock;
use App\Models\StickerMaster;
@@ -13,6 +15,9 @@ use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Tables\Actions\ExportAction;
use Filament\Tables\Actions\ImportAction;
class NotInStockResource extends Resource
{
@@ -232,6 +237,22 @@ class NotInStockResource extends Resource
Tables\Actions\ForceDeleteBulkAction::make(),
Tables\Actions\RestoreBulkAction::make(),
]),
])
->headerActions([
ImportAction::make()
->label('Import Not In Stock')
->color('warning')
->importer(NotInStockImporter::class)
->visible(function () {
return Filament::auth()->user()->can('view import not in stock');
}),
ExportAction::make()
->label('Export Not In Stock')
->color('warning')
->exporter(NotInStockExporter::class)
->visible(function () {
return Filament::auth()->user()->can('view export not in stock');
}),
]);
}
@@ -252,6 +273,7 @@ class NotInStockResource extends Resource
];
}
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()

File diff suppressed because it is too large Load Diff

View File

@@ -9,14 +9,7 @@ use App\Models\MotorTestingMaster;
use App\Models\Plant;
use App\Models\TestingPanelReading;
use App\Models\WorkGroupMaster;
use DB;
use Filament\Notifications\Notification;
use Illuminate\Http\Request;
use Mpdf\Mpdf;
use chillerlan\QRCode\QROptions;
use chillerlan\QRCode\Output\QROutputInterface;
use Mpdf\QrCode\Output;
use Mpdf\QrCode\QrCode;
use Str;
class TestingPanelController extends Controller
@@ -38,170 +31,148 @@ class TestingPanelController extends Controller
$expectedPw = env('API_AUTH_PW');
$header_auth = $request->header('Authorization');
$expectedToken = $expectedUser . ':' . $expectedPw;
$expectedToken = $expectedUser.':'.$expectedPw;
if ("Bearer " . $expectedToken != $header_auth)
{
if ('Bearer '.$expectedToken != $header_auth) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid authorization token!'
'status_description' => 'Invalid authorization token!',
], 403);
}
$data = $request->all();
if ($data['plant_code'] == null || $data['plant_code'] == '')
{
if ($data['plant_code'] == null || $data['plant_code'] == '') {
// return response("ERROR: Please provide a valid plant code.", 400)
// ->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Plant code can't be empty!"
'status_description' => "Plant code can't be empty!",
], 400);
}
else if (Str::length($data['plant_code']) < 4 || !is_numeric($data['plant_code']) || !preg_match('/^[1-9]\d{3,}$/', $data['plant_code']))//!ctype_digit($data['plant_code'])
{
} elseif (Str::length($data['plant_code']) < 4 || ! is_numeric($data['plant_code']) || ! preg_match('/^[1-9]\d{3,}$/', $data['plant_code'])) {// !ctype_digit($data['plant_code'])
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Invalid plant code found!"
'status_description' => 'Invalid plant code found!',
], 400);
}
$plant = Plant::where('code', $data['plant_code'])->first();
if (!$plant) {
//return response("Plant not found.", 400)->header('Content-Type', 'text/plain');
if (! $plant) {
// return response("Plant not found.", 400)->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Plant not found!'
'status_description' => 'Plant not found!',
], 400);
}
$plantId = $plant->id;
if ($data['line_name'] == null || $data['line_name'] == '')
{
if ($data['line_name'] == null || $data['line_name'] == '') {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Group work center can't be empty!"
'status_description' => "Group work center can't be empty!",
], 400);
}
else if (Str::length($data['line_name']) < 0)
{
} elseif (Str::length($data['line_name']) < 0) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Invalid group work center found!"
'status_description' => 'Invalid group work center found!',
], 400);
}
$gWorkCenter = WorkGroupMaster::where('name', $data['line_name'])->first();
if (!$gWorkCenter)
{
if (! $gWorkCenter) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Group work center not found!'
'status_description' => 'Group work center not found!',
], 400);
}
$gWorkCenter = WorkGroupMaster::where('name', $data['line_name'])->where('plant_id', $plantId)->first();
if (!$gWorkCenter)
{
//return response( "Line not found for the specified plant : {$data['plant_code']}",400)->header('Content-Type', 'text/plain');
if (! $gWorkCenter) {
// return response( "Line not found for the specified plant : {$data['plant_code']}",400)->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Group work center not found for the specified plant : '{$data['plant_code']}'!"
'status_description' => "Group work center not found for the specified plant : '{$data['plant_code']}'!",
], 400);
}
$gWorkCenterId = $gWorkCenter->id;
if ($data['machine_name'] == null || $data['machine_name'] == '')
{
if ($data['machine_name'] == null || $data['machine_name'] == '') {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Work center can't be empty!"
'status_description' => "Work center can't be empty!",
], 400);
}
else if (Str::length($data['machine_name']) < 0)
{
} elseif (Str::length($data['machine_name']) < 0) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Invalid work center found!"
'status_description' => 'Invalid work center found!',
], 400);
}
$machine = Machine::where('work_center', $data['machine_name'])->first();
if (!$machine)
{
if (! $machine) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Work center not found!'
'status_description' => 'Work center not found!',
], 400);
}
$machine = Machine::where('work_center', $data['machine_name'])->where('plant_id', $plantId)->first();
if (!$machine)
{
if (! $machine) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Work center not found for the specified plant : '{$data['plant_code']}'!"
'status_description' => "Work center not found for the specified plant : '{$data['plant_code']}'!",
], 400);
}
$machine = Machine::where('work_center', $data['machine_name'])->where('work_group_master_id', $gWorkCenterId)->first();
if (!$machine)
{
if (! $machine) {
// return response("Machine not found for the specified line : {$data['line_name']}", 400)->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Work center not found for the specified Group work center : '{$data['line_name']}'!"
'status_description' => "Work center not found for the specified Group work center : '{$data['line_name']}'!",
], 400);
}
$machine = Machine::where('work_center', $data['machine_name'])->where('plant_id', $plantId)->where('work_group_master_id', $gWorkCenterId)->first();
if (!$machine) {
if (! $machine) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Work center not found for the specified Plant : '{$data['plant_code']}' and Group work center : '{$data['line_name']}'!"
'status_description' => "Work center not found for the specified Plant : '{$data['plant_code']}' and Group work center : '{$data['line_name']}'!",
], 400);
}
$lineId = $machine->line_id;
$machineId = $machine->id;
try
{
try {
$insertedSerials = [];
$missedItemCodes = [];
$duplicateItemCodes = [];
$existSnoCount = [];
if (!empty($data['item_codes']) && is_array($data['item_codes']))
{
foreach ($data['item_codes'] as $item)
{
if (! empty($data['item_codes']) && is_array($data['item_codes'])) {
foreach ($data['item_codes'] as $item) {
$code = $item['item_code'] ?? null;
// Check if item_code is present
if ($code == '' || $code == null)
{
if ($code == '' || $code == null) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Item code can't be empty!"
'status_description' => "Item code can't be empty!",
], 400);
}
// Collect duplicates
if (isset($itemCodeCounts[$code]))
{
if (isset($itemCodeCounts[$code])) {
$itemCodeCounts[$code]++;
// Only add to duplicates array once
if ($itemCodeCounts[$code] == 2) {
$duplicateItemCodes[] = $code;
}
}
else
{
} else {
$itemCodeCounts[$code] = 1;
}
@@ -209,43 +180,41 @@ class TestingPanelController extends Controller
$query->where('code', $item['item_code']);
})->where('plant_id', $plantId)->first();
if (!$motorTestingMaster) {
if (! $motorTestingMaster) {
$missedItemCodes[] = $item['item_code'];
}
if (!empty($item['serial_numbers']) && is_array($item['serial_numbers'])) {
foreach ($item['serial_numbers'] as $serial)
{
if (! empty($item['serial_numbers']) && is_array($item['serial_numbers'])) {
foreach ($item['serial_numbers'] as $serial) {
$existSnoCount[] = $serial['serial_number'];
}
}
}
// If any duplicates found, return error
if (!empty($duplicateItemCodes)) {
if (! empty($duplicateItemCodes)) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Duplicate item codes found in request: ' . implode(', ', $duplicateItemCodes)
'status_description' => 'Duplicate item codes found in request: '.implode(', ', $duplicateItemCodes),
], 400);
}
$uniqueInvalidCodes = array_unique($missedItemCodes);
if (!empty($uniqueInvalidCodes)) {
if (! empty($uniqueInvalidCodes)) {
// return response("Item codes : ". implode(', ', $uniqueInvalidCodes)." not found in motor testing master for the specified plant {$plant->name}", 400)
// ->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Item codes : ". implode(', ', $uniqueInvalidCodes)." not found in master for the specified plant : '{$plant->name}'!"
'status_description' => 'Item codes : '.implode(', ', $uniqueInvalidCodes)." not found in master for the specified plant : '{$plant->name}'!",
], 400);
}
$insertedSnoCount = [];
foreach ($data['item_codes'] as $item)
{
foreach ($data['item_codes'] as $item) {
$motorTestingMaster = MotorTestingMaster::whereHas('item', callback: function ($query) use ($item) {
$query->where('code', $item['item_code']);
@@ -253,11 +222,9 @@ class TestingPanelController extends Controller
$motorTestingMasterId = $motorTestingMaster->id;
if (!empty($item['serial_numbers']) && is_array($item['serial_numbers']))
{
foreach ($item['serial_numbers'] as $serial)
{
//For update_count calculation
if (! empty($item['serial_numbers']) && is_array($item['serial_numbers'])) {
foreach ($item['serial_numbers'] as $serial) {
// For update_count calculation
$updateCount = [
'plant_id' => $plantId,
'line_id' => $lineId,
@@ -277,17 +244,17 @@ class TestingPanelController extends Controller
$maxLength = TestingPanelReading::where($updateCount)->selectRaw('MAX(LENGTH(update_count)) as max_length')->value('max_length');
// Then, get all records with that length
$lastUpdateCount = TestingPanelReading::where($updateCount)->whereRaw('LENGTH(update_count) = ?', [$maxLength])->orderByDesc('update_count')->select('update_count')->first();//->get();
$lastUpdateCount = TestingPanelReading::where($updateCount)->whereRaw('LENGTH(update_count) = ?', [$maxLength])->orderByDesc('update_count')->select('update_count')->first(); // ->get();
$newUpdateCount = ($lastUpdateCount == null || $lastUpdateCount == '') ? 0 : (int)$lastUpdateCount?->update_count + 1;//$maxUpdateCount?->update_count
$newUpdateCount = ($lastUpdateCount == null || $lastUpdateCount == '') ? 0 : (int) $lastUpdateCount?->update_count + 1; // $maxUpdateCount?->update_count
$updateCountString = (string)$newUpdateCount;
$updateCountString = (string) $newUpdateCount;
$row = [
'plant_id' => $plantId,
'line_id' => $lineId,
'machine_id' => $machineId,
'motor_testing_master_id'=> $motorTestingMasterId,
'motor_testing_master_id' => $motorTestingMasterId,
'serial_number' => $serial['serial_number'] ?? null,
'winded_serial_number' => $serial['winded_serial_number'] ?? null,
'output' => $serial['output'] ?? null,
@@ -346,32 +313,27 @@ class TestingPanelController extends Controller
}
}
if (!empty($insertedSerials))
{
if(count($existSnoCount) == count($insertedSnoCount))
{
if (! empty($insertedSerials)) {
if (count($existSnoCount) == count($insertedSnoCount)) {
// $messages[] = "Inserted serial numbers are: " . implode(', ', $insertedSerials);
return response()->json([
'status_code' => 'SUCCESS',
'status_description' => 'Inserted serial numbers are: ' . implode(', ', $insertedSerials)
'status_description' => 'Inserted serial numbers are: '.implode(', ', $insertedSerials),
], 200);
}
else
{
$missingSno = array_diff($existSnoCount,$insertedSnoCount);
} else {
$missingSno = array_diff($existSnoCount, $insertedSnoCount);
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Missed serial numbers are: " . implode(', ', $missingSno)
'status_description' => 'Missed serial numbers are: '.implode(', ', $missingSno),
], 400);
}
}
}
catch (\Exception $e)
{
} catch (\Exception $e) {
// return response($e->getMessage(), 500)->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Store testing panel readings internal server error : '.$e?->getCode()
'status_description' => 'Store testing panel readings internal server error : '.$e?->getCode(),
], 500);
}
}
@@ -384,14 +346,13 @@ class TestingPanelController extends Controller
$expectedUser = env('API_AUTH_USER');
$expectedPw = env('API_AUTH_PW');
$header_auth = $request->header('Authorization');
$expectedToken = $expectedUser . ':' . $expectedPw;
$expectedToken = $expectedUser.':'.$expectedPw;
//$data = $request->all();
if ("Bearer " . $expectedToken != $header_auth)
{
// $data = $request->all();
if ('Bearer '.$expectedToken != $header_auth) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid authorization token!'
'status_description' => 'Invalid authorization token!',
], 403);
}
@@ -399,45 +360,46 @@ class TestingPanelController extends Controller
$itemCode = $request->header('item-code');
// $description = $item ? $item->description : '';
if ($plantCode == null || $plantCode == '')
{
if ($plantCode == null || $plantCode == '') {
// return response("ERROR: Plant Name can't be empty", 400)
// ->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Plant code can't be empty!"
'status_description' => "Plant code can't be empty!",
], 400);
}
else if (Str::length($plantCode) < 4 || !is_numeric($plantCode) || !preg_match('/^[1-9]\d{3,}$/', $plantCode))
{
} elseif (Str::length($plantCode) < 4 || ! is_numeric($plantCode) || ! preg_match('/^[1-9]\d{3,}$/', $plantCode)) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Invalid plant code found!"
'status_description' => 'Invalid plant code found!',
], 400);
}
else if($itemCode == null || $itemCode == '')
{
// return response("ERROR: OBD Number can't be empty", 400)
// ->header('Content-Type', 'text/plain');
} elseif ($itemCode == null || $itemCode == '' || ! $itemCode) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Item Code can't be empty!"
], 400);
}
else if(Str::length($itemCode) < 6 || !ctype_alnum($itemCode))
{
'status_description' => "Item code can't be empty!",
], 404);
} elseif (Str::length($itemCode) < 6) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Invalid item code found!"
], 400);
'status_description' => "Item code '{$itemCode}' should contain minimum 6 digits!",
], 404);
} elseif (! ctype_alnum($itemCode)) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Item code '{$itemCode}' should contain only alpha-numeric values!",
], 404);
} elseif (! preg_match('/^[a-zA-Z1-9][a-zA-Z0-9]{5,}$/', $itemCode)) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Item code '{$itemCode}' should not begin with '0'!",
], 404);
}
$plant = Plant::where('code', $plantCode)->first();
if (!$plant) {
if (! $plant) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Plant not found!"
'status_description' => 'Plant not found!',
], 400);
}
@@ -445,72 +407,79 @@ class TestingPanelController extends Controller
$item = Item::where('code', $itemCode)->first();
if (!$item)
{
if (! $item) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Item Code not found in item table!"
'status_description' => 'Item code not found in item table!',
], 404);
}
$item = Item::where('plant_id', $plantId)->where('code', $itemCode)->first();
if (!$item)
{
if (! $item) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Item Code not found in item table for the plant : '$plant->name'!"
'status_description' => "Item code not found in item table for the plant : '$plant->name'!",
], 404);
}
// Get description or empty string if not found
$itemId = $item->id;
$description = $item ? $item->description : '';
$category = $item ? $item->category : '';
$motorTestingMaster = MotorTestingMaster::where('plant_id', $plantId)->where('item_id', $item->id)->first();
$motorTestingMaster = MotorTestingMaster::where('item_id', $itemId)->first();
if (!$motorTestingMaster)
{
if (! $motorTestingMaster) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Item Code not found in motor testing master table for the plant : '$plant->name'!"
'status_description' => 'Item code not found in motor testing master table!',
], 404);
}
$motorTestingMaster = MotorTestingMaster::where('plant_id', $plantId)->where('item_id', $itemId)->first();
if (! $motorTestingMaster) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Item code not found in motor testing master table for the plant : '$plant->name'!",
], 404);
}
$output = [
"mot_subassembly_code" => $motorTestingMaster->subassembly_code ?? "",
"mot_model_name" => $description,
"mot_non_isi_model" => $motorTestingMaster->isi_model ? "0" :"1",
"mot_phase" => $motorTestingMaster->phase ?? "",
"mot_hp" => $motorTestingMaster->hp ?? "",
"mot_kw" => $motorTestingMaster->kw ?? "",
"mot_volt" => $motorTestingMaster->volt ?? "",
"mot_cur" => $motorTestingMaster->current ?? "",
"mot_rpm" => $motorTestingMaster->rpm ?? "",
"mot_rate_torque_kg" => $motorTestingMaster->torque ?? "",
"mot_freq" => $motorTestingMaster->frequency ?? "",
"mot_conn" => $motorTestingMaster->connection ?? "",
"mot_ins_res_limit" => $motorTestingMaster->ins_res_limit ?? "",
"mot_ins_res_type" => $motorTestingMaster->ins_res_type ?? "",
"mot_category" => $category,
"mot_routine_test_time" => $motorTestingMaster->routine_test_time ?? "",
"mot_res_ry_ll" => $motorTestingMaster->res_ry_ll ?? "",
"mot_res_ry_ul" => $motorTestingMaster->res_ry_ul ?? "",
"mot_res_yb_ll" => $motorTestingMaster->res_yb_ll ?? "",
"mot_res_yb_ul" => $motorTestingMaster->res_yb_ul ?? "",
"mot_res_br_ll" => $motorTestingMaster->res_br_ll ?? "",
"mot_res_br_ul" => $motorTestingMaster->res_br_ul ?? "",
"mot_lock_volt_limit" => $motorTestingMaster->lock_volt_limit ?? "",
"mot_leak_cur_limit" => $motorTestingMaster->leak_cur_limit ?? "",
"mot_lock_cur_ll" => $motorTestingMaster->lock_cur_ll ?? "",
"mot_lock_cur_ul" => $motorTestingMaster->lock_cur_ul ?? "",
"mot_noload_cur_ll" => $motorTestingMaster->noload_cur_ll ?? "",
"mot_noload_cur_ul" => $motorTestingMaster->noload_cur_ul ?? "",
"mot_noload_pow_ll" => $motorTestingMaster->noload_pow_ll ?? "",
"mot_noload_pow_ul" => $motorTestingMaster->noload_pow_ul ?? "",
"mot_noload_spd_ll" => $motorTestingMaster->noload_spd_ll ?? "",
"mot_noload_spd_ul" => $motorTestingMaster->noload_spd_ul ?? ""
'mot_subassembly_code' => $motorTestingMaster->subassembly_code ?? '',
'mot_model_name' => ($itemCode == '123456') ? 'SAMPLE TYPE' : $description,
'mot_non_isi_model' => $motorTestingMaster->isi_model ? '0' : '1',
'mot_phase' => $motorTestingMaster->phase ?? '',
'mot_hp' => $motorTestingMaster->hp ?? '',
'mot_kw' => $motorTestingMaster->kw ?? '',
'mot_volt' => $motorTestingMaster->volt ?? '',
'mot_cur' => $motorTestingMaster->current ?? '',
'mot_rpm' => $motorTestingMaster->rpm ?? '',
'mot_rate_torque_kg' => $motorTestingMaster->torque ?? '',
'mot_freq' => $motorTestingMaster->frequency ?? '',
'mot_conn' => $motorTestingMaster->connection ?? '',
'mot_ins_res_limit' => $motorTestingMaster->ins_res_limit ?? '',
'mot_ins_res_type' => $motorTestingMaster->ins_res_type ?? '',
'mot_category' => $category,
'mot_routine_test_time' => $motorTestingMaster->routine_test_time ?? '',
'mot_res_ry_ll' => $motorTestingMaster->res_ry_ll ?? '',
'mot_res_ry_ul' => $motorTestingMaster->res_ry_ul ?? '',
'mot_res_yb_ll' => $motorTestingMaster->res_yb_ll ?? '',
'mot_res_yb_ul' => $motorTestingMaster->res_yb_ul ?? '',
'mot_res_br_ll' => $motorTestingMaster->res_br_ll ?? '',
'mot_res_br_ul' => $motorTestingMaster->res_br_ul ?? '',
'mot_lock_volt_limit' => $motorTestingMaster->lock_volt_limit ?? '',
'mot_leak_cur_limit' => $motorTestingMaster->leak_cur_limit ?? '',
'mot_lock_cur_ll' => $motorTestingMaster->lock_cur_ll ?? '',
'mot_lock_cur_ul' => $motorTestingMaster->lock_cur_ul ?? '',
'mot_noload_cur_ll' => $motorTestingMaster->noload_cur_ll ?? '',
'mot_noload_cur_ul' => $motorTestingMaster->noload_cur_ul ?? '',
'mot_noload_pow_ll' => $motorTestingMaster->noload_pow_ll ?? '',
'mot_noload_pow_ul' => $motorTestingMaster->noload_pow_ul ?? '',
'mot_noload_spd_ll' => $motorTestingMaster->noload_spd_ll ?? '',
'mot_noload_spd_ul' => $motorTestingMaster->noload_spd_ul ?? '',
];
return response()->json($output, 200);

View File

@@ -0,0 +1,126 @@
<x-filament-panels::page>
<!-- HEADER -->
<div class="mb-8">
<h1 class="text-4xl font-bold tracking-tight">
CRI Digital Manufacturing IIoT Platform
</h1>
<p class="text-lg text-gray-600 mt-2">
Complete visibility, traceability, and control across your manufacturing operations.
</p>
</div>
<!-- BANNER -->
{{-- <div class="w-full overflow-hidden rounded-2xl shadow mb-10"> --}}
<div class="w-full overflow-hidden rounded-xl shadow">
<img
src="{{ asset('images/iiot-banner.jpg') }}"
alt="CRI Digital Manufacturing IIoT"
class="w-full h-72 object-cover"
>
</div>
<!-- INTRO -->
<div class="max-w-4xl mb-10">
<p class="text-lg text-gray-700 mb-4">
CRI Digital Manufacturing IIoT is built to deliver
<strong>end-to-end traceability, real-time insights, and operational transparency</strong>
across plants, lines, and production processes.
</p>
<p class="text-lg text-gray-700">
The platform ensures <strong>right quality and on-time delivery</strong> by enabling
complete tracking of materials, production orders, and finished goods—helping teams
make faster, data-driven decisions with confidence.
</p>
</div>
<!-- KEY PILLARS -->
<div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-10">
<div class="bg-white rounded-xl border p-6 shadow-sm">
<h3 class="text-lg font-semibold mb-2">🔍 Traceability</h3>
<p class="text-gray-600">
Track materials, batches, and serials from input to dispatch.
</p>
</div>
<div class="bg-white rounded-xl border p-6 shadow-sm">
<h3 class="text-lg font-semibold mb-2"> Quality Assurance</h3>
<p class="text-gray-600">
Validate process data and ensure first-time-right production.
</p>
</div>
<div class="bg-white rounded-xl border p-6 shadow-sm">
<h3 class="text-lg font-semibold mb-2"> On-Time Delivery</h3>
<p class="text-gray-600">
Identify delays early and meet production commitments.
</p>
</div>
<div class="bg-white rounded-xl border p-6 shadow-sm">
<h3 class="text-lg font-semibold mb-2">📊 Real-Time Insights</h3>
<p class="text-gray-600">
Monitor performance and take quick corrective actions.
</p>
</div>
</div>
<!-- SUPPORT -->
<div class="bg-white rounded-xl border p-6 shadow-sm">
<h2 class="text-2xl font-semibold mb-3">24×7 Support</h2>
<p class="text-gray-700 mb-2">
Our dedicated IIoT support team is available round-the-clock to ensure
uninterrupted operations and quick issue resolution.
</p>
<p class="text-lg font-medium text-gray-900">
📞 Support Landline: <span class="font-semibold">0422 711 7179</span>
</p>
{{-- <p class="text-lg font-medium text-gray-900">
📞 Technical Support Contact: <span class="font-semibold">9952468104 / 9100832269</span>
</p> --}}
</div>
{{-- <div class="bg-white rounded-xl border p-6 shadow-sm">
<h2 class="text-2xl font-semibold mb-4">24×7 Support</h2>
<p class="text-lg text-gray-700 mb-4">
Our support structure is designed to ensure quick resolution based on the type
of issue whether it is on-site, application-related, or infrastructure-related.
</p>
<div class="space-y-3">
<p class="text-lg font-medium text-gray-900">
🏭 <strong>Plant & On-Site Support</strong> <br>
<span class="text-gray-700">
For plant visits, industry-level issues, and on-ground validation
</span><br>
📞 <span class="font-semibold">8925899458 / 8925899459</span>
</p>
<p class="text-lg font-medium text-gray-900">
💻 <strong>Application & Logic Support</strong> <br>
<span class="text-gray-700">
For website errors, logic issues, and application-level problems
</span><br>
📞 <span class="font-semibold">9952468104 / 9100832269</span>
</p>
</div>
</div> --}}
<!-- TEAM -->
{{-- <div class="bg-white rounded-xl border p-6 shadow-sm">
<h2 class="text-2xl font-semibold mb-4">IIOT Team Members</h2>
<div class="grid grid-cols-2 md:grid-cols-3 gap-4 text-gray-700">
<div class="flex items-center gap-2">👤 Jothikumar</div>
<div class="flex items-center gap-2">👤 Jeithef Shibu</div>
<div class="flex items-center gap-2">👤 Dhanabalan</div>
<div class="flex items-center gap-2">👤 Ranjith</div>
<div class="flex items-center gap-2">👤 Srimathy</div>
<div class="flex items-center gap-2">👤 Gokul</div>
</div>
</div> --}}
</x-filament-panels::page>

View File

@@ -1,126 +1,13 @@
<x-filament-panels::page>
<!-- HEADER -->
<div class="mb-8">
<h1 class="text-4xl font-bold tracking-tight">
CRI Digital Manufacturing IIoT Platform
</h1>
<p class="text-lg text-gray-600 mt-2">
Complete visibility, traceability, and control across your manufacturing operations.
</p>
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2 sm:gap-4 md:gap-4 p-2 md:p-4 items-start">
{{-- Filters form --}}
<div class="space-y-4 w-full max-w-full col-span-1">
{{ $this->filtersForm($this->form) }}
</div>
<!-- BANNER -->
{{-- <div class="w-full overflow-hidden rounded-2xl shadow mb-10"> --}}
<div class="w-full overflow-hidden rounded-xl shadow">
<img
src="{{ asset('images/iiot-banner.jpg') }}"
alt="CRI Digital Manufacturing IIoT"
class="w-full h-72 object-cover"
>
</div>
<!-- INTRO -->
<div class="max-w-4xl mb-10">
<p class="text-lg text-gray-700 mb-4">
CRI Digital Manufacturing IIoT is built to deliver
<strong>end-to-end traceability, real-time insights, and operational transparency</strong>
across plants, lines, and production processes.
</p>
<p class="text-lg text-gray-700">
The platform ensures <strong>right quality and on-time delivery</strong> by enabling
complete tracking of materials, production orders, and finished goods—helping teams
make faster, data-driven decisions with confidence.
</p>
</div>
<!-- KEY PILLARS -->
<div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-10">
<div class="bg-white rounded-xl border p-6 shadow-sm">
<h3 class="text-lg font-semibold mb-2">🔍 Traceability</h3>
<p class="text-gray-600">
Track materials, batches, and serials from input to dispatch.
</p>
</div>
<div class="bg-white rounded-xl border p-6 shadow-sm">
<h3 class="text-lg font-semibold mb-2"> Quality Assurance</h3>
<p class="text-gray-600">
Validate process data and ensure first-time-right production.
</p>
</div>
<div class="bg-white rounded-xl border p-6 shadow-sm">
<h3 class="text-lg font-semibold mb-2"> On-Time Delivery</h3>
<p class="text-gray-600">
Identify delays early and meet production commitments.
</p>
</div>
<div class="bg-white rounded-xl border p-6 shadow-sm">
<h3 class="text-lg font-semibold mb-2">📊 Real-Time Insights</h3>
<p class="text-gray-600">
Monitor performance and take quick corrective actions.
</p>
{{-- Stat widget --}}
<div class="w-full max-w-full col-span-1 sm:col-span-1 lg:col-span-2">
@livewire(\App\Filament\Widgets\CumulativeChart::class)
</div>
</div>
<!-- SUPPORT -->
<div class="bg-white rounded-xl border p-6 shadow-sm">
<h2 class="text-2xl font-semibold mb-3">24×7 Support</h2>
<p class="text-gray-700 mb-2">
Our dedicated IIoT support team is available round-the-clock to ensure
uninterrupted operations and quick issue resolution.
</p>
<p class="text-lg font-medium text-gray-900">
📞 Support Landline: <span class="font-semibold">0422 711 7179</span>
</p>
{{-- <p class="text-lg font-medium text-gray-900">
📞 Technical Support Contact: <span class="font-semibold">9952468104 / 9100832269</span>
</p> --}}
</div>
{{-- <div class="bg-white rounded-xl border p-6 shadow-sm">
<h2 class="text-2xl font-semibold mb-4">24×7 Support</h2>
<p class="text-lg text-gray-700 mb-4">
Our support structure is designed to ensure quick resolution based on the type
of issue whether it is on-site, application-related, or infrastructure-related.
</p>
<div class="space-y-3">
<p class="text-lg font-medium text-gray-900">
🏭 <strong>Plant & On-Site Support</strong> <br>
<span class="text-gray-700">
For plant visits, industry-level issues, and on-ground validation
</span><br>
📞 <span class="font-semibold">8925899458 / 8925899459</span>
</p>
<p class="text-lg font-medium text-gray-900">
💻 <strong>Application & Logic Support</strong> <br>
<span class="text-gray-700">
For website errors, logic issues, and application-level problems
</span><br>
📞 <span class="font-semibold">9952468104 / 9100832269</span>
</p>
</div>
</div> --}}
<!-- TEAM -->
{{-- <div class="bg-white rounded-xl border p-6 shadow-sm">
<h2 class="text-2xl font-semibold mb-4">IIOT Team Members</h2>
<div class="grid grid-cols-2 md:grid-cols-3 gap-4 text-gray-700">
<div class="flex items-center gap-2">👤 Jothikumar</div>
<div class="flex items-center gap-2">👤 Jeithef Shibu</div>
<div class="flex items-center gap-2">👤 Dhanabalan</div>
<div class="flex items-center gap-2">👤 Ranjith</div>
<div class="flex items-center gap-2">👤 Srimathy</div>
<div class="flex items-center gap-2">👤 Gokul</div>
</div>
</div> --}}
</x-filament-panels::page>