Add mailgateway form
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
d41aa466b1
commit
0080a54aaf
|
@ -3,9 +3,12 @@
|
||||||
namespace App\Maildispatcher\Resources;
|
namespace App\Maildispatcher\Resources;
|
||||||
|
|
||||||
use App\Activity;
|
use App\Activity;
|
||||||
|
use App\Group;
|
||||||
use App\Lib\HasMeta;
|
use App\Lib\HasMeta;
|
||||||
|
use App\Mailgateway\Models\Mailgateway;
|
||||||
use App\Mailgateway\Resources\MailgatewayResource;
|
use App\Mailgateway\Resources\MailgatewayResource;
|
||||||
use App\Member\FilterScope;
|
use App\Member\FilterScope;
|
||||||
|
use App\Member\Member;
|
||||||
use App\Subactivity;
|
use App\Subactivity;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
|
@ -45,6 +48,9 @@ class MaildispatcherResource extends JsonResource
|
||||||
],
|
],
|
||||||
'activities' => Activity::pluck('name', 'id'),
|
'activities' => Activity::pluck('name', 'id'),
|
||||||
'subactivities' => Subactivity::pluck('name', 'id'),
|
'subactivities' => Subactivity::pluck('name', 'id'),
|
||||||
|
'members' => Member::ordered()->get()->map(fn ($member) => ['id' => $member->id, 'name' => $member->fullname]),
|
||||||
|
'groups' => Group::pluck('name', 'id'),
|
||||||
|
'gateways' => Mailgateway::pluck('name', 'id'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@ class FilterScope extends Filter
|
||||||
/**
|
/**
|
||||||
* @param array<int, int> $activityIds
|
* @param array<int, int> $activityIds
|
||||||
* @param array<int, int> $subactivityIds
|
* @param array<int, int> $subactivityIds
|
||||||
|
* @param array<int, int> $groupIds
|
||||||
|
* @param array<int, int> $additional
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public bool $ausstand = false,
|
public bool $ausstand = false,
|
||||||
|
@ -26,7 +28,8 @@ class FilterScope extends Filter
|
||||||
public array $activityIds = [],
|
public array $activityIds = [],
|
||||||
public array $subactivityIds = [],
|
public array $subactivityIds = [],
|
||||||
public string $search = '',
|
public string $search = '',
|
||||||
public ?int $groupId = null,
|
public array $groupIds = [],
|
||||||
|
public array $additional = [],
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +48,7 @@ class FilterScope extends Filter
|
||||||
*/
|
*/
|
||||||
public function apply(Builder $query): Builder
|
public function apply(Builder $query): Builder
|
||||||
{
|
{
|
||||||
|
$query->orWhere(function ($query) {
|
||||||
if ($this->ausstand) {
|
if ($this->ausstand) {
|
||||||
$query->whereAusstand();
|
$query->whereAusstand();
|
||||||
}
|
}
|
||||||
|
@ -53,8 +57,8 @@ class FilterScope extends Filter
|
||||||
$query->where('bill_kind', BillKind::fromValue($this->billKind));
|
$query->where('bill_kind', BillKind::fromValue($this->billKind));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->groupId) {
|
if (count($this->groupIds)) {
|
||||||
$query->where('group_id', $this->groupId);
|
$query->whereIn('group_id', $this->groupIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($this->subactivityIds) + count($this->activityIds) > 0) {
|
if (count($this->subactivityIds) + count($this->activityIds) > 0) {
|
||||||
|
@ -68,6 +72,11 @@ class FilterScope extends Filter
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
})->orWhere(function ($query) {
|
||||||
|
if (count($this->additional)) {
|
||||||
|
$query->whereIn('id', $this->additional);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
class="flex items-center border-gray-600 text-gray-300 leading-none border-solid bg-gray-700 w-full appearance-none outline-none rounded-lg size-sm text-xs px-1 border pr-6"
|
class="flex items-center border-gray-600 text-gray-300 leading-none border-solid bg-gray-700 w-full appearance-none outline-none rounded-lg size-sm text-xs px-1 border pr-6"
|
||||||
v-text="`${value.length} Einträge ausgewählt`"
|
v-text="`${value.length} Einträge ausgewählt`"
|
||||||
></div>
|
></div>
|
||||||
<div v-show="visible" class="absolute h-[31rem] overflow-auto shadow-lg bg-gray-600 border border-gray-500 rounded-lg p-2 top-7">
|
<div v-show="visible" class="absolute w-[max-content] z-30 h-[31rem] overflow-auto shadow-lg bg-gray-600 border border-gray-500 rounded-lg p-2 top-7">
|
||||||
<div v-for="(option, index) in parsedOptions" class="flex items-center space-x-2" :key="index">
|
<div v-for="(option, index) in parsedOptions" class="flex items-center space-x-2" :key="index">
|
||||||
<f-switch :id="`${id}-${index}`" size="sm" :items="value.includes(option.id)" :value="option.id" @input="trigger(option, $event)"></f-switch>
|
<f-switch :id="`${id}-${index}`" size="sm" :items="value.includes(option.id)" :value="option.id" @input="trigger(option, $event)"></f-switch>
|
||||||
<div class="text-sm text-gray-200" v-text="option.name"></div>
|
<div class="text-sm text-gray-200" v-text="option.name"></div>
|
||||||
|
|
|
@ -5,6 +5,12 @@
|
||||||
</template>
|
</template>
|
||||||
<form id="form" class="p-3 grid gap-3" @submit.prevent="submit">
|
<form id="form" class="p-3 grid gap-3" @submit.prevent="submit">
|
||||||
<f-save-button form="form"></f-save-button>
|
<f-save-button form="form"></f-save-button>
|
||||||
|
<ui-box heading="Metadatem">
|
||||||
|
<div class="grid gap-4 sm:grid-cols-2">
|
||||||
|
<f-text id="name" name="name" v-model="model.name" label="Name" size="sm" required></f-text>
|
||||||
|
<f-select id="gateway_id" name="gateway_id" :options="meta.gateways" v-model="model.gateway_id" label="Verbindung" size="sm" required></f-select>
|
||||||
|
</div>
|
||||||
|
</ui-box>
|
||||||
<ui-box heading="Filterregeln">
|
<ui-box heading="Filterregeln">
|
||||||
<div class="grid gap-4 sm:grid-cols-2">
|
<div class="grid gap-4 sm:grid-cols-2">
|
||||||
<f-multipleselect
|
<f-multipleselect
|
||||||
|
@ -15,7 +21,6 @@
|
||||||
@input="reload(1)"
|
@input="reload(1)"
|
||||||
label="Tätigkeit"
|
label="Tätigkeit"
|
||||||
size="sm"
|
size="sm"
|
||||||
required
|
|
||||||
></f-multipleselect>
|
></f-multipleselect>
|
||||||
<f-multipleselect
|
<f-multipleselect
|
||||||
id="subactivity_ids"
|
id="subactivity_ids"
|
||||||
|
@ -25,8 +30,17 @@
|
||||||
@input="reload(1)"
|
@input="reload(1)"
|
||||||
label="Unterttätigkeit"
|
label="Unterttätigkeit"
|
||||||
size="sm"
|
size="sm"
|
||||||
required
|
|
||||||
></f-multipleselect>
|
></f-multipleselect>
|
||||||
|
<f-multipleselect
|
||||||
|
id="additional"
|
||||||
|
name="additional"
|
||||||
|
:options="meta.members"
|
||||||
|
v-model="model.filter.additional"
|
||||||
|
@input="reload(1)"
|
||||||
|
label="Zusätzliche Mitglieder"
|
||||||
|
size="sm"
|
||||||
|
></f-multipleselect>
|
||||||
|
<f-multipleselect id="groupIds" name="groupIds" :options="meta.groups" v-model="model.filter.group_ids" @input="reload(1)" label="Gruppierungen" size="sm"></f-multipleselect>
|
||||||
</div>
|
</div>
|
||||||
</ui-box>
|
</ui-box>
|
||||||
<ui-box heading="Mitglieder" v-if="members !== null">
|
<ui-box heading="Mitglieder" v-if="members !== null">
|
||||||
|
|
|
@ -22,7 +22,15 @@
|
||||||
<div class="px-6 py-2 flex border-b border-gray-600 items-center space-x-3">
|
<div class="px-6 py-2 flex border-b border-gray-600 items-center space-x-3">
|
||||||
<f-text :value="getFilter('search')" @input="setFilter('search', $event)" id="search" name="search" label="Suchen …" size="sm"></f-text>
|
<f-text :value="getFilter('search')" @input="setFilter('search', $event)" id="search" name="search" label="Suchen …" size="sm"></f-text>
|
||||||
<f-switch v-show="hasModule('bill')" id="ausstand" @input="setFilter('ausstand', $event)" :items="getFilter('ausstand')" label="Nur Ausstände" size="sm"></f-switch>
|
<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 id="group_id" @input="setFilter('group_id', $event)" :options="data.meta.groups" :value="getFilter('group_id')" label="Gruppierung" size="sm" name="group_id"></f-select>
|
<f-multipleselect
|
||||||
|
id="group_ids"
|
||||||
|
@input="setFilter('group_ids', $event)"
|
||||||
|
:options="data.meta.groups"
|
||||||
|
:value="getFilter('group_ids')"
|
||||||
|
label="Gruppierungen"
|
||||||
|
size="sm"
|
||||||
|
name="group_ids"
|
||||||
|
></f-multipleselect>
|
||||||
<f-select
|
<f-select
|
||||||
v-show="hasModule('bill')"
|
v-show="hasModule('bill')"
|
||||||
name="billKinds"
|
name="billKinds"
|
||||||
|
|
Loading…
Reference in New Issue