Add filter for activity and subactivity
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
6f9ccd7c92
commit
6e8d169f54
|
@ -11,7 +11,7 @@ class Activity extends Model
|
||||||
|
|
||||||
use HasNamiField;
|
use HasNamiField;
|
||||||
|
|
||||||
public $fillable = ['name', 'nami_id'];
|
public $fillable = ['name', 'is_filterable', 'nami_id'];
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
public $casts = [
|
public $casts = [
|
||||||
|
|
|
@ -9,6 +9,7 @@ use App\Payment\ActionFactory;
|
||||||
use App\Payment\PaymentResource;
|
use App\Payment\PaymentResource;
|
||||||
use App\Payment\Status;
|
use App\Payment\Status;
|
||||||
use App\Payment\Subscription;
|
use App\Payment\Subscription;
|
||||||
|
use App\Subactivity;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class MemberView {
|
class MemberView {
|
||||||
|
@ -23,6 +24,8 @@ class MemberView {
|
||||||
->orderByRaw('lastname, firstname')
|
->orderByRaw('lastname, firstname')
|
||||||
->paginate(15)
|
->paginate(15)
|
||||||
),
|
),
|
||||||
|
'filterActivities' => Activity::where('is_filterable', true)->get()->pluck('name', 'id'),
|
||||||
|
'filterSubactivities' => Subactivity::where('is_filterable', true)->get()->pluck('name', 'id'),
|
||||||
'toolbar' => [ ['href' => route('member.index'), 'label' => 'Zurück', 'color' => 'primary', 'icon' => 'plus'] ],
|
'toolbar' => [ ['href' => route('member.index'), 'label' => 'Zurück', 'color' => 'primary', 'icon' => 'plus'] ],
|
||||||
'paymentDefaults' => ['nr' => date('Y')],
|
'paymentDefaults' => ['nr' => date('Y')],
|
||||||
'subscriptions' => Subscription::get()->pluck('name', 'id'),
|
'subscriptions' => Subscription::get()->pluck('name', 'id'),
|
||||||
|
|
|
@ -204,6 +204,16 @@ class Member extends Model
|
||||||
if (data_get($filter, 'bill_kind', false)) {
|
if (data_get($filter, 'bill_kind', false)) {
|
||||||
$q->where('bill_kind_id', $filter['bill_kind']);
|
$q->where('bill_kind_id', $filter['bill_kind']);
|
||||||
}
|
}
|
||||||
|
if (data_get($filter, 'subactivity_id', false) || data_get($filter, 'activity_id', false)) {
|
||||||
|
$q->whereHas('memberships', function ($q) use ($filter) {
|
||||||
|
if (data_get($filter, 'subactivity_id', false)) {
|
||||||
|
$q->where('subactivity_id', $filter['subactivity_id']);
|
||||||
|
}
|
||||||
|
if (data_get($filter, 'activity_id', false)) {
|
||||||
|
$q->where('activity_id', $filter['activity_id']);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@ class MemberController extends Controller
|
||||||
public $filter = [
|
public $filter = [
|
||||||
'ausstand' => false,
|
'ausstand' => false,
|
||||||
'bill_kind' => null,
|
'bill_kind' => null,
|
||||||
|
'activity_id' => null,
|
||||||
|
'subactivity_id' => null,
|
||||||
];
|
];
|
||||||
|
|
||||||
public function index(Request $request): Response {
|
public function index(Request $request): Response {
|
||||||
|
|
|
@ -15,7 +15,7 @@ class Subactivity extends Model
|
||||||
use HasNamiField;
|
use HasNamiField;
|
||||||
use Sluggable;
|
use Sluggable;
|
||||||
|
|
||||||
public $fillable = ['is_age_group', 'slug', 'name', 'nami_id'];
|
public $fillable = ['is_age_group', 'is_filterable', 'slug', 'name', 'nami_id'];
|
||||||
|
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Activity;
|
||||||
|
use App\Subactivity;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateActivitiesIsLeaderColumn extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('activities', function (Blueprint $table) {
|
||||||
|
$table->boolean('is_filterable')->after('name')->default(false);
|
||||||
|
});
|
||||||
|
Schema::table('subactivities', function (Blueprint $table) {
|
||||||
|
$table->boolean('is_filterable')->after('slug')->default(false);
|
||||||
|
});
|
||||||
|
Activity::whereIn('name', ['€ Mitglied', '€ passive Mitgliedschaft', 'Schnuppermitgliedschaft', '€ LeiterIn', '€ KassiererIn', '€ KassenprüferIn'])
|
||||||
|
->update(['is_filterable' => true]);
|
||||||
|
SubActivity::whereIn('name', ['Biber', 'Wölfling', 'Jungpfadfinder', 'Pfadfinder', 'Rover', 'Vorstand', 'Sonstige'])
|
||||||
|
->update(['is_filterable' => true]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('activities', function (Blueprint $table) {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,8 @@
|
||||||
<div class="px-6 py-2 flex border-b border-gray-600 space-x-3">
|
<div class="px-6 py-2 flex border-b border-gray-600 space-x-3">
|
||||||
<f-switch id="ausstand" @input="reload" v-model="value.ausstand" label="Nur Ausstände" size="sm"></f-switch>
|
<f-switch id="ausstand" @input="reload" v-model="value.ausstand" label="Nur Ausstände" size="sm"></f-switch>
|
||||||
<f-select id="billKinds" @input="reload" :options="billKinds" v-model="value.bill_kind" label="Rechnung" size="sm"></f-select>
|
<f-select id="billKinds" @input="reload" :options="billKinds" v-model="value.bill_kind" label="Rechnung" size="sm"></f-select>
|
||||||
|
<f-select id="activity_id" @input="reload" :options="activities" v-model="value.activity_id" label="Tätigkeit" size="sm"></f-select>
|
||||||
|
<f-select id="subactivity_id" @input="reload" :options="subactivities" v-model="value.subactivity_id" label="Untertätigkeit" size="sm"></f-select>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -15,6 +17,8 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
value: {},
|
value: {},
|
||||||
billKinds: {},
|
billKinds: {},
|
||||||
|
activities: {},
|
||||||
|
subactivities: {},
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<filt v-model="query.filter" :bill-kinds="billKinds"></filt>
|
<filt v-model="query.filter" :activities="filterActivities" :subactivities="filterSubactivities" :bill-kinds="billKinds"></filt>
|
||||||
|
|
||||||
<table cellspacing="0" cellpadding="0" border="0" class="custom-table custom-table-sm">
|
<table cellspacing="0" cellpadding="0" border="0" class="custom-table custom-table-sm">
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -118,6 +118,8 @@ export default {
|
||||||
billKinds: {},
|
billKinds: {},
|
||||||
activities: {},
|
activities: {},
|
||||||
subactivities: {},
|
subactivities: {},
|
||||||
|
filterActivities: {},
|
||||||
|
filterSubactivities: {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue