Compare commits
150 Commits
renovate/a
...
fbf3edb3eb
| Author | SHA1 | Date | |
|---|---|---|---|
| fbf3edb3eb | |||
|
|
54d2f7d055 | ||
|
|
e1bf0a2066 | ||
|
|
a13fb8330c | ||
|
|
70848bb10a | ||
|
|
a6d28a035b | ||
|
|
d38f1c9e87 | ||
|
|
08c104ded9 | ||
| 6be40f4ee4 | |||
|
|
2f51007531 | ||
| 32fa892318 | |||
|
|
98daa2fd7e | ||
| 43b271bf1b | |||
|
|
02f0dce6aa | ||
| 88ad090a4e | |||
|
|
f9481275db | ||
| cc6395986b | |||
|
|
579daf6a83 | ||
| 70f279e04e | |||
|
|
38dc55ac7c | ||
|
|
3b890374e0 | ||
| 901058500d | |||
|
|
9f2ffa46ce | ||
|
|
e9657caeb4 | ||
| 2f06ffa665 | |||
|
|
3d764e0032 | ||
| f063393a55 | |||
|
|
e0168b90b4 | ||
| f7d438998e | |||
|
|
292ff86e39 | ||
| b277ecdfaa | |||
|
|
eaebee8336 | ||
| a9e819e503 | |||
|
|
d50171154f | ||
| 1312569d44 | |||
|
|
dac7cd4034 | ||
| f71e73e4fe | |||
|
|
34c143ba13 | ||
| c49e53d51c | |||
|
|
dbe1c0a1c2 | ||
| ad4a9898c6 | |||
|
|
009e5f93a3 | ||
| e8ae8d5f85 | |||
|
|
a8bd7a781c | ||
| f35333c147 | |||
|
|
5823a6b3d1 | ||
| e1e155d42e | |||
|
|
35ca404a69 | ||
|
|
9d12234d34 | ||
| ed3bf55204 | |||
|
|
f7964dca25 | ||
|
|
bfcb5f9f0c | ||
|
|
39d65afcfe | ||
|
|
7fcb3ebcb2 | ||
| a625312c59 | |||
|
|
e7acc56943 | ||
| f25ee965f3 | |||
|
|
d53addd0ad | ||
| 0e86ce0a4e | |||
|
|
73627bd7f9 | ||
| f81033636c | |||
|
|
ea0c4fcf31 | ||
| 0d83ff3ab5 | |||
|
|
b662795677 | ||
| 5a55fd49d5 | |||
|
|
6b8b03b2e3 | ||
| bf4fccecc7 | |||
|
|
afc41f20a5 | ||
| ebbe24b130 | |||
|
|
c3b8bc3880 | ||
| 871af92ebe | |||
|
|
42b27afb41 | ||
| 44f8495f16 | |||
|
|
889b18e833 | ||
| b56824cfdf | |||
|
|
68bc729856 | ||
| 7f88249033 | |||
|
|
7d10def133 | ||
| 52356d1d52 | |||
|
|
330bdd4d6e | ||
| 57a0a0f658 | |||
|
|
b7c552a64e | ||
|
|
8abd3057e1 | ||
|
|
1ebe456466 | ||
| ecb0c115da | |||
|
|
f3caccea72 | ||
| 640bd1b520 | |||
|
|
fb12f03b34 | ||
| 4e8b5188ed | |||
|
|
91ede80655 | ||
| e4f0b38858 | |||
|
|
26dd1bddc1 | ||
| 415fbab703 | |||
|
|
8cc77d0e01 | ||
|
|
a127a6e35f | ||
|
|
9ad230d789 | ||
|
|
f8683a561c | ||
| 3aa5cc62cb | |||
|
|
e047abed7b | ||
|
|
226d91ec6e | ||
|
|
221220d48e | ||
|
|
5b37cfe308 | ||
|
|
44b7088b6f | ||
| 33b16c1c95 | |||
|
|
e03bf547f0 | ||
| 11cf91c1af | |||
|
|
c519fd2180 | ||
| 867a4952ef | |||
|
|
6b59c6ac47 | ||
|
|
0dca72d271 | ||
|
|
e5c805f7ee | ||
|
|
44e890ccb6 | ||
|
|
a3b96cbded | ||
| bb6f26fbb8 | |||
|
|
44204df962 | ||
|
|
a3525a2d6e | ||
|
|
eb1a23bd7c | ||
|
|
e8b2c17427 | ||
|
|
f62618d82c | ||
| 30545569b7 | |||
|
|
7db5c91842 | ||
| d03dffad65 | |||
|
|
c571e6a961 | ||
|
|
480d906e6b | ||
|
|
25a73256bf | ||
|
|
a9a3bcf1dc | ||
|
|
e23c493e59 | ||
| 860ee7ecf5 | |||
|
|
a6e7330275 | ||
| 936cdf5c21 | |||
|
|
ec517d01f2 | ||
| da0ff48347 | |||
|
|
6b02cb8c29 | ||
| f106cd1e1e | |||
|
|
33b02fbed7 | ||
| edd9048f0b | |||
|
|
fe7e5301c0 | ||
| ce084122a2 | |||
|
|
fee05e2388 | ||
| b21f68fc36 | |||
|
|
c45efba965 | ||
|
|
ef24ef8549 | ||
| 351bfb359b | |||
|
|
6f5bc9ad38 | ||
| 418a17ffb3 | |||
|
|
28503c0953 | ||
|
|
956f563203 | ||
|
|
f7d37a7c3f | ||
|
|
fe1be84743 | ||
|
|
8b01f91bf7 |
@@ -68,7 +68,7 @@ class SendVehicleReport extends Command
|
||||
'type',
|
||||
])
|
||||
->where('plant_id', $plant->id)
|
||||
->whereBetween('created_at', [$startDate, $endDate])
|
||||
->whereBetween('entry_time', [$startDate, $endDate])
|
||||
->get();
|
||||
|
||||
if ($vehicleEntries->isEmpty()) {
|
||||
|
||||
@@ -41,6 +41,8 @@ class AlertMailRuleExporter extends Exporter
|
||||
$plant = Plant::find($state);
|
||||
return $plant ? $plant->code : 'Unknown';
|
||||
}),
|
||||
ExportColumn::make('machine.work_center')
|
||||
->label('WORK CENTER'),
|
||||
ExportColumn::make('cc_emails')
|
||||
->label('CC EMAILS'),
|
||||
ExportColumn::make('invoiceMaster.receiving_plant_name')
|
||||
|
||||
83
app/Filament/Exports/BeforeTestReadingExporter.php
Normal file
83
app/Filament/Exports/BeforeTestReadingExporter.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\BeforeTestReading;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class BeforeTestReadingExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = BeforeTestReading::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('line.name')
|
||||
->label('LINE NAME'),
|
||||
ExportColumn::make('machine.name')
|
||||
->label('MACHINE NAME'),
|
||||
ExportColumn::make('motorTestingMaster.item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('motorTestingMaster.item.description')
|
||||
->label('MODEL DESCRIPTION'),
|
||||
ExportColumn::make('serial_number')
|
||||
->label('SERIAL NUMBER'),
|
||||
ExportColumn::make('motorTestingMaster.kw')
|
||||
->label('KW'),
|
||||
ExportColumn::make('motorTestingMaster.hp')
|
||||
->label('HP'),
|
||||
ExportColumn::make('motorTestingMaster.phase')
|
||||
->label('PHASE'),
|
||||
ExportColumn::make('motorTestingMaster.connection')
|
||||
->label('CONNECTION'),
|
||||
ExportColumn::make('motorTestingMaster.isi_model')
|
||||
->label('ISI MODEL'),
|
||||
ExportColumn::make('before_fr_res_ry')
|
||||
->label('BEFORE FR RESISTANCE RY'),
|
||||
ExportColumn::make('before_fr_res_yb')
|
||||
->label('BEFORE FR RESISTANCE YB'),
|
||||
ExportColumn::make('before_fr_res_br')
|
||||
->label('BEFORE FR RESISTANCE BR'),
|
||||
ExportColumn::make('before_fr_ir')
|
||||
->label('BEFORE FR IR'),
|
||||
ExportColumn::make('tested_by')
|
||||
->label('TESTED BY'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('scanned_at')
|
||||
->label('SCANNED AT'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your before test reading export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
64
app/Filament/Exports/DealerVisitPlanExporter.php
Normal file
64
app/Filament/Exports/DealerVisitPlanExporter.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\DealerVisitPlan;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class DealerVisitPlanExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = DealerVisitPlan::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('name')
|
||||
->label('DEALER NAME'),
|
||||
ExportColumn::make('company')
|
||||
->label('DEALER COMPANY'),
|
||||
ExportColumn::make('visit_plan_date')
|
||||
->label('VISIT PLAN DATE'),
|
||||
ExportColumn::make('organizer')
|
||||
->label('ORGANIZER'),
|
||||
ExportColumn::make('employeeMaster.name')
|
||||
->label('RECIPIENT NAME'),
|
||||
ExportColumn::make('number_of_person')
|
||||
->label('NUMBER OF PERSON'),
|
||||
ExportColumn::make('purpose_of_visit')
|
||||
->label('PURPOSE OF VISIT'),
|
||||
ExportColumn::make('status')
|
||||
->label('STATUS'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your dealer visit plan 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;
|
||||
}
|
||||
}
|
||||
355
app/Filament/Exports/ItemCharacteristicExporter.php
Normal file
355
app/Filament/Exports/ItemCharacteristicExporter.php
Normal file
@@ -0,0 +1,355 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\ItemCharacteristic;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class ItemCharacteristicExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = ItemCharacteristic::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.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('class')
|
||||
->label('CLASS'),
|
||||
ExportColumn::make('zz1_cn_bill_ord')
|
||||
->label('ZZ1 CN BILL ORDER'),
|
||||
ExportColumn::make('zmm_amps')
|
||||
->label('ZMM AMPS'),
|
||||
ExportColumn::make('zmm_brand')
|
||||
->label('ZMM BRAND'),
|
||||
ExportColumn::make('zmm_degreeofprotection')
|
||||
->label('ZMM DEGREE OF PROTECTION'),
|
||||
ExportColumn::make('zmm_delivery')
|
||||
->label('ZMM DELIVERY'),
|
||||
ExportColumn::make('zmm_dir_rot')
|
||||
->label('ZMM DIRECTION OF ROTATION'),
|
||||
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 MAXAMB TEMP'),
|
||||
ExportColumn::make('zmm_mincoolingflow')
|
||||
->label('ZMM MIN COOLING FLOW'),
|
||||
ExportColumn::make('zmm_motorseries')
|
||||
->label('ZMM MOTOR SERIES'),
|
||||
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 PUMP FLOW TYPE'),
|
||||
ExportColumn::make('zmm_pumpseries')
|
||||
->label('ZMM PUMP SERIES'),
|
||||
ExportColumn::make('zmm_pump_model')
|
||||
->label('ZMM PUMP MODEL'),
|
||||
ExportColumn::make('zmm_ratedpower')
|
||||
->label('ZMM RATED POWER'),
|
||||
ExportColumn::make('zmm_region')
|
||||
->label('ZMM REGION'),
|
||||
ExportColumn::make('zmm_servicefactor')
|
||||
->label('ZMM SERVICE FACTOR'),
|
||||
ExportColumn::make('zmm_servicefactormaximumamps')
|
||||
->label('ZMM SERVICE FACTOR MAXIMUM AMPS'),
|
||||
ExportColumn::make('zmm_speed')
|
||||
->label('ZMM SPEED'),
|
||||
ExportColumn::make('zmm_suction')
|
||||
->label('ZMM SUCTION'),
|
||||
ExportColumn::make('zmm_suctionxdelivery')
|
||||
->label('ZMM SUCTION X DELIVERY'),
|
||||
ExportColumn::make('zmm_supplysource')
|
||||
->label('ZMM SUPPLY SOURCE'),
|
||||
ExportColumn::make('zmm_temperature')
|
||||
->label('ZMM TEMPERATURE'),
|
||||
ExportColumn::make('zmm_thrustload')
|
||||
->label('ZMM THRUST LOAD'),
|
||||
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 PV ARRAY RATING'),
|
||||
ExportColumn::make('zmm_isi')
|
||||
->label('ZMM ISI'),
|
||||
ExportColumn::make('zmm_isimotor')
|
||||
->label('ZMM ISI MOTOR'),
|
||||
ExportColumn::make('zmm_isipump')
|
||||
->label('ZMM ISI PUMP'),
|
||||
ExportColumn::make('zmm_isipumpset')
|
||||
->label('ZMM ISI PUMPSET'),
|
||||
ExportColumn::make('zmm_pumpset_model')
|
||||
->label('ZMM PUMPSET MODEL'),
|
||||
ExportColumn::make('zmm_stages')
|
||||
->label('ZMM STAGES'),
|
||||
ExportColumn::make('zmm_headrange')
|
||||
->label('ZMM HEAD RANGE'),
|
||||
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 ISI REFERENCE'),
|
||||
ExportColumn::make('zmm_category')
|
||||
->label('ZMM CATEGORY'),
|
||||
ExportColumn::make('zmm_submergence')
|
||||
->label('ZMM SUBMERGENCE'),
|
||||
ExportColumn::make('zmm_capacitorstart')
|
||||
->label('ZMM CAPACITOR START'),
|
||||
ExportColumn::make('zmm_capacitorrun')
|
||||
->label('ZMM CAPACITOR RUN'),
|
||||
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 BODY MOC'),
|
||||
ExportColumn::make('zmm_rotormoc')
|
||||
->label('ZMM ROTOR MOC'),
|
||||
ExportColumn::make('zmm_dlwl')
|
||||
->label('ZMM DLWL'),
|
||||
ExportColumn::make('zmm_inputpower')
|
||||
->label('ZMM INPUT POWER'),
|
||||
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 DISCHARGE RANGE'),
|
||||
ExportColumn::make('zmm_efficiency_class')
|
||||
->label('ZMM EFFICIENCY CLASS'),
|
||||
ExportColumn::make('zmm_framesize')
|
||||
->label('ZMM FRAME SIZE'),
|
||||
ExportColumn::make('zmm_impellerdiameter')
|
||||
->label('ZMM IMPELLER DIAMETER'),
|
||||
ExportColumn::make('zmm_insulationclass')
|
||||
->label('ZMM INSULATION CLASS'),
|
||||
ExportColumn::make('zmm_maxflow')
|
||||
->label('ZMM MAX FLOW'),
|
||||
ExportColumn::make('zmm_minhead')
|
||||
->label('ZMM MIN HEAD'),
|
||||
ExportColumn::make('zmm_mtrlofconst')
|
||||
->label('ZMM MTR LOF CONST'),
|
||||
ExportColumn::make('zmm_nde')
|
||||
->label('ZMM NDE'),
|
||||
ExportColumn::make('zmm_powerfactor')
|
||||
->label('ZMM POWER FACTOR'),
|
||||
ExportColumn::make('zmm_tagno')
|
||||
->label('ZMM TAG NO'),
|
||||
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_logo_ce')
|
||||
->label('ZMM LOGO CE'),
|
||||
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_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 ISI VALVE'),
|
||||
ExportColumn::make('zmm_isi_wc')
|
||||
->label('ZMM ISI WC'),
|
||||
ExportColumn::make('zmm_labelperiod')
|
||||
->label('ZMM LABEL PERIOD'),
|
||||
ExportColumn::make('zmm_length')
|
||||
->label('ZMM LENGTH'),
|
||||
ExportColumn::make('zmm_license_cml_no')
|
||||
->label('ZMM LICENSE CML NO'),
|
||||
ExportColumn::make('zmm_mfgmonyr')
|
||||
->label('ZMM MFG MON YR'),
|
||||
ExportColumn::make('zmm_modelyear')
|
||||
->label('ZMM MODEL YEAR'),
|
||||
ExportColumn::make('zmm_motoridentification')
|
||||
->label('ZMM MOTOR IDENTIFICATION'),
|
||||
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_logo_nsf')
|
||||
->label('ZMM LOGO NSF'),
|
||||
ExportColumn::make('zmm_packtype')
|
||||
->label('ZMM PACK TYPE'),
|
||||
ExportColumn::make('zmm_panel')
|
||||
->label('ZMM PANEL'),
|
||||
ExportColumn::make('zmm_performance_factor')
|
||||
->label('ZMM PERFORMANCE FACTOR'),
|
||||
ExportColumn::make('zmm_pumpidentification')
|
||||
->label('ZMM PUMP IDENTIFICATION'),
|
||||
ExportColumn::make('zmm_psettype')
|
||||
->label('ZMM PSET TYPE'),
|
||||
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('zmm_operating_range')
|
||||
->label('ZMM OPERATING RANGE'),
|
||||
ExportColumn::make('zmm_intake_air')
|
||||
->label('ZMM INTAKE AIR'),
|
||||
ExportColumn::make('zmm_oxygen_transfer_rate')
|
||||
->label('ZMM OXYGEN TRANSFER RATE'),
|
||||
ExportColumn::make('zmm_air_inlet_pipesize')
|
||||
->label('ZMM AIR INLET PIPE SIZE'),
|
||||
ExportColumn::make('zmm_sump_depth')
|
||||
->label('ZMM SUMP DEPTH'),
|
||||
ExportColumn::make('zmm_poles')
|
||||
->label('ZMM POLES'),
|
||||
ExportColumn::make('zmm_motor_heading')
|
||||
->label('ZMM MOTOR HEADING'),
|
||||
ExportColumn::make('zmm_motor_speed')
|
||||
->label('ZMM MOTOR SPEED'),
|
||||
ExportColumn::make('zqmm_qty')
|
||||
->label('ZMM QTY'),
|
||||
ExportColumn::make('zmm_1')
|
||||
->label('ZMM 1')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_2')
|
||||
->label('ZMM 2')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_3')
|
||||
->label('ZMM 3')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_4')
|
||||
->label('ZMM 4')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_5')
|
||||
->label('ZMM 5')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_6')
|
||||
->label('ZMM 6')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_7')
|
||||
->label('ZMM 7')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_8')
|
||||
->label('ZMM 8')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_9')
|
||||
->label('ZMM 9')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_10')
|
||||
->label('ZMM 10')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_11')
|
||||
->label('ZMM 11')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_12')
|
||||
->label('ZMM 12')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_13')
|
||||
->label('ZMM 13')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_14')
|
||||
->label('ZMM 14')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_15')
|
||||
->label('ZMM 15')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your item 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;
|
||||
}
|
||||
}
|
||||
87
app/Filament/Exports/PanelBoxValidationExporter.php
Normal file
87
app/Filament/Exports/PanelBoxValidationExporter.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\PanelBoxValidation;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class PanelBoxValidationExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = PanelBoxValidation::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.name')
|
||||
->label('PLANT NAME'),
|
||||
ExportColumn::make('line.name')
|
||||
->label('LINE NAME'),
|
||||
ExportColumn::make('stickerMaster.item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('production_order')
|
||||
->label('PRODUCTION ORDER'),
|
||||
ExportColumn::make('inspection_lot_number')
|
||||
->label('INSPECTION LOT NUMBER'),
|
||||
ExportColumn::make('serial_number')
|
||||
->label('SERIAL NUMBER'),
|
||||
ExportColumn::make('panel_box_supplier')
|
||||
->label('PANEL BOX SUPPLIER'),
|
||||
ExportColumn::make('panel_box_serial_number')
|
||||
->label('PANEL BOX SERIAL NUMBER'),
|
||||
ExportColumn::make('panel_box_code')
|
||||
->label('PANEL BOX CODE'),
|
||||
ExportColumn::make('serial_number_panel')
|
||||
->label('SERIAL NUMBER PANEL'),
|
||||
ExportColumn::make('pack_slip_panel')
|
||||
->label('PACK SLIP PANEL'),
|
||||
ExportColumn::make('name_plate_panel')
|
||||
->label('NAME PLATE PANEL'),
|
||||
ExportColumn::make('tube_sticker_panel')
|
||||
->label('TUBE STICKER PANEL'),
|
||||
ExportColumn::make('warranty_card_panel')
|
||||
->label('WARRANTY CARD PANEL'),
|
||||
ExportColumn::make('part_validation1')
|
||||
->label('PART VALIDATION 1'),
|
||||
ExportColumn::make('part_validation2')
|
||||
->label('PART VALIDATION 2'),
|
||||
ExportColumn::make('part_validation3')
|
||||
->label('PART VALIDATION 3'),
|
||||
ExportColumn::make('part_validation4')
|
||||
->label('PART VALIDATION 4'),
|
||||
ExportColumn::make('part_validation5')
|
||||
->label('PART VALIDATION 5'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your panel box validation 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;
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,8 @@ class PanelGrMasterExporter extends Exporter
|
||||
->label('INVOICE NUMBER'),
|
||||
ExportColumn::make('supplier_number')
|
||||
->label('SUPPLIER NUMBER'),
|
||||
ExportColumn::make('inspection_lot_number')
|
||||
->label('INSPECTION LOT NUMBER'),
|
||||
ExportColumn::make('quantity')
|
||||
->label('QUANTITY'),
|
||||
ExportColumn::make('created_at')
|
||||
|
||||
102
app/Filament/Exports/StickerDetailExporter.php
Normal file
102
app/Filament/Exports/StickerDetailExporter.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\StickerDetail;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class StickerDetailExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = StickerDetail::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('stickerStructureDetail.sticker_id')
|
||||
->label('STICKER ID'),
|
||||
ExportColumn::make('design_element_type')
|
||||
->label('DESIGN ELEMENT TYPE'),
|
||||
ExportColumn::make('element_id')
|
||||
->label('ELEMENT ID'),
|
||||
ExportColumn::make('element_type')
|
||||
->label('ELEMENT TYPE'),
|
||||
ExportColumn::make('characteristics_type')
|
||||
->label('CHARACTERISTICS TYPE'),
|
||||
ExportColumn::make('string_value')
|
||||
->label('STRING VALUE'),
|
||||
ExportColumn::make('string_font')
|
||||
->label('STRING FONT'),
|
||||
ExportColumn::make('string_size')
|
||||
->label('STRING SIZE'),
|
||||
ExportColumn::make('element_colour')
|
||||
->label('ELEMENT COLOUR'),
|
||||
ExportColumn::make('string_align')
|
||||
->label('STRING ALIGN'),
|
||||
ExportColumn::make('string_x_value')
|
||||
->label('STRING X VALUE'),
|
||||
ExportColumn::make('string_y_value')
|
||||
->label('STRING Y VALUE'),
|
||||
ExportColumn::make('shape_name')
|
||||
->label('SHAPE NAME'),
|
||||
ExportColumn::make('shape_pen_size')
|
||||
->label('SHAPE PEN SIZE'),
|
||||
ExportColumn::make('curve_radius')
|
||||
->label('CURVE RADIUS'),
|
||||
ExportColumn::make('shape_x1_value')
|
||||
->label('SHAPE X1 VALUE'),
|
||||
ExportColumn::make('shape_y1_value')
|
||||
->label('SHAPE Y1 VALUE'),
|
||||
ExportColumn::make('shape_x2_value')
|
||||
->label('SHAPE X2 VALUE'),
|
||||
ExportColumn::make('shape_y2_value')
|
||||
->label('SHAPE Y2 VALUE'),
|
||||
ExportColumn::make('image_x')
|
||||
->label('IMAGE X'),
|
||||
ExportColumn::make('image_y')
|
||||
->label('IMAGE Y'),
|
||||
ExportColumn::make('image_width')
|
||||
->label('IMAGE WIDTH'),
|
||||
ExportColumn::make('image_height')
|
||||
->label('IMAGE HEIGHT'),
|
||||
ExportColumn::make('qr_value')
|
||||
->label('QR VALUE'),
|
||||
ExportColumn::make('qr_align')
|
||||
->label('QR ALIGN'),
|
||||
ExportColumn::make('qr_size')
|
||||
->label('QR SIZE'),
|
||||
ExportColumn::make('qr_x_value')
|
||||
->label('QR X VALUE'),
|
||||
ExportColumn::make('qr_y_value')
|
||||
->label('QR Y VALUE'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your sticker detail 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;
|
||||
}
|
||||
}
|
||||
148
app/Filament/Exports/StickerMappingMasterExporter.php
Normal file
148
app/Filament/Exports/StickerMappingMasterExporter.php
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\StickerMappingMaster;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class StickerMappingMasterExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = StickerMappingMaster::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('itemCharacteristic.item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('sticker_structure1_id')
|
||||
->label('STICKER 1')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker1Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker1_machine_id')
|
||||
->label('WC STICKER 1')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker1Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker1_print_ip')
|
||||
->label('STICKER 1 PRINT IP'),
|
||||
ExportColumn::make('sticker_structure2_id')
|
||||
->label('STICKER 2')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker2Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker2_machine_id')
|
||||
->label('WC STICKER 2')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker2Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker2_print_ip')
|
||||
->label('STICKER 2 PRINT IP'),
|
||||
ExportColumn::make('sticker_structure3_id')
|
||||
->label('STICKER 3')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker3Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker3_machine_id')
|
||||
->label('WC STICKER 3')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker3Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker3_print_ip')
|
||||
->label('STICKER 3 PRINT IP'),
|
||||
ExportColumn::make('sticker_structure4_id')
|
||||
->label('STICKER 4')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker4Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker4_machine_id')
|
||||
->label('WC STICKER 4')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker4Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker4_print_ip')
|
||||
->label('STICKER 4 PRINT IP'),
|
||||
ExportColumn::make('sticker_structure5_id')
|
||||
->label('STICKER 5')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker5Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker5_machine_id')
|
||||
->label('WC STICKER 5')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker5Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker5_print_ip')
|
||||
->label('STICKER 5 PRINT IP'),
|
||||
ExportColumn::make('sticker_structure6_id')
|
||||
->label('STICKER 6')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker6Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker6_machine_id')
|
||||
->label('WC STICKER 6')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker6Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker6_print_ip')
|
||||
->label('STICKER 6 PRINT IP'),
|
||||
ExportColumn::make('sticker_structure7_id')
|
||||
->label('STICKER 7')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker7Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker7_machine_id')
|
||||
->label('WC STICKER 7')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker2Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker7_print_ip')
|
||||
->label('STICKER 7 PRINT IP'),
|
||||
ExportColumn::make('sticker_structure8_id')
|
||||
->label('STICKER 8')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker8Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker8_machine_id')
|
||||
->label('WC STICKER 8')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker8Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker8_print_ip')
|
||||
->label('STICKER 8 PRINT IP'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
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 sticker mapping 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;
|
||||
}
|
||||
}
|
||||
62
app/Filament/Exports/StickerStructureDetailExporter.php
Normal file
62
app/Filament/Exports/StickerStructureDetailExporter.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\StickerStructureDetail;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class StickerStructureDetailExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = StickerStructureDetail::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('sticker_id')
|
||||
->label('STICKER ID'),
|
||||
ExportColumn::make('sticker_width')
|
||||
->label('STICKER WIDTH'),
|
||||
ExportColumn::make('sticker_height')
|
||||
->label('STICKER HEIGHT'),
|
||||
ExportColumn::make('sticker_lmargin')
|
||||
->label('STICKER LEFT MARGIN'),
|
||||
ExportColumn::make('sticker_rmargin')
|
||||
->label('STICKER RIGHT MARGIN'),
|
||||
ExportColumn::make('sticker_tmargin')
|
||||
->label('STICKER TOP MARGIN'),
|
||||
ExportColumn::make('sticker_bmargin')
|
||||
->label('STICKER BOTTOM MARGIN'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your sticker structure detail 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;
|
||||
}
|
||||
}
|
||||
127
app/Filament/Imports/DealerVisitPlanImporter.php
Normal file
127
app/Filament/Imports/DealerVisitPlanImporter.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\DealerVisitPlan;
|
||||
use App\Models\EmployeeMaster;
|
||||
use App\Models\Plant;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
use Filament\Facades\Filament;
|
||||
use Str;
|
||||
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class DealerVisitPlanImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = DealerVisitPlan::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('name')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Dealer Name')
|
||||
->example('Suresh')
|
||||
->label('Dealer Name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('company')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Dealer Company')
|
||||
->example('Suresh Traders')
|
||||
->label('Dealer Company')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('visit_plan_date')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Visit Plan Date')
|
||||
->example('2026-07-20')
|
||||
->label('Visit Plan Date'),
|
||||
ImportColumn::make('organizer')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Organizer')
|
||||
->example('Ramesh')
|
||||
->label('Organizer'),
|
||||
ImportColumn::make('employee_master_id')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Receipient Employee Code')
|
||||
->example('RAS001234')
|
||||
->label('Receipient Employee Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('number_of_person')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Number Of Person')
|
||||
->example('10')
|
||||
->label('Number Of Person'),
|
||||
ImportColumn::make('purpose_of_visit')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Purpose Of Visit')
|
||||
->example('Meeting')
|
||||
->label('Purpose Of Visit'),
|
||||
ImportColumn::make('status')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Status')
|
||||
->example('Planned/Completed')
|
||||
->label('Status'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?DealerVisitPlan
|
||||
{
|
||||
$warnMsg = [];
|
||||
|
||||
$user = null;
|
||||
$dealerName = trim($this->data['name']);
|
||||
$dealerCompany = trim($this->data['company']);
|
||||
$visitPlanDt = trim($this->data['visit_plan_date']);
|
||||
$organizer = trim($this->data['organizer']);
|
||||
$employeeCode = trim($this->data['employee_master_id']);
|
||||
$noOfPerson = trim($this->data['number_of_person']);
|
||||
$purposeOfVisit = trim($this->data['purpose_of_visit']);
|
||||
$status = trim($this->data['status']);
|
||||
$user = Filament::auth()->user()->name;
|
||||
|
||||
if (Str::length($employeeCode) < 5) {
|
||||
$warnMsg[] = 'Invalid receipient employee number found!';
|
||||
}
|
||||
if (! empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
$employeeId = EmployeeMaster::where('code', $employeeCode)->first();
|
||||
|
||||
$eId = $employeeId->id;
|
||||
|
||||
DealerVisitPlan::updateOrCreate(
|
||||
[
|
||||
'name' => $dealerName,
|
||||
'company' => $dealerCompany,
|
||||
'visit_plan_date' => Carbon::createFromFormat('d-m-Y', $visitPlanDt)->format('Y-m-d'),
|
||||
'organizer' => $organizer,
|
||||
'employee_master_id' => $eId,
|
||||
'number_of_person' => $noOfPerson,
|
||||
'purpose_of_visit' => $purposeOfVisit,
|
||||
'status' => $status,
|
||||
'created_by' => $user,
|
||||
'updated_by' => $user,
|
||||
]
|
||||
);
|
||||
|
||||
return null;
|
||||
|
||||
// return new DealerVisitPlan();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your dealer visit plan 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;
|
||||
}
|
||||
}
|
||||
194
app/Filament/Imports/ItemCharacteristicImporter.php
Normal file
194
app/Filament/Imports/ItemCharacteristicImporter.php
Normal file
@@ -0,0 +1,194 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\ItemCharacteristic;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
|
||||
class ItemCharacteristicImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = ItemCharacteristic::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('item')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('class'),
|
||||
ImportColumn::make('zz1_cn_bill_ord'),
|
||||
ImportColumn::make('zmm_amps'),
|
||||
ImportColumn::make('zmm_brand'),
|
||||
ImportColumn::make('zmm_degreeofprotection'),
|
||||
ImportColumn::make('zmm_delivery'),
|
||||
ImportColumn::make('zmm_dir_rot'),
|
||||
ImportColumn::make('zmm_discharge'),
|
||||
ImportColumn::make('zmm_discharge_max'),
|
||||
ImportColumn::make('zmm_discharge_min'),
|
||||
ImportColumn::make('zmm_duty'),
|
||||
ImportColumn::make('zmm_eff_motor'),
|
||||
ImportColumn::make('zmm_eff_pump'),
|
||||
ImportColumn::make('zmm_frequency'),
|
||||
ImportColumn::make('zmm_head'),
|
||||
ImportColumn::make('zmm_heading'),
|
||||
ImportColumn::make('zmm_head_max'),
|
||||
ImportColumn::make('zmm_head_minimum'),
|
||||
ImportColumn::make('zmm_idx_eff_mtr'),
|
||||
ImportColumn::make('zmm_idx_eff_pump'),
|
||||
ImportColumn::make('zmm_kvacode'),
|
||||
ImportColumn::make('zmm_maxambtemp'),
|
||||
ImportColumn::make('zmm_mincoolingflow'),
|
||||
ImportColumn::make('zmm_motorseries'),
|
||||
ImportColumn::make('zmm_motor_model'),
|
||||
ImportColumn::make('zmm_outlet'),
|
||||
ImportColumn::make('zmm_phase'),
|
||||
ImportColumn::make('zmm_pressure'),
|
||||
ImportColumn::make('zmm_pumpflowtype'),
|
||||
ImportColumn::make('zmm_pumpseries'),
|
||||
ImportColumn::make('zmm_pump_model'),
|
||||
ImportColumn::make('zmm_ratedpower'),
|
||||
ImportColumn::make('zmm_region'),
|
||||
ImportColumn::make('zmm_servicefactor'),
|
||||
ImportColumn::make('zmm_servicefactormaximumamps'),
|
||||
ImportColumn::make('zmm_speed'),
|
||||
ImportColumn::make('zmm_suction'),
|
||||
ImportColumn::make('zmm_suctionxdelivery'),
|
||||
ImportColumn::make('zmm_supplysource'),
|
||||
ImportColumn::make('zmm_temperature'),
|
||||
ImportColumn::make('zmm_thrustload'),
|
||||
ImportColumn::make('zmm_volts'),
|
||||
ImportColumn::make('zmm_wire'),
|
||||
ImportColumn::make('zmm_package'),
|
||||
ImportColumn::make('zmm_pvarrayrating'),
|
||||
ImportColumn::make('zmm_isi'),
|
||||
ImportColumn::make('zmm_isimotor'),
|
||||
ImportColumn::make('zmm_isipump'),
|
||||
ImportColumn::make('zmm_isipumpset'),
|
||||
ImportColumn::make('zmm_pumpset_model'),
|
||||
ImportColumn::make('zmm_stages'),
|
||||
ImportColumn::make('zmm_headrange'),
|
||||
ImportColumn::make('zmm_overall_efficiency'),
|
||||
ImportColumn::make('zmm_connection'),
|
||||
ImportColumn::make('zmm_min_bore_size'),
|
||||
ImportColumn::make('zmm_isireference'),
|
||||
ImportColumn::make('zmm_category'),
|
||||
ImportColumn::make('zmm_submergence'),
|
||||
ImportColumn::make('zmm_capacitorstart'),
|
||||
ImportColumn::make('zmm_capacitorrun'),
|
||||
ImportColumn::make('zmm_inch'),
|
||||
ImportColumn::make('zmm_motor_type'),
|
||||
ImportColumn::make('zmm_dismantle_direction'),
|
||||
ImportColumn::make('zmm_eff_ovrall'),
|
||||
ImportColumn::make('zmm_bodymoc'),
|
||||
ImportColumn::make('zmm_rotormoc'),
|
||||
ImportColumn::make('zmm_dlwl'),
|
||||
ImportColumn::make('zmm_inputpower'),
|
||||
ImportColumn::make('zmm_imp_od'),
|
||||
ImportColumn::make('zmm_ambtemp'),
|
||||
ImportColumn::make('zmm_de'),
|
||||
ImportColumn::make('zmm_dischargerange'),
|
||||
ImportColumn::make('zmm_efficiency_class'),
|
||||
ImportColumn::make('zmm_framesize'),
|
||||
ImportColumn::make('zmm_impellerdiameter'),
|
||||
ImportColumn::make('zmm_insulationclass'),
|
||||
ImportColumn::make('zmm_maxflow'),
|
||||
ImportColumn::make('zmm_minhead'),
|
||||
ImportColumn::make('zmm_mtrlofconst'),
|
||||
ImportColumn::make('zmm_nde'),
|
||||
ImportColumn::make('zmm_powerfactor'),
|
||||
ImportColumn::make('zmm_tagno'),
|
||||
ImportColumn::make('zmm_year'),
|
||||
ImportColumn::make('zmm_laser_name'),
|
||||
ImportColumn::make('zmm_beenote'),
|
||||
ImportColumn::make('zmm_beenumber'),
|
||||
ImportColumn::make('zmm_beestar'),
|
||||
ImportColumn::make('zmm_logo_ce'),
|
||||
ImportColumn::make('zmm_codeclass'),
|
||||
ImportColumn::make('zmm_colour'),
|
||||
ImportColumn::make('zmm_logo_cp'),
|
||||
ImportColumn::make('zmm_grade'),
|
||||
ImportColumn::make('zmm_grwt_pset'),
|
||||
ImportColumn::make('zmm_grwt_cable'),
|
||||
ImportColumn::make('zmm_grwt_motor'),
|
||||
ImportColumn::make('zmm_grwt_pf'),
|
||||
ImportColumn::make('zmm_grwt_pump'),
|
||||
ImportColumn::make('zmm_isivalve'),
|
||||
ImportColumn::make('zmm_isi_wc'),
|
||||
ImportColumn::make('zmm_labelperiod'),
|
||||
ImportColumn::make('zmm_length'),
|
||||
ImportColumn::make('zmm_license_cml_no'),
|
||||
ImportColumn::make('zmm_mfgmonyr'),
|
||||
ImportColumn::make('zmm_modelyear'),
|
||||
ImportColumn::make('zmm_motoridentification'),
|
||||
ImportColumn::make('zmm_newt_pset'),
|
||||
ImportColumn::make('zmm_newt_cable'),
|
||||
ImportColumn::make('zmm_newt_motor'),
|
||||
ImportColumn::make('zmm_newt_pf'),
|
||||
ImportColumn::make('zmm_newt_pump'),
|
||||
ImportColumn::make('zmm_logo_nsf'),
|
||||
ImportColumn::make('zmm_packtype'),
|
||||
ImportColumn::make('zmm_panel'),
|
||||
ImportColumn::make('zmm_performance_factor'),
|
||||
ImportColumn::make('zmm_pumpidentification'),
|
||||
ImportColumn::make('zmm_psettype'),
|
||||
ImportColumn::make('zmm_size'),
|
||||
ImportColumn::make('zmm_eff_ttl'),
|
||||
ImportColumn::make('zmm_type'),
|
||||
ImportColumn::make('zmm_usp'),
|
||||
ImportColumn::make('zmm_operating_range'),
|
||||
ImportColumn::make('zmm_intake_air'),
|
||||
ImportColumn::make('zmm_oxygen_transfer_rate'),
|
||||
ImportColumn::make('zmm_air_inlet_pipesize'),
|
||||
ImportColumn::make('zmm_sump_depth'),
|
||||
ImportColumn::make('zmm_poles'),
|
||||
ImportColumn::make('zmm_motor_heading'),
|
||||
ImportColumn::make('zmm_motor_speed'),
|
||||
ImportColumn::make('zqmm_qty'),
|
||||
ImportColumn::make('zmm_1'),
|
||||
ImportColumn::make('zmm_2'),
|
||||
ImportColumn::make('zmm_3'),
|
||||
ImportColumn::make('zmm_4'),
|
||||
ImportColumn::make('zmm_5'),
|
||||
ImportColumn::make('zmm_6'),
|
||||
ImportColumn::make('zmm_7'),
|
||||
ImportColumn::make('zmm_8'),
|
||||
ImportColumn::make('zmm_9'),
|
||||
ImportColumn::make('zmm_10'),
|
||||
ImportColumn::make('zmm_11'),
|
||||
ImportColumn::make('zmm_12'),
|
||||
ImportColumn::make('zmm_13'),
|
||||
ImportColumn::make('zmm_14'),
|
||||
ImportColumn::make('zmm_15'),
|
||||
ImportColumn::make('created_by'),
|
||||
ImportColumn::make('updated_by'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?ItemCharacteristic
|
||||
{
|
||||
// return ItemCharacteristic::firstOrNew([
|
||||
// // Update existing records, matching them by `$this->data['column_name']`
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new ItemCharacteristic();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your item 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;
|
||||
}
|
||||
}
|
||||
70
app/Filament/Imports/PanelBoxValidationImporter.php
Normal file
70
app/Filament/Imports/PanelBoxValidationImporter.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\PanelBoxValidation;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
|
||||
class PanelBoxValidationImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = PanelBoxValidation::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('line')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('stickerMaster')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('production_order'),
|
||||
ImportColumn::make('serial_number'),
|
||||
ImportColumn::make('serial_number_panel'),
|
||||
ImportColumn::make('pack_slip_panel'),
|
||||
ImportColumn::make('name_plate_panel'),
|
||||
ImportColumn::make('tube_sticker_panel'),
|
||||
ImportColumn::make('warranty_card_panel'),
|
||||
ImportColumn::make('part_validation1'),
|
||||
ImportColumn::make('part_validation2'),
|
||||
ImportColumn::make('part_validation3'),
|
||||
ImportColumn::make('part_validation4'),
|
||||
ImportColumn::make('part_validation5'),
|
||||
ImportColumn::make('created_by'),
|
||||
ImportColumn::make('updated_by'),
|
||||
ImportColumn::make('panel_box_supplier'),
|
||||
ImportColumn::make('panel_box_serial_number'),
|
||||
ImportColumn::make('panel_box_code'),
|
||||
ImportColumn::make('inspection_lot_number'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?PanelBoxValidation
|
||||
{
|
||||
// return PanelBoxValidation::firstOrNew([
|
||||
// // Update existing records, matching them by `$this->data['column_name']`
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new PanelBoxValidation();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your panel box validation 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;
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,12 @@ class PanelGrMasterImporter extends Importer
|
||||
->example('154564564')
|
||||
->label('Supplier Number')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('inspection_lot_number')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Inspection Lot Number')
|
||||
->example('154564564')
|
||||
->label('Inspection Lot Number')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('quantity')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Quantity')
|
||||
@@ -86,14 +92,21 @@ class PanelGrMasterImporter extends Importer
|
||||
$warnMsg[] = 'Document Number cannot be empty.';
|
||||
}
|
||||
|
||||
if (Str::length($this->data['invoice_number']) < 7 || ! ctype_alnum($this->data['invoice_number'])) {
|
||||
$warnMsg[] = 'Invalid invoice number found';
|
||||
}
|
||||
// if (Str::length($this->data['invoice_number']) < 7 || ! ctype_alnum($this->data['invoice_number'])) {
|
||||
// $warnMsg[] = 'Invalid invoice number found';
|
||||
// }
|
||||
|
||||
if (empty($this->data['supplier_number'])) {
|
||||
$warnMsg[] = 'Supplier Number cannot be empty.';
|
||||
}
|
||||
|
||||
if (empty($this->data['inspection_lot_number'])) {
|
||||
$warnMsg[] = 'Inspection Lot Number cannot be empty.';
|
||||
}
|
||||
if (!is_numeric($this->data['inspection_lot_number'])) {
|
||||
$warnMsg[] = 'Inspection Lot Number must be a valid number.';
|
||||
}
|
||||
|
||||
if (empty($this->data['quantity'])) {
|
||||
$warnMsg[] = 'Quantity cannot be empty.';
|
||||
}
|
||||
@@ -121,6 +134,7 @@ class PanelGrMasterImporter extends Importer
|
||||
'document_number' => $this->data['document_number'],
|
||||
'invoice_number' => $this->data['invoice_number'],
|
||||
'supplier_number' => $this->data['supplier_number'] ?? null,
|
||||
'inspection_lot_number' => $this->data['inspection_lot_number'] ?? null,
|
||||
],
|
||||
[
|
||||
'quantity' => $this->data['quantity'] ?? null,
|
||||
|
||||
325
app/Filament/Imports/StickerDetailImporter.php
Normal file
325
app/Filament/Imports/StickerDetailImporter.php
Normal file
@@ -0,0 +1,325 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\Plant;
|
||||
use App\Models\StickerDetail;
|
||||
use App\Models\StickerStructureDetail;
|
||||
use App\Models\User;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||
use Filament\Facades\Filament;
|
||||
|
||||
class StickerDetailImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = StickerDetail::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('sticker_structure_detail_id')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Sticker ID')
|
||||
->example('123456')
|
||||
->label('STICKER ID')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('design_element_type')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Design Element Type')
|
||||
->label('DESIGN ELEMENT TYPE')
|
||||
->example('Text/Shape/Image/QR'),
|
||||
ImportColumn::make('element_id')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Element ID')
|
||||
->label('ELEMENT ID')
|
||||
->example('001'),
|
||||
ImportColumn::make('element_type')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Element Type')
|
||||
->label('ELEMENT TYPE')
|
||||
->example('Static/Dynamic'),
|
||||
ImportColumn::make('characteristics_type')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Characteristics Type')
|
||||
->label('CHARACTERISTICS TYPE')
|
||||
->example('zmm_heading'),
|
||||
ImportColumn::make('string_value')
|
||||
->requiredMapping()
|
||||
->exampleHeader('String Value')
|
||||
->label('STRING VALUE')
|
||||
->example('1'),
|
||||
ImportColumn::make('string_font')
|
||||
->requiredMapping()
|
||||
->exampleHeader('String Font')
|
||||
->label('STRING FONT')
|
||||
->example('Arial'),
|
||||
ImportColumn::make('string_size')
|
||||
->requiredMapping()
|
||||
->exampleHeader('String Size')
|
||||
->label('STRING SIZE')
|
||||
->example('12'),
|
||||
ImportColumn::make('element_colour')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Element Colour')
|
||||
->label('ELEMENT COLOUR')
|
||||
->example('Black'),
|
||||
ImportColumn::make('string_align')
|
||||
->requiredMapping()
|
||||
->exampleHeader('String Align')
|
||||
->label('STRING ALIGN')
|
||||
->example('Left/Center/Right'),
|
||||
ImportColumn::make('string_x_value')
|
||||
->requiredMapping()
|
||||
->exampleHeader('String X Value')
|
||||
->label('STRING X VALUE')
|
||||
->example('10'),
|
||||
ImportColumn::make('string_y_value')
|
||||
->requiredMapping()
|
||||
->exampleHeader('String Y Value')
|
||||
->label('STRING Y VALUE')
|
||||
->example('20'),
|
||||
ImportColumn::make('shape_name')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Shape Name')
|
||||
->label('SHAPE NAME')
|
||||
->example('Line/Rectangle/CurvedRectangle'),
|
||||
ImportColumn::make('shape_pen_size')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Shape Pen Size')
|
||||
->label('SHAPE PEN SIZE')
|
||||
->example('0.3'),
|
||||
ImportColumn::make('curve_radius')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Curve Radius')
|
||||
->label('CURVE RADIUS')
|
||||
->example('3'),
|
||||
ImportColumn::make('shape_x1_value')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Shape X1 Value')
|
||||
->label('SHAPE X1 VALUE')
|
||||
->example('10'),
|
||||
ImportColumn::make('shape_y1_value')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Shape Y1 Value')
|
||||
->label('SHAPE Y1 VALUE')
|
||||
->example('20'),
|
||||
ImportColumn::make('shape_x2_value')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Shape X2 Value')
|
||||
->label('SHAPE X2 VALUE')
|
||||
->example('30'),
|
||||
ImportColumn::make('shape_y2_value')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Shape Y2 Value')
|
||||
->label('SHAPE Y2 VALUE')
|
||||
->example('40'),
|
||||
ImportColumn::make('image_x')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Image X')
|
||||
->label('IMAGE X')
|
||||
->example('15'),
|
||||
ImportColumn::make('image_y')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Image Y')
|
||||
->label('IMAGE Y')
|
||||
->example('25'),
|
||||
ImportColumn::make('image_width')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Image Width')
|
||||
->label('IMAGE WIDTH')
|
||||
->example('100'),
|
||||
ImportColumn::make('image_height')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Image Height')
|
||||
->label('IMAGE HEIGHT')
|
||||
->example('100'),
|
||||
ImportColumn::make('qr_value')
|
||||
->requiredMapping()
|
||||
->exampleHeader('QR Value')
|
||||
->label('QR VALUE')
|
||||
->example('246118|53246735267'),
|
||||
ImportColumn::make('qr_align')
|
||||
->requiredMapping()
|
||||
->exampleHeader('QR Align')
|
||||
->label('QR ALIGN')
|
||||
->example('Left/Center/Right'),
|
||||
ImportColumn::make('qr_size')
|
||||
->requiredMapping()
|
||||
->exampleHeader('QR Size')
|
||||
->label('QR SIZE')
|
||||
->example('10'),
|
||||
ImportColumn::make('qr_x_value')
|
||||
->requiredMapping()
|
||||
->exampleHeader('QR X Value')
|
||||
->label('QR X VALUE')
|
||||
->example('30'),
|
||||
ImportColumn::make('qr_y_value')
|
||||
->requiredMapping()
|
||||
->exampleHeader('QR Y Value')
|
||||
->label('QR Y VALUE')
|
||||
->example('40'),
|
||||
// ImportColumn::make('created_by')
|
||||
// ->requiredMapping()
|
||||
// ->exampleHeader('Created By')
|
||||
// ->label('CREATED BY')
|
||||
// ->example('RAW001234'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?StickerDetail
|
||||
{
|
||||
|
||||
$warnMsg = [];
|
||||
$createdBy = Filament::auth()->user()->name;
|
||||
$updatedBy = Filament::auth()->user()->name;
|
||||
|
||||
$sticker = $this->data['sticker_structure_detail_id'] ?? null;
|
||||
|
||||
$stickerCode = StickerStructureDetail::where('sticker_id', $sticker)->first();
|
||||
if (!$stickerCode) {
|
||||
$warnMsg[] = "Sticker Id not found in Sticker Structure Detail";
|
||||
}else{
|
||||
$stickerId = $stickerCode->id;
|
||||
}
|
||||
|
||||
if (!$stickerId || $stickerId == null || $stickerId == '') {
|
||||
$warnMsg[] = "Sticker Id not found in Sticker Structure Detail";
|
||||
}
|
||||
|
||||
$designType = strtolower($this->data['design_element_type'] ?? '');
|
||||
|
||||
$rules = [
|
||||
'text' => [
|
||||
'required' => ['string_x_value', 'string_y_value'],
|
||||
'allowed' => [
|
||||
'string_value',
|
||||
'string_font',
|
||||
'string_size',
|
||||
'string_align',
|
||||
'string_colour',
|
||||
'string_x_value',
|
||||
'string_y_value',
|
||||
],
|
||||
],
|
||||
|
||||
'image' => [
|
||||
'required' => ['image_x', 'image_y', 'image_width', 'image_height'],
|
||||
'allowed' => [
|
||||
'image_x',
|
||||
'image_y',
|
||||
'image_width',
|
||||
'image_height',
|
||||
],
|
||||
],
|
||||
|
||||
'shape' => [
|
||||
'required' => ['shape_name', 'shape_pen_size', 'shape_x1_value', 'shape_y1_value', 'shape_x2_value', 'shape_y2_value'],
|
||||
'allowed' => [
|
||||
'shape_name',
|
||||
'shape_pen_size',
|
||||
'curve_radius',
|
||||
'shape_x1_value',
|
||||
'shape_y1_value',
|
||||
'shape_x2_value',
|
||||
'shape_y2_value',
|
||||
],
|
||||
],
|
||||
|
||||
'qr' => [
|
||||
'required' => ['qr_x_value', 'qr_y_value', 'qr_size'],
|
||||
'allowed' => [
|
||||
'qr_value',
|
||||
'qr_align',
|
||||
'qr_size',
|
||||
'qr_x_value',
|
||||
'qr_y_value',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
if (!isset($rules[$designType])) {
|
||||
$warnMsg[] = "Invalid Design Element Type: {$designType}";
|
||||
}
|
||||
|
||||
if (isset($rules[$designType])) {
|
||||
foreach ($rules[$designType]['required'] as $field) {
|
||||
if (empty($this->data[$field])) {
|
||||
$warnMsg[] = ucfirst($designType) . " requires {$field}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$allElementFields = [
|
||||
'string_value','string_font','string_size','string_align','string_colour',
|
||||
'string_x_value','string_y_value',
|
||||
'image_x','image_y','image_width','image_height',
|
||||
'shape_name','shape_pen_size','curve_radius',
|
||||
'shape_x1_value','shape_y1_value','shape_x2_value','shape_y2_value',
|
||||
'qr_value','qr_align','qr_size','qr_x_value','qr_y_value',
|
||||
];
|
||||
|
||||
if (isset($rules[$designType])) {
|
||||
$allowed = $rules[$designType]['allowed'];
|
||||
|
||||
foreach ($allElementFields as $field) {
|
||||
if (!in_array($field, $allowed, true) && !empty($this->data[$field])) {
|
||||
$warnMsg[] = "Field {$field} is not allowed for {$designType} element";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(' | ', $warnMsg));
|
||||
}
|
||||
|
||||
StickerDetail::Create([
|
||||
'sticker_structure_detail_id' => $stickerId,
|
||||
'design_element_type' => $this->data['design_element_type'],
|
||||
'element_id' => $this->data['element_id'],
|
||||
'element_type' => $this->data['element_type'],
|
||||
'characteristics_type' => $this->data['characteristics_type'],
|
||||
'string_value' => $this->data['string_value'],
|
||||
'string_font' => $this->data['string_font'],
|
||||
'string_size' => $this->data['string_size'],
|
||||
'element_colour' => $this->data['element_colour'],
|
||||
'string_align' => $this->data['string_align'],
|
||||
'string_x_value' => $this->data['string_x_value'],
|
||||
'string_y_value' => $this->data['string_y_value'],
|
||||
'shape_name' => $this->data['shape_name'],
|
||||
'shape_pen_size' => $this->data['shape_pen_size'],
|
||||
'curve_radius' => $this->data['curve_radius'],
|
||||
'shape_x1_value' => $this->data['shape_x1_value'],
|
||||
'shape_y1_value' => $this->data['shape_y1_value'],
|
||||
'shape_x2_value' => $this->data['shape_x2_value'],
|
||||
'shape_y2_value' => $this->data['shape_y2_value'],
|
||||
'image_x' => $this->data['image_x'],
|
||||
'image_y' => $this->data['image_y'],
|
||||
'image_width' => $this->data['image_width'],
|
||||
'image_height' => $this->data['image_height'],
|
||||
'qr_value' => $this->data['qr_value'],
|
||||
'qr_align' => $this->data['qr_align'],
|
||||
'qr_size' => $this->data['qr_size'],
|
||||
'qr_x_value' => $this->data['qr_x_value'],
|
||||
'qr_y_value' => $this->data['qr_y_value'],
|
||||
'created_by' => $createdBy,
|
||||
'updated_by' => $updatedBy,
|
||||
]);
|
||||
|
||||
return null;
|
||||
|
||||
//return new StickerDetail();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your sticker detail 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;
|
||||
}
|
||||
}
|
||||
55
app/Filament/Imports/StickerMappingMasterImporter.php
Normal file
55
app/Filament/Imports/StickerMappingMasterImporter.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\StickerMappingMaster;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
|
||||
class StickerMappingMasterImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = StickerMappingMaster::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('plant_id')
|
||||
->requiredMapping()
|
||||
->numeric()
|
||||
->rules(['required', 'integer']),
|
||||
ImportColumn::make('item')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('sticker1'),
|
||||
ImportColumn::make('sticker2'),
|
||||
ImportColumn::make('sticker3'),
|
||||
ImportColumn::make('sticker4'),
|
||||
ImportColumn::make('sticker5'),
|
||||
ImportColumn::make('created_by'),
|
||||
ImportColumn::make('updated_by'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?StickerMappingMaster
|
||||
{
|
||||
// return StickerMappingMaster::firstOrNew([
|
||||
// // Update existing records, matching them by `$this->data['column_name']`
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new StickerMappingMaster();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your sticker mapping master import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
||||
|
||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
49
app/Filament/Imports/StickerStructureDetailImporter.php
Normal file
49
app/Filament/Imports/StickerStructureDetailImporter.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\StickerStructureDetail;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
|
||||
class StickerStructureDetailImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = StickerStructureDetail::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('sticker_id'),
|
||||
ImportColumn::make('sticker_width'),
|
||||
ImportColumn::make('sticker_height'),
|
||||
ImportColumn::make('sticker_lmargin'),
|
||||
ImportColumn::make('sticker_rmargin'),
|
||||
ImportColumn::make('sticker_tmargin'),
|
||||
ImportColumn::make('sticker_bmargin'),
|
||||
ImportColumn::make('created_by'),
|
||||
ImportColumn::make('updated_by'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?StickerStructureDetail
|
||||
{
|
||||
// return StickerStructureDetail::firstOrNew([
|
||||
// // Update existing records, matching them by `$this->data['column_name']`
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new StickerStructureDetail();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your sticker structure detail 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;
|
||||
}
|
||||
}
|
||||
440
app/Filament/Pages/StickerPrint.php
Normal file
440
app/Filament/Pages/StickerPrint.php
Normal file
@@ -0,0 +1,440 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Models\Item;
|
||||
use App\Models\ItemCharacteristic;
|
||||
use App\Models\Machine;
|
||||
use App\Models\Plant;
|
||||
use App\Models\ProductionOrder;
|
||||
use App\Models\StickerDetail;
|
||||
use App\Models\StickerMappingMaster;
|
||||
use App\Models\StickerStructureDetail;
|
||||
use App\Models\StickerValidation;
|
||||
use App\Services\StickerPdfService;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Forms\Contracts\HasForms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class StickerPrint extends Page implements HasForms
|
||||
{
|
||||
protected static ?string $navigationIcon = 'heroicon-o-document-text';
|
||||
|
||||
protected static string $view = 'filament.pages.sticker-print';
|
||||
|
||||
protected static ?string $navigationGroup = 'Customized Sticker Printing';
|
||||
|
||||
public array $filters = [];
|
||||
|
||||
public $serNo;
|
||||
|
||||
public $ref_number;
|
||||
|
||||
//public $workCenter;
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->statePath('filters')
|
||||
->schema([
|
||||
Section::make('')
|
||||
->schema([
|
||||
Select::make('plant_id')
|
||||
->label('Plant')
|
||||
->reactive()
|
||||
->options(function(){
|
||||
|
||||
$plantId = Filament::auth()->user()->plant_id;
|
||||
|
||||
return $plantId
|
||||
? Plant::where('id',$plantId)
|
||||
->pluck('name','id')
|
||||
: Plant::pluck('name','id');
|
||||
|
||||
})
|
||||
->required(),
|
||||
Select::make('machine_id')
|
||||
->label('Work Center')
|
||||
->reactive()
|
||||
->options(function(callable $get){
|
||||
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||
|
||||
})
|
||||
->required(),
|
||||
TextInput::make('production_order')
|
||||
->label('Production Order')
|
||||
->reactive()
|
||||
->required(),
|
||||
TextInput::make('serial_number')
|
||||
->label('Serial Number')
|
||||
->reactive()
|
||||
->extraAttributes([
|
||||
'wire:keydown.enter' => 'processSnoNo($event.target.value)',
|
||||
]),
|
||||
])
|
||||
->columns(4),
|
||||
]);
|
||||
}
|
||||
|
||||
public function processSnoNo($qrcode)
|
||||
{
|
||||
|
||||
$parts = explode('|', $qrcode, 2);
|
||||
|
||||
$itemCode = $parts[0] ?? null;
|
||||
$serialNumber = $parts[1] ?? null;
|
||||
|
||||
$plantId = $this->form->getState()['plant_id'];
|
||||
|
||||
$plantId = trim($plantId) ?? null;
|
||||
|
||||
$workCenter = $this->form->getState()['machine_id'];
|
||||
|
||||
$prodOrderNo= $this->form->getState()['production_order'];
|
||||
|
||||
$prodOrderNo = trim($prodOrderNo) ?? null;
|
||||
|
||||
|
||||
if (!$qrcode || !preg_match('/^\d+\|\d+$/', $qrcode)) {
|
||||
Notification::make()
|
||||
->title('Invalid QR Code')
|
||||
->body('QR code format should be like: 123456|12456456464')
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'machine_id' => $workCenter,
|
||||
'production_order' => $prodOrderNo,
|
||||
'serial_number' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
elseif (!preg_match('/^[A-Za-z0-9]+$/', $itemCode)) {
|
||||
Notification::make()
|
||||
->title('Invalid Item Code')
|
||||
->body('Item code should contain only alpha-numeric values.')
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'machine_id' => $workCenter,
|
||||
'production_order' => $prodOrderNo,
|
||||
'serial_number' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
elseif (!preg_match('/^[A-Za-z0-9]+$/', $serialNumber)) {
|
||||
Notification::make()
|
||||
->title('Invalid Serial Number')
|
||||
->body('Serial number should contain only alpha-numeric values.')
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'machine_id' => $workCenter,
|
||||
'production_order' => $prodOrderNo,
|
||||
'serial_number' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$plant = Plant::find($plantId);
|
||||
|
||||
$plantName = $plant ? $plant->name : null;
|
||||
|
||||
$pOrderExist = ProductionOrder::where('plant_id', $plantId)
|
||||
->where('production_order', $prodOrderNo)
|
||||
->first();
|
||||
|
||||
if(!$pOrderExist){
|
||||
Notification::make()
|
||||
->title('Unknown Production Order')
|
||||
->body("Production Order not found against plant '$plantName'.")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'machine_id' => $workCenter,
|
||||
'production_order' => $prodOrderNo,
|
||||
'serial_number' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$itemExist = Item::where('code', $itemCode)->first();
|
||||
|
||||
$itemAgaPlant = Item::where('code', $itemCode)->where('plant_id', $plantId)->first();
|
||||
|
||||
if(!$itemExist){
|
||||
Notification::make()
|
||||
->title('Unknown Item Code')
|
||||
->body("Item code '$itemCode' not found.")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'machine_id' => $workCenter,
|
||||
'production_order' => $prodOrderNo,
|
||||
'serial_number' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
elseif(!$itemAgaPlant){
|
||||
Notification::make()
|
||||
->title('Unknown Item Code')
|
||||
->body("Item code '$itemCode' not found against the the plant '$plantName'.")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'machine_id' => $workCenter,
|
||||
'production_order' => $prodOrderNo,
|
||||
'serial_number' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
elseif ($itemAgaPlant->id != $pOrderExist->item_id) {
|
||||
Notification::make()
|
||||
->title('Item Code Mismatch')
|
||||
->body("Item code '$itemCode' does not match the item associated with production order '$prodOrderNo'.")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'machine_id' => $workCenter,
|
||||
'production_order' => $prodOrderNo,
|
||||
'serial_number' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$productionOrders = ProductionOrder::where('plant_id', $plantId)
|
||||
->where('production_order', $prodOrderNo)
|
||||
->where('item_id', $itemAgaPlant->id)
|
||||
->get();
|
||||
|
||||
$serialExist = null;
|
||||
|
||||
foreach ($productionOrders as $productionOrder) {
|
||||
|
||||
for (
|
||||
$serial = (int) $productionOrder->from_serial_number;
|
||||
$serial <= (int) $productionOrder->to_serial_number;
|
||||
$serial++
|
||||
) {
|
||||
if ($serial == (int) $serialNumber) {
|
||||
$serialExist = $productionOrder;
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!$serialExist){
|
||||
Notification::make()
|
||||
->title('Serial Number Not Found')
|
||||
->body("Serial number '$serialNumber' not found for production order '$prodOrderNo', item '$itemCode' and plant '$plantName'.")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'machine_id' => $workCenter,
|
||||
'production_order' => $prodOrderNo,
|
||||
'serial_number' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//..Generate Sticker PDF and download it
|
||||
|
||||
$this->ref_number = $this->form->getState()['production_order'];
|
||||
|
||||
$this->serNo = $serialNumber;
|
||||
|
||||
$user = Filament::auth()->user();
|
||||
|
||||
$operatorName = $user->name;
|
||||
|
||||
$duplicate = StickerValidation::where('plant_id', $plantId)
|
||||
->where('production_order', $this->ref_number)
|
||||
->where('serial_number', $serialNumber)
|
||||
->first();
|
||||
|
||||
if ($duplicate) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Duplicate Serial Number')
|
||||
->body("Serial number $serialNumber already exists for this plant and production order!")
|
||||
->seconds(3)
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'machine_id' => $workCenter,
|
||||
'production_order' => $this->ref_number,
|
||||
'serial_number' => null,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$itemC = Item::where('code', $itemCode)
|
||||
->where('plant_id',$plantId)
|
||||
->first();
|
||||
|
||||
$itemId = $itemC->id;
|
||||
|
||||
$item = ItemCharacteristic::where('item_id', $itemId)
|
||||
->where('plant_id',$plantId)
|
||||
->first();
|
||||
|
||||
$itemI = $item->id;
|
||||
|
||||
$mapping = StickerMappingMaster::where('plant_id', $plantId)
|
||||
->where('sticker1_machine_id', $workCenter)
|
||||
->where('item_characteristic_id', $itemI)
|
||||
->first();
|
||||
|
||||
if (!$mapping) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Sticker Mapping Not Found')
|
||||
->body("No sticker mapping found for this item and plant.")
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
|
||||
$stickers = [];
|
||||
|
||||
for ($i = 1; $i <= 8; $i++) {
|
||||
$machineColumn = "sticker{$i}_machine_id";
|
||||
$ipColumn = "sticker{$i}_print_ip";
|
||||
$stickerColumn = "sticker_structure{$i}_id";
|
||||
$itemColumn = "item_characteristic_id";
|
||||
|
||||
if (
|
||||
!empty($mapping->$machineColumn) &&
|
||||
!empty($mapping->$stickerColumn)
|
||||
) {
|
||||
$stickers[] = [
|
||||
'machine_id' => $mapping->$machineColumn,
|
||||
'sticker_id' => $mapping->$stickerColumn,
|
||||
'item_characteristic' => $mapping->$itemColumn,
|
||||
'print_ip' => $mapping->$ipColumn,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($stickers)) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('No Sticker Configuration Found')
|
||||
->body('No sticker and machine mappings configured for this item and plant.')
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
StickerValidation::create([
|
||||
'plant_id' => $plantId,
|
||||
'machine_id' => $workCenter,
|
||||
'production_order' => $this->ref_number ?? null,
|
||||
'serial_number' => $serialNumber,
|
||||
'status' => 'Printed',
|
||||
// 'sticker_id' => $matchedSticker,
|
||||
'created_by' => $operatorName,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
Notification::make()
|
||||
->success()
|
||||
->title('Sticker Recorded')
|
||||
->body("Item: $itemCode, Serial: $serialNumber recorded successfully!")
|
||||
->seconds(3)
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'machine_id' => $workCenter,
|
||||
'production_order' => $this->ref_number,
|
||||
'serial_number' => null,
|
||||
]);
|
||||
|
||||
$pdfUrls = [];
|
||||
|
||||
foreach ($stickers as $sticker)
|
||||
{
|
||||
|
||||
$structure = StickerStructureDetail::findOrFail($sticker['sticker_id']);
|
||||
|
||||
$itemCharacteristic = ItemCharacteristic::where('plant_id', $plantId)
|
||||
->where('id', $sticker['item_characteristic'])
|
||||
->firstOrFail();
|
||||
|
||||
$dynamicElements = StickerDetail::where(
|
||||
'sticker_structure_detail_id',
|
||||
$structure->id
|
||||
)->where('element_type', 'Dynamic')->get();
|
||||
|
||||
$pdfContent = (new StickerPdfService())->generatePdf1(
|
||||
$structure->sticker_id,
|
||||
$dynamicElements,
|
||||
$itemCharacteristic,
|
||||
$serialNumber,
|
||||
$itemCode,
|
||||
$plantId
|
||||
);
|
||||
|
||||
$tempPdfPath = storage_path('app/temp_sticker_' . uniqid() . '.pdf');
|
||||
|
||||
file_put_contents($tempPdfPath, $pdfContent);
|
||||
|
||||
// $pdfUrl = route('sticker.preview', [
|
||||
// 'path' => basename($tempPdfPath),
|
||||
// ]);
|
||||
$pdfUrls[] = route('sticker.preview', ['path' => basename($tempPdfPath)]);
|
||||
}
|
||||
|
||||
$this->dispatch('open-sticker-pdf', urls: $pdfUrls);
|
||||
|
||||
Notification::make()
|
||||
->success()
|
||||
->title('Sticker Printed')
|
||||
->body("Sticker for Serial Number: $serialNumber printed successfully!")
|
||||
->seconds(3)
|
||||
->send();
|
||||
}
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return Auth::check() && Auth::user()->can('view sticker print page');
|
||||
}
|
||||
}
|
||||
240
app/Filament/Pages/StickerStructurePreviewPage.php
Normal file
240
app/Filament/Pages/StickerStructurePreviewPage.php
Normal file
@@ -0,0 +1,240 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Models\Item;
|
||||
use App\Models\ItemCharacteristic;
|
||||
use App\Models\Plant;
|
||||
use App\Models\StickerDetail;
|
||||
use App\Models\StickerStructureDetail;
|
||||
use App\Services\StickerPdfService;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\ViewField;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Pages\Dashboard\Concerns\HasFiltersForm;
|
||||
use Filament\Pages\Page;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class StickerStructurePreviewPage extends Page
|
||||
{
|
||||
use HasFiltersForm;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-document-text';
|
||||
|
||||
protected static string $view = 'filament.pages.sticker-structure-preview-page';
|
||||
|
||||
protected static ?string $navigationGroup = 'Customized Sticker Printing';
|
||||
|
||||
public $stickerId;
|
||||
|
||||
public $plantId;
|
||||
|
||||
public $itemId;
|
||||
|
||||
public ?string $pdfPreview = null;
|
||||
|
||||
// public array $filters = [];
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
session()->forget(['stick_id', 'selected_plant', 'selected_item']);
|
||||
$this->form->fill([
|
||||
'sticker_id' => null,
|
||||
'plant' => null,
|
||||
'item' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->statePath('filters') // Store form state in 'filters'
|
||||
->schema([
|
||||
Section::make('')
|
||||
->schema([
|
||||
Select::make('sticker_id')
|
||||
->label('Sticker ID')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
|
||||
return StickerStructureDetail::orderByDesc('id')->pluck('sticker_id', 'sticker_id')->toArray();
|
||||
})
|
||||
->afterStateUpdated(callback: function ($state, callable $set) {
|
||||
session(['stick_id' => $state]);
|
||||
$set('plant', null);
|
||||
$set('item', null);
|
||||
$this->pdfPreview = null;
|
||||
})
|
||||
->searchable()
|
||||
->reactive()
|
||||
->required(),
|
||||
Select::make('plant')
|
||||
->label('Select Plant')
|
||||
->reactive()
|
||||
// ->options(Plant::pluck('name', 'id'))
|
||||
->options(function (callable $get) {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
session(['stick_id' => $state]);
|
||||
session(['selected_plant' => $state]);
|
||||
$set('item', null);
|
||||
session()->forget('item');
|
||||
$this->pdfPreview = null;
|
||||
}),
|
||||
Select::make('item')
|
||||
->label('Search by Item Code')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plant = $get('plant');
|
||||
|
||||
return $plant ? ItemCharacteristic::where('plant_id', $plant)->with('item')->get()->pluck('item.code', 'id')->toArray() : []; // ->orderBy('plant_id')
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
session(['stick_id' => $state]);
|
||||
session(['selected_plant' => $state]);
|
||||
session(['selected_item' => $state]);
|
||||
$this->pdfPreview = null;
|
||||
// $set('item_id', null);
|
||||
// session()->forget('item');
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
// ViewField::make('generate_template')
|
||||
// ->view('fields.generate-template-preview')
|
||||
// ->reactive()
|
||||
// // ->key(fn ($get) => 'generate-template' . ($get('sticker_id_live') ?? 'empty'))
|
||||
// ->key(fn (Get $get) => 'generate-template-'.
|
||||
// ($get('sticker_id') ?? 'empty').'-'.
|
||||
// ($get('plant') ?? 'empty').'-'.
|
||||
// ($get('item_characteristic_id') ?? 'empty')
|
||||
// )
|
||||
// // ->viewData(fn (Get $get) => [
|
||||
// // 'sticker_id' => $get('sticker_id_live') ?? 'empty',
|
||||
// // ]),
|
||||
// ->viewData(fn (Get $get) => [
|
||||
// 'sticker_id' => $get('sticker_id') ?? 'empty',
|
||||
// 'plant_id' => $get('plant') ?? 'empty',
|
||||
// 'item_characteristic_id' => $get('item') ?? 'empty',
|
||||
// ])
|
||||
// ->hidden(fn (callable $get) => ($get('sticker_id') == null || $get('sticker_id') == '0' || empty($get('sticker_id'))) || (($get('plant') != null || $get('plant') != '') &&
|
||||
// ($get('item') == null || $get('item') == '' || empty($get('item'))))),
|
||||
])
|
||||
->columns(3),
|
||||
]);
|
||||
}
|
||||
|
||||
public function showPreview()
|
||||
{
|
||||
$state = $this->form->getState();
|
||||
$stickerId = trim($state['sticker_id'] ?? '') ?: null;
|
||||
// $stickerId = $this->form->getState()['sticker_id'];
|
||||
// $stickerId = trim($stickerId) ?? null;
|
||||
$this->stickerId = $stickerId;
|
||||
|
||||
$plantId = trim($state['plant'] ?? '') ?: null;
|
||||
// $plantId = $this->form->getState()['plant'];
|
||||
// $plantId = trim($plantId) ?? null;
|
||||
$this->plantId = $plantId;
|
||||
|
||||
$itemId = trim($state['item'] ?? '') ?: null;
|
||||
// $itemId = $this->form->getState()['item'];
|
||||
// $itemId = trim($itemId) ?? null;
|
||||
$this->itemId = $itemId;
|
||||
|
||||
$this->pdfPreview = null;
|
||||
|
||||
// $operatorName = Filament::auth()->user()->name;
|
||||
|
||||
if (! $stickerId) {
|
||||
Notification::make()->title('Please select a Sticker ID first!')->danger()->duration(2000)->send();
|
||||
|
||||
$this->form->fill([
|
||||
'sticker_id' => $stickerId ?? null,
|
||||
'plant' => $plantId ?? null,
|
||||
'item' => $itemId ?? null,
|
||||
]);
|
||||
|
||||
return;
|
||||
} elseif ($plantId && ! $itemId) {
|
||||
Notification::make()->title('Please select an Item Code!')->danger()->duration(2000)->send();
|
||||
|
||||
$this->form->fill([
|
||||
'sticker_id' => $stickerId,
|
||||
'plant' => $plantId ?? null,
|
||||
'item' => $itemId ?? null,
|
||||
]);
|
||||
|
||||
return;
|
||||
} elseif ($stickerId && $plantId && $itemId != null && $itemId != '') {
|
||||
|
||||
$itemCharacteristic = $itemId ? ItemCharacteristic::find($itemId) : null;
|
||||
|
||||
$structure = StickerStructureDetail::where('sticker_id', $stickerId)->first();
|
||||
if (! $structure) {
|
||||
Notification::make()->title('Sticker structure not found!')->danger()->send();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$dynamicElements = StickerDetail::where('sticker_structure_detail_id', $structure->id)->get();
|
||||
|
||||
try {
|
||||
$stickerPdfService = new StickerPdfService;
|
||||
$this->pdfPreview = $stickerPdfService->generateStickerItem($stickerId, $dynamicElements, $itemCharacteristic);
|
||||
|
||||
Notification::make()
|
||||
->title('Sticker Preview Generated!')
|
||||
->success()
|
||||
->duration(2000)
|
||||
->send();
|
||||
} catch (\Exception $e) {
|
||||
Notification::make()
|
||||
->title('Error generating sticker preview!')
|
||||
->body($e->getMessage())
|
||||
->danger()
|
||||
->send();
|
||||
}
|
||||
} else {
|
||||
$elements = StickerStructureDetail::where('sticker_id', $stickerId)->first();
|
||||
|
||||
try {
|
||||
$stickerPdfService = new StickerPdfService;
|
||||
$this->pdfPreview = $stickerPdfService->generateSticker($stickerId, $elements->toArray());
|
||||
|
||||
Notification::make()
|
||||
->title('Sticker Preview Generated!')
|
||||
->success()
|
||||
->duration(2000)
|
||||
->send();
|
||||
} catch (\Exception $e) {
|
||||
Notification::make()
|
||||
->title('Error generating sticker preview!')
|
||||
->body($e->getMessage())
|
||||
->danger()
|
||||
->send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return 'Sticker Structure Preview';
|
||||
}
|
||||
|
||||
public function getHeading(): string
|
||||
{
|
||||
return 'Sticker Structure Preview';
|
||||
}
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return Auth::check() && Auth::user()->can('view sticker structure preview');
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ use App\Filament\Resources\AlertMailRuleResource\Pages;
|
||||
use App\Models\AlertMailRule;
|
||||
use App\Models\InvoiceMaster;
|
||||
use App\Models\Plant;
|
||||
use App\Models\Machine;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Actions\Action;
|
||||
@@ -49,6 +50,25 @@ class AlertMailRuleResource extends Resource
|
||||
->required(fn ($get) => ! $get('is_active'))
|
||||
->afterStateUpdated(fn ($state, callable $set) => $state ? $set('is_active', false) : null),
|
||||
// ->options(fn () => Plant::pluck('id', 'name')->toArray()),
|
||||
Forms\Components\Select::make('machine_id')
|
||||
->label('Work Center')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant');
|
||||
|
||||
if (!$plantId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Machine::where('plant_id', $plantId)
|
||||
->whereNotNull('work_center')
|
||||
->pluck('work_center', 'id')
|
||||
->toArray();
|
||||
})
|
||||
->searchable()
|
||||
->reactive()
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('module', null);
|
||||
}),
|
||||
Forms\Components\Select::make('module')
|
||||
->label('Module')
|
||||
->required()
|
||||
@@ -60,7 +80,8 @@ class AlertMailRuleResource extends Resource
|
||||
'InvoiceTransit' => 'InvoiceTransit',
|
||||
'ImportTransit' => 'ImportTransit',
|
||||
'VehicleReport' => 'VehicleReport',
|
||||
'ExportDispatchReport' => 'ExportDispatchReport'
|
||||
'ExportDispatchReport' => 'ExportDispatchReport',
|
||||
'LaserStopReport' => 'LaserStopReport'
|
||||
]),
|
||||
Forms\Components\Select::make('rule_name')
|
||||
->label('Rule Name')
|
||||
@@ -74,7 +95,8 @@ class AlertMailRuleResource extends Resource
|
||||
'InvoiceTransitMail' => 'Invoice Transit Mail',
|
||||
'ImportTransitMail' => 'Import Transit Mail',
|
||||
'VehicleReportMail' => 'Vehicle Report Mail',
|
||||
'ExportDispatchReportMail' => 'Export Dispatch Report Mail'
|
||||
'ExportDispatchReportMail' => 'Export Dispatch Report Mail',
|
||||
'LaserStopMail' => 'Laser Stop Mail'
|
||||
])
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('email')
|
||||
@@ -185,6 +207,11 @@ class AlertMailRuleResource extends Resource
|
||||
|
||||
return $plants[$state] ?? 'All Plants';
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('machine.work_center')
|
||||
->label('Work Center')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('module')
|
||||
->label('Module Name')
|
||||
->alignCenter()
|
||||
@@ -195,14 +222,14 @@ class AlertMailRuleResource extends Resource
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('invoiceMaster.receiving_plant_name')
|
||||
->label('Receiving Plant')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('invoiceMaster.transport_name')
|
||||
->label('Transporter')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
// Tables\Columns\TextColumn::make('invoiceMaster.receiving_plant_name')
|
||||
// ->label('Receiving Plant')
|
||||
// ->alignCenter()
|
||||
// ->sortable(),
|
||||
// Tables\Columns\TextColumn::make('invoiceMaster.transport_name')
|
||||
// ->label('Transporter')
|
||||
// ->alignCenter()
|
||||
// ->sortable(),
|
||||
Tables\Columns\TextColumn::make('email')
|
||||
->label('TO Emails')
|
||||
->searchable()
|
||||
|
||||
736
app/Filament/Resources/BeforeTestReadingResource.php
Normal file
736
app/Filament/Resources/BeforeTestReadingResource.php
Normal file
@@ -0,0 +1,736 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\BeforeTestReadingExporter;
|
||||
use App\Filament\Resources\BeforeTestReadingResource\Pages;
|
||||
use App\Models\BeforeTestReading;
|
||||
use App\Models\Configuration;
|
||||
use App\Models\Item;
|
||||
use App\Models\Line;
|
||||
use App\Models\Machine;
|
||||
use App\Models\MotorTestingMaster;
|
||||
use App\Models\Plant;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class BeforeTestReadingResource extends Resource
|
||||
{
|
||||
protected static ?string $model = BeforeTestReading::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Motor Testing Panel';
|
||||
|
||||
protected static ?int $navigationSort = 5;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Section::make('')
|
||||
->schema([
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->label('Plant Name')
|
||||
->relationship('plant', 'name')
|
||||
->columnSpan(1) // (['default' => 1, 'sm' => 2])
|
||||
->searchable()
|
||||
->required()
|
||||
->reactive()
|
||||
->options(function (callable $get) {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||
})
|
||||
->default(function () {
|
||||
return optional(BeforeTestReading::latest()->first())->plant_id ?? null;
|
||||
})
|
||||
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (! $plantId) {
|
||||
$set('line_id', null);
|
||||
$set('motor_testing_master_id', null);
|
||||
$set('machine_id', null);
|
||||
$set('tPrError', 'Please select a plant first.');
|
||||
|
||||
return;
|
||||
} else {
|
||||
$set('line_id', null);
|
||||
$set('motor_testing_master_id', null);
|
||||
$set('machine_id', null);
|
||||
$set('tPrError', null);
|
||||
}
|
||||
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->extraAttributes(fn ($get) => [
|
||||
'class' => $get('tPrError') ? 'border-red-500' : '',
|
||||
])
|
||||
->hint(fn ($get) => $get('tPrError') ? $get('tPrError') : null)
|
||||
->hintColor('danger'),
|
||||
Forms\Components\Select::make('line_id')
|
||||
->label('Line Name')
|
||||
// ->relationship('line', 'name')
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (! $plantId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Line::where('plant_id', $plantId)
|
||||
->pluck('name', 'id')
|
||||
->toArray();
|
||||
})
|
||||
->default(function () {
|
||||
return optional(BeforeTestReading::latest()->first())->line_id ?? null;
|
||||
})
|
||||
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||
->required()
|
||||
->reactive()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('motor_testing_master_id', null);
|
||||
$set('machine_id', null);
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\Select::make('machine_id')
|
||||
->label('Work Center')
|
||||
// ->relationship('machine', 'work_center')
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$lineId = $get('line_id');
|
||||
if (! $lineId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Only show machines for the selected line
|
||||
return Machine::where('line_id', $lineId)
|
||||
->pluck('work_center', 'id')
|
||||
->toArray();
|
||||
})
|
||||
->default(function () {
|
||||
return optional(BeforeTestReading::latest()->first())->machine_id ?? null;
|
||||
})
|
||||
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||
->required()
|
||||
->reactive()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\Select::make('motor_testing_master_id')
|
||||
->label('Item Code')
|
||||
// ->relationship('motorTestingMaster', 'item.code')
|
||||
// ->options(function (callable $get) {
|
||||
// $plantId = $get('plant_id');
|
||||
// if (!$plantId) {
|
||||
// return [];
|
||||
// }
|
||||
// return MotorTestingMaster::with('item')
|
||||
// ->where('plant_id', $plantId)
|
||||
// ->get()
|
||||
// //->filter(fn ($mtm) => $mtm->item)
|
||||
// ->pluck('item.code', 'id')
|
||||
// ->toArray();
|
||||
// })
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (! $plantId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return MotorTestingMaster::query()
|
||||
->join('items', 'motor_testing_masters.item_id', '=', 'items.id')
|
||||
->where('motor_testing_masters.plant_id', $plantId)
|
||||
->select('motor_testing_masters.id', 'items.code')
|
||||
->pluck('items.code', 'motor_testing_masters.id')
|
||||
->toArray();
|
||||
})
|
||||
// ->getOptionLabelUsing(fn ($value) =>
|
||||
// MotorTestingMaster::with('item')->find($value)?->item?->code
|
||||
// )
|
||||
->required()
|
||||
->searchable()
|
||||
->reactive()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('serial_number')
|
||||
->label('Serial Number')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('before_fr_res_ry')
|
||||
->label('Before FR Resistance RY')
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('before_fr_res_yb')
|
||||
->label('Before FR Resistance YB')
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('before_fr_res_br')
|
||||
->label('Before FR Resistance BR')
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('before_fr_ir')
|
||||
->label('Before FR IR')
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('tested_by')
|
||||
->default(fn () => Filament::auth()->user()?->name)
|
||||
->readOnly()
|
||||
->required(),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->default(fn () => Filament::auth()->user()?->name)
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('id')
|
||||
->hidden()
|
||||
->readOnly(),
|
||||
])
|
||||
->columns(['default' => 1, 'sm' => 2]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
// Tables\Columns\TextColumn::make('id')
|
||||
// ->label('ID')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant Name')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('line.name')
|
||||
->label('Line Name')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('machine.work_center')
|
||||
->label('Work Center')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('motorTestingMaster.item.code')
|
||||
->label('Item Code')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('motorTestingMaster.subassembly_code')
|
||||
->label('Subassembly Code')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('motorTestingMaster.item.description')
|
||||
->label('Model')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('serial_number')
|
||||
->label('Serial Number')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('motorTestingMaster.kw')
|
||||
->label('KW')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('motorTestingMaster.hp')
|
||||
->label('HP')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('motorTestingMaster.phase')
|
||||
->label('Phase')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('motorTestingMaster.connection')
|
||||
->label('Connection')
|
||||
->alignCenter(),
|
||||
Tables\Columns\IconColumn::make('motorTestingMaster.isi_model')
|
||||
->label('ISI Model')
|
||||
->alignCenter()
|
||||
->boolean(),
|
||||
Tables\Columns\TextColumn::make('before_fr_res_ry')
|
||||
->label('Before FR Resistance RY')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('before_fr_res_yb')
|
||||
->label('Before FR Resistance YB')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('before_fr_res_br')
|
||||
->label('Before FR Resistance BR')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('before_fr_ir')
|
||||
->label('Before FR IR')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('scanned_at')
|
||||
->label('Scanned At')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->dateTime(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('tested_by')
|
||||
->label('Tested By')
|
||||
->alignCenter()
|
||||
->numeric(),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->dateTime(),
|
||||
Tables\Columns\TextColumn::make('updated_by')
|
||||
->label('Updated By')
|
||||
->alignCenter()
|
||||
->numeric(),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->dateTime()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
Filter::make('advanced_filters')
|
||||
->label('Advanced Filters')
|
||||
->form([
|
||||
Select::make('Plant')
|
||||
->label('Search by Plant Name')
|
||||
->searchable()
|
||||
->nullable()
|
||||
->options(function () {
|
||||
// return Plant::pluck('name', 'id');
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
if ($userHas && strlen($userHas) > 0) {
|
||||
return Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
|
||||
} else {
|
||||
return Plant::whereHas('beforeTestReadings', function ($query) {
|
||||
$query->whereNotNull('id');
|
||||
})->orderBy('code')->pluck('name', 'id');
|
||||
}
|
||||
|
||||
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('Line', null);
|
||||
$set('item_code', null);
|
||||
|
||||
}),
|
||||
Select::make('Line')
|
||||
->label('Search by Line Name')
|
||||
->searchable()
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
if (! $plantId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Line::where('plant_id', $plantId)
|
||||
->pluck('name', 'id')
|
||||
->toArray();
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('item_code', null);
|
||||
}),
|
||||
Select::make('machine_name')
|
||||
->label('Search by Work Center')
|
||||
->searchable()
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
$lineId = $get('Line');
|
||||
|
||||
if (! $plantId || ! $lineId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Machine::where('plant_id', $plantId)
|
||||
->where('line_id', $lineId)
|
||||
->pluck('work_center', 'id')
|
||||
->toArray();
|
||||
})
|
||||
->reactive(),
|
||||
Select::make('item_code')
|
||||
->label('Search by Item Code')
|
||||
->searchable()
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
if ($plantId) {
|
||||
return Item::where('plant_id', $plantId)
|
||||
->whereHas('motorTestingMasters')
|
||||
->pluck('code', 'id')
|
||||
->toArray();
|
||||
} else {
|
||||
return [];
|
||||
// return Item::whereHas('motorTestingMasters')
|
||||
// ->pluck('code', 'id')
|
||||
// ->toArray();
|
||||
}
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('item_description', null);
|
||||
}),
|
||||
TextInput::make('serial_number')
|
||||
->label('Serial Number')
|
||||
->reactive()
|
||||
->placeholder('Enter Serial Number'),
|
||||
Select::make('subassembly_code')
|
||||
->label('Search by Subassembly Code')
|
||||
->searchable()
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
if ($plantId) {
|
||||
return MotorTestingMaster::whereHas('beforeTestReadings', function ($query) {
|
||||
$query->whereNotNull('id');
|
||||
})->whereNotNull('subassembly_code')->orderBy('subassembly_code')->pluck('subassembly_code', 'id');
|
||||
} else {
|
||||
return [];
|
||||
// return Item::whereHas('motorTestingMasters')
|
||||
// ->pluck('code', 'id')
|
||||
// ->toArray();
|
||||
}
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('item_description', null);
|
||||
}),
|
||||
Select::make('item_description')
|
||||
->label('Search by Model')
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
|
||||
// $query = Item::query();
|
||||
// if ($plantId) {
|
||||
// $query->where('plant_id', $plantId);
|
||||
// }
|
||||
|
||||
$plantId = $get('Plant');
|
||||
if ($plantId) {
|
||||
return Item::where('plant_id', $plantId)
|
||||
->whereHas('motorTestingMasters')
|
||||
->pluck('description', 'id')
|
||||
->toArray();
|
||||
} else {
|
||||
return [];
|
||||
// return Item::whereHas('motorTestingMasters')
|
||||
// ->pluck('description', 'id')
|
||||
// ->toArray();
|
||||
}
|
||||
// return $query->pluck('description', 'description')->toArray();
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('item_code', null);
|
||||
}),
|
||||
Select::make('connection')
|
||||
->label('Connection')
|
||||
->required()
|
||||
->default('Star')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
if ($plantId) {
|
||||
return Configuration::where('plant_id', $plantId)
|
||||
->where('c_name', 'MOTOR_CONNECTION')
|
||||
->orderBy('created_at')
|
||||
->pluck('c_value', 'c_value')
|
||||
->toArray();
|
||||
} else {
|
||||
return Configuration::where('c_name', 'MOTOR_CONNECTION')
|
||||
->orderBy('created_at')
|
||||
->pluck('c_value', 'c_value')
|
||||
->toArray();
|
||||
}
|
||||
})
|
||||
->selectablePlaceholder(false)
|
||||
->reactive(),
|
||||
Select::make('tested_by')
|
||||
->label('Tested By')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
if (! $plantId) {
|
||||
return BeforeTestReading::whereNotNull('tested_by')->select('tested_by')->distinct()->pluck('tested_by', 'tested_by');
|
||||
} else {
|
||||
return BeforeTestReading::where('plant_id', $plantId)->whereNotNull('tested_by')->select('tested_by')->distinct()->pluck('tested_by', 'tested_by');
|
||||
}
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
DateTimePicker::make(name: 'created_from')
|
||||
->label('Created From')
|
||||
->placeholder(placeholder: 'Select From DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
DateTimePicker::make('created_to')
|
||||
->label('Created To')
|
||||
->placeholder(placeholder: 'Select To DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
Select::make('updated_by')
|
||||
->label('Updated By')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
if (! $plantId) {
|
||||
return BeforeTestReading::whereNotNull('updated_by')->select('updated_by')->distinct()->pluck('updated_by', 'updated_by');
|
||||
} else {
|
||||
return BeforeTestReading::where('plant_id', $plantId)->whereNotNull('updated_by')->select('updated_by')->distinct()->pluck('updated_by', 'updated_by');
|
||||
}
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
DateTimePicker::make(name: 'updated_from')
|
||||
->label('Updated From')
|
||||
->placeholder(placeholder: 'Select From DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
DateTimePicker::make('updated_to')
|
||||
->label('Updated To')
|
||||
->placeholder(placeholder: 'Select To DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
])
|
||||
->query(function ($query, array $data) {
|
||||
|
||||
// dd($data);
|
||||
// Hide all records initially if no filters are applied
|
||||
if (empty($data['Plant']) && empty($data['Line']) && empty($data['item_code']) && empty($data['subassembly_code']) && empty($data['machine_name']) && empty($data['item_description']) && empty($data['serial_number']) && empty($data['connection']) && empty($data['tested_by']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['updated_by']) && empty($data['updated_from']) && empty($data['updated_to'])) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
|
||||
// && empty($data['phase'])
|
||||
|
||||
if (! empty($data['Plant'])) {
|
||||
$query->where('plant_id', $data['Plant']);
|
||||
} else {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
if ($userHas && strlen($userHas) > 0) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($data['Line'])) {
|
||||
$query->where('line_id', $data['Line']);
|
||||
}
|
||||
|
||||
if (! empty($data['item_code'])) {
|
||||
// $query->where('item_id', $data['item_code']);
|
||||
$query->whereHas('motorTestingMaster', function ($subQuery) use ($data) {
|
||||
$subQuery->where('item_id', $data['item_code']);
|
||||
});
|
||||
}
|
||||
|
||||
if (! empty($data['subassembly_code'])) {
|
||||
$query->where('motor_testing_master_id', $data['subassembly_code']);
|
||||
}
|
||||
|
||||
if (! empty($data['machine_name'])) {
|
||||
$query->where('machine_id', $data['machine_name']);
|
||||
}
|
||||
|
||||
if (! empty($data['serial_number'])) {
|
||||
$query->where('serial_number', 'like', '%'.$data['serial_number'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['item_description'])) {
|
||||
$itemId = $data['item_description']; // Item::where('description', $data['item_description'])->first()?->id ?? null;
|
||||
|
||||
if ($itemId) { // $item
|
||||
$mastId = MotorTestingMaster::where('item_id', $itemId)->first()?->id ?? null;
|
||||
if ($mastId) { // $item
|
||||
$motId = BeforeTestReading::where('motor_testing_master_id', $mastId)->first()?->id ?? null;
|
||||
if ($motId) { // $item
|
||||
$query->where('motor_testing_master_id', $mastId);
|
||||
// $query->whereHas('motorTestingMaster', function ($subQuery) use ($itemId) {
|
||||
// $subQuery->where('item_id', $itemId); //$item->id
|
||||
// });
|
||||
} else {
|
||||
$query->whereRaw('1 = 0');
|
||||
}
|
||||
} else {
|
||||
$query->whereRaw('1 = 0');
|
||||
}
|
||||
} else {
|
||||
$query->whereRaw('1 = 0');
|
||||
}
|
||||
}
|
||||
|
||||
// if (!empty($data['phase']))
|
||||
// {
|
||||
// //$query->where('phase',$data['phase']);
|
||||
// $query->whereHas('motorTestingMaster', function ($subQuery) use ($data) {
|
||||
// $subQuery->where('phase', $data['phase']);
|
||||
// });
|
||||
// }
|
||||
|
||||
if (! empty($data['connection'])) {
|
||||
// $query->where('connection',$data['connection']);
|
||||
$query->whereHas('motorTestingMaster', function ($subQuery) use ($data) {
|
||||
$subQuery->where('connection', $data['connection']);
|
||||
});
|
||||
}
|
||||
|
||||
if (! empty($data['created_from'])) {
|
||||
$query->where('created_at', '>=', $data['created_from']);
|
||||
}
|
||||
|
||||
if (! empty($data['created_to'])) {
|
||||
$query->where('created_at', '<=', $data['created_to']);
|
||||
}
|
||||
|
||||
if (! empty($data['tested_by'])) {
|
||||
$query->where('tested_by', $data['tested_by']);
|
||||
}
|
||||
|
||||
if (! empty($data['updated_from'])) {
|
||||
$query->where('updated_at', '>=', $data['updated_from']);
|
||||
}
|
||||
|
||||
if (! empty($data['updated_to'])) {
|
||||
$query->where('updated_at', '<=', $data['updated_to']);
|
||||
}
|
||||
|
||||
if (! empty($data['updated_by'])) {
|
||||
$query->where('updated_by', $data['updated_by']);
|
||||
}
|
||||
})
|
||||
->indicateUsing(function (array $data) {
|
||||
$indicators = [];
|
||||
|
||||
if (! empty($data['Plant'])) {
|
||||
$indicators[] = 'Plant Name: '.Plant::where('id', $data['Plant'])->value('name');
|
||||
} else {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
if ($userHas && strlen($userHas) > 0) {
|
||||
return 'Plant: Choose plant to filter records.';
|
||||
}
|
||||
}
|
||||
if (! empty($data['Line'])) {
|
||||
$indicators[] = 'Line Name: '.Line::where('id', $data['Line'])->value('name');
|
||||
}
|
||||
if (! empty($data['machine_name'])) {
|
||||
$indicators[] = 'Work Center: '.Machine::where('id', $data['machine_name'])->value('work_center');
|
||||
}
|
||||
if (! empty($data['item_code'])) {
|
||||
$indicators[] = 'Item Code: '.Item::where('id', $data['item_code'])->value('code');
|
||||
}
|
||||
if (! empty($data['subassembly_code'])) {
|
||||
$indicators[] = 'Subassembly Code: '.MotorTestingMaster::where('id', $data['subassembly_code'])->value('subassembly_code');
|
||||
}
|
||||
if (! empty($data['item_description'])) {
|
||||
$item = Item::where('id', $data['item_description'])->first()?->description ?? null;
|
||||
$indicators[] = 'Model: '.$item;
|
||||
}
|
||||
// if (!empty($data['phase'])) {
|
||||
// $indicators[] = 'Phase: ' . $data['phase'];
|
||||
// }
|
||||
if (! empty($data['connection'])) {
|
||||
$indicators[] = 'Connection: '.$data['connection'];
|
||||
}
|
||||
|
||||
if (! empty($data['serial_number'])) {
|
||||
$indicators[] = 'Serial Number: '.$data['serial_number'];
|
||||
}
|
||||
|
||||
if (! empty($data['tested_by'])) {
|
||||
$indicators[] = 'Tested By: '.$data['tested_by'];
|
||||
}
|
||||
|
||||
if (! empty($data['created_from'])) {
|
||||
$indicators[] = 'Created From: '.$data['created_from'];
|
||||
}
|
||||
|
||||
if (! empty($data['created_to'])) {
|
||||
$indicators[] = 'Created To: '.$data['created_to'];
|
||||
}
|
||||
|
||||
if (! empty($data['updated_by'])) {
|
||||
$indicators[] = 'Updated By: '.$data['updated_by'];
|
||||
}
|
||||
|
||||
if (! empty($data['updated_from'])) {
|
||||
$indicators[] = 'Updated From: '.$data['updated_from'];
|
||||
}
|
||||
|
||||
if (! empty($data['updated_to'])) {
|
||||
$indicators[] = 'Updated To: '.$data['updated_to'];
|
||||
}
|
||||
|
||||
return $indicators;
|
||||
}),
|
||||
])
|
||||
->filtersFormMaxHeight('280px')
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
ExportAction::make()
|
||||
->label('Export Before Test Readings')
|
||||
->color('warning')
|
||||
->exporter(BeforeTestReadingExporter::class)
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view export before test reading');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListBeforeTestReadings::route('/'),
|
||||
'create' => Pages\CreateBeforeTestReading::route('/create'),
|
||||
'view' => Pages\ViewBeforeTestReading::route('/{record}'),
|
||||
'edit' => Pages\EditBeforeTestReading::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BeforeTestReadingResource\Pages;
|
||||
|
||||
use App\Filament\Resources\BeforeTestReadingResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateBeforeTestReading extends CreateRecord
|
||||
{
|
||||
protected static string $resource = BeforeTestReadingResource::class;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BeforeTestReadingResource\Pages;
|
||||
|
||||
use App\Filament\Resources\BeforeTestReadingResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditBeforeTestReading extends EditRecord
|
||||
{
|
||||
protected static string $resource = BeforeTestReadingResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BeforeTestReadingResource\Pages;
|
||||
|
||||
use App\Filament\Resources\BeforeTestReadingResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListBeforeTestReadings extends ListRecords
|
||||
{
|
||||
protected static string $resource = BeforeTestReadingResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BeforeTestReadingResource\Pages;
|
||||
|
||||
use App\Filament\Resources\BeforeTestReadingResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewBeforeTestReading extends ViewRecord
|
||||
{
|
||||
protected static string $resource = BeforeTestReadingResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
209
app/Filament/Resources/DealerVisitPlanResource.php
Normal file
209
app/Filament/Resources/DealerVisitPlanResource.php
Normal file
@@ -0,0 +1,209 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\DealerVisitPlanResource\Pages;
|
||||
use App\Filament\Resources\DealerVisitPlanResource\RelationManagers;
|
||||
use App\Models\DealerVisitPlan;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
use App\Filament\Exports\DealerVisitPlanExporter;
|
||||
use App\Filament\Imports\DealerVisitPlanImporter;
|
||||
|
||||
class DealerVisitPlanResource extends Resource
|
||||
{
|
||||
protected static ?string $model = DealerVisitPlan::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Gate Entry';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('organizer')
|
||||
->label('Organizer'),
|
||||
Forms\Components\TextInput::make('mobile_number')
|
||||
->label('Mobile Number'),
|
||||
Forms\Components\TextInput::make('name')
|
||||
->label('Dealer Name'),
|
||||
Forms\Components\TextInput::make('company')
|
||||
->label('Dealer Company'),
|
||||
Forms\Components\DatePicker::make('visit_plan_date')
|
||||
->label('Visit Plan Date'),
|
||||
Forms\Components\Select::make('employee_master_id')
|
||||
->label('Recipient Employee')
|
||||
->relationship('employeeMaster', 'name')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('number_of_person')
|
||||
->label('Number Of Person'),
|
||||
Forms\Components\TextInput::make('purpose_of_visit')
|
||||
->label('Purpose Of Visit'),
|
||||
Forms\Components\Select::make('mode_of_travel')
|
||||
->label('Mode Of Travel')
|
||||
->options([
|
||||
'Rental' => 'Rental',
|
||||
'Car' => 'Car',
|
||||
'Bike' => 'Bike',
|
||||
])
|
||||
->reactive()
|
||||
->placeholder('Select Mode of Travel'),
|
||||
Forms\Components\Select::make('status')
|
||||
->label('Status')
|
||||
->options([
|
||||
'Planned' => 'Planned',
|
||||
'Completed' => 'Completed',
|
||||
])
|
||||
->required(),
|
||||
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),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('name')
|
||||
->label('Dealer Name')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('company')
|
||||
->label('Dealer Company')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('visit_plan_date')
|
||||
->label('Visit Plan Date')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->date()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('organizer')
|
||||
->label('Organizer')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('mobile_number')
|
||||
->label('Mobile Number')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('employeeMaster.name')
|
||||
->label('Recipient Employee')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('number_of_person')
|
||||
->label('No of Person')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('purpose_of_visit')
|
||||
->label('Purpose of Visit')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('mode_of_travel')
|
||||
->label('Mode of travel')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('status')
|
||||
->label('Status')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->label('Import Dealer Visit Plan')
|
||||
->color('warning')
|
||||
->importer(DealerVisitPlanImporter::class)
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view import dealer visit plan');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->label('Export Dealer Visit Plan')
|
||||
->color('warning')
|
||||
->exporter(DealerVisitPlanExporter::class)
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view export dealer visit plan');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListDealerVisitPlans::route('/'),
|
||||
'create' => Pages\CreateDealerVisitPlan::route('/create'),
|
||||
'view' => Pages\ViewDealerVisitPlan::route('/{record}'),
|
||||
'edit' => Pages\EditDealerVisitPlan::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DealerVisitPlanResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DealerVisitPlanResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateDealerVisitPlan extends CreateRecord
|
||||
{
|
||||
protected static string $resource = DealerVisitPlanResource::class;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DealerVisitPlanResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DealerVisitPlanResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditDealerVisitPlan extends EditRecord
|
||||
{
|
||||
protected static string $resource = DealerVisitPlanResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DealerVisitPlanResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DealerVisitPlanResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListDealerVisitPlans extends ListRecords
|
||||
{
|
||||
protected static string $resource = DealerVisitPlanResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DealerVisitPlanResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DealerVisitPlanResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewDealerVisitPlan extends ViewRecord
|
||||
{
|
||||
protected static string $resource = DealerVisitPlanResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
1045
app/Filament/Resources/ItemCharacteristicResource.php
Normal file
1045
app/Filament/Resources/ItemCharacteristicResource.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ItemCharacteristicResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ItemCharacteristicResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateItemCharacteristic extends CreateRecord
|
||||
{
|
||||
protected static string $resource = ItemCharacteristicResource::class;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ItemCharacteristicResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ItemCharacteristicResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditItemCharacteristic extends EditRecord
|
||||
{
|
||||
protected static string $resource = ItemCharacteristicResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ItemCharacteristicResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ItemCharacteristicResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListItemCharacteristics extends ListRecords
|
||||
{
|
||||
protected static string $resource = ItemCharacteristicResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ItemCharacteristicResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ItemCharacteristicResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewItemCharacteristic extends ViewRecord
|
||||
{
|
||||
protected static string $resource = ItemCharacteristicResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -146,21 +146,22 @@ class OcrValidationResource extends Resource
|
||||
// $fullPath = storage_path('app/' . $storedPath);
|
||||
$fullPath = storage_path('app/private/'.$storedPath);
|
||||
$parser = new Parser;
|
||||
// $pdf = $parser->parseContent(file_get_contents($uploaded->getRealPath()));
|
||||
$pdf = $parser->parseContent(file_get_contents($uploaded->getRealPath()));
|
||||
$pdf = $parser->parseFile($fullPath);
|
||||
$text = $pdf->getText();
|
||||
|
||||
// dd($text);
|
||||
|
||||
// dd($text);
|
||||
$item1 = null;
|
||||
$item2 = null;
|
||||
|
||||
if (preg_match('/Item code\s*:\s*(\S+)/i', $text, $matches)) {
|
||||
$item1 = $matches[1];
|
||||
} elseif (preg_match('/E CODE\s*:\s*(\S+)/i', $text, $matches)) {
|
||||
$item2 = $matches[1];
|
||||
}
|
||||
// if (preg_match('/Item code\s*:\s*(\S+)/i', $text, $matches)) {
|
||||
// $item1 = $matches[1];
|
||||
// }
|
||||
// // elseif (preg_match('/E CODE\s*:\s*(\S+)/i', $text, $matches)) {
|
||||
// else if (preg_match('/(?:Item\s*code|E[-\s]*CODE)\s*:\s*(\S+)/i', $text, $matches)) {
|
||||
// $item2 = $matches[1];
|
||||
// }
|
||||
|
||||
// dd($item2);
|
||||
|
||||
$processOrder = $get('gr_number');
|
||||
|
||||
@@ -194,36 +195,45 @@ class OcrValidationResource extends Resource
|
||||
'local'
|
||||
);
|
||||
|
||||
if ($itemCode == $item1) {
|
||||
Notification::make()
|
||||
Notification::make()
|
||||
->title('Success')
|
||||
->body("Gr Number '$processOrder' PDF uploaded successfully.")
|
||||
->success()
|
||||
->send();
|
||||
|
||||
return;
|
||||
}
|
||||
if ($itemCode == $item2) {
|
||||
Notification::make()
|
||||
->title('Success')
|
||||
->body("Gr Number '$processOrder' PDF uploaded successfully.")
|
||||
->success()
|
||||
->send();
|
||||
|
||||
return;
|
||||
} else {
|
||||
Notification::make()
|
||||
->title('Item Code not matched')
|
||||
->body("Item Code: {$item->code} not matched with the uploaded pdf code $item1.")
|
||||
->danger()
|
||||
->send();
|
||||
// if ($itemCode == $item1) {
|
||||
// Notification::make()
|
||||
// ->title('Success')
|
||||
// ->body("Gr Number '$processOrder' PDF uploaded successfully.")
|
||||
// ->success()
|
||||
// ->send();
|
||||
|
||||
if (Storage::disk('local')->exists($storedPath)) {
|
||||
Storage::disk('local')->delete($storedPath);
|
||||
}
|
||||
// return;
|
||||
// }
|
||||
// if ($itemCode == $item2) {
|
||||
// Notification::make()
|
||||
// ->title('Success')
|
||||
// ->body("Gr Number '$processOrder' PDF uploaded successfully.")
|
||||
// ->success()
|
||||
// ->send();
|
||||
|
||||
return;
|
||||
}
|
||||
// return;
|
||||
// }
|
||||
// else {
|
||||
// Notification::make()
|
||||
// ->title('Item Code not matched')
|
||||
// ->body("Item Code: {$item->code} not matched with the uploaded pdf code $item2.")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
|
||||
// if (Storage::disk('local')->exists($storedPath)) {
|
||||
// Storage::disk('local')->delete($storedPath);
|
||||
// }
|
||||
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
} else {
|
||||
Notification::make()
|
||||
|
||||
@@ -19,8 +19,15 @@ use App\Models\Plant;
|
||||
use App\Models\StickerMaster;
|
||||
use App\Models\PanelGrMaster;
|
||||
use Filament\Notifications\Notification;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Mail\InvalidQualityMail;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Str;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
use App\Filament\Exports\PanelBoxValidationExporter;
|
||||
use App\Filament\Imports\PanelBoxValidationImporter;
|
||||
|
||||
class PanelBoxValidationResource extends Resource
|
||||
{
|
||||
@@ -169,6 +176,40 @@ class PanelBoxValidationResource extends Resource
|
||||
$set('production_order', request()->get('production_order'));
|
||||
}
|
||||
}),
|
||||
Forms\Components\TextInput::make('inspection_lot_number')
|
||||
->label('Inspec Lot No')
|
||||
->placeholder('Scan the valid Inspec Lot No')
|
||||
->minLength(7)
|
||||
->maxLength(14)
|
||||
->reactive()
|
||||
->readOnly(fn (callable $get) => $get('item_id'))
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
if (! is_numeric($get('inspection_lot_number'))) {
|
||||
$set('inspecOrdError', 'Must be a numeric value.');
|
||||
$set('item_id', null);
|
||||
$set('sticker_master_id', null);
|
||||
$set('uom', null);
|
||||
$set('serial_number', null);
|
||||
} else {
|
||||
$set('inspecOrdError', null);
|
||||
$set('inspection_lot_number', $state);
|
||||
$set('inspection', $state);
|
||||
}
|
||||
})
|
||||
->default(fn ($get) => $get('inspection') ?? session('last_selected_inspection'))
|
||||
->extraAttributes(fn ($get) => [
|
||||
'class' => $get('inspecOrdError') ? 'border-red-500' : '',
|
||||
])
|
||||
->hint(fn ($get) => $get('inspecOrdError') ? $get('inspecOrdError') : null)
|
||||
->hintColor('danger')
|
||||
->required(),
|
||||
Forms\Components\Hidden::make('inspection')
|
||||
->default(fn () => session('last_selected_inspection'))
|
||||
->afterStateHydrated(function ($state, $set) {
|
||||
if (! $state && request()->has('inspection_lot_number')) {
|
||||
$set('inspection_lot_number', request()->get('inspection_lot_number'));
|
||||
}
|
||||
}),
|
||||
Forms\Components\TextInput::make('item_id')
|
||||
->label('Item Code')
|
||||
// ->id('item_id')
|
||||
@@ -179,9 +220,11 @@ class PanelBoxValidationResource extends Resource
|
||||
->live()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
|
||||
$state = trim($state);
|
||||
$pId = $get('line_id');
|
||||
$plantId = $get('plant_id');
|
||||
$plaCode = Plant::find($plantId)?->code;
|
||||
$inspecLotNo = $get('inspection_lot_number');
|
||||
$set('part_validation_type', null);
|
||||
$set('show_validation_image', false);
|
||||
$set('validation1_image_url', null);
|
||||
@@ -507,45 +550,25 @@ class PanelBoxValidationResource extends Resource
|
||||
}
|
||||
elseif (str_contains($state, '/'))
|
||||
{
|
||||
$parts = array_map('trim', explode('/', $state));
|
||||
$parts = explode('/', $state);
|
||||
|
||||
if (count($parts) != 4) {
|
||||
if (count($parts) < 3) {
|
||||
|
||||
Notification::make()
|
||||
->title('Invalid QR Format')
|
||||
->body('Expected format: plantcode/itemcode/yearmm/serialnumber')
|
||||
->body('Expected format: plantcode/itemcode/yearmm/serialnumber (Or) plantcode/panelboxcode/serialnumber')
|
||||
->danger()
|
||||
->send();
|
||||
$set('item_id', null);
|
||||
return;
|
||||
}
|
||||
|
||||
$plantCode = $parts[0];
|
||||
$itemCode = $parts[1];
|
||||
$yearMonth = $parts[2];
|
||||
$serialNumber = $parts[3];
|
||||
|
||||
$supplier = $parts[0];
|
||||
$panelBoxCode = $parts[1];
|
||||
$yearMonth = $parts[2];
|
||||
$serialNumber = $parts[3];
|
||||
$panelBoxSerialNo = $parts[2] . $parts[3];
|
||||
$panelBoxSerialNo = implode('/', array_slice($parts, 2));
|
||||
|
||||
if($serialNumber == '' || $serialNumber == null){
|
||||
Notification::make()
|
||||
->title('Unknown Serial number')
|
||||
->body("Serial number can't be empty!")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$set('item_id', null);
|
||||
return;
|
||||
}
|
||||
if (! ctype_alnum($serialNumber)) {
|
||||
$set('validationError', 'Serial Number should contain alpha-numeric values.');
|
||||
$set('item_id', null);
|
||||
return;
|
||||
}
|
||||
$itemCode = $panelBoxCode;
|
||||
$serialNumber = $panelBoxSerialNo;
|
||||
|
||||
$existInMasterPo = PanelGrMaster::where('document_number', $pOrder)->where('plant_id', $plantId)->first();
|
||||
|
||||
@@ -600,6 +623,15 @@ class PanelBoxValidationResource extends Resource
|
||||
$set('item_id', null);
|
||||
return;
|
||||
}
|
||||
else if($existInMaster->inspection_lot_number != $inspecLotNo){
|
||||
Notification::make()
|
||||
->title('Panel GR Found')
|
||||
->body("Inspection Lot Number code not match for Production Order (Or) Doc No'{$pOrder}' and Item '{$itemCode}'.")
|
||||
->danger()
|
||||
->send();
|
||||
$set('item_id', null);
|
||||
return;
|
||||
}
|
||||
else if($existInMaster->quantity == '' || $existInMaster->quantity == null){
|
||||
Notification::make()
|
||||
->title('Panel GR Found')
|
||||
@@ -950,17 +982,19 @@ class PanelBoxValidationResource extends Resource
|
||||
return;
|
||||
}
|
||||
|
||||
if (!preg_match('/^\d+\/\d+\/\d+\/\d+$/', $state)) {
|
||||
$parts = explode('/', $state);
|
||||
|
||||
if (count($parts) < 3) {
|
||||
|
||||
Notification::make()
|
||||
->title('Invalid QR Format')
|
||||
->body('Expected format: plantcode/itemcode/yearmm/serialnumber')
|
||||
->body('Expected format: plantcode/itemcode/yearmm/serialnumber (Or) plantcode/panelboxcode/serialnumber')
|
||||
->danger()
|
||||
->send();
|
||||
$set('serial_number_panel_qr', null);
|
||||
$set('item_id', null);
|
||||
return;
|
||||
}
|
||||
|
||||
$parts = explode('/', $state);
|
||||
$extracted = trim(end($parts));
|
||||
|
||||
$expected = $get('serial_number');
|
||||
@@ -976,13 +1010,13 @@ class PanelBoxValidationResource extends Resource
|
||||
$set('serial_number_panel_qr', $extracted);
|
||||
$set('serial_number_panel', '1');
|
||||
|
||||
$panelParts = array_map('trim', explode('/', $state));
|
||||
$panelParts = explode('/', $state);
|
||||
|
||||
if (count($panelParts) != 4) {
|
||||
if (count($panelParts) < 3) {
|
||||
|
||||
Notification::make()
|
||||
->title('Invalid QR Format')
|
||||
->body('Expected format: plantcode/itemcode/yearmm/serialnumber')
|
||||
->body('Expected format: plantcode/itemcode/yearmm/serialnumber (Or) plantcode/panelboxcode/serialnumber')
|
||||
->danger()
|
||||
->send();
|
||||
$set('item_id', null);
|
||||
@@ -991,9 +1025,7 @@ class PanelBoxValidationResource extends Resource
|
||||
|
||||
$supplier = $panelParts[0];
|
||||
$panelBoxCode = $panelParts[1];
|
||||
$yearMonth = $panelParts[2];
|
||||
$serialNumber = $panelParts[3];
|
||||
$panelBoxSerialNo = $yearMonth . $serialNumber;
|
||||
$panelBoxSerialNo = implode('/', array_slice($panelParts, 2));
|
||||
|
||||
$set('panel_box_supplier', $supplier);
|
||||
$set('panel_box_serial_number', $panelBoxSerialNo);
|
||||
@@ -1635,6 +1667,11 @@ class PanelBoxValidationResource extends Resource
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('inspection_lot_number')
|
||||
->label('Inspection Lot No')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('serial_number')
|
||||
->label('Serial Number')
|
||||
->alignCenter()
|
||||
@@ -1644,52 +1681,62 @@ class PanelBoxValidationResource extends Resource
|
||||
->label('Serial Number Panel')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
->sortable()
|
||||
->visible(fn ($record) => $record?->stickerMaster?->serial_number_panel == 1),
|
||||
Tables\Columns\TextColumn::make('pack_slip_panel')
|
||||
->label('Pack Slip Panel')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
->sortable()
|
||||
->visible(fn ($record) => $record?->stickerMaster?->pack_slip_panel == 1),
|
||||
Tables\Columns\TextColumn::make('name_plate_panel')
|
||||
->label('Name Plate Panel')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
->sortable()
|
||||
->visible(fn ($record) => $record?->stickerMaster?->name_plate_panel == 1),
|
||||
Tables\Columns\TextColumn::make('tube_sticker_panel')
|
||||
->label('Tube Sticker Panel')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
->sortable()
|
||||
->visible(fn ($record) => $record?->stickerMaster?->tube_sticker_panel == 1),
|
||||
Tables\Columns\TextColumn::make('warranty_card_panel')
|
||||
->label('Warranty Card Panel')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
->sortable()
|
||||
->visible(fn ($record) => $record?->stickerMaster?->warranty_card_panel == 1),
|
||||
Tables\Columns\TextColumn::make('part_validation1')
|
||||
->label('Part Validation 1')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
->sortable()
|
||||
->visible(fn ($record) => $record?->stickerMaster?->part_validation1 != null),
|
||||
Tables\Columns\TextColumn::make('part_validation2')
|
||||
->label('Part Validation 2')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
->sortable()
|
||||
->visible(fn ($record) => $record?->stickerMaster?->part_validation2 != null),
|
||||
Tables\Columns\TextColumn::make('part_validation3')
|
||||
->label('Part Validation 3')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
->sortable()
|
||||
->visible(fn ($record) => $record?->stickerMaster?->part_validation3 != null),
|
||||
Tables\Columns\TextColumn::make('part_validation4')
|
||||
->label('Part Validation 4')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
->sortable()
|
||||
->visible(fn ($record) => $record?->stickerMaster?->part_validation4 != null),
|
||||
Tables\Columns\TextColumn::make('part_validation5')
|
||||
->label('Part Validation 5')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
->sortable()
|
||||
->visible(fn ($record) => $record?->stickerMaster?->part_validation5 != null),
|
||||
Tables\Columns\TextColumn::make('panel_box_supplier')
|
||||
->label('Panel Box Supplier')
|
||||
->alignCenter()
|
||||
@@ -1732,7 +1779,193 @@ class PanelBoxValidationResource extends Resource
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
Filter::make('advanced_filters')
|
||||
->label('Advanced Filters')
|
||||
->form([
|
||||
Select::make('Plant')
|
||||
->label('Search by Plant Name')
|
||||
->nullable()
|
||||
->searchable()
|
||||
->reactive()
|
||||
->options(function (callable $get) {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
if ($userHas && strlen($userHas) > 0) {
|
||||
return Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
|
||||
} else {
|
||||
return Plant::whereHas('panelBoxValidations', function ($query) {
|
||||
$query->whereNotNull('id');
|
||||
})->orderBy('code')->pluck('name', 'id');
|
||||
}
|
||||
|
||||
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('Line', null);
|
||||
$set('Item', null);
|
||||
$set('Machine', null);
|
||||
}),
|
||||
Select::make('Line')
|
||||
->label('Search by Line Name')
|
||||
->nullable()
|
||||
->searchable()
|
||||
->reactive()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Line::whereHas('panelBoxValidations', function ($query) use ($plantId) {
|
||||
if ($plantId) {
|
||||
$query->where('plant_id', $plantId);
|
||||
}
|
||||
})->pluck('name', 'id');
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('Item', null);
|
||||
}),
|
||||
Select::make('sticker_master_id')
|
||||
->label('Search by Item Code')
|
||||
->nullable()
|
||||
->searchable()
|
||||
->reactive()
|
||||
->options(function (callable $get) {
|
||||
$pId = $get('Plant');
|
||||
|
||||
// if (empty($pId)) {
|
||||
// return [];
|
||||
// }
|
||||
return Item::whereHas('stickerMasters', function ($query) use ($pId) {
|
||||
if ($pId) {
|
||||
$query->where('plant_id', $pId);
|
||||
}
|
||||
$query->whereHas('panelBoxValidations');
|
||||
})->pluck('code', 'id');
|
||||
}),
|
||||
TextInput::make('production_order')
|
||||
->label('Production Order / Doc No')
|
||||
->reactive()
|
||||
->placeholder('Enter Production Order (or) Doc No')
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('serial_number', null);
|
||||
}),
|
||||
TextInput::make('serial_number')
|
||||
->label('Serial Number')
|
||||
->reactive()
|
||||
->placeholder('Enter Serial Number'),
|
||||
TextInput::make('panel_box_code')
|
||||
->label('Panel Box Code')
|
||||
->reactive()
|
||||
->placeholder('Enter Panel Box Code'),
|
||||
DateTimePicker::make(name: 'created_from')
|
||||
->label('Created From')
|
||||
->placeholder('Select From DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
DateTimePicker::make('created_to')
|
||||
->label('Created To')
|
||||
->placeholder('Select To DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
])
|
||||
->query(function ($query, array $data) {
|
||||
// Hide all records initially if no filters are applied
|
||||
if (empty($data['Plant']) && empty($data['Line']) && empty($data['Item']) && empty($data['production_order']) && empty($data['serial_number']) && empty($data['panel_box_code']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
|
||||
if (! empty($data['Plant'])) {
|
||||
$query->where('plant_id', $data['Plant']);
|
||||
} else {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
if ($userHas && strlen($userHas) > 0) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($data['Line'])) {
|
||||
$query->where('line_id', $data['Line']);
|
||||
}
|
||||
|
||||
if (! empty($data['sticker_master_id'])) {
|
||||
$stickerMasterIds = StickerMaster::where('item_id', $data['sticker_master_id'])
|
||||
->pluck('id')
|
||||
->toArray();
|
||||
|
||||
if (! empty($stickerMasterIds)) {
|
||||
$query->whereIn('sticker_master_id', $stickerMasterIds);
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($data['production_order'])) {
|
||||
$query->where('production_order', 'like', '%'.$data['production_order'].'%');
|
||||
}
|
||||
|
||||
if (Str::length($data['serial_number']) > 0) {
|
||||
$query->where('serial_number', 'like', '%'.$data['serial_number'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['panel_box_code'])) {
|
||||
$query->where('panel_box_code', 'like', '%'.$data['panel_box_code'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['created_from'])) {
|
||||
$query->where('created_at', '>=', $data['created_from']);
|
||||
}
|
||||
|
||||
if (! empty($data['created_to'])) {
|
||||
$query->where('created_at', '<=', $data['created_to']);
|
||||
}
|
||||
})
|
||||
->indicateUsing(function (array $data) {
|
||||
$indicators = [];
|
||||
|
||||
if (! empty($data['Plant'])) {
|
||||
$indicators[] = 'Plant Name: '.Plant::where('id', $data['Plant'])->value('name');
|
||||
} else {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
if ($userHas && strlen($userHas) > 0) {
|
||||
return 'Plant Name: Choose plant to filter records.';
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($data['Line'])) {
|
||||
$indicators[] = 'Line Name: '.Line::where('id', $data['Line'])->value('name');
|
||||
}
|
||||
|
||||
if (! empty($data['sticker_master_id'])) {
|
||||
$itemCode = Item::find($data['sticker_master_id'])->code ?? 'Unknown';
|
||||
$indicators[] = 'Item Code: '.$itemCode;
|
||||
}
|
||||
|
||||
if (! empty($data['production_order'])) {
|
||||
$indicators[] = 'Production Order: '.$data['production_order'];
|
||||
}
|
||||
|
||||
if (Str::length($data['serial_number']) > 0) {
|
||||
$indicators[] = 'Serial Number: '.$data['serial_number'];
|
||||
}
|
||||
|
||||
if (! empty($data['panel_box_code'])) {
|
||||
$indicators[] = 'Panel Box Code: '.$data['panel_box_code'];
|
||||
}
|
||||
|
||||
if (! empty($data['created_from'])) {
|
||||
$indicators[] = 'From: '.$data['created_from'];
|
||||
}
|
||||
|
||||
if (! empty($data['created_to'])) {
|
||||
$indicators[] = 'To: '.$data['created_to'];
|
||||
}
|
||||
|
||||
return $indicators;
|
||||
}),
|
||||
])
|
||||
->filtersFormMaxHeight('280px')
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
@@ -1743,6 +1976,22 @@ class PanelBoxValidationResource extends Resource
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->label('Import Panel Box Validation')
|
||||
->color('warning')
|
||||
->importer(PanelBoxValidationImporter::class)
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view import panel box validation');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->label('Export Panel Box Validation')
|
||||
->color('warning')
|
||||
->exporter(PanelBoxValidationExporter::class)
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view export panel box validation');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ class CreatePanelBoxValidation extends CreateRecord {
|
||||
'last_selected_plant_id',
|
||||
'last_selected_line',
|
||||
'last_selected_production',
|
||||
'last_selected_inspection',
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -96,8 +97,9 @@ class CreatePanelBoxValidation extends CreateRecord {
|
||||
}
|
||||
|
||||
$this->existingRecords = ProductCharacteristicsMaster::where('plant_id', $plantId)
|
||||
->where('category', $categoryName)
|
||||
->where('item_id', $item->id)
|
||||
->where('line_id', $lineId)
|
||||
->orderBy('id', 'asc')
|
||||
->get();
|
||||
|
||||
return $this->existingRecords->isNotEmpty();
|
||||
@@ -116,6 +118,7 @@ class CreatePanelBoxValidation extends CreateRecord {
|
||||
'plant_id' => $this->data['plant_id'] ?? null,
|
||||
'line_id' => $this->data['line_id'] ?? null,
|
||||
'production_order' => $this->data['production_order'] ?? null,
|
||||
'inspection_lot_number' => $this->data['inspection_lot_number'] ?? null,
|
||||
])
|
||||
);
|
||||
}
|
||||
@@ -219,6 +222,7 @@ class CreatePanelBoxValidation extends CreateRecord {
|
||||
$plant = $this->form->getState()['plant'] ?? null;
|
||||
$line = $this->form->getState()['line'] ?? null;
|
||||
$production = $this->form->getState()['production'] ?? null;
|
||||
$inspection = $this->form->getState()['inspection'] ?? null;
|
||||
|
||||
// $this->skipChecklistValidation = false;
|
||||
// $this->showChecklist = false;
|
||||
@@ -243,6 +247,7 @@ class CreatePanelBoxValidation extends CreateRecord {
|
||||
'plant_id' => null,
|
||||
'line_id' => null,
|
||||
'production_order' => null,
|
||||
'inspection_lot_number' => null,
|
||||
]);
|
||||
|
||||
|
||||
@@ -259,6 +264,9 @@ class CreatePanelBoxValidation extends CreateRecord {
|
||||
if ($production) {
|
||||
session(['last_selected_production' => $production]);
|
||||
}
|
||||
if ($inspection) {
|
||||
session(['last_selected_inspection' => $inspection]);
|
||||
}
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
@@ -269,6 +277,7 @@ class CreatePanelBoxValidation extends CreateRecord {
|
||||
'plant_id' => $this->data['plant_id'] ?? null,
|
||||
'line_id' => $this->data['line_id'] ?? null,
|
||||
'production_order' => $this->data['production_order'] ?? null,
|
||||
'inspection_lot_number' => $this->data['inspection_lot_number'] ?? null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +85,9 @@ class PanelGrMasterResource extends Resource
|
||||
Forms\Components\TextInput::make('supplier_number')
|
||||
->label('Supplier Number')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('inspection_lot_number')
|
||||
->label('Inspection Lot Number')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('quantity')
|
||||
->label('Quantity')
|
||||
->numeric()
|
||||
@@ -144,6 +147,11 @@ class PanelGrMasterResource extends Resource
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('inspection_lot_number')
|
||||
->label('Inspection Lot Number')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('quantity')
|
||||
->label('Quantity')
|
||||
->searchable()
|
||||
|
||||
@@ -170,6 +170,8 @@ class ProductionCharacteristicResource extends Resource
|
||||
->label('Production Order'),
|
||||
Forms\Components\TextInput::make('serial_number')
|
||||
->label('Serial Number'),
|
||||
Forms\Components\TextInput::make('inspection_lot_number')
|
||||
->label('Inspection Lot No'),
|
||||
Forms\Components\TextInput::make('characteristic_name')
|
||||
->label('Characteristic Name'),
|
||||
Forms\Components\TextInput::make('observed_value')
|
||||
@@ -235,7 +237,12 @@ class ProductionCharacteristicResource extends Resource
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('production_order')
|
||||
->label('Production Order')
|
||||
->label('Production Order / Doc No')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('inspection_lot_number')
|
||||
->label('Inspection Lot No')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
@@ -280,17 +287,6 @@ class ProductionCharacteristicResource extends Resource
|
||||
})
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
// Tables\Columns\TextColumn::make('inspection_status')
|
||||
// ->label('Inspection Status')
|
||||
// ->searchable()
|
||||
// ->color(fn (string $state): string => match ($state) {
|
||||
// 'Ok' => 'success',
|
||||
// 'Not Ok' => 'danger',
|
||||
// 'NotOk' => 'danger',
|
||||
// default => 'gray',
|
||||
// })
|
||||
// ->alignCenter()
|
||||
// ->sortable(),
|
||||
Tables\Columns\TextColumn::make('remark')
|
||||
->label('Remark')
|
||||
->searchable()
|
||||
|
||||
453
app/Filament/Resources/StickerDetailResource.php
Normal file
453
app/Filament/Resources/StickerDetailResource.php
Normal file
@@ -0,0 +1,453 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\StickerDetailExporter;
|
||||
use App\Filament\Imports\StickerDetailImporter;
|
||||
use App\Filament\Resources\StickerDetailResource\Pages;
|
||||
use App\Filament\Resources\StickerDetailResource\RelationManagers;
|
||||
use App\Models\ItemCharacteristic;
|
||||
use App\Models\StickerDetail;
|
||||
use App\Models\StickerStructureDetail;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Closure;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class StickerDetailResource extends Resource
|
||||
{
|
||||
protected static ?string $model = StickerDetail::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Customized Sticker Printing';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Select::make('sticker_structure_detail_id')
|
||||
->label('Sticker ID')
|
||||
->reactive()
|
||||
->relationship('stickerStructureDetail', 'sticker_id')
|
||||
->options(function (callable $get) {
|
||||
return StickerStructureDetail::pluck('sticker_id', 'id');
|
||||
})
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $get, callable $set) {
|
||||
// if ($get('element_id')) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
$structureId = $get('sticker_structure_detail_id');
|
||||
$set('design_element_type', null);
|
||||
$set('element_id', null);
|
||||
|
||||
if (!$structureId) {
|
||||
$set('element_id', null);
|
||||
return;
|
||||
}
|
||||
|
||||
$maxId = StickerDetail::where('sticker_structure_detail_id', $structureId)
|
||||
->max('element_id');
|
||||
|
||||
$nextId = $maxId ? ((int) $maxId + 1) : 1;
|
||||
|
||||
$formattedId = str_pad($nextId, 3, '0', STR_PAD_LEFT);
|
||||
|
||||
$set('element_id', $formattedId);
|
||||
}),
|
||||
Forms\Components\Select::make('design_element_type')
|
||||
->label('Design Element Type')
|
||||
->reactive()
|
||||
->options([
|
||||
'Text' => 'Text',
|
||||
'Shape' => 'Shape',
|
||||
'Image' => 'Image',
|
||||
'QR' => 'QR',
|
||||
]),
|
||||
Forms\Components\TextInput::make('element_id')
|
||||
->label('Element ID')
|
||||
->readOnly()
|
||||
->reactive(),
|
||||
Forms\Components\Select::make('element_type')
|
||||
->label('Element Type')
|
||||
->options([
|
||||
'Static' => 'Static',
|
||||
'Dynamic' => 'Dynamic',
|
||||
]),
|
||||
Forms\Components\Select::make('characteristics_type')
|
||||
->label('Characteristics')
|
||||
->reactive()
|
||||
->searchable()
|
||||
->options(
|
||||
collect(Schema::getColumnListing('item_characteristics'))
|
||||
->reject(fn ($column) => in_array($column, [
|
||||
'id',
|
||||
'plant_id',
|
||||
'item_id',
|
||||
'class',
|
||||
'zz1_cn_bill_ord',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
]))
|
||||
->mapWithKeys(fn ($column) => [
|
||||
$column => ucfirst(str_replace('_', ' ', $column))
|
||||
])
|
||||
->prepend('Item Code', 'item_code')
|
||||
->prepend('Serial Number', 'serial_number')
|
||||
->prepend('Plant Name', 'plant_name')
|
||||
->prepend('Plant Address', 'plant_address')
|
||||
->prepend('Current Date', 'current_date')
|
||||
->toArray()
|
||||
),
|
||||
Forms\Components\TextInput::make('string_value')
|
||||
->label('String Value')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Text'),
|
||||
Forms\Components\Select::make('string_font')
|
||||
->label('String Font')
|
||||
->reactive()
|
||||
->options(function () {
|
||||
$files = File::files(storage_path('app/fonts'));
|
||||
|
||||
return collect($files)
|
||||
->mapWithKeys(function ($file) {
|
||||
$name = pathinfo($file->getFilename(), PATHINFO_FILENAME);
|
||||
|
||||
return [$name => $name];
|
||||
})
|
||||
->toArray();
|
||||
})
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Text'),
|
||||
Forms\Components\TextInput::make('string_size')
|
||||
->label('String Size')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Text'),
|
||||
Forms\Components\Select::make('element_colour')
|
||||
->label('Element Colour')
|
||||
->options([
|
||||
'' => 'Default (Black)',
|
||||
'#000000' => 'Black',
|
||||
'#FFFFFF' => 'White',
|
||||
'#FF0000' => 'Red',
|
||||
'#00FF00' => 'Lime',
|
||||
'#0000FF' => 'Blue',
|
||||
'#FFFF00' => 'Yellow',
|
||||
'#00FFFF' => 'Cyan',
|
||||
'#FF00FF' => 'Magenta',
|
||||
'#800000' => 'Maroon',
|
||||
'#808000' => 'Olive',
|
||||
'#008000' => 'Green',
|
||||
'#800080' => 'Purple',
|
||||
'#008080' => 'Teal',
|
||||
'#808080' => 'Gray',
|
||||
'#C0C0C0' => 'Silver',
|
||||
'#FFA500' => 'Orange',
|
||||
'#FFC0CB' => 'Pink',
|
||||
'#A52A2A' => 'Brown',
|
||||
'#87CEEB' => 'Sky Blue',
|
||||
])
|
||||
->nullable()
|
||||
->reactive(),
|
||||
Forms\Components\Select::make('string_align')
|
||||
->label('String Align')
|
||||
->options([
|
||||
'Left' => 'Left',
|
||||
'Right' => 'Right',
|
||||
'Center' => 'Center',
|
||||
])
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Text'),
|
||||
Forms\Components\TextInput::make('string_x_value')
|
||||
->label('String X Value')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Text'),
|
||||
Forms\Components\TextInput::make('string_y_value')
|
||||
->label('String Y Value')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Text'),
|
||||
Forms\Components\Select::make('shape_name')
|
||||
->label('Shape Name')
|
||||
->reactive()
|
||||
->options([
|
||||
'Line' => 'Line',
|
||||
'Rectangle' => 'Rectangle',
|
||||
'CurvedRectangle' => 'CurvedRectangle',
|
||||
])
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Shape'),
|
||||
Forms\Components\TextInput::make('shape_pen_size')
|
||||
->label('Shape Pen Size')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Shape'),
|
||||
Forms\Components\TextInput::make('curve_radius')
|
||||
->label('Curve Radius')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('shape_name') == 'CurvedRectangle'),
|
||||
Forms\Components\TextInput::make('shape_x1_value')
|
||||
->label('Shape X1 Value')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Shape'),
|
||||
Forms\Components\TextInput::make('shape_y1_value')
|
||||
->label('Shape Y1 Value')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Shape'),
|
||||
Forms\Components\TextInput::make('shape_x2_value')
|
||||
->label('Shape X2 Value')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Shape'),
|
||||
Forms\Components\TextInput::make('shape_y2_value')
|
||||
->label('Shape Y2 Value')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Shape'),
|
||||
// Forms\Components\FileUpload::make('image_path')
|
||||
// ->label('Image')
|
||||
// ->image()
|
||||
// ->directory('sticker-images')
|
||||
// ->visibility('public')
|
||||
// ->preserveFilenames(false)
|
||||
// ->required(false)
|
||||
// ->reactive()
|
||||
// ->visible(fn ($get) => $get('design_element_type') == 'Image'),
|
||||
// Forms\Components\TextInput::make('image_type')
|
||||
// ->label('Image Type')
|
||||
// ->reactive()
|
||||
// ->visible(fn ($get) => $get('design_element_type') == 'Image'),
|
||||
Forms\Components\TextInput::make('image_x')
|
||||
->label('Image X')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Image'),
|
||||
Forms\Components\TextInput::make('image_y')
|
||||
->label('Image Y')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Image'),
|
||||
Forms\Components\TextInput::make('image_width')
|
||||
->label('Image Width')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Image'),
|
||||
Forms\Components\TextInput::make('image_height')
|
||||
->label('Image Height')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Image'),
|
||||
Forms\Components\TextInput::make('qr_value')
|
||||
->label('QR Value')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'QR'),
|
||||
Forms\Components\TextInput::make('qr_align')
|
||||
->label('QR Align')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'QR'),
|
||||
Forms\Components\TextInput::make('qr_size')
|
||||
->label('QR Size')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'QR'),
|
||||
Forms\Components\TextInput::make('qr_x_value')
|
||||
->label('QR X Value')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'QR'),
|
||||
Forms\Components\TextInput::make('qr_y_value')
|
||||
->label('QR Y Value')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'QR'),
|
||||
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),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('stickerStructureDetail.sticker_id')
|
||||
->label('Sticker ID')
|
||||
->searchable()
|
||||
->sortable()
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('design_element_type')
|
||||
->label('Design Element Type')
|
||||
->searchable()
|
||||
->sortable()
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('element_id')
|
||||
->label('Element ID')
|
||||
->searchable()
|
||||
->sortable()
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('element_type')
|
||||
->label('Element Type')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('characteristics_type')
|
||||
->label('Characteristics Type')
|
||||
->searchable()
|
||||
->sortable()
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('string_value')
|
||||
->label('String Value')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('string_font')
|
||||
->label('String Font')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('string_size')
|
||||
->label('String Size')
|
||||
->alignCenter(),
|
||||
// Tables\Columns\TextColumn::make('element_colour')
|
||||
// ->label('Element Colour')
|
||||
// ->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('string_align')
|
||||
->label('String Align')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('string_x_value')
|
||||
->label('String X Value')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('string_y_value')
|
||||
->label('String Y Value')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('shape_name')
|
||||
->label('Shape Name')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('shape_pen_size')
|
||||
->label('Shape Pen Size')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('curve_radius')
|
||||
->label('Curve Radius'),
|
||||
Tables\Columns\TextColumn::make('shape_x1_value')
|
||||
->label('Shape X1 Value')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('shape_y1_value')
|
||||
->label('Shape Y1 Value')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('shape_x2_value')
|
||||
->label('Shape X2 Value')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('shape_y2_value')
|
||||
->label('Shape Y2 Value')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('image_x')
|
||||
->label('Image X')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('image_y')
|
||||
->label('Image Y')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('image_width')
|
||||
->label('Image Width')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('image_height')
|
||||
->label('Image Height')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('qr_value')
|
||||
->label('QR Value')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('qr_align')
|
||||
->label('QR Align')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('qr_size')
|
||||
->label('QR Size')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('qr_x_value')
|
||||
->label('QR X Value')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('qr_y_value')
|
||||
->label('QR Y Value')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('created_by')
|
||||
->label('Created By')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->label('Import Sticker Details')
|
||||
->color('warning')
|
||||
->importer(StickerDetailImporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view import sticker details');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->label('Export Sticker Details')
|
||||
->color('warning')
|
||||
->exporter(StickerDetailExporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view export sticker details');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListStickerDetails::route('/'),
|
||||
'create' => Pages\CreateStickerDetail::route('/create'),
|
||||
'view' => Pages\ViewStickerDetail::route('/{record}'),
|
||||
'edit' => Pages\EditStickerDetail::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerDetailResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerDetailResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateStickerDetail extends CreateRecord
|
||||
{
|
||||
protected static string $resource = StickerDetailResource::class;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerDetailResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerDetailResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditStickerDetail extends EditRecord
|
||||
{
|
||||
protected static string $resource = StickerDetailResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerDetailResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerDetailResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListStickerDetails extends ListRecords
|
||||
{
|
||||
protected static string $resource = StickerDetailResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerDetailResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerDetailResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewStickerDetail extends ViewRecord
|
||||
{
|
||||
protected static string $resource = StickerDetailResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
478
app/Filament/Resources/StickerMappingMasterResource.php
Normal file
478
app/Filament/Resources/StickerMappingMasterResource.php
Normal file
@@ -0,0 +1,478 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\StickerMappingMasterExporter;
|
||||
use App\Filament\Imports\StickerMappingMasterImporter;
|
||||
use App\Filament\Resources\StickerMappingMasterResource\Pages;
|
||||
use App\Filament\Resources\StickerMappingMasterResource\RelationManagers;
|
||||
use App\Models\Item;
|
||||
use App\Models\ItemCharacteristic;
|
||||
use App\Models\Machine;
|
||||
use App\Models\StickerMappingMaster;
|
||||
use App\Models\StickerStructureDetail;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
|
||||
class StickerMappingMasterResource extends Resource
|
||||
{
|
||||
protected static ?string $model = StickerMappingMaster::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Customized Sticker Printing';
|
||||
|
||||
// public static function form(Form $form): Form
|
||||
// {
|
||||
// return $form
|
||||
// ->schema([
|
||||
// Forms\Components\TextInput::make('plant_id')
|
||||
// ->required()
|
||||
// ->numeric(),
|
||||
// Forms\Components\TextInput::make('item_id')
|
||||
// ->required()
|
||||
// ->numeric(),
|
||||
// Forms\Components\Textarea::make('sticker1')
|
||||
// ->columnSpanFull(),
|
||||
// Forms\Components\Textarea::make('sticker2')
|
||||
// ->columnSpanFull(),
|
||||
// Forms\Components\Textarea::make('sticker3')
|
||||
// ->columnSpanFull(),
|
||||
// Forms\Components\Textarea::make('sticker4')
|
||||
// ->columnSpanFull(),
|
||||
// Forms\Components\Textarea::make('sticker5')
|
||||
// ->columnSpanFull(),
|
||||
// Forms\Components\Textarea::make('created_by')
|
||||
// ->columnSpanFull(),
|
||||
// Forms\Components\Textarea::make('updated_by')
|
||||
// ->columnSpanFull(),
|
||||
// ]);
|
||||
// }
|
||||
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
/* -------- Basic Mapping -------- */
|
||||
Section::make('Basic Mapping')
|
||||
->schema([
|
||||
Select::make('plant_id')
|
||||
->label('Plant')
|
||||
->reactive()
|
||||
->relationship('plant', 'name')
|
||||
->required(),
|
||||
|
||||
Select::make('item_characteristic_id')
|
||||
->label('Item Code')
|
||||
->reactive()
|
||||
//->relationship('item', 'code')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
|
||||
if (! $plantId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return ItemCharacteristic::query()
|
||||
->whereHas('item', function ($query) use ($plantId) {
|
||||
$query->where('plant_id', $plantId);
|
||||
})
|
||||
->with('item')
|
||||
->get()
|
||||
->mapWithKeys(fn ($ic) => [
|
||||
$ic->id => $ic->item->code,
|
||||
]);
|
||||
})
|
||||
->searchable()
|
||||
->required(),
|
||||
])
|
||||
->columns(2),
|
||||
|
||||
/* -------- Sticker 1 -------- */
|
||||
Section::make('Sticker 1')
|
||||
->schema([
|
||||
Select::make('sticker_structure1_id')
|
||||
->label('Sticker ID')
|
||||
->options(function (callable $get) {
|
||||
return StickerStructureDetail::pluck('sticker_id', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
Select::make('sticker1_machine_id')
|
||||
->label('Work Center')
|
||||
//->relationship('sticker1Machine', 'name')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
TextInput::make('sticker1_print_ip')
|
||||
->label('Printer IP')
|
||||
->ipv4(),
|
||||
])
|
||||
->columns(2),
|
||||
|
||||
/* -------- Sticker 2 -------- */
|
||||
Section::make('Sticker 2')
|
||||
->schema([
|
||||
Select::make('sticker_structure2_id')
|
||||
->label('Sticker ID')
|
||||
->options(function (callable $get) {
|
||||
return StickerStructureDetail::pluck('sticker_id', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
Select::make('sticker2_machine_id')
|
||||
->label('Work Center')
|
||||
// ->relationship('sticker2Machine', 'name')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
TextInput::make('sticker2_print_ip')
|
||||
->label('Printer IP')
|
||||
->ipv4(),
|
||||
])
|
||||
->columns(2),
|
||||
|
||||
/* -------- Sticker 3 -------- */
|
||||
Section::make('Sticker 3')
|
||||
->schema([
|
||||
Select::make('sticker_structure3_id')
|
||||
->label('Sticker ID')
|
||||
->options(function (callable $get) {
|
||||
return StickerStructureDetail::pluck('sticker_id', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
Select::make('sticker3_machine_id')
|
||||
->label('Work Center')
|
||||
//->relationship('sticker3Machine', 'name')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
TextInput::make('sticker3_print_ip')
|
||||
->label('Printer IP')
|
||||
->ipv4(),
|
||||
])
|
||||
->columns(2),
|
||||
|
||||
/* -------- Sticker 4 -------- */
|
||||
Section::make('Sticker 4')
|
||||
->schema([
|
||||
Select::make('sticker_structure4_id')
|
||||
->label('Sticker ID')
|
||||
->options(function (callable $get) {
|
||||
return StickerStructureDetail::pluck('sticker_id', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
Select::make('sticker4_machine_id')
|
||||
->label('Work Center')
|
||||
//->relationship('sticker4Machine', 'name')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
TextInput::make('sticker4_print_ip')
|
||||
->label('Printer IP')
|
||||
->ipv4(),
|
||||
])
|
||||
->columns(2),
|
||||
|
||||
/* -------- Sticker 5 -------- */
|
||||
Section::make('Sticker 5')
|
||||
->schema([
|
||||
Select::make('sticker_structure5_id')
|
||||
->label('Sticker ID')
|
||||
->options(function (callable $get) {
|
||||
return StickerStructureDetail::pluck('sticker_id', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
Select::make('sticker5_machine_id')
|
||||
->label('Work Center')
|
||||
//->relationship('sticker5Machine', 'name')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
TextInput::make('sticker5_print_ip')
|
||||
->label('Printer IP')
|
||||
->ipv4(),
|
||||
])
|
||||
->columns(2),
|
||||
|
||||
/* -------- Sticker 6 -------- */
|
||||
Section::make('Sticker 6')
|
||||
->schema([
|
||||
Select::make('sticker_structure6_id')
|
||||
->label('Sticker ID')
|
||||
->options(function (callable $get) {
|
||||
return StickerStructureDetail::pluck('sticker_id', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
Select::make('sticker6_machine_id')
|
||||
->label('Work Center')
|
||||
//->relationship('sticker6Machine', 'name')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
TextInput::make('sticker6_print_ip')
|
||||
->label('Printer IP')
|
||||
->ipv4(),
|
||||
])
|
||||
->columns(2),
|
||||
|
||||
/* -------- Sticker 7 -------- */
|
||||
Section::make('Sticker 7')
|
||||
->schema([
|
||||
Select::make('sticker_structure7_id')
|
||||
->label('Sticker ID')
|
||||
->options(function (callable $get) {
|
||||
return StickerStructureDetail::pluck('sticker_id', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
Select::make('sticker7_machine_id')
|
||||
->label('Work Center')
|
||||
//->relationship('sticker7Machine', 'name')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
TextInput::make('sticker7_print_ip')
|
||||
->label('Printer IP')
|
||||
->ipv4(),
|
||||
])
|
||||
->columns(2),
|
||||
|
||||
/* -------- Sticker 8 -------- */
|
||||
Section::make('Sticker 8')
|
||||
->schema([
|
||||
Select::make('sticker_structure8_id')
|
||||
->label('Sticker ID')
|
||||
->options(function (callable $get) {
|
||||
return StickerStructureDetail::pluck('sticker_id', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
Select::make('sticker8_machine_id')
|
||||
->label('Work Center')
|
||||
//->relationship('sticker8Machine', 'name')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
TextInput::make('sticker8_print_ip')
|
||||
->label('Printer IP')
|
||||
->ipv4(),
|
||||
])
|
||||
->columns(2),
|
||||
]);
|
||||
}
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('itemCharacteristic.item.code')
|
||||
->label('Item')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('sticker1Structure.sticker_id')
|
||||
->label('Sticker 1')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker1Machine.work_center')
|
||||
->label('WC 1')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker1_print_ip')
|
||||
->label('Printer IP 1')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker2Structure.sticker_id')
|
||||
->label('Sticker 2')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker2Machine.work_center')
|
||||
->label('WC 2')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker2_print_ip')
|
||||
->label('Printer IP 2')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker3Structure.sticker_id')
|
||||
->label('Sticker 3')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker3Machine.work_center')
|
||||
->label('WC 3')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker3_print_ip')
|
||||
->label('Printer IP 3')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker4Structure.sticker_id')
|
||||
->label('Sticker 4')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker4Machine.work_center')
|
||||
->label('WC 4')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker4_print_ip')
|
||||
->label('Printer IP 4')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker5Structure.sticker_id')
|
||||
->label('Sticker 5')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker5Machine.work_center')
|
||||
->label('WC 5')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker5_print_ip')
|
||||
->label('Printer IP 5')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker6Structure.sticker_id')
|
||||
->label('Sticker 6')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker6Machine.work_center')
|
||||
->label('WC 6')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker6_print_ip')
|
||||
->label('Printer IP 6')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker7Structure.sticker_id')
|
||||
->label('Sticker 7')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker7Machine.work_center')
|
||||
->label('WC 7')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker7_print_ip')
|
||||
->label('Printer IP 7')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker8Structure.sticker_id')
|
||||
->label('Sticker 8')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker8Machine.work_center')
|
||||
->label('WC 8')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker8_print_ip')
|
||||
->label('Printer IP 8')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->importer(StickerMappingMasterImporter::class)
|
||||
->label('Import Sticker Mapping Master')
|
||||
->color('warning')
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view import sticker mapping master');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->exporter(StickerMappingMasterExporter::class)
|
||||
->label('Export Sticker Mapping Master')
|
||||
->color('warning')
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view export sticker mapping master');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListStickerMappingMasters::route('/'),
|
||||
'create' => Pages\CreateStickerMappingMaster::route('/create'),
|
||||
'view' => Pages\ViewStickerMappingMaster::route('/{record}'),
|
||||
'edit' => Pages\EditStickerMappingMaster::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerMappingMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerMappingMasterResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateStickerMappingMaster extends CreateRecord
|
||||
{
|
||||
protected static string $resource = StickerMappingMasterResource::class;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerMappingMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerMappingMasterResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditStickerMappingMaster extends EditRecord
|
||||
{
|
||||
protected static string $resource = StickerMappingMasterResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerMappingMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerMappingMasterResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListStickerMappingMasters extends ListRecords
|
||||
{
|
||||
protected static string $resource = StickerMappingMasterResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerMappingMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerMappingMasterResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewStickerMappingMaster extends ViewRecord
|
||||
{
|
||||
protected static string $resource = StickerMappingMasterResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
207
app/Filament/Resources/StickerStructureDetailResource.php
Normal file
207
app/Filament/Resources/StickerStructureDetailResource.php
Normal file
@@ -0,0 +1,207 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\StickerStructureDetailExporter;
|
||||
use App\Filament\Imports\StickerStructureDetailImporter;
|
||||
use App\Filament\Resources\StickerStructureDetailResource\Pages;
|
||||
use App\Filament\Resources\StickerStructureDetailResource\RelationManagers;
|
||||
use App\Models\ItemCharacteristic;
|
||||
use App\Models\StickerStructureDetail;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Filament\Forms\Components\Actions\Action;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Filament\Forms\Components\Html;
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
|
||||
class StickerStructureDetailResource extends Resource
|
||||
{
|
||||
protected static ?string $model = StickerStructureDetail::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Customized Sticker Printing';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('sticker_id')
|
||||
->label('Sticker ID')
|
||||
->reactive()
|
||||
->required()
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
//\Log::info('Sticker ID typed:', ['sticker_id' => $state]);
|
||||
$set('sticker_id_live', $state);
|
||||
}),
|
||||
Forms\Components\TextInput::make('sticker_width')
|
||||
->label('Sticker Width')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('sticker_height')
|
||||
->label('Sticker Height')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('sticker_lmargin')
|
||||
->label('Sticker Left Margin')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('sticker_rmargin')
|
||||
->label('Sticker Right Margin')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('sticker_tmargin')
|
||||
->label('Sticker Top Margin')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('sticker_bmargin')
|
||||
->label('Sticker Bottom Margin')
|
||||
->required(),
|
||||
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\Hidden::make('sticker_id_live')
|
||||
// ->default(fn ($get) => $get('sticker_id'))
|
||||
// ->reactive()
|
||||
// ->afterStateUpdated(function ($state, callable $set) {
|
||||
// $set('sticker_id_live', $state);
|
||||
// }),
|
||||
// Forms\Components\ViewField::make('generate_template')
|
||||
// ->view('fields.generate-template')
|
||||
// ->reactive()
|
||||
// //->key(fn ($get) => 'generate-template' . ($get('sticker_id_live') ?? 'empty'))
|
||||
// ->key(fn (Get $get) =>
|
||||
// 'generate-template-' .
|
||||
// ($get('sticker_id_live') ?? 'empty') . '-' .
|
||||
// ($get('plant_id') ?? 'empty') . '-' .
|
||||
// ($get('item_characteristic_id') ?? 'empty')
|
||||
// )
|
||||
// // ->viewData(fn (Get $get) => [
|
||||
// // 'sticker_id' => $get('sticker_id_live') ?? 'empty',
|
||||
// // ]),
|
||||
// ->viewData(fn (Get $get) => [
|
||||
// 'sticker_id' => $get('sticker_id_live') ?? 'empty',
|
||||
// 'plant_id' => $get('plant_id') ?? 'empty',
|
||||
// 'item_characteristic_id' => $get('item_characteristic_id') ?? 'empty',
|
||||
// ])
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('sticker_id')
|
||||
->label('Sticker ID')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker_width')
|
||||
->label('Sticker Width')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker_height')
|
||||
->label('Sticker Height')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker_lmargin')
|
||||
->label('Sticker Left Margin')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker_rmargin')
|
||||
->label('Sticker Right Margin')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker_tmargin')
|
||||
->label('Sticker Top Margin')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker_bmargin')
|
||||
->label('Sticker Bottom Margin')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->label('Import Sticker Structure Details')
|
||||
->color('warning')
|
||||
->importer(StickerStructureDetailImporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view import sticker structure details');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->label('Export Sticker Structure Details')
|
||||
->color('warning')
|
||||
->exporter(StickerStructureDetailExporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view export sticker structure details');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListStickerStructureDetails::route('/'),
|
||||
'create' => Pages\CreateStickerStructureDetail::route('/create'),
|
||||
'view' => Pages\ViewStickerStructureDetail::route('/{record}'),
|
||||
'edit' => Pages\EditStickerStructureDetail::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerStructureDetailResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerStructureDetailResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateStickerStructureDetail extends CreateRecord
|
||||
{
|
||||
protected static string $resource = StickerStructureDetailResource::class;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerStructureDetailResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerStructureDetailResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditStickerStructureDetail extends EditRecord
|
||||
{
|
||||
protected static string $resource = StickerStructureDetailResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerStructureDetailResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerStructureDetailResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListStickerStructureDetails extends ListRecords
|
||||
{
|
||||
protected static string $resource = StickerStructureDetailResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerStructureDetailResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerStructureDetailResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewStickerStructureDetail extends ViewRecord
|
||||
{
|
||||
protected static string $resource = StickerStructureDetailResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
165
app/Filament/Resources/StickerValidationResource.php
Normal file
165
app/Filament/Resources/StickerValidationResource.php
Normal file
@@ -0,0 +1,165 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\StickerValidationResource\Pages;
|
||||
use App\Filament\Resources\StickerValidationResource\RelationManagers;
|
||||
use App\Models\Machine;
|
||||
use App\Models\StickerValidation;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class StickerValidationResource extends Resource
|
||||
{
|
||||
protected static ?string $model = StickerValidation::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Customized Sticker Printing';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Section::make('')
|
||||
->schema([
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->label('Plant')
|
||||
->reactive()
|
||||
->relationship('plant', 'name')
|
||||
->required(),
|
||||
Forms\Components\Select::make('machine_id')
|
||||
->label('Work Center')
|
||||
->required()
|
||||
->reactive()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
Forms\Components\TextInput::make('production_order')
|
||||
->label('Production Order')
|
||||
->reactive()
|
||||
->extraAttributes([
|
||||
'id' => 'production_order_input',
|
||||
'x-data' => '{ value: "" }',
|
||||
'x-model' => 'value',
|
||||
'wire:keydown.enter.prevent' => 'processProOrder(value)',
|
||||
]),
|
||||
Forms\Components\TextInput::make('serial_number')
|
||||
->label('Serial Number')
|
||||
->reactive()
|
||||
->extraAttributes([
|
||||
'id' => 'serial_number_input',
|
||||
'x-data' => '{ value: "" }',
|
||||
'x-model' => 'value',
|
||||
'wire:keydown.enter.prevent' => 'processSno(value)',
|
||||
]),
|
||||
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),
|
||||
])
|
||||
->columns(4),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('plant.code')
|
||||
->label('Plant')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('machine.work_center')
|
||||
->label('Work Center')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('production_order')
|
||||
->label('Production Order')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('serial_number')
|
||||
->label('Serial Number')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('status')
|
||||
->label('Status')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListStickerValidations::route('/'),
|
||||
'create' => Pages\CreateStickerValidation::route('/create'),
|
||||
'view' => Pages\ViewStickerValidation::route('/{record}'),
|
||||
'edit' => Pages\EditStickerValidation::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,336 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerValidationResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerValidationResource;
|
||||
use App\Models\Item;
|
||||
use App\Models\ItemCharacteristic;
|
||||
use App\Models\ProductionQuantity;
|
||||
use App\Models\StickerDetail;
|
||||
use App\Models\StickerMappingMaster;
|
||||
use App\Models\StickerStructureDetail;
|
||||
use App\Models\StickerValidation;
|
||||
use App\Services\StickerPdfService;
|
||||
use Filament\Actions;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateStickerValidation extends CreateRecord
|
||||
{
|
||||
protected static string $resource = StickerValidationResource::class;
|
||||
|
||||
protected static string $view = 'filament.resources.sticker-validation-resource.create-sticker-validation';
|
||||
|
||||
public $ref_number;
|
||||
|
||||
public $plantId;
|
||||
|
||||
public $workCenter;
|
||||
|
||||
public $serNo;
|
||||
|
||||
public function getFormActions(): array
|
||||
{
|
||||
return [
|
||||
$this->getCancelFormAction(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
|
||||
|
||||
public function processProOrder($value)
|
||||
{
|
||||
$plantId = $this->form->getState()['plant_id'];
|
||||
|
||||
$this->plantId = $plantId;
|
||||
|
||||
$this->ref_number = $value;
|
||||
|
||||
$this->dispatch('refreshEmptySticker', $plantId, $value);
|
||||
|
||||
$this->dispatch('focus-serial-number');
|
||||
}
|
||||
|
||||
public function processSno($serNo)
|
||||
{
|
||||
$plantId = $this->form->getState()['plant_id'];
|
||||
|
||||
$this->plantId = $plantId;
|
||||
|
||||
$workCenter = $this->form->getState()['machine_id'];
|
||||
|
||||
$this->workCenter = $workCenter;
|
||||
|
||||
$this->ref_number = $this->form->getState()['production_order'];
|
||||
|
||||
$this->serNo = $serNo;
|
||||
|
||||
$user = Filament::auth()->user();
|
||||
|
||||
$operatorName = $user->name;
|
||||
|
||||
if (! preg_match('/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})\|?$/', $this->serNo, $matches)) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Invalid Serial QR Format')
|
||||
->body('Scan valid Serial QR code proceed!<br>Sample formats are:<br>123456|1234567890123| OR 123456|1234567890123')
|
||||
->seconds(3)
|
||||
->send();
|
||||
|
||||
$this->dispatch('playWarnSound');
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $this->plantId,
|
||||
'machine_id' => $this->workCenter,
|
||||
'production_order' => $this->ref_number,
|
||||
'serial_number' => null,
|
||||
]);
|
||||
|
||||
$this->dispatch('focus-serial-number');
|
||||
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$itemCode = $matches[1];
|
||||
$serialNumber = $matches[2];
|
||||
|
||||
$recFound = ProductionQuantity::where('plant_id', $this->plantId)
|
||||
->where('production_order', $this->ref_number)
|
||||
->where('serial_number', $serialNumber)
|
||||
->first();
|
||||
|
||||
if(!$recFound){
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Unknown Serial Number')
|
||||
->body("Scanned serial number '$serialNumber' not found for the given plant and production order")
|
||||
->seconds(3)
|
||||
->send();
|
||||
$this->form->fill([
|
||||
'plant_id' => $this->plantId,
|
||||
'machine_id' => $this->workCenter,
|
||||
'production_order' => $this->ref_number,
|
||||
'serial_number' => null,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$duplicate = StickerValidation::where('plant_id', $this->plantId)
|
||||
->where('production_order', $this->ref_number)
|
||||
->where('serial_number', $serialNumber)
|
||||
->first();
|
||||
|
||||
if ($duplicate) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Duplicate Serial Number')
|
||||
->body("Serial number $serialNumber already exists for this plant and production order!")
|
||||
->seconds(3)
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $this->plantId,
|
||||
'machine_id' => $this->workCenter,
|
||||
'production_order' => $this->ref_number,
|
||||
'serial_number' => null,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$itemC = Item::where('code', $itemCode)
|
||||
->where('plant_id',$this->plantId)
|
||||
->first();
|
||||
|
||||
$itemId = $itemC->id;
|
||||
|
||||
$item = ItemCharacteristic::where('item_id', $itemId)
|
||||
->where('plant_id',$this->plantId)
|
||||
->first();
|
||||
|
||||
$itemI = $item->id;
|
||||
|
||||
$mapping = StickerMappingMaster::where('plant_id', $this->plantId)
|
||||
->where('item_characteristic_id', $itemI)
|
||||
->first();
|
||||
|
||||
if (!$mapping) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Sticker Mapping Not Found')
|
||||
->body("No sticker mapping found for this item and plant.")
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
|
||||
$stickers = [];
|
||||
|
||||
for ($i = 1; $i <= 8; $i++) {
|
||||
$machineColumn = "sticker{$i}_machine_id";
|
||||
$ipColumn = "sticker{$i}_print_ip";
|
||||
$stickerColumn = "sticker_structure{$i}_id";
|
||||
$itemColumn = "item_characteristic_id";
|
||||
|
||||
if (
|
||||
!empty($mapping->$machineColumn) &&
|
||||
!empty($mapping->$stickerColumn)
|
||||
) {
|
||||
$stickers[] = [
|
||||
'machine_id' => $mapping->$machineColumn,
|
||||
'sticker_id' => $mapping->$stickerColumn,
|
||||
'item_characteristic' => $mapping->$itemColumn,
|
||||
'print_ip' => $mapping->$ipColumn,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($stickers)) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('No Sticker Configuration Found')
|
||||
->body('No sticker and machine mappings configured for this item and plant.')
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
|
||||
StickerValidation::create([
|
||||
'plant_id' => $this->plantId,
|
||||
'machine_id' => $this->workCenter,
|
||||
'production_order' => $this->ref_number ?? null,
|
||||
'serial_number' => $serialNumber,
|
||||
'status' => 'Printed',
|
||||
// 'sticker_id' => $matchedSticker,
|
||||
'created_by' => $operatorName,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
Notification::make()
|
||||
->success()
|
||||
->title('Sticker Recorded')
|
||||
->body("Item: $itemCode, Serial: $serialNumber recorded successfully!")
|
||||
->seconds(3)
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $this->plantId,
|
||||
'machine_id' => $this->workCenter,
|
||||
'production_order' => $this->ref_number,
|
||||
'serial_number' => null,
|
||||
]);
|
||||
|
||||
$this->dispatch('refreshEmptySticker', $plantId, $this->ref_number);
|
||||
|
||||
foreach ($stickers as $sticker)
|
||||
{
|
||||
|
||||
\Log::info("Looking up printer for IP: " . $sticker['print_ip']);
|
||||
|
||||
$printerName = $this->getCupsPrinterNameByIp($sticker['print_ip']);
|
||||
|
||||
\Log::info("Found printer: " . ($printerName ?? 'NULL'));
|
||||
|
||||
if (! $printerName) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Printer Not Found')
|
||||
->body("No CUPS printer configured for IP: {$sticker['print_ip']}")
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
|
||||
$structure = StickerStructureDetail::findOrFail($sticker['sticker_id']);
|
||||
|
||||
$itemCharacteristic = ItemCharacteristic::where('plant_id', $this->plantId)
|
||||
->where('id', $sticker['item_characteristic'])
|
||||
->firstOrFail();
|
||||
|
||||
$dynamicElements = StickerDetail::where(
|
||||
'sticker_structure_detail_id',
|
||||
$structure->id
|
||||
)->where('element_type', 'Dynamic')->get();
|
||||
|
||||
$pdfContent = (new StickerPdfService())->generatePdf1(
|
||||
$structure->sticker_id,
|
||||
$dynamicElements,
|
||||
$itemCharacteristic,
|
||||
$serialNumber,
|
||||
$serNo
|
||||
);
|
||||
|
||||
$tempPdfPath = storage_path('app/temp_sticker_' . uniqid() . '.pdf');
|
||||
file_put_contents($tempPdfPath, $pdfContent);
|
||||
|
||||
exec(
|
||||
"lp -d " . escapeshellarg($printerName) . " " . escapeshellarg($tempPdfPath),
|
||||
$output,
|
||||
$status
|
||||
);
|
||||
|
||||
\Log::info("LP Output:", $output);
|
||||
\Log::info("LP Status: " . $status);
|
||||
|
||||
if ($status != 0) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Print Failed')
|
||||
->body("CUPS error while printing.")
|
||||
->send();
|
||||
|
||||
if (file_exists($tempPdfPath)) {
|
||||
unlink($tempPdfPath);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (file_exists($tempPdfPath)) {
|
||||
unlink($tempPdfPath);
|
||||
}
|
||||
}
|
||||
|
||||
Notification::make()
|
||||
->success()
|
||||
->title('Sticker Printed')
|
||||
->body("Sticker for Serial Number: $serialNumber printed successfully!")
|
||||
->seconds(3)
|
||||
->send();
|
||||
|
||||
// [$itemCode, $serialNumber] = explode('|', $serNo);
|
||||
|
||||
// $this->dispatch('open-sticker-pdf', [
|
||||
// 'url' => url("/sticker/pdf/{$itemCode}/{$serialNumber}/$this->plantId/$this->ref_number")
|
||||
// ]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected function getCupsPrinterNameByIp(string $ip): ?string
|
||||
{
|
||||
|
||||
exec('lpstat -v 2>&1', $output, $status); //locak
|
||||
|
||||
// exec('lpstat -h cups:631 -v 2>&1', $output, $status);
|
||||
|
||||
if ($status != 0 || empty($output)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach ($output as $line){
|
||||
$parts = explode(':', $line, 2);
|
||||
if (count($parts) < 2) continue;
|
||||
|
||||
$printerName = trim(str_replace('device for', '', $parts[0]));
|
||||
$deviceUri = trim($parts[1]);
|
||||
|
||||
if (str_contains($deviceUri, $ip)) {
|
||||
return $printerName;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerValidationResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerValidationResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditStickerValidation extends EditRecord
|
||||
{
|
||||
protected static string $resource = StickerValidationResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerValidationResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerValidationResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListStickerValidations extends ListRecords
|
||||
{
|
||||
protected static string $resource = StickerValidationResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerValidationResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerValidationResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewStickerValidation extends ViewRecord
|
||||
{
|
||||
protected static string $resource = StickerValidationResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ use App\Filament\Resources\VisitorEntryResource\Pages;
|
||||
use App\Filament\Resources\VisitorEntryResource\RelationManagers;
|
||||
use App\Models\VisitorEntry;
|
||||
use App\Models\EmployeeMaster;
|
||||
use App\Models\DealerVisitPlan;
|
||||
use App\Models\Plant;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
@@ -28,6 +29,7 @@ use Filament\Tables\Filters\Filter;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Radio;
|
||||
|
||||
class VisitorEntryResource extends Resource
|
||||
{
|
||||
@@ -95,11 +97,13 @@ class VisitorEntryResource extends Resource
|
||||
$set('mobile_number', $employeeExist->mobile_number);
|
||||
$set('company', $plant->name);
|
||||
$set('type', 'InterUnitStaff');
|
||||
$set('dealer', null);
|
||||
} else {
|
||||
$set('name', null);
|
||||
$set('mobile_number', null);
|
||||
$set('company', null);
|
||||
$set('type', null);
|
||||
$set('dealer', null);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -109,6 +113,92 @@ class VisitorEntryResource extends Resource
|
||||
$set('company', null);
|
||||
$set('type', null);
|
||||
|
||||
}
|
||||
}),
|
||||
Forms\Components\Select::make('dealer')
|
||||
->label('Dealer Visit')
|
||||
->options(
|
||||
DealerVisitPlan::where('status', 'Planned')
|
||||
->whereDate('visit_plan_date', today())
|
||||
->select('organizer', 'company', 'name')
|
||||
->distinct()
|
||||
->orderBy('organizer')
|
||||
->get()
|
||||
->mapWithKeys(function ($dealer) {
|
||||
$key = "{$dealer->organizer}|{$dealer->company}|{$dealer->name}";
|
||||
|
||||
return [
|
||||
$key => "{$dealer->organizer} ({$dealer->company}) ({$dealer->name})"
|
||||
];
|
||||
})
|
||||
)
|
||||
->searchable()
|
||||
->reactive()
|
||||
->afterStateUpdated(function (callable $set, callable $get, $state) {
|
||||
|
||||
if(!$state){
|
||||
$set('name', null);
|
||||
$set('inter_unit', null);
|
||||
$set('company', null);
|
||||
$set('type', null);
|
||||
$set('number_of_person', null);
|
||||
$set('purpose_of_visit', null);
|
||||
$set('department', null);
|
||||
$set('employee_master_id', null);
|
||||
return;
|
||||
}
|
||||
|
||||
[$organizer, $company, $name] = explode('|', $state);
|
||||
|
||||
|
||||
$dealer = DealerVisitPlan::where('organizer', $organizer)
|
||||
->where('company', $company)
|
||||
->where('name', $name)
|
||||
->where('status', 'Planned')
|
||||
->whereDate('visit_plan_date', today())
|
||||
->first();
|
||||
|
||||
if($dealer){
|
||||
|
||||
$organizerExist = DealerVisitPlan::where('organizer', $organizer)->where('name', $name)->where('company', $company)->latest()->first();
|
||||
|
||||
$empDepart = EmployeeMaster::where('id', $dealer->employee_master_id)->first();
|
||||
|
||||
if ($organizerExist) {
|
||||
$set('name', $organizerExist->name);
|
||||
$set('company', $organizerExist->company);
|
||||
$set('number_of_person', $organizerExist->number_of_person);
|
||||
$set('purpose_of_visit', $organizerExist->purpose_of_visit);
|
||||
$set('type', 'Dealers');
|
||||
$set('department', $empDepart->department);
|
||||
$set('organizer', $organizerExist->organizer);
|
||||
$set('inter_unit', null);
|
||||
$set('mobile_number', $organizerExist->mobile_number);
|
||||
$set('mode_of_travel', $organizerExist->mode_of_travel);
|
||||
} else {
|
||||
$set('name', null);
|
||||
$set('mobile_number', null);
|
||||
$set('inter_unit', null);
|
||||
$set('company', null);
|
||||
$set('type', null);
|
||||
$set('number_of_person', null);
|
||||
$set('purpose_of_visit', null);
|
||||
$set('department', null);
|
||||
// $set('employee_master_id', null);
|
||||
$set('code', null);
|
||||
$set('mode_of_travel', null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$set('name', null);
|
||||
$set('company', null);
|
||||
$set('type', null);
|
||||
$set('number_of_person', null);
|
||||
$set('purpose_of_visit', null);
|
||||
$set('mode_of_travel', null);
|
||||
$set('mobile_number', null);
|
||||
|
||||
}
|
||||
}),
|
||||
Forms\Components\TextInput::make('mobile_number')
|
||||
@@ -148,7 +238,8 @@ class VisitorEntryResource extends Resource
|
||||
'Supplier' => 'Supplier',
|
||||
'InterUnitStaff' => 'Inter Unit Staff',
|
||||
'InterviewCandidates' => 'Interview Candidates',
|
||||
'Customers/Dealers' => 'Customers/Dealers',
|
||||
'Customers' => 'Customers',
|
||||
'Dealers' => 'Dealers',
|
||||
'Bankers' => 'Bankers',
|
||||
'ServiceProviders' => 'Service Providers',
|
||||
'GovermentOfficials' => 'Government Officials',
|
||||
@@ -271,6 +362,8 @@ class VisitorEntryResource extends Resource
|
||||
->validationMessages([
|
||||
'after' => 'Valid Upto must be after the In Time.',
|
||||
]),
|
||||
Forms\Components\Hidden::make('organizer')
|
||||
->label('Organizer'),
|
||||
Forms\Components\View::make('components.webcam-field')
|
||||
->columnSpanFull(),
|
||||
Forms\Components\Hidden::make('photo'),
|
||||
@@ -317,8 +410,13 @@ class VisitorEntryResource extends Resource
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('organizer')
|
||||
->label('Organizer')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('mobile_number')
|
||||
->label('Visitor Mobile Number')
|
||||
->label('Mobile Number')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->searchable()
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
namespace App\Filament\Resources\VisitorEntryResource\Pages;
|
||||
|
||||
use App\Filament\Resources\VisitorEntryResource;
|
||||
use App\Models\DealerVisitPlan;
|
||||
use App\Models\EmployeeMaster;
|
||||
use App\Models\VisitorEntry;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Actions;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
@@ -139,6 +141,18 @@ class CreateVisitorEntry extends CreateRecord
|
||||
else{
|
||||
\Log::warning('No email found for employee ID: ' . $visitor->employee_master_id);
|
||||
}
|
||||
|
||||
|
||||
if ($visitor->type == 'Dealers') {
|
||||
DealerVisitPlan::where('name', $visitor->name)
|
||||
->where('company', $visitor->company)
|
||||
->where('mobile_number', $visitor->mobile_number)
|
||||
->whereDate('visit_plan_date', today())
|
||||
->where('status', 'Planned')
|
||||
->update([
|
||||
'status' => 'Completed',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
|
||||
@@ -276,6 +276,123 @@ class StickerMasterController extends Controller
|
||||
return response()->json($output, 200);
|
||||
}
|
||||
|
||||
public function get_quality_master(Request $request)
|
||||
{
|
||||
$expectedUser = env('API_AUTH_USER');
|
||||
$expectedPw = env('API_AUTH_PW');
|
||||
$header_auth = $request->header('Authorization');
|
||||
$expectedToken = $expectedUser.':'.$expectedPw;
|
||||
|
||||
if ('Bearer '.$expectedToken != $header_auth) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid authorization token!',
|
||||
], 403);
|
||||
}
|
||||
|
||||
$plantCode = $request->header('plant-code');
|
||||
$itemCode = $request->header('item-code');
|
||||
|
||||
if ($plantCode == null || $plantCode == '') {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Plant code can't be empty!",
|
||||
], 400);
|
||||
} elseif (! is_numeric($plantCode)) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Plant code should contain only numeric values!',
|
||||
], 400);
|
||||
} elseif (Str::length($plantCode) < 4 || Str::length($plantCode) > 7) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Plant code must be between 4 and 7 digits only!',
|
||||
], 400);
|
||||
} elseif (! preg_match('/^[1-9]\d{3,6}$/', $plantCode)) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid plant code found!',
|
||||
], 400);
|
||||
} elseif ($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!',
|
||||
], 400);
|
||||
}
|
||||
|
||||
$plant = Plant::where('code', $plantCode)->first();
|
||||
|
||||
if (! $plant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Plant Code not found!',
|
||||
], 400);
|
||||
}
|
||||
|
||||
$plantId = $plant->id;
|
||||
|
||||
$item = Item::where('code', $itemCode)->first();
|
||||
|
||||
if (! $item) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Item Code not found in item table!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
$item = Item::where('plant_id', $plantId)->where('code', $itemCode)->first();
|
||||
|
||||
if (! $item) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item Code not found for the plant : '$plant->name' in item table!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$itemId = $item->id;
|
||||
|
||||
$description = $item ? $item->description : '';
|
||||
|
||||
$uom = $item ? $item->uom : '';
|
||||
|
||||
// $category = $item ? $item->category : '';
|
||||
|
||||
$stickerMaster = StickerMaster::where('item_id', $itemId)->first();
|
||||
|
||||
if (! $stickerMaster) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Item Code not found in sticker master table!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
$stickerMaster = StickerMaster::where('plant_id', $plantId)->where('item_id', $itemId)->first();
|
||||
|
||||
if (! $stickerMaster) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item Code not found for the plant : '$plant->name' in sticker master table!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$output = [
|
||||
'item_description' => $description ?? '',
|
||||
'uom' => $uom ?? '',
|
||||
'Part_Validation_1' => $stickerMaster?->part_validation1 ?? '',
|
||||
'Part_Validation_2' => $stickerMaster?->part_validation2 ?? '',
|
||||
'Part_Validation_3' => $stickerMaster?->part_validation3 ?? '',
|
||||
'Part_Validation_4' => $stickerMaster?->part_validation4 ?? '',
|
||||
'Part_Validation_5' => $stickerMaster?->part_validation5 ?? '',
|
||||
];
|
||||
|
||||
return response()->json($output, 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\BeforeTestReading;
|
||||
use App\Models\Item;
|
||||
use App\Models\LeakTestReading;
|
||||
use App\Models\Machine;
|
||||
@@ -66,6 +67,7 @@ class TestingPanelController extends Controller
|
||||
}
|
||||
|
||||
$plantId = $plant->id;
|
||||
$plantName = $plant->name;
|
||||
|
||||
if ($data['line_name'] == null || $data['line_name'] == '') {
|
||||
return response()->json([
|
||||
@@ -203,12 +205,12 @@ class TestingPanelController extends Controller
|
||||
|
||||
if (! empty($uniqueInvalidCodes)) {
|
||||
|
||||
// return response("Item codes : ". implode(', ', $uniqueInvalidCodes)." not found in motor testing master for the specified plant {$plant->name}", 400)
|
||||
// return response("Item codes : ". implode(', ', $uniqueInvalidCodes)." not found in motor testing master for the specified plant {$plantName}", 400)
|
||||
// ->header('Content-Type', 'text/plain');
|
||||
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Item codes : '.implode(', ', $uniqueInvalidCodes)." not found in master for the specified plant : '{$plant->name}'!",
|
||||
'status_description' => 'Item codes : '.implode(', ', $uniqueInvalidCodes)." not found in master for the specified plant : '{$plantName}'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
@@ -660,6 +662,257 @@ class TestingPanelController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created before test status in storage.
|
||||
*/
|
||||
public function storeBeforeTestStatus(Request $request)
|
||||
{
|
||||
$expectedUser = env('API_AUTH_USER');
|
||||
$expectedPw = env('API_AUTH_PW');
|
||||
|
||||
$header_auth = $request->header('Authorization');
|
||||
$expectedToken = $expectedUser.':'.$expectedPw;
|
||||
|
||||
if ('Bearer '.$expectedToken != $header_auth) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid authorization token!',
|
||||
], 403);
|
||||
}
|
||||
|
||||
$data = $request->all();
|
||||
|
||||
if ($data['plant_code'] == null || $data['plant_code'] == '') {
|
||||
// return response("ERROR: Please provide a valid plant code.", 400)
|
||||
// ->header('Content-Type', 'text/plain');
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Plant code can't be empty!",
|
||||
], 404);
|
||||
} elseif (Str::length($data['plant_code']) < 4 || ! is_numeric($data['plant_code']) || ! preg_match('/^[1-9]\d{3,}$/', $data['plant_code'])) {// !ctype_digit($data['plant_code'])
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid plant code found!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
$plant = Plant::where('code', $data['plant_code'])->first();
|
||||
if (! $plant) {
|
||||
// return response("Plant not found.", 400)->header('Content-Type', 'text/plain');
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Plant not found!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
$plantId = $plant->id;
|
||||
$plantName = $plant->name;
|
||||
|
||||
if ($data['line_name'] == null || $data['line_name'] == '') {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Group work center can't be empty!",
|
||||
], 404);
|
||||
} elseif (Str::length($data['line_name']) < 0) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid group work center found!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
$gWorkCenter = WorkGroupMaster::where('name', $data['line_name'])->first();
|
||||
if (! $gWorkCenter) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Group work center not found!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
$gWorkCenter = WorkGroupMaster::where('name', $data['line_name'])->where('plant_id', $plantId)->first();
|
||||
if (! $gWorkCenter) {
|
||||
// return response( "Line not found for the specified plant : {$data['plant_code']}",400)->header('Content-Type', 'text/plain');
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Group work center not found for the specified plant : '{$data['plant_code']}'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$gWorkCenterId = $gWorkCenter->id;
|
||||
|
||||
if ($data['machine_name'] == null || $data['machine_name'] == '') {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Work center can't be empty!",
|
||||
], 404);
|
||||
} elseif (Str::length($data['machine_name']) < 0) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid work center found!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
$machine = Machine::where('work_center', $data['machine_name'])->first();
|
||||
if (! $machine) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Work center not found!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
$machine = Machine::where('work_center', $data['machine_name'])->where('plant_id', $plantId)->first();
|
||||
if (! $machine) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Work center not found for the specified plant : '{$data['plant_code']}'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$machine = Machine::where('work_center', $data['machine_name'])->where('work_group_master_id', $gWorkCenterId)->first();
|
||||
if (! $machine) {
|
||||
// return response("Machine not found for the specified line : {$data['line_name']}", 400)->header('Content-Type', 'text/plain');
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Work center not found for the specified Group work center : '{$data['line_name']}'!",
|
||||
], 404);
|
||||
|
||||
}
|
||||
|
||||
$machine = Machine::where('work_center', $data['machine_name'])->where('plant_id', $plantId)->where('work_group_master_id', $gWorkCenterId)->first();
|
||||
if (! $machine) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Work center not found for the specified Plant : '{$data['plant_code']}' and Group work center : '{$data['line_name']}'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$lineId = $machine->line_id;
|
||||
$machineId = $machine->id;
|
||||
|
||||
try {
|
||||
$insertedSerials = [];
|
||||
$missedItemCodes = [];
|
||||
$duplicateItemCodes = [];
|
||||
$existSnoCount = [];
|
||||
|
||||
if (! empty($data['item_codes']) && is_array($data['item_codes'])) {
|
||||
foreach ($data['item_codes'] as $item) {
|
||||
$code = $item['item_code'] ?? null;
|
||||
|
||||
// Check if item_code is present
|
||||
if ($code == '' || $code == null) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item code can't be empty!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
// Collect duplicates
|
||||
if (isset($itemCodeCounts[$code])) {
|
||||
$itemCodeCounts[$code]++;
|
||||
// Only add to duplicates array once
|
||||
if ($itemCodeCounts[$code] == 2) {
|
||||
$duplicateItemCodes[] = $code;
|
||||
}
|
||||
} else {
|
||||
$itemCodeCounts[$code] = 1;
|
||||
}
|
||||
|
||||
$motorTestingMaster = MotorTestingMaster::whereHas('item', function ($query) use ($item) {
|
||||
$query->where('code', $item['item_code']);
|
||||
})->where('plant_id', $plantId)->first();
|
||||
|
||||
if (! $motorTestingMaster) {
|
||||
$missedItemCodes[] = $item['item_code'];
|
||||
}
|
||||
|
||||
if (! empty($item['serial_numbers']) && is_array($item['serial_numbers'])) {
|
||||
foreach ($item['serial_numbers'] as $serial) {
|
||||
$existSnoCount[] = $serial['serial_number'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If any duplicates found, return error
|
||||
if (! empty($duplicateItemCodes)) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Duplicate item codes found in request: '.implode(', ', $duplicateItemCodes),
|
||||
], 404);
|
||||
}
|
||||
|
||||
$uniqueInvalidCodes = array_unique($missedItemCodes);
|
||||
|
||||
if (! empty($uniqueInvalidCodes)) {
|
||||
|
||||
// return response("Item codes : ". implode(', ', $uniqueInvalidCodes)." not found in motor testing master for the specified plant {$plantName}", 400)
|
||||
// ->header('Content-Type', 'text/plain');
|
||||
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Item codes : '.implode(', ', $uniqueInvalidCodes)." not found in master for the specified plant : '{$plantName}'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$insertedSnoCount = [];
|
||||
|
||||
foreach ($data['item_codes'] as $item) {
|
||||
|
||||
$motorTestingMaster = MotorTestingMaster::whereHas('item', callback: function ($query) use ($item) {
|
||||
$query->where('code', $item['item_code']);
|
||||
})->where('plant_id', $plantId)->first();
|
||||
|
||||
$motorTestingMasterId = $motorTestingMaster->id;
|
||||
|
||||
if (! empty($item['serial_numbers']) && is_array($item['serial_numbers'])) {
|
||||
foreach ($item['serial_numbers'] as $serial) {
|
||||
|
||||
$row = [
|
||||
'plant_id' => $plantId,
|
||||
'line_id' => $lineId,
|
||||
'machine_id' => $machineId,
|
||||
'motor_testing_master_id' => $motorTestingMasterId,
|
||||
'serial_number' => $serial['serial_number'] ?? null,
|
||||
'before_fr_res_ry' => $serial['before_fr_res_ry'] ?? null,
|
||||
'before_fr_res_yb' => $serial['before_fr_res_yb'] ?? null,
|
||||
'before_fr_res_br' => $serial['before_fr_res_br'] ?? null,
|
||||
'before_fr_ir' => $serial['before_fr_ir'] ?? null,
|
||||
'tested_by' => (($serial['tested_by'] == 'jothi') ? 'Admin' : $serial['tested_by']) ?? null,
|
||||
'scanned_at' => $serial['scanned_at'] ?? now(),
|
||||
];
|
||||
|
||||
// Insert the new record
|
||||
BeforeTestReading::create($row);
|
||||
$insertedSerials[] = $serial['serial_number'] ?? '[unknown]';
|
||||
$insertedSnoCount[] = $serial['serial_number'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($insertedSerials)) {
|
||||
if (count($existSnoCount) == count($insertedSnoCount)) {
|
||||
return response()->json([
|
||||
'status_code' => 'SUCCESS',
|
||||
'status_description' => 'Inserted before test serial numbers are: '.implode(', ', $insertedSerials),
|
||||
], 200);
|
||||
} else {
|
||||
$missingSno = array_diff($existSnoCount, $insertedSnoCount);
|
||||
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Missed before test serial numbers are: '.implode(', ', $missingSno),
|
||||
], 404);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
// return response($e->getMessage(), 500)->header('Content-Type', 'text/plain');
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Store testing panel before test readings internal server error : '.$e?->getCode(),
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
@@ -726,6 +979,7 @@ class TestingPanelController extends Controller
|
||||
}
|
||||
|
||||
$plantId = $plant->id;
|
||||
$plantName = $plant->name;
|
||||
|
||||
$item = Item::where('code', $itemCode)->first();
|
||||
|
||||
@@ -741,7 +995,7 @@ class TestingPanelController extends Controller
|
||||
if (! $item) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item code not found in item table for the plant : '$plant->name'!",
|
||||
'status_description' => "Item code not found in item table for the plant : '$plantName'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
@@ -765,7 +1019,7 @@ class TestingPanelController extends Controller
|
||||
if (! $motorTestingMaster) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item code not found in motor testing master table for the plant : '$plant->name'!",
|
||||
'status_description' => "Item code not found in motor testing master table for the plant : '$plantName'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ public $records = [];
|
||||
|
||||
public $showChecklist = false;
|
||||
|
||||
public bool $selectForNotOk = false;
|
||||
|
||||
// public $skipChecklistValidation = false;
|
||||
|
||||
// protected $listeners = ['focus-item-id' => 'handleFocus', 'trigger-create' => 'doCreate',];
|
||||
@@ -66,6 +68,8 @@ public $records = [];
|
||||
|
||||
public function saveChecklist()
|
||||
{
|
||||
|
||||
|
||||
if (empty($this->checklist) || count($this->checklist) != count($this->records)) {
|
||||
Notification::make()
|
||||
->title('Incomplete Checklist')
|
||||
@@ -116,6 +120,61 @@ public $records = [];
|
||||
return;
|
||||
}
|
||||
|
||||
if(!$this->selectForNotOk){
|
||||
|
||||
// First validate all checklist values
|
||||
foreach ($this->checklist as $characteristicId => $value) {
|
||||
|
||||
$characteristic = ProductCharacteristicsMaster::find($characteristicId);
|
||||
|
||||
$itemCharacteristic = ProductCharacteristicsMaster::where('plant_id', $this->data['plant_id'])
|
||||
->where('line_id', $this->data['line_id'])
|
||||
->where('name', $characteristic->name)
|
||||
->where('item_id', $itemId)
|
||||
->first();
|
||||
|
||||
if (!$itemCharacteristic) {
|
||||
Notification::make()
|
||||
->title('Characteristic Not Found')
|
||||
->body("Characteristic '{$characteristic?->name}' was not found.")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($itemCharacteristic->inspection_type == 'Value') {
|
||||
|
||||
if (
|
||||
!is_numeric($value) ||
|
||||
$value < $itemCharacteristic->lower ||
|
||||
$value > $itemCharacteristic->upper
|
||||
) {
|
||||
Notification::make()
|
||||
->title('Invalid Value Selected')
|
||||
->body("'{$characteristic->name}' must be between {$itemCharacteristic->lower} and {$itemCharacteristic->upper}.")
|
||||
->danger()
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
// Visual inspection must always be OK
|
||||
if (strtolower(trim($value)) != 'ok') {
|
||||
|
||||
Notification::make()
|
||||
->title('Inspection Failed')
|
||||
->body("You selected 'NotOk' for '{$characteristic->name}'. Please select 'OK' to continue.")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$qualityValidation = PanelBoxValidation::create([
|
||||
'plant_id' => $this->data['plant_id'] ?? null,
|
||||
'line_id' => $this->data['line_id'] ?? null,
|
||||
@@ -132,7 +191,12 @@ public $records = [];
|
||||
'part_validation3' => $this->data['part_validation3'] ?? null,
|
||||
'part_validation4' => $this->data['part_validation4'] ?? null,
|
||||
'part_validation5' => $this->data['part_validation5'] ?? null,
|
||||
'panel_box_supplier' => $this->data['panel_box_supplier'] ?? null,
|
||||
'panel_box_serial_number' => $this->data['panel_box_serial_number'] ?? null,
|
||||
'panel_box_code' => $this->data['panel_box_code'] ?? null,
|
||||
'inspection_lot_number' => $this->data['inspection_lot_number'] ?? null,
|
||||
'created_by' => $this->data['created_by'] ?? null,
|
||||
'updated_by' => $this->data['updated_by'] ?? null,
|
||||
]);
|
||||
|
||||
if (! $qualityValidation || ! $qualityValidation->exists) {
|
||||
@@ -145,56 +209,93 @@ public $records = [];
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($this->checklist as $characteristicId => $value) {
|
||||
if($this->selectForNotOk){
|
||||
|
||||
// $status = 'Ok';
|
||||
foreach ($this->checklist as $characteristicId => $value) {
|
||||
|
||||
$characteristic = ProductCharacteristicsMaster::find($characteristicId);
|
||||
|
||||
$itemCharacteristic = ProductCharacteristicsMaster::where('plant_id', $this->data['plant_id'])
|
||||
->where('line_id', $this->data['line_id'])
|
||||
->where('name', $characteristic->name)
|
||||
->where('item_id', $itemId)
|
||||
->first();
|
||||
$characteristic = ProductCharacteristicsMaster::find($characteristicId);
|
||||
|
||||
// if (($characteristic?->inspection_type ?? null) === 'Value') {
|
||||
// if ($characteristic && is_numeric($value) && (($value >= $characteristic->lower && $value <= $characteristic->upper) || $value == $characteristic->lower || $value == $characteristic->upper)
|
||||
// ) {
|
||||
// $status = 'Ok';
|
||||
// } else {
|
||||
// $status = 'NotOk';
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// $status = $value;
|
||||
// }
|
||||
$itemCharacteristic = ProductCharacteristicsMaster::where('plant_id', $this->data['plant_id'])
|
||||
->where('line_id', $this->data['line_id'])
|
||||
->where('name', $characteristic->name)
|
||||
->where('item_id', $itemId)
|
||||
->first();
|
||||
|
||||
if (($itemCharacteristic?->inspection_type ?? null) === 'Value') {
|
||||
if (($itemCharacteristic?->inspection_type ?? null) === 'Value') {
|
||||
|
||||
if ($itemCharacteristic && is_numeric($value) && $value >= $itemCharacteristic->lower && $value <= $itemCharacteristic->upper
|
||||
) {
|
||||
$status = 'Ok';
|
||||
} else {
|
||||
$status = 'NotOk';
|
||||
if ($itemCharacteristic && is_numeric($value) && $value >= $itemCharacteristic->lower && $value <= $itemCharacteristic->upper
|
||||
) {
|
||||
$status = 'Ok';
|
||||
} else {
|
||||
$status = 'NotOk';
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$status = $value;
|
||||
else {
|
||||
$status = $value;
|
||||
}
|
||||
|
||||
$prod = ProductionCharacteristic::create([
|
||||
'plant_id' => $this->data['plant_id'] ?? null,
|
||||
'item_id' => $itemId ?? null,
|
||||
'line_id' => $this->data['line_id'] ?? null,
|
||||
'machine_id' => $characteristic?->machine_id ?? null,
|
||||
'production_order' => $this->data['production_order'] ?? null,
|
||||
'serial_number' => $this->data['serial_number'] ?? null,
|
||||
'characteristic_name' => $characteristic?->name ?? null,
|
||||
'observed_value' => $value ?? null,
|
||||
'status' => $status,
|
||||
'inspection_status' => $finalInspectionStatus ?? null,
|
||||
'inspection_lot_number' => $this->data['inspection_lot_number'] ?? null,
|
||||
'created_by' => $this->data['created_by'] ?? null,
|
||||
'updated_by' => $this->data['updated_by'] ?? null,
|
||||
]);
|
||||
}
|
||||
|
||||
$prod = ProductionCharacteristic::create([
|
||||
'plant_id' => $this->data['plant_id'] ?? null,
|
||||
'item_id' => $itemId ?? null,
|
||||
'line_id' => $this->data['line_id'] ?? null,
|
||||
'machine_id' => $characteristic?->machine_id ?? null,
|
||||
'production_order' => $this->data['production_order'] ?? null,
|
||||
'serial_number' => $this->data['serial_number'] ?? null,
|
||||
'characteristic_name' => $characteristic?->name ?? null,
|
||||
'observed_value' => $value ?? null,
|
||||
'status' => $status,
|
||||
'inspection_status' => $finalInspectionStatus ?? null,
|
||||
'created_by' => $this->data['operator_id'] ?? null,
|
||||
]);
|
||||
}
|
||||
else {
|
||||
|
||||
//All validations Passed
|
||||
foreach ($this->checklist as $characteristicId => $value) {
|
||||
|
||||
|
||||
$characteristic = ProductCharacteristicsMaster::find($characteristicId);
|
||||
|
||||
$itemCharacteristic = ProductCharacteristicsMaster::where('plant_id', $this->data['plant_id'])
|
||||
->where('line_id', $this->data['line_id'])
|
||||
->where('name', $characteristic->name)
|
||||
->where('item_id', $itemId)
|
||||
->first();
|
||||
|
||||
if (($itemCharacteristic?->inspection_type ?? null) === 'Value') {
|
||||
|
||||
if ($itemCharacteristic && is_numeric($value) && $value >= $itemCharacteristic->lower && $value <= $itemCharacteristic->upper
|
||||
) {
|
||||
$status = 'Ok';
|
||||
} else {
|
||||
$status = 'NotOk';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$status = $value;
|
||||
}
|
||||
|
||||
$prod = ProductionCharacteristic::create([
|
||||
'plant_id' => $this->data['plant_id'] ?? null,
|
||||
'item_id' => $itemId ?? null,
|
||||
'line_id' => $this->data['line_id'] ?? null,
|
||||
'machine_id' => $characteristic?->machine_id ?? null,
|
||||
'production_order' => $this->data['production_order'] ?? null,
|
||||
'serial_number' => $this->data['serial_number'] ?? null,
|
||||
'characteristic_name' => $characteristic?->name ?? null,
|
||||
'observed_value' => $value ?? null,
|
||||
'status' => $status,
|
||||
'inspection_status' => $finalInspectionStatus ?? null,
|
||||
'inspection_lot_number' => $this->data['inspection_lot_number'] ?? null,
|
||||
'created_by' => $this->data['created_by'] ?? null,
|
||||
'updated_by' => $this->data['updated_by'] ?? null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
if (! $prod) {
|
||||
|
||||
@@ -18,6 +18,7 @@ class AlertMailRule extends Model
|
||||
'email',
|
||||
'cc_emails',
|
||||
'schedule_type',
|
||||
'machine_id',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'created_by',
|
||||
@@ -29,4 +30,10 @@ class AlertMailRule extends Model
|
||||
return $this->belongsTo(InvoiceMaster::class);
|
||||
//return $this->belongsTo(InvoiceMaster::class, 'invoice_master_id');
|
||||
}
|
||||
|
||||
public function machine(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Machine::class);
|
||||
//return $this->belongsTo(InvoiceMaster::class, 'invoice_master_id');
|
||||
}
|
||||
}
|
||||
|
||||
54
app/Models/BeforeTestReading.php
Normal file
54
app/Models/BeforeTestReading.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class BeforeTestReading extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'plant_id',
|
||||
'line_id',
|
||||
'motor_testing_master_id',
|
||||
'machine_id',
|
||||
'serial_number',
|
||||
'before_fr_res_ry',
|
||||
'before_fr_res_yb',
|
||||
'before_fr_res_br',
|
||||
'before_fr_ir',
|
||||
'tested_by',
|
||||
'updated_by',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'scanned_at',
|
||||
];
|
||||
|
||||
public function plant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Plant::class);
|
||||
}
|
||||
|
||||
public function line(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Line::class);
|
||||
}
|
||||
|
||||
public function machine(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Machine::class);
|
||||
}
|
||||
|
||||
public function item(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Item::class);
|
||||
}
|
||||
|
||||
public function motorTestingMaster()
|
||||
{
|
||||
return $this->belongsTo(MotorTestingMaster::class);
|
||||
}
|
||||
}
|
||||
33
app/Models/DealerVisitPlan.php
Normal file
33
app/Models/DealerVisitPlan.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class DealerVisitPlan extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'employee_master_id',
|
||||
'name',
|
||||
'company',
|
||||
'visit_plan_date',
|
||||
'organizer',
|
||||
'mobile_number',
|
||||
'number_of_person',
|
||||
'purpose_of_visit',
|
||||
'mode_of_travel',
|
||||
'status',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
public function employeeMaster(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(EmployeeMaster::class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -108,5 +108,4 @@ class Item extends Model
|
||||
{
|
||||
return $this->hasMany(PanelGrMaster::class, 'item_id', 'id');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
176
app/Models/ItemCharacteristic.php
Normal file
176
app/Models/ItemCharacteristic.php
Normal file
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class ItemCharacteristic extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'plant_id',
|
||||
'item_id',
|
||||
'class',
|
||||
'zz1_cn_bill_ord',
|
||||
'zmm_amps',
|
||||
'zmm_brand',
|
||||
'zmm_degreeofprotection',
|
||||
'zmm_delivery',
|
||||
'zmm_dir_rot',
|
||||
'zmm_discharge',
|
||||
'zmm_discharge_max',
|
||||
'zmm_discharge_min',
|
||||
'zmm_duty',
|
||||
'zmm_eff_motor',
|
||||
'zmm_eff_pump',
|
||||
'zmm_frequency',
|
||||
'zmm_head',
|
||||
'zmm_heading',
|
||||
'zmm_head_max',
|
||||
'zmm_head_minimum',
|
||||
'zmm_idx_eff_mtr',
|
||||
'zmm_idx_eff_pump',
|
||||
'zmm_kvacode',
|
||||
'zmm_maxambtemp',
|
||||
'zmm_mincoolingflow',
|
||||
'zmm_motorseries',
|
||||
'zmm_motor_model',
|
||||
'zmm_outlet',
|
||||
'zmm_phase',
|
||||
'zmm_pressure',
|
||||
'zmm_pumpflowtype',
|
||||
'zmm_pumpseries',
|
||||
'zmm_pump_model',
|
||||
'zmm_ratedpower',
|
||||
'zmm_region',
|
||||
'zmm_servicefactor',
|
||||
'zmm_servicefactormaximumamps',
|
||||
'zmm_speed',
|
||||
'zmm_suction',
|
||||
'zmm_suctionxdelivery',
|
||||
'zmm_supplysource',
|
||||
'zmm_temperature',
|
||||
'zmm_thrustload',
|
||||
'zmm_volts',
|
||||
'zmm_wire',
|
||||
'zmm_package',
|
||||
'zmm_pvarrayrating',
|
||||
'zmm_isi',
|
||||
'zmm_isimotor',
|
||||
'zmm_isipump',
|
||||
'zmm_isipumpset',
|
||||
'zmm_pumpset_model',
|
||||
'zmm_stages',
|
||||
'zmm_headrange',
|
||||
'zmm_overall_efficiency',
|
||||
'zmm_connection',
|
||||
'zmm_min_bore_size',
|
||||
'zmm_isireference',
|
||||
'zmm_category',
|
||||
'zmm_submergence',
|
||||
'zmm_capacitorstart',
|
||||
'zmm_capacitorrun',
|
||||
'zmm_inch',
|
||||
'zmm_motor_type',
|
||||
'zmm_dismantle_direction',
|
||||
'zmm_eff_ovrall',
|
||||
'zmm_bodymoc',
|
||||
'zmm_rotormoc',
|
||||
'zmm_dlwl',
|
||||
'zmm_inputpower',
|
||||
'zmm_imp_od',
|
||||
'zmm_ambtemp',
|
||||
'zmm_de',
|
||||
'zmm_dischargerange',
|
||||
'zmm_efficiency_class',
|
||||
'zmm_framesize',
|
||||
'zmm_impellerdiameter',
|
||||
'zmm_insulationclass',
|
||||
'zmm_maxflow',
|
||||
'zmm_minhead',
|
||||
'zmm_mtrlofconst',
|
||||
'zmm_nde',
|
||||
'zmm_powerfactor',
|
||||
'zmm_tagno',
|
||||
'zmm_year',
|
||||
'zmm_laser_name',
|
||||
'zmm_beenote',
|
||||
'zmm_beenumber',
|
||||
'zmm_beestar',
|
||||
'zmm_logo_ce',
|
||||
'zmm_codeclass',
|
||||
'zmm_colour',
|
||||
'zmm_logo_cp',
|
||||
'zmm_grade',
|
||||
'zmm_grwt_pset',
|
||||
'zmm_grwt_cable',
|
||||
'zmm_grwt_motor',
|
||||
'zmm_grwt_pf',
|
||||
'zmm_grwt_pump',
|
||||
'zmm_isivalve',
|
||||
'zmm_isi_wc',
|
||||
'zmm_labelperiod',
|
||||
'zmm_length',
|
||||
'zmm_license_cml_no',
|
||||
'zmm_mfgmonyr',
|
||||
'zmm_modelyear',
|
||||
'zmm_motoridentification',
|
||||
'zmm_newt_pset',
|
||||
'zmm_newt_cable',
|
||||
'zmm_newt_motor',
|
||||
'zmm_newt_pf',
|
||||
'zmm_newt_pump',
|
||||
'zmm_logo_nsf',
|
||||
'zmm_packtype',
|
||||
'zmm_panel',
|
||||
'zmm_performance_factor',
|
||||
'zmm_pumpidentification',
|
||||
'zmm_psettype',
|
||||
'zmm_size',
|
||||
'zmm_eff_ttl',
|
||||
'zmm_type',
|
||||
'zmm_usp',
|
||||
'zmm_operating_range',
|
||||
'zmm_intake_air',
|
||||
'zmm_oxygen_transfer_rate',
|
||||
'zmm_air_inlet_pipesize',
|
||||
'zmm_sump_depth',
|
||||
'zmm_poles',
|
||||
'zmm_motor_heading',
|
||||
'zmm_motor_speed',
|
||||
'zqmm_qty',
|
||||
'mrp',
|
||||
'zmm_1',
|
||||
'zmm_2',
|
||||
'zmm_3',
|
||||
'zmm_4',
|
||||
'zmm_5',
|
||||
'zmm_6',
|
||||
'zmm_7',
|
||||
'zmm_8',
|
||||
'zmm_9',
|
||||
'zmm_10',
|
||||
'zmm_11',
|
||||
'zmm_12',
|
||||
'zmm_13',
|
||||
'zmm_14',
|
||||
'zmm_15',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
public function plant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Plant::class);
|
||||
}
|
||||
|
||||
public function item(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Item::class);
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,11 @@ class Line extends Model
|
||||
return $this->hasMany(TestingPanelReading::class);
|
||||
}
|
||||
|
||||
public function beforeTestReadings()
|
||||
{
|
||||
return $this->hasMany(BeforeTestReading::class);
|
||||
}
|
||||
|
||||
public function workGroupMasters(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(WorkGroupMaster::class);
|
||||
@@ -185,4 +190,9 @@ class Line extends Model
|
||||
// {
|
||||
// return $this->hasMany(RejectReason::class, 'line_id', 'id');
|
||||
// }
|
||||
|
||||
public function panelBoxValidations()
|
||||
{
|
||||
return $this->hasMany(PanelBoxValidation::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,12 +35,12 @@ class Machine extends Model
|
||||
|
||||
public function productCharacteristicsMasters()
|
||||
{
|
||||
return $this->hasMany(ProductCharacteristicsMaster::class);
|
||||
return $this->hasMany(ProductCharacteristicsMaster::class, 'machine_id', 'id');
|
||||
}
|
||||
|
||||
public function characteristicValues()
|
||||
{
|
||||
return $this->hasMany(CharacteristicValue::class);
|
||||
return $this->hasMany(CharacteristicValue::class, 'machine_id', 'id');
|
||||
}
|
||||
|
||||
public function ClassCharacteristics()
|
||||
@@ -65,12 +65,17 @@ class Machine extends Model
|
||||
|
||||
public function testingPanelReadings()
|
||||
{
|
||||
return $this->hasMany(TestingPanelReading::class);
|
||||
return $this->hasMany(TestingPanelReading::class, 'machine_id', 'id');
|
||||
}
|
||||
|
||||
public function beforeTestReadings()
|
||||
{
|
||||
return $this->hasMany(BeforeTestReading::class, 'machine_id', 'id');
|
||||
}
|
||||
|
||||
public function tempClassCharacteristics()
|
||||
{
|
||||
return $this->hasMany(TempClassCharacteristic::class, 'plant_id', 'id');
|
||||
return $this->hasMany(TempClassCharacteristic::class, 'machine_id', 'id');
|
||||
}
|
||||
|
||||
public function equipmentMasters()
|
||||
|
||||
@@ -12,39 +12,39 @@ class MotorTestingMaster extends Model
|
||||
|
||||
protected $fillable = [
|
||||
'plant_id',
|
||||
'item_id',
|
||||
'item_id',
|
||||
'subassembly_code',
|
||||
'isi_model',
|
||||
'phase',
|
||||
'kw',
|
||||
'hp',
|
||||
'volt',
|
||||
'current',
|
||||
'rpm',
|
||||
'torque',
|
||||
'frequency',
|
||||
'connection',
|
||||
'ins_res_limit',
|
||||
'ins_res_type',
|
||||
'isi_model',
|
||||
'phase',
|
||||
'kw',
|
||||
'hp',
|
||||
'volt',
|
||||
'current',
|
||||
'rpm',
|
||||
'torque',
|
||||
'frequency',
|
||||
'connection',
|
||||
'ins_res_limit',
|
||||
'ins_res_type',
|
||||
'routine_test_time',
|
||||
'res_ry_ll',
|
||||
'res_ry_ul',
|
||||
'res_yb_ll',
|
||||
'res_yb_ul',
|
||||
'res_br_ll',
|
||||
'res_br_ul',
|
||||
'lock_volt_limit',
|
||||
'leak_cur_limit',
|
||||
'lock_cur_ll',
|
||||
'lock_cur_ul',
|
||||
'noload_cur_ll',
|
||||
'noload_cur_ul',
|
||||
'noload_pow_ll',
|
||||
'noload_pow_ul',
|
||||
'noload_spd_ll',
|
||||
'noload_spd_ul',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
'res_ry_ll',
|
||||
'res_ry_ul',
|
||||
'res_yb_ll',
|
||||
'res_yb_ul',
|
||||
'res_br_ll',
|
||||
'res_br_ul',
|
||||
'lock_volt_limit',
|
||||
'leak_cur_limit',
|
||||
'lock_cur_ll',
|
||||
'lock_cur_ul',
|
||||
'noload_cur_ll',
|
||||
'noload_cur_ul',
|
||||
'noload_pow_ll',
|
||||
'noload_pow_ul',
|
||||
'noload_spd_ll',
|
||||
'noload_spd_ul',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
public function plant(): BelongsTo
|
||||
@@ -52,14 +52,18 @@ class MotorTestingMaster extends Model
|
||||
return $this->belongsTo(Plant::class);
|
||||
}
|
||||
|
||||
public function item(): BelongsTo
|
||||
public function item(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Item::class, 'item_id', 'id');
|
||||
// return $this->belongsTo(Item::class);
|
||||
}
|
||||
|
||||
public function testingPanelReadings()
|
||||
{
|
||||
return $this->hasMany(TestingPanelReading::class, 'motor_testing_master_id');
|
||||
return $this->hasMany(TestingPanelReading::class, 'motor_testing_master_id', 'id');
|
||||
}
|
||||
|
||||
public function beforeTestReadings()
|
||||
{
|
||||
return $this->hasMany(BeforeTestReading::class, 'motor_testing_master_id', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ class PanelBoxValidation extends Model
|
||||
'part_validation5',
|
||||
'panel_box_supplier',
|
||||
'panel_box_serial_number',
|
||||
'batch_number',
|
||||
'panel_box_code',
|
||||
'inspection_lot_number',
|
||||
'created_by',
|
||||
'updated_by'
|
||||
];
|
||||
|
||||
@@ -13,6 +13,7 @@ class PanelGrMaster extends Model
|
||||
protected $fillable = [
|
||||
'plant_id',
|
||||
'item_id',
|
||||
'inspection_lot_number',
|
||||
'document_number',
|
||||
'invoice_number',
|
||||
'supplier_number',
|
||||
|
||||
@@ -84,6 +84,16 @@ class Plant extends Model
|
||||
return $this->hasMany(TestingPanelReading::class, 'plant_id', 'id');
|
||||
}
|
||||
|
||||
// public function pumpTestingMasters()
|
||||
// {
|
||||
// return $this->hasMany(PumpTestingMaster::class, 'plant_id', 'id');
|
||||
// }
|
||||
|
||||
// public function pumpTestingEntries()
|
||||
// {
|
||||
// return $this->hasMany(PumpTestingEntry::class, 'plant_id', 'id');
|
||||
// }
|
||||
|
||||
public function guardNames()
|
||||
{
|
||||
return $this->hasMany(GuardName::class, 'plant_id', 'id');
|
||||
@@ -149,9 +159,14 @@ class Plant extends Model
|
||||
return $this->hasMany(ClassCharacteristic::class, 'plant_id', 'id');
|
||||
}
|
||||
|
||||
// public function rejectReasons()
|
||||
// public function ModelMasters()
|
||||
// {
|
||||
// return $this->hasMany(RejectReason::class, 'plant_id', 'id');
|
||||
// return $this->hasMany(ModelMaster::class, 'plant_id', 'id');
|
||||
// }
|
||||
|
||||
// public function windedSerialValidationErrors()
|
||||
// {
|
||||
// return $this->hasMany(WindedSerialValidationError::class, 'plant_id', 'id');
|
||||
// }
|
||||
|
||||
public function requestCharacteristics()
|
||||
@@ -184,6 +199,11 @@ class Plant extends Model
|
||||
return $this->hasMany(LeakTestReading::class, 'plant_id', 'id');
|
||||
}
|
||||
|
||||
public function beforeTestReadings()
|
||||
{
|
||||
return $this->hasMany(BeforeTestReading::class, 'plant_id', 'id');
|
||||
}
|
||||
|
||||
public function asrsItemValidations()
|
||||
{
|
||||
return $this->hasMany(AsrsItemValidation::class, 'plant_id', 'id');
|
||||
@@ -198,4 +218,9 @@ class Plant extends Model
|
||||
{
|
||||
return $this->hasMany(CharacteristicApproverMaster::class, 'plant_id', 'id');
|
||||
}
|
||||
|
||||
public function panelBoxValidations()
|
||||
{
|
||||
return $this->hasMany(PanelBoxValidation::class, 'plant_id', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,10 @@ class ProductionCharacteristic extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $casts = [
|
||||
'result' => 'array',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'plant_id',
|
||||
'line_id',
|
||||
@@ -21,7 +25,9 @@ class ProductionCharacteristic extends Model
|
||||
'characteristic_name',
|
||||
'status',
|
||||
'inspection_status',
|
||||
'inspection_lot_number',
|
||||
'remark',
|
||||
'result',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'created_by',
|
||||
|
||||
54
app/Models/StickerDetail.php
Normal file
54
app/Models/StickerDetail.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class StickerDetail extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
protected $fillable = [
|
||||
'sticker_structure_detail_id',
|
||||
'design_element_type',
|
||||
'element_id',
|
||||
'element_type',
|
||||
'characteristics_type',
|
||||
'string_value',
|
||||
'string_font',
|
||||
'string_size',
|
||||
'element_colour',
|
||||
'string_align',
|
||||
'string_x_value',
|
||||
'string_y_value',
|
||||
'shape_name',
|
||||
'shape_pen_size',
|
||||
'curve_radius',
|
||||
'shape_x1_value',
|
||||
'shape_y1_value',
|
||||
'shape_x2_value',
|
||||
'shape_y2_value',
|
||||
// 'image_path',
|
||||
// 'image_type',
|
||||
'image_x',
|
||||
'image_y',
|
||||
'image_width',
|
||||
'image_height',
|
||||
'qr_value',
|
||||
'qr_align',
|
||||
'qr_size',
|
||||
'qr_x_value',
|
||||
'qr_y_value',
|
||||
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
public function stickerStructureDetail(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(StickerStructureDetail::class);
|
||||
}
|
||||
}
|
||||
144
app/Models/StickerMappingMaster.php
Normal file
144
app/Models/StickerMappingMaster.php
Normal file
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class StickerMappingMaster extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'plant_id',
|
||||
'item_characteristic_id',
|
||||
|
||||
'sticker_structure1_id',
|
||||
'sticker1_machine_id',
|
||||
'sticker1_print_ip',
|
||||
'sticker_structure2_id',
|
||||
'sticker2_machine_id',
|
||||
'sticker2_print_ip',
|
||||
'sticker_structure3_id',
|
||||
'sticker3_machine_id',
|
||||
'sticker3_print_ip',
|
||||
'sticker_structure4_id',
|
||||
'sticker4_machine_id',
|
||||
'sticker4_print_ip',
|
||||
'sticker_structure5_id',
|
||||
'sticker5_machine_id',
|
||||
'sticker5_print_ip',
|
||||
'sticker_structure6_id',
|
||||
'sticker6_machine_id',
|
||||
'sticker6_print_ip',
|
||||
'sticker_structure7_id',
|
||||
'sticker7_machine_id',
|
||||
'sticker7_print_ip',
|
||||
'sticker_structure8_id',
|
||||
'sticker8_machine_id',
|
||||
'sticker8_print_ip',
|
||||
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
public function plant()
|
||||
{
|
||||
return $this->belongsTo(Plant::class);
|
||||
}
|
||||
|
||||
public function itemCharacteristic()
|
||||
{
|
||||
return $this->belongsTo(ItemCharacteristic::class);
|
||||
}
|
||||
|
||||
public function item(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Item::class, 'item_id');
|
||||
}
|
||||
|
||||
public function sticker1Structure()
|
||||
{
|
||||
return $this->belongsTo(StickerStructureDetail::class, 'sticker_structure1_id');
|
||||
}
|
||||
|
||||
public function sticker2Structure()
|
||||
{
|
||||
return $this->belongsTo(StickerStructureDetail::class, 'sticker_structure2_id');
|
||||
}
|
||||
|
||||
public function sticker3Structure()
|
||||
{
|
||||
return $this->belongsTo(StickerStructureDetail::class, 'sticker_structure3_id');
|
||||
}
|
||||
|
||||
public function sticker4Structure()
|
||||
{
|
||||
return $this->belongsTo(StickerStructureDetail::class, 'sticker_structure4_id');
|
||||
}
|
||||
|
||||
public function sticker5Structure()
|
||||
{
|
||||
return $this->belongsTo(StickerStructureDetail::class, 'sticker_structure5_id');
|
||||
}
|
||||
|
||||
public function sticker6Structure()
|
||||
{
|
||||
return $this->belongsTo(StickerStructureDetail::class, 'sticker_structure6_id');
|
||||
}
|
||||
|
||||
public function sticker7Structure()
|
||||
{
|
||||
return $this->belongsTo(StickerStructureDetail::class, 'sticker_structure7_id');
|
||||
}
|
||||
|
||||
public function sticker8Structure()
|
||||
{
|
||||
return $this->belongsTo(StickerStructureDetail::class, 'sticker_structure8_id');
|
||||
}
|
||||
|
||||
// Machine relationships (per sticker)
|
||||
public function sticker1Machine()
|
||||
{
|
||||
return $this->belongsTo(Machine::class, 'sticker1_machine_id');
|
||||
}
|
||||
|
||||
public function sticker2Machine()
|
||||
{
|
||||
return $this->belongsTo(Machine::class, 'sticker2_machine_id');
|
||||
}
|
||||
|
||||
public function sticker3Machine()
|
||||
{
|
||||
return $this->belongsTo(Machine::class, 'sticker3_machine_id');
|
||||
}
|
||||
|
||||
public function sticker4Machine()
|
||||
{
|
||||
return $this->belongsTo(Machine::class, 'sticker4_machine_id');
|
||||
}
|
||||
|
||||
public function sticker5Machine()
|
||||
{
|
||||
return $this->belongsTo(Machine::class, 'sticker5_machine_id');
|
||||
}
|
||||
|
||||
public function sticker6Machine()
|
||||
{
|
||||
return $this->belongsTo(Machine::class, 'sticker6_machine_id');
|
||||
}
|
||||
|
||||
public function sticker7Machine()
|
||||
{
|
||||
return $this->belongsTo(Machine::class, 'sticker7_machine_id');
|
||||
}
|
||||
|
||||
public function sticker8Machine()
|
||||
{
|
||||
return $this->belongsTo(Machine::class, 'sticker8_machine_id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,4 +63,9 @@ class StickerMaster extends Model
|
||||
{
|
||||
return $this->hasMany(InvoiceValidation::class, 'sticker_master_id');
|
||||
}
|
||||
|
||||
public function panelBoxValidations()
|
||||
{
|
||||
return $this->hasMany(PanelBoxValidation::class, 'sticker_master_id');
|
||||
}
|
||||
}
|
||||
|
||||
28
app/Models/StickerStructureDetail.php
Normal file
28
app/Models/StickerStructureDetail.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class StickerStructureDetail extends Model
|
||||
{
|
||||
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'sticker_id',
|
||||
'sticker_width',
|
||||
'sticker_height',
|
||||
'sticker_lmargin',
|
||||
'sticker_rmargin',
|
||||
'sticker_tmargin',
|
||||
'sticker_bmargin',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'created_by',
|
||||
'updated_by'
|
||||
];
|
||||
|
||||
}
|
||||
33
app/Models/StickerValidation.php
Normal file
33
app/Models/StickerValidation.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class StickerValidation extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'plant_id',
|
||||
'machine_id',
|
||||
'sticker_id',
|
||||
'production_order',
|
||||
'serial_number',
|
||||
'status',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public function plant()
|
||||
{
|
||||
return $this->belongsTo(Plant::class);
|
||||
}
|
||||
|
||||
public function machine()
|
||||
{
|
||||
return $this->belongsTo(Machine::class);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ class VisitorEntry extends Model
|
||||
|
||||
protected $fillable = [
|
||||
'mobile_number',
|
||||
'organizer',
|
||||
'register_id',
|
||||
'name',
|
||||
'company',
|
||||
|
||||
105
app/Policies/BeforeTestReadingPolicy.php
Normal file
105
app/Policies/BeforeTestReadingPolicy.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\BeforeTestReading;
|
||||
use App\Models\User;
|
||||
|
||||
class BeforeTestReadingPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any BeforeTestReading');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, BeforeTestReading $beforetestreading): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view BeforeTestReading');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create BeforeTestReading');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, BeforeTestReading $beforetestreading): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update BeforeTestReading');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, BeforeTestReading $beforetestreading): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete BeforeTestReading');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any BeforeTestReading');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, BeforeTestReading $beforetestreading): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore BeforeTestReading');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any BeforeTestReading');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, BeforeTestReading $beforetestreading): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate BeforeTestReading');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder BeforeTestReading');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, BeforeTestReading $beforetestreading): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete BeforeTestReading');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any BeforeTestReading');
|
||||
}
|
||||
}
|
||||
106
app/Policies/DealerVisitPlanPolicy.php
Normal file
106
app/Policies/DealerVisitPlanPolicy.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use App\Models\DealerVisitPlan;
|
||||
use App\Models\User;
|
||||
|
||||
class DealerVisitPlanPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any DealerVisitPlan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, DealerVisitPlan $dealervisitplan): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view DealerVisitPlan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create DealerVisitPlan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, DealerVisitPlan $dealervisitplan): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update DealerVisitPlan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, DealerVisitPlan $dealervisitplan): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete DealerVisitPlan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any DealerVisitPlan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, DealerVisitPlan $dealervisitplan): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore DealerVisitPlan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any DealerVisitPlan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, DealerVisitPlan $dealervisitplan): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate DealerVisitPlan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder DealerVisitPlan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, DealerVisitPlan $dealervisitplan): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete DealerVisitPlan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any DealerVisitPlan');
|
||||
}
|
||||
}
|
||||
106
app/Policies/ItemCharacteristicPolicy.php
Normal file
106
app/Policies/ItemCharacteristicPolicy.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use App\Models\ItemCharacteristic;
|
||||
use App\Models\User;
|
||||
|
||||
class ItemCharacteristicPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any ItemCharacteristic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, ItemCharacteristic $itemcharacteristic): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view ItemCharacteristic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create ItemCharacteristic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, ItemCharacteristic $itemcharacteristic): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update ItemCharacteristic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, ItemCharacteristic $itemcharacteristic): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete ItemCharacteristic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any ItemCharacteristic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, ItemCharacteristic $itemcharacteristic): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore ItemCharacteristic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any ItemCharacteristic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, ItemCharacteristic $itemcharacteristic): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate ItemCharacteristic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder ItemCharacteristic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, ItemCharacteristic $itemcharacteristic): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete ItemCharacteristic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any ItemCharacteristic');
|
||||
}
|
||||
}
|
||||
106
app/Policies/StickerDetailPolicy.php
Normal file
106
app/Policies/StickerDetailPolicy.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use App\Models\StickerDetail;
|
||||
use App\Models\User;
|
||||
|
||||
class StickerDetailPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any StickerDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, StickerDetail $stickerdetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view StickerDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create StickerDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, StickerDetail $stickerdetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update StickerDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, StickerDetail $stickerdetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete StickerDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any StickerDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, StickerDetail $stickerdetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore StickerDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any StickerDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, StickerDetail $stickerdetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate StickerDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder StickerDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, StickerDetail $stickerdetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete StickerDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any StickerDetail');
|
||||
}
|
||||
}
|
||||
106
app/Policies/StickerMappingMasterPolicy.php
Normal file
106
app/Policies/StickerMappingMasterPolicy.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use App\Models\StickerMappingMaster;
|
||||
use App\Models\User;
|
||||
|
||||
class StickerMappingMasterPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any StickerMappingMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, StickerMappingMaster $stickermappingmaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view StickerMappingMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create StickerMappingMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, StickerMappingMaster $stickermappingmaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update StickerMappingMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, StickerMappingMaster $stickermappingmaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete StickerMappingMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any StickerMappingMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, StickerMappingMaster $stickermappingmaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore StickerMappingMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any StickerMappingMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, StickerMappingMaster $stickermappingmaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate StickerMappingMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder StickerMappingMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, StickerMappingMaster $stickermappingmaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete StickerMappingMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any StickerMappingMaster');
|
||||
}
|
||||
}
|
||||
106
app/Policies/StickerStructureDetailPolicy.php
Normal file
106
app/Policies/StickerStructureDetailPolicy.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use App\Models\StickerStructureDetail;
|
||||
use App\Models\User;
|
||||
|
||||
class StickerStructureDetailPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, StickerStructureDetail $stickerstructuredetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, StickerStructureDetail $stickerstructuredetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, StickerStructureDetail $stickerstructuredetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, StickerStructureDetail $stickerstructuredetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, StickerStructureDetail $stickerstructuredetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, StickerStructureDetail $stickerstructuredetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any StickerStructureDetail');
|
||||
}
|
||||
}
|
||||
106
app/Policies/StickerValidationPolicy.php
Normal file
106
app/Policies/StickerValidationPolicy.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use App\Models\StickerValidation;
|
||||
use App\Models\User;
|
||||
|
||||
class StickerValidationPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any StickerValidation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, StickerValidation $stickervalidation): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view StickerValidation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create StickerValidation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, StickerValidation $stickervalidation): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update StickerValidation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, StickerValidation $stickervalidation): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete StickerValidation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any StickerValidation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, StickerValidation $stickervalidation): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore StickerValidation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any StickerValidation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, StickerValidation $stickervalidation): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate StickerValidation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder StickerValidation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, StickerValidation $stickervalidation): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete StickerValidation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any StickerValidation');
|
||||
}
|
||||
}
|
||||
1166
app/Services/StickerPdfService.php
Normal file
1166
app/Services/StickerPdfService.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE dealer_visit_plans (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
employee_master_id BIGINT NOT NULL,
|
||||
|
||||
name TEXT DEFAULT NULL,
|
||||
company TEXT DEFAULT NULL,
|
||||
visit_plan_date DATE DEFAULT NULL,
|
||||
organizer TEXT DEFAULT NULL,
|
||||
mobile_number TEXT DEFAULT NULL,
|
||||
number_of_person TEXT DEFAULT NULL,
|
||||
purpose_of_visit TEXT DEFAULT NULL,
|
||||
mode_of_travel TEXT DEFAULT NULL,
|
||||
status TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
created_by TEXT NULL,
|
||||
updated_by TEXT NULL,
|
||||
|
||||
FOREIGN KEY (employee_master_id) REFERENCES employee_masters (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('dealer_visit_plans');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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
|
||||
{
|
||||
$sql3 = <<<'SQL'
|
||||
ALTER TABLE visitor_entries
|
||||
ADD COLUMN organizer TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('visitor_entries', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE sticker_structure_details (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
sticker_id TEXT DEFAULT NULL,
|
||||
sticker_width TEXT DEFAULT NULL,
|
||||
sticker_height TEXT DEFAULT NULL,
|
||||
sticker_lmargin TEXT DEFAULT NULL,
|
||||
sticker_rmargin TEXT DEFAULT NULL,
|
||||
sticker_tmargin TEXT DEFAULT NULL,
|
||||
sticker_bmargin TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sticker_structure_details');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE item_characteristics (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
item_id BIGINT NOT NULL,
|
||||
class TEXT DEFAULT NULL,
|
||||
zz1_cn_bill_ord TEXT DEFAULT NULL,
|
||||
zmm_amps TEXT DEFAULT NULL,
|
||||
zmm_brand TEXT DEFAULT NULL,
|
||||
zmm_degreeofprotection TEXT DEFAULT NULL,
|
||||
zmm_delivery TEXT DEFAULT NULL,
|
||||
zmm_dir_rot TEXT DEFAULT NULL,
|
||||
zmm_discharge TEXT DEFAULT NULL,
|
||||
zmm_discharge_max TEXT DEFAULT NULL,
|
||||
zmm_discharge_min TEXT DEFAULT NULL,
|
||||
zmm_duty TEXT DEFAULT NULL,
|
||||
zmm_eff_motor TEXT DEFAULT NULL,
|
||||
zmm_eff_pump TEXT DEFAULT NULL,
|
||||
zmm_frequency TEXT DEFAULT NULL,
|
||||
zmm_head TEXT DEFAULT NULL,
|
||||
zmm_heading TEXT DEFAULT NULL,
|
||||
zmm_head_max TEXT DEFAULT NULL,
|
||||
zmm_head_minimum TEXT DEFAULT NULL,
|
||||
zmm_idx_eff_mtr TEXT DEFAULT NULL,
|
||||
zmm_idx_eff_pump TEXT DEFAULT NULL,
|
||||
zmm_kvacode TEXT DEFAULT NULL,
|
||||
zmm_maxambtemp TEXT DEFAULT NULL,
|
||||
zmm_mincoolingflow TEXT DEFAULT NULL,
|
||||
zmm_motorseries TEXT DEFAULT NULL,
|
||||
zmm_motor_model TEXT DEFAULT NULL,
|
||||
zmm_outlet TEXT DEFAULT NULL,
|
||||
zmm_phase TEXT DEFAULT NULL,
|
||||
zmm_pressure TEXT DEFAULT NULL,
|
||||
zmm_pumpflowtype TEXT DEFAULT NULL,
|
||||
zmm_pumpseries TEXT DEFAULT NULL,
|
||||
zmm_pump_model TEXT DEFAULT NULL,
|
||||
zmm_ratedpower TEXT DEFAULT NULL,
|
||||
zmm_region TEXT DEFAULT NULL,
|
||||
zmm_servicefactor TEXT DEFAULT NULL,
|
||||
zmm_servicefactormaximumamps TEXT DEFAULT NULL,
|
||||
zmm_speed TEXT DEFAULT NULL,
|
||||
zmm_suction TEXT DEFAULT NULL,
|
||||
zmm_suctionxdelivery TEXT DEFAULT NULL,
|
||||
zmm_supplysource TEXT DEFAULT NULL,
|
||||
zmm_temperature TEXT DEFAULT NULL,
|
||||
zmm_thrustload TEXT DEFAULT NULL,
|
||||
zmm_volts TEXT DEFAULT NULL,
|
||||
zmm_wire TEXT DEFAULT NULL,
|
||||
zmm_package TEXT DEFAULT NULL,
|
||||
zmm_pvarrayrating TEXT DEFAULT NULL,
|
||||
zmm_isi TEXT DEFAULT NULL,
|
||||
zmm_isimotor TEXT DEFAULT NULL,
|
||||
zmm_isipump TEXT DEFAULT NULL,
|
||||
zmm_isipumpset TEXT DEFAULT NULL,
|
||||
zmm_pumpset_model TEXT DEFAULT NULL,
|
||||
zmm_stages TEXT DEFAULT NULL,
|
||||
zmm_headrange TEXT DEFAULT NULL,
|
||||
zmm_overall_efficiency TEXT DEFAULT NULL,
|
||||
zmm_connection TEXT DEFAULT NULL,
|
||||
zmm_min_bore_size TEXT DEFAULT NULL,
|
||||
zmm_isireference TEXT DEFAULT NULL,
|
||||
zmm_category TEXT DEFAULT NULL,
|
||||
zmm_submergence TEXT DEFAULT NULL,
|
||||
zmm_capacitorstart TEXT DEFAULT NULL,
|
||||
zmm_capacitorrun TEXT DEFAULT NULL,
|
||||
zmm_inch TEXT DEFAULT NULL,
|
||||
zmm_motor_type TEXT DEFAULT NULL,
|
||||
zmm_dismantle_direction TEXT DEFAULT NULL,
|
||||
zmm_eff_ovrall TEXT DEFAULT NULL,
|
||||
zmm_bodymoc TEXT DEFAULT NULL,
|
||||
zmm_rotormoc TEXT DEFAULT NULL,
|
||||
zmm_dlwl TEXT DEFAULT NULL,
|
||||
zmm_inputpower TEXT DEFAULT NULL,
|
||||
zmm_imp_od TEXT DEFAULT NULL,
|
||||
zmm_ambtemp TEXT DEFAULT NULL,
|
||||
zmm_de TEXT DEFAULT NULL,
|
||||
zmm_dischargerange TEXT DEFAULT NULL,
|
||||
zmm_efficiency_class TEXT DEFAULT NULL,
|
||||
zmm_framesize TEXT DEFAULT NULL,
|
||||
zmm_impellerdiameter TEXT DEFAULT NULL,
|
||||
zmm_insulationclass TEXT DEFAULT NULL,
|
||||
zmm_maxflow TEXT DEFAULT NULL,
|
||||
zmm_minhead TEXT DEFAULT NULL,
|
||||
zmm_mtrlofconst TEXT DEFAULT NULL,
|
||||
zmm_nde TEXT DEFAULT NULL,
|
||||
zmm_powerfactor TEXT DEFAULT NULL,
|
||||
zmm_tagno TEXT DEFAULT NULL,
|
||||
zmm_year TEXT DEFAULT NULL,
|
||||
zmm_laser_name TEXT DEFAULT NULL,
|
||||
zmm_beenote TEXT DEFAULT NULL,
|
||||
zmm_beenumber TEXT DEFAULT NULL,
|
||||
zmm_beestar TEXT DEFAULT NULL,
|
||||
zmm_logo_ce TEXT DEFAULT NULL,
|
||||
zmm_codeclass TEXT DEFAULT NULL,
|
||||
zmm_colour TEXT DEFAULT NULL,
|
||||
zmm_logo_cp TEXT DEFAULT NULL,
|
||||
zmm_grade TEXT DEFAULT NULL,
|
||||
zmm_grwt_pset TEXT DEFAULT NULL,
|
||||
zmm_grwt_cable TEXT DEFAULT NULL,
|
||||
zmm_grwt_motor TEXT DEFAULT NULL,
|
||||
zmm_grwt_pf TEXT DEFAULT NULL,
|
||||
zmm_grwt_pump TEXT DEFAULT NULL,
|
||||
zmm_isivalve TEXT DEFAULT NULL,
|
||||
zmm_isi_wc TEXT DEFAULT NULL,
|
||||
zmm_labelperiod TEXT DEFAULT NULL,
|
||||
zmm_length TEXT DEFAULT NULL,
|
||||
zmm_license_cml_no TEXT DEFAULT NULL,
|
||||
zmm_mfgmonyr TEXT DEFAULT NULL,
|
||||
zmm_modelyear TEXT DEFAULT NULL,
|
||||
zmm_motoridentification TEXT DEFAULT NULL,
|
||||
zmm_newt_pset TEXT DEFAULT NULL,
|
||||
zmm_newt_cable TEXT DEFAULT NULL,
|
||||
zmm_newt_motor TEXT DEFAULT NULL,
|
||||
zmm_newt_pf TEXT DEFAULT NULL,
|
||||
zmm_newt_pump TEXT DEFAULT NULL,
|
||||
zmm_logo_nsf TEXT DEFAULT NULL,
|
||||
zmm_packtype TEXT DEFAULT NULL,
|
||||
zmm_panel TEXT DEFAULT NULL,
|
||||
zmm_performance_factor TEXT DEFAULT NULL,
|
||||
zmm_pumpidentification TEXT DEFAULT NULL,
|
||||
zmm_psettype TEXT DEFAULT NULL,
|
||||
zmm_size TEXT DEFAULT NULL,
|
||||
zmm_eff_ttl TEXT DEFAULT NULL,
|
||||
zmm_type TEXT DEFAULT NULL,
|
||||
zmm_usp TEXT DEFAULT NULL,
|
||||
zmm_operating_range TEXT DEFAULT NULL,
|
||||
zmm_intake_air TEXT DEFAULT NULL,
|
||||
zmm_oxygen_transfer_rate TEXT DEFAULT NULL,
|
||||
zmm_air_inlet_pipesize TEXT DEFAULT NULL,
|
||||
zmm_sump_depth TEXT DEFAULT NULL,
|
||||
zmm_poles TEXT DEFAULT NULL,
|
||||
zmm_motor_heading TEXT DEFAULT NULL,
|
||||
zmm_motor_speed TEXT DEFAULT NULL,
|
||||
zqmm_qty TEXT DEFAULT NULL,
|
||||
zmm_1 TEXT DEFAULT NULL,
|
||||
zmm_2 TEXT DEFAULT NULL,
|
||||
zmm_3 TEXT DEFAULT NULL,
|
||||
zmm_4 TEXT DEFAULT NULL,
|
||||
zmm_5 TEXT DEFAULT NULL,
|
||||
zmm_6 TEXT DEFAULT NULL,
|
||||
zmm_7 TEXT DEFAULT NULL,
|
||||
zmm_8 TEXT DEFAULT NULL,
|
||||
zmm_9 TEXT DEFAULT NULL,
|
||||
zmm_10 TEXT DEFAULT NULL,
|
||||
zmm_11 TEXT DEFAULT NULL,
|
||||
zmm_12 TEXT DEFAULT NULL,
|
||||
zmm_13 TEXT DEFAULT NULL,
|
||||
zmm_14 TEXT DEFAULT NULL,
|
||||
zmm_15 TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (item_id) REFERENCES items (id)
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('item_characteristics');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE sticker_details (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
sticker_structure_detail_id BIGINT NOT NULL,
|
||||
design_element_type TEXT DEFAULT NULL,
|
||||
element_id TEXT DEFAULT NULL,
|
||||
element_type TEXT DEFAULT NULL,
|
||||
string_value TEXT DEFAULT NULL,
|
||||
string_font TEXT DEFAULT NULL,
|
||||
string_size TEXT DEFAULT NULL,
|
||||
element_colour TEXT DEFAULT NULL,
|
||||
string_align TEXT DEFAULT NULL,
|
||||
string_x_value TEXT DEFAULT NULL,
|
||||
string_y_value TEXT DEFAULT NULL,
|
||||
shape_name TEXT DEFAULT NULL,
|
||||
shape_pen_size TEXT DEFAULT NULL,
|
||||
shape_x1_value TEXT DEFAULT NULL,
|
||||
shape_y1_value TEXT DEFAULT NULL,
|
||||
shape_x2_value TEXT DEFAULT NULL,
|
||||
shape_y2_value TEXT DEFAULT NULL,
|
||||
image_path TEXT DEFAULT NULL,
|
||||
image_type TEXT DEFAULT NULL,
|
||||
image_x TEXT DEFAULT NULL,
|
||||
image_y TEXT DEFAULT NULL,
|
||||
image_width TEXT DEFAULT NULL,
|
||||
image_height TEXT DEFAULT NULL,
|
||||
qr_value TEXT DEFAULT NULL,
|
||||
qr_align TEXT DEFAULT NULL,
|
||||
qr_size TEXT DEFAULT NULL,
|
||||
qr_x_value TEXT DEFAULT NULL,
|
||||
qr_y_value TEXT DEFAULT NULL,
|
||||
characteristics_type TEXT DEFAULT NULL,
|
||||
curve_radius TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (sticker_structure_detail_id) REFERENCES sticker_structure_details (id)
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sticker_details');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE sticker_validations (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
machine_id BIGINT NOT NULL,
|
||||
production_order TEXT DEFAULT NULL,
|
||||
serial_number TEXT DEFAULT NULL,
|
||||
status TEXT DEFAULT NULL,
|
||||
sticker_id TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (machine_id) REFERENCES machines (id)
|
||||
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sticker_validations');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE sticker_mapping_masters (
|
||||
id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
item_characteristic_id BIGINT DEFAULT NULL,
|
||||
sticker_structure1_id BIGINT DEFAULT NULL,
|
||||
sticker1_machine_id BIGINT DEFAULT NULL,
|
||||
sticker1_print_ip TEXT DEFAULT NULL,
|
||||
|
||||
sticker_structure2_id BIGINT DEFAULT NULL,
|
||||
sticker2_machine_id BIGINT DEFAULT NULL,
|
||||
sticker2_print_ip TEXT DEFAULT NULL,
|
||||
|
||||
sticker_structure3_id BIGINT DEFAULT NULL,
|
||||
sticker3_machine_id BIGINT DEFAULT NULL,
|
||||
sticker3_print_ip TEXT DEFAULT NULL,
|
||||
|
||||
sticker_structure4_id BIGINT DEFAULT NULL,
|
||||
sticker4_machine_id BIGINT DEFAULT NULL,
|
||||
sticker4_print_ip TEXT DEFAULT NULL,
|
||||
|
||||
sticker_structure5_id BIGINT DEFAULT NULL,
|
||||
sticker5_machine_id BIGINT DEFAULT NULL,
|
||||
sticker5_print_ip TEXT DEFAULT NULL,
|
||||
|
||||
sticker_structure6_id BIGINT DEFAULT NULL,
|
||||
sticker6_machine_id BIGINT DEFAULT NULL,
|
||||
sticker6_print_ip TEXT DEFAULT NULL,
|
||||
|
||||
sticker_structure7_id BIGINT DEFAULT NULL,
|
||||
sticker7_machine_id BIGINT DEFAULT NULL,
|
||||
sticker7_print_ip TEXT DEFAULT NULL,
|
||||
|
||||
sticker_structure8_id BIGINT DEFAULT NULL,
|
||||
sticker8_machine_id BIGINT DEFAULT NULL,
|
||||
sticker8_print_ip TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants(id),
|
||||
FOREIGN KEY (item_characteristic_id) REFERENCES item_characteristics(id),
|
||||
|
||||
FOREIGN KEY (sticker_structure1_id) REFERENCES sticker_structure_details(id),
|
||||
FOREIGN KEY (sticker_structure2_id) REFERENCES sticker_structure_details(id),
|
||||
FOREIGN KEY (sticker_structure3_id) REFERENCES sticker_structure_details(id),
|
||||
FOREIGN KEY (sticker_structure4_id) REFERENCES sticker_structure_details(id),
|
||||
FOREIGN KEY (sticker_structure5_id) REFERENCES sticker_structure_details(id),
|
||||
FOREIGN KEY (sticker_structure6_id) REFERENCES sticker_structure_details(id),
|
||||
FOREIGN KEY (sticker_structure7_id) REFERENCES sticker_structure_details(id),
|
||||
FOREIGN KEY (sticker_structure8_id) REFERENCES sticker_structure_details(id),
|
||||
|
||||
FOREIGN KEY (sticker1_machine_id) REFERENCES machines(id),
|
||||
FOREIGN KEY (sticker2_machine_id) REFERENCES machines(id),
|
||||
FOREIGN KEY (sticker3_machine_id) REFERENCES machines(id),
|
||||
FOREIGN KEY (sticker4_machine_id) REFERENCES machines(id),
|
||||
FOREIGN KEY (sticker5_machine_id) REFERENCES machines(id),
|
||||
FOREIGN KEY (sticker6_machine_id) REFERENCES machines(id),
|
||||
FOREIGN KEY (sticker7_machine_id) REFERENCES machines(id),
|
||||
FOREIGN KEY (sticker8_machine_id) REFERENCES machines(id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sticker_mapping_masters');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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 item_characteristics
|
||||
ADD COLUMN mrp TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('item_characteristics', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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 alert_mail_rules
|
||||
ADD COLUMN machine_id BIGINT DEFAULT NULL,
|
||||
ADD CONSTRAINT alert_mail_rules_machine_id_fkey
|
||||
FOREIGN KEY (machine_id) REFERENCES machines(id);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('alert_mail_rules', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user