Add beitrag

This commit is contained in:
philipp lang 2021-07-04 18:29:21 +02:00
parent a0b3bad036
commit fa4467006f
4 changed files with 10 additions and 1 deletions

View File

@ -12,7 +12,7 @@ use App\Payment\PaymentResource;
class MemberView {
public function index(Request $request) {
return [
'data' => MemberResource::collection(Member::select('*')->search($request->query('search', null))->with('billKind')->withIsConfirmed()->paginate(15)),
'data' => MemberResource::collection(Member::select('*')->search($request->query('search', null))->with('billKind')->withSubscriptionName()->withIsConfirmed()->orderByRaw('lastname, firstname')->paginate(15)),
'toolbar' => [ ['href' => route('member.index'), 'label' => 'Zurück', 'color' => 'primary', 'icon' => 'plus'] ]
];
}

View File

@ -140,4 +140,10 @@ class Member extends Model
$q->selectSub('DATEDIFF(NOW(), IFNULL(confirmed_at, DATE_SUB(NOW(), INTERVAL 3 YEAR))) < 712', 'is_confirmed');
}
public function scopeWithSubscriptionName($q) {
return $q->addSelect([
'subscription_name' => Subscription::select('name')->whereColumn('subscriptions.id', 'members.subscription_id')->limit(1)
]);
}
}

View File

@ -28,6 +28,7 @@ class MemberResource extends JsonResource
'joined_at_human' => $this->joined_at->format('d.m.Y'),
'id' => $this->id,
'subscription_id' => $this->subscription_id,
'subscription_name' => $this->subscription_name,
'gender_id' => $this->gender_id,
'further_address' => $this->further_address,
'work_phone' => $this->work_phone,

View File

@ -9,6 +9,7 @@
<div>PLZ</div>
<div>Ort</div>
<div>Tags</div>
<div>Beitrag</div>
<div>Rechnung</div>
<div>Geburtstag</div>
<div>Eintritt</div>
@ -28,6 +29,7 @@
<v-bool v-model="member.is_confirmed">C</v-bool>
</div>
</div>
<div v-text="member.subscription_name"></div>
<div>
<div class="py-1 rounded-full flex text-xs items-center justify-center leading-none bg-primary-900" v-text="member.bill_kind_name" v-if="member.bill_kind_name"></div>
<div class="py-1 rounded-full flex text-xs items-center justify-center leading-none" v-else>Kein</div>