Compare commits
33 Commits
68060fe5fc
...
df6b5af920
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df6b5af920 | ||
|
|
26c76eb539 | ||
|
|
84ac80a18a | ||
|
|
c826a0da3d | ||
|
|
c60a78d85a | ||
|
|
5b450adbda | ||
|
|
8ebf76f91c | ||
|
|
21d70380a8 | ||
|
|
f3ffe4bff6 | ||
|
|
64af4215aa | ||
|
|
c2c91e1427 | ||
|
|
fd8f82c3b1 | ||
|
|
2bd69214d6 | ||
|
|
58f98c7632 | ||
|
|
ce80f8e7e5 | ||
|
|
37d6c174c3 | ||
|
|
7757347407 | ||
|
|
2b02e01cca | ||
|
|
390740bbd0 | ||
|
|
561c2d7bf2 | ||
|
|
9b1a0d5b58 | ||
|
|
580ca9d569 | ||
|
|
ad06e0d4d2 | ||
|
|
e3c651d22b | ||
|
|
75212ea2b1 | ||
|
|
670b47bc31 | ||
|
|
03cbd6f877 | ||
|
|
7bf910c800 | ||
|
|
bbdd05bed0 | ||
|
|
3ec4cd3c3b | ||
|
|
79ff0b10a7 | ||
|
|
2c90676f62 | ||
|
|
46eaa273c3 |
51
app/Filament/Exports/BlockExporter.php
Normal file
51
app/Filament/Exports/BlockExporter.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\Block;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class BlockExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = Block::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
// ExportColumn::make('id')
|
||||
// ->label('ID'),
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('name')
|
||||
->label('NAME'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your block export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
49
app/Filament/Exports/CompanyExporter.php
Normal file
49
app/Filament/Exports/CompanyExporter.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\Company;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class CompanyExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = Company::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
// ExportColumn::make('id')
|
||||
// ->label('ID'),
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('name')
|
||||
->label('NAME'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your company export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
@@ -13,9 +13,17 @@ class InvoiceValidationExporter extends Exporter
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('id')
|
||||
->label('ID'),
|
||||
// ExportColumn::make('id')
|
||||
// ->label('ID'),
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('invoice_number')
|
||||
|
||||
@@ -13,9 +13,17 @@ class ItemExporter extends Exporter
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('id')
|
||||
->label('ID'),
|
||||
// ExportColumn::make('id')
|
||||
// ->label('ID'),
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('code')
|
||||
->label('CODE'),
|
||||
ExportColumn::make('description')
|
||||
|
||||
51
app/Filament/Exports/LineStopExporter.php
Normal file
51
app/Filament/Exports/LineStopExporter.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\LineStop;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class LineStopExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = LineStop::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
// ExportColumn::make('id')
|
||||
// ->label('ID'),
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('code')
|
||||
->label('LINE STOP CODE'),
|
||||
ExportColumn::make('reason')
|
||||
->label('LINE STOP REASON'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your line stop export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
67
app/Filament/Exports/MotorTestingMasterExporter.php
Normal file
67
app/Filament/Exports/MotorTestingMasterExporter.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\MotorTestingMaster;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class MotorTestingMasterExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = MotorTestingMaster::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ExportColumn::make('id')
|
||||
->label('ID'),
|
||||
ExportColumn::make('plant.name'),
|
||||
ExportColumn::make('item.id'),
|
||||
ExportColumn::make('isi_model'),
|
||||
ExportColumn::make('phase'),
|
||||
ExportColumn::make('hp'),
|
||||
ExportColumn::make('kw'),
|
||||
ExportColumn::make('volt'),
|
||||
ExportColumn::make('current'),
|
||||
ExportColumn::make('rpm'),
|
||||
ExportColumn::make('torque'),
|
||||
ExportColumn::make('frequency'),
|
||||
ExportColumn::make('connection'),
|
||||
ExportColumn::make('ins_res_limit'),
|
||||
ExportColumn::make('ins_res_type'),
|
||||
ExportColumn::make('res_ry_ll'),
|
||||
ExportColumn::make('res_ry_ul'),
|
||||
ExportColumn::make('res_yb_ll'),
|
||||
ExportColumn::make('res_yb_ul'),
|
||||
ExportColumn::make('res_br_ll'),
|
||||
ExportColumn::make('res_br_ul'),
|
||||
ExportColumn::make('lock_volt_limit'),
|
||||
ExportColumn::make('leak_cur_limit'),
|
||||
ExportColumn::make('lock_cur_ll'),
|
||||
ExportColumn::make('lock_cur_ul'),
|
||||
ExportColumn::make('noload_cur_ll'),
|
||||
ExportColumn::make('noload_cur_ul'),
|
||||
ExportColumn::make('noload_pow_ll'),
|
||||
ExportColumn::make('noload_pow_ul'),
|
||||
ExportColumn::make('noload_spd_ll'),
|
||||
ExportColumn::make('noload_spd_ul'),
|
||||
ExportColumn::make('created_at'),
|
||||
ExportColumn::make('updated_at'),
|
||||
ExportColumn::make('deleted_at'),
|
||||
ExportColumn::make('created_by'),
|
||||
ExportColumn::make('updated_by'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your motor testing master export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
55
app/Filament/Exports/PlantExporter.php
Normal file
55
app/Filament/Exports/PlantExporter.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\Plant;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class PlantExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = Plant::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
// ExportColumn::make('id')
|
||||
// ->label('ID'),
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('company.name')
|
||||
->label('COMPANY'),
|
||||
ExportColumn::make('code')
|
||||
->label('CODE'),
|
||||
ExportColumn::make('name')
|
||||
->label('NAME'),
|
||||
ExportColumn::make('address')
|
||||
->label('ADDRESS'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your plant export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
@@ -13,9 +13,17 @@ class ProductionLineStopExporter extends Exporter
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('id')
|
||||
->label('ID'),
|
||||
// ExportColumn::make('id')
|
||||
// ->label('ID'),
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('linestop.code')
|
||||
->label('CODE'),
|
||||
ExportColumn::make('linestop.reason')
|
||||
|
||||
@@ -13,9 +13,17 @@ class ProductionPlanExporter extends Exporter
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('id')
|
||||
->label('ID'),
|
||||
// ExportColumn::make('id')
|
||||
// ->label('ID'),
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plan_quantity')
|
||||
->label('PLAN QUANTITY'),
|
||||
ExportColumn::make('production_quantity')
|
||||
|
||||
@@ -13,9 +13,17 @@ class ProductionQuantityExporter extends Exporter
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('id')
|
||||
->label('ID'),
|
||||
// ExportColumn::make('id')
|
||||
// ->label('ID'),
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('production_order')
|
||||
->label('PRODUCTION ORDER'),
|
||||
ExportColumn::make('serial_number')
|
||||
|
||||
61
app/Filament/Exports/ShiftExporter.php
Normal file
61
app/Filament/Exports/ShiftExporter.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\Shift;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class ShiftExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = Shift::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
// ExportColumn::make('id')
|
||||
// ->label('ID'),
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('block.name')
|
||||
->label('BLOCK'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('name')
|
||||
->label('NAME'),
|
||||
ExportColumn::make('start_time')
|
||||
->label('START TIME'),
|
||||
ExportColumn::make('duration')
|
||||
->label('DURATION'),
|
||||
ExportColumn::make('end_time')
|
||||
->label('END TIME'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('status')
|
||||
->label('STATUS'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your shift export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
@@ -13,13 +13,21 @@ class StickerMasterExporter extends Exporter
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
// ExportColumn::make('id')
|
||||
// ->label('ID'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('serial_number_motor')
|
||||
->label('SERIAL NUMBER MOTOR'),
|
||||
ExportColumn::make('serial_number_pump')
|
||||
|
||||
85
app/Filament/Exports/TestingPanelReadingExporter.php
Normal file
85
app/Filament/Exports/TestingPanelReadingExporter.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\TestingPanelReading;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class TestingPanelReadingExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = TestingPanelReading::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ExportColumn::make('id')
|
||||
->label('ID'),
|
||||
ExportColumn::make('plant.name'),
|
||||
ExportColumn::make('line.name'),
|
||||
ExportColumn::make('item.id'),
|
||||
ExportColumn::make('machine.name'),
|
||||
ExportColumn::make('output'),
|
||||
ExportColumn::make('serial_number'),
|
||||
ExportColumn::make('before_fr_volt'),
|
||||
ExportColumn::make('before_fr_cur'),
|
||||
ExportColumn::make('before_fr_pow'),
|
||||
ExportColumn::make('before_fr_res_ry'),
|
||||
ExportColumn::make('before_fr_res_yb'),
|
||||
ExportColumn::make('before_fr_res_br'),
|
||||
ExportColumn::make('before_fr_ir'),
|
||||
ExportColumn::make('before_fr_ir_r'),
|
||||
ExportColumn::make('before_fr_ir_y'),
|
||||
ExportColumn::make('before_fr_ir_b'),
|
||||
ExportColumn::make('before_fr_freq'),
|
||||
ExportColumn::make('before_fr_speed'),
|
||||
ExportColumn::make('after_fr_vol'),
|
||||
ExportColumn::make('after_fr_cur'),
|
||||
ExportColumn::make('after_fr_pow'),
|
||||
ExportColumn::make('after_fr_ir_hot'),
|
||||
ExportColumn::make('after_fr_ir_hot_r'),
|
||||
ExportColumn::make('after_fr_ir_hot_y'),
|
||||
ExportColumn::make('after_fr_ir_hot_b'),
|
||||
ExportColumn::make('after_fr_ir_cool'),
|
||||
ExportColumn::make('after_fr_ir_cool_r'),
|
||||
ExportColumn::make('after_fr_ir_cool_y'),
|
||||
ExportColumn::make('after_fr_ir_cool_b'),
|
||||
ExportColumn::make('after_fr_freq'),
|
||||
ExportColumn::make('after_fr_speed'),
|
||||
ExportColumn::make('after_fr_leak_cur'),
|
||||
ExportColumn::make('locked_rt_volt'),
|
||||
ExportColumn::make('locked_rt_cur'),
|
||||
ExportColumn::make('locked_rt_pow'),
|
||||
ExportColumn::make('no_load_pickup_volt'),
|
||||
ExportColumn::make('room_temperature'),
|
||||
ExportColumn::make('hv_test'),
|
||||
ExportColumn::make('batch_number'),
|
||||
ExportColumn::make('batch_count'),
|
||||
ExportColumn::make('result'),
|
||||
ExportColumn::make('remark'),
|
||||
ExportColumn::make('rework_count'),
|
||||
ExportColumn::make('update_count'),
|
||||
ExportColumn::make('output_flag'),
|
||||
ExportColumn::make('pds_status'),
|
||||
ExportColumn::make('pds_description'),
|
||||
ExportColumn::make('tested_by'),
|
||||
ExportColumn::make('updated_by'),
|
||||
ExportColumn::make('created_at'),
|
||||
ExportColumn::make('updated_at'),
|
||||
ExportColumn::make('scanned_at'),
|
||||
ExportColumn::make('deleted_at'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your testing panel reading export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
235
app/Filament/Imports/MotorTestingMasterImporter.php
Normal file
235
app/Filament/Imports/MotorTestingMasterImporter.php
Normal file
@@ -0,0 +1,235 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\MotorTestingMaster;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
use Filament\Facades\Filament;
|
||||
|
||||
class MotorTestingMasterImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = MotorTestingMaster::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant')
|
||||
->example(['Ransar Industries-I','Ransar Industries-I','Ransar Industries-I'])
|
||||
->label('Plant')
|
||||
->relationship(resolveUsing: 'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('item')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Item Code')
|
||||
->example(['123456','123456','123456'])
|
||||
->label('Item Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('isi_model')
|
||||
->boolean()
|
||||
->exampleHeader('ISI Model')
|
||||
->example(['Y','N','Y'])
|
||||
->label('ISI Model')
|
||||
->rules(['boolean']),
|
||||
ImportColumn::make('phase')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Phase')
|
||||
->example(['Single','Three','Single'])
|
||||
->label('Phase')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('hp')
|
||||
->requiredMapping()
|
||||
->exampleHeader('HP')
|
||||
->example(['5','10','5'])
|
||||
->label('HP')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('kw')
|
||||
->requiredMapping()
|
||||
->exampleHeader('KW')
|
||||
->example(['5','7.5','5'])
|
||||
->label('KW')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('volt')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Volt')
|
||||
->example(['230','380','230'])
|
||||
->label('Volt')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('current')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Current')
|
||||
->example(['7','21.8','7'])
|
||||
->label('Current')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('rpm')
|
||||
->requiredMapping()
|
||||
->exampleHeader('RPM')
|
||||
->example(['2500','3420','2500'])
|
||||
->label('RPM')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('torque')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Torque')
|
||||
->example(['0.5','1.25','0.5'])
|
||||
->label('Torque')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('frequency')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Frequency')
|
||||
->label('Frequency')
|
||||
->example(['50','60','50'])
|
||||
->rules(['required']),
|
||||
ImportColumn::make('connection')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Connection')
|
||||
->label('Connection')
|
||||
->example(['Star','Star-Delta','Delta'])
|
||||
->rules(['required']),
|
||||
ImportColumn::make('ins_res_limit')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Insulation Resistance Limit')
|
||||
->label('Insulation Resistance Limit')
|
||||
->example(['1000','2','1000'])
|
||||
->rules(['required']),
|
||||
ImportColumn::make('ins_res_type')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Insulation Resistance Type')
|
||||
->label('Insulation Resistance Type')
|
||||
->example(['O','G','O'])
|
||||
->rules(['required']),
|
||||
ImportColumn::make('res_ry_ll')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Resistance RY LL')
|
||||
->label('Resistance RY LL')
|
||||
->example(['0.05','0.05','0.05'])
|
||||
->rules(['required']),
|
||||
ImportColumn::make('res_ry_ul')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Resistance RY UL')
|
||||
->label('Resistance RY UL')
|
||||
->example(['99','99','99'])
|
||||
->rules(['required']),
|
||||
ImportColumn::make('res_yb_ll')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Resistance YB LL')
|
||||
->label('Resistance YB LL')
|
||||
->example(['0.05','0.05','0.05'])
|
||||
->rules(['required']),
|
||||
ImportColumn::make('res_yb_ul')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Resistance YB UL')
|
||||
->label('Resistance YB UL')
|
||||
->example(['99','99','99'])
|
||||
->rules(['required']),
|
||||
ImportColumn::make('res_br_ll')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Resistance BR LL')
|
||||
->label('Resistance BR LL')
|
||||
->example(['0.05','0.05','0.05'])
|
||||
->rules(['required']),
|
||||
ImportColumn::make('res_br_ul')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Resistance BR UL')
|
||||
->label('Resistance BR UL')
|
||||
->example(['99','99','99'])
|
||||
->rules(['required']),
|
||||
ImportColumn::make('lock_volt_limit')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Lock Volt Limit')
|
||||
->label('Lock Volt Limit')
|
||||
->example(['80','100','80'])
|
||||
->rules(['required']),
|
||||
ImportColumn::make('leak_cur_limit')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Leakage Current Limit')
|
||||
->label('Leakage Current Limit')
|
||||
->example(['50','50','50'])
|
||||
->rules(['required']),
|
||||
ImportColumn::make('lock_cur_ll')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Lock Current LL')
|
||||
->label('Lock Current LL')
|
||||
->example(['10','12.5','10'])
|
||||
->rules(['required']),
|
||||
ImportColumn::make('lock_cur_ul')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Lock Current UL')
|
||||
->label('Lock Current UL')
|
||||
->example(['15','14.6','15'])
|
||||
->rules(['required']),
|
||||
ImportColumn::make('noload_cur_ll')
|
||||
->requiredMapping()
|
||||
->exampleHeader('No Load Current LL')
|
||||
->label('No Load Current LL')
|
||||
->example(['3','5.9','3'])
|
||||
->rules(['required']),
|
||||
ImportColumn::make('noload_cur_ul')
|
||||
->requiredMapping()
|
||||
->exampleHeader('No Load Current UL')
|
||||
->label('No Load Current UL')
|
||||
->example(['15','6.9','15'])
|
||||
->rules(['required']),
|
||||
ImportColumn::make('noload_pow_ll')
|
||||
->requiredMapping()
|
||||
->exampleHeader('No Load Power LL')
|
||||
->label('No Load Power LL')
|
||||
->example(['250','850','250'])
|
||||
->rules(['required']),
|
||||
ImportColumn::make('noload_pow_ul')
|
||||
->requiredMapping()
|
||||
->exampleHeader('No Load Power UL')
|
||||
->label('No Load Power UL')
|
||||
->example(['500','1200','500'])
|
||||
->rules(['required']),
|
||||
ImportColumn::make('noload_spd_ll')
|
||||
->requiredMapping()
|
||||
->exampleHeader('No Load Speed LL')
|
||||
->label('No Load Speed LL')
|
||||
->example(['2000','2500','2000'])
|
||||
->rules(['required']),
|
||||
ImportColumn::make('noload_spd_ul')
|
||||
->requiredMapping()
|
||||
->exampleHeader('No Load Speed UL')
|
||||
->label('No Load Speed UL')
|
||||
->example(['4000','3500','4000'])
|
||||
->rules(['required']),
|
||||
ImportColumn::make('created_by')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Created By')
|
||||
->example([Filament::auth()->user()->name, Filament::auth()->user()->name, Filament::auth()->user()->name])
|
||||
->label('Created By')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('updated_by')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Updated By')
|
||||
->example([Filament::auth()->user()->name, Filament::auth()->user()->name, Filament::auth()->user()->name])
|
||||
->label('Updated By')
|
||||
->rules(['required']),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?MotorTestingMaster
|
||||
{
|
||||
// return MotorTestingMaster::firstOrNew([
|
||||
// // Update existing records, matching them by `$this->data['column_name']`
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new MotorTestingMaster();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your motor testing master import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
||||
|
||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
@@ -121,7 +121,7 @@ class ProductionQuantityImporter extends Importer
|
||||
$warnMsg[] = "Shift not found";
|
||||
}
|
||||
$item = null;
|
||||
if (!$plant) {
|
||||
if ($plant) {
|
||||
$item = Item::where('code', $this->data['item'])->where('plant_id', $plant->id)->first();
|
||||
}
|
||||
if (!$item) {
|
||||
|
||||
@@ -187,7 +187,10 @@ class StickerMasterImporter extends Importer
|
||||
if (!$plant) {
|
||||
$warnMsg[] = "Plant not found";
|
||||
}
|
||||
$item = Item::where('code', $this->data['item'])->where('plant_id', $plant->id)->first();
|
||||
$item = null;
|
||||
if ($plant) {
|
||||
$item = Item::where('code', $this->data['item'])->where('plant_id', $plant->id)->first();
|
||||
}
|
||||
if (!$item) {
|
||||
$warnMsg[] = "Item code not found";
|
||||
}
|
||||
|
||||
116
app/Filament/Imports/TestingPanelReadingImporter.php
Normal file
116
app/Filament/Imports/TestingPanelReadingImporter.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\TestingPanelReading;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
|
||||
class TestingPanelReadingImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = TestingPanelReading::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('line')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('item')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('machine')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('output')
|
||||
->requiredMapping()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('serial_number')
|
||||
->requiredMapping()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('before_fr_volt'),
|
||||
ImportColumn::make('before_fr_cur'),
|
||||
ImportColumn::make('before_fr_pow'),
|
||||
ImportColumn::make('before_fr_res_ry'),
|
||||
ImportColumn::make('before_fr_res_yb'),
|
||||
ImportColumn::make('before_fr_res_br'),
|
||||
ImportColumn::make('before_fr_ir'),
|
||||
ImportColumn::make('before_fr_ir_r'),
|
||||
ImportColumn::make('before_fr_ir_y'),
|
||||
ImportColumn::make('before_fr_ir_b'),
|
||||
ImportColumn::make('before_fr_freq'),
|
||||
ImportColumn::make('before_fr_speed'),
|
||||
ImportColumn::make('after_fr_vol'),
|
||||
ImportColumn::make('after_fr_cur'),
|
||||
ImportColumn::make('after_fr_pow'),
|
||||
ImportColumn::make('after_fr_ir_hot'),
|
||||
ImportColumn::make('after_fr_ir_hot_r'),
|
||||
ImportColumn::make('after_fr_ir_hot_y'),
|
||||
ImportColumn::make('after_fr_ir_hot_b'),
|
||||
ImportColumn::make('after_fr_ir_cool'),
|
||||
ImportColumn::make('after_fr_ir_cool_r'),
|
||||
ImportColumn::make('after_fr_ir_cool_y'),
|
||||
ImportColumn::make('after_fr_ir_cool_b'),
|
||||
ImportColumn::make('after_fr_freq'),
|
||||
ImportColumn::make('after_fr_speed'),
|
||||
ImportColumn::make('after_fr_leak_cur'),
|
||||
ImportColumn::make('locked_rt_volt'),
|
||||
ImportColumn::make('locked_rt_cur'),
|
||||
ImportColumn::make('locked_rt_pow'),
|
||||
ImportColumn::make('no_load_pickup_volt'),
|
||||
ImportColumn::make('room_temperature'),
|
||||
ImportColumn::make('hv_test'),
|
||||
ImportColumn::make('batch_number'),
|
||||
ImportColumn::make('batch_count')
|
||||
->requiredMapping()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('result'),
|
||||
ImportColumn::make('remark'),
|
||||
ImportColumn::make('rework_count')
|
||||
->requiredMapping()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('update_count')
|
||||
->requiredMapping()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('output_flag')
|
||||
->requiredMapping()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('pds_status'),
|
||||
ImportColumn::make('pds_description'),
|
||||
ImportColumn::make('tested_by'),
|
||||
ImportColumn::make('updated_by'),
|
||||
ImportColumn::make('scanned_at')
|
||||
->requiredMapping()
|
||||
->rules(['required', 'datetime']),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?TestingPanelReading
|
||||
{
|
||||
// return TestingPanelReading::firstOrNew([
|
||||
// // Update existing records, matching them by `$this->data['column_name']`
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new TestingPanelReading();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your testing panel reading import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
||||
|
||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Filament\Widgets\ItemOverview;
|
||||
use App\Models\Plant;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Form;
|
||||
@@ -77,18 +78,18 @@ class HourlyProduction extends page
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return 'Hourly Production Count';
|
||||
return 'Production Hourly Count';
|
||||
}
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return Auth::check() && Auth::user()->can('view production dashboard');
|
||||
return Auth::check() && Auth::user()->can('view production hourly count dashboard');
|
||||
}
|
||||
|
||||
public function getWidgets(): array
|
||||
{
|
||||
return [
|
||||
\App\Filament\Widgets\ItemOverview::class,
|
||||
ItemOverview::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\BlockExporter;
|
||||
use App\Filament\Imports\BlockImporter;
|
||||
use App\Filament\Resources\BlockResource\Pages;
|
||||
use App\Models\Block;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Forms\Get;
|
||||
@@ -15,6 +17,7 @@ use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class BlockResource extends Resource
|
||||
@@ -99,27 +102,44 @@ class BlockResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')
|
||||
->label('ID')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
// Tables\Columns\TextColumn::make('id')
|
||||
// ->label('ID')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('name')
|
||||
//->unique(ignoreRecord: true)
|
||||
->label('Block')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
@@ -139,7 +159,15 @@ class BlockResource extends Resource
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->importer(BlockImporter::class),
|
||||
->importer(BlockImporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view import block');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->exporter(BlockExporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view export block');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\CompanyExporter;
|
||||
use App\Filament\Imports\CompanyImporter;
|
||||
use App\Filament\Resources\CompanyResource\Pages;
|
||||
use App\Filament\Resources\CompanyResource\RelationManagers\PlantsRelationManager;
|
||||
use App\Models\Company;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
@@ -16,6 +18,7 @@ use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
|
||||
class CompanyResource extends Resource
|
||||
{
|
||||
@@ -67,22 +70,38 @@ class CompanyResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')
|
||||
->label('ID')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
// Tables\Columns\TextColumn::make('id')
|
||||
// ->label('ID')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('name')
|
||||
->label('Company')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
@@ -102,10 +121,17 @@ class CompanyResource extends Resource
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->importer(CompanyImporter::class)
|
||||
->importer(CompanyImporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view import company');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->exporter(CompanyExporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view export company');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
|
||||
139
app/Filament/Resources/ConfigurationResource.php
Normal file
139
app/Filament/Resources/ConfigurationResource.php
Normal file
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\ConfigurationResource\Pages;
|
||||
use App\Filament\Resources\ConfigurationResource\RelationManagers;
|
||||
use App\Models\Configuration;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class ConfigurationResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Configuration::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->relationship('plant', 'name')
|
||||
->required()
|
||||
->reactive(),
|
||||
Forms\Components\Select::make('line_id')
|
||||
->label('Line')
|
||||
->required()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (!$plantId) {
|
||||
return [];
|
||||
}
|
||||
return \App\Models\Line::where('plant_id', $plantId)->pluck('name', 'id')->toArray();
|
||||
})
|
||||
->reactive(),
|
||||
Forms\Components\TextInput::make('c_type')
|
||||
->label('Type')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('c_group')
|
||||
->label('Group')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('c_name')
|
||||
->label('Name')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('c_value')
|
||||
->label('Value')
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')
|
||||
->label('ID')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('line.name')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('c_type')
|
||||
->numeric()
|
||||
->label('Type')
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('c_group')
|
||||
->label('Group')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('c_name')
|
||||
->label('Name')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('c_value')
|
||||
->label('Value')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListConfigurations::route('/'),
|
||||
'create' => Pages\CreateConfiguration::route('/create'),
|
||||
'view' => Pages\ViewConfiguration::route('/{record}'),
|
||||
'edit' => Pages\EditConfiguration::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ConfigurationResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ConfigurationResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateConfiguration extends CreateRecord
|
||||
{
|
||||
protected static string $resource = ConfigurationResource::class;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ConfigurationResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ConfigurationResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditConfiguration extends EditRecord
|
||||
{
|
||||
protected static string $resource = ConfigurationResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ConfigurationResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ConfigurationResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListConfigurations extends ListRecords
|
||||
{
|
||||
protected static string $resource = ConfigurationResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ConfigurationResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ConfigurationResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewConfiguration extends ViewRecord
|
||||
{
|
||||
protected static string $resource = ConfigurationResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,6 @@ class InvoiceValidationResource extends Resource
|
||||
|
||||
Section::make('')
|
||||
->schema([
|
||||
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->relationship('plant', 'name')
|
||||
->required()
|
||||
@@ -198,10 +197,18 @@ class InvoiceValidationResource extends Resource
|
||||
return $table
|
||||
->query(InvoiceValidation::query())
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')
|
||||
->label('ID')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
// Tables\Columns\TextColumn::make('id')
|
||||
// ->label('ID')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('invoice_number')
|
||||
->label('Invoice Number')
|
||||
->alignCenter()
|
||||
|
||||
@@ -7,6 +7,7 @@ use App\Filament\Imports\ItemImporter;
|
||||
use App\Filament\Resources\ItemResource\Pages;
|
||||
use App\Models\Item;
|
||||
use Filament\Actions\Exports\Enums\ExportFormat;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
@@ -159,38 +160,58 @@ class ItemResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')
|
||||
->label('ID')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
// Tables\Columns\TextColumn::make('id')
|
||||
// ->label('ID')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
// ->getStateUsing(fn ($record, $livewire, $column, $rowLoop) => $rowLoop->iteration),
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('code')
|
||||
->label('Item Code')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('description')
|
||||
->label('Description')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('hourly_quantity')
|
||||
->label('Hourly Quantity')
|
||||
->alignCenter()
|
||||
->numeric()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('uom')
|
||||
->label('Unit of Measure')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
@@ -210,13 +231,19 @@ class ItemResource extends Resource
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->importer(ItemImporter::class),
|
||||
->importer(ItemImporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view import item');
|
||||
}),
|
||||
// ->maxRows(100000),
|
||||
ExportAction::make()
|
||||
// ->columnMapping(true)
|
||||
// ->label('Export')
|
||||
// ->fileName("items" . date('Y-m-d') . ".xlsx")
|
||||
->exporter(ItemExporter::class),
|
||||
// ->fileName("Items Report " . date('Y-m-d H:i:s'))
|
||||
->exporter(ItemExporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view export item');
|
||||
}),
|
||||
// ->formats([
|
||||
// ExportFormat::Xlsx,
|
||||
// ExportFormat::Csv,
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\LineStopExporter;
|
||||
use App\Filament\Imports\LineStopImporter;
|
||||
use App\Filament\Resources\LineStopResource\Pages;
|
||||
use App\Filament\Resources\LineStopResource\RelationManagers;
|
||||
use App\Models\LineStop;
|
||||
use Doctrine\DBAL\Exception\InvalidColumnType\ColumnPrecisionRequired;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
@@ -16,6 +18,7 @@ use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
|
||||
class LineStopResource extends Resource
|
||||
{
|
||||
@@ -98,26 +101,43 @@ class LineStopResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')
|
||||
->label('ID')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
// Tables\Columns\TextColumn::make('id')
|
||||
// ->label('ID')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('code')
|
||||
->label('Line Stop Code')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('reason')
|
||||
->label('Line Stop Reason')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
@@ -137,7 +157,15 @@ class LineStopResource extends Resource
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->importer(LineStopImporter::class),
|
||||
->importer(LineStopImporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view import line stop');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->exporter(LineStopExporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view export line stop');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
117
app/Filament/Resources/MachineResource.php
Normal file
117
app/Filament/Resources/MachineResource.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\MachineResource\Pages;
|
||||
use App\Filament\Resources\MachineResource\RelationManagers;
|
||||
use App\Models\Machine;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class MachineResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Machine::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->relationship('plant', 'name')
|
||||
->required()
|
||||
->reactive(),
|
||||
Forms\Components\Select::make('line_id')
|
||||
->label('Line')
|
||||
->required()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (!$plantId) {
|
||||
return [];
|
||||
}
|
||||
return \App\Models\Line::where('plant_id', $plantId)->pluck('name', 'id')->toArray();
|
||||
})
|
||||
->reactive(),
|
||||
Forms\Components\TextInput::make('name')
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')
|
||||
->label('ID')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('line.name')
|
||||
->label('Line')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('name')
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListMachines::route('/'),
|
||||
'create' => Pages\CreateMachine::route('/create'),
|
||||
'view' => Pages\ViewMachine::route('/{record}'),
|
||||
'edit' => Pages\EditMachine::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MachineResource\Pages;
|
||||
|
||||
use App\Filament\Resources\MachineResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateMachine extends CreateRecord
|
||||
{
|
||||
protected static string $resource = MachineResource::class;
|
||||
}
|
||||
22
app/Filament/Resources/MachineResource/Pages/EditMachine.php
Normal file
22
app/Filament/Resources/MachineResource/Pages/EditMachine.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MachineResource\Pages;
|
||||
|
||||
use App\Filament\Resources\MachineResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditMachine extends EditRecord
|
||||
{
|
||||
protected static string $resource = MachineResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MachineResource\Pages;
|
||||
|
||||
use App\Filament\Resources\MachineResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListMachines extends ListRecords
|
||||
{
|
||||
protected static string $resource = MachineResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
19
app/Filament/Resources/MachineResource/Pages/ViewMachine.php
Normal file
19
app/Filament/Resources/MachineResource/Pages/ViewMachine.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MachineResource\Pages;
|
||||
|
||||
use App\Filament\Resources\MachineResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewMachine extends ViewRecord
|
||||
{
|
||||
protected static string $resource = MachineResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
402
app/Filament/Resources/MotorTestingMasterResource.php
Normal file
402
app/Filament/Resources/MotorTestingMasterResource.php
Normal file
@@ -0,0 +1,402 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\MotorTestingMasterExporter;
|
||||
use App\Filament\Imports\MotorTestingMasterImporter;
|
||||
use App\Filament\Resources\MotorTestingMasterResource\Pages;
|
||||
use App\Filament\Resources\MotorTestingMasterResource\RelationManagers;
|
||||
use App\Models\Configuration;
|
||||
use App\Models\Item;
|
||||
use App\Models\MotorTestingMaster;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
|
||||
class MotorTestingMasterResource extends Resource
|
||||
{
|
||||
protected static ?string $model = MotorTestingMaster::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->relationship('plant', 'name')
|
||||
->required()
|
||||
->reactive()
|
||||
->default(function () {
|
||||
return optional(Item::latest()->first())->plant_id;
|
||||
})
|
||||
->disabled(fn (Get $get) => !empty($get('id')))
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (!$plantId) {
|
||||
$set('mTmError', 'Please select a plant first.');
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$set('mTmError', null);
|
||||
}
|
||||
})
|
||||
->extraAttributes(fn ($get) => [
|
||||
'class' => $get('mTmError') ? 'border-red-500' : '',
|
||||
])
|
||||
->hint(fn ($get) => $get('mTmError') ? $get('mTmError') : null)
|
||||
->hintColor('danger'),
|
||||
Forms\Components\Select::make('item_id')
|
||||
->label('Item')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (!$plantId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Item::where('plant_id', $plantId)
|
||||
->pluck('code', 'id')
|
||||
->toArray();
|
||||
})
|
||||
->required()
|
||||
->searchable()
|
||||
->reactive(),
|
||||
Forms\Components\Select::make('isi_model')
|
||||
->label('ISI Model')
|
||||
->options([
|
||||
1 => 'Yes',
|
||||
0 => 'No',
|
||||
])
|
||||
->selectablePlaceholder(false)
|
||||
->default(1)
|
||||
->required()
|
||||
->reactive(),
|
||||
Forms\Components\Select::make('phase')
|
||||
->label('Phase')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
|
||||
// if (!$plantId || !$lineId)
|
||||
// {
|
||||
// return [];
|
||||
// }
|
||||
if ($plantId)
|
||||
{
|
||||
return Configuration::where('plant_id', $plantId)
|
||||
->where('c_name', 'MOTOR_PHASE')
|
||||
->pluck('c_value', 'c_value')
|
||||
->toArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
return Configuration::where('c_name', 'MOTOR_PHASE')
|
||||
->pluck('c_value', 'c_value')
|
||||
->toArray();
|
||||
}
|
||||
})
|
||||
->selectablePlaceholder(false)
|
||||
->default('Single')
|
||||
->required()
|
||||
->reactive(),
|
||||
Forms\Components\TextInput::make('hp')
|
||||
->label('HP')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('kw')
|
||||
->label('KW')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('volt')
|
||||
->label('Volt')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('current')
|
||||
->label('Current')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('rpm')
|
||||
->label('RPM')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('torque')
|
||||
->label('Torque')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('frequency')
|
||||
->label('Frequency')
|
||||
->required(),
|
||||
Forms\Components\Select::make('connection')
|
||||
->label('Connection')
|
||||
->selectablePlaceholder(false)
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if ($plantId)
|
||||
{
|
||||
return Configuration::where('plant_id', $plantId)
|
||||
->where('c_name', 'MOTOR_CONNECTION')
|
||||
->pluck('c_value', 'c_value')
|
||||
->toArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
return Configuration::where('c_name', 'MOTOR_CONNECTION')
|
||||
->pluck('c_value', 'c_value')
|
||||
->toArray();
|
||||
}
|
||||
})
|
||||
->required()
|
||||
->default('Star')
|
||||
->reactive(),
|
||||
Forms\Components\TextInput::make('ins_res_limit')
|
||||
->label('Insulation Resistance Limit')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('ins_res_type')
|
||||
->label('Insulation Resistance Type')
|
||||
->default('O')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('res_ry_ll')
|
||||
->label('Resistance RY LL')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('res_ry_ul')
|
||||
->label('Resistance RY UL')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('res_yb_ll')
|
||||
->label('Resistance YB LL')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('res_yb_ul')
|
||||
->label('Resistance YB UL')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('res_br_ll')
|
||||
->label('Resistance BR LL')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('res_br_ul')
|
||||
->label('Resistance BR UL')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('lock_volt_limit')
|
||||
->label('Lock Volt Limit')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('leak_cur_limit')
|
||||
->label('Leakage Current Limit')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('lock_cur_ll')
|
||||
->label('Lock Current LL')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('lock_cur_ul')
|
||||
->label('Lock Current UL')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('noload_cur_ll')
|
||||
->label('No Load Current LL')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('noload_cur_ul')
|
||||
->label('No Load Current UL')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('noload_pow_ll')
|
||||
->label('No Load Power LL')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('noload_pow_ul')
|
||||
->label('No Load Power UL')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('noload_spd_ll')
|
||||
->label('No Load Speed LL')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('noload_spd_ul')
|
||||
->label('No Load Speed UL')
|
||||
->required(),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->default(fn () => Filament::auth()->user()?->name)
|
||||
->required(),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->default(fn () => Filament::auth()->user()?->name)
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('item.code')
|
||||
->label('Item Code')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('item.description')
|
||||
->label('Model')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\IconColumn::make('isi_model')
|
||||
->label('ISI Model')
|
||||
->alignCenter()
|
||||
->boolean(),
|
||||
Tables\Columns\TextColumn::make('phase')
|
||||
->label('Phase')
|
||||
->searchable()
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('kw')
|
||||
->label('KW')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('hp')
|
||||
->label('HP')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('volt')
|
||||
->label('Volt')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('current')
|
||||
->label('Current')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('rpm')
|
||||
->label('Rpm')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('torque')
|
||||
->label('Torque')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('frequency')
|
||||
->label('Frequency')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('connection')
|
||||
->label('Connection')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('ins_res_limit')
|
||||
->label('Insulation Resistance Limit')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('ins_res_type')
|
||||
->label('Insulation Resistance Type')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('res_ry_ll')
|
||||
->label('Resistance RY LL')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('res_ry_ul')
|
||||
->label('Resistance RY UL')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('res_yb_ll')
|
||||
->label('Resistance YB LL')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('res_yb_ul')
|
||||
->label('Resistance YB UL')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('res_br_ll')
|
||||
->label('Resistance BR LL')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('res_br_ul')
|
||||
->label('Resistance BR UL')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('lock_volt_limit')
|
||||
->label('Lock Volt Limit')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('leak_cur_limit')
|
||||
->label('Leakage Current Limit')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('lock_cur_ll')
|
||||
->label('Lock Current LL')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('lock_cur_ul')
|
||||
->label('Lock Current UL')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('noload_cur_ll')
|
||||
->label('No Load Current LL')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('noload_cur_ul')
|
||||
->label('No Load Current UL')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('noload_pow_ll')
|
||||
->label('No Load Power LL')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('noload_pow_ul')
|
||||
->label('No Load Power UL')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('noload_spd_ll')
|
||||
->label('No Load Speed LL')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('noload_spd_ul')
|
||||
->label('No Load Speed UL')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_by')
|
||||
->label('Created By')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('updated_by')
|
||||
->label('Updated By')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->importer(MotorTestingMasterImporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view import motor testing master');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->exporter(MotorTestingMasterExporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view export motor testing master');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListMotorTestingMasters::route('/'),
|
||||
'create' => Pages\CreateMotorTestingMaster::route('/create'),
|
||||
'view' => Pages\ViewMotorTestingMaster::route('/{record}'),
|
||||
'edit' => Pages\EditMotorTestingMaster::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MotorTestingMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\MotorTestingMasterResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateMotorTestingMaster extends CreateRecord
|
||||
{
|
||||
protected static string $resource = MotorTestingMasterResource::class;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MotorTestingMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\MotorTestingMasterResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditMotorTestingMaster extends EditRecord
|
||||
{
|
||||
protected static string $resource = MotorTestingMasterResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MotorTestingMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\MotorTestingMasterResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListMotorTestingMasters extends ListRecords
|
||||
{
|
||||
protected static string $resource = MotorTestingMasterResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MotorTestingMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\MotorTestingMasterResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewMotorTestingMaster extends ViewRecord
|
||||
{
|
||||
protected static string $resource = MotorTestingMasterResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -2,15 +2,18 @@
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\PlantExporter;
|
||||
use App\Filament\Imports\PlantImporter;
|
||||
use App\Filament\Resources\PlantResource\Pages;
|
||||
use App\Models\Plant;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
@@ -150,31 +153,52 @@ class PlantResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')
|
||||
->label('ID')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
// Tables\Columns\TextColumn::make('id')
|
||||
// ->label('ID')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('code')
|
||||
->label('Code')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('name')
|
||||
->label('Plant')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('address')
|
||||
->label('Address')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('company.name')
|
||||
->label('Company')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
@@ -194,7 +218,15 @@ class PlantResource extends Resource
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->importer(PlantImporter::class),
|
||||
->importer(PlantImporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view import plant');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->exporter(PlantExporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view export plant');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ class ProductionLineStopResource extends Resource
|
||||
// )
|
||||
->placeholder('Scan the valid code')
|
||||
->autofocus(true)
|
||||
->options(fn () => \App\Models\LineStop::pluck('code', 'id'))
|
||||
->options(fn () => LineStop::pluck('code', 'id'))
|
||||
->required()
|
||||
// ->nullable()
|
||||
// ->reactive()
|
||||
@@ -254,7 +254,7 @@ class ProductionLineStopResource extends Resource
|
||||
}
|
||||
|
||||
// Check if item exists for the selected plant
|
||||
$lineStop = \App\Models\LineStop::where('id', $lineStopId)
|
||||
$lineStop = LineStop::where('id', $lineStopId)
|
||||
->where('id', $lineStopId)
|
||||
->first();
|
||||
|
||||
@@ -349,61 +349,75 @@ class ProductionLineStopResource extends Resource
|
||||
return $table
|
||||
->query(ProductionLineStop::query())
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')
|
||||
->label('ID')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
// Tables\Columns\TextColumn::make('id')
|
||||
// ->label('ID')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('linestop.code')
|
||||
->label('Code')
|
||||
->label('Line Stop Code')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('linestop.reason')
|
||||
->label('Reason')
|
||||
->label('Line Stop Reason')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('from_datetime')
|
||||
->label('From DateTime')
|
||||
->dateTime()
|
||||
->sortable(),
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('to_datetime')
|
||||
->label('To DateTime')
|
||||
->dateTime()
|
||||
->sortable(),
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('stop_hour')
|
||||
->label('Stop Hour')
|
||||
->alignCenter()
|
||||
->numeric()
|
||||
->sortable(),
|
||||
->numeric(),
|
||||
Tables\Columns\TextColumn::make('stop_min')
|
||||
->label('Stop Minute')
|
||||
->alignCenter()
|
||||
->numeric()
|
||||
->sortable(),
|
||||
->numeric(),
|
||||
Tables\Columns\TextColumn::make('line.name')
|
||||
->label('Line')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('shift.name')
|
||||
->label('Shift')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant')
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('operator_id')
|
||||
->label('Operator ID')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('operator_id')
|
||||
->label('Operator ID')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
])
|
||||
|
||||
->filters([
|
||||
|
||||
@@ -185,7 +185,7 @@ class ProductionPlanResource extends Resource
|
||||
return [];
|
||||
}
|
||||
|
||||
return \App\Models\Line::where('plant_id', $get('plant_id'))
|
||||
return Line::where('plant_id', $get('plant_id'))
|
||||
->pluck('name', 'id')
|
||||
->toArray();
|
||||
})
|
||||
@@ -515,37 +515,61 @@ class ProductionPlanResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')
|
||||
->label('ID')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
// Tables\Columns\TextColumn::make('id')
|
||||
// ->label('ID')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('plan_quantity')
|
||||
->label('Plan Quantity')
|
||||
->alignCenter()
|
||||
->numeric()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('production_quantity')
|
||||
->label('Production Quantity')
|
||||
->alignCenter()
|
||||
->numeric()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('line.name')
|
||||
->label('Line')
|
||||
->alignCenter()
|
||||
->sortable(),// ->searchable(),
|
||||
Tables\Columns\TextColumn::make('shift.name')
|
||||
->label('Shift')
|
||||
->alignCenter()
|
||||
->sortable(),// ->searchable(),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant')
|
||||
->alignCenter()
|
||||
->sortable(),// ->searchable(),
|
||||
Tables\Columns\TextColumn::make('operator_id')
|
||||
->label('Operator ID')
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('operator_id')
|
||||
->label('Operator ID')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
|
||||
@@ -942,54 +942,74 @@ class ProductionQuantityResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')
|
||||
->label('ID')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
// Tables\Columns\TextColumn::make('id')
|
||||
// ->label('ID')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('production_order')
|
||||
->label('Production Order')
|
||||
->alignCenter()
|
||||
->sortable(),// ->searchable(),
|
||||
Tables\Columns\TextColumn::make('serial_number')
|
||||
->label('Serial Number')
|
||||
->alignCenter()
|
||||
->sortable(),// ->searchable(),
|
||||
Tables\Columns\TextColumn::make('item.code')
|
||||
->label('Item Code')
|
||||
->alignCenter()
|
||||
->sortable(),// ->searchable(),
|
||||
Tables\Columns\TextColumn::make('item.uom')
|
||||
->label('Unit of Measure')
|
||||
->alignCenter()
|
||||
->label('Unit of Measure'),
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('line.name')
|
||||
->label('Line')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('shift.name')
|
||||
->label('Shift')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('sap_msg_status')
|
||||
->label('SAP Message Status')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('sap_msg_description')
|
||||
->label('SAP Message Description')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('operator_id')
|
||||
->label('Operator ID')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
])
|
||||
->filters([
|
||||
@@ -1216,6 +1236,7 @@ class ProductionQuantityResource extends Resource
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
ActionsFilamentExportBulkAction::make('export')
|
||||
->defaultPageOrientation('landscape'),
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
|
||||
@@ -2195,11 +2195,11 @@ class QualityValidationResource extends Resource
|
||||
}
|
||||
|
||||
if (!empty($data['production_order'])) {
|
||||
$query->where('production_order', 'like', '%' . $data['production_order'] . '%');
|
||||
$query->where('production_order', $data['production_order']);
|
||||
}
|
||||
|
||||
if (!empty($data['serial_number'])) {
|
||||
$query->where('serial_number', 'like', '%' . $data['serial_number'] . '%');
|
||||
$query->where('serial_number',$data['serial_number']);
|
||||
}
|
||||
|
||||
if (!empty($data['sap_msg_status'])) {
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\ShiftExporter;
|
||||
use App\Filament\Imports\ShiftImporter;
|
||||
use App\Filament\Resources\ShiftResource\Pages;
|
||||
use App\Models\Plant;
|
||||
use App\Models\Shift;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Forms\Get;
|
||||
@@ -17,6 +19,7 @@ use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class ShiftResource extends Resource
|
||||
@@ -265,34 +268,59 @@ class ShiftResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')
|
||||
->label('ID')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
// Tables\Columns\TextColumn::make('id')
|
||||
// ->label('ID')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('name')
|
||||
->label('Shift')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('start_time')
|
||||
->label('Start Time')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('duration')
|
||||
->label('Duration')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('end_time'),
|
||||
Tables\Columns\TextColumn::make('end_time')
|
||||
->label('End Time')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('block.name')
|
||||
->label('Block')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
@@ -312,7 +340,15 @@ class ShiftResource extends Resource
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->importer(ShiftImporter::class),
|
||||
->importer(ShiftImporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view import shift');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->exporter(ShiftExporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view export shift');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ use App\Filament\Resources\StickerMasterResource\Pages;
|
||||
use App\Filament\Resources\StickerMasterResource\RelationManagers;
|
||||
use App\Models\StickerMaster;
|
||||
use Closure;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
@@ -406,86 +407,138 @@ class StickerMasterResource extends Resource
|
||||
return $table
|
||||
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')
|
||||
->label('ID')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('item.code')
|
||||
->sortable()
|
||||
->searchable(),
|
||||
// Tables\Columns\TextColumn::make('id')
|
||||
// ->label('ID')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->sortable()
|
||||
->searchable(),
|
||||
->label('Plant')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('item.code')
|
||||
->label('Item Code')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\CheckboxColumn::make('serial_number_motor')
|
||||
->disabled(true)
|
||||
->sortable(),
|
||||
->label('Serial Number Motor')
|
||||
->disabled(true)
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\CheckboxColumn::make('serial_number_pump')
|
||||
->disabled(true)
|
||||
->sortable(),
|
||||
->label('Serial Number Pump')
|
||||
->disabled(true)
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\CheckboxColumn::make('serial_number_pumpset')
|
||||
->disabled(true)
|
||||
->sortable(),
|
||||
->label('Serial Number Pumpset')
|
||||
->disabled(true)
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\CheckboxColumn::make('pack_slip_motor')
|
||||
->disabled(true)
|
||||
->sortable(),
|
||||
->label('Pack Slip Motor')
|
||||
->disabled(true)
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\CheckboxColumn::make('pack_slip_pump')
|
||||
->disabled(true)
|
||||
->sortable(),
|
||||
->label('Pack Slip Pump')
|
||||
->disabled(true)
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\CheckboxColumn::make('pack_slip_pumpset')
|
||||
->disabled(true)
|
||||
->sortable(),
|
||||
->label('Pack Slip Pumpset')
|
||||
->disabled(true)
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\CheckboxColumn::make('name_plate_motor')
|
||||
->disabled(true)
|
||||
->sortable(),
|
||||
->label('Name Plate Motor')
|
||||
->disabled(true)
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\CheckboxColumn::make('name_plate_pump')
|
||||
->disabled(true)
|
||||
->sortable(),
|
||||
->label('Name Plate Pump')
|
||||
->disabled(true)
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\CheckboxColumn::make('name_plate_pumpset')
|
||||
->disabled(true)
|
||||
->sortable(),
|
||||
->label('Name Plate Pumpset')
|
||||
->disabled(true)
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\CheckboxColumn::make('tube_sticker_motor')
|
||||
->disabled(true)
|
||||
->sortable(),
|
||||
->label('Tube Sticker Motor')
|
||||
->disabled(true)
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\CheckboxColumn::make('tube_sticker_pump')
|
||||
->disabled(true)
|
||||
->sortable(),
|
||||
->label('Tube Sticker Pump')
|
||||
->disabled(true)
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\CheckboxColumn::make('tube_sticker_pumpset')
|
||||
->disabled(true)
|
||||
->sortable(),
|
||||
->label('Tube Sticker Pumpset')
|
||||
->disabled(true)
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\CheckboxColumn::make('warranty_card')
|
||||
->disabled(true)
|
||||
->sortable(),
|
||||
->label('Warranty Card')
|
||||
->disabled(true)
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('part_validation1')
|
||||
->sortable(),
|
||||
->label('Part Validation 1')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('part_validation2')
|
||||
->sortable(),
|
||||
->label('Part Validation 2')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('part_validation3')
|
||||
->sortable(),
|
||||
->label('Part Validation 3')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('part_validation4')
|
||||
->sortable(),
|
||||
->label('Part Validation 4')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('part_validation5')
|
||||
->sortable(),
|
||||
->label('Part Validation 5')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('panel_box_code')
|
||||
->sortable(),
|
||||
->label('Panel Box Code')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('load_rate')
|
||||
->sortable(),
|
||||
->label('Load Rate')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('bundle_quantity')
|
||||
->sortable(),
|
||||
->label('Bundle Quantity')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('material_type')
|
||||
->label('Material Type')
|
||||
->sortable(),
|
||||
->label('Material Type')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
->label('Created At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
->label('Updated At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
->label('Deleted At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
@@ -503,9 +556,15 @@ class StickerMasterResource extends Resource
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->importer(StickerMasterImporter::class),
|
||||
->importer(StickerMasterImporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view import sticker master');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->exporter(StickerMasterExporter::class),
|
||||
->exporter(StickerMasterExporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view export sticker master');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
1099
app/Filament/Resources/TestingPanelReadingResource.php
Normal file
1099
app/Filament/Resources/TestingPanelReadingResource.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\TestingPanelReadingResource\Pages;
|
||||
|
||||
use App\Filament\Resources\TestingPanelReadingResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateTestingPanelReading extends CreateRecord
|
||||
{
|
||||
protected static string $resource = TestingPanelReadingResource::class;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\TestingPanelReadingResource\Pages;
|
||||
|
||||
use App\Filament\Resources\TestingPanelReadingResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditTestingPanelReading extends EditRecord
|
||||
{
|
||||
protected static string $resource = TestingPanelReadingResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\TestingPanelReadingResource\Pages;
|
||||
|
||||
use App\Filament\Resources\TestingPanelReadingResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListTestingPanelReadings extends ListRecords
|
||||
{
|
||||
protected static string $resource = TestingPanelReadingResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\TestingPanelReadingResource\Pages;
|
||||
|
||||
use App\Filament\Resources\TestingPanelReadingResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewTestingPanelReading extends ViewRecord
|
||||
{
|
||||
protected static string $resource = TestingPanelReadingResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class UserResource extends Resource
|
||||
{
|
||||
@@ -46,6 +47,7 @@ class UserResource extends Resource
|
||||
->password()
|
||||
->revealable()
|
||||
->required()
|
||||
// ->dehydrateStateUsing(fn (string $state): string => Hash::make($state))
|
||||
->maxLength(255),
|
||||
// Forms\Components\Select::make('roles')
|
||||
// ->multiple()
|
||||
@@ -66,28 +68,48 @@ class UserResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')
|
||||
->label('ID')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
// Tables\Columns\TextColumn::make('id')
|
||||
// ->label('ID')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('name')
|
||||
->label('User Name')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('email')
|
||||
->label('Email')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('email_verified_at')
|
||||
->label('Email Verified At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
|
||||
492
app/Http/Controllers/TestingPanelController.php
Normal file
492
app/Http/Controllers/TestingPanelController.php
Normal file
@@ -0,0 +1,492 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Item;
|
||||
use App\Models\MotorTestingMaster;
|
||||
use App\Models\Plant;
|
||||
use App\Models\TestingPanelReading;
|
||||
use DB;
|
||||
use Filament\Notifications\Notification;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TestingPanelController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$expectedUser = env('API_AUTH_USER');
|
||||
$expectedPw = env('API_AUTH_PW');
|
||||
|
||||
$header_auth = $request->header('Authorization');
|
||||
$expectedToken = $expectedUser . ':' . $expectedPw;
|
||||
|
||||
if("Bearer " . $expectedToken !== $header_auth)
|
||||
{
|
||||
return response("Unauthorized", 403)
|
||||
->header('Content-Type', 'text/plain');
|
||||
}
|
||||
$data = $request->all();
|
||||
|
||||
if ($data['plant_code'] == '' || !ctype_digit($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' => 'Please provide a valid plant code.'
|
||||
], 400);
|
||||
}
|
||||
|
||||
$plant = Plant::where('code', $data['plant_code'])->first();
|
||||
if (!$plant) {
|
||||
//return response("Plant not found.", 400)->header('Content-Type', 'text/plain');
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Plant not found.'
|
||||
], 400);
|
||||
}
|
||||
$plantId = $plant->id;
|
||||
|
||||
$line = \App\Models\Line::where('name', $data['line_name'])->first();
|
||||
if (!$line)
|
||||
{
|
||||
//return response("Line not found.", 400)->header('Content-Type', 'text/plain');
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Line not found.'
|
||||
], 400);
|
||||
}
|
||||
|
||||
$line = \App\Models\Line::where('name', $data['line_name'])
|
||||
->where('plant_id', $plantId)
|
||||
->first();
|
||||
|
||||
if (!$line)
|
||||
{
|
||||
//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' => "Line not found for the specified plant : {$data['plant_code']}."
|
||||
], 400);
|
||||
}
|
||||
|
||||
$lineId = $line->id;
|
||||
|
||||
$machine = \App\Models\Machine::where('name', $data['machine_name'])
|
||||
->first();
|
||||
|
||||
if (!$machine)
|
||||
{
|
||||
// return response('Machine not found', 400)->header('Content-Type', 'text/plain');
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Machine not found.'
|
||||
], 400);
|
||||
}
|
||||
|
||||
$machine = \App\Models\Machine::where('name', $data['machine_name'])
|
||||
->where('plant_id', $plantId)
|
||||
->first();
|
||||
|
||||
if (!$machine)
|
||||
{
|
||||
// return response("Machine not found for the specified plant : {$data['plant_code']}", 400)->header('Content-Type', 'text/plain');
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Machine not found for the specified plant : {$data['plant_code']}."
|
||||
], 400);
|
||||
}
|
||||
|
||||
$machine = \App\Models\Machine::where('name', $data['machine_name'])
|
||||
->where('line_id', $lineId)
|
||||
->first();
|
||||
|
||||
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' => "Machine not found for the specified line : {$data['line_name']}."
|
||||
], 400);
|
||||
|
||||
}
|
||||
|
||||
$machine = \App\Models\Machine::where('name', $data['machine_name'])
|
||||
->where('plant_id', $plantId)
|
||||
->where('line_id', $lineId)
|
||||
->first();
|
||||
|
||||
if (!$machine) {
|
||||
// return response('Machine not found for the specified plant and line', 400)
|
||||
// ->header('Content-Type', 'text/plain');
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Machine not found for the specified plant and line.'
|
||||
], 400);
|
||||
}
|
||||
$machineId = $machine->id;
|
||||
|
||||
try
|
||||
{
|
||||
$insertedSerials = [];
|
||||
$missedItemCodes = [];
|
||||
$duplicateItemCodes = [];
|
||||
$existSnoCount = [];
|
||||
|
||||
|
||||
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 == '')
|
||||
{
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Item code cannot be empty.'
|
||||
], 400);
|
||||
}
|
||||
|
||||
// Collect duplicates
|
||||
if (isset($itemCodeCounts[$code]))
|
||||
{
|
||||
$itemCodeCounts[$code]++;
|
||||
// Only add to duplicates array once
|
||||
if ($itemCodeCounts[$code] == 2) {
|
||||
$duplicateItemCodes[] = $code;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$itemCodeCounts[$code] = 1;
|
||||
}
|
||||
|
||||
$motorTestingMaster = MotorTestingMaster::whereHas('item', function ($query) use ($item) {
|
||||
$query->where('code', $item['item_code']);
|
||||
})->where('plant_id', $plantId)->first();
|
||||
|
||||
if (!$motorTestingMaster) {
|
||||
$missedItemCodes[] = $item['item_code'];
|
||||
}
|
||||
|
||||
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)) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Duplicate item codes found in request: ' . implode(', ', $duplicateItemCodes)
|
||||
], 400);
|
||||
}
|
||||
|
||||
$uniqueInvalidCodes = array_unique($missedItemCodes);
|
||||
|
||||
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}"
|
||||
], 400);
|
||||
}
|
||||
|
||||
$insertedSnoCount = [];
|
||||
|
||||
foreach ($data['item_codes'] as $item)
|
||||
{
|
||||
|
||||
$motorTestingMaster = \App\Models\MotorTestingMaster::whereHas('item', callback: function ($query) use ($item) {
|
||||
$query->where('code', $item['item_code']);
|
||||
})->where('plant_id', $plantId)->first();
|
||||
|
||||
$motorTestingMasterId = $motorTestingMaster->id;
|
||||
|
||||
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,
|
||||
'machine_id' => $machineId,
|
||||
'motor_testing_master_id' => $motorTestingMasterId,
|
||||
'serial_number' => $serial['serial_number'] ?? null,
|
||||
'rework_count' => $serial['rework_count'] ?? 0,
|
||||
];
|
||||
|
||||
// Find the current max update_count for this composite key
|
||||
// $maxUpdateCount = \App\Models\TestingPanelReading::where($updateCount)->max('update_count');
|
||||
$maxUpdateCount = TestingPanelReading::where($updateCount)
|
||||
->select(TestingPanelReading::raw('MAX(CAST(update_count AS INTEGER)) AS max_update_count'))
|
||||
->value('max_update_count');
|
||||
|
||||
$newUpdateCount = ($maxUpdateCount === null || $maxUpdateCount === '') ? 0 : $maxUpdateCount + 1;
|
||||
|
||||
$updateCountString = (string) $newUpdateCount;
|
||||
|
||||
|
||||
$row =
|
||||
[
|
||||
'plant_id' => $plantId,
|
||||
'line_id' => $lineId,
|
||||
'machine_id' => $machineId,
|
||||
'motor_testing_master_id'=> $motorTestingMasterId,
|
||||
'serial_number' => $serial['serial_number'] ?? null,
|
||||
'output' => $serial['output'] ?? null,
|
||||
'before_fr_volt' => $serial['before_fr_volt'] ?? null,
|
||||
'before_fr_cur' => $serial['before_fr_cur'] ?? null,
|
||||
'before_fr_pow' => $serial['before_fr_pow'] ?? null,
|
||||
'before_fr_res_ry' => $serial['before_fr_res_ry'] ?? null,
|
||||
'before_fr_res_yb' => $serial['before_fr_res_yb'] ?? null,
|
||||
'before_fr_res_br' => $serial['before_fr_res_br'] ?? null,
|
||||
'before_fr_ir' => $serial['before_fr_ir'] ?? null,
|
||||
'before_fr_ir_r' => $serial['before_fr_ir_r'] ?? null,
|
||||
'before_fr_ir_y' => $serial['before_fr_ir_y'] ?? null,
|
||||
'before_fr_ir_b' => $serial['before_fr_ir_b'] ?? null,
|
||||
'before_fr_freq' => $serial['before_fr_freq'] ?? null,
|
||||
'before_fr_speed' => $serial['before_fr_speed'] ?? null,
|
||||
'after_fr_vol' => $serial['after_fr_vol'] ?? null,
|
||||
'after_fr_cur' => $serial['after_fr_cur'] ?? null,
|
||||
'after_fr_pow' => $serial['after_fr_pow'] ?? null,
|
||||
'after_fr_ir_hot' => $serial['after_fr_ir_hot'] ?? null,
|
||||
'after_fr_ir_hot_r' => $serial['after_fr_ir_hot_r'] ?? null,
|
||||
'after_fr_ir_hot_y' => $serial['after_fr_ir_hot_y'] ?? null,
|
||||
'after_fr_ir_hot_b' => $serial['after_fr_ir_hot_b'] ?? null,
|
||||
'after_fr_ir_cool' => $serial['after_fr_ir_cool'] ?? null,
|
||||
'after_fr_ir_cool_r' => $serial['after_fr_ir_cool_r'] ?? null,
|
||||
'after_fr_ir_cool_y' => $serial['after_fr_ir_cool_y'] ?? null,
|
||||
'after_fr_ir_cool_b' => $serial['after_fr_ir_cool_b'] ?? null,
|
||||
'after_fr_freq' => $serial['after_fr_freq'] ?? null,
|
||||
'after_fr_speed' => $serial['after_fr_speed'] ?? null,
|
||||
'after_fr_leak_cur' => $serial['after_fr_leak_cur'] ?? null,
|
||||
'locked_rt_volt' => $serial['locked_rt_volt'] ?? null,
|
||||
'locked_rt_cur' => $serial['locked_rt_cur'] ?? null,
|
||||
'locked_rt_pow' => $serial['locked_rt_pow'] ?? null,
|
||||
'no_load_pickup_volt' => $serial['no_load_pickup_volt'] ?? null,
|
||||
'room_temperature' => $serial['room_temperature'] ?? null,
|
||||
'hv_test' => $serial['hv_test'] ?? null,
|
||||
'batch_number' => $serial['batch_number'] ?? null,
|
||||
'batch_count' => $serial['batch_count'] ?? 0,
|
||||
'result' => $serial['result'] ?? null,
|
||||
'remark' => $serial['remark'] ?? null,
|
||||
'rework_count' => $serial['rework_count'] ?? 0,
|
||||
'output_flag' => $serial['output_flag'] ?? 0,
|
||||
'tested_by' => $serial['tested_by'] ?? null,
|
||||
'updated_by' => $serial['updated_by'] ?? null,
|
||||
'created_at' => $serial['created_at'] ?? null,
|
||||
'updated_at' => $serial['updated_at'] ?? $serial['created_at'],
|
||||
'scanned_at' => $serial['scanned_at'] ?? null,
|
||||
'update_count' => $updateCountString,
|
||||
];
|
||||
|
||||
// Insert the new record
|
||||
TestingPanelReading::create($row);
|
||||
$insertedSerials[] = $serial['serial_number'] ?? '[unknown]';
|
||||
$insertedSnoCount[] = $serial['serial_number'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
], 200);
|
||||
}
|
||||
else
|
||||
{
|
||||
// $missingSno = array_diff($existSnoCount,$insertedSnoCount);
|
||||
// $messages[] = "Missed serial numbers are: " . implode(', ', $missingSno);
|
||||
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Missed serial numbers are: " . implode(', ', $missingSno)'
|
||||
], 400);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// return response("" . implode("\n", $messages), 200)
|
||||
// ->header('Content-Type', 'text/plain');
|
||||
|
||||
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
// return response($e->getMessage(), 500)->header('Content-Type', 'text/plain');
|
||||
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Internal Sever Error : '.$e->getCode()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function get_motor_master(Request $request)
|
||||
{
|
||||
$expectedUser = env('API_AUTH_USER');
|
||||
$expectedPw = env('API_AUTH_PW');
|
||||
$header_auth = $request->header('Authorization');
|
||||
$expectedToken = $expectedUser . ':' . $expectedPw;
|
||||
|
||||
if("Bearer " . $expectedToken !== $header_auth)
|
||||
{
|
||||
return response("Unauthorized", 403)
|
||||
->header('Content-Type', 'text/plain');
|
||||
}
|
||||
|
||||
//$data = $request->all();
|
||||
|
||||
if ("Bearer " . $expectedToken !== $header_auth)
|
||||
{
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid authorization token'
|
||||
], 403);
|
||||
}
|
||||
|
||||
$plantCode = $request->header('plant-code');
|
||||
$itemCode = $request->header('item-code');
|
||||
// $description = $item ? $item->description : '';
|
||||
|
||||
// Fetch item by code
|
||||
$item = Item::where('code', $itemCode)->first();
|
||||
|
||||
// Get description or empty string if not found
|
||||
$description = $item ? $item->description : '';
|
||||
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 Name cannot be empty"
|
||||
], 400);
|
||||
}
|
||||
else if($itemCode == null || $itemCode == '')
|
||||
{
|
||||
// return response("ERROR: OBD Number can't be empty", 400)
|
||||
// ->header('Content-Type', 'text/plain');
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item Code cannot be empty"
|
||||
], 400);
|
||||
}
|
||||
|
||||
$plant = Plant::where('code', $plantCode)->first();
|
||||
|
||||
if (!$plant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Plant not found"
|
||||
], 400);
|
||||
}
|
||||
|
||||
$plantId = $plant->id;
|
||||
|
||||
$item = Item::where('code', $itemCode)->first();
|
||||
|
||||
if (!$item)
|
||||
{
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item Code not found for plant : $plant->name"
|
||||
], 404);
|
||||
}
|
||||
|
||||
$motorTestingMaster = MotorTestingMaster::where('plant_id', $plant->id)
|
||||
->where('item_id', $item->id)
|
||||
->first();
|
||||
|
||||
if (!$motorTestingMaster)
|
||||
{
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item Code not found in master for the plant : $plant->name"
|
||||
], 404);
|
||||
}
|
||||
|
||||
$output = [
|
||||
"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_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);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
31
app/Models/Configuration.php
Normal file
31
app/Models/Configuration.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Configuration extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'plant_id',
|
||||
'line_id',
|
||||
'c_type',
|
||||
'c_group',
|
||||
'c_name',
|
||||
'c_value',
|
||||
];
|
||||
|
||||
public function plant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Plant::class);
|
||||
}
|
||||
|
||||
public function line(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Line::class);
|
||||
}
|
||||
}
|
||||
@@ -32,4 +32,8 @@ class Item extends Model
|
||||
{
|
||||
return $this->hasMany(ProductionQuantity::class);
|
||||
}
|
||||
public function testingPanelReadings()
|
||||
{
|
||||
return $this->hasMany(TestingPanelReading::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,4 +21,9 @@ class Line extends Model
|
||||
{
|
||||
return $this->belongsTo(Plant::class);
|
||||
}
|
||||
|
||||
public function testingPanelReadings()
|
||||
{
|
||||
return $this->hasMany(TestingPanelReading::class);
|
||||
}
|
||||
}
|
||||
|
||||
33
app/Models/Machine.php
Normal file
33
app/Models/Machine.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Machine extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'plant_id',
|
||||
'line_id',
|
||||
'name',
|
||||
];
|
||||
|
||||
public function plant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Plant::class);
|
||||
}
|
||||
|
||||
public function line(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Line::class);
|
||||
}
|
||||
|
||||
public function testingPanelReadings()
|
||||
{
|
||||
return $this->hasMany(TestingPanelReading::class);
|
||||
}
|
||||
}
|
||||
57
app/Models/MotorTestingMaster.php
Normal file
57
app/Models/MotorTestingMaster.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class MotorTestingMaster extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'plant_id',
|
||||
'item_id',
|
||||
'isi_model',
|
||||
'phase',
|
||||
'kw',
|
||||
'hp',
|
||||
'volt',
|
||||
'current',
|
||||
'rpm',
|
||||
'torque',
|
||||
'frequency',
|
||||
'connection',
|
||||
'ins_res_limit',
|
||||
'ins_res_type',
|
||||
'res_ry_ll',
|
||||
'res_ry_ul',
|
||||
'res_yb_ll',
|
||||
'res_yb_ul',
|
||||
'res_br_ll',
|
||||
'res_br_ul',
|
||||
'lock_volt_limit',
|
||||
'leak_cur_limit',
|
||||
'lock_cur_ll',
|
||||
'lock_cur_ul',
|
||||
'noload_cur_ll',
|
||||
'noload_cur_ul',
|
||||
'noload_pow_ll',
|
||||
'noload_pow_ul',
|
||||
'noload_spd_ll',
|
||||
'noload_spd_ul',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
public function plant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Plant::class);
|
||||
}
|
||||
|
||||
public function item(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Item::class);
|
||||
}
|
||||
}
|
||||
@@ -57,4 +57,9 @@ class Plant extends Model
|
||||
{
|
||||
return $this->hasMany(QualityValidation::class, 'sticker_master_id');
|
||||
}
|
||||
|
||||
public function testingPanelReadings()
|
||||
{
|
||||
return $this->hasMany(TestingPanelReading::class);
|
||||
}
|
||||
}
|
||||
|
||||
89
app/Models/TestingPanelReading.php
Normal file
89
app/Models/TestingPanelReading.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class TestingPanelReading extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'plant_id',
|
||||
'line_id',
|
||||
'motor_testing_master_id',
|
||||
'machine_id',
|
||||
'output',
|
||||
'serial_number',
|
||||
'before_fr_volt',
|
||||
'before_fr_cur',
|
||||
'before_fr_pow',
|
||||
'before_fr_res_ry',
|
||||
'before_fr_res_yb',
|
||||
'before_fr_res_br',
|
||||
'before_fr_ir',
|
||||
'before_fr_ir_r',
|
||||
'before_fr_ir_y',
|
||||
'before_fr_ir_b',
|
||||
'before_fr_freq',
|
||||
'before_fr_speed',
|
||||
'after_fr_vol',
|
||||
'after_fr_cur',
|
||||
'after_fr_pow',
|
||||
'after_fr_ir_hot',
|
||||
'after_fr_ir_hot_r',
|
||||
'after_fr_ir_hot_y',
|
||||
'after_fr_ir_hot_b',
|
||||
'after_fr_ir_cool',
|
||||
'after_fr_ir_cool_r',
|
||||
'after_fr_ir_cool_y',
|
||||
'after_fr_ir_cool_b',
|
||||
'after_fr_freq',
|
||||
'after_fr_speed',
|
||||
'after_fr_leak_cur',
|
||||
'locked_rt_volt',
|
||||
'locked_rt_cur',
|
||||
'locked_rt_pow',
|
||||
'no_load_pickup_volt',
|
||||
'room_temperature',
|
||||
'hv_test',
|
||||
'batch_number',
|
||||
'batch_count',
|
||||
'result',
|
||||
'remark',
|
||||
'rework_count',
|
||||
'update_count',
|
||||
'output_flag',
|
||||
'tested_by',
|
||||
'updated_by',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'scanned_at',
|
||||
];
|
||||
|
||||
public function plant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Plant::class);
|
||||
}
|
||||
|
||||
public function line(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Line::class);
|
||||
}
|
||||
public function machine(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Machine::class);
|
||||
}
|
||||
|
||||
public function item(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Item::class);
|
||||
}
|
||||
|
||||
public function motorTestingMaster()
|
||||
{
|
||||
return $this->belongsTo(MotorTestingMaster::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE configurations (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
line_id BIGINT NOT NULL,
|
||||
|
||||
c_type TEXT NOT NULL,
|
||||
c_group TEXT NOT NULL,
|
||||
c_name TEXT NOT NULL,
|
||||
c_value TEXT NOT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
UNIQUE (plant_id, line_id, c_type, c_group, c_name, c_value),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (line_id) REFERENCES lines (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('configurations');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE machines (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
line_id BIGINT NOT NULL,
|
||||
|
||||
name TEXT NOT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
UNIQUE (plant_id, line_id, name),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (line_id) REFERENCES lines (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('machines');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE testing_panel_readings (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
line_id BIGINT NOT NULL,
|
||||
motor_testing_master_id BIGINT NOT NULL,
|
||||
machine_id BIGINT NOT NULL,
|
||||
|
||||
output TEXT NOT NULL,
|
||||
serial_number TEXT NOT NULL,
|
||||
before_fr_volt TEXT DEFAULT '0',
|
||||
before_fr_cur TEXT DEFAULT '0',
|
||||
before_fr_pow TEXT DEFAULT '0',
|
||||
before_fr_res_ry TEXT DEFAULT '0',
|
||||
before_fr_res_yb TEXT DEFAULT '0',
|
||||
before_fr_res_br TEXT DEFAULT '0',
|
||||
before_fr_ir TEXT DEFAULT '0',
|
||||
before_fr_ir_r TEXT DEFAULT '0',
|
||||
before_fr_ir_y TEXT DEFAULT '0',
|
||||
before_fr_ir_b TEXT DEFAULT '0',
|
||||
before_fr_freq TEXT DEFAULT '0',
|
||||
before_fr_speed TEXT DEFAULT '0',
|
||||
after_fr_vol TEXT DEFAULT '0',
|
||||
after_fr_cur TEXT DEFAULT '0',
|
||||
after_fr_pow TEXT DEFAULT '0',
|
||||
after_fr_ir_hot TEXT DEFAULT '0',
|
||||
after_fr_ir_hot_r TEXT DEFAULT '0',
|
||||
after_fr_ir_hot_y TEXT DEFAULT '0',
|
||||
after_fr_ir_hot_b TEXT DEFAULT '0',
|
||||
after_fr_ir_cool TEXT DEFAULT '0',
|
||||
after_fr_ir_cool_r TEXT DEFAULT '0',
|
||||
after_fr_ir_cool_y TEXT DEFAULT '0',
|
||||
after_fr_ir_cool_b TEXT DEFAULT '0',
|
||||
after_fr_freq TEXT DEFAULT '0',
|
||||
after_fr_speed TEXT DEFAULT '0',
|
||||
after_fr_leak_cur TEXT DEFAULT '0',
|
||||
locked_rt_volt TEXT DEFAULT '0',
|
||||
locked_rt_cur TEXT DEFAULT '0',
|
||||
locked_rt_pow TEXT DEFAULT '0',
|
||||
no_load_pickup_volt TEXT DEFAULT '0',
|
||||
room_temperature TEXT NULL,
|
||||
hv_test TEXT NULL,
|
||||
batch_number TEXT NULL,
|
||||
batch_count TEXT NOT NULL DEFAULT '0',
|
||||
result TEXT NULL,
|
||||
remark TEXT NULL,
|
||||
|
||||
rework_count TEXT NOT NULL DEFAULT '0',
|
||||
update_count TEXT NOT NULL DEFAULT '0',
|
||||
output_flag TEXT NOT NULL DEFAULT '0',
|
||||
|
||||
tested_by TEXT NULL,
|
||||
updated_by TEXT NULL,
|
||||
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
scanned_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
UNIQUE (plant_id, motor_testing_master_id, serial_number, machine_id, line_id, rework_count, update_count),
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (motor_testing_master_id) REFERENCES motor_testing_masters(id),
|
||||
FOREIGN KEY (machine_id) REFERENCES machines (id),
|
||||
FOREIGN KEY (line_id) REFERENCES lines (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('testing_panel_readings');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE motor_testing_masters (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
item_id BIGINT NOT NULL,
|
||||
|
||||
isi_model BOOLEAN DEFAULT FALSE,
|
||||
phase TEXT NOT NULL,
|
||||
hp TEXT NOT NULL,
|
||||
kw TEXT NOT NULL,
|
||||
|
||||
volt TEXT NOT NULL,
|
||||
current TEXT NOT NULL,
|
||||
rpm TEXT NOT NULL,
|
||||
torque TEXT NOT NULL,
|
||||
frequency TEXT NOT NULL,
|
||||
connection TEXT NOT NULL,
|
||||
ins_res_limit TEXT NOT NULL,
|
||||
ins_res_type TEXT NOT NULL DEFAULT 'O',
|
||||
|
||||
res_ry_ll TEXT NOT NULL DEFAULT '0.05',
|
||||
res_ry_ul TEXT NOT NULL DEFAULT '99',
|
||||
res_yb_ll TEXT NOT NULL DEFAULT '0.05',
|
||||
res_yb_ul TEXT NOT NULL DEFAULT '99',
|
||||
res_br_ll TEXT NOT NULL DEFAULT '0.05',
|
||||
res_br_ul TEXT NOT NULL DEFAULT '99',
|
||||
|
||||
lock_volt_limit TEXT NOT NULL,
|
||||
leak_cur_limit TEXT NOT NULL,
|
||||
lock_cur_ll TEXT NOT NULL,
|
||||
lock_cur_ul TEXT NOT NULL,
|
||||
|
||||
noload_cur_ll TEXT NOT NULL,
|
||||
noload_cur_ul TEXT NOT NULL,
|
||||
|
||||
noload_pow_ll TEXT NOT NULL,
|
||||
noload_pow_ul TEXT NOT NULL,
|
||||
|
||||
noload_spd_ll TEXT NOT NULL,
|
||||
noload_spd_ul TEXT NOT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
created_by TEXT NOT NULL,
|
||||
updated_by TEXT NOT NULL,
|
||||
|
||||
UNIQUE (plant_id, item_id),
|
||||
|
||||
FOREIGN KEY (item_id) REFERENCES items (id),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('motor_testing_masters');
|
||||
}
|
||||
};
|
||||
@@ -40,7 +40,7 @@ class PermissionSeeder extends Seeder
|
||||
Permission::updateOrCreate(['name' => 'create ProductionQuantities']);
|
||||
|
||||
Permission::updateOrCreate(['name' => 'view invoice dashboard']); //invoice dashboard
|
||||
Permission::updateOrCreate(['name' => 'view production dashboard']); //hourly production
|
||||
Permission::updateOrCreate(['name' => 'view production hourly count dashboard']); //hourly production
|
||||
Permission::updateOrCreate(['name' => 'view production line count dashboard']);
|
||||
Permission::updateOrCreate(['name' => 'view production order count dashboard']);
|
||||
Permission::updateOrCreate(['name' => 'view production line stop count dashboard']);
|
||||
@@ -55,5 +55,10 @@ class PermissionSeeder extends Seeder
|
||||
Permission::updateOrCreate(['name' => 'view import obd weight validation']);
|
||||
Permission::updateOrCreate(['name' => 'view import weight validation']);
|
||||
Permission::updateOrCreate(['name' => 'view export weight validation']);
|
||||
Permission::updateOrCreate(['name' => 'view import motor testing master']);
|
||||
Permission::updateOrCreate(['name' => 'view export motor testing master']);
|
||||
Permission::updateOrCreate(['name' => 'view import testing panel reading']);
|
||||
Permission::updateOrCreate(['name' => 'view export testing panel reading']);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
BIN
public/images/cripumps.logo.png
Normal file
BIN
public/images/cripumps.logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.5 KiB |
BIN
public/images/isi_logo1.PNG
Normal file
BIN
public/images/isi_logo1.PNG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
175
resources/views/exports/export-isi-pdf.blade.php
Normal file
175
resources/views/exports/export-isi-pdf.blade.php
Normal file
@@ -0,0 +1,175 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
@page { size: A4 landscape; margin: 30px 8px 8px 8px; }
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 8px;
|
||||
counter-reset: page;
|
||||
}
|
||||
|
||||
.page-number {
|
||||
position: fixed;
|
||||
top: -15px;
|
||||
right: 0;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.page-number:after {
|
||||
content: "Page " counter(page);
|
||||
}
|
||||
|
||||
.data-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.data-table th, .data-table td {
|
||||
border: 1px solid #222;
|
||||
padding: 2px;
|
||||
text-align: center;
|
||||
font-size: 7px;
|
||||
}
|
||||
|
||||
thead { display: table-header-group; }
|
||||
.company-title { font-size: 16px; font-weight: bold; text-align: center; }
|
||||
.company-subtitle { font-size: 12px; text-align: center; }
|
||||
.company-address { font-size: 10px; text-align: center; }
|
||||
.register-title { font-size: 12px; font-weight: bold; text-align: center; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="page-number"></div>
|
||||
|
||||
<table class="data-table">
|
||||
<tr>
|
||||
<td colspan="20" style="padding:0;">
|
||||
<table width="100%" style="border-collapse:collapse;">
|
||||
<tr>
|
||||
<td style="width:13%; text-align:left; border:none; border-bottom:1px solid #222;">
|
||||
<img src="{{ public_path('images/cripumps.logo.png') }}" alt="Logo" height="45" style="position: relative; left: 5mm;">
|
||||
</td>
|
||||
<td style="width:74%; border:none; border-bottom:1px solid #222;">
|
||||
<div class="company-title">C.R.I. Pumps Private Limited</div>
|
||||
<div class="company-subtitle">Unit : {{ $plant?->name ?? '' }}</div>
|
||||
<div class="company-address">{{ $plant?->address ?? '' }}</div>
|
||||
<div class="register-title">MOTOR FREE RUN TEST REGISTER</div>
|
||||
</td>
|
||||
@php
|
||||
$showIsiLogo = $records->every(fn ($record) => $record['isi_model']);
|
||||
@endphp
|
||||
<td style="width:13%; text-align:right; border:none; border-bottom:1px solid #222;">
|
||||
@if ($showIsiLogo)
|
||||
<img src="{{ public_path('images/isi_logo1.PNG') }}" alt="ISI Logo" height="35" style="position: relative; left: -20mm;">
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@php
|
||||
$uniqueItemCodes = $records->pluck('Item Code')->unique();
|
||||
$kw = $hp = $phase = '-';
|
||||
if ($uniqueItemCodes->count() === 1) {
|
||||
$firstRecord = $records->first();
|
||||
$kw = $firstRecord['kw'] ?? '-';
|
||||
$hp = $firstRecord['hp'] ?? '-';
|
||||
$phase = $firstRecord['phase'] ?? '-';
|
||||
}
|
||||
@endphp
|
||||
<td colspan="3" style="text-align:left; font-size:10px; font-weight:bold; border:none; padding-left:230mm;">
|
||||
MOTOR KW / HP : {{ $kw }} / {{ $hp }} and PHASE : {{ $phase }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<thead>
|
||||
<!-- Row 1: Main Group Headings -->
|
||||
<tr>
|
||||
<th rowspan="3">Date</th>
|
||||
<th rowspan="3">Motor SNo</th>
|
||||
<th rowspan="3">Item Code</th>
|
||||
<th rowspan="3">Motor Type</th>
|
||||
|
||||
<th colspan="8">AFTER FREE RUN</th>
|
||||
<th colspan="3">LOCKED ROTOR TEST</th>
|
||||
|
||||
<th rowspan="3">No Load Pickup Voltage</th>
|
||||
<th rowspan="3">Room Temp.</th>
|
||||
<th rowspan="3">High Voltage Test</th>
|
||||
<th rowspan="3">Result</th>
|
||||
<th rowspan="3">Remark</th>
|
||||
</tr>
|
||||
|
||||
<!-- Row 2: Sub-Headers (Column Names) -->
|
||||
<tr>
|
||||
<!-- AFTER FREE RUN -->
|
||||
<th>Voltage</th>
|
||||
<th>Current</th>
|
||||
<th>Power</th>
|
||||
<th>IR.Hot</th>
|
||||
<th>IR.Cool</th>
|
||||
<th>Frequency</th>
|
||||
<th>Speed</th>
|
||||
<th>Leakage Current</th>
|
||||
|
||||
<!-- LOCKED ROTOR TEST -->
|
||||
<th>Voltage</th>
|
||||
<th>Current</th>
|
||||
<th>Power</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<!-- AFTER FREE RUN -->
|
||||
<td>(V)</td>
|
||||
<td>(A)</td>
|
||||
<td>(W)</td>
|
||||
<td>(Ohm)</td>
|
||||
<td>(Ohm)</td>
|
||||
<td>(Hz)</td>
|
||||
<td>(Rpm)</td>
|
||||
<td>(mA)</td>
|
||||
<!-- LOCKED ROTOR TEST -->
|
||||
<td>(V)</td>
|
||||
<td>(A)</td>
|
||||
<td>(W)</td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
|
||||
@foreach($records as $record)
|
||||
<tr>
|
||||
<td>{{ $record['Date'] ?? '' }}</td>
|
||||
<td>{{ $record['Motor SNo'] ?? '' }}</td>
|
||||
<td>{{ $record['Item Code'] ?? '' }}</td>
|
||||
<td>{{ $record['Motor Type'] ?? '' }}</td>
|
||||
|
||||
{{-- AFTER FREE RUN --}}
|
||||
<td>{{ $record['Voltage_After'] ?? '' }}</td>
|
||||
<td>{{ $record['Current_After'] ?? '' }}</td>
|
||||
<td>{{ $record['Power_After'] ?? '' }}</td>
|
||||
<td>{{ $record['IR_Hot'] ?? '' }}</td>
|
||||
<td>{{ $record['IR_Cool'] ?? '' }}</td>
|
||||
<td>{{ $record['Frequency_After'] ?? '' }}</td>
|
||||
<td>{{ $record['Speed_After'] ?? '' }}</td>
|
||||
<td>{{ $record['Leakage_Current'] ?? '' }}</td>
|
||||
|
||||
{{-- LOCKED ROTOR TEST --}}
|
||||
<td>{{ $record['Voltage_Locked'] ?? '' }}</td>
|
||||
<td>{{ $record['Current_Locked'] ?? '' }}</td>
|
||||
<td>{{ $record['Power_Locked'] ?? '' }}</td>
|
||||
|
||||
{{-- OTHERS --}}
|
||||
<td>{{ $record['No_Load_Pickup_Voltage'] ?? '' }}</td>
|
||||
<td>{{ $record['Room_Temp'] ?? '' }}</td>
|
||||
<td>{{ $record['High_Voltage_Test'] ?? '' }}</td>
|
||||
<td>{{ $record['Result'] ?? '' }}</td>
|
||||
<td>{{ $record['Remark'] ?? '' }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
200
resources/views/exports/export-isi-three-phase-pdf.blade.php
Normal file
200
resources/views/exports/export-isi-three-phase-pdf.blade.php
Normal file
@@ -0,0 +1,200 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
@page { size: A4 landscape; margin: 30px 8px 8px 8px; }
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 8px;
|
||||
counter-reset: page;
|
||||
}
|
||||
|
||||
.page-number {
|
||||
position: fixed;
|
||||
top: -15px;
|
||||
right: 0;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.page-number:after {
|
||||
content: "Page " counter(page);
|
||||
}
|
||||
|
||||
.data-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.data-table th, .data-table td {
|
||||
border: 1px solid #222;
|
||||
padding: 2px;
|
||||
text-align: center;
|
||||
font-size: 7px;
|
||||
}
|
||||
|
||||
thead { display: table-header-group; }
|
||||
.company-title { font-size: 16px; font-weight: bold; text-align: center; }
|
||||
.company-subtitle { font-size: 12px; text-align: center; }
|
||||
.company-address { font-size: 10px; text-align: center; }
|
||||
.register-title { font-size: 12px; font-weight: bold; text-align: center; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="page-number"></div>
|
||||
|
||||
<table class="data-table">
|
||||
<tr>
|
||||
<td colspan="24" style="padding:0;">
|
||||
<table width="100%" style="border-collapse:collapse;">
|
||||
<tr>
|
||||
<td style="width:13%; text-align:left; border:none; border-bottom:1px solid #222;">
|
||||
<img src="{{ public_path('images/cripumps.logo.png') }}" alt="Logo" height="45" style="position: relative; left: 5mm;">
|
||||
</td>
|
||||
<td style="width:74%; border:none; border-bottom:1px solid #222;">
|
||||
<div class="company-title">C.R.I. Pumps Private Limited</div>
|
||||
<div class="company-subtitle">Unit : {{ $plant?->name ?? '' }}</div>
|
||||
<div class="company-address">{{ $plant?->address ?? '' }}</div>
|
||||
<div class="register-title">MOTOR FREE RUN TEST REGISTER</div>
|
||||
</td>
|
||||
@php
|
||||
$showIsiLogo = $records->every(fn ($record) => $record['isi_model']);
|
||||
@endphp
|
||||
<td style="width:13%; text-align:right; border:none; border-bottom:1px solid #222;">
|
||||
@if ($showIsiLogo)
|
||||
<img src="{{ public_path('images/isi_logo1.PNG') }}" alt="ISI Logo" height="35" style="position: relative; left: -20mm;">
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@php
|
||||
$uniqueItemCodes = $records->pluck('Item Code')->unique();
|
||||
$kw = $hp = $phase = '-';
|
||||
if ($uniqueItemCodes->count() === 1) {
|
||||
$firstRecord = $records->first();
|
||||
$kw = $firstRecord['kw'] ?? '-';
|
||||
$hp = $firstRecord['hp'] ?? '-';
|
||||
$phase = $firstRecord['phase'] ?? '-';
|
||||
}
|
||||
@endphp
|
||||
<td colspan="3" style="text-align:left; font-size:10px; font-weight:bold; border:none; padding-left:230mm;">
|
||||
MOTOR KW / HP : {{ $kw }} / {{ $hp }} and PHASE : {{ $phase }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<thead>
|
||||
<!-- Row 1: Main Group Headings -->
|
||||
<tr>
|
||||
<th rowspan="4">Date</th>
|
||||
<th rowspan="4">Motor SNo</th>
|
||||
<th rowspan="4">Item Code</th>
|
||||
<th rowspan="4">Motor Type</th>
|
||||
|
||||
<th colspan="12">AFTER FREE RUN</th>
|
||||
<th colspan="3">LOCKED ROTOR TEST</th>
|
||||
|
||||
<th rowspan="4">No Load Pickup Voltage</th>
|
||||
<th rowspan="4">Room Temp.</th>
|
||||
<th rowspan="4">High Voltage Test</th>
|
||||
<th rowspan="4">Result</th>
|
||||
<th rowspan="4">Remark</th>
|
||||
</tr>
|
||||
|
||||
<!-- Row 2: AFTER FREE RUN main columns -->
|
||||
<tr>
|
||||
<th rowspan="2">Voltage</th>
|
||||
<th rowspan="2">Current</th>
|
||||
<th rowspan="2">Power</th>
|
||||
<th colspan="3">IR.Hot</th>
|
||||
<th colspan="3">IR.Cool</th>
|
||||
<th rowspan="2">Frequency</th>
|
||||
<th rowspan="2">Speed</th>
|
||||
<th rowspan="2">Leakage Current</th>
|
||||
|
||||
<!-- LOCKED ROTOR TEST -->
|
||||
<th rowspan="2">Voltage</th>
|
||||
<th rowspan="2">Current</th>
|
||||
<th rowspan="2">Power</th>
|
||||
</tr>
|
||||
|
||||
<!-- Row 3: Sub-columns for IR.Hot and IR.Cool -->
|
||||
<tr>
|
||||
<th>R</th>
|
||||
<th>Y</th>
|
||||
<th>B</th>
|
||||
<th>R</th>
|
||||
<th>Y</th>
|
||||
<th>B</th>
|
||||
</tr>
|
||||
|
||||
<!-- Row 4: Units -->
|
||||
<tr>
|
||||
<td>(V)</td> <!-- Voltage -->
|
||||
<td>(A)</td> <!-- Current -->
|
||||
<td>(W)</td> <!-- Power -->
|
||||
<td>(Ohm)</td> <!-- IR.Hot R -->
|
||||
<td>(Ohm)</td> <!-- IR.Hot Y -->
|
||||
<td>(Ohm)</td> <!-- IR.Hot B -->
|
||||
<td>(Ohm)</td> <!-- IR.Cool R -->
|
||||
<td>(Ohm)</td> <!-- IR.Cool Y -->
|
||||
<td>(Ohm)</td> <!-- IR.Cool B -->
|
||||
<td>(Hz)</td> <!-- Frequency -->
|
||||
<td>(Rpm)</td> <!-- Speed -->
|
||||
<td>(mA)</td> <!-- Leakage Current -->
|
||||
|
||||
<td>(V)</td> <!-- Locked Voltage -->
|
||||
<td>(A)</td> <!-- Locked Current -->
|
||||
<td>(W)</td> <!-- Locked Power -->
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
|
||||
|
||||
@foreach($records as $record)
|
||||
<tr>
|
||||
{{-- COMMON FIELDS --}}
|
||||
<td>{{ $record['Date'] ?? '' }}</td>
|
||||
<td>{{ $record['Motor SNo'] ?? '' }}</td>
|
||||
<td>{{ $record['Item Code'] ?? '' }}</td>
|
||||
<td>{{ $record['Motor Type'] ?? '' }}</td>
|
||||
|
||||
{{-- AFTER FREE RUN --}}
|
||||
<td>{{ $record['Voltage_After'] ?? '' }}</td>
|
||||
<td>{{ $record['Current_After'] ?? '' }}</td>
|
||||
<td>{{ $record['Power_After'] ?? '' }}</td>
|
||||
|
||||
{{-- IR Hot: R, Y, B --}}
|
||||
<td>{{ $record['IR_Hot_R'] ?? '' }}</td>
|
||||
<td>{{ $record['IR_Hot_Y'] ?? '' }}</td>
|
||||
<td>{{ $record['IR_Hot_B'] ?? '' }}</td>
|
||||
|
||||
{{-- IR Cool: R, Y, B --}}
|
||||
<td>{{ $record['IR_Cool_R'] ?? '' }}</td>
|
||||
<td>{{ $record['IR_Cool_Y'] ?? '' }}</td>
|
||||
<td>{{ $record['IR_Cool_B'] ?? '' }}</td>
|
||||
|
||||
<td>{{ $record['Frequency_After'] ?? '' }}</td>
|
||||
<td>{{ $record['Speed_After'] ?? '' }}</td>
|
||||
<td>{{ $record['Leakage_Current'] ?? '' }}</td>
|
||||
|
||||
{{-- LOCKED ROTOR TEST --}}
|
||||
<td>{{ $record['Voltage_Locked'] ?? '' }}</td>
|
||||
<td>{{ $record['Current_Locked'] ?? '' }}</td>
|
||||
<td>{{ $record['Power_Locked'] ?? '' }}</td>
|
||||
|
||||
{{-- OTHER FIELDS --}}
|
||||
<td>{{ $record['No_Load_Pickup_Voltage'] ?? '' }}</td>
|
||||
<td>{{ $record['Room_Temp'] ?? '' }}</td>
|
||||
<td>{{ $record['High_Voltage_Test'] ?? '' }}</td>
|
||||
<td>{{ $record['Result'] ?? '' }}</td>
|
||||
<td>{{ $record['Remark'] ?? '' }}</td>
|
||||
</tr>
|
||||
|
||||
@endforeach
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
213
resources/views/exports/export-three-phase-pdf.blade.php
Normal file
213
resources/views/exports/export-three-phase-pdf.blade.php
Normal file
@@ -0,0 +1,213 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
@page { size: A4 landscape; margin: 30px 8px 8px 8px; }
|
||||
body { font-family: Arial, sans-serif; font-size: 8px; }
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 8px;
|
||||
counter-reset: page;
|
||||
}
|
||||
|
||||
/* Page number fixed at top-right, slightly above the content */
|
||||
.page-number {
|
||||
position: fixed;
|
||||
top: -15px; /* Adjust as needed to appear above the border */
|
||||
right: 0;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.page-number:after {
|
||||
content: "Page " counter(page);
|
||||
}
|
||||
.header-table { width: 100%; border-collapse: collapse;}
|
||||
.header-table td { vertical-align: middle; border-collapse: collapse; border: 1px solid #222; }
|
||||
.company-title { font-size: 16px; font-weight: bold; text-align: center; }
|
||||
.company-subtitle { font-size: 12px; text-align: center; }
|
||||
.company-address { font-size: 10px; text-align: center; }
|
||||
.register-title { font-size: 12px; font-weight: bold; text-align: center; }
|
||||
.data-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
|
||||
.data-table th, .data-table td { border: 1px solid #222; padding: 2px 2px; text-align: center; font-size: 7px; }
|
||||
.data-table td:last-child {border-right: 1px solid #222 !important;}
|
||||
/* .highlight { color: #0072c6; font-weight: bold; } */
|
||||
thead { display: table-header-group; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table class="data-table">
|
||||
<tr>
|
||||
<td colspan="39" style="padding:0;">
|
||||
<table width="100%" style="border-collapse:collapse;">
|
||||
<tr>
|
||||
<td style="width:13%; text-align:left; border:none; border-bottom:1px solid #222;">
|
||||
<img src="{{ public_path('images/cripumps.logo.png') }}" alt="Left Logo" height="45" style="position: relative; left: 5mm;">
|
||||
</td>
|
||||
<td style="width:74%; border:none; border-bottom:1px solid #222;">
|
||||
<div class="company-title">C.R.I. Pumps Private Limited</div>
|
||||
<div class="company-subtitle">Unit : {{ $plant?->name ?? '' }}</div>
|
||||
<div class="company-address">{{ $plant?->address ?? '' }}</div>
|
||||
<div class="register-title">MOTOR FREE RUN TEST REGISTER</div>
|
||||
</td>
|
||||
{{-- <td style="width:13%; text-align:right; border:none; border-bottom:1px solid #222;">
|
||||
<img src="{{ public_path('images/isi_logo1.PNG') }}" alt="ISI Logo" height="35" style="position: relative; left: -20mm;">
|
||||
</td> --}}
|
||||
@php
|
||||
$showIsiLogo = $records->every(fn ($record) => $record['isi_model']);
|
||||
@endphp
|
||||
|
||||
@if ($showIsiLogo)
|
||||
<td style="width:13%; text-align:right; border:none; border-bottom:1px solid #222;">
|
||||
<img src="{{ public_path('images/isi_logo1.PNG') }}" alt="ISI Logo" height="35" style="position: relative; left: -20mm;">
|
||||
</td>
|
||||
@else
|
||||
<td style="width:13%; border:none; border-bottom:1px solid #222;"></td>
|
||||
@endif
|
||||
</tr>
|
||||
<tr>
|
||||
{{-- @php
|
||||
$firstRecord = $records->first();
|
||||
$kw = $firstRecord['kw'] ?? '-';
|
||||
$hp = $firstRecord['hp'] ?? '-';
|
||||
$phase = $firstRecord['phase'] ?? '-';
|
||||
@endphp --}}
|
||||
|
||||
@php
|
||||
$uniqueItemCodes = $records->pluck('Item Code')->unique();
|
||||
|
||||
//Default values
|
||||
$kw = '-';
|
||||
$hp = '-';
|
||||
$phase = '-';
|
||||
|
||||
// If there's exactly one unique item code, extract values from the first record
|
||||
if ($uniqueItemCodes->count() === 1) {
|
||||
$firstRecord = $records->first();
|
||||
$kw = $firstRecord['kw'] ?? '-';
|
||||
$hp = $firstRecord['hp'] ?? '-';
|
||||
$phase = $firstRecord['phase'] ?? '-';
|
||||
}
|
||||
@endphp
|
||||
<td colspan="3" style="text-align:left; font-size:10px; font-weight:bold; border:none; padding-left:230mm;">
|
||||
MOTOR KW / HP : {{ $kw }} / {{ $hp }} and PHASE : {{ $phase }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<thead>
|
||||
<!-- Table Column Headers -->
|
||||
<tr>
|
||||
<th rowspan="3">Date</th>
|
||||
<th rowspan="3">Output</th>
|
||||
<th rowspan="3">Motor SNo</th>
|
||||
<th rowspan="3">Item Code</th>
|
||||
<th rowspan="3">Motor Type</th>
|
||||
<th colspan="11">BEFORE FREE RUN</th>
|
||||
<th colspan="12">AFTER FREE RUN</th>
|
||||
<th colspan="3">LOCKED ROTOR TEST</th>
|
||||
<th rowspan="3">No Load Pickup Voltage (V)</th>
|
||||
<th rowspan="3">Room Temp. (°C)</th>
|
||||
<th rowspan="3">High Voltage Test (V)</th>
|
||||
<th rowspan="3">Batch Number</th>
|
||||
<th rowspan="3">Batch Count</th>
|
||||
<th rowspan="3">Result</th>
|
||||
<th rowspan="3">Remark</th>
|
||||
<th rowspan="3">Tested By</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th rowspan="2">Voltage (V)</th>
|
||||
<th rowspan="2">Current (A)</th>
|
||||
<th rowspan="2">Power (W)</th>
|
||||
<th colspan="3">Resistance (Ohm)</th>
|
||||
<th colspan="3">Insulation Resistance (Ohm)</th>
|
||||
<th rowspan="2">Frequency (Hz)</th>
|
||||
<th rowspan="2">Speed (Rpm)</th>
|
||||
|
||||
<th rowspan="2">Voltage (V)</th>
|
||||
<th rowspan="2">Current (A)</th>
|
||||
<th rowspan="2">Power (W)</th>
|
||||
<th colspan="3">IR.Hot (Ohm)</th>
|
||||
<th colspan="3">IR.Cool (Ohm)</th>
|
||||
<th rowspan="2">Frequency (Hz)</th>
|
||||
<th rowspan="2">Speed (Rpm)</th>
|
||||
|
||||
<th rowspan="2">Leakage Current (mA)</th>
|
||||
<th rowspan="2">Voltage (V)</th>
|
||||
<th rowspan="2">Current (A)</th>
|
||||
<th rowspan="2">Power (W)</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>RY</th>
|
||||
<th>YB</th>
|
||||
<th>BR</th>
|
||||
<th>R</th>
|
||||
<th>Y</th>
|
||||
<th>B</th>
|
||||
<th>R</th>
|
||||
<th>Y</th>
|
||||
<th>B</th>
|
||||
<th>R</th>
|
||||
<th>Y</th>
|
||||
<th>B</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($records as $record)
|
||||
<tr>
|
||||
<td>{{ $record['Date'] ?? '' }}</td>
|
||||
<td>{{ $record['Output'] ?? '' }}</td>
|
||||
<td>{{ $record['Motor SNo'] ?? '' }}</td>
|
||||
<td>{{ $record['Item Code'] ?? '' }}</td>
|
||||
<td>{{ $record['Motor Type'] ?? '' }}</td>
|
||||
|
||||
{{-- BEFORE FREE RUN --}}
|
||||
<td>{{ $record['Voltage_Before'] ?? '' }}</td>
|
||||
<td>{{ $record['Current_Before'] ?? '' }}</td>
|
||||
<td>{{ $record['Power_Before'] ?? '' }}</td>
|
||||
<td>{{ $record['Resistance_RY'] ?? '' }}</td>
|
||||
<td>{{ $record['Resistance_YB'] ?? '' }}</td>
|
||||
<td>{{ $record['Resistance_BR'] ?? '' }}</td>
|
||||
<td>{{ $record['Insulation_Resistance_R'] ?? '' }}</td>
|
||||
<td>{{ $record['Insulation_Resistance_Y'] ?? '' }}</td>
|
||||
<td>{{ $record['Insulation_Resistance_B'] ?? '' }}</td>
|
||||
<td>{{ $record['Frequency_Before'] ?? '' }}</td>
|
||||
<td>{{ $record['Speed_Before'] ?? '' }}</td>
|
||||
|
||||
{{-- AFTER FREE RUN --}}
|
||||
<td>{{ $record['Voltage_After'] ?? '' }}</td>
|
||||
<td>{{ $record['Current_After'] ?? '' }}</td>
|
||||
<td>{{ $record['Power_After'] ?? '' }}</td>
|
||||
<td>{{ $record['IR_Hot_R'] ?? '' }}</td>
|
||||
<td>{{ $record['IR_Hot_Y'] ?? '' }}</td>
|
||||
<td>{{ $record['IR_Hot_B'] ?? '' }}</td>
|
||||
<td>{{ $record['IR_Cool_R'] ?? '' }}</td>
|
||||
<td>{{ $record['IR_Cool_Y'] ?? '' }}</td>
|
||||
<td>{{ $record['IR_Cool_B'] ?? '' }}</td>
|
||||
<td>{{ $record['Frequency_After'] ?? '' }}</td>
|
||||
<td>{{ $record['Speed_After'] ?? '' }}</td>
|
||||
<td>{{ $record['Leakage_Current'] ?? '' }}</td>
|
||||
|
||||
{{-- LOCKED ROTOR TEST --}}
|
||||
<td>{{ $record['Voltage_Locked'] ?? '' }}</td>
|
||||
<td>{{ $record['Current_Locked'] ?? '' }}</td>
|
||||
<td>{{ $record['Power_Locked'] ?? '' }}</td>
|
||||
|
||||
{{-- Other Info --}}
|
||||
<td>{{ $record['No_Load_Pickup_Voltage'] ?? '' }}</td>
|
||||
<td>{{ $record['Room_Temp'] ?? '' }}</td>
|
||||
<td>{{ $record['High_Voltage_Test'] ?? '' }}</td>
|
||||
<td>{{ $record['Batch_Number'] ?? '' }}</td>
|
||||
<td>{{ $record['Batch_Count'] ?? '' }}</td>
|
||||
<td>{{ $record['Result'] ?? '' }}</td>
|
||||
<td>{{ $record['Remark'] ?? '' }}</td>
|
||||
<td>{{ $record['Tested_By'] ?? '' }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
231
resources/views/exports/testingpanel-pdf.blade.php
Normal file
231
resources/views/exports/testingpanel-pdf.blade.php
Normal file
@@ -0,0 +1,231 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
@page { size: A4 landscape; margin: 30px 8px 8px 8px; }
|
||||
body { font-family: Arial, sans-serif; font-size: 8px; }
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 8px;
|
||||
counter-reset: page;
|
||||
}
|
||||
|
||||
/* Page number fixed at top-right, slightly above the content */
|
||||
.page-number {
|
||||
position: fixed;
|
||||
top: -15px; /* Adjust as needed to appear above the border */
|
||||
right: 0;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.page-number:after {
|
||||
content: "Page " counter(page);
|
||||
}
|
||||
.header-table { width: 100%; border-collapse: collapse;}
|
||||
.header-table td { vertical-align: middle; border-collapse: collapse; border: 1px solid #222; }
|
||||
.company-title { font-size: 16px; font-weight: bold; text-align: center; }
|
||||
.company-subtitle { font-size: 12px; text-align: center; }
|
||||
.company-address { font-size: 10px; text-align: center; }
|
||||
.register-title { font-size: 12px; font-weight: bold; text-align: center; }
|
||||
.data-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
|
||||
.data-table th, .data-table td { border: 1px solid #222; padding: 2px 2px; text-align: center; font-size: 7px; }
|
||||
.data-table td:last-child {border-right: 1px solid #222 !important;}
|
||||
/* .highlight { color: #0072c6; font-weight: bold; } */
|
||||
thead { display: table-header-group; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="page-number"></div>
|
||||
<!-- Header Row with Logos and Company Info -->
|
||||
<table class="data-table">
|
||||
<tr>
|
||||
<td colspan="33" style="padding:0;">
|
||||
<table width="100%" style="border-collapse:collapse;">
|
||||
<tr>
|
||||
<td style="width:13%; text-align:left; border:none; border-bottom:1px solid #222;">
|
||||
<img src="{{ public_path('images/cripumps.logo.png') }}" alt="Left Logo" height="45" style="position: relative; left: 5mm;">
|
||||
</td>
|
||||
<td style="width:74%; border:none; border-bottom:1px solid #222;">
|
||||
<div class="company-title">C.R.I. Pumps Private Limited</div>
|
||||
<div class="company-subtitle">Unit : {{ $plant?->name ?? '' }}</div>
|
||||
<div class="company-address">{{ $plant?->address ?? '' }}</div>
|
||||
<div class="register-title">MOTOR FREE RUN TEST REGISTER</div>
|
||||
</td>
|
||||
{{-- <td style="width:13%; text-align:right; border:none; border-bottom:1px solid #222;">
|
||||
<img src="{{ public_path('images/isi_logo1.PNG') }}" alt="ISI Logo" height="35" style="position: relative; left: -20mm;">
|
||||
</td> --}}
|
||||
@php
|
||||
$showIsiLogo = $records->every(fn ($record) => $record['isi_model']);
|
||||
@endphp
|
||||
|
||||
@if ($showIsiLogo)
|
||||
<td style="width:13%; text-align:right; border:none; border-bottom:1px solid #222;">
|
||||
<img src="{{ public_path('images/isi_logo1.PNG') }}" alt="ISI Logo" height="35" style="position: relative; left: -20mm;">
|
||||
</td>
|
||||
@else
|
||||
<td style="width:13%; border:none; border-bottom:1px solid #222;"></td>
|
||||
@endif
|
||||
</tr>
|
||||
<tr>
|
||||
{{-- @php
|
||||
$firstRecord = $records->first();
|
||||
$kw = $firstRecord['kw'] ?? '-';
|
||||
$hp = $firstRecord['hp'] ?? '-';
|
||||
$phase = $firstRecord['phase'] ?? '-';
|
||||
@endphp --}}
|
||||
|
||||
@php
|
||||
$uniqueItemCodes = $records->pluck('Item Code')->unique();
|
||||
|
||||
//Default values
|
||||
$kw = '-';
|
||||
$hp = '-';
|
||||
$phase = '-';
|
||||
|
||||
// If there's exactly one unique item code, extract values from the first record
|
||||
if ($uniqueItemCodes->count() === 1) {
|
||||
$firstRecord = $records->first();
|
||||
$kw = $firstRecord['kw'] ?? '-';
|
||||
$hp = $firstRecord['hp'] ?? '-';
|
||||
$phase = $firstRecord['phase'] ?? '-';
|
||||
}
|
||||
@endphp
|
||||
<td colspan="3" style="text-align:left; font-size:10px; font-weight:bold; border:none; padding-left:230mm;">
|
||||
MOTOR KW / HP : {{ $kw }} / {{ $hp }} and PHASE : {{ $phase }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- Combine first 5 columns into one cell with rowspan 4 -->
|
||||
<th rowspan="4">Date</th>
|
||||
<th rowspan="4">Output</th>
|
||||
<th rowspan="4">Motor SNo</th>
|
||||
<th rowspan="4">Item Code</th>
|
||||
<th rowspan="4">Motor Type</th>
|
||||
|
||||
<!-- Grouped columns -->
|
||||
<th colspan="9">BEFORE FREE RUN</th>
|
||||
<th colspan="8">AFTER FREE RUN</th>
|
||||
<th colspan="3">LOCKED ROTOR TEST</th>
|
||||
|
||||
<!-- Last 8 columns with rowspan 4 -->
|
||||
<th rowspan="4">No Load Pickup Voltage</th>
|
||||
<th rowspan="4">Room Temp.</th>
|
||||
<th rowspan="4">High Voltage Test</th>
|
||||
<th rowspan="4">Batch Number</th>
|
||||
<th rowspan="4">Batch Count</th>
|
||||
<th rowspan="4">Result</th>
|
||||
<th rowspan="4">Remark</th>
|
||||
<th rowspan="4">Tested By</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<!-- BEFORE FREE RUN -->
|
||||
<th rowspan="2">Voltage</th>
|
||||
<th rowspan="2">Current</th>
|
||||
<th rowspan="2">Power</th>
|
||||
<th colspan="3">Resistance</th>
|
||||
<th rowspan="2">Insulation Resistance</th>
|
||||
<th rowspan="2">Frequency</th>
|
||||
<th rowspan="2">Speed</th>
|
||||
|
||||
<!-- AFTER FREE RUN -->
|
||||
<th rowspan="2">Voltage</th>
|
||||
<th rowspan="2">Current</th>
|
||||
<th rowspan="2">Power</th>
|
||||
<th rowspan="2">IR.Hot</th>
|
||||
<th rowspan="2">IR.Cool</th>
|
||||
<th rowspan="2">Frequency</th>
|
||||
<th rowspan="2">Speed</th>
|
||||
<th rowspan="2">Leakage Current</th>
|
||||
|
||||
<!-- LOCKED ROTOR TEST -->
|
||||
<th rowspan="2">Voltage</th>
|
||||
<th rowspan="2">Current</th>
|
||||
<th rowspan="2">Power</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>RY</th>
|
||||
<th>YB</th>
|
||||
<th>BR</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>(V)</th>
|
||||
<th>(A)</th>
|
||||
<th>(W)</th>
|
||||
<th>(Ohm)</th>
|
||||
<th>(Ohm)</th>
|
||||
<th>(Ohm)</th>
|
||||
<th>(Ohm)</th>
|
||||
<th>(Hz)</th>
|
||||
<th>(Rpm)</th>
|
||||
|
||||
<th>(V)</th>
|
||||
<th>(A)</th>
|
||||
<th>(W)</th>
|
||||
<th>(Ohm)</th>
|
||||
<th>(Ohm)</th>
|
||||
<th>(Hz)</th>
|
||||
<th>(Rpm)</th>
|
||||
<th>(mA)</th>
|
||||
|
||||
<th>(V)</th>
|
||||
<th>(A)</th>
|
||||
<th>(W)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@foreach($records as $record)
|
||||
<tr>
|
||||
|
||||
<td>{{ $record['Date'] ?? '' }}</td>
|
||||
<td>{{ $record['Output'] ?? '' }}</td>
|
||||
<td>{{ $record['Motor SNo'] ?? '' }}</td>
|
||||
<td>{{ $record['Item Code'] ?? '' }}</td>
|
||||
<td>{{ $record['Motor Type'] ?? '' }}</td>
|
||||
|
||||
{{-- BEFORE FREE RUN --}}
|
||||
|
||||
<td>{{ $record['Voltage_Before'] ?? '' }}</td>
|
||||
<td>{{ $record['Current_Before'] ?? '' }}</td>
|
||||
<td>{{ $record['Power_Before'] ?? '' }}</td>
|
||||
<td>{{ $record['Resistance_RY'] ?? '' }}</td>
|
||||
<td>{{ $record['Resistance_YB'] ?? '' }}</td>
|
||||
<td>{{ $record['Resistance_BR'] ?? '' }}</td>
|
||||
<td>{{ $record['Insulation_BBR'] ?? '' }}</td>
|
||||
<td>{{ $record['Frequency_Before'] ?? '' }}</td>
|
||||
<td>{{ $record['Speed_Before'] ?? '' }}</td>
|
||||
|
||||
{{-- AFTER FREE RUN --}}
|
||||
<td>{{ $record['Voltage_After'] ?? '' }}</td>
|
||||
<td>{{ $record['Current_After'] ?? '' }}</td>
|
||||
<td>{{ $record['Power_After'] ?? '' }}</td>
|
||||
<td>{{ $record['IR_Hot'] ?? '' }}</td>
|
||||
<td>{{ $record['IR_Cool'] ?? '' }}</td>
|
||||
<td>{{ $record['Frequency_After'] ?? '' }}</td>
|
||||
<td>{{ $record['Speed_After'] ?? '' }}</td>
|
||||
<td>{{ $record['Leakage_Current'] ?? '' }}</td>
|
||||
|
||||
{{-- LOCKED ROTOR TEST --}}
|
||||
<td>{{ $record['Voltage_Locked'] ?? '' }}</td>
|
||||
<td>{{ $record['Current_Locked'] ?? '' }}</td>
|
||||
<td>{{ $record['Power_Locked'] ?? '' }}</td>
|
||||
|
||||
{{-- Other Info --}}
|
||||
<td>{{ $record['No_Load_Pickup_Voltage'] ?? '' }}</td>
|
||||
<td>{{ $record['Room_Temp'] ?? '' }}</td>
|
||||
<td>{{ $record['High_Voltage_Test'] ?? '' }}</td>
|
||||
<td>{{ $record['Batch_Number'] ?? '' }}</td>
|
||||
<td>{{ $record['Batch_Count'] ?? '' }}</td>
|
||||
<td>{{ $record['Result'] ?? '' }}</td>
|
||||
<td>{{ $record['Remark'] ?? '' }}</td>
|
||||
<td>{{ $record['Tested_By'] ?? '' }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\ObdController;
|
||||
use App\Http\Controllers\TestingPanelController;
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
@@ -34,11 +35,13 @@ use Illuminate\Support\Facades\Route;
|
||||
// });
|
||||
|
||||
|
||||
Route::post('obd/store-data', [ObdController::class, 'store'])
|
||||
->withoutMiddleware(VerifyCsrfToken::class);
|
||||
Route::post('obd/store-data', [ObdController::class, 'store']);
|
||||
|
||||
Route::post('obd/store-test-data', [ObdController::class, 'test'])
|
||||
->withoutMiddleware(VerifyCsrfToken::class);
|
||||
Route::post('obd/store-test-datas', [ObdController::class, 'test']);//->withoutMiddleware(VerifyCsrfToken::class)
|
||||
|
||||
Route::get('obd/store-data/get', [ObdController::class, 'get_obd']);
|
||||
|
||||
Route::post('testing/reading/store-data', [TestingPanelController::class, 'store']);
|
||||
|
||||
Route::get('testing/item/get-master-data', [TestingPanelController::class, 'get_motor_master']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user