ranjith-dev #638
@@ -48,6 +48,9 @@ class VehicleEntryResource extends Resource
|
|||||||
Forms\Components\TextInput::make('vehicle_number')
|
Forms\Components\TextInput::make('vehicle_number')
|
||||||
->label('Vehicle Number')
|
->label('Vehicle Number')
|
||||||
->required(),
|
->required(),
|
||||||
|
Forms\Components\TextInput::make('boom_opened')
|
||||||
|
->label('Boom Opened')
|
||||||
|
->required(),
|
||||||
Forms\Components\DateTimePicker::make('entry_time')
|
Forms\Components\DateTimePicker::make('entry_time')
|
||||||
->label('Entry Time')
|
->label('Entry Time')
|
||||||
->required()
|
->required()
|
||||||
@@ -121,6 +124,11 @@ class VehicleEntryResource extends Resource
|
|||||||
->sortable()
|
->sortable()
|
||||||
->searchable()
|
->searchable()
|
||||||
->formatStateUsing(fn ($state) => strtoupper($state)),
|
->formatStateUsing(fn ($state) => strtoupper($state)),
|
||||||
|
Tables\Columns\TextColumn::make('boom_opened')
|
||||||
|
->label('Boom Opened')
|
||||||
|
->alignCenter()
|
||||||
|
->sortable()
|
||||||
|
->searchable(),
|
||||||
Tables\Columns\TextColumn::make('entry_time')
|
Tables\Columns\TextColumn::make('entry_time')
|
||||||
->label('Entry Time')
|
->label('Entry Time')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
|
|||||||
@@ -147,12 +147,19 @@ class VehicleController extends Controller
|
|||||||
foreach ($data as $item) {
|
foreach ($data as $item) {
|
||||||
|
|
||||||
$uuid = $item['uuid'] ?? '';
|
$uuid = $item['uuid'] ?? '';
|
||||||
$vehicleNo = trim($item['vehicle_number'] ?? '');
|
$vehicleNo = strtoupper(trim($item['vehicle_number'] ?? ''));
|
||||||
$entryTimeRaw = $item['entry_time'] ?? '';
|
$entryTimeRaw = $item['entry_time'] ?? '';
|
||||||
$exitTimeRaw = $item['exit_time'] ?? '';
|
$exitTimeRaw = $item['exit_time'] ?? '';
|
||||||
$duration = $item['duration'] ?? '';
|
$duration = $item['duration'] ?? '';
|
||||||
$type = $item['type'] ?? '';
|
$type = $item['type'] ?? '';
|
||||||
|
|
||||||
|
$manualVehicles = [
|
||||||
|
'TN01KK0004',
|
||||||
|
'TN01KK0001',
|
||||||
|
];
|
||||||
|
|
||||||
|
$boomOpened = in_array($vehicleNo, $manualVehicles) ? 'Manual' : 'Auto';
|
||||||
|
|
||||||
if(!empty($entryTimeRaw)){
|
if(!empty($entryTimeRaw)){
|
||||||
$entryTime = $entryTimeRaw
|
$entryTime = $entryTimeRaw
|
||||||
? Carbon::createFromFormat('d/m/Y h:i:s A', $entryTimeRaw)
|
? Carbon::createFromFormat('d/m/Y h:i:s A', $entryTimeRaw)
|
||||||
@@ -194,7 +201,8 @@ class VehicleController extends Controller
|
|||||||
'uuid' => $uuid
|
'uuid' => $uuid
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'vehicle_number' => strtoupper($vehicleNo),
|
'vehicle_number' => $vehicleNo,
|
||||||
|
'boom_opened' => $boomOpened,
|
||||||
'entry_time' => $entryTime,
|
'entry_time' => $entryTime,
|
||||||
'exit_time' => $exitTime ?? null,
|
'exit_time' => $exitTime ?? null,
|
||||||
'duration' => $duration ?: null,
|
'duration' => $duration ?: null,
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ class VehicleEntry extends Model
|
|||||||
'duration',
|
'duration',
|
||||||
'type',
|
'type',
|
||||||
'uuid',
|
'uuid',
|
||||||
|
'boom_opened',
|
||||||
'created_at',
|
'created_at',
|
||||||
'created_by',
|
'created_by',
|
||||||
'updated_at',
|
'updated_at',
|
||||||
|
|||||||
@@ -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 vehicle_entries
|
||||||
|
ADD COLUMN boom_opened TEXT DEFAULT NULL
|
||||||
|
SQL;
|
||||||
|
|
||||||
|
DB::statement($sql1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
// Schema::table('vehicle_entries', function (Blueprint $table) {
|
||||||
|
// //
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user