Add button to export members
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
86590f93a5
commit
8669199b1a
|
@ -16,7 +16,7 @@ class ExportAction
|
|||
use AsAction;
|
||||
|
||||
/**
|
||||
* @param Collection<int, Member>
|
||||
* @param Collection<int, Member> $members
|
||||
*/
|
||||
public function handle(Collection $members): string
|
||||
{
|
||||
|
@ -31,9 +31,9 @@ class ExportAction
|
|||
$member->address,
|
||||
$member->zip,
|
||||
$member->location,
|
||||
$member->mainPhone,
|
||||
$member->mobilePhone,
|
||||
$member->workPhone,
|
||||
$member->main_phone,
|
||||
$member->mobile_phone,
|
||||
$member->work_phone,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,11 +7,16 @@ export default {
|
|||
props: {
|
||||
data: {},
|
||||
},
|
||||
computed: {
|
||||
filterString() {
|
||||
return btoa(JSON.stringify(this.inner.meta.filter));
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
reload(resetPage = true) {
|
||||
var _self = this;
|
||||
var data = {
|
||||
filter: btoa(JSON.stringify(this.inner.meta.filter)),
|
||||
filter: this.filterString,
|
||||
page: 1,
|
||||
};
|
||||
|
||||
|
@ -50,4 +55,3 @@ export default {
|
|||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="pb-6">
|
||||
<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 items-center space-x-3">
|
||||
<f-switch v-show="hasModule('bill')" id="ausstand" @input="setFilter('ausstand', $event)" :items="getFilter('ausstand')" label="Nur Ausstände" size="sm"></f-switch>
|
||||
<f-select
|
||||
v-show="hasModule('bill')"
|
||||
|
@ -30,6 +30,10 @@
|
|||
size="sm"
|
||||
name="subactivity_id"
|
||||
></f-select>
|
||||
<button class="btn btn-primary label mr-2" @click.prevent="exportMembers">
|
||||
<svg-sprite class="w-3 h-3 xl:mr-2" src="save"></svg-sprite>
|
||||
<span class="hidden xl:inline">Exportieren</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<table cellspacing="0" cellpadding="0" border="0" class="custom-table custom-table-sm hidden md:table">
|
||||
|
@ -132,6 +136,9 @@ export default {
|
|||
},
|
||||
|
||||
methods: {
|
||||
exportMembers() {
|
||||
window.open(`/member-export?filter=${this.filterString}`);
|
||||
},
|
||||
remove(member) {
|
||||
if (window.confirm('Mitglied löschen?')) {
|
||||
this.$inertia.delete(`/member/${member.id}`);
|
||||
|
|
|
@ -19,7 +19,7 @@ class ExportCsvActionTest extends TestCase
|
|||
Storage::fake('temp');
|
||||
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
Member::factory()->defaults()->postBillKind()->create(['firstname' => 'Jane']);
|
||||
Member::factory()->defaults()->postBillKind()->create(['firstname' => 'Jane', 'main_phone' => '+49 176 70343221']);
|
||||
Member::factory()->defaults()->emailBillKind()->create(['firstname' => 'Max']);
|
||||
|
||||
$response = $this->callFilter('member-export', ['bill_kind' => 'Post']);
|
||||
|
@ -27,6 +27,7 @@ class ExportCsvActionTest extends TestCase
|
|||
$response->assertDownload('mitglieder.csv');
|
||||
$contents = Storage::disk('temp')->get('mitglieder.csv');
|
||||
$this->assertTrue(str_contains($contents, 'Jane'));
|
||||
$this->assertTrue(str_contains($contents, '+49 176 70343221'));
|
||||
$this->assertFalse(str_contains($contents, 'Max'));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue