Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
iamBiB committed Nov 2, 2023
1 parent a0061a4 commit b7ed39e
Showing 1 changed file with 62 additions and 62 deletions.
124 changes: 62 additions & 62 deletions app/Filament/Resources/MapPointsResource/Pages/ViewMapPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,19 @@ public function editLocationAction(): Action
->description('Update map point location')
->schema([
TextInput::make('county')
->required()
->default($this->getRecord()->county)->disabled(),
->required()
->default($this->getRecord()->county)->disabled(),
TextInput::make('city')
->required()
->default($this->getRecord()->city)->disabled(),
->required()
->default($this->getRecord()->city)->disabled(),
TextInput::make('address')
->required()
->default($this->getRecord()->address),
->required()
->default($this->getRecord()->address),
// TextInput::make('lat')->required()->default($this->getRecord()->lat),
// TextInput::make('lon')->required()->default($this->getRecord()->lon),
TextInput::make('location_notes')
->required()
->default($this->getRecord()->location_notes),
->required()
->default($this->getRecord()->location_notes),

])
->columns(2),
Expand All @@ -98,53 +98,53 @@ public function editDetailsAction(): Action
->iconButton()
->form([
Select::make('type')
->label(__('map_points.point_type_alt'))
->label(__('map_points.point_type_alt'))
->options(MapPointTypeModel::query()->pluck('display_name', 'id'))
->default($this->getRecord()->type->id)
->required(),
Select::make('materials')
->label(__('map_points.materials'))
->label(__('map_points.materials'))
->options(RecycleMaterialModel::query()->pluck('name', 'id'))
->default($this->getRecord()->materials->pluck('id')->toArray())
->multiple()
->required(),
TextInput::make('managed_by')
->required()
->default($this->getRecord()->managed_by),
->required()
->default($this->getRecord()->managed_by),
TextInput::make('website')
->required()
->default($this->getRecord()->website),
->required()
->default($this->getRecord()->website),
TextInput::make('email')
->required()
->default($this->getRecord()->email)->email(),
->required()
->default($this->getRecord()->email)->email(),
TextInput::make('phone_no')
->required()
->default($this->getRecord()->phone_no),
->required()
->default($this->getRecord()->phone_no),
Repeater::make('opening_hours')
->schema([
Select::make('start_day')
->label('Start day')
->options(__('common.week_days'))
->options(__('common.week_days'))
->required(),
Select::make('end_day')
->label('End day')
->options(__('common.week_days'))
->options(__('common.week_days'))
// ->default($this->getRecord()->materials->pluck('id')->toArray())
->required(),
TimePicker::make('start_hour')
->seconds('false')
->hoursStep(1)
->seconds('false')
->hoursStep(1)
->minutesStep(10),
TimePicker::make('end_hour')
->seconds('false')
->hoursStep(1)
->seconds('false')
->hoursStep(1)
->minutesStep(10),
])
->default($this->getRecord()->opening_hours)
->default($this->getRecord()->opening_hours)
->columns(4),
TextInput::make('notes')
->required()
->default($this->getRecord()->notes),
->required()
->default($this->getRecord()->notes),
Checkbox::make('offers_transport')->default($this->getRecord()->offers_transport),
Checkbox::make('offers_money')->default($this->getRecord()->offers_money),
])
Expand All @@ -161,8 +161,8 @@ protected function getHeaderActions(): array
{
$actions = array_merge($actions, [
Action::make('validate-point')
->label(__('map_points.buttons.change_status'))
->icon('heroicon-m-check')
->label(__('map_points.buttons.change_status'))
->icon('heroicon-m-check')
->action(function (array $data, Collection $records): void
{
$this->record->changeStatus();
Expand All @@ -177,7 +177,7 @@ protected function getHeaderActions(): array
->label(__('map_points.buttons.set_group'))
->form([
Select::make('group_id')
->label(__('map_points.buttons.group'))
->label(__('map_points.buttons.group'))
->options(MapPointGroupModel::query()->pluck('name', 'id'))
->required(),
])
Expand Down Expand Up @@ -239,41 +239,41 @@ public function table(Table $table): Table
->query(ActionLogModel::whereModel(\get_class($this->getRecord()))->whereModelId($this->getRecord()->id)->orderBy('created_at', 'desc'))
->columns([
TextColumn::make('user_id')
->formatStateUsing(function (string $state, $record)
{
if ($record->user_id > 0)
{
$user = UserModel::find($record->user_id);
}
else
{
$user = new UserModel();
$user->name = 'System';
}
return "[{$record->user_id}] {$user->name}";
})
->html(),
->formatStateUsing(function (string $state, $record)
{
if ($record->user_id > 0)
{
$user = UserModel::find($record->user_id);
}
else
{
$user = new UserModel();
$user->name = 'System';
}

return "[{$record->user_id}] {$user->name}";
})
->html(),
TextColumn::make('action')
->formatStateUsing(function (string $state, $record)
{
return trans('actions.' . $record->action);
})
->html(),
->formatStateUsing(function (string $state, $record)
{
return trans('actions.' . $record->action);
})
->html(),
TextColumn::make('old_values')
->formatStateUsing(function (string $state, $record)
{
return ActionLogModel::formatValuesText($record, 'old_values');
})
->wrap()
->html(),
->formatStateUsing(function (string $state, $record)
{
return ActionLogModel::formatValuesText($record, 'old_values');
})
->wrap()
->html(),
TextColumn::make('new_values')
->formatStateUsing(function (string $state, $record)
{
return ActionLogModel::formatValuesText($record, 'new_values');
})
->wrap()
->html(),
->formatStateUsing(function (string $state, $record)
{
return ActionLogModel::formatValuesText($record, 'new_values');
})
->wrap()
->html(),
TextColumn::make('created_at'),

]);
Expand Down

0 comments on commit b7ed39e

Please sign in to comment.