Compare commits
129 Commits
renovate/a
...
901058500d
| Author | SHA1 | Date | |
|---|---|---|---|
| 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')
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
|
||||
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,11 @@ 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;
|
||||
|
||||
class PanelBoxValidationResource extends Resource
|
||||
{
|
||||
@@ -179,6 +182,7 @@ 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;
|
||||
@@ -507,45 +511,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();
|
||||
|
||||
@@ -950,17 +934,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 +962,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 +977,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);
|
||||
@@ -1732,7 +1716,189 @@ 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('Item')
|
||||
->label('Search by Item Code')
|
||||
->nullable()
|
||||
->searchable()
|
||||
->reactive()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Item::whereHas('productionCharacteristics', function ($query) use ($plantId) {
|
||||
if ($plantId) {
|
||||
$query->where('plant_id', $plantId);
|
||||
}
|
||||
})->pluck('code', 'id');
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('production_order', null);
|
||||
}),
|
||||
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['Item'])) {
|
||||
$query->where('item_id', $data['Item']);
|
||||
}
|
||||
|
||||
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['Item'])) {
|
||||
$indicators[] = 'Item Code: '.Item::where('id', $data['Item'])->value('code');
|
||||
}
|
||||
|
||||
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(),
|
||||
|
||||
@@ -98,6 +98,7 @@ class CreatePanelBoxValidation extends CreateRecord {
|
||||
$this->existingRecords = ProductCharacteristicsMaster::where('plant_id', $plantId)
|
||||
->where('category', $categoryName)
|
||||
->where('line_id', $lineId)
|
||||
->orderBy('id', 'asc')
|
||||
->get();
|
||||
|
||||
return $this->existingRecords->isNotEmpty();
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -132,6 +132,9 @@ 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,
|
||||
'created_by' => $this->data['created_by'] ?? null,
|
||||
]);
|
||||
|
||||
@@ -193,7 +196,8 @@ public $records = [];
|
||||
'observed_value' => $value ?? null,
|
||||
'status' => $status,
|
||||
'inspection_status' => $finalInspectionStatus ?? null,
|
||||
'created_by' => $this->data['operator_id'] ?? null,
|
||||
'created_by' => $this->data['created_by'] ?? null,
|
||||
'updated_by' => $this->data['updated_by'] ?? null,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -185,4 +185,9 @@ class Line extends Model
|
||||
// {
|
||||
// return $this->hasMany(RejectReason::class, 'line_id', 'id');
|
||||
// }
|
||||
|
||||
public function panelBoxValidations()
|
||||
{
|
||||
return $this->hasMany(PanelBoxValidation::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,6 +159,11 @@ class Plant extends Model
|
||||
return $this->hasMany(ClassCharacteristic::class, 'plant_id', 'id');
|
||||
}
|
||||
|
||||
// public function ModelMasters()
|
||||
// {
|
||||
// return $this->hasMany(ModelMaster::class, 'plant_id', 'id');
|
||||
// }
|
||||
|
||||
// public function rejectReasons()
|
||||
// {
|
||||
// return $this->hasMany(RejectReason::class, 'plant_id', 'id');
|
||||
@@ -198,4 +213,11 @@ 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');
|
||||
}
|
||||
}
|
||||
|
||||
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',
|
||||
|
||||
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) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -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 panel_gr_masters
|
||||
ADD COLUMN inspection_lot_number TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('panel_gr_masters', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -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 panel_box_validations
|
||||
ADD COLUMN inspection_lot_number TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('panel_box_validations', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -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 production_characteristics
|
||||
ADD COLUMN inspection_lot_number TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('production_characteristics', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -243,6 +243,7 @@ class PermissionSeeder extends Seeder
|
||||
Permission::updateOrCreate(['name' => 'view import panel gr master']);
|
||||
Permission::updateOrCreate(['name' => 'view export panel gr master']);
|
||||
|
||||
Permission::updateOrCreate(['name' => 'view sticker print page']);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,54 +73,27 @@
|
||||
Our dedicated IIoT support team is available round-the-clock to ensure
|
||||
uninterrupted operations and quick issue resolution.
|
||||
</p>
|
||||
<p class="text-lg font-medium text-gray-900">
|
||||
<p class="text-lg font-medium text-gray-900 flex flex-wrap items-center gap-2">
|
||||
📞 Support Landline: <span class="font-semibold">0422 711 7179</span>
|
||||
</p>
|
||||
{{-- <p class="text-lg font-medium text-gray-900">
|
||||
📞 Technical Support Contact: <span class="font-semibold">9952468104 / 9100832269</span>
|
||||
</p> --}}
|
||||
</div>
|
||||
<p class="text-lg font-medium text-gray-900 flex flex-wrap items-center gap-2">
|
||||
<img
|
||||
src="https://www.zoho.com/favicon.ico"
|
||||
alt="Zoho"
|
||||
class="w-5 h-5"
|
||||
>
|
||||
|
||||
{{-- <div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
<h2 class="text-2xl font-semibold mb-4">24×7 Support</h2>
|
||||
<span>Zoho Support:</span>
|
||||
|
||||
<p class="text-lg text-gray-700 mb-4">
|
||||
Our support structure is designed to ensure quick resolution based on the type
|
||||
of issue — whether it is on-site, application-related, or infrastructure-related.
|
||||
</p>
|
||||
|
||||
<div class="space-y-3">
|
||||
|
||||
<p class="text-lg font-medium text-gray-900">
|
||||
🏭 <strong>Plant & On-Site Support</strong> <br>
|
||||
<span class="text-gray-700">
|
||||
For plant visits, industry-level issues, and on-ground validation
|
||||
</span><br>
|
||||
📞 <span class="font-semibold">8925899458 / 8925899459</span>
|
||||
</p>
|
||||
|
||||
<p class="text-lg font-medium text-gray-900">
|
||||
💻 <strong>Application & Logic Support</strong> <br>
|
||||
<span class="text-gray-700">
|
||||
For website errors, logic issues, and application-level problems
|
||||
</span><br>
|
||||
📞 <span class="font-semibold">9952468104 / 9100832269</span>
|
||||
<a
|
||||
href="https://join.zoho.in"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="font-semibold text-blue-600 hover:underline"
|
||||
>
|
||||
https://join.zoho.in
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
|
||||
<!-- TEAM -->
|
||||
{{-- <div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
<h2 class="text-2xl font-semibold mb-4">IIOT Team Members</h2>
|
||||
<div class="grid grid-cols-2 md:grid-cols-3 gap-4 text-gray-700">
|
||||
<div class="flex items-center gap-2">👤 Jothikumar</div>
|
||||
<div class="flex items-center gap-2">👤 Jeithef Shibu</div>
|
||||
<div class="flex items-center gap-2">👤 Dhanabalan</div>
|
||||
<div class="flex items-center gap-2">👤 Ranjith</div>
|
||||
<div class="flex items-center gap-2">👤 Srimathy</div>
|
||||
<div class="flex items-center gap-2">👤 Gokul</div>
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
</x-filament-panels::page>
|
||||
|
||||
28
resources/views/filament/pages/sticker-print.blade.php
Normal file
28
resources/views/filament/pages/sticker-print.blade.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<x-filament-panels::page>
|
||||
|
||||
|
||||
{{ $this->form }}
|
||||
|
||||
<script>
|
||||
document.addEventListener('livewire:init', () => {
|
||||
|
||||
Livewire.on('open-sticker-pdf', (event) => {
|
||||
|
||||
console.log('PDF EVENT RECEIVED', event);
|
||||
|
||||
const urls = event.urls;
|
||||
|
||||
console.log('PDF URLs:', urls);
|
||||
|
||||
urls.forEach(url => {
|
||||
window.open(url, '_blank');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
</x-filament-panels::page>
|
||||
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
<x-filament-panels::page>
|
||||
<div class="space-y-4">
|
||||
{{-- Form --}}
|
||||
<div class="space-y-4">
|
||||
{{ $this->filtersForm($this->form) }}
|
||||
</div>
|
||||
|
||||
{{-- Preview Button --}}
|
||||
<div class="flex flex-row gap-2 mt-4">
|
||||
<button
|
||||
type="button"
|
||||
wire:click="showPreview"
|
||||
class="px-3 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
|
||||
>
|
||||
Show Preview
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{{-- PDF Preview --}}
|
||||
{{-- @if($this->pdfPreview)
|
||||
<div class="mt-6">
|
||||
<h3 class="text-lg font-medium text-gray-900">Preview</h3>
|
||||
<div class="mt-2 border rounded overflow-hidden bg-white">
|
||||
<embed
|
||||
src="data:application/pdf;base64,{{ $this->pdfPreview }}"
|
||||
type="application/pdf"
|
||||
width="100%"
|
||||
height="600px"
|
||||
class="bg-gray-50"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@endif --}}
|
||||
|
||||
{{-- PDF Preview with Fallback --}}
|
||||
@if($this->pdfPreview)
|
||||
<div class="mt-6">
|
||||
{{-- <h3 class="text-lg font-medium text-gray-900">Sticker Preview</h3> --}}
|
||||
<div class="mt-2 border rounded overflow-hidden bg-gray-50">
|
||||
<object
|
||||
data="data:application/pdf;base64,{{ $this->pdfPreview }}"
|
||||
type="application/pdf"
|
||||
width="100%"
|
||||
height="600"
|
||||
style="min-height: 600px;"
|
||||
>
|
||||
<p class="p-4 text-red-600 bg-white border border-red-200 rounded">
|
||||
<strong>⚠️ Your browser cannot display PDFs inline.</strong><br>
|
||||
Don’t worry — you can still:
|
||||
</p>
|
||||
<div class="p-4 bg-white">
|
||||
<!-- Fallback: Provide a download link -->
|
||||
<a
|
||||
href="data:application/pdf;base64,{{ $this->pdfPreview }}"
|
||||
download="sticker_preview.pdf"
|
||||
class="inline-flex items-center px-4 py-2 bg-primary-600 text-white text-sm font-medium rounded hover:bg-primary-700"
|
||||
>
|
||||
📥 Download PDF Preview
|
||||
</a>
|
||||
<p class="mt-2 text-sm text-gray-600">
|
||||
Or try opening this page in Chrome, Edge, or Firefox.
|
||||
</p>
|
||||
</div>
|
||||
</object>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</x-filament-panels::page>
|
||||
@@ -0,0 +1,69 @@
|
||||
<x-filament::page>
|
||||
<form wire:submit.prevent="create" class="space-y-6">
|
||||
{{-- Form Section --}}
|
||||
<div class="filament-form space-y-6">
|
||||
{{ $this->form }}
|
||||
</div>
|
||||
|
||||
{{-- <livewire:notification-sound /> --}}
|
||||
|
||||
{{-- Livewire Component (Invoice Table) --}}
|
||||
{{-- <div class="bg-white shadow rounded-xl p-4">
|
||||
<livewire:sticker-validation :ref-data="$ref_number" />
|
||||
</div> --}}
|
||||
|
||||
{{-- Actions --}}
|
||||
<div class="filament-actions mt-6">
|
||||
<x-filament::actions>
|
||||
@foreach ($this->getFormActions() as $action)
|
||||
{{ $action }}
|
||||
@endforeach
|
||||
</x-filament::actions>
|
||||
</div>
|
||||
</form>
|
||||
</x-filament::page>
|
||||
|
||||
<script>
|
||||
window.addEventListener('open-stickers-sequence', async (event) => {
|
||||
const urls = event.detail.urls;
|
||||
|
||||
for (const url of urls) {
|
||||
const win = window.open(url, '_blank');
|
||||
|
||||
win.onload = () => {
|
||||
win.focus();
|
||||
win.print();
|
||||
};
|
||||
|
||||
// wait before next
|
||||
await new Promise(r => setTimeout(r, 1500));
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
window.addEventListener('open-sticker-pdf', event => {
|
||||
|
||||
console.log('PDF event:', event.detail);
|
||||
|
||||
let url = null;
|
||||
|
||||
// Livewire v3 wraps payload in array
|
||||
if (Array.isArray(event.detail)) {
|
||||
url = event.detail[0]?.url;
|
||||
}
|
||||
|
||||
// fallback (if direct object comes)
|
||||
else if (event.detail?.url) {
|
||||
url = event.detail.url;
|
||||
}
|
||||
|
||||
if (url) {
|
||||
window.open(url, '_blank');
|
||||
} else {
|
||||
console.error('PDF URL missing', event.detail);
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -167,6 +167,10 @@ Route::get('get-pdf', [PdfController::class, 'getPdf']); // processorder/get-pdf
|
||||
|
||||
// ..Part Validation - Characteristics
|
||||
|
||||
Route::get('laser/item/get-quality-master-data', [StickerMasterController::class, 'get_quality_master']);
|
||||
|
||||
// ..Part Validation - Characteristics
|
||||
|
||||
Route::get('laser/item/get-master-data', [StickerMasterController::class, 'get_master']);
|
||||
|
||||
// ..Laser Route to SAP
|
||||
@@ -235,6 +239,6 @@ Route::get('/print-pallet/{pallet}/{plant}', [PalletPrintController::class, 'pri
|
||||
|
||||
Route::post('vehicle/entry', [VehicleController::class, 'storeVehicleEntry']);
|
||||
|
||||
//..Item Code
|
||||
// ..Item Code
|
||||
|
||||
Route::get('item-code', [PlantController::class, 'getItemCode']);
|
||||
|
||||
@@ -8,8 +8,10 @@ use App\Models\EquipmentMaster;
|
||||
use App\Models\User;
|
||||
use Filament\Facades\Filament;
|
||||
use Illuminate\Http\Request;
|
||||
// use Illuminate\Support\Facades\Password;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use thiagoalessio\TesseractOCR\TesseractOCR;
|
||||
use Carbon\Carbon;
|
||||
|
||||
Route::get('/', function () {
|
||||
return redirect('/admin');
|
||||
@@ -19,6 +21,51 @@ Route::get('/', function () {
|
||||
// return redirect('/admin/welcome');
|
||||
// });
|
||||
|
||||
// Route::get('/password-reset/approve/{token}', function ($token) {
|
||||
|
||||
// // $workerId = cache()->pull("password-reset-approval-{$token}");
|
||||
|
||||
// $workerId = cache()->get("password-reset-approval-{$token}");
|
||||
|
||||
// if (! $workerId) {
|
||||
// return response()->view('errors.password-reset-expired', [], 410);
|
||||
// }
|
||||
|
||||
// $worker = User::findOrFail($workerId);
|
||||
|
||||
|
||||
// $resetToken = Password::broker()->createToken($worker);
|
||||
|
||||
|
||||
// $resetUrl = URL::temporarySignedRoute(
|
||||
// 'filament.admin.auth.password-reset.reset',
|
||||
// Carbon::now()->addMinutes(60),
|
||||
// [
|
||||
// 'email' => $worker->email,
|
||||
// 'token' => $resetToken,
|
||||
// ]
|
||||
// );
|
||||
|
||||
|
||||
// return redirect()->to($resetUrl);
|
||||
|
||||
// })->middleware('signed')->name('password-reset.approve');
|
||||
|
||||
//..
|
||||
|
||||
Route::get('/sticker/preview/{path}', function ($path) {
|
||||
$file = storage_path('app/' . $path);
|
||||
|
||||
if (!file_exists($file)) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
return response()->file($file, [
|
||||
'Content-Type' => 'application/pdf',
|
||||
'Content-Disposition' => 'inline',
|
||||
]);
|
||||
})->name('sticker.preview');
|
||||
|
||||
// ..Characteristic Approval Routes..//
|
||||
|
||||
Route::get('/characteristic/hold', [CharacteristicApprovalController::class, 'holdForm'])
|
||||
|
||||
Reference in New Issue
Block a user