Compare commits
261 Commits
ranjith-de
...
78987f1430
| Author | SHA1 | Date | |
|---|---|---|---|
| 78987f1430 | |||
| a16ae0ca16 | |||
| 5ee964b5f7 | |||
| de1bf16ace | |||
| a1f5fa0457 | |||
| b7b6ab6c77 | |||
| 32b86b4289 | |||
| c33db6b934 | |||
| 4807c572eb | |||
| 252014bd51 | |||
| e1d5793922 | |||
| 56152816e2 | |||
| 8b2d4c4faf | |||
| 0430d605e7 | |||
| 0decbc6e29 | |||
| 9aa727cc36 | |||
| 22ece583b7 | |||
| 8c90d1fc03 | |||
| 5e68debd87 | |||
| 855e9f91c8 | |||
| 6d088471bf | |||
| f167b732c0 | |||
| 4264c5493c | |||
| 61774d240a | |||
| ae01370107 | |||
| f3389399eb | |||
| c18a07853e | |||
| 555f810c0f | |||
| 2e5d185be1 | |||
| 0ece1d0dd6 | |||
| e145560920 | |||
| e02052e536 | |||
| 39e40e011f | |||
| 7184eda58c | |||
| 3c4b419078 | |||
| 7ba5375386 | |||
| c3324caa08 | |||
| ace14124f3 | |||
| c68a45ef8d | |||
| 3edd8fafc6 | |||
| 2c66f2e6bd | |||
| e791176500 | |||
| 1eddecc660 | |||
| 379e8fc8f9 | |||
| b018ef48d7 | |||
| e45c166345 | |||
| d53d3dedbb | |||
| 18e74f4a52 | |||
| 16c525773b | |||
| 501cd541b9 | |||
| 62e14fb3c3 | |||
| 78f4929e27 | |||
| b674966886 | |||
| 103515a387 | |||
| dd182c6504 | |||
| 1fed559feb | |||
| 312de66a1c | |||
| 7d8a891f95 | |||
| 557c367f4c | |||
| cef3e17dc7 | |||
| f89ad49eff | |||
| c9006ee0a1 | |||
| 2fa58b587e | |||
| bb0a684366 | |||
| 16b1802412 | |||
| 079ed2eba6 | |||
| f1f6b596a4 | |||
| b2aa572994 | |||
| 44bdcba615 | |||
| 76a5379c02 | |||
| eeeec722ee | |||
| d8a4ddf6e9 | |||
| 9493bf5edf | |||
| feab063017 | |||
| b2f5194ef9 | |||
| 3a3322ccc4 | |||
| 7a9dac239d | |||
| 77d98b16fb | |||
| a2554fb4a9 | |||
| 353774b184 | |||
| 29fecaea3d | |||
| a35185e4b1 | |||
| f07ba9dd00 | |||
| 2a7f48cc75 | |||
| c7f4f49669 | |||
| 2e9a52a890 | |||
| 3c34495048 | |||
| b70907cb9f | |||
| 9ee4fe5c7e | |||
| 6f06319752 | |||
| 785be70629 | |||
| e5cb7f3d88 | |||
| 1dbbd53fc9 | |||
| 04d0c2dc82 | |||
| 048977a44b | |||
| 8395599d9d | |||
| 9a7b42dea5 | |||
| 0ce59ebe22 | |||
| c032cdc58d | |||
| 4074374614 | |||
| 15712c44b6 | |||
| 99f7450e5e | |||
| f6f6f0924e | |||
| 3bab0310a1 | |||
| 6924990ace | |||
| ba0b2c2709 | |||
| 51416cdf37 | |||
| a8ff5b5120 | |||
| 4ca965ccb1 | |||
| 22cbb6c4d3 | |||
| 6db07e1825 | |||
| 1bc0a4b01d | |||
| dc77a51c3c | |||
| b07a9596e5 | |||
| b96a54aae5 | |||
| fe0e1e139e | |||
| a95766fd45 | |||
| d5d5a6d193 | |||
| 25125cfead | |||
| d6c6cf0c69 | |||
| 99a95dc150 | |||
| 6d26307c4a | |||
| 8703aec73e | |||
| f8691500cf | |||
| 12f9cb683f | |||
| 73c26a649a | |||
| 80f6aeb3d6 | |||
| f633285a57 | |||
| 841922a4b3 | |||
| 3a819737cb | |||
| 18f60ec336 | |||
| 4ab7be97bb | |||
| a643bce1c2 | |||
| 45392419cd | |||
| 7b300f63d2 | |||
| 650314a435 | |||
| eaefffd51b | |||
| 084d9b04f1 | |||
| 75a3a8641c | |||
| f7f1d3a855 | |||
| f00fc8b4d7 | |||
| 73eb79a8d0 | |||
| 5856fe64c1 | |||
| 4615e45c74 | |||
| 486b94bb79 | |||
| 71eda460bd | |||
| 938f9b9fdf | |||
| 648551c619 | |||
| 308e68b79a | |||
| 5b9cb33a63 | |||
| 8b57518408 | |||
| 4b68133bf1 | |||
| a52fc9580a | |||
| 94819ccc4f | |||
| 6e51b9fba8 | |||
| 0a66526a63 | |||
| 0398cd5262 | |||
| cca6fbe428 | |||
| 633c8c89ca | |||
| 543ab7f44f | |||
| 09aeff2b96 | |||
| 2f3973f6af | |||
| 7f76a604a3 | |||
| 837ac47120 | |||
| e6fb2c1bae | |||
| a687b8af3b | |||
| cd45e6658a | |||
| 0b221c5eae | |||
| 8c062505c9 | |||
| 9411d0b33b | |||
| ab3a2047bb | |||
| f0ef2dda8e | |||
| 968d67d808 | |||
| 2342c6003d | |||
| 290d218a0d | |||
| c455c76715 | |||
| a1abe537c3 | |||
| c65265e68e | |||
| 3da016ae49 | |||
| ea17636670 | |||
| 31b56ae9b2 | |||
| 9517b38f9b | |||
| 2c1caa40a3 | |||
| c3fef2f3a0 | |||
| 904e18e63a | |||
| 27dc2690ca | |||
| 8e1c4f46e8 | |||
| d699c043d4 | |||
| 1806f32a7b | |||
| eb2ae19641 | |||
| 2dbcc8b859 | |||
| 79e3427cdb | |||
| 81a5fa16c4 | |||
| 6520c3ca87 | |||
| 2e167c75b0 | |||
| aca5d6c957 | |||
| 9edbaf3d43 | |||
| a46aaa72a2 | |||
| d917aa530d | |||
| 45944c5c25 | |||
| fda672948b | |||
| f15e6451ca | |||
| c8aac9116d | |||
| bcd107a8bc | |||
| 458e143b9a | |||
| de2dda0dc5 | |||
| 7543f8a416 | |||
| f76316ec91 | |||
| acea7b14a6 | |||
| 87f49e8491 | |||
| f612551288 | |||
| 4f84735eaf | |||
| 45b8c1fbb4 | |||
| 6015968043 | |||
| 2bc8584e7a | |||
| d126e931c8 | |||
| 62bf68ad2e | |||
| c6c63dcb35 | |||
| d1663ae58a | |||
| deb46cdda2 | |||
| 002bdc597d | |||
| a406d1b58a | |||
| 58d0b9f0ae | |||
| c0d8ca7b1e | |||
| f31ab62ec0 | |||
| 4285a31f94 | |||
| 0c9228bfec | |||
| 58b45c849d | |||
| 61a2e7ffad | |||
| 3779cf3e3b | |||
| acf955dd94 | |||
| 0de49f14ce | |||
| 0473ca33cf | |||
| 8a01033459 | |||
| 0555f9faff | |||
| 8cbbaa4845 | |||
| cb6b201648 | |||
| c3089a147c | |||
| 45f0e39f73 | |||
| fe1e1b9918 | |||
| e20915ca82 | |||
| 58e6cbfac0 | |||
| 1ace049687 | |||
| e5e85a8eea | |||
| 555802ab35 | |||
| 587b743f12 | |||
| 42555d4a81 | |||
| fd1e554076 | |||
| 022654f192 | |||
| 55f1088fda | |||
| f9233f44d8 | |||
| e0fec6b07c | |||
| 6bda9c1459 | |||
| 39bdd3df57 | |||
| 5bcf0703d9 | |||
| 80e522b7e6 | |||
| ee101f80ea | |||
| 37a99d03c1 | |||
| 5fdced003a | |||
| 0b0bb90efb | |||
| 32ce6da2c1 |
@@ -211,7 +211,7 @@ class Scheduler extends Command
|
||||
}
|
||||
break;
|
||||
case 'Daily':
|
||||
if (now()->format('H:i') == '11:00') {
|
||||
if (now()->format('H:i') == '10:45') {
|
||||
try {
|
||||
\Artisan::call('send:invoice-transit-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
|
||||
@@ -44,8 +44,6 @@ class InvoiceValidationExporter extends Exporter
|
||||
->label('CAPACITOR SCANNED STATUS'),
|
||||
ExportColumn::make('scanned_status')
|
||||
->label('SCANNED STATUS'),
|
||||
ExportColumn::make('panel_box_code')
|
||||
->label('PANEL BOX CODE'),
|
||||
ExportColumn::make('panel_box_supplier')
|
||||
->label('PANEL BOX SUPPLIER'),
|
||||
ExportColumn::make('panel_box_serial_number')
|
||||
@@ -63,13 +61,9 @@ class InvoiceValidationExporter extends Exporter
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
// ->dateTimeFormat('d-m-Y H:i:s'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
// ->dateTimeFormat('d-m-Y H:i:s'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
|
||||
@@ -18,7 +18,7 @@ class UserImporter extends Importer
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('plant_id')
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Code')
|
||||
->example('1000')
|
||||
@@ -54,13 +54,10 @@ class UserImporter extends Importer
|
||||
public function resolveRecord(): ?User
|
||||
{
|
||||
$warnMsg = [];
|
||||
$plantCod = $this->data['plant_id'];
|
||||
$plantCod = $this->data['plant'];
|
||||
$plant = null;
|
||||
if (Str::length($plantCod) > 0 && (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod))) {
|
||||
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
|
||||
$warnMsg[] = 'Invalid plant code found!';
|
||||
} elseif (Str::length($plantCod) <= 0) {
|
||||
$plant = null;
|
||||
$plantCod = null;
|
||||
} else {
|
||||
$plant = Plant::where('code', $plantCod)->first();
|
||||
if (! $plant) {
|
||||
|
||||
@@ -7,11 +7,13 @@ use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class Welcome extends Page
|
||||
{
|
||||
protected static ?string $navigationIcon = 'heroicon-s-gift'; // 'heroicon-o-document-text';
|
||||
protected static ?string $navigationIcon = 'heroicon-o-document-text';
|
||||
|
||||
protected static string $view = 'filament.pages.welcome';
|
||||
|
||||
public function getHeading(): string
|
||||
|
||||
|
||||
public function getHeading(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -65,65 +65,41 @@ class CharacteristicApproverMasterResource extends Resource
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('characteristic_field')
|
||||
->label('Master Characteristic Field')
|
||||
->columnSpan(2)
|
||||
->required()
|
||||
->default('NIL')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('machine_name')
|
||||
->label('Machine')
|
||||
->columnSpan(2)
|
||||
->reactive()
|
||||
->required()
|
||||
->minLength(5)
|
||||
->default(function () {
|
||||
return optional(CharacteristicApproverMaster::latest()->first())->machine_name ?? '';
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('characteristic_field')
|
||||
->label('Master Characteristic Field')
|
||||
->columnSpan(2)
|
||||
->reactive()
|
||||
->required()
|
||||
->minLength(1)
|
||||
->default('NIL')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
if (strtolower($state) == 'nil' || $state == '' || $state == null) {
|
||||
$set('characteristic_field', 'NIL');
|
||||
}
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Section::make('Approver - 1')
|
||||
// ->description('Prevent abuse by limiting the number of requests per period')
|
||||
->columnSpan(['default' => 2, 'sm' => 4])
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name1')
|
||||
->label('Name')
|
||||
->reactive()
|
||||
->required()
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('mail1')
|
||||
->label('Mail ID')
|
||||
->label('Mail')
|
||||
->columnSpan(['default' => 1, 'sm' => 2])
|
||||
->reactive()
|
||||
->required()
|
||||
->suffixIcon('heroicon-m-envelope')
|
||||
->suffixIconColor('primary')
|
||||
->email()
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('duration1')
|
||||
->label('Duration (HH.MM)')
|
||||
->reactive()
|
||||
->required()
|
||||
->minLength(4)
|
||||
->maxLength(5)
|
||||
->regex('/^([0-9]|0[0-9]|1[0-9]|2[0-3])\.(0[0-9]|[1-5][0-9])$/')
|
||||
->validationMessages([
|
||||
// 'regex' => 'Duration must be 4 digits in HH.MM format (e.g., 12.30, 23.59). Hours: 00-23, Minutes: 00-59.',
|
||||
'regex' => 'Duration must be HH.MM format (example: 00.00 - 23.59)',
|
||||
// 'length' => 'Duration must be exactly 5 characters',
|
||||
])
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
@@ -135,28 +111,17 @@ class CharacteristicApproverMasterResource extends Resource
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name2')
|
||||
->label('Name')
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('mail2')
|
||||
->label('Mail ID')
|
||||
->label('Mail')
|
||||
->columnSpan(['default' => 1, 'sm' => 2])
|
||||
->reactive()
|
||||
->suffixIcon('heroicon-m-envelope')
|
||||
->suffixIconColor('primary')
|
||||
->email()
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('duration2')
|
||||
->label('Duration (HH.MM)')
|
||||
->reactive()
|
||||
->length(4)
|
||||
->regex('/^([0-9]|0[0-9]|1[0-9]|2[0-3])\.(0[0-9]|[1-5][0-9])$/')
|
||||
->validationMessages([
|
||||
'regex' => 'Duration must be HH.MM format (example: 00.00 - 23.59)',
|
||||
])
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
@@ -168,28 +133,17 @@ class CharacteristicApproverMasterResource extends Resource
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name3')
|
||||
->label('Name')
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('mail3')
|
||||
->label('Mail ID')
|
||||
->label('Mail')
|
||||
->columnSpan(['default' => 1, 'sm' => 2])
|
||||
->reactive()
|
||||
->suffixIcon('heroicon-m-envelope')
|
||||
->suffixIconColor('primary')
|
||||
->email()
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('duration3')
|
||||
->label('Duration (HH.MM)')
|
||||
->reactive()
|
||||
->length(4)
|
||||
->regex('/^([0-9]|0[0-9]|1[0-9]|2[0-3])\.(0[0-9]|[1-5][0-9])$/')
|
||||
->validationMessages([
|
||||
'regex' => 'Duration must be HH.MM format (example: 00.00 - 23.59)',
|
||||
])
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
@@ -251,7 +205,7 @@ class CharacteristicApproverMasterResource extends Resource
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('mail1')
|
||||
->label('E-Mail 1')
|
||||
->label('Mail 1')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
@@ -265,7 +219,7 @@ class CharacteristicApproverMasterResource extends Resource
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('mail2')
|
||||
->label('E-Mail 2')
|
||||
->label('Mail 2')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
@@ -279,7 +233,7 @@ class CharacteristicApproverMasterResource extends Resource
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('mail3')
|
||||
->label('E-Mail 3')
|
||||
->label('Mail 3')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
@@ -67,7 +67,7 @@ class InvoiceValidationResource extends Resource
|
||||
->options(function (callable $get) {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||
})
|
||||
->default(function () {
|
||||
return optional(InvoiceValidation::latest()->first())->plant_id;
|
||||
@@ -77,7 +77,7 @@ class InvoiceValidationResource extends Resource
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
$set('update_invoice', null);
|
||||
|
||||
// Ensure `linestop_id` is not cleared
|
||||
if (! $plantId) {
|
||||
$set('invoice_number', null);
|
||||
$set('serial_number', null);
|
||||
@@ -87,11 +87,6 @@ class InvoiceValidationResource extends Resource
|
||||
|
||||
return;
|
||||
} else {
|
||||
$plantCode = Plant::find($plantId)?->code ?? null;
|
||||
$directory = "uploads/temp/{$plantCode}";
|
||||
if (! Storage::disk('local')->exists($directory)) {
|
||||
Storage::disk('local')->makeDirectory($directory);
|
||||
}
|
||||
$set('ivPlantError', null);
|
||||
}
|
||||
})
|
||||
@@ -212,14 +207,6 @@ class InvoiceValidationResource extends Resource
|
||||
Forms\Components\TextInput::make('id')
|
||||
->hidden()
|
||||
->readOnly(true),
|
||||
// Forms\Components\Hidden::make('created_by')
|
||||
// ->label('Created By')
|
||||
// ->default(Filament::auth()->user()?->name)
|
||||
// ->reactive(),
|
||||
// Forms\Components\Hidden::make('updated_by')
|
||||
// ->label('Updated By')
|
||||
// ->default(Filament::auth()->user()?->name)
|
||||
// ->reactive(),
|
||||
])
|
||||
->columns(5),
|
||||
]);
|
||||
@@ -275,11 +262,9 @@ class InvoiceValidationResource extends Resource
|
||||
Tables\Columns\TextColumn::make('scanned_status')
|
||||
->label('Scanned Status')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('panel_box_code')// stickerMaster.panel_box_code
|
||||
->label('Panel Box Code')
|
||||
->alignCenter()
|
||||
->sortable(), // ->searchable()
|
||||
// ->toggleable(isToggledHiddenByDefault: true),
|
||||
// Tables\Columns\TextColumn::make('stickerMaster.panel_box_code')
|
||||
// ->label('Panel Box Code')
|
||||
// ->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('panel_box_supplier')
|
||||
->label('Panel Box Supplier')
|
||||
->alignCenter(),
|
||||
@@ -304,20 +289,11 @@ class InvoiceValidationResource extends Resource
|
||||
->label('Plant')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_by')
|
||||
->label('Created By')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('updated_by')
|
||||
->label('Updated By')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->dateTime()
|
||||
@@ -356,7 +332,7 @@ class InvoiceValidationResource extends Resource
|
||||
->options(function (callable $get) {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||
})
|
||||
->label('Select Plant')
|
||||
->required()
|
||||
@@ -365,37 +341,19 @@ class InvoiceValidationResource extends Resource
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('invoice_serial_number', null);
|
||||
$plantId = $get('plant_id');
|
||||
$plantCode = Plant::find($plantId)?->code ?? null;
|
||||
|
||||
$directory = "uploads/temp/{$plantCode}";
|
||||
if ($plantId && ! Storage::disk('local')->exists($directory)) {
|
||||
Storage::disk('local')->makeDirectory($directory);
|
||||
}
|
||||
})
|
||||
->reactive(),
|
||||
|
||||
FileUpload::make('invoice_serial_number')
|
||||
->label('Invoice Serial Number')
|
||||
->required()
|
||||
->acceptedFileTypes([
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'application/vnd.ms-excel', // Legacy .xls fallback if needed
|
||||
])
|
||||
->rules(['mimes:xlsx']) // Laravel validation: extension check
|
||||
// ->required()
|
||||
->preserveFilenames() // <- this keeps the original filename
|
||||
->reactive()
|
||||
->storeFiles(false) // prevent auto-storing, we will store manually
|
||||
->reactive()
|
||||
->required()
|
||||
->disk('local') // 'local' refers to the local storage disk defined in config/filesystems.php, typically pointing to storage/app.
|
||||
->visible(fn (Get $get) => ! empty($get('plant_id')))
|
||||
->directory(function (callable $get) {
|
||||
$plant = Plant::find($get('plant_id'));
|
||||
$plantCode = $plant?->code ?? null;
|
||||
|
||||
return "uploads/temp/{$plantCode}";
|
||||
})
|
||||
->uploadingMessage('Uploading...')
|
||||
->helperText('Only .xlsx files are allowed (Excel files).'),
|
||||
->directory('uploads/temp'),
|
||||
])
|
||||
->action(function (array $data) {
|
||||
$uploadedFile = $data['invoice_serial_number'];
|
||||
@@ -404,40 +362,17 @@ class InvoiceValidationResource extends Resource
|
||||
|
||||
$plantId = $data['plant_id'];
|
||||
|
||||
$plant = Plant::find($plantId);
|
||||
$plantCode = $plant?->code ?? null;
|
||||
|
||||
// Get original filename
|
||||
$originalName = $uploadedFile->getClientOriginalName(); // e.g. 3RA0018732.xlsx
|
||||
|
||||
$extension = strtolower(pathinfo($originalName, PATHINFO_EXTENSION));
|
||||
if ($extension !== 'xlsx') {
|
||||
throw new \Exception('Only .xlsx files allowed.');
|
||||
}
|
||||
|
||||
$originalNameOnly = pathinfo($originalName, PATHINFO_FILENAME);
|
||||
|
||||
$originalName = "{$originalNameOnly}.xlsx";
|
||||
|
||||
// Store manually using storeAs to keep original name
|
||||
$path = $uploadedFile->storeAs("uploads/temp/{$plantCode}", $originalName, 'local'); // returns relative path
|
||||
// uploads/temp/{$plantCode}/3RA0018735.xlsx
|
||||
|
||||
if (strlen($originalNameOnly) < 8 || ! ctype_alnum($originalNameOnly)) {
|
||||
Notification::make()
|
||||
->title("Serial invoice number : '$originalNameOnly' should contain minimum 8 digit alpha numeric values!")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
$path = $uploadedFile->storeAs('uploads/temp', $originalName, 'local'); // returns relative path
|
||||
// uploads/temp/3RA0018735.xlsx
|
||||
|
||||
$fullPath = Storage::disk('local')->path($path);
|
||||
// /home/iot-dev/projects/pds/storage/app/private/uploads/temp/{$plantCode}/3RA0018735.xlsx
|
||||
// /home/iot-dev/projects/pds/storage/app/private/uploads/temp/3RA0018735.xlsx
|
||||
|
||||
$totQuan = InvoiceValidation::where('invoice_number', $originalNameOnly)->count();
|
||||
if ($totQuan > 0) {
|
||||
@@ -702,7 +637,7 @@ class InvoiceValidationResource extends Resource
|
||||
->options(function (callable $get) {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||
})
|
||||
->label('Select Plant')
|
||||
->required()
|
||||
@@ -711,68 +646,32 @@ class InvoiceValidationResource extends Resource
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('invoice_material', null);
|
||||
$plantId = $get('plant_id');
|
||||
$plantCode = Plant::find($plantId)?->code ?? null;
|
||||
|
||||
$directory = "uploads/temp/{$plantCode}";
|
||||
if ($plantId && ! Storage::disk('local')->exists($directory)) {
|
||||
Storage::disk('local')->makeDirectory($directory);
|
||||
}
|
||||
})
|
||||
->reactive(),
|
||||
|
||||
FileUpload::make('invoice_material')
|
||||
->label('Invoice Material')
|
||||
->required()
|
||||
->preserveFilenames() // <- this keeps the original filename
|
||||
->reactive()
|
||||
->preserveFilenames()
|
||||
->reactive() // <- this keeps the original filename
|
||||
->storeFiles(false) // prevent auto-storing
|
||||
->disk('local')
|
||||
->visible(fn (Get $get) => ! empty($get('plant_id')))
|
||||
->directory(function (callable $get) {
|
||||
$plant = Plant::find($get('plant_id'));
|
||||
$plantCode = $plant?->code ?? null;
|
||||
|
||||
return "uploads/temp/{$plantCode}";
|
||||
})
|
||||
->helperText('Only .xlsx files are allowed (Excel files).'),
|
||||
->directory('uploads/temp'),
|
||||
])
|
||||
->action(function (array $data) {
|
||||
$uploadedFile = $data['invoice_material'];
|
||||
|
||||
$plantId = $data['plant_id']; // Access the selected plant_id
|
||||
|
||||
$plant = Plant::find($plantId);
|
||||
$plantCode = $plant?->code ?? null;
|
||||
|
||||
$disk = Storage::disk('local');
|
||||
|
||||
// Get original filename
|
||||
$originalName = $uploadedFile->getClientOriginalName();
|
||||
|
||||
$extension = strtolower(pathinfo($originalName, PATHINFO_EXTENSION));
|
||||
if ($extension !== 'xlsx') {
|
||||
throw new \Exception('Only .xlsx files allowed.');
|
||||
}
|
||||
|
||||
$originalNameOnly = pathinfo($originalName, PATHINFO_FILENAME);
|
||||
|
||||
$originalName = "{$originalNameOnly}.xlsx";
|
||||
|
||||
$path = $uploadedFile->storeAs("uploads/temp/{$plantCode}", $originalName, 'local');
|
||||
|
||||
if (strlen($originalNameOnly) < 8 || ! ctype_alnum($originalNameOnly)) {
|
||||
Notification::make()
|
||||
->title("Material invoice number : '$originalNameOnly' should contain minimum 8 digit alpha numeric values!")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
$path = $uploadedFile->storeAs('uploads/temp', $originalName, 'local');
|
||||
|
||||
$fullPath = Storage::disk('local')->path($path);
|
||||
|
||||
@@ -1174,7 +1073,7 @@ class InvoiceValidationResource extends Resource
|
||||
->options(function (callable $get) {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
||||
|
||||
@@ -117,8 +117,8 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
|
||||
$this->plantId = $plantId;
|
||||
|
||||
$plant = Plant::find($plantId);
|
||||
$plantCode = $plant?->code ?? null;
|
||||
// $plant = Plant::find($plantId);
|
||||
// $plantCode = $plant ? $plant->code : null;
|
||||
|
||||
// ..GET SERIAL INVOICE API
|
||||
|
||||
@@ -233,7 +233,7 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
$this->dispatch('playNotificationSound');
|
||||
|
||||
$filename = $invoiceNumber.'.xlsx';
|
||||
$directory = "uploads/temp/{$plantCode}";
|
||||
$directory = 'uploads/temp';
|
||||
$disk = Storage::disk('local');
|
||||
$filePath = $directory.'/'.$filename;
|
||||
// $fullPath = null;
|
||||
@@ -266,7 +266,7 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
if ($updateStatus == '1') {
|
||||
// 'Material invoice update in progress...';
|
||||
$filename = $invoiceNumber.'.xlsx';
|
||||
$directory = "uploads/temp/{$plantCode}";
|
||||
$directory = 'uploads/temp';
|
||||
$disk = Storage::disk('local');
|
||||
$filePath = $directory.'/'.$filename;
|
||||
$fullPath = $disk->path($filePath);
|
||||
@@ -613,8 +613,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
'invoice_number' => $invoiceNumber,
|
||||
'quantity' => 1,
|
||||
'operator_id' => $operatorName,
|
||||
'created_by' => $operatorName,
|
||||
'updated_by' => $operatorName,
|
||||
]);
|
||||
$inserted++;
|
||||
}
|
||||
@@ -655,8 +653,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
'invoice_number' => $invoiceNumber,
|
||||
'quantity' => $bundleQty,
|
||||
'operator_id' => $operatorName,
|
||||
'created_by' => $operatorName,
|
||||
'updated_by' => $operatorName,
|
||||
]);
|
||||
$inserted++;
|
||||
}
|
||||
@@ -720,7 +716,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
$existEmpRecQty->update([
|
||||
'quantity' => $newInsQty,
|
||||
'operator_id' => $operatorName,
|
||||
'updated_by' => $operatorName,
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
$newQuan--;
|
||||
@@ -732,8 +727,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
'invoice_number' => $invoiceNumber,
|
||||
'quantity' => $newInsQty,
|
||||
'operator_id' => $operatorName,
|
||||
'created_by' => $operatorName,
|
||||
'updated_by' => $operatorName,
|
||||
]);
|
||||
$inserted++;
|
||||
}
|
||||
@@ -753,7 +746,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
$existEmpRecQty->update([
|
||||
'quantity' => $newInsQty,
|
||||
'operator_id' => $operatorName,
|
||||
'updated_by' => $operatorName,
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
$newQuan--;
|
||||
@@ -765,8 +757,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
'invoice_number' => $invoiceNumber,
|
||||
'quantity' => $newInsQty,
|
||||
'operator_id' => $operatorName,
|
||||
'created_by' => $operatorName,
|
||||
'updated_by' => $operatorName,
|
||||
]);
|
||||
$inserted++;
|
||||
}
|
||||
@@ -790,8 +780,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
->send();
|
||||
$this->dispatch('playNotificationSound');
|
||||
|
||||
InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->update(['updated_by' => $operatorName]); // 'updated_at' => now(),
|
||||
|
||||
// Update total quantity in the form
|
||||
$totalQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count();
|
||||
$scannedQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->whereNotNull('serial_number')->where('serial_number', '!=', '')->where('plant_id', $plantId)->count();
|
||||
@@ -889,7 +877,7 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
$this->dispatch('playNotificationSound');
|
||||
|
||||
$filename = $invoiceNumber.'.xlsx';
|
||||
$directory = "uploads/temp/{$plantCode}";
|
||||
$directory = 'uploads/temp';
|
||||
$disk = Storage::disk('local');
|
||||
$filePath = $directory.'/'.$filename;
|
||||
// $fullPath = null;
|
||||
@@ -919,15 +907,16 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
|
||||
if ($updateStatus == '1') {
|
||||
$filename = $invoiceNumber.'.xlsx';
|
||||
$directory = "uploads/temp/{$plantCode}";
|
||||
$directory = 'uploads/temp';
|
||||
$disk = Storage::disk('local');
|
||||
$filePath = $directory.'/'.$filename;
|
||||
$fullPath = $disk->path($filePath);
|
||||
|
||||
// Check if file exists //if ($disk->exists($filePath))
|
||||
if ($fullPath && file_exists($fullPath)) {
|
||||
// /home/iot-dev/projects/pds/storage/app/private/uploads/temp/{$plantCode}/3RA0018735.xlsx
|
||||
// /home/iot-dev/projects/pds/storage/app/private/uploads/temp/3RA0018735.xlsx
|
||||
// 'Serial invoice update in progress...'
|
||||
|
||||
// Now you can read/process the file here
|
||||
$rows = Excel::toArray(null, $fullPath)[0];
|
||||
|
||||
@@ -1244,8 +1233,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
'invoice_number' => $invoiceNumber,
|
||||
'serial_number' => $serialNumber,
|
||||
'operator_id' => $operatorName,
|
||||
'created_by' => $operatorName,
|
||||
'updated_by' => $operatorName,
|
||||
]);
|
||||
$inserted++;
|
||||
}
|
||||
@@ -1268,8 +1255,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
|
||||
$this->dispatch('playNotificationSound');
|
||||
|
||||
InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->update(['updated_by' => $operatorName]); // 'updated_at' => now(),
|
||||
|
||||
// Update total quantity in the form
|
||||
$totalQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count();
|
||||
$scannedQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count();
|
||||
@@ -1352,7 +1337,7 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
}
|
||||
|
||||
$filename = $invoiceNumber.'.xlsx';
|
||||
$directory = "uploads/temp/{$plantCode}";
|
||||
$directory = 'uploads/temp';
|
||||
$disk = Storage::disk('local');
|
||||
$filePath = $directory.'/'.$filename;
|
||||
$fullPath = null; // $fullPath = $disk->path($filePath);
|
||||
@@ -1793,8 +1778,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
'invoice_number' => $invoiceNumber,
|
||||
'quantity' => 1,
|
||||
'operator_id' => $operatorName,
|
||||
'created_by' => $operatorName,
|
||||
'updated_by' => $operatorName,
|
||||
]);
|
||||
$inserted++;
|
||||
}
|
||||
@@ -1828,8 +1811,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
'invoice_number' => $invoiceNumber,
|
||||
'quantity' => $bundleQty,
|
||||
'operator_id' => $operatorName,
|
||||
'created_by' => $operatorName,
|
||||
'updated_by' => $operatorName,
|
||||
]);
|
||||
$inserted++;
|
||||
}
|
||||
@@ -1861,8 +1842,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
'invoice_number' => $invoiceNumber,
|
||||
'quantity' => $totalExcelQty,
|
||||
'operator_id' => $operatorName,
|
||||
'created_by' => $operatorName,
|
||||
'updated_by' => $operatorName,
|
||||
]);
|
||||
$inserted++;
|
||||
}
|
||||
@@ -2227,8 +2206,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
'invoice_number' => $invoiceNumber,
|
||||
'serial_number' => $serialNumber,
|
||||
'operator_id' => $operatorName,
|
||||
'created_by' => $operatorName,
|
||||
'updated_by' => $operatorName,
|
||||
]);
|
||||
$inserted++;
|
||||
}
|
||||
@@ -2381,9 +2358,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
$invoiceNumber = $this->form->getState()['invoice_number'];
|
||||
$this->invoiceNumber = $invoiceNumber;
|
||||
|
||||
$plant = Plant::find($plantId);
|
||||
$plantCode = $plant?->code ?? null;
|
||||
|
||||
$totQuan = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count();
|
||||
$scanSQuan = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count();
|
||||
$totMQuan = InvoiceValidation::where('invoice_number', $invoiceNumber)->whereNotNull('quantity')->where('plant_id', $plantId)->count(); // ->where('quantity', '!=', '')
|
||||
@@ -2421,7 +2395,7 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
$this->dispatch('playNotificationSound');
|
||||
|
||||
$filename = $invoiceNumber.'.xlsx';
|
||||
$directory = "uploads/temp/{$plantCode}";
|
||||
$directory = 'uploads/temp';
|
||||
$disk = Storage::disk('local');
|
||||
$filePath = $directory.'/'.$filename;
|
||||
// $fullPath = null;
|
||||
@@ -2973,7 +2947,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
if ($curExistQty > $curScanQty) { // 5 > 2
|
||||
$record->quantity = $curExistQty - $curScanQty; // 5 - 2
|
||||
$record->operator_id = $operatorName;
|
||||
// $record->updated_by = $operatorName;
|
||||
// $record->updated_at = now();
|
||||
$record->save();
|
||||
|
||||
@@ -2986,15 +2959,12 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
'quantity' => $curScanQty,
|
||||
'created_at' => $createdDt,
|
||||
'operator_id' => $operatorName,
|
||||
'created_by' => $operatorName,
|
||||
'updated_by' => $operatorName,
|
||||
]);
|
||||
} elseif ($curExistQty == $curScanQty) { // 2 = 2
|
||||
// $record->delete();
|
||||
$record->serial_number = $serialNumber;
|
||||
$record->batch_number = $batchNumber;
|
||||
$record->operator_id = $operatorName;
|
||||
// $record->updated_by = $operatorName;
|
||||
// $record->updated_at = now();
|
||||
$record->save();
|
||||
|
||||
@@ -3005,8 +2975,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
// 'quantity' => $curScanQty,
|
||||
// 'created_at' => $createdDt,
|
||||
// 'operator_id'=> $operatorName,
|
||||
// 'created_by' => $operatorName,
|
||||
// 'updated_by' => $operatorName,
|
||||
// ]);
|
||||
} else {
|
||||
Notification::make()
|
||||
@@ -3062,7 +3030,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
$record->batch_number = $batchNumber;
|
||||
// $record->updated_at = now();
|
||||
$record->operator_id = $operatorName;
|
||||
// $record->updated_by = $operatorName;
|
||||
$record->save();
|
||||
}
|
||||
|
||||
@@ -3088,7 +3055,7 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
$this->dispatch('playNotificationSound');
|
||||
|
||||
$filename = $invoiceNumber.'.xlsx';
|
||||
$directory = "uploads/temp/{$plantCode}";
|
||||
$directory = 'uploads/temp';
|
||||
$disk = Storage::disk('local');
|
||||
$filePath = $directory.'/'.$filename;
|
||||
// $fullPath = null;
|
||||
@@ -3132,7 +3099,7 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
$this->dispatch('playNotificationSound');
|
||||
|
||||
$filename = $invoiceNumber.'.xlsx';
|
||||
$directory = "uploads/temp/{$plantCode}";
|
||||
$directory = 'uploads/temp';
|
||||
$disk = Storage::disk('local');
|
||||
$filePath = $directory.'/'.$filename;
|
||||
// $fullPath = null;
|
||||
@@ -3431,7 +3398,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
$record->scanned_status = 'Scanned';
|
||||
}
|
||||
$record->operator_id = $operatorName;
|
||||
// $record->updated_by = $operatorName;
|
||||
$record->save();
|
||||
|
||||
// Notification::make()
|
||||
@@ -3461,7 +3427,7 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
$this->dispatch('playNotificationSound');
|
||||
|
||||
$filename = $invoiceNumber.'.xlsx';
|
||||
$directory = "uploads/temp/{$plantCode}";
|
||||
$directory = 'uploads/temp';
|
||||
$disk = Storage::disk('local');
|
||||
$filePath = $directory.'/'.$filename;
|
||||
// $fullPath = null;
|
||||
@@ -3548,7 +3514,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
$record->scanned_status = 'Scanned';
|
||||
}
|
||||
$record->operator_id = $operatorName;
|
||||
// $record->updated_by = $operatorName;
|
||||
$record->save();
|
||||
|
||||
// Notification::make()
|
||||
@@ -3579,7 +3544,7 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
$this->dispatch('playNotificationSound');
|
||||
|
||||
$filename = $invoiceNumber.'.xlsx';
|
||||
$directory = "uploads/temp/{$plantCode}";
|
||||
$directory = 'uploads/temp';
|
||||
$disk = Storage::disk('local');
|
||||
$filePath = $directory.'/'.$filename;
|
||||
// $fullPath = null;
|
||||
@@ -3731,7 +3696,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
$record->scanned_status = 'Scanned';
|
||||
}
|
||||
$record->operator_id = $operatorName;
|
||||
// $record->updated_by = $operatorName;
|
||||
$record->save();
|
||||
|
||||
// Notification::make()
|
||||
@@ -3776,7 +3740,7 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
// }
|
||||
|
||||
$filename = $invoiceNumber.'.xlsx';
|
||||
$directory = "uploads/temp/{$plantCode}";
|
||||
$directory = 'uploads/temp';
|
||||
$disk = Storage::disk('local');
|
||||
$filePath = $directory.'/'.$filename;
|
||||
// $fullPath = null;
|
||||
|
||||
@@ -8,7 +8,6 @@ use App\Models\CharacteristicApproverMaster;
|
||||
use App\Models\Item;
|
||||
use App\Models\Machine;
|
||||
use App\Models\RequestCharacteristic;
|
||||
use Closure;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Section;
|
||||
@@ -22,7 +21,6 @@ use Filament\Tables\Actions\ImportAction;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class RequestCharacteristicResource extends Resource
|
||||
@@ -238,7 +236,7 @@ class RequestCharacteristicResource extends Resource
|
||||
})
|
||||
->required(),
|
||||
// ->disabled(fn ($get) => self::isFieldDisabled($get))
|
||||
Section::make('Request Characteristic Field')
|
||||
Section::make('Request Characteristic')
|
||||
// ->columnSpan(['default' => 2, 'sm' => 4])
|
||||
->reactive()
|
||||
->schema([
|
||||
@@ -246,82 +244,24 @@ class RequestCharacteristicResource extends Resource
|
||||
->label('Characteristic Name')
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('characteristic_name', strtoupper($state));
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->required()
|
||||
->rules([
|
||||
// function (callable $get) {
|
||||
// return Rule::unique('request_characteristics', 'characteristic_name')
|
||||
// ->where('plant_id', $get('plant_id'))
|
||||
// ->where('machine_id', $get('machine_id'))
|
||||
// ->where('machine_name', $get('machine_name'))
|
||||
// ->ignore($get('id'));
|
||||
// },
|
||||
function (callable $get): Closure {
|
||||
return function (string $attribute, $value, Closure $fail) use ($get) {
|
||||
$charVal = strtolower($value);
|
||||
$columns = Schema::getColumnListing('class_characteristics');
|
||||
|
||||
if (! in_array($charVal, $columns, true)) {
|
||||
$fail('Unknown characteristic field found.'); // .implode(', ', $columns).
|
||||
} else {
|
||||
|
||||
$plantId = $get('plant_id');
|
||||
$jobNo = $get('aufnr');
|
||||
$updId = $get('id');
|
||||
$pendingExists = RequestCharacteristic::where('plant_id', $plantId)->where('aufnr', $jobNo)->where('characteristic_name', $value)->latest()->first();
|
||||
|
||||
if ($pendingExists) {
|
||||
if ($updId && $pendingExists->id == $updId) {
|
||||
return;
|
||||
}
|
||||
$app1 = $pendingExists->approver_status1 ?? null;
|
||||
$app2 = $pendingExists->approver_status2 ?? null;
|
||||
$app3 = $pendingExists->approver_status3 ?? null;
|
||||
|
||||
if ($app1 != 'Rejected' && $app2 != 'Rejected' && $app3 != 'Rejected' && $app1 != 'Approved' && $app2 != 'Approved' && $app3 != 'Approved') {
|
||||
$fail('Approval is already pending.');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
])
|
||||
->readOnly(fn ($get) => self::isFieldDisabled($get)), // disabled
|
||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
||||
Forms\Components\TextInput::make('current_value')
|
||||
->label('Current Value')
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->required(function (callable $get) {
|
||||
$updateVal = $get('update_value');
|
||||
if ($updateVal == null || $updateVal == '') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
})
|
||||
->readOnly(fn ($get) => self::isFieldDisabled($get)),
|
||||
->disabled(fn ($get) => self::isFieldDisabled(get: $get)),
|
||||
Forms\Components\TextInput::make('update_value')
|
||||
->label('Update Value')
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->rules([
|
||||
function (callable $get): Closure {
|
||||
return function (string $attribute, $value, Closure $fail) use ($get) {
|
||||
$currVal = $get('current_value');
|
||||
|
||||
if ($value == $currVal) {
|
||||
$fail('Update value must be different from current value.');
|
||||
}
|
||||
};
|
||||
},
|
||||
])
|
||||
->readOnly(fn ($get) => self::isFieldDisabled($get)),
|
||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
||||
])
|
||||
->collapsible()
|
||||
->columns(['default' => 1, 'sm' => 3]),
|
||||
@@ -858,19 +798,6 @@ class RequestCharacteristicResource extends Resource
|
||||
->dateTime()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('mail_status')
|
||||
->label('Mail Status')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('trigger_at')
|
||||
->label('Trigger At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->dateTime()
|
||||
|
||||
@@ -3,20 +3,20 @@
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\TestingTempResource\Pages;
|
||||
use App\Models\Plant;
|
||||
use App\Filament\Resources\TestingTempResource\RelationManagers;
|
||||
use App\Models\TestingTemp;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Actions\Action;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
|
||||
use Filament\Forms\Components\Actions\Action;
|
||||
use Filament\Notifications\Notification;
|
||||
use Storage;
|
||||
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
|
||||
|
||||
class TestingTempResource extends Resource
|
||||
{
|
||||
@@ -30,77 +30,12 @@ class TestingTempResource extends Resource
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->label('Plant Name')
|
||||
->relationship('plant', 'name')
|
||||
->required()
|
||||
->searchable()
|
||||
// ->preload()
|
||||
// ->nullable(),
|
||||
->reactive()
|
||||
->columnSpan(1)
|
||||
->options(function (callable $get) {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
$set('ivPlantError', null);
|
||||
$set('name', null);
|
||||
$set('selected_file', null);
|
||||
$set('attachment', null);
|
||||
if (! $plantId) {
|
||||
$set('ivPlantError', 'Please select a plant first.');
|
||||
} else {
|
||||
$plantCode = Plant::find($plantId)?->code ?? null;
|
||||
|
||||
$directory = "uploads/temp/{$plantCode}";
|
||||
if (! Storage::disk('local')->exists($directory)) {
|
||||
Storage::disk('local')->makeDirectory($directory);
|
||||
}
|
||||
}
|
||||
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->extraAttributes(fn ($get) => [
|
||||
'class' => $get('ivPlantError') ? 'border-red-500' : '',
|
||||
])
|
||||
->hint(fn ($get) => $get('ivPlantError') ? $get('ivPlantError') : null)
|
||||
->hintColor('danger'),
|
||||
Forms\Components\TextInput::make('name')
|
||||
->label('File Name')
|
||||
->required()
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
$fileNam = $get('name');
|
||||
// $set('selected_file', null);
|
||||
if (! $plantId) {
|
||||
$set('name', null);
|
||||
} elseif (! $fileNam) {
|
||||
$set('attachment', null);
|
||||
}
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
->label('File Name'),
|
||||
Forms\Components\Select::make('selected_file')
|
||||
->label('Select Uploaded File')
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (! $plantId) {
|
||||
return collect(Storage::disk('local')->files('uploads/temp'))
|
||||
->mapWithKeys(function ($file) {
|
||||
return [
|
||||
$file => basename($file), // value => label
|
||||
];
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
$plantCode = Plant::find($plantId)?->code ?? null;
|
||||
|
||||
return collect(Storage::disk('local')->files("uploads/temp/{$plantCode}"))
|
||||
->options(function () {
|
||||
return collect(Storage::disk('local')->files('uploads'))
|
||||
->mapWithKeys(function ($file) {
|
||||
return [
|
||||
$file => basename($file), // value => label
|
||||
@@ -108,157 +43,101 @@ class TestingTempResource extends Resource
|
||||
})
|
||||
->toArray();
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
// $plantId = $get('plant_id');
|
||||
// if (! $plantId) {
|
||||
// $set('selected_file', null);
|
||||
// }
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
// ->disabled(fn (callable $get) => ! $get('plant_id')),
|
||||
Forms\Components\FileUpload::make('attachment')
|
||||
->label('Choose File to Upload')
|
||||
->label('Upload')
|
||||
// ->acceptedFileTypes(['application/pdf'])
|
||||
->storeFiles(false)
|
||||
->disk('local')
|
||||
->directory(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
$plantCode = Plant::find($plantId)?->code ?? null;
|
||||
|
||||
return "uploads/temp/{$plantCode}";
|
||||
})
|
||||
->directory('uploads/temp')
|
||||
->preserveFilenames()
|
||||
->maxSize(20480) // 20 MB
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (! $plantId) {
|
||||
$set('attachment', null);
|
||||
}
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->required(function (callable $get) {
|
||||
$selFile = $get('selected_file');
|
||||
$selAtt = $get('attachment');
|
||||
if (! $selAtt && ! $selFile) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
})
|
||||
->reactive()
|
||||
->disabled(fn (callable $get) => ! $get('plant_id') || ! $get('name')),
|
||||
->maxSize(20480)
|
||||
->reactive(),
|
||||
Forms\Components\Actions::make([
|
||||
Action::make('uploadNow')
|
||||
->label('Upload File')
|
||||
->color('success')
|
||||
->requiresConfirmation(function (callable $get) {
|
||||
$filePath = $get('attachment');
|
||||
if ($filePath) {
|
||||
return true;
|
||||
->label('File Upload')
|
||||
->color('success')
|
||||
->action(function ($get) {
|
||||
|
||||
$uploadedFiles = $get('attachment');
|
||||
|
||||
if (is_array($uploadedFiles) && count($uploadedFiles) > 0) {
|
||||
|
||||
$uploaded = reset($uploadedFiles);
|
||||
|
||||
if ($uploaded instanceof TemporaryUploadedFile) {
|
||||
|
||||
$baseName = $get('name');
|
||||
$extension = $uploaded->getClientOriginalExtension();
|
||||
|
||||
$finalFileName = $baseName . '.' . $extension;
|
||||
|
||||
$uploaded->storeAs(
|
||||
'uploads',
|
||||
$finalFileName,
|
||||
'local'
|
||||
);
|
||||
|
||||
Notification::make()
|
||||
->title("File uploaded successfully: {$finalFileName}")
|
||||
->success()
|
||||
->send();
|
||||
}
|
||||
|
||||
return false;
|
||||
})
|
||||
->action(function (callable $get, callable $set) {
|
||||
} else {
|
||||
Notification::make()
|
||||
->title('No file selected to upload')
|
||||
->warning()
|
||||
->send();
|
||||
}
|
||||
}),
|
||||
|
||||
$uploadedFiles = $get('attachment');
|
||||
// Action::make('downloadAttachment')
|
||||
// ->label('Download File')
|
||||
// ->action(function ($get) {
|
||||
|
||||
if (is_array($uploadedFiles) && count($uploadedFiles) > 0) {
|
||||
// $fileName = basename($get('selected_file'));
|
||||
|
||||
$uploaded = reset($uploadedFiles);
|
||||
// //dd($fileName);
|
||||
|
||||
if ($uploaded instanceof TemporaryUploadedFile) {
|
||||
// // if (!$fileName) {
|
||||
// // Notification::make()
|
||||
// // ->title('Enter file name to download')
|
||||
// // ->danger()
|
||||
// // ->send();
|
||||
// // return;
|
||||
// // }
|
||||
|
||||
$baseName = $get('name');
|
||||
$extension = $uploaded->getClientOriginalExtension();
|
||||
// $files = Storage::disk('local')->files('uploads');
|
||||
|
||||
$finalFileName = $baseName.'.'.$extension;
|
||||
// foreach ($files as $file) {
|
||||
|
||||
$plantId = $get('plant_id');
|
||||
$plantCode = Plant::find($plantId)?->code ?? null;
|
||||
// if (pathinfo($file, PATHINFO_FILENAME) === $fileName) {
|
||||
// dd($fileName);
|
||||
// Notification::make()
|
||||
// ->title("File downloaded successfully")
|
||||
// ->success()
|
||||
// ->send();
|
||||
|
||||
if (! $plantCode) {
|
||||
Notification::make()
|
||||
->title('Please select a plant first.')
|
||||
->warning()
|
||||
->send();
|
||||
|
||||
return;
|
||||
} elseif (! $baseName) {
|
||||
Notification::make()
|
||||
->title('Please enter a file name first.')
|
||||
->warning()
|
||||
->send();
|
||||
|
||||
return;
|
||||
}
|
||||
// return "uploads/temp/{$plantCode}";
|
||||
|
||||
$uploaded->storeAs(
|
||||
"uploads/temp/{$plantCode}",
|
||||
$finalFileName,
|
||||
'local'
|
||||
);
|
||||
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
|
||||
Notification::make()
|
||||
->title("File uploaded successfully: {$finalFileName}")
|
||||
->success()
|
||||
->send();
|
||||
}
|
||||
|
||||
} else {
|
||||
if (! $get('plant_id')) {
|
||||
Notification::make()
|
||||
->title('Please select a plant first.')
|
||||
->warning()
|
||||
->send();
|
||||
} elseif (! $get('name')) {
|
||||
Notification::make()
|
||||
->title('Please enter a file name first.')
|
||||
->warning()
|
||||
->send();
|
||||
} else {
|
||||
Notification::make()
|
||||
->title('No file selected to upload')
|
||||
->warning()
|
||||
->send();
|
||||
}
|
||||
}
|
||||
}),
|
||||
// return response()->download(
|
||||
// Storage::disk('local')->path($file)
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Notification::make()
|
||||
// // ->title('File not found')
|
||||
// // ->danger()
|
||||
// // ->send();
|
||||
// }),
|
||||
Action::make('downloadAttachment')
|
||||
->label('Download File')
|
||||
->color('warning')
|
||||
->requiresConfirmation(function (callable $get) {
|
||||
$filePath = $get('selected_file');
|
||||
if ($filePath) {
|
||||
return true;
|
||||
}
|
||||
->action(function ($get) {
|
||||
|
||||
return false;
|
||||
})
|
||||
->action(function (callable $get, callable $set) {
|
||||
$filePath = $get('selected_file'); // uploads/filename.pdf
|
||||
|
||||
// if (! $get('plant_id')) {
|
||||
// Notification::make()
|
||||
// ->title('Please select a plant first.')
|
||||
// ->warning()
|
||||
// ->send();
|
||||
|
||||
// return;
|
||||
// } else
|
||||
if (! $filePath) {
|
||||
Notification::make()
|
||||
->title('Please select a file first.')
|
||||
->warning()
|
||||
->send();
|
||||
|
||||
return;
|
||||
} elseif (! Storage::disk('local')->exists($filePath)) {
|
||||
if (!$filePath || !Storage::disk('local')->exists($filePath)) {
|
||||
Notification::make()
|
||||
->title('File not found')
|
||||
->danger()
|
||||
@@ -267,8 +146,6 @@ class TestingTempResource extends Resource
|
||||
return;
|
||||
}
|
||||
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
|
||||
Notification::make()
|
||||
->title('File downloaded successfully')
|
||||
->success()
|
||||
@@ -279,65 +156,38 @@ class TestingTempResource extends Resource
|
||||
);
|
||||
}),
|
||||
|
||||
Action::make('deleteAttachment')
|
||||
Action::make('deleteAttachment')
|
||||
->label('Delete File')
|
||||
->color('danger')
|
||||
->requiresConfirmation(function (callable $get) {
|
||||
$filePath = $get('selected_file');
|
||||
|
||||
if ($filePath) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
})
|
||||
->action(function ($get, $set) {
|
||||
->requiresConfirmation()
|
||||
->action(function ($get) {
|
||||
|
||||
$filePath = $get('selected_file'); // uploads/filename.pdf
|
||||
|
||||
// if (! $get('plant_id')) {
|
||||
// Notification::make()
|
||||
// ->title('Please select a plant first.')
|
||||
// ->warning()
|
||||
// ->send();
|
||||
if (!$filePath || !Storage::disk('local')->exists($filePath)) {
|
||||
Notification::make()
|
||||
->title('File not found')
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Storage::disk('local')->delete($filePath);
|
||||
|
||||
// return;
|
||||
// } else
|
||||
if (! $filePath) {
|
||||
Notification::make()
|
||||
->title('Please select a file first.')
|
||||
->warning()
|
||||
->title('File deleted successfully')
|
||||
->success()
|
||||
->send();
|
||||
}),
|
||||
|
||||
return;
|
||||
} elseif (! Storage::disk('local')->exists($filePath)) {
|
||||
Notification::make()
|
||||
->title('File not found')
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Storage::disk('local')->delete($filePath);
|
||||
|
||||
$set('selected_file', null);
|
||||
|
||||
Notification::make()
|
||||
->title('File deleted successfully')
|
||||
->success()
|
||||
->send();
|
||||
}),
|
||||
|
||||
]),
|
||||
]),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
->default(Filament::auth()->user()?->name)
|
||||
->reactive(),
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->label('Updated By')
|
||||
->default(Filament::auth()->user()?->name)
|
||||
->reactive(),
|
||||
->default(Filament::auth()->user()?->name),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace App\Filament\Resources;
|
||||
use App\Filament\Exports\UserExporter;
|
||||
use App\Filament\Imports\UserImporter;
|
||||
use App\Filament\Resources\UserResource\Pages;
|
||||
use App\Models\Plant;
|
||||
use App\Filament\Resources\UserResource\RelationManagers;
|
||||
use App\Models\User;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
@@ -36,21 +36,16 @@ class UserResource extends Resource
|
||||
->relationship('plant', 'name')
|
||||
->nullable()
|
||||
->reactive()
|
||||
->options(function (callable $get) {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||
})
|
||||
->default(function () {
|
||||
return optional(User::latest()->first())->plant_id;
|
||||
}),
|
||||
Forms\Components\TextInput::make('name')
|
||||
->required()
|
||||
->autofocus()
|
||||
// ->reactive()
|
||||
//->reactive()
|
||||
->live(debounce: 600)
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('email', $state.'@cripumps.com');
|
||||
$set('email', $state . '@cripumps.com');
|
||||
})
|
||||
->maxLength(255),
|
||||
Forms\Components\TextInput::make('email')
|
||||
@@ -63,7 +58,7 @@ class UserResource extends Resource
|
||||
// ->ignore($get('id')); // Ignore current record during updates
|
||||
// })
|
||||
->reactive()
|
||||
// ->prefix(fn ($get) => $get('name') ?? null)
|
||||
//->prefix(fn ($get) => $get('name') ?? null)
|
||||
// ->suffix('@cripumps.com')
|
||||
->maxLength(255),
|
||||
Forms\Components\DateTimePicker::make('email_verified_at'),
|
||||
@@ -78,7 +73,7 @@ class UserResource extends Resource
|
||||
// ->relationship('roles', 'name'),
|
||||
Forms\Components\Select::make('roles')
|
||||
->relationship('roles', 'name')
|
||||
// ->relationship(name: 'roles', titleAttribute: 'name')
|
||||
//->relationship(name: 'roles', titleAttribute: 'name')
|
||||
// ->saveRelationshipsUsing(function (Model $record, $state) {
|
||||
// $record->roles()->syncWithPivotValues($state, [config('permission.column_names.team_foreign_key') => getPermissionsTeamId()]);
|
||||
// })
|
||||
@@ -106,7 +101,6 @@ class UserResource extends Resource
|
||||
$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')
|
||||
@@ -171,14 +165,14 @@ class UserResource extends Resource
|
||||
->label('Import Users')
|
||||
->color('warning')
|
||||
->importer(UserImporter::class)
|
||||
->visible(function () {
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view import user');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->label('Export Users')
|
||||
->color('warning')
|
||||
->exporter(UserExporter::class)
|
||||
->visible(function () {
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view export user');
|
||||
}),
|
||||
]);
|
||||
|
||||
@@ -60,12 +60,6 @@ class CharacteristicApprovalController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
$allowedMailStatusByLevel = [
|
||||
1 => 'Sent',
|
||||
2 => 'Sent-Mail2',
|
||||
3 => 'Sent-Mail3',
|
||||
];
|
||||
|
||||
$expectedMailStatus = $allowedMailStatusByLevel[$level] ?? null;
|
||||
|
||||
if ($record->mail_status != $expectedMailStatus) {
|
||||
@@ -116,12 +110,6 @@ class CharacteristicApprovalController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
$allowedMailStatusByLevel = [
|
||||
1 => 'Sent',
|
||||
2 => 'Sent-Mail2',
|
||||
3 => 'Sent-Mail3',
|
||||
];
|
||||
|
||||
$expectedMailStatus = $allowedMailStatusByLevel[$level] ?? null;
|
||||
|
||||
if ($record->mail_status != $expectedMailStatus) {
|
||||
|
||||
@@ -2875,7 +2875,7 @@ class CharacteristicsController extends Controller
|
||||
// $pendingCharacteristics = [];
|
||||
|
||||
// foreach ($characteristics as $char) {
|
||||
// $charName = strtoupper($char['characteristic_name']) ?? null;
|
||||
// $charName = strtolower($char['characteristic_name']) ?? null;
|
||||
// $pendingExists = RequestCharacteristic::where('aufnr', $jobNo)
|
||||
// ->where('characteristic_name', $charName)
|
||||
// ->latest()
|
||||
@@ -2948,7 +2948,7 @@ class CharacteristicsController extends Controller
|
||||
// 'item_id' => $ItemId,
|
||||
// 'characteristic_approver_master_id' => $charId,
|
||||
// 'aufnr' => $jobNo,
|
||||
// 'characteristic_name' => strtoupper($char['characteristic_name']),//strtolower
|
||||
// 'characteristic_name' => strtolower($char['characteristic_name']),
|
||||
// 'current_value' => $char['current_value'],
|
||||
// 'update_value' => $char['update_value'],
|
||||
// 'created_by' => $userName,
|
||||
@@ -3037,7 +3037,7 @@ class CharacteristicsController extends Controller
|
||||
}
|
||||
|
||||
if ($charField == null || $charField == '') {
|
||||
$charField = 'NIL';
|
||||
$charField = 'nil';
|
||||
}
|
||||
|
||||
$plant = Plant::where('code', $plantCode)->first();
|
||||
@@ -3132,24 +3132,6 @@ class CharacteristicsController extends Controller
|
||||
|
||||
$MachineId = $machineAgaPlant->id;
|
||||
|
||||
$iCode = Item::where('code', $itemCode)->first();
|
||||
if (! $iCode) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item code '{$itemCode}' not found!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$iCodeAgaPlant = Item::where('code', $itemCode)->where('plant_id', $plantId)->first();
|
||||
if (! $iCodeAgaPlant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item code '{$itemCode}' not found for the plant code '{$plantCode}'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$ItemId = $iCodeAgaPlant->id;
|
||||
|
||||
$pCode = CharacteristicApproverMaster::where('plant_id', $plantId)->first();
|
||||
if (! $pCode) {
|
||||
return response()->json([
|
||||
@@ -3190,76 +3172,46 @@ class CharacteristicsController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
$cField = CharacteristicApproverMaster::where('characteristic_field', $charField)->first();
|
||||
if (! $cField) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Master characteristic field value '{$charField}' not found in characteristic approver master!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$cFieldAgaPlant = CharacteristicApproverMaster::where('characteristic_field', $charField)->where('plant_id', $plantId)->first();
|
||||
if (! $cFieldAgaPlant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Master characteristic field value '{$charField}' not found for the plant code '{$plantCode}' in characteristic approver master!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$mNameAndWorkCenter = CharacteristicApproverMaster::where('machine_name', $machineName)->where('machine_id', $MachineId)->first();
|
||||
if (! $mNameAndWorkCenter) {
|
||||
$mNameAgaWorkCenter = CharacteristicApproverMaster::where('machine_name', $machineName)->where('machine_id', $MachineId)->first();
|
||||
if (! $mNameAgaWorkCenter) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Machine name '{$machineName}' and work center '{$workCenter}' not found in characteristic approver master!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$mNameAndWorkCenterAgaPlant = CharacteristicApproverMaster::where('machine_name', $machineName)->where('machine_id', $MachineId)->where('plant_id', $plantId)->first();
|
||||
if (! $mNameAndWorkCenterAgaPlant) {
|
||||
$mNameAgaWorkCenterForPlant = CharacteristicApproverMaster::where('machine_name', $machineName)->where('machine_id', $MachineId)->where('plant_id', $plantId)->first();
|
||||
if (! $mNameAgaWorkCenterForPlant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Machine name '{$machineName}' and work center '{$workCenter}' not found for the plant code '{$plantCode}' in characteristic approver master!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$cFieldAndWorkCent = CharacteristicApproverMaster::where('characteristic_field', $charField)->where('machine_id', $MachineId)->first();
|
||||
if (! $cFieldAndWorkCent) {
|
||||
$charId = $mNameAgaWorkCenterForPlant->id;
|
||||
|
||||
$iCode = Item::where('code', $itemCode)->first();
|
||||
if (! $iCode) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Master characteristic field value '{$charField}' not found for the work center '{$workCenter}' in characteristic approver master!",
|
||||
'status_description' => "Item code '{$itemCode}' not found!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$cFieldAndWorkCentAgaPlant = CharacteristicApproverMaster::where('characteristic_field', $charField)->where('machine_id', $MachineId)->where('plant_id', $plantId)->first();
|
||||
if (! $cFieldAndWorkCentAgaPlant) {
|
||||
$iCodeAgaPlant = Item::where('code', $itemCode)->where('plant_id', $plantId)->first();
|
||||
if (! $iCodeAgaPlant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Master characteristic field value '{$charField}' and work center '{$workCenter}' not found for the plant code '{$plantCode}' in characteristic approver master!",
|
||||
'status_description' => "Item code '{$itemCode}' not found for the plant code '{$plantCode}'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$cFieldAndMach = CharacteristicApproverMaster::where('characteristic_field', $charField)->where('machine_name', $machineName)->first();
|
||||
if (! $cFieldAndMach) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Master characteristic field value '{$charField}' not found for the machine name '{$machineName}' in characteristic approver master!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$cFieldAndWorkCentAndMachAgaPlant = CharacteristicApproverMaster::where('characteristic_field', $charField)->where('machine_id', $MachineId)->where('machine_name', $machineName)->where('plant_id', $plantId)->first();
|
||||
if (! $cFieldAndWorkCentAndMachAgaPlant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Master characteristic field value '{$charField}', work center '{$workCenter}', and machine name '{$machineName}' not found for the plant code '{$plantCode}' in characteristic approver master!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$charId = $cFieldAndWorkCentAndMachAgaPlant->id;
|
||||
$ItemId = $iCodeAgaPlant->id;
|
||||
|
||||
$pendingCharacteristics = [];
|
||||
|
||||
foreach ($characteristics as $char) {
|
||||
$charName = strtoupper($char['characteristic_name']) ?? null;
|
||||
$charName = strtolower($char['characteristic_name']) ?? null;
|
||||
$pendingExists = RequestCharacteristic::where('plant_id', $plantId)->where('aufnr', $jobNo)->where('characteristic_name', $charName)->latest()->first();
|
||||
|
||||
if ($pendingExists) {
|
||||
@@ -3340,7 +3292,7 @@ class CharacteristicsController extends Controller
|
||||
'item_id' => $ItemId,
|
||||
'characteristic_approver_master_id' => $charId,
|
||||
'aufnr' => $jobNo,
|
||||
'characteristic_name' => strtoupper($char['characteristic_name']), // strtolower
|
||||
'characteristic_name' => strtolower($char['characteristic_name']),
|
||||
'current_value' => $char['current_value'],
|
||||
'update_value' => $char['update_value'],
|
||||
'created_by' => $userName,
|
||||
@@ -3768,8 +3720,6 @@ class CharacteristicsController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
$workFlowId = strtoupper($workFlowId);
|
||||
|
||||
if (! $workFlowId) {
|
||||
|
||||
$records = RequestCharacteristic::with('approver')->where([
|
||||
@@ -3832,14 +3782,14 @@ class CharacteristicsController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
// if (! str_ends_with(strtolower($filename), '.pdf')) {
|
||||
// $filename .= '.pdf';
|
||||
// }
|
||||
if (! str_ends_with(strtolower($filename), '.pdf')) {
|
||||
$filename .= '.pdf';
|
||||
}
|
||||
|
||||
if (! Storage::disk('local')->exists($filePath)) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Pdf File not found for the provided 'Work Flow ID' number!",
|
||||
'status_description' => 'Pdf File not found for the provided work flow id number!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,17 +6,17 @@ use App\Models\InvoiceValidation;
|
||||
use App\Models\StickerMaster;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Notifications\Notification;
|
||||
use Livewire\Attributes\On;
|
||||
use Livewire\Component;
|
||||
use Livewire\WithPagination;
|
||||
use Str;
|
||||
use Livewire\Attributes\On;
|
||||
use Livewire\WithPagination;
|
||||
|
||||
class InvoiceDataTable extends Component
|
||||
{
|
||||
|
||||
use WithPagination;
|
||||
|
||||
protected $paginationTheme = 'tailwind';
|
||||
|
||||
public $invoiceData = [];
|
||||
|
||||
// public $invoiceRecords;
|
||||
@@ -25,6 +25,7 @@ class InvoiceDataTable extends Component
|
||||
|
||||
public $package = [];
|
||||
|
||||
|
||||
public $packageCount = 0;
|
||||
|
||||
public string $invoiceNumber = '';
|
||||
@@ -57,7 +58,7 @@ class InvoiceDataTable extends Component
|
||||
|
||||
public $panel_box_supplier;
|
||||
|
||||
public $panel_box_code;
|
||||
public $panel_box_item_code;
|
||||
|
||||
public $panel_box_serial_number;
|
||||
|
||||
@@ -186,187 +187,125 @@ class InvoiceDataTable extends Component
|
||||
// }
|
||||
// }
|
||||
|
||||
// public function loadData($invoiceNumber, $plantId, $onCapFocus = false)
|
||||
// {
|
||||
// $this->invoiceNumber = $invoiceNumber;
|
||||
// $this->plantId = $plantId;
|
||||
// public function loadData($invoiceNumber, $plantId, $onCapFocus = false)
|
||||
// {
|
||||
// $this->invoiceNumber = $invoiceNumber;
|
||||
// $this->plantId = $plantId;
|
||||
|
||||
// $this->completedInvoice = false;
|
||||
// $this->isSerial = true;
|
||||
// $this->onCapFocus = $onCapFocus;
|
||||
// $this->emptyInvoice = false;
|
||||
// $this->hasSearched = true;
|
||||
// $this->materialInvoice = false;
|
||||
// $this->completedInvoice = false;
|
||||
// $this->isSerial = true;
|
||||
// $this->onCapFocus = $onCapFocus;
|
||||
// $this->emptyInvoice = false;
|
||||
// $this->hasSearched = true;
|
||||
// $this->materialInvoice = false;
|
||||
|
||||
// $this->resetPage();
|
||||
// $this->resetPage();
|
||||
|
||||
// $this->packageCount = 0;
|
||||
// $this->packageCount = 0;
|
||||
|
||||
// // IMPORTANT: keep scanned rows, otherwise count will not update
|
||||
// $this->invoiceRecords = InvoiceValidation::with('stickerMasterRelation')
|
||||
// ->where('invoice_number', $this->invoiceNumber)
|
||||
// ->where('plant_id', $this->plantId)
|
||||
// ->get();
|
||||
// // IMPORTANT: keep scanned rows, otherwise count will not update
|
||||
// $this->invoiceRecords = InvoiceValidation::with('stickerMasterRelation')
|
||||
// ->where('invoice_number', $this->invoiceNumber)
|
||||
// ->where('plant_id', $this->plantId)
|
||||
// ->get();
|
||||
|
||||
// foreach ($this->invoiceRecords as &$row) {
|
||||
// foreach ($this->invoiceRecords as &$row) {
|
||||
|
||||
// $stickCount = 0;
|
||||
// $scannedCount = 0;
|
||||
// $stickCount = 0;
|
||||
// $scannedCount = 0;
|
||||
|
||||
// // Get item code
|
||||
// $row['code'] = StickerMaster::with('item')
|
||||
// ->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
|
||||
// // Get item code
|
||||
// $row['code'] = StickerMaster::with('item')
|
||||
// ->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
|
||||
|
||||
// $curStick = StickerMaster::find($row['sticker_master_id']);
|
||||
// $curStick = StickerMaster::find($row['sticker_master_id']);
|
||||
|
||||
// if ($curStick) {
|
||||
// if ($curStick) {
|
||||
|
||||
// /** ---------------- REQUIRED STICKERS ---------------- */
|
||||
// /** ---------------- REQUIRED STICKERS ---------------- */
|
||||
|
||||
// // PANEL BOX (capacitor)
|
||||
// if (!empty($curStick->panel_box_code)) {
|
||||
// $stickCount++;
|
||||
// // PANEL BOX (capacitor)
|
||||
// if (!empty($curStick->panel_box_code)) {
|
||||
// $stickCount++;
|
||||
|
||||
// // Panel box scan = capacitor_scanned_status
|
||||
// if ($row['capacitor_scanned_status'] == 1) {
|
||||
// $scannedCount++;
|
||||
// }
|
||||
// }
|
||||
// // Panel box scan = capacitor_scanned_status
|
||||
// if ($row['capacitor_scanned_status'] == 1) {
|
||||
// $scannedCount++;
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Tube stickers
|
||||
// if (
|
||||
// $curStick->tube_sticker_motor == 1 ||
|
||||
// $curStick->tube_sticker_pump == 1 ||
|
||||
// $curStick->tube_sticker_pumpset == 1
|
||||
// ) {
|
||||
// if ($curStick->tube_sticker_motor == 1) {
|
||||
// $stickCount++;
|
||||
// if ($row['motor_scanned_status'] == 1) {
|
||||
// $scannedCount++;
|
||||
// }
|
||||
// }
|
||||
// // Tube stickers
|
||||
// if (
|
||||
// $curStick->tube_sticker_motor == 1 ||
|
||||
// $curStick->tube_sticker_pump == 1 ||
|
||||
// $curStick->tube_sticker_pumpset == 1
|
||||
// ) {
|
||||
// if ($curStick->tube_sticker_motor == 1) {
|
||||
// $stickCount++;
|
||||
// if ($row['motor_scanned_status'] == 1) {
|
||||
// $scannedCount++;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (
|
||||
// $curStick->tube_sticker_pump == 1 ||
|
||||
// ($curStick->tube_sticker_pumpset != 1 &&
|
||||
// $curStick->tube_sticker_pump != 1 &&
|
||||
// $curStick->pack_slip_pump == 1)
|
||||
// ) {
|
||||
// $stickCount++;
|
||||
// if ($row['pump_scanned_status'] == 1) {
|
||||
// $scannedCount++;
|
||||
// }
|
||||
// }
|
||||
// if (
|
||||
// $curStick->tube_sticker_pump == 1 ||
|
||||
// ($curStick->tube_sticker_pumpset != 1 &&
|
||||
// $curStick->tube_sticker_pump != 1 &&
|
||||
// $curStick->pack_slip_pump == 1)
|
||||
// ) {
|
||||
// $stickCount++;
|
||||
// if ($row['pump_scanned_status'] == 1) {
|
||||
// $scannedCount++;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if ($curStick->tube_sticker_pumpset == 1) {
|
||||
// $stickCount++;
|
||||
// if ($row['scanned_status_set'] == 1) {
|
||||
// $scannedCount++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if ($curStick->tube_sticker_pumpset == 1) {
|
||||
// $stickCount++;
|
||||
// if ($row['scanned_status_set'] == 1) {
|
||||
// $scannedCount++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Pack slips (only if no tube stickers)
|
||||
// elseif (
|
||||
// $curStick->pack_slip_motor == 1 ||
|
||||
// $curStick->pack_slip_pump == 1 ||
|
||||
// $curStick->pack_slip_pumpset == 1
|
||||
// ) {
|
||||
// if ($curStick->pack_slip_motor == 1) {
|
||||
// $stickCount++;
|
||||
// if ($row['motor_scanned_status'] == 1) {
|
||||
// $scannedCount++;
|
||||
// }
|
||||
// }
|
||||
// // Pack slips (only if no tube stickers)
|
||||
// elseif (
|
||||
// $curStick->pack_slip_motor == 1 ||
|
||||
// $curStick->pack_slip_pump == 1 ||
|
||||
// $curStick->pack_slip_pumpset == 1
|
||||
// ) {
|
||||
// if ($curStick->pack_slip_motor == 1) {
|
||||
// $stickCount++;
|
||||
// if ($row['motor_scanned_status'] == 1) {
|
||||
// $scannedCount++;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if ($curStick->pack_slip_pump == 1) {
|
||||
// $stickCount++;
|
||||
// if ($row['pump_scanned_status'] == 1) {
|
||||
// $scannedCount++;
|
||||
// }
|
||||
// }
|
||||
// if ($curStick->pack_slip_pump == 1) {
|
||||
// $stickCount++;
|
||||
// if ($row['pump_scanned_status'] == 1) {
|
||||
// $scannedCount++;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if ($curStick->pack_slip_pumpset == 1) {
|
||||
// $stickCount++;
|
||||
// if ($row['scanned_status_set'] == 1) {
|
||||
// $scannedCount++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if ($curStick->pack_slip_pumpset == 1) {
|
||||
// $stickCount++;
|
||||
// if ($row['scanned_status_set'] == 1) {
|
||||
// $scannedCount++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// // SAFETY: never go negative
|
||||
// $this->packageCount += max($stickCount - $scannedCount, 0);
|
||||
// }
|
||||
// // SAFETY: never go negative
|
||||
// $this->packageCount += max($stickCount - $scannedCount, 0);
|
||||
// }
|
||||
|
||||
// $this->dispatch($onCapFocus ? 'focus-capacitor-input' : 'focus-serial-number');
|
||||
// }
|
||||
|
||||
// $this->dispatch($onCapFocus ? 'focus-capacitor-input' : 'focus-serial-number');
|
||||
// }
|
||||
|
||||
// #[On('refreshInvoiceData')]
|
||||
|
||||
// public function loadData($invoiceNumber, $plantId, $onCapFocus = false)
|
||||
// {
|
||||
// $this->invoiceNumber = $invoiceNumber;
|
||||
// $this->plantId = $plantId;
|
||||
|
||||
// $this->completedInvoice = false;
|
||||
// $this->isSerial = true;
|
||||
// $this->onCapFocus = $onCapFocus;
|
||||
// $this->emptyInvoice = false;
|
||||
// $this->hasSearched = true;
|
||||
// $this->materialInvoice = false;
|
||||
|
||||
// $this->resetPage();
|
||||
|
||||
// $this->packageCount = 0;
|
||||
|
||||
// $records = InvoiceValidation::with('stickerMasterRelation')
|
||||
// ->where('invoice_number', $this->invoiceNumber)
|
||||
// ->where('plant_id', $this->plantId)
|
||||
// ->get();
|
||||
|
||||
// $this->packageCount = $records->sum(function ($record) {
|
||||
// $sm = $record->stickerMasterRelation;
|
||||
|
||||
// $stickCount = 0;
|
||||
// $scannedCount = 0;
|
||||
|
||||
// if ($sm) {
|
||||
|
||||
// if (strlen($sm->panel_box_code) > 0) $stickCount++;
|
||||
|
||||
// // if (!empty($sm->panel_box_code)) {
|
||||
// // $stickCount++;
|
||||
// // if (!empty($record->panel_box_serial_number)) {
|
||||
// // $scannedCount++;
|
||||
// // }
|
||||
// // }
|
||||
|
||||
// // Tube stickers
|
||||
// if ($sm->tube_sticker_motor || $sm->tube_sticker_pump || $sm->tube_sticker_pumpset) {
|
||||
// $stickCount += $sm->tube_sticker_motor ? 1 : 0;
|
||||
// $stickCount += ($sm->tube_sticker_pump || ($sm->tube_sticker_pumpset != 1 && !$sm->tube_sticker_pump && $sm->pack_slip_pump)) ? 1 : 0;
|
||||
// $stickCount += $sm->tube_sticker_pumpset ? 1 : 0;
|
||||
// }
|
||||
// // Pack slips (only if tube stickers not applied)
|
||||
// elseif ($sm->pack_slip_motor || $sm->pack_slip_pump || $sm->pack_slip_pumpset) {
|
||||
// $stickCount += $sm->pack_slip_motor ? 1 : 0;
|
||||
// $stickCount += $sm->pack_slip_pump ? 1 : 0;
|
||||
// $stickCount += $sm->pack_slip_pumpset ? 1 : 0;
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Already scanned
|
||||
// $scannedCount += $record->motor_scanned_status == 1 ? 1 : 0;
|
||||
// $scannedCount += $record->pump_scanned_status == 1 ? 1 : 0;
|
||||
// $scannedCount += $record->capacitor_scanned_status == 1 ? 1 : 0;
|
||||
// $scannedCount += $record->scanned_status_set == 1 ? 1 : 0;
|
||||
|
||||
// return max($stickCount - $scannedCount, 0);
|
||||
// });
|
||||
|
||||
// $this->dispatch($onCapFocus ? 'focus-capacitor-input' : 'focus-serial-number');
|
||||
// }
|
||||
|
||||
public function loadData($invoiceNumber, $plantId, $onCapFocus = false)
|
||||
{
|
||||
@@ -381,106 +320,82 @@ class InvoiceDataTable extends Component
|
||||
$this->materialInvoice = false;
|
||||
|
||||
$this->resetPage();
|
||||
|
||||
$this->packageCount = 0;
|
||||
|
||||
$records = InvoiceValidation::with('stickerMasterRelation')
|
||||
$this->packageCount = InvoiceValidation::with('stickerMasterRelation')
|
||||
->where('invoice_number', $this->invoiceNumber)
|
||||
->where('plant_id', $this->plantId)
|
||||
->get();
|
||||
->whereNull('scanned_status')
|
||||
->get()
|
||||
->sum(function ($record) {
|
||||
$sm = $record->stickerMasterRelation;
|
||||
|
||||
$this->packageCount = $records->sum(function ($record) {
|
||||
$stickCount = 0;
|
||||
$scannedCount = 0;
|
||||
|
||||
$sm = $record->stickerMasterRelation;
|
||||
if ($sm) {
|
||||
|
||||
if (! $sm) {
|
||||
return 0;
|
||||
}
|
||||
// if (strlen($sm->panel_box_code) > 0) $stickCount++;
|
||||
|
||||
$stickCount = 0;
|
||||
$scannedCount = 0;
|
||||
if (!empty($sm->panel_box_code)) {
|
||||
$stickCount++;
|
||||
if (!empty($record->panel_box_serial_number)) {
|
||||
$scannedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($sm->panel_box_code)) {
|
||||
$stickCount++;
|
||||
|
||||
if ($record->capacitor_scanned_status == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
}
|
||||
if ($sm->tube_sticker_motor == 1 || $sm->tube_sticker_pump == 1 || $sm->tube_sticker_pumpset == 1) {
|
||||
|
||||
if ($sm->tube_sticker_motor == 1) {
|
||||
$stickCount++;
|
||||
if ($record->motor_scanned_status == 1) {
|
||||
$scannedCount++;
|
||||
// Tube stickers
|
||||
if ($sm->tube_sticker_motor || $sm->tube_sticker_pump || $sm->tube_sticker_pumpset) {
|
||||
$stickCount += $sm->tube_sticker_motor ? 1 : 0;
|
||||
$stickCount += ($sm->tube_sticker_pump || ($sm->tube_sticker_pumpset != 1 && !$sm->tube_sticker_pump && $sm->pack_slip_pump)) ? 1 : 0;
|
||||
$stickCount += $sm->tube_sticker_pumpset ? 1 : 0;
|
||||
}
|
||||
// Pack slips (only if tube stickers not applied)
|
||||
elseif ($sm->pack_slip_motor || $sm->pack_slip_pump || $sm->pack_slip_pumpset) {
|
||||
$stickCount += $sm->pack_slip_motor ? 1 : 0;
|
||||
$stickCount += $sm->pack_slip_pump ? 1 : 0;
|
||||
$stickCount += $sm->pack_slip_pumpset ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
$sm->tube_sticker_pump == 1 ||
|
||||
($sm->tube_sticker_pumpset != 1 &&
|
||||
$sm->tube_sticker_pump != 1 &&
|
||||
$sm->pack_slip_pump == 1)
|
||||
) {
|
||||
$stickCount++;
|
||||
if ($record->pump_scanned_status == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
}
|
||||
// Already scanned
|
||||
$scannedCount += $record->motor_scanned_status == 1 ? 1 : 0;
|
||||
$scannedCount += $record->pump_scanned_status == 1 ? 1 : 0;
|
||||
$scannedCount += $record->capacitor_scanned_status == 1 ? 1 : 0;
|
||||
$scannedCount += $record->scanned_status_set == 1 ? 1 : 0;
|
||||
|
||||
if ($sm->tube_sticker_pumpset == 1) {
|
||||
$stickCount++;
|
||||
if ($record->scanned_status_set == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
}
|
||||
} elseif ($sm->pack_slip_motor == 1 || $sm->pack_slip_pump == 1 || $sm->pack_slip_pumpset == 1) {
|
||||
if ($sm->pack_slip_motor == 1) {
|
||||
$stickCount++;
|
||||
if ($record->motor_scanned_status == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
}
|
||||
// if (!empty($record->panel_box_serial_number)) {
|
||||
// $scannedCount++;
|
||||
// }
|
||||
return max($stickCount - $scannedCount, 0);
|
||||
});
|
||||
|
||||
if ($sm->pack_slip_pump == 1) {
|
||||
$stickCount++;
|
||||
if ($record->pump_scanned_status == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($sm->pack_slip_pumpset == 1) {
|
||||
$stickCount++;
|
||||
if ($record->scanned_status_set == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return max($stickCount - $scannedCount, 0);
|
||||
});
|
||||
|
||||
$this->dispatch(
|
||||
$onCapFocus ? 'focus-capacitor-input' : 'focus-serial-number'
|
||||
);
|
||||
$this->dispatch($onCapFocus ? 'focus-capacitor-input' : 'focus-serial-number');
|
||||
}
|
||||
|
||||
public function getInvoiceRecordsProperty()
|
||||
{
|
||||
return InvoiceValidation::with('stickerMasterRelation.item')
|
||||
->where('invoice_number', $this->invoiceNumber)
|
||||
->where('plant_id', $this->plantId)
|
||||
->where(function ($query) {
|
||||
$query->whereNull('scanned_status')
|
||||
->orWhere('scanned_status', '');
|
||||
})
|
||||
// ->when($this->hasSearched, function ($query) {
|
||||
// $query->where('invoice_number', $this->invoiceNumber)
|
||||
// ->where('plant_id', $this->plantId)
|
||||
// ->where('scanned_status', '=', '');
|
||||
// })
|
||||
->paginate(6);
|
||||
->when(! $this->hasSearched, fn ($q) => $q->whereRaw('1 = 0'))
|
||||
->when($this->hasSearched, fn ($q) =>
|
||||
$q->where('invoice_number', $this->invoiceNumber)
|
||||
->where('plant_id', $this->plantId)
|
||||
->whereNull('scanned_status')
|
||||
)
|
||||
->paginate(7);
|
||||
}
|
||||
|
||||
// public function getInvoiceRecordsProperty()
|
||||
// {
|
||||
// return InvoiceValidation::with('stickerMasterRelation.item')
|
||||
// ->where('invoice_number', $this->hasSearched ? $this->invoiceNumber : null)
|
||||
// ->where('plant_id', $this->hasSearched ? $this->plantId : null)
|
||||
// ->whereNull('scanned_status')
|
||||
// ->paginate(7);
|
||||
// }
|
||||
|
||||
|
||||
// public function loadData($invoiceNumber, $plantId, $onCapFocus = false)
|
||||
// {
|
||||
// $this->plantId = $plantId;
|
||||
@@ -563,6 +478,7 @@ class InvoiceDataTable extends Component
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
public function loadMaterialData($invoiceNumber, $plantId)
|
||||
{
|
||||
$this->plantId = $plantId;
|
||||
@@ -627,168 +543,10 @@ class InvoiceDataTable extends Component
|
||||
|
||||
public function cancelCapacitorInput()
|
||||
{
|
||||
$this->capacitorInput = null;
|
||||
$this->showCapacitorInput = false;
|
||||
$this->dispatch('focus-serial-number');
|
||||
}
|
||||
|
||||
// public function processCapacitorInput()
|
||||
// {
|
||||
// $user = Filament::auth()->user();
|
||||
// $operatorName = $user->name;
|
||||
|
||||
// if (! $this->capacitorInput) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (! preg_match('/^[^\/]+\/[^\/]+\/.+$/', $this->capacitorInput)) {
|
||||
// Notification::make()
|
||||
// ->title('Invalid Panel Box QR Format:')
|
||||
// ->body("Scan the valid panel box QR '$this->capacitorInput' to proceed!")
|
||||
// ->danger()
|
||||
// // ->duration(3000)
|
||||
// ->seconds(2)
|
||||
// ->send();
|
||||
|
||||
// $this->capacitorInput = '';
|
||||
// return;
|
||||
// }
|
||||
|
||||
// $parts = explode('/', $this->capacitorInput);
|
||||
// $supplier = $parts[0];
|
||||
// $itemCode = $parts[1];
|
||||
// $serialNumber = implode('/', array_slice($parts, 2)); // Keep rest of the string
|
||||
|
||||
// $existsInStickerMaster = StickerMaster::where('panel_box_code', $itemCode)->where('plant_id', $this->plantId)->whereHas('item', function ($query) {
|
||||
// $query->where('code', $this->currentItemCode);
|
||||
// })
|
||||
// ->exists();
|
||||
|
||||
// if (! $existsInStickerMaster) {
|
||||
// Notification::make()
|
||||
// ->title('Unknown: Panel Box Code')
|
||||
// ->body("Unknown panel box code: $itemCode found for item code: $this->currentItemCode")
|
||||
// ->danger()
|
||||
// // ->duration(4000)
|
||||
// ->seconds(2)
|
||||
// ->send();
|
||||
// $this->capacitorInput = '';
|
||||
|
||||
// return;
|
||||
// }
|
||||
|
||||
// foreach ($this->invoiceData as &$row) {
|
||||
|
||||
// if (($row['code'] ?? '') === $this->currentItemCode && ($row['serial_number'] ?? '') === $this->currentSerialNumber) {
|
||||
// $row['panel_box_supplier'] = $supplier;
|
||||
// $row['panel_box_code'] = $itemCode;
|
||||
// $row['panel_box_serial_number'] = $serialNumber;
|
||||
// $row['capacitor_scanned_status'] = 1;
|
||||
// // $row['scanned_status_set'] = true;
|
||||
|
||||
// $matchingValidation = InvoiceValidation::with('stickerMaster.item')
|
||||
// ->where('serial_number', $this->currentSerialNumber)
|
||||
// ->where('plant_id', $this->plantId)
|
||||
// ->get()
|
||||
// ->first(function ($validation) {
|
||||
// return $validation->stickerMaster?->item?->code === $this->currentItemCode;
|
||||
// });
|
||||
|
||||
// // dd($matchingValidation);
|
||||
|
||||
// if ($matchingValidation) {
|
||||
// $hasMotorQr = $matchingValidation->stickerMasterRelation->tube_sticker_motor ?? null;
|
||||
// $hasPumpQr = $matchingValidation->stickerMasterRelation->tube_sticker_pump ?? null;
|
||||
// $hasPumpSetQr = $matchingValidation->stickerMasterRelation->tube_sticker_pumpset ?? null;
|
||||
// // $hasCapacitorQr = $matchingValidation->stickerMasterRelation->panel_box_code ?? null;
|
||||
|
||||
// $hadMotorQr = $matchingValidation->motor_scanned_status ?? null;
|
||||
// $hadPumpQr = $matchingValidation->pump_scanned_status ?? null;
|
||||
// $hadPumpSetQr = $matchingValidation->scanned_status_set ?? null;
|
||||
// // $hadCapacitorQr = $matchingValidation->capacitor_scanned_status ?? null;
|
||||
|
||||
// $packCnt = 1;
|
||||
// $scanCnt = 1;
|
||||
// // if ($hadMotorQr === $hasMotorQr && $hadPumpQr === $hasPumpQr && $hadPumpSetQr === $hasPumpSetQr)
|
||||
// if ($hasMotorQr || $hasPumpQr || $hasPumpSetQr) {
|
||||
// $packCnt = $hasMotorQr ? $packCnt + 1 : $packCnt;
|
||||
// $packCnt = $hasPumpQr ? $packCnt + 1 : $packCnt;
|
||||
// $packCnt = $hasPumpSetQr ? $packCnt + 1 : $packCnt;
|
||||
|
||||
// $scanCnt = $hadMotorQr ? $scanCnt + 1 : $scanCnt;
|
||||
// $scanCnt = $hadPumpQr ? $scanCnt + 1 : $scanCnt;
|
||||
// $scanCnt = $hadPumpSetQr ? $scanCnt + 1 : $scanCnt;
|
||||
|
||||
// if ($packCnt === $scanCnt) {
|
||||
// $matchingValidation->update([
|
||||
// 'panel_box_supplier' => $supplier,
|
||||
// 'panel_box_code' => $itemCode,
|
||||
// 'panel_box_serial_number' => $serialNumber,
|
||||
// 'capacitor_scanned_status' => 1,
|
||||
// 'scanned_status' => 'Scanned',
|
||||
// 'operator_id' => $operatorName,
|
||||
// ]);
|
||||
// } else {
|
||||
// $matchingValidation->update([
|
||||
// 'panel_box_supplier' => $supplier,
|
||||
// 'panel_box_code' => $itemCode,
|
||||
// 'panel_box_serial_number' => $serialNumber,
|
||||
// 'capacitor_scanned_status' => 1,
|
||||
// 'operator_id' => $operatorName,
|
||||
// ]);
|
||||
// }
|
||||
// } else {
|
||||
// $matchingValidation->update([
|
||||
// 'panel_box_supplier' => $supplier,
|
||||
// 'panel_box_code' => $itemCode,
|
||||
// 'panel_box_serial_number' => $serialNumber,
|
||||
// 'capacitor_scanned_status' => 1,
|
||||
// 'scanned_status' => 'Scanned',
|
||||
// 'operator_id' => $operatorName,
|
||||
// ]);
|
||||
// }
|
||||
|
||||
// // Notification::make()
|
||||
// // ->title('Success: Capacitor QR')
|
||||
// // // ->title("Panel box code scanned: $itemCode")
|
||||
// // ->body("'Capacitor' QR scanned status updated, Scan next QR.")
|
||||
// // ->success() // commented
|
||||
// // ->seconds(2)
|
||||
// // ->send();
|
||||
|
||||
// $totalQuantity = InvoiceValidation::where('invoice_number', $matchingValidation->invoice_number)->where('plant_id', $this->plantId)->count();
|
||||
// $scannedQuantity = InvoiceValidation::where('invoice_number', $matchingValidation->invoice_number)->where('plant_id', $this->plantId)->where('scanned_status', 'Scanned')->count();
|
||||
// // $this->form->fill([
|
||||
// // 'plant_id' => $matchingValidation->plant_id,
|
||||
// // 'invoice_number' => $matchingValidation->invoice_number,
|
||||
// // 'serial_number' => null,
|
||||
// // 'total_quantity' => $totalQuantity,
|
||||
// // 'scanned_quantity'=> $scannedQuantity,
|
||||
// // ]);
|
||||
|
||||
// if ($totalQuantity === $scannedQuantity) {
|
||||
// Notification::make()
|
||||
// ->title('Completed: Serial Invoice')
|
||||
// ->body("Serial invoice '$matchingValidation->invoice_number' completed the scanning process.<br>Scan the next 'Serial Invoice' to proceed!")
|
||||
// ->success()
|
||||
// ->seconds(2)
|
||||
// ->send();
|
||||
// $this->loadCompletedData($matchingValidation->invoice_number, $matchingValidation->plant_id, true);
|
||||
// } else {
|
||||
// $this->loadData($matchingValidation->invoice_number, $matchingValidation->plant_id, false);
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// $this->showCapacitorInput = false;
|
||||
// $this->capacitorInput = '';
|
||||
// $this->dispatch('updateScannedQuantity');
|
||||
// // $this->loadData($this->invoiceNumber, $this->plantId);
|
||||
// $this->dispatch('focus-serial-number');
|
||||
// }
|
||||
|
||||
public function processCapacitorInput()
|
||||
{
|
||||
$user = Filament::auth()->user();
|
||||
@@ -808,7 +566,6 @@ class InvoiceDataTable extends Component
|
||||
->send();
|
||||
|
||||
$this->capacitorInput = '';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -838,16 +595,19 @@ class InvoiceDataTable extends Component
|
||||
$this->package = InvoiceValidation::with('stickerMasterRelation')
|
||||
->where('invoice_number', $this->invoiceNumber)
|
||||
->where('plant_id', $this->plantId)
|
||||
->whereNull('scanned_status')
|
||||
->get();
|
||||
|
||||
foreach ($this->package as &$row) {
|
||||
|
||||
// if (($row['code'] ?? '') === $this->currentItemCode && ($row['serial_number'] ?? '') === $this->currentSerialNumber) {
|
||||
// if ($row->stickerMasterRelation?->item?->code == $this->currentItemCode && ($row['serial_number'] ?? '') === $this->currentSerialNumber) {
|
||||
$stickerCode = $row->stickerMasterRelation?->item?->code ?? null;
|
||||
$serialNo = $row->serial_number ?? null;
|
||||
$serialNumber = $row->serial_number ?? null;
|
||||
|
||||
if ($stickerCode === $this->currentItemCode && $serialNo === $this->currentSerialNumber) {
|
||||
if ($stickerCode === $this->currentItemCode && $serialNumber === $this->currentSerialNumber) {
|
||||
$row['panel_box_supplier'] = $supplier;
|
||||
$row['panel_box_code'] = $itemCode;
|
||||
$row['panel_box_item_code'] = $itemCode;
|
||||
$row['panel_box_serial_number'] = $serialNumber;
|
||||
$row['capacitor_scanned_status'] = 1;
|
||||
// $row['scanned_status_set'] = true;
|
||||
@@ -860,7 +620,7 @@ class InvoiceDataTable extends Component
|
||||
return $validation->stickerMaster?->item?->code === $this->currentItemCode;
|
||||
});
|
||||
|
||||
// dd($matchingValidation);
|
||||
// dd($matchingValidation);
|
||||
|
||||
if ($matchingValidation) {
|
||||
$hasMotorQr = $matchingValidation->stickerMasterRelation->tube_sticker_motor ?? null;
|
||||
@@ -888,7 +648,7 @@ class InvoiceDataTable extends Component
|
||||
if ($packCnt === $scanCnt) {
|
||||
$matchingValidation->update([
|
||||
'panel_box_supplier' => $supplier,
|
||||
'panel_box_code' => $itemCode,
|
||||
'panel_box_item_code' => $itemCode,
|
||||
'panel_box_serial_number' => $serialNumber,
|
||||
'capacitor_scanned_status' => 1,
|
||||
'scanned_status' => 'Scanned',
|
||||
@@ -897,7 +657,7 @@ class InvoiceDataTable extends Component
|
||||
} else {
|
||||
$matchingValidation->update([
|
||||
'panel_box_supplier' => $supplier,
|
||||
'panel_box_code' => $itemCode,
|
||||
'panel_box_item_code' => $itemCode,
|
||||
'panel_box_serial_number' => $serialNumber,
|
||||
'capacitor_scanned_status' => 1,
|
||||
'operator_id' => $operatorName,
|
||||
@@ -906,7 +666,7 @@ class InvoiceDataTable extends Component
|
||||
} else {
|
||||
$matchingValidation->update([
|
||||
'panel_box_supplier' => $supplier,
|
||||
'panel_box_code' => $itemCode,
|
||||
'panel_box_item_code' => $itemCode,
|
||||
'panel_box_serial_number' => $serialNumber,
|
||||
'capacitor_scanned_status' => 1,
|
||||
'scanned_status' => 'Scanned',
|
||||
|
||||
@@ -23,7 +23,6 @@ class InvoiceValidation extends Model
|
||||
'capacitor_scanned_status',
|
||||
'scanned_status_set',
|
||||
'scanned_status',
|
||||
'panel_box_code',
|
||||
'panel_box_supplier',
|
||||
'panel_box_serial_number',
|
||||
'load_rate',
|
||||
@@ -31,8 +30,6 @@ class InvoiceValidation extends Model
|
||||
'batch_number',
|
||||
'quantity',
|
||||
'operator_id',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
public function plant(): BelongsTo
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
@@ -26,20 +27,19 @@ return new class extends Migration
|
||||
scanned_status_set TEXT DEFAULT NULL,
|
||||
scanned_status TEXT DEFAULT NULL,
|
||||
|
||||
panel_box_code TEXT DEFAULT NULL,
|
||||
panel_box_supplier TEXT DEFAULT NULL,
|
||||
panel_box_serial_number TEXT DEFAULT NULL,
|
||||
|
||||
load_rate INT NOT NULL DEFAULT (0),
|
||||
upload_status TEXT NOT NULL DEFAULT 'N',
|
||||
|
||||
|
||||
batch_number TEXT DEFAULT NULL,
|
||||
quantity INT DEFAULT NULL,
|
||||
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
UNIQUE (plant_id, serial_number),
|
||||
@@ -48,7 +48,7 @@ return new class extends Migration
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
<?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
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE characteristic_approver_masters
|
||||
ADD COLUMN approver_type TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('characteristic_approver_masters', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -1,45 +0,0 @@
|
||||
<?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
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE invoice_validations
|
||||
ADD COLUMN panel_box_code TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
|
||||
$sql2 = <<<'SQL'
|
||||
ALTER TABLE invoice_validations
|
||||
ADD COLUMN created_by TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql2);
|
||||
|
||||
$sql3 = <<<'SQL'
|
||||
ALTER TABLE invoice_validations
|
||||
ADD COLUMN updated_by TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('invoice_validations', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -1,126 +1,19 @@
|
||||
<x-filament-panels::page>
|
||||
|
||||
<!-- HEADER -->
|
||||
<div class="mb-8">
|
||||
<h1 class="text-4xl font-bold tracking-tight">
|
||||
CRI Digital Manufacturing IIoT Platform
|
||||
</h1>
|
||||
<p class="text-lg text-gray-600 mt-2">
|
||||
Complete visibility, traceability, and control across your manufacturing operations
|
||||
</p>
|
||||
</div>
|
||||
<h1 class="text-3xl font-bold mb-6">Welcome to CRI Digital Manufacturing IIOT</h1>
|
||||
|
||||
<!-- BANNER -->
|
||||
{{-- <div class="w-full overflow-hidden rounded-2xl shadow mb-10"> --}}
|
||||
<div class="w-full overflow-hidden rounded-xl shadow">
|
||||
<img
|
||||
src="{{ asset('images/iiot-banner.jpg') }}"
|
||||
alt="CRI Digital Manufacturing IIoT"
|
||||
class="w-full h-72 object-cover"
|
||||
>
|
||||
</div>
|
||||
<div class="w-full overflow-hidden rounded-xl shadow">
|
||||
<img
|
||||
src="{{ asset('images/iiot-banner.jpg') }}"
|
||||
alt="CRI Digital Manufacturing IIoT"
|
||||
class="w-full h-64 object-cover"
|
||||
>
|
||||
</div>
|
||||
|
||||
<!-- INTRO -->
|
||||
<div class="max-w-4xl mb-10">
|
||||
<p class="text-lg text-gray-700 mb-4">
|
||||
CRI Digital Manufacturing IIoT is built to deliver
|
||||
<strong>end-to-end traceability, real-time insights, and operational transparency</strong>
|
||||
across plants, lines, and production processes.
|
||||
</p>
|
||||
|
||||
<p class="text-lg text-gray-700">
|
||||
The platform ensures <strong>right quality and on-time delivery</strong> by enabling
|
||||
complete tracking of materials, production orders, and finished goods—helping teams
|
||||
make faster, data-driven decisions with confidence.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- KEY PILLARS -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-10">
|
||||
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
<h3 class="text-lg font-semibold mb-2">🔍 Traceability</h3>
|
||||
<p class="text-gray-600">
|
||||
Track materials, batches, and serials from input to dispatch.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
<h3 class="text-lg font-semibold mb-2">✅ Quality Assurance</h3>
|
||||
<p class="text-gray-600">
|
||||
Validate process data and ensure first-time-right production.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
<h3 class="text-lg font-semibold mb-2">⏱ On-Time Delivery</h3>
|
||||
<p class="text-gray-600">
|
||||
Identify delays early and meet production commitments.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
<h3 class="text-lg font-semibold mb-2">📊 Real-Time Insights</h3>
|
||||
<p class="text-gray-600">
|
||||
Monitor performance and take quick corrective actions.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- SUPPORT -->
|
||||
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
<h2 class="text-2xl font-semibold mb-3">24×7 Support</h2>
|
||||
<p class="text-gray-700 mb-2">
|
||||
Our dedicated IIoT support team is available round-the-clock to ensure
|
||||
uninterrupted operations and quick issue resolution.
|
||||
</p>
|
||||
<p class="text-lg font-medium text-gray-900">
|
||||
📞 Support Landline: <span class="font-semibold">0422 711 7179</span>
|
||||
</p>
|
||||
{{-- <p class="text-lg font-medium text-gray-900">
|
||||
📞 Technical Support Contact: <span class="font-semibold">9952468104 / 9100832269</span>
|
||||
</p> --}}
|
||||
</div>
|
||||
|
||||
{{-- <div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
<h2 class="text-2xl font-semibold mb-4">24×7 Support</h2>
|
||||
|
||||
<p class="text-lg text-gray-700 mb-4">
|
||||
Our support structure is designed to ensure quick resolution based on the type
|
||||
of issue — whether it is on-site, application-related, or infrastructure-related.
|
||||
</p>
|
||||
|
||||
<div class="space-y-3">
|
||||
|
||||
<p class="text-lg font-medium text-gray-900">
|
||||
🏭 <strong>Plant & On-Site Support</strong> <br>
|
||||
<span class="text-gray-700">
|
||||
For plant visits, industry-level issues, and on-ground validation
|
||||
</span><br>
|
||||
📞 <span class="font-semibold">8925899458 / 8925899459</span>
|
||||
</p>
|
||||
|
||||
<p class="text-lg font-medium text-gray-900">
|
||||
💻 <strong>Application & Logic Support</strong> <br>
|
||||
<span class="text-gray-700">
|
||||
For website errors, logic issues, and application-level problems
|
||||
</span><br>
|
||||
📞 <span class="font-semibold">9952468104 / 9100832269</span>
|
||||
</p>
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
|
||||
<!-- TEAM -->
|
||||
{{-- <div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
<h2 class="text-2xl font-semibold mb-4">IIOT Team Members</h2>
|
||||
<div class="grid grid-cols-2 md:grid-cols-3 gap-4 text-gray-700">
|
||||
<div class="flex items-center gap-2">👤 Jothikumar</div>
|
||||
<div class="flex items-center gap-2">👤 Jeithef Shibu</div>
|
||||
<div class="flex items-center gap-2">👤 Dhanabalan</div>
|
||||
<div class="flex items-center gap-2">👤 Ranjith</div>
|
||||
<div class="flex items-center gap-2">👤 Srimathy</div>
|
||||
<div class="flex items-center gap-2">👤 Gokul</div>
|
||||
</div>
|
||||
</div> --}}
|
||||
<p class="text-lg text-gray-600 mb-6">
|
||||
This dashboard provides real-time visibility into your manufacturing operations,
|
||||
enabling you to monitor production, track performance, and make data-driven decisions
|
||||
across plants and lines—all from one centralized platform.
|
||||
</p>
|
||||
|
||||
</x-filament-panels::page>
|
||||
|
||||
@@ -81,7 +81,6 @@
|
||||
<th class="border px-4 py-2">Scanned Status</th>
|
||||
<th class="border px-4 py-2 w-[300px] whitespace-nowrap">Time Stamp</th>
|
||||
<th class="border px-4 py-2">Operator ID</th>
|
||||
<th class="border px-4 py-2">Panel Box Code</th>
|
||||
<th class="border px-4 py-2">Panel Box Supplier</th>
|
||||
<th class="border px-4 py-2">Panel Box Serial Number</th>
|
||||
</tr>
|
||||
@@ -99,7 +98,6 @@
|
||||
<td class="border px-4 py-2">{{ $row['scanned_status'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2">{{ $row['created_at'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2">{{ $row['operator_id'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2">{{ $row['panel_box_code'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2">{{ $row['panel_box_supplier'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2">{{ $row['panel_box_serial_number'] ?? '' }}</td>
|
||||
</tr>
|
||||
@@ -132,7 +130,6 @@
|
||||
<th class="border px-4 py-2">Scanned Status</th>
|
||||
<th class="border px-4 py-2 w-[300px] whitespace-nowrap">Time Stamp</th>
|
||||
<th class="border px-4 py-2">Operator ID</th>
|
||||
<th class="border px-4 py-2">Panel Box Code</th>
|
||||
<th class="border px-4 py-2">Panel Box Supplier</th>
|
||||
<th class="border px-4 py-2">Panel Box Serial Number</th>
|
||||
</tr>
|
||||
@@ -151,7 +148,6 @@
|
||||
<td class="border px-2 py-2">{{ $record->scanned_status ?? '' }}</td>
|
||||
<td class="border px-2 py-2 whitespace-nowrap">{{ optional($record->created_at)->format('d-m-Y H:i:s') }}</td>
|
||||
<td class="border px-2 py-2">{{ $record->operator_id ?? '' }}</td>
|
||||
<td class="border px-2 py-2">{{ $record->panel_box_code ?? '' }}</td>
|
||||
<td class="border px-2 py-2">{{ $record->panel_box_supplier ?? '' }}</td>
|
||||
<td class="border px-2 py-2">{{ $record->panel_box_serial_number ?? '' }}</td>
|
||||
</tr>
|
||||
@@ -168,6 +164,7 @@
|
||||
{{ $records->onEachSide(3)->links() }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endif
|
||||
|
||||
{{-- Modal for Capacitor Input --}}
|
||||
@@ -202,10 +199,10 @@
|
||||
</div>
|
||||
</div>
|
||||
{{-- Add this script to focus on the input --}}
|
||||
<script>
|
||||
document.getElementById('capacitorInput').focus();
|
||||
</script>
|
||||
{{-- <script>
|
||||
document.getElementById('capacitorInput').focus();
|
||||
</script> --}}
|
||||
<script>
|
||||
document.addEventListener('livewire:initialized', () => {
|
||||
@this.on('focus-capacitor-input', () => {
|
||||
setTimeout(() => {
|
||||
@@ -214,7 +211,7 @@
|
||||
}, 100);
|
||||
});
|
||||
});
|
||||
</script> --}}
|
||||
</script>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ use App\Http\Controllers\ModuleProductionLineStopController;
|
||||
use App\Http\Controllers\ModuleProductionOrderDataController;
|
||||
use App\Http\Controllers\ObdController;
|
||||
use App\Http\Controllers\PalletController;
|
||||
// use App\Http\Controllers\PalletPrintController;
|
||||
use App\Http\Controllers\PdfController;
|
||||
use App\Http\Controllers\PlantController;
|
||||
use App\Http\Controllers\ProductionStickerReprintController;
|
||||
@@ -205,12 +204,12 @@ Route::post('grmaster-sno-update', [PdfController::class, 'updateGR']);
|
||||
Route::post('file/store', [SapFileController::class, 'store'])->name('file.store');
|
||||
|
||||
// routes/api.php
|
||||
|
||||
// Route::post('/characteristic/hold-save', [CharacteristicApprovalController::class, 'holdSave']);
|
||||
|
||||
// Route::post('send-telegram', [TelegramController::class, 'sendMessage']);
|
||||
|
||||
// Route::post('invoice-exit', [InvoiceValidationController::class, 'handle']);
|
||||
|
||||
// Route::get('/print-pallet/{pallet}/{plant}', [PalletPrintController::class, 'print'])
|
||||
// ->name('print.pallet');
|
||||
|
||||
// Route::post('/characteristic/hold-save', [CharacteristicApprovalController::class, 'holdSave'])
|
||||
// ->name('characteristic.hold.save');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\CharacteristicApprovalController;
|
||||
// use App\Http\Controllers\FileUploadController;
|
||||
use App\Http\Controllers\FileUploadController;
|
||||
use App\Models\EquipmentMaster;
|
||||
use App\Models\User;
|
||||
use Filament\Facades\Filament;
|
||||
@@ -41,22 +41,11 @@ Route::get('/approval/reject-success', function () {
|
||||
return view('approval.reject-success');
|
||||
})->name('approval.reject.success');
|
||||
|
||||
Route::get('/characteristic/approve', [CharacteristicApprovalController::class, 'approveForm'])
|
||||
Route::get('/characteristic/approve', [CharacteristicApprovalController::class, 'approve'])
|
||||
->name('characteristic.approve')
|
||||
->middleware('signed');
|
||||
|
||||
Route::post('/characteristic/approve-save', [CharacteristicApprovalController::class, 'approveSave'])
|
||||
->name('characteristic.approve.save');
|
||||
|
||||
Route::get('/approval/approve-success', function () {
|
||||
return view('approval.approve-success');
|
||||
})->name('approval.approve.success');
|
||||
|
||||
// Route::get('/characteristic/approve', [CharacteristicApprovalController::class, 'approve'])
|
||||
// ->name('characteristic.approve')
|
||||
// ->middleware('signed');
|
||||
|
||||
// Route::post('/file-upload', [FileUploadController::class, 'upload'])->name('file.upload');
|
||||
Route::post('/file-upload', [FileUploadController::class, 'upload'])->name('file.upload');
|
||||
|
||||
// Route::get('/characteristic/hold', [CharacteristicApprovalController::class, 'hold'])
|
||||
// ->name('characteristic.hold')
|
||||
|
||||
Reference in New Issue
Block a user