Simplify view
This commit is contained in:
parent
acced9c054
commit
76c319a6a0
|
@ -22,7 +22,7 @@ class MemberView
|
|||
'data' => MemberResource::collection(Member::select('*')
|
||||
->filter($filter)->search($request->query('search', null))
|
||||
->with('billKind')->with('payments.subscription')->with('memberships')->with('courses')->with('subscription')->with('leaderMemberships')->with('ageGroupMemberships')
|
||||
->withIsConfirmed()->withPendingPayment()
|
||||
->withPendingPayment()
|
||||
->orderByRaw('lastname, firstname')
|
||||
->paginate(15)
|
||||
),
|
||||
|
|
|
@ -30,7 +30,6 @@ use Zoomyboy\LaravelNami\Data\MembershipEntry;
|
|||
/**
|
||||
* @property string $subscription_name
|
||||
* @property int $pending_payment
|
||||
* @property bool $is_confirmed
|
||||
*/
|
||||
class Member extends Model
|
||||
{
|
||||
|
@ -62,7 +61,6 @@ class Member extends Model
|
|||
'region_id' => 'integer',
|
||||
'confession_id' => 'integer',
|
||||
'nami_id' => 'integer',
|
||||
'is_confirmed' => 'boolean',
|
||||
'has_svk' => 'boolean',
|
||||
'has_vk' => 'boolean',
|
||||
'multiply_pv' => 'boolean',
|
||||
|
@ -283,11 +281,6 @@ class Member extends Model
|
|||
return $q->orderByRaw('firstname, lastname');
|
||||
}
|
||||
|
||||
public function scopeWithIsConfirmed(Builder $q): Builder
|
||||
{
|
||||
return $q->selectSub('DATEDIFF(NOW(), IFNULL(confirmed_at, DATE_SUB(NOW(), INTERVAL 3 YEAR))) < 712', 'is_confirmed');
|
||||
}
|
||||
|
||||
public function scopeWithPendingPayment(Builder $q): Builder
|
||||
{
|
||||
return $q->addSelect([
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Member;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class MemberConfirmController extends Controller
|
||||
{
|
||||
public function __invoke(Request $request, Member $member): RedirectResponse
|
||||
{
|
||||
$member->update(['confirmed_at' => now()]);
|
||||
|
||||
return redirect()->route('member.index');
|
||||
}
|
||||
}
|
|
@ -57,7 +57,6 @@ class MemberResource extends JsonResource
|
|||
'bill_kind_id' => $this->bill_kind_id,
|
||||
'bill_kind_name' => optional($this->billKind)->name,
|
||||
'has_nami' => null !== $this->nami_id,
|
||||
'is_confirmed' => $this->is_confirmed,
|
||||
'children_phone' => $this->children_phone,
|
||||
'payments' => PaymentResource::collection($this->whenLoaded('payments')),
|
||||
'memberships' => MembershipResource::collection($this->whenLoaded('memberships')),
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class() extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('members', function (Blueprint $table) {
|
||||
$table->dropColumn('confirmed_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
}
|
||||
};
|
|
@ -19,14 +19,6 @@
|
|||
<!-- ****************************** menu links ******************************* -->
|
||||
<v-tabs v-model="active" :entries="menu">
|
||||
<div slot="bottom">
|
||||
<button
|
||||
type="button"
|
||||
v-show="mode !== 'create'"
|
||||
@click.prevent="confirm"
|
||||
class="btn block w-full btn-primary"
|
||||
>
|
||||
Daten bestätigen
|
||||
</button>
|
||||
<button type="submit" class="mt-3 btn block w-full btn-primary">Speichern</button>
|
||||
</div>
|
||||
</v-tabs>
|
||||
|
@ -262,9 +254,6 @@ export default {
|
|||
},
|
||||
|
||||
methods: {
|
||||
confirm() {
|
||||
this.$inertia.post(`/member/${this.inner.id}/confirm`);
|
||||
},
|
||||
submit() {
|
||||
this.mode === 'create'
|
||||
? this.$inertia.post(`/member`, this.inner)
|
||||
|
|
|
@ -12,38 +12,34 @@
|
|||
<th></th>
|
||||
<th>Nachname</th>
|
||||
<th>Vorname</th>
|
||||
<th>Straße</th>
|
||||
<th>PLZ</th>
|
||||
<th>Ort</th>
|
||||
<th>Tags</th>
|
||||
<th>Beitrag</th>
|
||||
<th>Geburtstag</th>
|
||||
<th>Alter</th>
|
||||
<th v-show="hasModule('bill')">Rechnung</th>
|
||||
<th v-show="hasModule('bill')">Ausstand</th>
|
||||
<th>Eintritt</th>
|
||||
<th></th>
|
||||
</thead>
|
||||
|
||||
<tr v-for="(member, index) in data.data" :key="index">
|
||||
<td class="w-6 flex gap-1 items-center">
|
||||
<svg-sprite
|
||||
class="w-3 h-3 flex-none"
|
||||
v-if="member.is_leader"
|
||||
:class="ageColors.leiter"
|
||||
src="lilie"
|
||||
></svg-sprite>
|
||||
<svg-sprite
|
||||
class="w-3 h-3 flex-none"
|
||||
v-if="member.age_group_icon"
|
||||
:class="ageColors[member.age_group_icon]"
|
||||
src="lilie"
|
||||
></svg-sprite>
|
||||
<td>
|
||||
<div class="flex gap-1 items-center">
|
||||
<svg-sprite
|
||||
class="w-3 h-3 flex-none"
|
||||
v-if="member.is_leader"
|
||||
:class="ageColors.leiter"
|
||||
src="lilie"
|
||||
></svg-sprite>
|
||||
<svg-sprite
|
||||
class="w-3 h-3 flex-none"
|
||||
v-if="member.age_group_icon"
|
||||
:class="ageColors[member.age_group_icon]"
|
||||
src="lilie"
|
||||
></svg-sprite>
|
||||
</div>
|
||||
</td>
|
||||
<td v-text="member.lastname"></td>
|
||||
<td v-text="member.firstname"></td>
|
||||
<td v-text="`${member.address}`"></td>
|
||||
<td v-text="`${member.zip}`"></td>
|
||||
<td v-text="`${member.location}`"></td>
|
||||
<td v-text="member.full_address"></td>
|
||||
<td>
|
||||
<div class="bool-row">
|
||||
<v-bool
|
||||
|
@ -58,16 +54,9 @@
|
|||
v-model="member.has_nami"
|
||||
>N</v-bool
|
||||
>
|
||||
<v-bool
|
||||
true-comment="Daten bestätigt"
|
||||
false-comment="Daten warten auf Bestätigung"
|
||||
v-model="member.is_confirmed"
|
||||
>C</v-bool
|
||||
>
|
||||
</div>
|
||||
</td>
|
||||
<td v-text="member.subscription ? member.subscription.name : ''"></td>
|
||||
<td v-text="`${member.birthday_human} (${member.age})`"></td>
|
||||
<td v-text="member.age"></td>
|
||||
<td v-show="hasModule('bill')">
|
||||
<div class="flex justify-center">
|
||||
<div
|
||||
|
@ -87,7 +76,6 @@
|
|||
></div>
|
||||
</div>
|
||||
</td>
|
||||
<td v-text="`${member.joined_at_human}`"></td>
|
||||
<td>
|
||||
<div class="flex space-x-1">
|
||||
<i-link :href="member.links.show" class="inline-flex btn btn-primary btn-sm"
|
||||
|
|
|
@ -9,7 +9,6 @@ use App\Initialize\Actions\InitializeAction;
|
|||
use App\Initialize\Actions\InitializeFormAction;
|
||||
use App\Member\Actions\MemberShowAction;
|
||||
use App\Member\Controllers\MemberResyncController;
|
||||
use App\Member\MemberConfirmController;
|
||||
use App\Member\MemberController;
|
||||
use App\Membership\Actions\MembershipDestroyAction;
|
||||
use App\Membership\Actions\MembershipStoreAction;
|
||||
|
@ -32,7 +31,6 @@ Route::group(['middleware' => 'auth:web'], function (): void {
|
|||
Route::apiResource('member.payment', PaymentController::class);
|
||||
Route::resource('allpayment', AllpaymentController::class);
|
||||
Route::resource('subscription', SubscriptionController::class);
|
||||
Route::post('/member/{member}/confirm', MemberConfirmController::class);
|
||||
Route::get('/member/{member}/pdf', MemberPdfController::class)
|
||||
->name('member.singlepdf');
|
||||
Route::get('/sendpayment', [SendpaymentController::class, 'create'])->name('sendpayment.create');
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
namespace Tests\Feature\Member;
|
||||
|
||||
use App\Activity;
|
||||
use App\Course\Models\Course;
|
||||
use App\Course\Models\CourseMember;
|
||||
use App\Member\Member;
|
||||
use App\Member\Membership;
|
||||
use App\Payment\Payment;
|
||||
|
@ -12,7 +10,6 @@ use App\Subactivity;
|
|||
use Carbon\Carbon;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Tests\TestCase;
|
||||
use Zoomyboy\LaravelNami\Backend\FakeBackend;
|
||||
|
||||
class IndexTest extends TestCase
|
||||
{
|
||||
|
@ -20,32 +17,19 @@ class IndexTest extends TestCase
|
|||
|
||||
public function testItGetsMembers(): void
|
||||
{
|
||||
$backend = app(FakeBackend::class)
|
||||
->fakeMember([
|
||||
'vorname' => '::firstname::',
|
||||
'nachname' => '::lastname::',
|
||||
'beitragsartId' => 300,
|
||||
'geburtsDatum' => '2014-07-11 00:00:00',
|
||||
'gruppierungId' => 1000,
|
||||
'id' => 411,
|
||||
'eintrittsdatum' => '2020-11-17 00:00:00',
|
||||
'geschlechtId' => 303,
|
||||
'landId' => 302,
|
||||
'staatsangehoerigkeitId' => 291,
|
||||
'zeitschriftenversand' => true,
|
||||
'strasse' => '::street',
|
||||
'plz' => '12346',
|
||||
'ort' => '::location::',
|
||||
'gruppierung' => '::group::',
|
||||
'version' => 40,
|
||||
]);
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
Member::factory()->defaults()->has(CourseMember::factory()->for(Course::factory()), 'courses')->create(['firstname' => '::firstname::']);
|
||||
Member::factory()->defaults()->create([
|
||||
'firstname' => '::firstname::',
|
||||
'address' => 'Kölner Str 3',
|
||||
'zip' => 33333,
|
||||
'location' => 'Hilden',
|
||||
]);
|
||||
|
||||
$response = $this->get('/member');
|
||||
|
||||
$this->assertComponent('member/VIndex', $response);
|
||||
$this->assertInertiaHas('::firstname::', $response, 'data.data.0.firstname');
|
||||
$this->assertInertiaHas('Kölner Str 3, 33333 Hilden', $response, 'data.data.0.full_address');
|
||||
}
|
||||
|
||||
public function testItShowsEfzForEfzMembership(): void
|
||||
|
|
Loading…
Reference in New Issue