Compare commits
1 Commits
61774d240a
...
renovate/b
| Author | SHA1 | Date | |
|---|---|---|---|
| 52f61551a3 |
@@ -1,77 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\CharacteristicApproverMaster;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class CharacteristicApproverMasterExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = CharacteristicApproverMaster::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
// ExportColumn::make('id')
|
||||
// ->label('ID'),
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('machine.work_center')
|
||||
->label('WORK CENTER'),
|
||||
ExportColumn::make('machine_name')
|
||||
->label('MACHINE NAME'),
|
||||
ExportColumn::make('characteristic_field')
|
||||
->label('MASTER CHARACTERISTIC FIELD 1'),
|
||||
ExportColumn::make('name1')
|
||||
->label('APPROVER NAME 1'),
|
||||
ExportColumn::make('mail1')
|
||||
->label('APPROVER MAIL 1'),
|
||||
ExportColumn::make('duration1')
|
||||
->label('DURATION 1'),
|
||||
ExportColumn::make('name2')
|
||||
->label('APPROVER NAME 2'),
|
||||
ExportColumn::make('mail2')
|
||||
->label('APPROVER MAIL 2'),
|
||||
ExportColumn::make('duration2')
|
||||
->label('DURATION 2'),
|
||||
ExportColumn::make('name3')
|
||||
->label('APPROVER NAME 3'),
|
||||
ExportColumn::make('mail3')
|
||||
->label('APPROVER MAIL 3'),
|
||||
ExportColumn::make('duration3')
|
||||
->label('DURATION 3'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your characteristic approver master export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
@@ -1,335 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\ClassCharacteristic;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class ClassCharacteristicExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = ClassCharacteristic::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('aufnr')
|
||||
->label('AUFNR'),
|
||||
ExportColumn::make('class')
|
||||
->label('CLASS'),
|
||||
ExportColumn::make('arbid')
|
||||
->label('ARBID'),
|
||||
ExportColumn::make('gamng')
|
||||
->label('GAMNG'),
|
||||
ExportColumn::make('lmnga')
|
||||
->label('LMNGA'),
|
||||
ExportColumn::make('gernr')
|
||||
->label('GERNR'),
|
||||
ExportColumn::make('zz1_cn_bill_ord')
|
||||
->label('ZZ1 CN BILL ORD'),
|
||||
ExportColumn::make('zmm_amps')
|
||||
->label('ZMM AMPSTEXT'),
|
||||
ExportColumn::make('zmm_brand')
|
||||
->label('ZMM BRAND'),
|
||||
ExportColumn::make('zmm_degreeofprotection')
|
||||
->label('ZMM DEGREEOFPROTECTION'),
|
||||
ExportColumn::make('zmm_delivery')
|
||||
->label('ZMM DELIVERY'),
|
||||
ExportColumn::make('zmm_dir_rot')
|
||||
->label('ZMM DIR ROT'),
|
||||
ExportColumn::make('zmm_discharge')
|
||||
->label('ZMM DISCHARGE'),
|
||||
ExportColumn::make('zmm_discharge_max')
|
||||
->label('ZMM DISCHARGE MAX'),
|
||||
ExportColumn::make('zmm_discharge_min')
|
||||
->label('ZMM DISCHARGE MIN'),
|
||||
ExportColumn::make('zmm_duty')
|
||||
->label('ZMM DUTY'),
|
||||
ExportColumn::make('zmm_eff_motor')
|
||||
->label('ZMM EFF MOTOR'),
|
||||
ExportColumn::make('zmm_eff_pump')
|
||||
->label('ZMM EFF PUMP'),
|
||||
ExportColumn::make('zmm_frequency')
|
||||
->label('ZMM FREQUENCY'),
|
||||
ExportColumn::make('zmm_head')
|
||||
->label('ZMM HEAD'),
|
||||
ExportColumn::make('zmm_heading')
|
||||
->label('ZMM HEADING'),
|
||||
ExportColumn::make('zmm_head_max')
|
||||
->label('ZMM HEAD MAX'),
|
||||
ExportColumn::make('zmm_head_minimum')
|
||||
->label('ZMM HEAD MINIMUM'),
|
||||
ExportColumn::make('zmm_idx_eff_mtr')
|
||||
->label('ZMM IDX EFF MTR'),
|
||||
ExportColumn::make('zmm_idx_eff_pump')
|
||||
->label('ZMM IDX EFF PUMP'),
|
||||
ExportColumn::make('zmm_kvacode')
|
||||
->label('ZMM KVACODE'),
|
||||
ExportColumn::make('zmm_maxambtemp')
|
||||
->label('ZMM MAXAMBTEMP'),
|
||||
ExportColumn::make('zmm_mincoolingflow')
|
||||
->label('ZMM MINCOOLING FLOW'),
|
||||
ExportColumn::make('zmm_motorseries')
|
||||
->label('ZMM MOTORSERIES'),
|
||||
ExportColumn::make('zmm_motor_model')
|
||||
->label('ZMM MOTOR MODEL'),
|
||||
ExportColumn::make('zmm_outlet')
|
||||
->label('ZMM OUTLET'),
|
||||
ExportColumn::make('zmm_phase')
|
||||
->label('ZMM PHASE'),
|
||||
ExportColumn::make('zmm_pressure')
|
||||
->label('ZMM PRESSURE'),
|
||||
ExportColumn::make('zmm_pumpflowtype')
|
||||
->label('ZMM PUMPFLOWTYPE'),
|
||||
ExportColumn::make('zmm_pumpseries')
|
||||
->label('ZMM PUMPSERIES'),
|
||||
ExportColumn::make('zmm_pump_model')
|
||||
->label('ZMM PUMP MODEL'),
|
||||
ExportColumn::make('zmm_ratedpower')
|
||||
->label('ZMM RATEDPOWER'),
|
||||
ExportColumn::make('zmm_region')
|
||||
->label('ZMM REGION'),
|
||||
ExportColumn::make('zmm_servicefactor')
|
||||
->label('ZMM SERVICEFACTOR'),
|
||||
ExportColumn::make('zmm_servicefactormaximumamps')
|
||||
->label('ZMM SERVICEFACTORMAXIMUMAMPS'),
|
||||
ExportColumn::make('zmm_speed')
|
||||
->label('ZMM SPEED'),
|
||||
ExportColumn::make('zmm_suction')
|
||||
->label('ZMM SUCTION'),
|
||||
ExportColumn::make('zmm_suctionxdelivery')
|
||||
->label('ZMM SUCTIONXDELIVERY'),
|
||||
ExportColumn::make('zmm_supplysource')
|
||||
->label('ZMM SUPPLYSOURCE'),
|
||||
ExportColumn::make('zmm_temperature')
|
||||
->label('ZMM TEMPERATURE'),
|
||||
ExportColumn::make('zmm_thrustload')
|
||||
->label('ZMM THRUSTLOAD'),
|
||||
ExportColumn::make('zmm_volts')
|
||||
->label('ZMM VOLTS'),
|
||||
ExportColumn::make('zmm_wire')
|
||||
->label('ZMM WIRE'),
|
||||
ExportColumn::make('zmm_package')
|
||||
->label('ZMM PACKAGE'),
|
||||
ExportColumn::make('zmm_pvarrayrating')
|
||||
->label('ZMM PVARRAYRATING'),
|
||||
ExportColumn::make('zmm_isi')
|
||||
->label('ZMM ISI'),
|
||||
ExportColumn::make('zmm_isimotor')
|
||||
->label('ZMM ISIMOTOR'),
|
||||
ExportColumn::make('zmm_isipump')
|
||||
->label('ZMM ISIPUMP'),
|
||||
ExportColumn::make('zmm_isipumpset')
|
||||
->label('ZMM ISIPUMPSET'),
|
||||
ExportColumn::make('zmm_pumpset_model')
|
||||
->label('ZMM PUMPSET MODEL'),
|
||||
ExportColumn::make('zmm_stages')
|
||||
->label('ZMM STAGES'),
|
||||
ExportColumn::make('zmm_headrange')
|
||||
->label('ZMM HEADRANGE'),
|
||||
ExportColumn::make('zmm_overall_efficiency')
|
||||
->label('ZMM OVERALL EFFICIENCY'),
|
||||
ExportColumn::make('zmm_connection')
|
||||
->label('ZMM CONNECTION'),
|
||||
ExportColumn::make('zmm_min_bore_size')
|
||||
->label('ZMM MIN BORE SIZE'),
|
||||
ExportColumn::make('zmm_isireference')
|
||||
->label('ZMM ISIREFERENCE'),
|
||||
ExportColumn::make('zmm_category')
|
||||
->label('ZMM CATEGORY'),
|
||||
ExportColumn::make('zmm_submergence')
|
||||
->label('ZMM SUBMERGENCE'),
|
||||
ExportColumn::make('zmm_capacitorstart')
|
||||
->label('ZMM CAPACITORSTART'),
|
||||
ExportColumn::make('zmm_capacitorrun')
|
||||
->label('ZMM CAPACITORRUN'),
|
||||
ExportColumn::make('zmm_inch')
|
||||
->label('ZMM INCH'),
|
||||
ExportColumn::make('zmm_motor_type')
|
||||
->label('ZMM MOTOR TYPE'),
|
||||
ExportColumn::make('zmm_dismantle_direction')
|
||||
->label('ZMM DISMANTLE DIRECTION'),
|
||||
ExportColumn::make('zmm_eff_ovrall')
|
||||
->label('ZMM EFF OVRALL'),
|
||||
ExportColumn::make('zmm_bodymoc')
|
||||
->label('ZMM BODYMOC'),
|
||||
ExportColumn::make('zmm_rotormoc')
|
||||
->label('ZMM ROTORMOC'),
|
||||
ExportColumn::make('zmm_dlwl')
|
||||
->label('ZMM DLWL'),
|
||||
ExportColumn::make('zmm_inputpower')
|
||||
->label('ZMM INPUTPOWER'),
|
||||
ExportColumn::make('zmm_imp_od')
|
||||
->label('ZMM IMP OD'),
|
||||
ExportColumn::make('zmm_ambtemp')
|
||||
->label('ZMM AMBTEMP'),
|
||||
ExportColumn::make('zmm_de')
|
||||
->label('ZMM DE'),
|
||||
ExportColumn::make('zmm_dischargerange')
|
||||
->label('ZMM DISCHARGERANGE'),
|
||||
ExportColumn::make('zmm_efficiency_class')
|
||||
->label('ZMM EFFICIENCY CLASS'),
|
||||
ExportColumn::make('zmm_framesize')
|
||||
->label('ZMM FRAMESIZE'),
|
||||
ExportColumn::make('zmm_impellerdiameter')
|
||||
->label('ZMM IMPELLERDIAMETER'),
|
||||
ExportColumn::make('zmm_insulationclass')
|
||||
->label('ZMM INSULATIONCLASS'),
|
||||
ExportColumn::make('zmm_maxflow')
|
||||
->label('ZMM MAXFLOW'),
|
||||
ExportColumn::make('zmm_minhead')
|
||||
->label('ZMM MINHEAD'),
|
||||
ExportColumn::make('zmm_mtrlofconst')
|
||||
->label('ZMM MTRLOFCONST'),
|
||||
ExportColumn::make('zmm_nde')
|
||||
->label('ZMM NDE'),
|
||||
ExportColumn::make('zmm_powerfactor')
|
||||
->label('ZMM POWERFACTOR'),
|
||||
ExportColumn::make('zmm_tagno')
|
||||
->label('ZMM TANGO'),
|
||||
ExportColumn::make('zmm_year')
|
||||
->label('ZMM YEAR'),
|
||||
ExportColumn::make('zmm_laser_name')
|
||||
->label('ZMM LASER NAME'),
|
||||
ExportColumn::make('zmm_beenote')
|
||||
->label('ZMM BEENOTE'),
|
||||
ExportColumn::make('zmm_beenumber')
|
||||
->label('ZMM BEENUMBER'),
|
||||
ExportColumn::make('zmm_beestar')
|
||||
->label('ZMM BEESTAR'),
|
||||
ExportColumn::make('zmm_codeclass')
|
||||
->label('ZMM CODECLASS'),
|
||||
ExportColumn::make('zmm_colour')
|
||||
->label('ZMM COLOUR'),
|
||||
ExportColumn::make('zmm_logo_cp')
|
||||
->label('ZMM LOGO CP'),
|
||||
ExportColumn::make('zmm_logo_ce')
|
||||
->label('ZMM LOGO CE'),
|
||||
ExportColumn::make('zmm_logo_nsf')
|
||||
->label('ZMM LOGO NSF'),
|
||||
ExportColumn::make('zmm_grade')
|
||||
->label('ZMM GRADE'),
|
||||
ExportColumn::make('zmm_grwt_pset')
|
||||
->label('ZMM GRWT PSET'),
|
||||
ExportColumn::make('zmm_grwt_cable')
|
||||
->label('ZMM GRWT CABLE'),
|
||||
ExportColumn::make('zmm_grwt_motor')
|
||||
->label('ZMM GRWT MOTOR'),
|
||||
ExportColumn::make('zmm_grwt_pf')
|
||||
->label('ZMM GRWT PF'),
|
||||
ExportColumn::make('zmm_grwt_pump')
|
||||
->label('ZMM GRWT PUMP'),
|
||||
ExportColumn::make('zmm_isivalve')
|
||||
->label('ZMM ISIVALVE'),
|
||||
ExportColumn::make('zmm_isi_wc')
|
||||
->label('ZMM ISI WC'),
|
||||
ExportColumn::make('zmm_labelperiod')
|
||||
->label('ZMM LABELPERIOD'),
|
||||
ExportColumn::make('zmm_length')
|
||||
->label('ZMM LENGTH'),
|
||||
ExportColumn::make('zmm_license_cml_no')
|
||||
->label('ZMM LICENSE CML NO'),
|
||||
ExportColumn::make('zmm_mfgmonyr')
|
||||
->label('ZMM MFGMONYR'),
|
||||
ExportColumn::make('zmm_modelyear')
|
||||
->label('ZMM MODELYEAR'),
|
||||
ExportColumn::make('zmm_motoridentification')
|
||||
->label('ZMM MOTORIDENTIFICATION'),
|
||||
ExportColumn::make('zmm_newt_pset')
|
||||
->label('ZMM NEWT PSET'),
|
||||
ExportColumn::make('zmm_newt_cable')
|
||||
->label('ZMM NEWT CABLE'),
|
||||
ExportColumn::make('zmm_newt_motor')
|
||||
->label('ZMM NEWT MOTOR'),
|
||||
ExportColumn::make('zmm_newt_pf')
|
||||
->label('ZMM NEWT PF'),
|
||||
ExportColumn::make('zmm_newt_pump')
|
||||
->label('ZMM NEWT PUMP'),
|
||||
ExportColumn::make('zmm_packtype')
|
||||
->label('ZMM PACKTYPE'),
|
||||
ExportColumn::make('zmm_panel')
|
||||
->label('ZMM PANEL'),
|
||||
ExportColumn::make('zmm_performance_factor')
|
||||
->label('ZMM PERFORMANCE FACTOR'),
|
||||
ExportColumn::make('zmm_pumpidentification')
|
||||
->label('ZMM PUMPIDENTIFICATION'),
|
||||
ExportColumn::make('zmm_psettype')
|
||||
->label('ZMM PSETTYPE'),
|
||||
ExportColumn::make('zmm_size')
|
||||
->label('ZMM SIZE'),
|
||||
ExportColumn::make('zmm_eff_ttl')
|
||||
->label('ZMM EFF TTL'),
|
||||
ExportColumn::make('zmm_type')
|
||||
->label('ZMM TYPE'),
|
||||
ExportColumn::make('zmm_usp')
|
||||
->label('ZMM USP'),
|
||||
ExportColumn::make('mark_status')
|
||||
->label('MARKED STATUS'),
|
||||
ExportColumn::make('marked_datetime')
|
||||
->label('MARKED DATETIME'),
|
||||
ExportColumn::make('marked_by')
|
||||
->label('MARKED BY'),
|
||||
ExportColumn::make('man_marked_status')
|
||||
->label('MANUAL MARKED STATUS'),
|
||||
ExportColumn::make('man_marked_datetime')
|
||||
->label('MANUAL MARKED DATETIME'),
|
||||
ExportColumn::make('man_marked_by')
|
||||
->label('MANUAL MARKED BY'),
|
||||
ExportColumn::make('motor_marked_status')
|
||||
->label('MOTOR MARKED STATUS'),
|
||||
ExportColumn::make('pump_marked_status')
|
||||
->label('PUMP MARKED STATUS'),
|
||||
ExportColumn::make('motor_pump_pumpset_status')
|
||||
->label('MOTOR PUMP PUMPSET STATUS'),
|
||||
ExportColumn::make('part_validation_1')
|
||||
->label('PART VALIDATION 1'),
|
||||
ExportColumn::make('part_validation_2')
|
||||
->label('PART VALIDATION 2'),
|
||||
ExportColumn::make('samlight_logged_name')
|
||||
->label('SAMLIGHT LOGGED NAME'),
|
||||
ExportColumn::make('pending_released_status')
|
||||
->label('PENDING RELEASED STATUS'),
|
||||
ExportColumn::make('motor_expected_time')
|
||||
->label('MOTOR EXPECTED TIME'),
|
||||
ExportColumn::make('pump_expected_time')
|
||||
->label('PUMP EXPECTED TIME'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT')
|
||||
->enabledByDefault(true),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY')
|
||||
->enabledByDefault(true),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your class characteristic export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\RequestCharacteristic;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class RequestCharacteristicExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = RequestCharacteristic::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
// ExportColumn::make('id')
|
||||
// ->label('ID'),
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('machine.work_center')
|
||||
->label('WORK CENTER'),
|
||||
ExportColumn::make('work_flow_id')
|
||||
->label('WORK FLOW ID'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('aufnr')
|
||||
->label('AUFNR'),
|
||||
ExportColumn::make('characteristicApproverMaster.machine_name')
|
||||
->label('MACHINE NAME'),
|
||||
ExportColumn::make('characteristicApproverMaster.characteristic_field')
|
||||
->label('MASTER CHARACTERISTIC FIELD'),
|
||||
ExportColumn::make('characteristic_name')
|
||||
->label('CHARACTERISTIC NAME'),
|
||||
ExportColumn::make('current_value')
|
||||
->label('CURRENT VALUE'),
|
||||
ExportColumn::make('update_value')
|
||||
->label('UPDATE VALUE'),
|
||||
ExportColumn::make('characteristicApproverMaster.name1')
|
||||
->label('APPROVER NAME 1'),
|
||||
ExportColumn::make('approver_status1')
|
||||
->label('APPROVER STATUS 1'),
|
||||
ExportColumn::make('approver_remark1')
|
||||
->label('APPROVER REMARK 1'),
|
||||
ExportColumn::make('approved1_at')
|
||||
->label('APPROVED AT 1'),
|
||||
ExportColumn::make('characteristicApproverMaster.name2')
|
||||
->label('APPROVER NAME 2'),
|
||||
ExportColumn::make('approver_status2')
|
||||
->label('APPROVER STATUS 2'),
|
||||
ExportColumn::make('approver_remark2')
|
||||
->label('APPROVER REMARK 2'),
|
||||
ExportColumn::make('approved2_at')
|
||||
->label('APPROVED AT 2'),
|
||||
ExportColumn::make('characteristicApproverMaster.name3')
|
||||
->label('APPROVER NAME 3'),
|
||||
ExportColumn::make('approver_status3')
|
||||
->label('APPROVER STATUS 3'),
|
||||
ExportColumn::make('approver_remark3')
|
||||
->label('APPROVER REMARK 3'),
|
||||
ExportColumn::make('approved3_at')
|
||||
->label('APPROVED AT 1'),
|
||||
ExportColumn::make('mail_status')
|
||||
->label('MAIL STATUS'),
|
||||
ExportColumn::make('trigger_at')
|
||||
->label('TRIGGERED AT'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your request characteristic export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
@@ -1,651 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\ClassCharacteristic;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
|
||||
class ClassCharacteristicImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = ClassCharacteristic::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Code')
|
||||
->example('1000')
|
||||
->label('Plant Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('item')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Item Code')
|
||||
->example('630214')
|
||||
->label('Item Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('aufnr')
|
||||
->label('Aufnr')
|
||||
->exampleHeader('Aufnr')
|
||||
->example(''),
|
||||
ImportColumn::make('class')
|
||||
->label('Class')
|
||||
->exampleHeader('Class')
|
||||
->example(''),
|
||||
ImportColumn::make('arbid')
|
||||
->label('Arbid')
|
||||
->exampleHeader('Arbid')
|
||||
->example(''),
|
||||
ImportColumn::make('gamng')
|
||||
->label('Gamng')
|
||||
->exampleHeader('Gamng')
|
||||
->example(''),
|
||||
ImportColumn::make('lmnga')
|
||||
->label('Lmnga')
|
||||
->exampleHeader('Lmnga')
|
||||
->example(''),
|
||||
ImportColumn::make('gernr')
|
||||
->label('Gernr')
|
||||
->exampleHeader('Gernr')
|
||||
->example(''),
|
||||
ImportColumn::make('zz1_cn_bill_ord')
|
||||
->label('zz1 ccn bill ord')
|
||||
->exampleHeader('zz1 ccn bill ord')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_amps')
|
||||
->label('zmm amps')
|
||||
->exampleHeader('zmm amps')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_brand')
|
||||
->label('zmm brand')
|
||||
->exampleHeader('zmm brand')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_degreeofprotection')
|
||||
->label('zmm degreeofprotection')
|
||||
->exampleHeader('zmm degreeofprotection')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_delivery')
|
||||
->label('zmm delivery')
|
||||
->exampleHeader('zmm delivery')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_dir_rot')
|
||||
->label('zmm dir rot')
|
||||
->exampleHeader('zmm dir rot')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_discharge')
|
||||
->label('zmm discharge')
|
||||
->exampleHeader('zmm discharge')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_discharge_max')
|
||||
->label('zmm discharge max')
|
||||
->exampleHeader('zmm discharge max')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_discharge_min')
|
||||
->label('zmm discharge min')
|
||||
->exampleHeader('zmm discharge min')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_duty')
|
||||
->label('zmm duty')
|
||||
->exampleHeader('zmm duty')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_eff_motor')
|
||||
->label('zmm eff motor')
|
||||
->exampleHeader('zmm eff motor')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_eff_pump')
|
||||
->label('zmm eff pump')
|
||||
->exampleHeader('zmm eff pump')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_frequency')
|
||||
->label('zmm frequency')
|
||||
->exampleHeader('zmm frequency')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_head')
|
||||
->label('zmm head')
|
||||
->exampleHeader('zmm head')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_heading')
|
||||
->label('zmm heading')
|
||||
->exampleHeader('zmm heading')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_head_max')
|
||||
->label('zmm head max')
|
||||
->exampleHeader('zmm head max')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_head_minimum')
|
||||
->label('zmm head minimum')
|
||||
->exampleHeader('zmm head minimum')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_idx_eff_mtr')
|
||||
->label('zmm idx eff mtr')
|
||||
->exampleHeader('zmm idx eff mtr')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_idx_eff_pump')
|
||||
->label('zmm idx eff pump')
|
||||
->exampleHeader('zmm idx eff pump')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_kvacode')
|
||||
->label('zmm kvacode')
|
||||
->exampleHeader('zmm kvacode')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_maxambtemp')
|
||||
->label('zmm maxambtemp')
|
||||
->exampleHeader('zmm maxambtemp')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_mincoolingflow')
|
||||
->label('zmm mincoolingflow')
|
||||
->exampleHeader('zmm mincoolingflow')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_motorseries')
|
||||
->label('zmm motorseries')
|
||||
->exampleHeader('zmm motorseries')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_motor_model')
|
||||
->label('zmm motor model')
|
||||
->exampleHeader('zmm motor model')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_outlet')
|
||||
->label('zmm outlet')
|
||||
->exampleHeader('zmm outlet')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_phase')
|
||||
->label('zmm phase')
|
||||
->exampleHeader('zmm phase')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_pressure')
|
||||
->label('zmm pressure')
|
||||
->exampleHeader('zmm pressure')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_pumpflowtype')
|
||||
->label('zmm pumpflowtype')
|
||||
->exampleHeader('zmm pumpflowtype')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_pumpseries')
|
||||
->label('zmm pumpseries')
|
||||
->exampleHeader('zmm pumpseries')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_pump_model')
|
||||
->label('zmm pump model')
|
||||
->exampleHeader('zmm pump model')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_ratedpower')
|
||||
->label('zmm ratedpower')
|
||||
->exampleHeader('zmm ratedpower')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_region')
|
||||
->label('zmm region')
|
||||
->exampleHeader('zmm region')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_servicefactor')
|
||||
->label('zmm servicefactor')
|
||||
->exampleHeader('zmm servicefactor')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_servicefactormaximumamps')
|
||||
->label('zmm servicefactormaximumamps')
|
||||
->exampleHeader('zmm servicefactormaximumamps')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_speed')
|
||||
->label('zmm speed')
|
||||
->exampleHeader('zmm speed')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_suction')
|
||||
->label('zmm suction')
|
||||
->exampleHeader('zmm suction')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_suctionxdelivery')
|
||||
->label('zmm suctionxdelivery')
|
||||
->exampleHeader('zmm suctionxdelivery')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_supplysource')
|
||||
->label('zmm supplysource')
|
||||
->exampleHeader('zmm supplysource')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_temperature')
|
||||
->label('zmm temperature')
|
||||
->exampleHeader('zmm temperature')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_thrustload')
|
||||
->label('zmm thrustload')
|
||||
->exampleHeader('zmm thrustload')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_volts')
|
||||
->label('zmm volts')
|
||||
->exampleHeader('zmm volts')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_wire')
|
||||
->label('zmm wire')
|
||||
->exampleHeader('zmm wire')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_package')
|
||||
->label('zmm package')
|
||||
->exampleHeader('zmm package')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_pvarrayrating')
|
||||
->label('zmm pvarrayrating')
|
||||
->exampleHeader('zmm pvarrayrating')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_isi')
|
||||
->label('zmm isi')
|
||||
->exampleHeader('zmm isi')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_isimotor')
|
||||
->label('zmm isimotor')
|
||||
->exampleHeader('zmm isimotor')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_isipump')
|
||||
->label('zmm isipump')
|
||||
->exampleHeader('zmm isipump')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_isipumpset')
|
||||
->label('zmm isipumpset')
|
||||
->exampleHeader('zmm isipumpset')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_pumpset_model')
|
||||
->label('zmm pumpset model')
|
||||
->exampleHeader('zmm pumpset model')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_stages')
|
||||
->label('zmm stages')
|
||||
->exampleHeader('zmm stages')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_headrange')
|
||||
->label('zmm headrange')
|
||||
->exampleHeader('zmm headrange')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_overall_efficiency')
|
||||
->label('zmm overall efficiency')
|
||||
->exampleHeader('zmm overall efficiency')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_connection')
|
||||
->label('zmm connection')
|
||||
->exampleHeader('zmm connection')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_min_bore_size')
|
||||
->label('zmm min bore size')
|
||||
->exampleHeader('zmm min bore size')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_isireference')
|
||||
->label('zmm isireference')
|
||||
->exampleHeader('zmm isireference')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_category')
|
||||
->label('zmm category')
|
||||
->exampleHeader('zmm category')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_submergence')
|
||||
->label('zmm submergence')
|
||||
->exampleHeader('zmm submergence')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_capacitorstart')
|
||||
->label('zmm capacitorstart')
|
||||
->exampleHeader('zmm capacitorstart')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_capacitorrun')
|
||||
->label('zmm capacitorrun')
|
||||
->exampleHeader('zmm capacitorrun')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_inch')
|
||||
->label('zmm inch')
|
||||
->exampleHeader('zmm inch')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_motor_type')
|
||||
->label('zmm motor type')
|
||||
->exampleHeader('zmm motor type')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_dismantle_direction')
|
||||
->label('zmm dismantle direction')
|
||||
->exampleHeader('zmm dismantle direction')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_eff_ovrall')
|
||||
->label('zmm eff ovrall')
|
||||
->exampleHeader('zmm eff ovrall')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_bodymoc')
|
||||
->label('zmm bodymoc')
|
||||
->exampleHeader('zmm bodymoc')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_rotormoc')
|
||||
->label('zmm rotormoc')
|
||||
->exampleHeader('zmm rotormoc')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_dlwl')
|
||||
->label('zmm dlwl')
|
||||
->exampleHeader('zmm dlwl')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_inputpower')
|
||||
->label('zmm inputpower')
|
||||
->exampleHeader('zmm inputpower')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_imp_od')
|
||||
->label('zmm imp od')
|
||||
->exampleHeader('zmm imp od')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_ambtemp')
|
||||
->label('zmm ambtemp')
|
||||
->exampleHeader('zmm ambtemp')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_de')
|
||||
->label('zmm de')
|
||||
->exampleHeader('zmm de')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_dischargerange')
|
||||
->label('zmm dischargerange')
|
||||
->exampleHeader('zmm dischargerange')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_efficiency_class')
|
||||
->label('zmm efficiency class')
|
||||
->exampleHeader('zmm efficiency class')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_framesize')
|
||||
->label('zmm framesize')
|
||||
->exampleHeader('zmm framesize')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_impellerdiameter')
|
||||
->label('zmm impellerdiameter')
|
||||
->exampleHeader('zmm impellerdiameter')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_insulationclass')
|
||||
->label('zmm insulationclass')
|
||||
->exampleHeader('zmm insulationclass')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_maxflow')
|
||||
->label('zmm maxflow')
|
||||
->exampleHeader('zmm maxflow')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_minhead')
|
||||
->label('zmm minhead')
|
||||
->exampleHeader('zmm minhead')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_mtrlofconst')
|
||||
->label('zmm mtrlofconst')
|
||||
->exampleHeader('zmm mtrlofconst')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_nde')
|
||||
->label('zmm nde')
|
||||
->exampleHeader('zmm nde')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_powerfactor')
|
||||
->label('zmm powerfactor')
|
||||
->exampleHeader('zmm powerfactor')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_tagno')
|
||||
->label('zmm tagno')
|
||||
->exampleHeader('zmm tagno')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_year')
|
||||
->label('zmm year')
|
||||
->exampleHeader('zmm year')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_laser_name')
|
||||
->label('zmm laser name')
|
||||
->exampleHeader('zmm laser name')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_beenote')
|
||||
->label('zmm beenote')
|
||||
->exampleHeader('zmm beenote')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_beenumber')
|
||||
->label('zmm beenumber')
|
||||
->exampleHeader('zmm beenumber')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_beestar')
|
||||
->label('zmm beenumber')
|
||||
->exampleHeader('zmm beenumber')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_codeclass')
|
||||
->label('zmm codeclass')
|
||||
->exampleHeader('zmm codeclass')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_colour')
|
||||
->label('zmm colour')
|
||||
->exampleHeader('zmm colour')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_logo_cp')
|
||||
->label('zmm logo cp')
|
||||
->exampleHeader('zmm logo cp')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_logo_ce')
|
||||
->label('zmm logo ce')
|
||||
->exampleHeader('zmm logo ce')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_logo_nsf')
|
||||
->label('zmm logo nsf')
|
||||
->exampleHeader('zmm logo nsf')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_grade')
|
||||
->label('zmm grade')
|
||||
->exampleHeader('zmm grade')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_grwt_pset')
|
||||
->label('zmm grwt pset')
|
||||
->exampleHeader('zmm grwt pset')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_grwt_cable')
|
||||
->label('zmm grwt cable')
|
||||
->exampleHeader('zmm grwt cable')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_grwt_motor')
|
||||
->label('zmm grwt motor')
|
||||
->exampleHeader('zmm grwt motor')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_grwt_pf')
|
||||
->label('zmm grwt pf')
|
||||
->exampleHeader('zmm grwt pf')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_grwt_pump')
|
||||
->label('zmm grwt pump')
|
||||
->exampleHeader('zmm grwt pump')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_isivalve')
|
||||
->label('zmm isivalve')
|
||||
->exampleHeader('zmm isivalve')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_isi_wc')
|
||||
->label('zmm isi wc')
|
||||
->exampleHeader('zmm isi wc')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_labelperiod')
|
||||
->label('zmm labelperiod')
|
||||
->exampleHeader('zmm labelperiod')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_length')
|
||||
->label('zmm length')
|
||||
->exampleHeader('zmm length')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_license_cml_no')
|
||||
->label('zmm license cml no')
|
||||
->exampleHeader('zmm license cml no')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_mfgmonyr')
|
||||
->label('zmm mfgmonyr')
|
||||
->exampleHeader('zmm mfgmonyr')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_modelyear')
|
||||
->label('zmm modelyear')
|
||||
->exampleHeader('zmm modelyear')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_motoridentification')
|
||||
->label('zmm motoridentification')
|
||||
->exampleHeader('zmm motoridentification')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_newt_pset')
|
||||
->label('zmm newt pset')
|
||||
->exampleHeader('zmm newt pset')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_newt_cable')
|
||||
->label('zmm newt cable')
|
||||
->exampleHeader('zmm newt cable')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_newt_motor')
|
||||
->label('zmm newt motor')
|
||||
->exampleHeader('zmm newt motor')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_newt_pf')
|
||||
->label('zmm newt pf')
|
||||
->exampleHeader('zmm newt pf')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_newt_pump')
|
||||
->label('zmm newt pump')
|
||||
->exampleHeader('zmm newt pump')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_packtype')
|
||||
->label('zmm packtype')
|
||||
->exampleHeader('zmm packtype')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_panel')
|
||||
->label('zmm panel')
|
||||
->exampleHeader('zmm panel')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_performance_factor')
|
||||
->label('zmm performance factor')
|
||||
->exampleHeader('zmm performance factor')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_pumpidentification')
|
||||
->label('zmm pumpidentification')
|
||||
->exampleHeader('zmm pumpidentification')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_psettype')
|
||||
->label('zmm psettype')
|
||||
->exampleHeader('zmm psettype')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_size')
|
||||
->label('zmm size')
|
||||
->exampleHeader('zmm size')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_eff_ttl')
|
||||
->label('zmm eff ttl')
|
||||
->exampleHeader('zmm eff ttl')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_type')
|
||||
->label('zmm type')
|
||||
->exampleHeader('zmm type')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_usp')
|
||||
->label('zmm usp')
|
||||
->exampleHeader('zmm usp')
|
||||
->example(''),
|
||||
ImportColumn::make('mark_status')
|
||||
->label('MARKED STATUS')
|
||||
->exampleHeader('MARKED STATUS')
|
||||
->example(''),
|
||||
ImportColumn::make('marked_datetime')
|
||||
->label('MARKED DATETIME')
|
||||
->exampleHeader('MARKED DATETIME')
|
||||
->example(''),
|
||||
ImportColumn::make('marked_by')
|
||||
->label('MARKED BY')
|
||||
->exampleHeader('MARKED BY')
|
||||
->example(''),
|
||||
ImportColumn::make('man_marked_status')
|
||||
->label('MANUAL MARKED STATUS')
|
||||
->exampleHeader('MANUAL MARKED STATUS')
|
||||
->example(''),
|
||||
ImportColumn::make('man_marked_datetime')
|
||||
->label('MANUAL MARKED DATETIME')
|
||||
->exampleHeader('MANUAL MARKED DATETIME')
|
||||
->example(''),
|
||||
ImportColumn::make('man_marked_by')
|
||||
->label('MANUAL MARKED BY')
|
||||
->exampleHeader('MANUAL MARKED BY')
|
||||
->example(''),
|
||||
ImportColumn::make('motor_marked_status')
|
||||
->label('MOTOR MARKED STATUS')
|
||||
->exampleHeader('MOTOR MARKED STATUS')
|
||||
->example(''),
|
||||
ImportColumn::make('motor_marked_by')
|
||||
->label('MOTOR MARKED BY')
|
||||
->exampleHeader('MOTOR MARKED BY')
|
||||
->example(''),
|
||||
ImportColumn::make('pump_marked_status')
|
||||
->label('PUMP MARKED STATUS')
|
||||
->exampleHeader('PUMP MARKED STATUS')
|
||||
->example(''),
|
||||
ImportColumn::make('pump_marked_by')
|
||||
->label('PUMP MARKED BY')
|
||||
->exampleHeader('PUMP MARKED BY')
|
||||
->example(''),
|
||||
ImportColumn::make('motor_pump_pumpset_status')
|
||||
->label('MOTOR PUMP PUMPSET STATUS')
|
||||
->exampleHeader('MOTOR PUMP PUMPSET STATUS')
|
||||
->example(''),
|
||||
ImportColumn::make('motor_machine_name')
|
||||
->label('MOTOR MACHINE NAME')
|
||||
->exampleHeader('MOTOR MACHINE NAME')
|
||||
->example(''),
|
||||
ImportColumn::make('pump_machine_name')
|
||||
->label('PUMP MACHINE NAME')
|
||||
->exampleHeader('PUMP MACHINE NAME')
|
||||
->example(''),
|
||||
ImportColumn::make('pumpset_machine_name')
|
||||
->label('PUMPSET MACHINE NAME')
|
||||
->exampleHeader('PUMPSET MACHINE NAME')
|
||||
->example(''),
|
||||
ImportColumn::make('part_validation_1')
|
||||
->label('PART VALIDATION 1')
|
||||
->exampleHeader('PART VALIDATION 1')
|
||||
->example(''),
|
||||
ImportColumn::make('part_validation_2')
|
||||
->label('PART VALIDATION 2')
|
||||
->exampleHeader('PART VALIDATION 2')
|
||||
->example(''),
|
||||
ImportColumn::make('samlight_logged_name')
|
||||
->label('SAMLGHT LOGGED NAME')
|
||||
->exampleHeader('SAMLGHT LOGGED NAME')
|
||||
->example(''),
|
||||
ImportColumn::make('pending_released_status')
|
||||
->label('PENDING RELEASED STATUS')
|
||||
->exampleHeader('PENDING RELEASED STATUS')
|
||||
->example(''),
|
||||
ImportColumn::make('motor_expected_time')
|
||||
->label('MOTOR EXPECTED TIME')
|
||||
->exampleHeader('MOTOR EXPECTED TIME')
|
||||
->example(''),
|
||||
ImportColumn::make('pump_expected_time')
|
||||
->label('PUMP EXPECTED TIME')
|
||||
->exampleHeader('PUMP EXPECTED TIME')
|
||||
->example(''),
|
||||
ImportColumn::make('created_at')
|
||||
->label('CREATED AT')
|
||||
->exampleHeader('CREATED AT')
|
||||
->example(''),
|
||||
ImportColumn::make('created_by')
|
||||
->label('CREATED BY')
|
||||
->exampleHeader('CREATED BY')
|
||||
->example('RAW01234'),
|
||||
ImportColumn::make('updated_at')
|
||||
->label('UPDATED AT')
|
||||
->exampleHeader('UPDATED AT')
|
||||
->example(''),
|
||||
ImportColumn::make('updated_by')
|
||||
->label('UPDATED BY')
|
||||
->exampleHeader('UPDATED BY')
|
||||
->example(''),
|
||||
// ImportColumn::make('updated_by'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?ClassCharacteristic
|
||||
{
|
||||
// return ClassCharacteristic::firstOrNew([
|
||||
// // Update existing records, matching them by `$this->data['column_name']`
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new ClassCharacteristic;
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your class characteristic import has completed and '.number_format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' imported.';
|
||||
|
||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@ use App\Models\CharacteristicApproverMaster;
|
||||
use App\Models\Machine;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
@@ -27,125 +26,53 @@ class CharacteristicApproverMasterResource extends Resource
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Section::make('')
|
||||
->schema([
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->label('Plant')
|
||||
->columnSpan(2)
|
||||
->reactive()
|
||||
->relationship('plant', 'name')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->required(),
|
||||
Forms\Components\Select::make('machine_id')
|
||||
->label('Work Center')
|
||||
->columnSpan(2)
|
||||
// ->relationship('machine', 'name')
|
||||
->reactive()
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->label('Plant')
|
||||
->reactive()
|
||||
->relationship('plant', 'name')
|
||||
->required(),
|
||||
Forms\Components\Select::make('machine_id')
|
||||
->label('Work Center')
|
||||
// ->relationship('machine', 'name')
|
||||
->reactive()
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('characteristic_field')
|
||||
->label('Characteristic Field')
|
||||
->columnSpan(2)
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('machine_name')
|
||||
->label('Machine')
|
||||
->columnSpan(2)
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$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')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('mail1')
|
||||
->label('Mail')
|
||||
->columnSpan(['default' => 1, 'sm' => 2])
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('duration1')
|
||||
->label('Duration (HH.MM)')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
])
|
||||
->collapsed()// collapsible()
|
||||
->columns(['default' => 1, 'sm' => 4]),
|
||||
Section::make('Approver - 2')
|
||||
->columnSpan(['default' => 2, 'sm' => 4])
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name2')
|
||||
->label('Name')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('mail2')
|
||||
->label('Mail')
|
||||
->columnSpan(['default' => 1, 'sm' => 2])
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('duration2')
|
||||
->label('Duration (HH.MM)')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
])
|
||||
->collapsed()// collapsible()
|
||||
->columns(['default' => 1, 'sm' => 4]),
|
||||
Section::make('Approver - 3')
|
||||
->columnSpan(['default' => 2, 'sm' => 4])
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name3')
|
||||
->label('Name')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('mail3')
|
||||
->label('Mail')
|
||||
->columnSpan(['default' => 1, 'sm' => 2])
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('duration3')
|
||||
->label('Duration (HH.MM)')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
])
|
||||
->collapsed()// collapsible()
|
||||
->columns(['default' => 1, 'sm' => 4]),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->label('Updated By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\TextInput::make('id')
|
||||
->hidden()
|
||||
->readOnly(),
|
||||
])
|
||||
->columns(['default' => 1, 'sm' => 4]),
|
||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||
})
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('characteristic_field')
|
||||
->label('Characteristic Field'),
|
||||
Forms\Components\TextInput::make('machine_name')
|
||||
->label('Machine Name'),
|
||||
Forms\Components\TextInput::make('name1')
|
||||
->label('Name-1'),
|
||||
Forms\Components\TextInput::make('mail1')
|
||||
->label('Mail-1'),
|
||||
Forms\Components\TextInput::make('duration1')
|
||||
->label('Duration-1 (Hour.Minute)'),
|
||||
Forms\Components\TextInput::make('name2')
|
||||
->label('Name-2'),
|
||||
Forms\Components\TextInput::make('mail2')
|
||||
->label('Mail-2'),
|
||||
Forms\Components\TextInput::make('duration2')
|
||||
->label('Duration-2 (Hour.Minute)'),
|
||||
Forms\Components\TextInput::make('name3')
|
||||
->label('Name-3'),
|
||||
Forms\Components\TextInput::make('mail3')
|
||||
->label('Mail-3'),
|
||||
Forms\Components\TextInput::make('duration3')
|
||||
->label('Duration-3 (Hour.Minute)'),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->label('Updated By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -165,34 +92,26 @@ class CharacteristicApproverMasterResource extends Resource
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('machine.work_center')
|
||||
->label('Work Center')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('characteristic_field')
|
||||
->label('Characteristic Field')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->formatStateUsing(fn (string $state): string => strtoupper(__($state)))
|
||||
->extraAttributes(['class' => 'uppercase'])
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('machine_name')
|
||||
->label('Machine Name')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('name1')
|
||||
->label('Approver Name 1')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('mail1')
|
||||
->label('Mail 1')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('duration1')
|
||||
->label('Duration 1 (Hour.Minute)')
|
||||
@@ -201,12 +120,10 @@ class CharacteristicApproverMasterResource extends Resource
|
||||
Tables\Columns\TextColumn::make('name2')
|
||||
->label('Approver Name 2')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('mail2')
|
||||
->label('Mail 2')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('duration2')
|
||||
->label('Duration 2 (Hour.Minute)')
|
||||
@@ -215,12 +132,10 @@ class CharacteristicApproverMasterResource extends Resource
|
||||
Tables\Columns\TextColumn::make('name3')
|
||||
->label('Approver Name 3')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('mail3')
|
||||
->label('Mail 3')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('duration3')
|
||||
->label('Duration 3 (Hour.Minute)')
|
||||
@@ -230,31 +145,16 @@ class CharacteristicApproverMasterResource extends Resource
|
||||
->label('Created At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_by')
|
||||
->label('Created By')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->searchable()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_by')
|
||||
->label('Updated By')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
|
||||
@@ -9,10 +9,7 @@ use App\Models\Machine;
|
||||
use App\Models\RequestCharacteristic;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Forms\Set;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
@@ -57,503 +54,317 @@ class RequestCharacteristicResource extends Resource
|
||||
|
||||
return $form
|
||||
->schema([
|
||||
Section::make('')
|
||||
->schema([
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->label('Plant')
|
||||
->reactive()
|
||||
->relationship('plant', 'name')
|
||||
->required()
|
||||
->default(function () {
|
||||
return optional(RequestCharacteristic::latest()->first())->plant_id;
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
$updRec = $get('id');
|
||||
$set('machine_id', null);
|
||||
$set('item_id', null);
|
||||
$set('aufnr', null);
|
||||
$set('machine_name', null);
|
||||
$set('characteristic_approver_master_id', null);
|
||||
if (! $updRec && $plantId) {
|
||||
$set('work_flow_id', self::isNewWorkFlow($get));
|
||||
}
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
||||
Forms\Components\Select::make('machine_id')
|
||||
->label('Work Center')
|
||||
// ->relationship('machine', 'name')
|
||||
->reactive()
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (! $plantId) {
|
||||
return [];
|
||||
}
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->label('Plant')
|
||||
->relationship('plant', 'name')
|
||||
->required()
|
||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
||||
Forms\Components\Select::make('machine_id')
|
||||
->label('Work Center')
|
||||
// ->relationship('machine', 'name')
|
||||
->reactive()
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||
})
|
||||
->required()
|
||||
->default(function () {
|
||||
return optional(RequestCharacteristic::latest()->first())->machine_id ?? [];
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('item_id', null);
|
||||
$set('aufnr', null);
|
||||
$set('machine_name', null);
|
||||
$set('characteristic_approver_master_id', null);
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
||||
Forms\Components\TextInput::make('work_flow_id')
|
||||
->label('Work Flow ID')
|
||||
->readOnly()
|
||||
->reactive()
|
||||
->default(function ($state, callable $set, callable $get) {
|
||||
$updRec = $get('id');
|
||||
if (! $updRec) {
|
||||
return self::isNewWorkFlow($get);
|
||||
}
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
// ->rule(function (callable $get) {
|
||||
// return Rule::unique('request_characteristics', 'work_flow_id')
|
||||
// ->where('plant_id', $get('plant_id'))
|
||||
// ->ignore($get('id'));
|
||||
// }),
|
||||
Forms\Components\Select::make('item_id')
|
||||
->label('Item')
|
||||
// ->relationship('item', 'id')
|
||||
->reactive()
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (! $plantId) {
|
||||
return [];
|
||||
}
|
||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||
})
|
||||
->required()
|
||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
||||
Forms\Components\TextInput::make('work_flow_id')
|
||||
->label('Work Flow ID')
|
||||
->readOnly()
|
||||
->reactive(),
|
||||
// ->rule(function (callable $get) {
|
||||
// return Rule::unique('request_characteristics', 'work_flow_id')
|
||||
// ->where('plant_id', $get('plant_id'))
|
||||
// ->ignore($get('id'));
|
||||
// }),
|
||||
Forms\Components\Select::make('item_id')
|
||||
->label('Item')
|
||||
// ->relationship('item', 'id')
|
||||
->reactive()
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Item::where('plant_id', $plantId)->pluck('code', 'id');
|
||||
})
|
||||
->required()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('aufnr', null);
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
||||
Forms\Components\TextInput::make('aufnr')
|
||||
->label('Aufnr')
|
||||
->reactive()
|
||||
->required()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
||||
Forms\Components\Select::make('machine_name')
|
||||
->label('Machines')
|
||||
->reactive()
|
||||
->nullable()
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
$machineId = $get('machine_id');
|
||||
return Item::where('plant_id', $plantId)->pluck('code', 'id');
|
||||
})
|
||||
->required()
|
||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
||||
Forms\Components\Select::make('characteristic_approver_master_id')
|
||||
->label('Characteristic Approver')
|
||||
// ->relationship('characteristicApproverMaster', 'id')
|
||||
->reactive()
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
|
||||
if (! $plantId || ! $machineId) {
|
||||
return [];
|
||||
}
|
||||
$machineId = $get('machine_id');
|
||||
|
||||
return CharacteristicApproverMaster::where('plant_id', $plantId)->where('machine_id', $machineId)->pluck('machine_name', 'id')->unique();
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('characteristic_approver_master_id', null);
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->default(function () {
|
||||
return optional(RequestCharacteristic::latest()->first())->characteristic_approver_master_id ?? [];
|
||||
})
|
||||
->afterStateHydrated(function ($component, $state, Get $get, Set $set) {
|
||||
if ($get('id')) {
|
||||
$reqId = RequestCharacteristic::where('id', $get('id'))->first()?->characteristic_approver_master_id;
|
||||
if ($reqId) {
|
||||
$reqMac = CharacteristicApproverMaster::where('id', $reqId)->first()?->machine_name;
|
||||
if ($reqMac) {
|
||||
$set('machine_name', $reqMac);
|
||||
} else {
|
||||
$set('machine_name', null);
|
||||
}
|
||||
} else {
|
||||
$set('machine_name', null);
|
||||
}
|
||||
}
|
||||
})
|
||||
->required(),
|
||||
Forms\Components\Select::make('characteristic_approver_master_id')
|
||||
->label('Master Characteristic')
|
||||
->relationship('characteristicApproverMaster', 'characteristic_field')
|
||||
->reactive()
|
||||
->nullable()
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
$machineId = $get('machine_id');
|
||||
$machineName = $get('machine_name');
|
||||
if (! $plantId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (! $plantId || ! $machineId || ! $machineName) {
|
||||
return [];
|
||||
}
|
||||
$approvers = CharacteristicApproverMaster::where('plant_id', $plantId)
|
||||
->where('machine_id', $machineId)
|
||||
->get();
|
||||
|
||||
return CharacteristicApproverMaster::where('plant_id', $plantId)->where('machine_id', $machineId)->where('machine_name', $machineName)->pluck('characteristic_field', 'id');
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->required(),
|
||||
// ->disabled(fn ($get) => self::isFieldDisabled($get))
|
||||
Section::make('Request Characteristic')
|
||||
// ->columnSpan(['default' => 2, 'sm' => 4])
|
||||
->reactive()
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('characteristic_name')
|
||||
->label('Characteristic Name')
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->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);
|
||||
})
|
||||
->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);
|
||||
})
|
||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
||||
])
|
||||
->collapsible()
|
||||
->columns(['default' => 1, 'sm' => 3]),
|
||||
Section::make(function ($get): string {
|
||||
$approverId = $get('characteristic_approver_master_id');
|
||||
$approverName = $approverId ? CharacteristicApproverMaster::find($approverId)?->name1 : null;
|
||||
$options = [];
|
||||
|
||||
return 'Approver - 1'.($approverName ? " ( {$approverName} )" : '');
|
||||
})
|
||||
->reactive()
|
||||
// ->description(fn (Get $get) => CharacteristicApproverMaster::find($get('characteristic_approver_master_id'))?->name1 ?? 'Select approver above'
|
||||
// )
|
||||
->schema([
|
||||
Forms\Components\Select::make('approver_status1')
|
||||
->label('Approver Status')
|
||||
->reactive()
|
||||
->options([
|
||||
'Approved' => 'Approved',
|
||||
'Hold' => 'Hold',
|
||||
'Rejected' => 'Rejected',
|
||||
])
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
if ($state && empty($get('approved1_at'))) {
|
||||
$set('approved1_at', now());
|
||||
}
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->disabled(function ($get) {
|
||||
$currentUser = Filament::auth()->user();
|
||||
$approverId = $get('characteristic_approver_master_id');
|
||||
foreach ($approvers as $approver) {
|
||||
if ($approver->name1) {
|
||||
$options[$approver->id.'_name1'] = $approver->name1;
|
||||
}
|
||||
if ($approver->name2) {
|
||||
$options[$approver->id.'_name2'] = $approver->name2;
|
||||
}
|
||||
if ($approver->name3) {
|
||||
$options[$approver->id.'_name3'] = $approver->name3;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $approverId) {
|
||||
return true;
|
||||
}
|
||||
return $options;
|
||||
})
|
||||
->dehydrateStateUsing(function ($state, callable $set) {
|
||||
|
||||
if (str_contains($approverId, '_')) {
|
||||
[$approverId, $level] = explode('_', $approverId);
|
||||
}
|
||||
if (empty($state) || ! str_contains($state, '_')) {
|
||||
return $state;
|
||||
}
|
||||
|
||||
$approver = CharacteristicApproverMaster::find($approverId);
|
||||
if (! $approver) {
|
||||
return true;
|
||||
}
|
||||
$parts = explode('_', $state);
|
||||
|
||||
// Super Admin can edit any
|
||||
if ($currentUser && $currentUser->hasRole('Super Admin')) {
|
||||
return false; // field enabled
|
||||
}
|
||||
if (count($parts) != 2) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Otherwise, enable only if the user's name matches
|
||||
return $approver->name1 != $currentUser?->name;
|
||||
}),
|
||||
Forms\Components\TextInput::make('approver_remark1')
|
||||
->label('Approver Remark')
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->disabled(function ($get) {
|
||||
$currentUser = Filament::auth()->user();
|
||||
$updId = $get('id');
|
||||
[$id, $level] = $parts;
|
||||
|
||||
if (! $updId) {
|
||||
return true;
|
||||
} elseif ($currentUser && $currentUser->hasRole('Super Admin')) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}),
|
||||
Forms\Components\DateTimePicker::make('approved1_at')
|
||||
// ->label('Approved At')
|
||||
->label(fn (callable $get): string => match ($get('approver_status1')) {
|
||||
'Approved' => 'Approved At',
|
||||
'Hold' => 'Hold At',
|
||||
'Rejected' => 'Rejected At',
|
||||
default => 'Updated At',
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->disabled(function ($get) {
|
||||
$currentUser = Filament::auth()->user(); // logged-in user
|
||||
$approverId = $get('characteristic_approver_master_id');
|
||||
$set('approver_level', $level);
|
||||
|
||||
if (! $approverId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (str_contains($approverId, '_')) {
|
||||
[$approverId, $level] = explode('_', $approverId);
|
||||
}
|
||||
|
||||
$approver = CharacteristicApproverMaster::find($approverId);
|
||||
if (! $approver) {
|
||||
return true;
|
||||
}
|
||||
if ($currentUser && $currentUser->hasRole('Super Admin')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $approver->name1 != $currentUser?->name;
|
||||
}),
|
||||
])
|
||||
->collapsed()// collapsible()
|
||||
->columns(['default' => 1, 'sm' => 3]),
|
||||
Section::make(function ($get): string {
|
||||
$approverId = $get('characteristic_approver_master_id');
|
||||
$approverName = $approverId ? CharacteristicApproverMaster::find($approverId)?->name2 : null;
|
||||
|
||||
return 'Approver - 2'.($approverName ? " ( {$approverName} )" : '');
|
||||
})
|
||||
->reactive()
|
||||
->schema([
|
||||
Forms\Components\Select::make('approver_status2')
|
||||
->label('Approver Status')
|
||||
->reactive()
|
||||
->options([
|
||||
'Approved' => 'Approved',
|
||||
'Hold' => 'Hold',
|
||||
'Rejected' => 'Rejected',
|
||||
])
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
if ($state && empty($get('approved2_at'))) {
|
||||
$set('approved2_at', now());
|
||||
}
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->disabled(function ($get) {
|
||||
$currentUser = Filament::auth()->user(); // get the User object
|
||||
$approverId = $get('characteristic_approver_master_id');
|
||||
|
||||
if (! $approverId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (str_contains($approverId, '_')) {
|
||||
[$approverId, $level] = explode('_', $approverId);
|
||||
}
|
||||
|
||||
$approver = CharacteristicApproverMaster::find($approverId);
|
||||
if (! $approver) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Super Admin can always edit
|
||||
if ($currentUser && $currentUser->hasRole('Super Admin')) {
|
||||
return false; // ENABLE field
|
||||
}
|
||||
|
||||
// Otherwise, enable only if the user's name matches
|
||||
return $approver->name2 != $currentUser?->name;
|
||||
}),
|
||||
Forms\Components\TextInput::make('approver_remark2')
|
||||
->label('Approver Remark')
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->disabled(function ($get) {
|
||||
$currentUser = Filament::auth()->user();
|
||||
$updId = $get('id');
|
||||
|
||||
if (! $updId) {
|
||||
return true;
|
||||
} elseif ($currentUser && $currentUser->hasRole('Super Admin')) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}),
|
||||
Forms\Components\DateTimePicker::make('approved2_at')
|
||||
->label(fn (callable $get): string => match ($get('approver_status2')) {
|
||||
'Approved' => 'Approved At',
|
||||
'Hold' => 'Hold At',
|
||||
'Rejected' => 'Rejected At',
|
||||
default => 'Updated At',
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->disabled(function ($get) {
|
||||
$currentUser = Filament::auth()->user(); // logged-in user
|
||||
$approverId = $get('characteristic_approver_master_id');
|
||||
|
||||
if (! $approverId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (str_contains($approverId, '_')) {
|
||||
[$approverId, $level] = explode('_', $approverId);
|
||||
}
|
||||
|
||||
$approver = CharacteristicApproverMaster::find($approverId);
|
||||
if (! $approver) {
|
||||
return true;
|
||||
}
|
||||
if ($currentUser && $currentUser->hasRole('Super Admin')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $approver->name2 != $currentUser?->name;
|
||||
}),
|
||||
// ->dehydrated(true),
|
||||
])
|
||||
->collapsed()// collapsible()
|
||||
->columns(['default' => 1, 'sm' => 3]),
|
||||
Section::make(function ($get): string {
|
||||
$approverId = $get('characteristic_approver_master_id');
|
||||
$approverName = $approverId ? CharacteristicApproverMaster::find($approverId)?->name3 : null;
|
||||
|
||||
return 'Approver - 3'.($approverName ? " ( {$approverName} )" : '');
|
||||
})
|
||||
->reactive()
|
||||
->schema([
|
||||
Forms\Components\Select::make('approver_status3')
|
||||
->label('Approver Status')
|
||||
->reactive()
|
||||
->options([
|
||||
'Approved' => 'Approved',
|
||||
'Hold' => 'Hold',
|
||||
'Rejected' => 'Rejected',
|
||||
])
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
if ($state && empty($get('approved3_at'))) {
|
||||
$set('approved3_at', now());
|
||||
}
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->disabled(function ($get) {
|
||||
$currentUser = Filament::auth()->user();
|
||||
$approverId = $get('characteristic_approver_master_id');
|
||||
|
||||
if (! $approverId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (str_contains($approverId, '_')) {
|
||||
[$approverId, $level] = explode('_', $approverId);
|
||||
}
|
||||
|
||||
$approver = CharacteristicApproverMaster::find($approverId);
|
||||
if (! $approver) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($currentUser->hasRole('Super Admin')) {
|
||||
return false;
|
||||
} else {
|
||||
return $approver->name3 != $currentUser?->name;
|
||||
}
|
||||
|
||||
}),
|
||||
Forms\Components\TextInput::make('approver_remark3')
|
||||
->label('Approver Remark')
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->disabled(function ($get) {
|
||||
$currentUser = Filament::auth()->user();
|
||||
$updId = $get('id');
|
||||
|
||||
if (! $updId) {
|
||||
return true;
|
||||
} elseif ($currentUser && $currentUser->hasRole('Super Admin')) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}),
|
||||
Forms\Components\DateTimePicker::make('approved3_at')
|
||||
->label(fn (callable $get): string => match ($get('approver_status3')) {
|
||||
'Approved' => 'Approved At',
|
||||
'Hold' => 'Hold At',
|
||||
'Rejected' => 'Rejected At',
|
||||
default => 'Updated At',
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->disabled(function ($get) {
|
||||
$currentUser = Filament::auth()->user(); // logged-in user
|
||||
$approverId = $get('characteristic_approver_master_id');
|
||||
|
||||
if (! $approverId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (str_contains($approverId, '_')) {
|
||||
[$approverId, $level] = explode('_', $approverId);
|
||||
}
|
||||
|
||||
$approver = CharacteristicApproverMaster::find($approverId);
|
||||
if (! $approver) {
|
||||
return true;
|
||||
}
|
||||
if ($currentUser && $currentUser->hasRole('Super Admin')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $approver->name3 != $currentUser?->name;
|
||||
}),
|
||||
])
|
||||
->collapsed()// collapsible()
|
||||
->columns(['default' => 1, 'sm' => 3]),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->label('Updated By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\TextInput::make('id')
|
||||
->hidden()
|
||||
->readOnly(),
|
||||
return (int) $id;
|
||||
})
|
||||
->required()
|
||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
||||
Forms\Components\TextInput::make('aufnr')
|
||||
->label('Aufnr')
|
||||
->reactive()
|
||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
||||
Forms\Components\TextInput::make('characteristic_name')
|
||||
->label('Characteristic Name')
|
||||
->reactive()
|
||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
||||
Forms\Components\TextInput::make('current_value')
|
||||
->label('Current Value')
|
||||
->reactive()
|
||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
||||
Forms\Components\TextInput::make('update_value')
|
||||
->label('Update Value')
|
||||
->reactive()
|
||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
||||
Forms\Components\Select::make('approver_status1')
|
||||
->label('Approver Status 1')
|
||||
->reactive()
|
||||
->options([
|
||||
'Approved' => 'Approved',
|
||||
'Hold' => 'Hold',
|
||||
'Rejected' => 'Rejected',
|
||||
])
|
||||
->columns(['default' => 1, 'sm' => 3]),
|
||||
->disabled(function ($get) {
|
||||
$currentUser = Filament::auth()->user();
|
||||
$approverId = $get('characteristic_approver_master_id');
|
||||
|
||||
if (! $approverId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (str_contains($approverId, '_')) {
|
||||
[$approverId, $level] = explode('_', $approverId);
|
||||
}
|
||||
|
||||
$approver = CharacteristicApproverMaster::find($approverId);
|
||||
if (! $approver) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Super Admin can edit any
|
||||
if ($currentUser && $currentUser->hasRole('Super Admin')) {
|
||||
return false; // field enabled
|
||||
}
|
||||
|
||||
// Otherwise, enable only if the user's name matches
|
||||
return $approver->name1 != $currentUser?->name;
|
||||
}),
|
||||
Forms\Components\TextInput::make('approver_remark1')
|
||||
->label('Approver Remark 1')
|
||||
->reactive(),
|
||||
Forms\Components\DateTimePicker::make('approved1_at')
|
||||
->label('Approved At 1')
|
||||
->reactive()
|
||||
->disabled(function ($get) {
|
||||
$currentUser = Filament::auth()->user(); // logged-in user
|
||||
$approverId = $get('characteristic_approver_master_id');
|
||||
|
||||
if (! $approverId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (str_contains($approverId, '_')) {
|
||||
[$approverId, $level] = explode('_', $approverId);
|
||||
}
|
||||
|
||||
$approver = CharacteristicApproverMaster::find($approverId);
|
||||
if (! $approver) {
|
||||
return true;
|
||||
}
|
||||
if ($currentUser && $currentUser->hasRole('Super Admin')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $approver->name1 != $currentUser?->name;
|
||||
}),
|
||||
Forms\Components\Select::make('approver_status2')
|
||||
->label('Approver Status 2')
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
if ($state && empty($get('approved2_at'))) {
|
||||
$set('approved2_at', now());
|
||||
}
|
||||
})
|
||||
->options([
|
||||
'Approved' => 'Approved',
|
||||
'Hold' => 'Hold',
|
||||
'Rejected' => 'Rejected',
|
||||
])
|
||||
->disabled(function ($get) {
|
||||
$currentUser = Filament::auth()->user(); // get the User object
|
||||
$approverId = $get('characteristic_approver_master_id');
|
||||
|
||||
if (! $approverId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (str_contains($approverId, '_')) {
|
||||
[$approverId, $level] = explode('_', $approverId);
|
||||
}
|
||||
|
||||
$approver = CharacteristicApproverMaster::find($approverId);
|
||||
if (! $approver) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Super Admin can always edit
|
||||
if ($currentUser && $currentUser->hasRole('Super Admin')) {
|
||||
return false; // ENABLE field
|
||||
}
|
||||
|
||||
// Otherwise, enable only if the user's name matches
|
||||
return $approver->name2 != $currentUser?->name;
|
||||
}),
|
||||
Forms\Components\TextInput::make('approver_remark2')
|
||||
->label('Approver Remark 2')
|
||||
->reactive(),
|
||||
Forms\Components\DateTimePicker::make('approved2_at')
|
||||
->label('Approverd At 2')
|
||||
->reactive()
|
||||
->disabled(function ($get) {
|
||||
$currentUser = Filament::auth()->user(); // logged-in user
|
||||
$approverId = $get('characteristic_approver_master_id');
|
||||
|
||||
if (! $approverId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (str_contains($approverId, '_')) {
|
||||
[$approverId, $level] = explode('_', $approverId);
|
||||
}
|
||||
|
||||
$approver = CharacteristicApproverMaster::find($approverId);
|
||||
if (! $approver) {
|
||||
return true;
|
||||
}
|
||||
if ($currentUser && $currentUser->hasRole('Super Admin')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $approver->name2 != $currentUser?->name;
|
||||
})
|
||||
->dehydrated(true),
|
||||
Forms\Components\Select::make('approver_status3')
|
||||
->label('Approver Status 3')
|
||||
->reactive()
|
||||
->options([
|
||||
'Approved' => 'Approved',
|
||||
'Hold' => 'Hold',
|
||||
'Rejected' => 'Rejected',
|
||||
])
|
||||
->disabled(function ($get) {
|
||||
$currentUser = Filament::auth()->user();
|
||||
$approverId = $get('characteristic_approver_master_id');
|
||||
|
||||
if (! $approverId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (str_contains($approverId, '_')) {
|
||||
[$approverId, $level] = explode('_', $approverId);
|
||||
}
|
||||
|
||||
$approver = CharacteristicApproverMaster::find($approverId);
|
||||
if (! $approver) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($currentUser->hasRole('Super Admin')) {
|
||||
return false;
|
||||
} else {
|
||||
return $approver->name3 != $currentUser?->name;
|
||||
}
|
||||
|
||||
}),
|
||||
Forms\Components\TextInput::make('approver_remark3')
|
||||
->label('Approver Remark 3')
|
||||
->reactive(),
|
||||
Forms\Components\DateTimePicker::make('approved3_at')
|
||||
->label('Approverd At 3')
|
||||
->reactive()
|
||||
->disabled(function ($get) {
|
||||
$currentUser = Filament::auth()->user(); // logged-in user
|
||||
$approverId = $get('characteristic_approver_master_id');
|
||||
|
||||
if (! $approverId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (str_contains($approverId, '_')) {
|
||||
[$approverId, $level] = explode('_', $approverId);
|
||||
}
|
||||
|
||||
$approver = CharacteristicApproverMaster::find($approverId);
|
||||
if (! $approver) {
|
||||
return true;
|
||||
}
|
||||
if ($currentUser && $currentUser->hasRole('Super Admin')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $approver->name3 != $currentUser?->name;
|
||||
}),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->label('Updated By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\TextInput::make('id')
|
||||
->hidden()
|
||||
->readOnly(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -588,36 +399,6 @@ class RequestCharacteristicResource extends Resource
|
||||
]);
|
||||
}
|
||||
|
||||
protected static function isNewWorkFlow($get): string
|
||||
{
|
||||
$year = now()->format('y');
|
||||
$month = now()->format('m');
|
||||
$date = now()->format('d');
|
||||
$prefix = "WF-{$year}{$month}{$date}-";
|
||||
|
||||
$lastWorkflow = RequestCharacteristic::where('work_flow_id', 'like', "{$prefix}%")
|
||||
// ->where('machine_id', $MachineId)
|
||||
->where('work_flow_id', 'like', "{$prefix}%")
|
||||
->orderByDesc('work_flow_id')
|
||||
->first();
|
||||
|
||||
if ($lastWorkflow) {
|
||||
$lastSerial = substr($lastWorkflow->work_flow_id, strlen($prefix));
|
||||
$nextSerial = str_pad(
|
||||
intval($lastSerial) + 1,
|
||||
3,
|
||||
'0',
|
||||
STR_PAD_LEFT
|
||||
);
|
||||
} else {
|
||||
$nextSerial = '001';
|
||||
}
|
||||
|
||||
$workFlowId = "{$prefix}{$nextSerial}";
|
||||
|
||||
return $workFlowId;
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
@@ -655,24 +436,10 @@ class RequestCharacteristicResource extends Resource
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('characteristicApproverMaster.machine_name')
|
||||
->label('Machine')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('characteristicApproverMaster.characteristic_field')
|
||||
->label('Master Characteristic')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->formatStateUsing(fn (string $state): string => strtoupper(__($state)))
|
||||
->extraAttributes(['class' => 'uppercase'])
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('characteristic_name')
|
||||
->label('Characteristic Name')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->formatStateUsing(fn (string $state): string => strtoupper(__($state)))
|
||||
->extraAttributes(['class' => 'uppercase'])
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('current_value')
|
||||
->label('Current Value')
|
||||
@@ -691,17 +458,6 @@ class RequestCharacteristicResource extends Resource
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('approver_status1')
|
||||
->label('Approver Status 1')
|
||||
->color(fn (string $state): string => match ($state) {
|
||||
'Approved' => 'success',
|
||||
'Hold' => 'warning',
|
||||
'Rejected' => 'danger',
|
||||
default => 'gray',
|
||||
})
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('approver_remark1')
|
||||
->label('Approver Remark 1')
|
||||
// ->color('success')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
@@ -719,18 +475,7 @@ class RequestCharacteristicResource extends Resource
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('approver_status2')
|
||||
->label('Approver Status 2')
|
||||
->color(fn (string $state): string => match ($state) {
|
||||
'Approved' => 'success',
|
||||
'Hold' => 'warning',
|
||||
'Rejected' => 'danger',
|
||||
default => 'gray',
|
||||
})
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('approver_remark2')
|
||||
->label('Approver Remark 2')
|
||||
// ->color('success')
|
||||
// ->color('danger')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
@@ -747,18 +492,7 @@ class RequestCharacteristicResource extends Resource
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('approver_status3')
|
||||
->label('Approver Status 3')
|
||||
->color(fn (string $state): string => match ($state) {
|
||||
'Approved' => 'success',
|
||||
'Hold' => 'warning',
|
||||
'Rejected' => 'danger',
|
||||
default => 'gray',
|
||||
})
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('approver_remark3')
|
||||
->label('Approver Remark 3')
|
||||
// ->color('success')
|
||||
// ->color('primary')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
@@ -769,31 +503,26 @@ class RequestCharacteristicResource extends Resource
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_by')
|
||||
->label('Created By')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_by')
|
||||
->label('Updated By')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
|
||||
@@ -3011,8 +3011,6 @@ class CharacteristicsController extends Controller
|
||||
$userName = 'Admin';
|
||||
}
|
||||
|
||||
$charField = $request->header('characteristic-field');
|
||||
|
||||
$json = $request->input('data');
|
||||
$data = json_decode($json, true);
|
||||
|
||||
@@ -3036,10 +3034,6 @@ class CharacteristicsController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($charField == null || $charField == '') {
|
||||
$charField = 'nil';
|
||||
}
|
||||
|
||||
$plant = Plant::where('code', $plantCode)->first();
|
||||
if (! $plant) {
|
||||
return response()->json([
|
||||
@@ -3078,47 +3072,11 @@ class CharacteristicsController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($machineName == null || $machineName == '' || ! $machineName) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Machine name can't be empty!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($itemCode == null || $itemCode == '') {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item Code can't be empty!",
|
||||
], 400);
|
||||
} elseif (Str::length($itemCode) < 6 || ! ctype_alnum($itemCode)) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid item code found!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
if (! $jobNo) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Job number can't be empty",
|
||||
], 404);
|
||||
} elseif (Str::length($jobNo) < 7) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Job number '{$jobNo}' should contain minimum 7 digits!",
|
||||
], 404);
|
||||
} elseif (! is_numeric($jobNo)) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Job number '{$jobNo}' should contain only numeric values!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$machine = Machine::where('work_center', $workCenter)->first();
|
||||
if (! $machine) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Work center '{$workCenter}' not found in master!",
|
||||
'status_description' => "Work center '{$workCenter}' not found!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
@@ -3126,33 +3084,16 @@ class CharacteristicsController extends Controller
|
||||
if (! $machineAgaPlant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Work center '{$workCenter}' not found for the plant code '{$plantCode}' in master!",
|
||||
'status_description' => "Work center '{$workCenter}' not found for the plant code '{$plantCode}'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$MachineId = $machineAgaPlant->id;
|
||||
|
||||
$pCode = CharacteristicApproverMaster::where('plant_id', $plantId)->first();
|
||||
if (! $pCode) {
|
||||
if ($machineName == null || $machineName == '' || ! $machineName) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Plant code '{$plantCode}' not found in characteristic approver master!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$wCenter = CharacteristicApproverMaster::where('machine_id', $MachineId)->first();
|
||||
if (! $wCenter) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Work center '{$workCenter}' not found in characteristic approver master!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$wCenterAgaPlant = CharacteristicApproverMaster::where('machine_id', $MachineId)->where('plant_id', $plantId)->first();
|
||||
if (! $wCenterAgaPlant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Work center '{$workCenter}' not found for the plant code '{$plantCode}' in characteristic approver master!",
|
||||
'status_description' => "Machine name can't be empty!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
@@ -3160,7 +3101,7 @@ class CharacteristicsController extends Controller
|
||||
if (! $mName) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Machine name '{$machineName}' not found in characteristic approver master!",
|
||||
'status_description' => "Machine name '{$machineName}' not found in master!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
@@ -3168,28 +3109,19 @@ class CharacteristicsController extends Controller
|
||||
if (! $mNameAgaPlant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Machine name '{$machineName}' not found for the plant code '{$plantCode}' in characteristic approver master!",
|
||||
'status_description' => "Machine name '{$machineName}' not found in master against plant code '{$plantCode}'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$mNameAgaWorkCenter = CharacteristicApproverMaster::where('machine_name', $machineName)->where('machine_id', $MachineId)->first();
|
||||
if (! $mNameAgaWorkCenter) {
|
||||
$charId = $mNameAgaPlant->id;
|
||||
|
||||
if ($itemCode == null || $itemCode == '' || ! $itemCode) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Machine name '{$machineName}' not found for the work center '{$workCenter}' in characteristic approver master!",
|
||||
'status_description' => "Item code can't be empty!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
$charId = $mNameAgaWorkCenterForPlant->id;
|
||||
|
||||
$iCode = Item::where('code', $itemCode)->first();
|
||||
if (! $iCode) {
|
||||
return response()->json([
|
||||
@@ -3212,7 +3144,10 @@ class CharacteristicsController extends Controller
|
||||
|
||||
foreach ($characteristics as $char) {
|
||||
$charName = strtolower($char['characteristic_name']) ?? null;
|
||||
$pendingExists = RequestCharacteristic::where('plant_id', $plantId)->where('aufnr', $jobNo)->where('characteristic_name', $charName)->latest()->first();
|
||||
$pendingExists = RequestCharacteristic::where('aufnr', $jobNo)
|
||||
->where('characteristic_name', $charName)
|
||||
->latest()
|
||||
->first();
|
||||
|
||||
if ($pendingExists) {
|
||||
|
||||
@@ -3241,8 +3176,7 @@ class CharacteristicsController extends Controller
|
||||
|
||||
$year = now()->format('y');
|
||||
$month = now()->format('m');
|
||||
$date = now()->format('d');
|
||||
$prefix = "WF-{$year}{$month}{$date}-";
|
||||
$prefix = "WF-{$year}{$month}-";
|
||||
|
||||
// $existingWorkflowId = RequestCharacteristic::where('plant_id', $plantId)
|
||||
// ->where('machine_id', $MachineId)
|
||||
@@ -3254,9 +3188,8 @@ class CharacteristicsController extends Controller
|
||||
|
||||
// }
|
||||
|
||||
$lastWorkflow = RequestCharacteristic::where('work_flow_id', 'like', "{$prefix}%")
|
||||
// ->where('plant_id', $plantId)
|
||||
// ->where('machine_id', $MachineId)
|
||||
$lastWorkflow = RequestCharacteristic::where('plant_id', $plantId)
|
||||
->where('machine_id', $MachineId)
|
||||
->where('work_flow_id', 'like', "{$prefix}%")
|
||||
->orderByDesc('work_flow_id')
|
||||
->first();
|
||||
|
||||
@@ -12,7 +12,6 @@ class ProcessOrder extends Model
|
||||
|
||||
protected $fillable = [
|
||||
'plant_id',
|
||||
'line_id',
|
||||
'item_id',
|
||||
'process_order',
|
||||
'coil_number',
|
||||
@@ -20,8 +19,6 @@ class ProcessOrder extends Model
|
||||
'received_quantity',
|
||||
'sfg_number',
|
||||
'machine_name',
|
||||
'scrap_quantity',
|
||||
'rework_status',
|
||||
'created_at',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
@@ -33,12 +30,7 @@ class ProcessOrder extends Model
|
||||
return $this->belongsTo(Plant::class);
|
||||
}
|
||||
|
||||
public function line(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Line::class);
|
||||
}
|
||||
|
||||
public function item(): BelongsTo
|
||||
public function item()
|
||||
{
|
||||
return $this->belongsTo(Item::class, 'item_id');
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
"tpetry/laravel-postgresql-enhanced": "^2.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-debugbar": "^3.15",
|
||||
"barryvdh/laravel-debugbar": "^4.0",
|
||||
"barryvdh/laravel-ide-helper": "^3.5",
|
||||
"beyondcode/laravel-dump-server": "^2.1",
|
||||
"fakerphp/faker": "^1.23",
|
||||
|
||||
@@ -1,33 +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
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
ALTER TABLE process_orders
|
||||
ADD COLUMN line_id BIGINT DEFAULT NULL,
|
||||
ADD CONSTRAINT process_orders_line_id_fkey
|
||||
FOREIGN KEY (line_id) REFERENCES lines(id);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('process_orders', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -1,29 +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
|
||||
{
|
||||
DB::statement("
|
||||
ALTER TABLE process_orders
|
||||
ADD COLUMN scrap_quantity NUMERIC(10,3)
|
||||
");
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('process_orders', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -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 process_orders
|
||||
ADD COLUMN rework_status INT NOT NULL DEFAULT (0)
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('process_orders', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user