Compare commits
5 Commits
master
...
permission
Author | SHA1 | Date |
---|---|---|
philipp lang | 2ec7dd23eb | |
philipp lang | 4548407d55 | |
philipp lang | cbb45a0452 | |
philipp lang | 3e92a7c40a | |
philipp lang | 310f3c9727 |
|
@ -1,21 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Fileshare\Actions;
|
|
||||||
|
|
||||||
use App\Fileshare\Models\Fileshare;
|
|
||||||
use App\Fileshare\Resources\FileshareResource;
|
|
||||||
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
|
|
||||||
use Lorisleiva\Actions\Concerns\AsAction;
|
|
||||||
|
|
||||||
class FileshareApiIndexAction
|
|
||||||
{
|
|
||||||
use AsAction;
|
|
||||||
|
|
||||||
public function handle(): AnonymousResourceCollection
|
|
||||||
{
|
|
||||||
session()->put('menu', 'setting');
|
|
||||||
session()->put('title', 'Datei-Verbindungen');
|
|
||||||
|
|
||||||
return FileshareResource::collection(Fileshare::paginate(15));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -21,10 +21,8 @@ class FileshareSettings extends LocalSettings
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
public function viewData(): array
|
public function data()
|
||||||
{
|
{
|
||||||
return [
|
return FileshareResource::collection(Fileshare::paginate(15));
|
||||||
'data' => FileshareResource::collection(Fileshare::paginate(15))
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,8 @@
|
||||||
|
|
||||||
namespace App\Form;
|
namespace App\Form;
|
||||||
|
|
||||||
use App\Form\Actions\SettingStoreAction;
|
|
||||||
use App\Setting\Contracts\Storeable;
|
use App\Setting\Contracts\Storeable;
|
||||||
use App\Setting\LocalSettings;
|
use App\Setting\LocalSettings;
|
||||||
use Lorisleiva\Actions\ActionRequest;
|
|
||||||
|
|
||||||
class FormSettings extends LocalSettings implements Storeable
|
class FormSettings extends LocalSettings implements Storeable
|
||||||
{
|
{
|
||||||
|
@ -32,23 +30,4 @@ class FormSettings extends LocalSettings implements Storeable
|
||||||
'clearCacheUrl' => 'present|string',
|
'clearCacheUrl' => 'present|string',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeSave(ActionRequest $request): void
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritdoc
|
|
||||||
*/
|
|
||||||
public function viewData(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'data' => [
|
|
||||||
'data' => [
|
|
||||||
'registerUrl' => $this->registerUrl,
|
|
||||||
'clearCacheUrl' => $this->clearCacheUrl,
|
|
||||||
]
|
|
||||||
]
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Http\Resources;
|
namespace App\Http\Resources;
|
||||||
|
|
||||||
|
use App\Lib\HasMeta;
|
||||||
use App\User;
|
use App\User;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
use Storage;
|
use Storage;
|
||||||
|
@ -11,6 +12,8 @@ use Storage;
|
||||||
*/
|
*/
|
||||||
class UserResource extends JsonResource
|
class UserResource extends JsonResource
|
||||||
{
|
{
|
||||||
|
use HasMeta;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform the resource into an array.
|
* Transform the resource into an array.
|
||||||
*
|
*
|
||||||
|
@ -25,9 +28,27 @@ class UserResource extends JsonResource
|
||||||
'lastname' => $this->lastname,
|
'lastname' => $this->lastname,
|
||||||
'avatar_url' => $this->getGravatarUrl(),
|
'avatar_url' => $this->getGravatarUrl(),
|
||||||
'email' => $this->email,
|
'email' => $this->email,
|
||||||
|
'id' => $this->id,
|
||||||
'avatar' => [
|
'avatar' => [
|
||||||
'src' => Storage::url('avatar.png'),
|
'src' => Storage::url('avatar.png'),
|
||||||
],
|
],
|
||||||
|
'links' => [
|
||||||
|
'update' => route('user.update', ['user' => $this->getModel()]),
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function meta(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'default' => [
|
||||||
|
'firstname' => '',
|
||||||
|
'lastname' => '',
|
||||||
|
'email' => '',
|
||||||
|
],
|
||||||
|
'links' => [
|
||||||
|
'store' => route('user.store'),
|
||||||
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ namespace App\Invoice;
|
||||||
|
|
||||||
use App\Setting\Contracts\Storeable;
|
use App\Setting\Contracts\Storeable;
|
||||||
use App\Setting\LocalSettings;
|
use App\Setting\LocalSettings;
|
||||||
use Lorisleiva\Actions\ActionRequest;
|
|
||||||
|
|
||||||
class InvoiceSettings extends LocalSettings implements Storeable
|
class InvoiceSettings extends LocalSettings implements Storeable
|
||||||
{
|
{
|
||||||
|
@ -35,28 +34,6 @@ class InvoiceSettings extends LocalSettings implements Storeable
|
||||||
return 'bill';
|
return 'bill';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritdoc
|
|
||||||
*/
|
|
||||||
public function viewData(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'data' => [
|
|
||||||
'from_long' => $this->from_long,
|
|
||||||
'from' => $this->from,
|
|
||||||
'mobile' => $this->mobile,
|
|
||||||
'email' => $this->email,
|
|
||||||
'website' => $this->website,
|
|
||||||
'address' => $this->address,
|
|
||||||
'place' => $this->place,
|
|
||||||
'zip' => $this->zip,
|
|
||||||
'iban' => $this->iban,
|
|
||||||
'bic' => $this->bic,
|
|
||||||
'rememberWeeks' => $this->rememberWeeks,
|
|
||||||
]
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
|
@ -77,10 +54,6 @@ class InvoiceSettings extends LocalSettings implements Storeable
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeSave(ActionRequest $request): void
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function title(): string
|
public static function title(): string
|
||||||
{
|
{
|
||||||
return 'Rechnung';
|
return 'Rechnung';
|
||||||
|
|
|
@ -21,10 +21,8 @@ class MailgatewaySettings extends LocalSettings
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
public function viewData(): array
|
public function data()
|
||||||
{
|
{
|
||||||
return [
|
return MailgatewayResource::collection(Mailgateway::paginate(10));
|
||||||
'data' => MailgatewayResource::collection(Mailgateway::paginate(10)),
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,6 @@ class ModuleSettings extends LocalSettings implements Storeable
|
||||||
return in_array($module, $this->modules);
|
return in_array($module, $this->modules);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeSave(ActionRequest $request): void
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
|
@ -45,14 +41,13 @@ class ModuleSettings extends LocalSettings implements Storeable
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
public function viewData(): array
|
public function data(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'data' => [
|
...parent::data(),
|
||||||
'data' => [
|
'meta' => [
|
||||||
'modules' => $this->modules,
|
...parent::data()['meta'],
|
||||||
],
|
'modules' => Module::forSelect(),
|
||||||
'meta' => ['modules' => Module::forSelect()],
|
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Prevention\Actions;
|
|
||||||
|
|
||||||
use App\Prevention\PreventionSettings;
|
|
||||||
use Illuminate\Http\JsonResponse;
|
|
||||||
use Lorisleiva\Actions\Concerns\AsAction;
|
|
||||||
|
|
||||||
class SettingApiAction
|
|
||||||
{
|
|
||||||
use AsAction;
|
|
||||||
|
|
||||||
public function handle(): JsonResponse
|
|
||||||
{
|
|
||||||
return response()->json([
|
|
||||||
'data' => app(PreventionSettings::class)->toArray(),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Prevention\Actions;
|
|
||||||
|
|
||||||
use App\Lib\Editor\EditorData;
|
|
||||||
use App\Lib\Events\Succeeded;
|
|
||||||
use App\Prevention\PreventionSettings;
|
|
||||||
use Lorisleiva\Actions\ActionRequest;
|
|
||||||
use Lorisleiva\Actions\Concerns\AsAction;
|
|
||||||
|
|
||||||
class SettingStoreAction
|
|
||||||
{
|
|
||||||
use AsAction;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array<string, string>
|
|
||||||
*/
|
|
||||||
public function rules(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'formmail' => 'array',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function handle(ActionRequest $request): void
|
|
||||||
{
|
|
||||||
$settings = app(PreventionSettings::class);
|
|
||||||
$settings->formmail = EditorData::from($request->formmail);
|
|
||||||
$settings->save();
|
|
||||||
|
|
||||||
Succeeded::message('Einstellungen gespeichert.')->dispatch();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,9 +3,11 @@
|
||||||
namespace App\Prevention;
|
namespace App\Prevention;
|
||||||
|
|
||||||
use App\Lib\Editor\EditorData;
|
use App\Lib\Editor\EditorData;
|
||||||
|
use App\Setting\Contracts\Storeable;
|
||||||
use App\Setting\LocalSettings;
|
use App\Setting\LocalSettings;
|
||||||
|
use Lorisleiva\Actions\ActionRequest;
|
||||||
|
|
||||||
class PreventionSettings extends LocalSettings
|
class PreventionSettings extends LocalSettings implements Storeable
|
||||||
{
|
{
|
||||||
|
|
||||||
public EditorData $formmail;
|
public EditorData $formmail;
|
||||||
|
@ -23,8 +25,17 @@ class PreventionSettings extends LocalSettings
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
public function viewData(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [
|
||||||
|
'formmail' => 'required',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function saveAttributes(ActionRequest $request): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'formmail' => EditorData::from($request->formmail),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
namespace App\Setting\Actions;
|
namespace App\Setting\Actions;
|
||||||
|
|
||||||
|
use App\Lib\Events\Succeeded;
|
||||||
use App\Setting\Contracts\Storeable;
|
use App\Setting\Contracts\Storeable;
|
||||||
|
use GrahamCampbell\ResultType\Success;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Lorisleiva\Actions\ActionRequest;
|
use Lorisleiva\Actions\ActionRequest;
|
||||||
use Lorisleiva\Actions\Concerns\AsAction;
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
@ -33,7 +35,9 @@ class StoreAction
|
||||||
public function asController(ActionRequest $request, Storeable $settingGroup): RedirectResponse
|
public function asController(ActionRequest $request, Storeable $settingGroup): RedirectResponse
|
||||||
{
|
{
|
||||||
$settingGroup->beforeSave($request);
|
$settingGroup->beforeSave($request);
|
||||||
$this->handle($settingGroup, $request->validated());
|
$this->handle($settingGroup, $settingGroup->saveAttributes($request));
|
||||||
|
|
||||||
|
Succeeded::message('Einstellungen gespeichert')->dispatch();
|
||||||
|
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,8 @@ class ViewAction
|
||||||
session()->put('title', $settingGroup::title());
|
session()->put('title', $settingGroup::title());
|
||||||
|
|
||||||
return Inertia::render('setting/' . ucfirst($settingGroup::group()), [
|
return Inertia::render('setting/' . ucfirst($settingGroup::group()), [
|
||||||
...$settingGroup->viewData(),
|
'data' => $settingGroup->data(),
|
||||||
'setting_menu' => app(SettingFactory::class)->getShare(),
|
'settingMenu' => app(SettingFactory::class)->getShare(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,4 +24,6 @@ interface Storeable
|
||||||
public function rules(): array;
|
public function rules(): array;
|
||||||
|
|
||||||
public function beforeSave(ActionRequest $request): void;
|
public function beforeSave(ActionRequest $request): void;
|
||||||
|
|
||||||
|
public function saveAttributes(ActionRequest $request): array;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Setting;
|
namespace App\Setting;
|
||||||
|
|
||||||
|
use Lorisleiva\Actions\ActionRequest;
|
||||||
use Spatie\LaravelSettings\Settings;
|
use Spatie\LaravelSettings\Settings;
|
||||||
|
|
||||||
abstract class LocalSettings extends Settings
|
abstract class LocalSettings extends Settings
|
||||||
|
@ -13,8 +14,36 @@ abstract class LocalSettings extends Settings
|
||||||
return route('setting.view', ['settingGroup' => $this->group()]);
|
return route('setting.view', ['settingGroup' => $this->group()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function storeUrl(): string
|
||||||
|
{
|
||||||
|
return $this->url();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function data()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'data' => $this->toArray(),
|
||||||
|
'meta' => [
|
||||||
|
'links' => [
|
||||||
|
'store' => $this->storeUrl(),
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function beforeSave(ActionRequest $request): void
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array<string, mixed>
|
* @return array<string, mixed>
|
||||||
*/
|
*/
|
||||||
abstract public function viewData(): array;
|
public function saveAttributes(ActionRequest $request): array
|
||||||
|
{
|
||||||
|
return $request->validated();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ namespace App\Setting;
|
||||||
|
|
||||||
use App\Group;
|
use App\Group;
|
||||||
use App\Initialize\Actions\NamiLoginCheckAction;
|
use App\Initialize\Actions\NamiLoginCheckAction;
|
||||||
use App\Nami\Actions\SettingSaveAction;
|
|
||||||
use App\Setting\Contracts\Storeable;
|
use App\Setting\Contracts\Storeable;
|
||||||
use Lorisleiva\Actions\ActionRequest;
|
use Lorisleiva\Actions\ActionRequest;
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
|
@ -64,14 +63,15 @@ class NamiSettings extends LocalSettings implements Storeable
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
public function viewData(): array
|
public function data(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
...parent::data(),
|
||||||
'data' => [
|
'data' => [
|
||||||
'mglnr' => $this->mglnr,
|
'mglnr' => $this->mglnr,
|
||||||
'password' => '',
|
'password' => '',
|
||||||
'default_group_id' => $this->default_group_id,
|
'default_group_id' => $this->default_group_id,
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
namespace App\Setting;
|
namespace App\Setting;
|
||||||
|
|
||||||
use App\Invoice\InvoiceSettings;
|
|
||||||
use App\Setting\Contracts\Storeable;
|
|
||||||
use Illuminate\Routing\Router;
|
use Illuminate\Routing\Router;
|
||||||
|
|
||||||
class SettingFactory
|
class SettingFactory
|
||||||
|
|
|
@ -10,6 +10,7 @@ use App\Module\ModuleSettings;
|
||||||
use App\Prevention\PreventionSettings;
|
use App\Prevention\PreventionSettings;
|
||||||
use App\Setting\Actions\StoreAction;
|
use App\Setting\Actions\StoreAction;
|
||||||
use App\Setting\Actions\ViewAction;
|
use App\Setting\Actions\ViewAction;
|
||||||
|
use App\User\UserSettings;
|
||||||
use Illuminate\Routing\Router;
|
use Illuminate\Routing\Router;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
@ -43,5 +44,6 @@ class SettingServiceProvider extends ServiceProvider
|
||||||
app(SettingFactory::class)->register(FormSettings::class);
|
app(SettingFactory::class)->register(FormSettings::class);
|
||||||
app(SettingFactory::class)->register(FileshareSettings::class);
|
app(SettingFactory::class)->register(FileshareSettings::class);
|
||||||
app(SettingFactory::class)->register(PreventionSettings::class);
|
app(SettingFactory::class)->register(PreventionSettings::class);
|
||||||
|
app(SettingFactory::class)->register(UserSettings::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,4 +27,9 @@ class User extends Authenticatable
|
||||||
{
|
{
|
||||||
return 'https://www.gravatar.com/avatar/' . hash('sha256', $this->email);
|
return 'https://www.gravatar.com/avatar/' . hash('sha256', $this->email);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFullname(): string
|
||||||
|
{
|
||||||
|
return $this->firstname . ' ' . $this->lastname;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Actions;
|
||||||
|
|
||||||
|
use App\User;
|
||||||
|
use App\User\Mail\WelcomeMail;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use Illuminate\Support\Facades\Password;
|
||||||
|
use Lorisleiva\Actions\ActionRequest;
|
||||||
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|
||||||
|
class StoreAction
|
||||||
|
{
|
||||||
|
use AsAction;
|
||||||
|
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'firstname' => 'required|string|max:255',
|
||||||
|
'lastname' => 'required|string|max:255',
|
||||||
|
'email' => 'required|string|email|max:255|unique:users,email',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle(ActionRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
User::create([
|
||||||
|
...$request->validated(),
|
||||||
|
'password' => Hash::make(str()->random(32)),
|
||||||
|
]);
|
||||||
|
|
||||||
|
Password::broker()->sendResetLink(
|
||||||
|
$request->safe()->only('email'),
|
||||||
|
fn ($user, $token) => Mail::to($user)->send(new WelcomeMail($user, $token))
|
||||||
|
);
|
||||||
|
|
||||||
|
return response()->json([]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Actions;
|
||||||
|
|
||||||
|
use App\User;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Lorisleiva\Actions\ActionRequest;
|
||||||
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|
||||||
|
class UpdateAction
|
||||||
|
{
|
||||||
|
use AsAction;
|
||||||
|
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'firstname' => 'required|string|max:255',
|
||||||
|
'lastname' => 'required|string|max:255',
|
||||||
|
'email' => ['required', 'string', 'email', 'max:255', Rule::unique('users', 'email')->ignore(request()->route('user')->id)],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle(User $user, ActionRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$user->update($request->validated());
|
||||||
|
|
||||||
|
return response()->json([]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Mail;
|
||||||
|
|
||||||
|
use App\User;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Mail\Mailables\Content;
|
||||||
|
use Illuminate\Mail\Mailables\Envelope;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class WelcomeMail extends Mailable implements ShouldQueue
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public string $resetUrl;
|
||||||
|
public string $home;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new message instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct(public User $user, public string $token)
|
||||||
|
{
|
||||||
|
$this->resetUrl = route('password.reset', ['token' => $token, 'email' => $user->email]);
|
||||||
|
$this->home = url('');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the message envelope.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Mail\Mailables\Envelope
|
||||||
|
*/
|
||||||
|
public function envelope()
|
||||||
|
{
|
||||||
|
return new Envelope(
|
||||||
|
subject: 'Willkommen bei Adrema',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the message content definition.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Mail\Mailables\Content
|
||||||
|
*/
|
||||||
|
public function content()
|
||||||
|
{
|
||||||
|
return new Content(
|
||||||
|
markdown: 'mail.user.welcome',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the attachments for the message.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function attachments()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User;
|
||||||
|
|
||||||
|
use App\Http\Resources\UserResource;
|
||||||
|
use App\Setting\LocalSettings;
|
||||||
|
use App\User;
|
||||||
|
|
||||||
|
class UserSettings extends LocalSettings
|
||||||
|
{
|
||||||
|
public static function group(): string
|
||||||
|
{
|
||||||
|
return 'user';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function title(): string
|
||||||
|
{
|
||||||
|
return 'Benutzer';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function data()
|
||||||
|
{
|
||||||
|
return UserResource::collection(User::orderByRaw('lastname, firstname')->get());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
ssh dkd 'cd $ADREMA_PATH && docker compose exec db mysqldump -q -udb -p'$ADREMA_DB_PASSWORD' db --ignore-table=db.telescope_entries --ignore-table=db.failed_jobs' > db.tmp
|
||||||
|
sudo mysql scoutrobot < db.tmp
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/zsh
|
||||||
|
|
||||||
|
php artisan migrate:fresh --env=testing
|
||||||
|
ssh dkd 'cd $ADREMA_PATH && docker compose exec db mysqldump -q -udb -p'$ADREMA_DB_PASSWORD' db --ignore-table=db.telescope_entries --ignore-table=db.failed_jobs' > dddd.sql
|
||||||
|
sudo mysql scoutrobottest < dddd.sql
|
||||||
|
php artisan migrate --env=testing
|
||||||
|
|
|
@ -27,4 +27,15 @@ class UserFactory extends Factory
|
||||||
'lastname' => $this->faker->lastName,
|
'lastname' => $this->faker->lastName,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function name(string $name): self
|
||||||
|
{
|
||||||
|
[$firstname, $lastname] = explode(' ', $name);
|
||||||
|
return $this->state(['firstname' => $firstname, 'lastname' => $lastname]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function email(string $email): self
|
||||||
|
{
|
||||||
|
return $this->state(['email' => $email]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,8 @@ services:
|
||||||
|
|
||||||
socketi:
|
socketi:
|
||||||
image: quay.io/soketi/soketi:89604f268623cf799573178a7ba56b7491416bde-16-debian
|
image: quay.io/soketi/soketi:89604f268623cf799573178a7ba56b7491416bde-16-debian
|
||||||
|
ports:
|
||||||
|
- '6001:6001'
|
||||||
environment:
|
environment:
|
||||||
SOKETI_DEFAULT_APP_ID: adremaid
|
SOKETI_DEFAULT_APP_ID: adremaid
|
||||||
SOKETI_DEFAULT_APP_KEY: adremakey
|
SOKETI_DEFAULT_APP_KEY: adremakey
|
||||||
|
@ -104,6 +106,8 @@ services:
|
||||||
|
|
||||||
meilisearch:
|
meilisearch:
|
||||||
image: getmeili/meilisearch:v1.6
|
image: getmeili/meilisearch:v1.6
|
||||||
|
ports:
|
||||||
|
- '7700:7700'
|
||||||
volumes:
|
volumes:
|
||||||
- ./data/meilisearch:/meili_data
|
- ./data/meilisearch:/meili_data
|
||||||
env_file:
|
env_file:
|
||||||
|
|
|
@ -2,9 +2,11 @@ import {ref, inject, computed, onBeforeUnmount} from 'vue';
|
||||||
import {router} from '@inertiajs/vue3';
|
import {router} from '@inertiajs/vue3';
|
||||||
import useQueueEvents from './useQueueEvents.js';
|
import useQueueEvents from './useQueueEvents.js';
|
||||||
|
|
||||||
export function useIndex(props, siteName) {
|
export function useIndex(props, siteName = null) {
|
||||||
const axios = inject('axios');
|
const axios = inject('axios');
|
||||||
const {startListener, stopListener} = useQueueEvents(siteName, () => reload(false));
|
if (siteName !== null) {
|
||||||
|
var {startListener, stopListener} = useQueueEvents(siteName, () => reload(false));
|
||||||
|
}
|
||||||
const rawProps = JSON.parse(JSON.stringify(props));
|
const rawProps = JSON.parse(JSON.stringify(props));
|
||||||
const inner = {
|
const inner = {
|
||||||
data: ref(rawProps.data),
|
data: ref(rawProps.data),
|
||||||
|
@ -56,8 +58,10 @@ export function useIndex(props, siteName) {
|
||||||
reload(true);
|
reload(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
startListener();
|
if (siteName !== null) {
|
||||||
onBeforeUnmount(() => stopListener());
|
startListener();
|
||||||
|
onBeforeUnmount(() => stopListener());
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
data: inner.data,
|
data: inner.data,
|
||||||
|
|
|
@ -2,9 +2,11 @@ import {computed, ref, inject, onBeforeUnmount} from 'vue';
|
||||||
import {router} from '@inertiajs/vue3';
|
import {router} from '@inertiajs/vue3';
|
||||||
import useQueueEvents from './useQueueEvents.js';
|
import useQueueEvents from './useQueueEvents.js';
|
||||||
|
|
||||||
export function useIndex(props, siteName) {
|
export function useIndex(props, siteName = null) {
|
||||||
const axios = inject('axios');
|
const axios = inject('axios');
|
||||||
const {startListener, stopListener} = useQueueEvents(siteName, () => reload(false));
|
if (siteName !== null) {
|
||||||
|
var {startListener, stopListener} = useQueueEvents(siteName, () => reload(false));
|
||||||
|
}
|
||||||
const single = ref(null);
|
const single = ref(null);
|
||||||
const rawProps = JSON.parse(JSON.stringify(props));
|
const rawProps = JSON.parse(JSON.stringify(props));
|
||||||
const inner = {
|
const inner = {
|
||||||
|
@ -86,8 +88,10 @@ export function useIndex(props, siteName) {
|
||||||
reload(true);
|
reload(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
startListener();
|
if (siteName !== null) {
|
||||||
onBeforeUnmount(() => stopListener());
|
startListener();
|
||||||
|
onBeforeUnmount(() => stopListener());
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
data: inner.data,
|
data: inner.data,
|
||||||
|
|
|
@ -5,45 +5,26 @@
|
||||||
</template>
|
</template>
|
||||||
<setting-layout>
|
<setting-layout>
|
||||||
<form id="billsettingform" class="grow p-6 grid grid-cols-2 gap-3 items-start content-start" @submit.prevent="submit">
|
<form id="billsettingform" class="grow p-6 grid grid-cols-2 gap-3 items-start content-start" @submit.prevent="submit">
|
||||||
<f-text id="from" v-model="inner.from" label="Absender" hint="Absender-Name in Kurzform, i.d.R. der kurze Stammesname"></f-text>
|
<f-text id="from" v-model="data.from" label="Absender" hint="Absender-Name in Kurzform, i.d.R. der kurze Stammesname"></f-text>
|
||||||
<f-text id="from_long" v-model="inner.from_long" label="Absender (lang)" hint="Absender-Name in Langform, i.d.R. der Stammesname"></f-text>
|
<f-text id="from_long" v-model="data.from_long" label="Absender (lang)" hint="Absender-Name in Langform, i.d.R. der Stammesname"></f-text>
|
||||||
<h2 class="text-lg font-semibold text-gray-300 col-span-2 mt-5">Kontaktdaten</h2>
|
<h2 class="text-lg font-semibold text-gray-300 col-span-2 mt-5">Kontaktdaten</h2>
|
||||||
<div class="col-span-2 text-gray-300 text-sm">Diese Kontaktdaten stehen im Absender-Bereich auf der Rechnung.</div>
|
<div class="col-span-2 text-gray-300 text-sm">Diese Kontaktdaten stehen im Absender-Bereich auf der Rechnung.</div>
|
||||||
<f-text id="address" v-model="inner.address" label="Straße"></f-text>
|
<f-text id="address" v-model="data.address" label="Straße"></f-text>
|
||||||
<f-text id="zip" v-model="inner.zip" label="PLZ"></f-text>
|
<f-text id="zip" v-model="data.zip" label="PLZ"></f-text>
|
||||||
<f-text id="place" v-model="inner.place" label="Ort"></f-text>
|
<f-text id="place" v-model="data.place" label="Ort"></f-text>
|
||||||
<f-text id="email" v-model="inner.email" label="E-Mail-Adresse"></f-text>
|
<f-text id="email" v-model="data.email" label="E-Mail-Adresse"></f-text>
|
||||||
<f-text id="mobile" v-model="inner.mobile" label="Telefonnummer"></f-text>
|
<f-text id="mobile" v-model="data.mobile" label="Telefonnummer"></f-text>
|
||||||
<f-text id="website" v-model="inner.website" label="Webseite"></f-text>
|
<f-text id="website" v-model="data.website" label="Webseite"></f-text>
|
||||||
<f-text id="iban" v-model="inner.iban" label="IBAN"></f-text>
|
<f-text id="iban" v-model="data.iban" label="IBAN"></f-text>
|
||||||
<f-text id="bic" v-model="inner.bic" label="BIC"></f-text>
|
<f-text id="bic" v-model="data.bic" label="BIC"></f-text>
|
||||||
<f-text id="remember_weeks" v-model="inner.rememberWeeks" type="number" label="Erinnerung alle X Wochen versenden"></f-text>
|
<f-text id="remember_weeks" v-model="data.rememberWeeks" type="number" label="Erinnerung alle X Wochen versenden"></f-text>
|
||||||
</form>
|
</form>
|
||||||
</setting-layout>
|
</setting-layout>
|
||||||
</page-layout>
|
</page-layout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
import SettingLayout from './Layout.vue';
|
import {props, useSettings} from './useSettings.js';
|
||||||
|
const innerProps = defineProps(props);
|
||||||
export default {
|
const {submit, data, meta, SettingLayout} = useSettings(innerProps);
|
||||||
components: {
|
|
||||||
SettingLayout,
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
data: {},
|
|
||||||
},
|
|
||||||
data: function () {
|
|
||||||
return {
|
|
||||||
inner: {...this.data},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
submit() {
|
|
||||||
this.$inertia.post('/setting/bill', this.inner, {
|
|
||||||
onSuccess: () => this.$success('Einstellungen gespeichert.'),
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -76,10 +76,12 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="js" setup>
|
<script lang="js" setup>
|
||||||
import { useApiIndex } from '../../composables/useApiIndex.js';
|
import { useIndex, indexProps } from '../../composables/useInertiaApiIndex.js';
|
||||||
import SettingLayout from '../setting/Layout.vue';
|
import SettingLayout from '../setting/Layout.vue';
|
||||||
|
|
||||||
const { meta, data, reload, create, edit, cancel, single, submit } = useApiIndex('/api/fileshare', 'fileshare');
|
const props = defineProps(indexProps);
|
||||||
|
|
||||||
|
const { meta, data, reload, create, edit, cancel, single, submit } = useIndex(props.data, 'fileshare');
|
||||||
|
|
||||||
function getType(type) {
|
function getType(type) {
|
||||||
if (!type) {
|
if (!type) {
|
||||||
|
@ -89,6 +91,4 @@ function getType(type) {
|
||||||
}
|
}
|
||||||
return meta.value.types.find((t) => t.id === type);
|
return meta.value.types.find((t) => t.id === type);
|
||||||
}
|
}
|
||||||
|
|
||||||
reload();
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -9,40 +9,16 @@
|
||||||
<p class="text-sm">Hier kannst du Einstellungen für Anmeldeformulare setzen.</p>
|
<p class="text-sm">Hier kannst du Einstellungen für Anmeldeformulare setzen.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid grid-cols-2 gap-4">
|
<div class="grid grid-cols-2 gap-4">
|
||||||
<f-text id="register_url" v-model="inner.registerUrl" label="Formular-Link"></f-text>
|
<f-text id="register_url" v-model="data.registerUrl" label="Formular-Link"></f-text>
|
||||||
<f-text id="clear_cache_url" v-model="inner.clearCacheUrl" label="Frontend-Cache-Url"></f-text>
|
<f-text id="clear_cache_url" v-model="data.clearCacheUrl" label="Frontend-Cache-Url"></f-text>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</setting-layout>
|
</setting-layout>
|
||||||
</page-layout>
|
</page-layout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
import SettingLayout from './Layout.vue';
|
import {props, useSettings} from './useSettings.js';
|
||||||
|
const innerProps = defineProps(props);
|
||||||
export default {
|
const {submit, data, meta, SettingLayout} = useSettings(innerProps);
|
||||||
components: {
|
|
||||||
SettingLayout,
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
data: {
|
|
||||||
type: Object,
|
|
||||||
default: () => {
|
|
||||||
return {};
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
data: function () {
|
|
||||||
return {
|
|
||||||
inner: {...this.data.data},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
submit() {
|
|
||||||
this.$inertia.post('/setting/form', this.inner, {
|
|
||||||
onSuccess: () => this.$success('Einstellungen gespeichert.'),
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="flex grow relative">
|
<div class="flex grow relative">
|
||||||
<ui-menulist v-model="active" :entries="$page.props.setting_menu"></ui-menulist>
|
<ui-menulist v-model="active" :entries="$page.props.settingMenu"></ui-menulist>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
export default {
|
export default {
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
innerActive: this.$page.props.setting_menu.findIndex((menu) => menu.is_active),
|
innerActive: this.$page.props.settingMenu.findIndex((menu) => menu.is_active),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -19,7 +19,7 @@ export default {
|
||||||
},
|
},
|
||||||
set(v) {
|
set(v) {
|
||||||
var _self = this;
|
var _self = this;
|
||||||
this.$inertia.visit(this.$page.props.setting_menu[v].url, {
|
this.$inertia.visit(this.$page.props.settingMenu[v].url, {
|
||||||
onSuccess() {
|
onSuccess() {
|
||||||
_self.innerActive = v;
|
_self.innerActive = v;
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,87 +0,0 @@
|
||||||
<template>
|
|
||||||
<page-layout>
|
|
||||||
<template #right>
|
|
||||||
<f-save-button form="mailmansettingform"></f-save-button>
|
|
||||||
</template>
|
|
||||||
<setting-layout>
|
|
||||||
<form id="mailmansettingform" class="grow p-6 grid grid-cols-2 gap-3 items-start content-start" @submit.prevent="submit">
|
|
||||||
<div class="col-span-full text-gray-100 mb-3">
|
|
||||||
<p class="text-sm">
|
|
||||||
Scoutrobot kann automatisch Mailinglisten erstellen, wenn es mit einem existierenden
|
|
||||||
<a href="https://docs.mailman3.org/en/latest/">Mailman Server</a> verbunden wird. Mailman ist ein OpenSource-Mailinglisten-System, um E-Mails an mehrere Leute zu senden.
|
|
||||||
</p>
|
|
||||||
<p class="text-sm mt-1">Scoutrobot wird nach der Ersteinrichtung deine Mitglieder zu bestehenden E-Mail-Verteilern hinzufügen.</p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<f-switch id="is_active" v-model="inner.is_active" label="Mailman-Synchronisation aktiv"></f-switch>
|
|
||||||
</div>
|
|
||||||
<div class="flex h-full items-center">
|
|
||||||
<ui-sprite :src="stateDisplay.icon" :class="stateDisplay.text" class="w-5 h-5"></ui-sprite>
|
|
||||||
<span class="ml-3" :class="stateDisplay.text" v-text="stateDisplay.label"></span>
|
|
||||||
</div>
|
|
||||||
<f-text id="base_url" v-model="inner.base_url" label="URL" hint="URL der Mailman Api"></f-text>
|
|
||||||
<f-text id="username" v-model="inner.username" label="Benutzername"></f-text>
|
|
||||||
<f-text id="password" v-model="inner.password" type="password" label="Passwort"></f-text>
|
|
||||||
<f-select id="all_list" v-model="inner.all_list" label="Liste für alle Mitglieder" name="all_list" :options="lists"></f-select>
|
|
||||||
<f-select id="all_parents_list" v-model="inner.all_parents_list" label="Liste für Eltern" name="all_parents_list" :options="lists"></f-select>
|
|
||||||
<f-select id="active_leaders_list" v-model="inner.active_leaders_list" label="Liste für aktive Leiter" name="active_leaders_list" :options="lists"></f-select>
|
|
||||||
<f-select id="passive_leaders_list" v-model="inner.passive_leaders_list" label="Liste für passive Leiter" name="passive_leaders_list" :options="lists"></f-select>
|
|
||||||
<div></div>
|
|
||||||
</form>
|
|
||||||
</setting-layout>
|
|
||||||
</page-layout>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import SettingLayout from './Layout.vue';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
SettingLayout,
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
data: {},
|
|
||||||
state: {},
|
|
||||||
lists: {},
|
|
||||||
},
|
|
||||||
data: function () {
|
|
||||||
return {
|
|
||||||
inner: {...this.data},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
stateDisplay() {
|
|
||||||
if (this.state === null) {
|
|
||||||
return {
|
|
||||||
text: 'text-gray-500',
|
|
||||||
icon: 'disabled',
|
|
||||||
label: 'Deaktiviert',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.state
|
|
||||||
? {
|
|
||||||
text: 'text-green-500',
|
|
||||||
icon: 'check',
|
|
||||||
label: 'Verbindung erfolgreich.',
|
|
||||||
}
|
|
||||||
: {
|
|
||||||
text: 'text-red-500',
|
|
||||||
icon: 'close',
|
|
||||||
label: 'Verbindung fehlgeschlagen.',
|
|
||||||
};
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
submit() {
|
|
||||||
this.$inertia.post('/setting/mailman', this.inner, {
|
|
||||||
onSuccess: (page) => {
|
|
||||||
this.$success('Einstellungen gespeichert.');
|
|
||||||
this.inner = page.props.data;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
|
@ -4,48 +4,20 @@
|
||||||
<f-save-button form="modulesettingform"></f-save-button>
|
<f-save-button form="modulesettingform"></f-save-button>
|
||||||
</template>
|
</template>
|
||||||
<setting-layout>
|
<setting-layout>
|
||||||
<form id="modulesettingform" class="grow p-6 grid grid-cols-2 gap-3 items-start content-start"
|
<form id="modulesettingform" class="grow p-6 grid grid-cols-2 gap-3 items-start content-start" @submit.prevent="submit">
|
||||||
@submit.prevent="submit">
|
|
||||||
<div class="col-span-full text-gray-100 mb-3">
|
<div class="col-span-full text-gray-100 mb-3">
|
||||||
<p class="text-sm">Hier kannst du Funktionen innerhalb von Adrema (Module) aktivieren oder deaktivieren
|
<p class="text-sm">Hier kannst du Funktionen innerhalb von Adrema (Module) aktivieren oder deaktivieren und so den Funktionsumfang auf deine Bedürfnisse anpassen.</p>
|
||||||
und so den Funktionsumfang auf deine Bedürfnisse anpassen.</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="grid grid-cols-2 gap-4">
|
<div class="grid grid-cols-2 gap-4">
|
||||||
<f-switch v-for="module in meta.modules" :id="module.id" v-model="inner.modules" :value="module.id"
|
<f-switch v-for="module in meta.modules" :id="module.id" v-model="data.modules" :value="module.id" size="sm" name="modules" :label="module.name"></f-switch>
|
||||||
size="sm" name="modules" :label="module.name"></f-switch>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</setting-layout>
|
</setting-layout>
|
||||||
</page-layout>
|
</page-layout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
import SettingLayout from './Layout.vue';
|
import {props, useSettings} from './useSettings.js';
|
||||||
|
const innerProps = defineProps(props);
|
||||||
export default {
|
const {submit, data, meta, SettingLayout} = useSettings(innerProps);
|
||||||
components: {
|
|
||||||
SettingLayout,
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
data: {
|
|
||||||
type: Object,
|
|
||||||
default: () => {
|
|
||||||
return {};
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
data: function () {
|
|
||||||
return {
|
|
||||||
inner: { ...this.data.data },
|
|
||||||
meta: { ...this.data.meta },
|
|
||||||
};
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
submit() {
|
|
||||||
this.$inertia.post('/setting/module', this.inner, {
|
|
||||||
onSuccess: () => this.$success('Einstellungen gespeichert.'),
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -8,40 +8,16 @@
|
||||||
<div class="col-span-full text-gray-100 mb-3">
|
<div class="col-span-full text-gray-100 mb-3">
|
||||||
<p class="text-sm">Hier kannst du deine Zugangsdaten zu NaMi anpassen, falls sich z.B. dein Passwort geändert hat.</p>
|
<p class="text-sm">Hier kannst du deine Zugangsdaten zu NaMi anpassen, falls sich z.B. dein Passwort geändert hat.</p>
|
||||||
</div>
|
</div>
|
||||||
<f-text id="mglnr" v-model="inner.mglnr" label="Mitgliedsnummer"></f-text>
|
<f-text id="mglnr" v-model="data.mglnr" label="Mitgliedsnummer"></f-text>
|
||||||
<f-text id="default_group_id" v-model="inner.default_group_id" label="Standard-Gruppierung"></f-text>
|
<f-text id="default_group_id" v-model="data.default_group_id" label="Standard-Gruppierung"></f-text>
|
||||||
<f-text id="password" v-model="inner.password" label="Passwort" name="password" type="password"></f-text>
|
<f-text id="password" v-model="data.password" label="Passwort" name="password" type="password"></f-text>
|
||||||
</form>
|
</form>
|
||||||
</setting-layout>
|
</setting-layout>
|
||||||
</page-layout>
|
</page-layout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
import SettingLayout from './Layout.vue';
|
import {props, useSettings} from './useSettings.js';
|
||||||
|
const innerProps = defineProps(props);
|
||||||
export default {
|
const {submit, data, meta, SettingLayout} = useSettings(innerProps);
|
||||||
components: {
|
|
||||||
SettingLayout,
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
data: {
|
|
||||||
type: Object,
|
|
||||||
default: () => {
|
|
||||||
return {};
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
data: function () {
|
|
||||||
return {
|
|
||||||
inner: {...this.data},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
submit() {
|
|
||||||
this.$inertia.post('/setting/nami', this.inner, {
|
|
||||||
onSuccess: () => this.$success('Einstellungen gespeichert.'),
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<template #right>
|
<template #right>
|
||||||
<f-save-button form="preventionform"></f-save-button>
|
<f-save-button form="preventionform"></f-save-button>
|
||||||
</template>
|
</template>
|
||||||
<setting-layout v-if="loaded">
|
<setting-layout>
|
||||||
<form id="preventionform" class="grow p-6" @submit.prevent="submit">
|
<form id="preventionform" class="grow p-6" @submit.prevent="submit">
|
||||||
<div class="col-span-full text-gray-100 mb-3">
|
<div class="col-span-full text-gray-100 mb-3">
|
||||||
<p class="text-sm">Hier kannst du Einstellungen zu Prävention setzen.</p>
|
<p class="text-sm">Hier kannst du Einstellungen zu Prävention setzen.</p>
|
||||||
|
@ -16,22 +16,8 @@
|
||||||
</page-layout>
|
</page-layout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="js" setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import {props, useSettings} from './useSettings.js';
|
||||||
import { useApiIndex } from '../../composables/useApiIndex.js';
|
const innerProps = defineProps(props);
|
||||||
import SettingLayout from '../setting/Layout.vue';
|
const {submit, data, meta, SettingLayout} = useSettings(innerProps);
|
||||||
|
|
||||||
const { axios, data, reload } = useApiIndex('/api/prevention', 'prevention');
|
|
||||||
const loaded = ref(false);
|
|
||||||
|
|
||||||
async function load() {
|
|
||||||
await reload();
|
|
||||||
loaded.value = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function submit() {
|
|
||||||
await axios.post('/api/prevention', { ...data.value });
|
|
||||||
}
|
|
||||||
|
|
||||||
load();
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
<template>
|
||||||
|
<page-layout>
|
||||||
|
<template #toolbar>
|
||||||
|
<page-toolbar-button color="primary" icon="plus" @click.prevent="create">Neuer Benutzer</page-toolbar-button>
|
||||||
|
</template>
|
||||||
|
<ui-popup v-if="single !== null" :heading="single.id ? 'Benutzer bearbeiten' : 'Neuer Benutzer'" @close="cancel">
|
||||||
|
<form @submit.prevent="submit">
|
||||||
|
<section class="grid grid-cols-2 gap-3 mt-6">
|
||||||
|
<f-text id="firstname" v-model="single.firstname" name="firstname" label="Vorname" required></f-text>
|
||||||
|
<f-text id="lastname" v-model="single.lastname" name="lastname" label="Nachname" required></f-text>
|
||||||
|
<f-text id="email" v-model="single.email" name="email" label="E-Mail-Adresse" required></f-text>
|
||||||
|
</section>
|
||||||
|
<section class="flex mt-4 space-x-2">
|
||||||
|
<ui-button type="submit" class="btn-danger">Speichern</ui-button>
|
||||||
|
<ui-button class="btn-primary" @click.prevent="single = null">Abbrechen</ui-button>
|
||||||
|
</section>
|
||||||
|
</form>
|
||||||
|
</ui-popup>
|
||||||
|
<setting-layout>
|
||||||
|
<div class="w-full h-full pb-6">
|
||||||
|
<table cellspacing="0" cellpadding="0" border="0" class="custom-table custom-table-sm hidden md:table">
|
||||||
|
<thead>
|
||||||
|
<th>Nachname</th>
|
||||||
|
<th>Vorname</th>
|
||||||
|
<th>Aktion</th>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tr v-for="(user, index) in data" :key="index">
|
||||||
|
<td v-text="user.lastname"></td>
|
||||||
|
<td v-text="user.firstname"></td>
|
||||||
|
<td>
|
||||||
|
<a v-tooltip="`Bearbeiten`" href="#" class="inline-flex btn btn-warning btn-sm" @click.prevent="edit(user)"><ui-sprite src="pencil"></ui-sprite></a>
|
||||||
|
<a v-tooltip="`Löschen`" href="#" class="inline-flex btn btn-danger btn-sm" @click.prevent="remove(user)"><ui-sprite src="pencil"></ui-sprite></a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="px-6">
|
||||||
|
<ui-pagination class="mt-4" :value="meta" :only="['data']"></ui-pagination>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</setting-layout>
|
||||||
|
</page-layout>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="js" setup>
|
||||||
|
import SettingLayout from '../setting/Layout.vue';
|
||||||
|
|
||||||
|
import {indexProps, useIndex} from '../../composables/useInertiaApiIndex.js';
|
||||||
|
|
||||||
|
const props = defineProps(indexProps);
|
||||||
|
|
||||||
|
const {data, cancel, meta, single, create, submit, edit} = useIndex(props.data);
|
||||||
|
</script>
|
|
@ -0,0 +1,29 @@
|
||||||
|
import {useIndex} from '../../composables/useInertiaApiIndex.js';
|
||||||
|
import SettingLayout from './Layout.vue';
|
||||||
|
|
||||||
|
export function useSettings(props) {
|
||||||
|
const {data, meta, router} = useIndex(props.data);
|
||||||
|
|
||||||
|
function submit() {
|
||||||
|
router.post(meta.value.links.store, {...data.value});
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
submit,
|
||||||
|
data,
|
||||||
|
meta,
|
||||||
|
props,
|
||||||
|
SettingLayout,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = {
|
||||||
|
data: {
|
||||||
|
default: () => {
|
||||||
|
return {data: [], meta: {}};
|
||||||
|
},
|
||||||
|
type: Object,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export {props};
|
|
@ -0,0 +1,18 @@
|
||||||
|
@component('mail::message')
|
||||||
|
# Hallo {{ $user->getFullname() }},
|
||||||
|
|
||||||
|
Für dich wurde vor kurzem bei Adrema ({{$home}}) ein neues Konto mit der E-Mail-Adresse {{$user->email}} angelegt.
|
||||||
|
|
||||||
|
Bitte klicke auf nachfolgenden Link, um für dieses Konto ein Passwort zu vergeben:
|
||||||
|
|
||||||
|
@component('mail::button', ['url' => $resetUrl])
|
||||||
|
Passwort setzen
|
||||||
|
@endcomponent
|
||||||
|
|
||||||
|
@component('mail::subcopy')
|
||||||
|
Herzliche Grüße und gut Pfad
|
||||||
|
|
||||||
|
{{app(\App\Invoice\InvoiceSettings::class)->from_long}}
|
||||||
|
@endcomponent
|
||||||
|
|
||||||
|
@endcomponent
|
|
@ -3,13 +3,9 @@
|
||||||
use App\Contribution\Actions\GenerateApiAction as ContributionGenerateApiAction;
|
use App\Contribution\Actions\GenerateApiAction as ContributionGenerateApiAction;
|
||||||
use App\Form\Actions\FormApiListAction;
|
use App\Form\Actions\FormApiListAction;
|
||||||
use App\Form\Actions\RegisterAction;
|
use App\Form\Actions\RegisterAction;
|
||||||
use App\Prevention\Actions\SettingStoreAction as PreventionStoreAction;
|
|
||||||
use App\Group\Actions\GroupApiIndexAction;
|
use App\Group\Actions\GroupApiIndexAction;
|
||||||
use App\Prevention\Actions\SettingApiAction;
|
|
||||||
|
|
||||||
Route::post('/contribution-generate', ContributionGenerateApiAction::class)->name('api.contribution.generate')->middleware('client:contribution-generate');
|
Route::post('/contribution-generate', ContributionGenerateApiAction::class)->name('api.contribution.generate')->middleware('client:contribution-generate');
|
||||||
Route::post('/form/{form}/register', RegisterAction::class)->name('form.register');
|
Route::post('/form/{form}/register', RegisterAction::class)->name('form.register');
|
||||||
Route::get('/group/{group?}', GroupApiIndexAction::class)->name('api.group');
|
Route::get('/group/{group?}', GroupApiIndexAction::class)->name('api.group');
|
||||||
Route::get('/form', FormApiListAction::class)->name('api.form.index');
|
Route::get('/form', FormApiListAction::class)->name('api.form.index');
|
||||||
Route::get('/prevention', SettingApiAction::class)->name('api.prevention.index');
|
|
||||||
Route::post('/prevention', PreventionStoreAction::class)->name('api.prevention.store');
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ use App\Invoice\Actions\InvoiceStoreAction;
|
||||||
use App\Course\Actions\CourseUpdateAction;
|
use App\Course\Actions\CourseUpdateAction;
|
||||||
use App\Dashboard\Actions\IndexAction as DashboardIndexAction;
|
use App\Dashboard\Actions\IndexAction as DashboardIndexAction;
|
||||||
use App\Efz\ShowEfzDocumentAction;
|
use App\Efz\ShowEfzDocumentAction;
|
||||||
use App\Fileshare\Actions\FileshareApiIndexAction;
|
|
||||||
use App\Fileshare\Actions\FileshareStoreAction;
|
use App\Fileshare\Actions\FileshareStoreAction;
|
||||||
use App\Fileshare\Actions\FileshareUpdateAction;
|
use App\Fileshare\Actions\FileshareUpdateAction;
|
||||||
use App\Fileshare\Actions\ListFilesAction;
|
use App\Fileshare\Actions\ListFilesAction;
|
||||||
|
@ -78,6 +77,8 @@ use App\Membership\Actions\MembershipDestroyAction;
|
||||||
use App\Membership\Actions\MembershipStoreAction;
|
use App\Membership\Actions\MembershipStoreAction;
|
||||||
use App\Membership\Actions\MembershipUpdateAction;
|
use App\Membership\Actions\MembershipUpdateAction;
|
||||||
use App\Payment\SubscriptionController;
|
use App\Payment\SubscriptionController;
|
||||||
|
use App\User\Actions\StoreAction as UserStoreAction;
|
||||||
|
use App\User\Actions\UpdateAction as UserUpdateAction;
|
||||||
|
|
||||||
Route::group(['namespace' => 'App\\Http\\Controllers'], function (): void {
|
Route::group(['namespace' => 'App\\Http\\Controllers'], function (): void {
|
||||||
Auth::routes(['register' => false]);
|
Auth::routes(['register' => false]);
|
||||||
|
@ -182,6 +183,9 @@ Route::group(['middleware' => 'auth:web'], function (): void {
|
||||||
// ------------------------------------ fileshare -----------------------------------
|
// ------------------------------------ fileshare -----------------------------------
|
||||||
Route::post('/fileshare', FileshareStoreAction::class)->name('fileshare.store');
|
Route::post('/fileshare', FileshareStoreAction::class)->name('fileshare.store');
|
||||||
Route::patch('/fileshare/{fileshare}', FileshareUpdateAction::class)->name('fileshare.update');
|
Route::patch('/fileshare/{fileshare}', FileshareUpdateAction::class)->name('fileshare.update');
|
||||||
Route::get('/api/fileshare', FileshareApiIndexAction::class)->name('api.fileshare.index');
|
|
||||||
Route::post('/api/fileshare/{fileshare}/files', ListFilesAction::class)->name('api.fileshare.files');
|
Route::post('/api/fileshare/{fileshare}/files', ListFilesAction::class)->name('api.fileshare.files');
|
||||||
|
|
||||||
|
// -------------------------------------- user -------------------------------------
|
||||||
|
Route::post('/user', UserStoreAction::class)->name('user.store');
|
||||||
|
Route::patch('/user/{user}', UserUpdateAction::class)->name('user.update');
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature\Permission;
|
||||||
|
|
||||||
|
use App\User;
|
||||||
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class UserIndexTest extends TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
use DatabaseTransactions;
|
||||||
|
|
||||||
|
public function testItOpensSettingsPage(): void
|
||||||
|
{
|
||||||
|
$this->login()->loginNami();
|
||||||
|
auth()->user()->update(['firstname' => 'Jane', 'lastname' => 'Doe']);
|
||||||
|
User::factory()->create(['firstname' => 'John', 'lastname' => 'Doe']);
|
||||||
|
$anna = User::factory()->create(['firstname' => 'Anna', 'lastname' => 'Doe']);
|
||||||
|
$this->get(route('setting.view', ['settingGroup' => 'user']))
|
||||||
|
->assertOk()
|
||||||
|
->assertComponent('setting/User')
|
||||||
|
->assertInertiaPath('data.data.0.firstname', 'Anna')
|
||||||
|
->assertInertiaPath('data.data.0.lastname', 'Doe')
|
||||||
|
->assertInertiaPath('data.data.0.id', $anna->id)
|
||||||
|
->assertInertiaPath('data.data.0.links.update', route('user.update', ['user' => $anna]))
|
||||||
|
->assertInertiaPath('data.data.1.firstname', 'Jane')
|
||||||
|
->assertInertiaPath('data.data.2.firstname', 'John')
|
||||||
|
->assertInertiaPath('data.meta.default.firstname', '')
|
||||||
|
->assertInertiaPath('data.meta.default.email', '')
|
||||||
|
->assertInertiaPath('data.meta.links.store', route('user.store'));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature\Permission;
|
||||||
|
|
||||||
|
use App\Invoice\InvoiceSettings;
|
||||||
|
use App\User;
|
||||||
|
use App\User\Mail\WelcomeMail;
|
||||||
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use Tests\RequestFactories\UserRequestFactory;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class UserStoreTest extends TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
use DatabaseTransactions;
|
||||||
|
|
||||||
|
public function testItStoresUser(): void
|
||||||
|
{
|
||||||
|
Mail::fake();
|
||||||
|
$this->login()->loginNami();
|
||||||
|
|
||||||
|
$this->postJson(route('user.store'), UserRequestFactory::new()->name('Max Muster')->email('max@muster.de')->create())
|
||||||
|
->assertOk();
|
||||||
|
|
||||||
|
$this->assertDatabaseHas('users', [
|
||||||
|
'email' => 'max@muster.de',
|
||||||
|
'firstname' => 'Max',
|
||||||
|
'lastname' => 'Muster',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertDatabaseHas('password_resets', ['email' => 'max@muster.de']);
|
||||||
|
Mail::assertQueued(
|
||||||
|
WelcomeMail::class,
|
||||||
|
fn ($mail) => Hash::check($mail->token, DB::table('password_resets')->where('email', 'max@muster.de')->first()->token)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testItNeedsNameAndEmail(): void
|
||||||
|
{
|
||||||
|
Mail::fake();
|
||||||
|
$this->login()->loginNami();
|
||||||
|
|
||||||
|
User::factory()->email('jane@doe.de')->create();
|
||||||
|
$this->postJson(route('user.store'), UserRequestFactory::new()->name('')->email('max@muster.de')->create())->assertJsonValidationErrors('firstname');
|
||||||
|
$this->postJson(route('user.store'), UserRequestFactory::new()->name('Max Muster')->email('maxusterde')->create())->assertJsonValidationErrors('email');
|
||||||
|
$this->postJson(route('user.store'), UserRequestFactory::new()->name('Max Muster')->email('')->create())->assertJsonValidationErrors('email');
|
||||||
|
$this->postJson(route('user.store'), UserRequestFactory::new()->email('jane@doe.de')->create())->assertJsonValidationErrors('email');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testWelcomeMailHasPasswordResetLink(): void
|
||||||
|
{
|
||||||
|
app(InvoiceSettings::class)->fill(['from_long' => 'Stamm BiPi'])->save();
|
||||||
|
(new WelcomeMail(User::factory()->email('max@muster.de')->name('Max Muster')->create(), 'RESETToken'))
|
||||||
|
->assertSeeInHtml('Hallo Max Muster')
|
||||||
|
->assertSeeInHtml(url(''))
|
||||||
|
->assertSeeInHtml('Stamm BiPi')
|
||||||
|
->assertSeeInHtml('max@muster.de')
|
||||||
|
->assertSeeInHtml(route('password.reset', ['token' => 'RESETToken', 'email' => 'max@muster.de']));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature\Permission;
|
||||||
|
|
||||||
|
use App\User;
|
||||||
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use Tests\RequestFactories\UserRequestFactory;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class UserUpdateTest extends TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
use DatabaseTransactions;
|
||||||
|
|
||||||
|
public function testItUpdatesAUser(): void
|
||||||
|
{
|
||||||
|
$this->login()->loginNami();
|
||||||
|
|
||||||
|
$user = User::factory()->create();
|
||||||
|
$this->patchJson(route('user.update', ['user' => $user]), UserRequestFactory::new()->name('Max Muster')->email('max@muster.de')->create())
|
||||||
|
->assertOk();
|
||||||
|
|
||||||
|
$this->assertDatabaseHas('users', [
|
||||||
|
'email' => 'max@muster.de',
|
||||||
|
'firstname' => 'Max',
|
||||||
|
'lastname' => 'Muster',
|
||||||
|
]);
|
||||||
|
$this->assertDatabaseCount('users', 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testItCannotUseAGivenMailAddress(): void
|
||||||
|
{
|
||||||
|
$this->login()->loginNami();
|
||||||
|
|
||||||
|
$jane = User::factory()->email('jane@muster.de')->create();
|
||||||
|
$user = User::factory()->create();
|
||||||
|
$this->patchJson(route('user.update', ['user' => $user]), UserRequestFactory::new()->email('jane@muster.de')->create())
|
||||||
|
->assertJsonValidationErrors('email');
|
||||||
|
$this->patchJson(route('user.update', ['user' => $jane]), UserRequestFactory::new()->email('jane@muster.de')->create())
|
||||||
|
->assertJsonMissingValidationErrors('email');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testItNeedsNameAndEmail(): void
|
||||||
|
{
|
||||||
|
Mail::fake();
|
||||||
|
$this->login()->loginNami();
|
||||||
|
$user = User::factory()->create();
|
||||||
|
|
||||||
|
User::factory()->email('jane@doe.de')->create();
|
||||||
|
$this->patchJson(route('user.update', ['user' => $user]), UserRequestFactory::new()->name('')->email('max@muster.de')->create())->assertJsonValidationErrors('firstname');
|
||||||
|
$this->patchJson(route('user.update', ['user' => $user]), UserRequestFactory::new()->name('Max Muster')->email('maxusterde')->create())->assertJsonValidationErrors('email');
|
||||||
|
$this->patchJson(route('user.update', ['user' => $user]), UserRequestFactory::new()->name('Max Muster')->email('')->create())->assertJsonValidationErrors('email');
|
||||||
|
$this->patchJson(route('user.update', ['user' => $user]), UserRequestFactory::new()->email('jane@doe.de')->create())->assertJsonValidationErrors('email');
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,25 +16,25 @@ class SettingTest extends TestCase
|
||||||
{
|
{
|
||||||
$this->login()->loginNami();
|
$this->login()->loginNami();
|
||||||
|
|
||||||
$this->get('/setting/prevention')->assertComponent('setting/Prevention')->assertOk();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testItReceivesSettings(): void
|
|
||||||
{
|
|
||||||
$this->login()->loginNami();
|
|
||||||
|
|
||||||
$text = EditorRequestFactory::new()->text(50, 'lorem ipsum')->toData();
|
$text = EditorRequestFactory::new()->text(50, 'lorem ipsum')->toData();
|
||||||
app(PreventionSettings::class)->fill(['formmail' => $text])->save();
|
app(PreventionSettings::class)->fill(['formmail' => $text])->save();
|
||||||
|
|
||||||
$this->get('/api/prevention')
|
$this->get(route('setting.view', ['settingGroup' => 'prevention']))
|
||||||
->assertJsonPath('data.formmail.blocks.0.data.text', 'lorem ipsum');
|
->assertOk()
|
||||||
|
->assertComponent('setting/Prevention')
|
||||||
|
->assertInertiaPath('data.formmail.blocks.0.data.text', 'lorem ipsum')
|
||||||
|
->assertInertiaPath('store_url', route('setting.store', ['settingGroup' => 'prevention']));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testItStoresSettings(): void
|
public function testItStoresSettings(): void
|
||||||
{
|
{
|
||||||
$this->login()->loginNami();
|
$this->login()->loginNami();
|
||||||
|
|
||||||
$this->post('/api/prevention', ['formmail' => EditorRequestFactory::new()->text(50, 'new lorem')->create()])->assertOk();
|
$route = route('setting.store', ['settingGroup' => 'prevention']);
|
||||||
|
$this
|
||||||
|
->from($route)
|
||||||
|
->post($route, ['formmail' => EditorRequestFactory::new()->text(50, 'new lorem')->create()])
|
||||||
|
->assertRedirect($route);
|
||||||
$this->assertTrue(app(PreventionSettings::class)->formmail->hasAll(['new lorem']));
|
$this->assertTrue(app(PreventionSettings::class)->formmail->hasAll(['new lorem']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,31 +17,25 @@ class FileshareIndexActionTest extends FileshareTestCase
|
||||||
->name('lokaler Server')
|
->name('lokaler Server')
|
||||||
->create();
|
->create();
|
||||||
|
|
||||||
$this->get('/api/fileshare')
|
$this->get(route('setting.view', ['settingGroup' => 'fileshare']))
|
||||||
->assertJsonPath('data.0.name', 'lokaler Server')
|
->assertComponent('setting/Fileshare')
|
||||||
->assertJsonPath('data.0.type', OwncloudConnection::class)
|
->assertInertiaPath('data.data.0.name', 'lokaler Server')
|
||||||
->assertJsonPath('data.0.config.user', 'badenpowell')
|
->assertInertiaPath('data.data.0.type', OwncloudConnection::class)
|
||||||
->assertJsonPath('data.0.config.password', 'secret')
|
->assertInertiaPath('data.data.0.config.user', 'badenpowell')
|
||||||
->assertJsonPath('data.0.config.base_url', env('TEST_OWNCLOUD_DOMAIN'))
|
->assertInertiaPath('data.data.0.config.password', 'secret')
|
||||||
->assertJsonPath('data.0.id', $connection->id)
|
->assertInertiaPath('data.data.0.config.base_url', env('TEST_OWNCLOUD_DOMAIN'))
|
||||||
->assertJsonPath('data.0.is_active', true)
|
->assertInertiaPath('data.data.0.id', $connection->id)
|
||||||
->assertJsonPath('data.0.type_human', 'Owncloud')
|
->assertInertiaPath('data.data.0.is_active', true)
|
||||||
->assertJsonPath('data.0.links.update', route('fileshare.update', ['fileshare' => $connection]))
|
->assertInertiaPath('data.data.0.type_human', 'Owncloud')
|
||||||
->assertJsonPath('meta.default.name', '')
|
->assertInertiaPath('data.data.0.links.update', route('fileshare.update', ['fileshare' => $connection]))
|
||||||
->assertJsonPath('meta.links.store', route('fileshare.store'))
|
->assertInertiaPath('data.meta.default.name', '')
|
||||||
->assertJsonPath('meta.types.0.id', NextcloudConnection::class)
|
->assertInertiaPath('data.meta.links.store', route('fileshare.store'))
|
||||||
->assertJsonPath('meta.types.0.name', 'Nextcloud')
|
->assertInertiaPath('data.meta.types.0.id', NextcloudConnection::class)
|
||||||
->assertJsonPath('meta.types.0.defaults.base_url', '')
|
->assertInertiaPath('data.meta.types.0.name', 'Nextcloud')
|
||||||
->assertJsonPath('meta.types.1.id', OwncloudConnection::class)
|
->assertInertiaPath('data.meta.types.0.defaults.base_url', '')
|
||||||
->assertJsonPath('meta.types.1.name', 'Owncloud')
|
->assertInertiaPath('data.meta.types.1.id', OwncloudConnection::class)
|
||||||
->assertJsonPath('meta.types.1.defaults.base_url', '')
|
->assertInertiaPath('data.meta.types.1.name', 'Owncloud')
|
||||||
->assertJsonPath('meta.types.0.fields.1', ['label' => 'Benutzer', 'key' => 'user', 'type' => 'text']);
|
->assertInertiaPath('data.meta.types.1.defaults.base_url', '')
|
||||||
}
|
->assertInertiaPath('data.meta.types.0.fields.1', ['label' => 'Benutzer', 'key' => 'user', 'type' => 'text']);
|
||||||
|
|
||||||
public function testItRendersComponent(): void
|
|
||||||
{
|
|
||||||
$this->withoutExceptionHandling()->login()->loginNami();
|
|
||||||
|
|
||||||
$this->get('/setting/fileshare')->assertComponent('setting/Fileshare');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\RequestFactories;
|
||||||
|
|
||||||
|
use Worksome\RequestFactories\RequestFactory;
|
||||||
|
|
||||||
|
class UserRequestFactory extends RequestFactory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return array{fee_id: int, name: string, children: array<int, array{amount: int, name: string}>}
|
||||||
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'firstname' => $this->faker->firstName(),
|
||||||
|
'lastname' => $this->faker->lastName(),
|
||||||
|
'email' => $this->faker->safeEmail(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function name(string $name): self
|
||||||
|
{
|
||||||
|
[$firstname, $lastname] = explode(' ', $name ?: ' ');
|
||||||
|
return $this->state(['firstname' => $firstname, 'lastname' => $lastname]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function email(string $email): self
|
||||||
|
{
|
||||||
|
return $this->state(['email' => $email]);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue