fixed: set first activity id on update

This commit is contained in:
Philipp Lang 2021-07-05 13:31:20 +02:00
parent b108ccf7df
commit 4ba63d6391
3 changed files with 9 additions and 1 deletions

View File

@ -67,7 +67,13 @@ class MemberController extends Controller
session()->put('menu', 'member'); session()->put('menu', 'member');
session()->put('title', "Mitglied {$member->firstname} {$member->lastname} bearbeiten"); session()->put('title', "Mitglied {$member->firstname} {$member->lastname} bearbeiten");
$activities = Activity::with('subactivities')->get();
return \Inertia::render('member/Form', [ return \Inertia::render('member/Form', [
'activities' => $activities->pluck('name', 'id'),
'subactivities' => $activities->map(function($activity) {
return ['subactivities' => $activity->subactivities->pluck('name', 'id'), 'id' => $activity->id];
})->pluck('subactivities', 'id'),
'billKinds' => BillKind::get()->pluck('name', 'id'), 'billKinds' => BillKind::get()->pluck('name', 'id'),
'genders' => Gender::get()->pluck('name', 'id'), 'genders' => Gender::get()->pluck('name', 'id'),
'countries' => Country::get()->pluck('name', 'id'), 'countries' => Country::get()->pluck('name', 'id'),

View File

@ -66,7 +66,7 @@ class MemberRequest extends FormRequest
} }
public function persistUpdate(Member $member) { public function persistUpdate(Member $member) {
$member->update(Arr::except($this->input(), ['first_activity_id', 'first_subactivity_id'])); $member->update($this->input());
if($this->input('has_nami') && $member->nami_id === null) { if($this->input('has_nami') && $member->nami_id === null) {
CreateJob::dispatch($member, auth()->user()); CreateJob::dispatch($member, auth()->user());

View File

@ -50,6 +50,8 @@ class MemberResource extends JsonResource
'children_phone' => $this->children_phone, 'children_phone' => $this->children_phone,
'payments' => PaymentResource::collection($this->whenLoaded('payments')), 'payments' => PaymentResource::collection($this->whenLoaded('payments')),
'pending_payment' => $this->pending_payment ? number_format($this->pending_payment / 100, 2, ',', '.').' €' : null, 'pending_payment' => $this->pending_payment ? number_format($this->pending_payment / 100, 2, ',', '.').' €' : null,
'first_activity_id' => $this->first_activity_id,
'first_subactivity_id' => $this->first_subactivity_id,
]; ];
} }
} }