Add Settings for Bill
This commit is contained in:
parent
bff309ccfa
commit
c4b300403f
|
@ -4,10 +4,10 @@ namespace App\Contribution\Documents;
|
||||||
|
|
||||||
use App\Contribution\Data\MemberData;
|
use App\Contribution\Data\MemberData;
|
||||||
use App\Country;
|
use App\Country;
|
||||||
use App\Invoice\InvoiceSettings;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
use Modules\Invoice\InvoiceSettings;
|
||||||
use Zoomyboy\Tex\Engine;
|
use Zoomyboy\Tex\Engine;
|
||||||
use Zoomyboy\Tex\Template;
|
use Zoomyboy\Tex\Template;
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
namespace App\Contribution\Documents;
|
namespace App\Contribution\Documents;
|
||||||
|
|
||||||
use App\Contribution\Data\MemberData;
|
use App\Contribution\Data\MemberData;
|
||||||
use App\Invoice\InvoiceSettings;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
use Modules\Invoice\InvoiceSettings;
|
||||||
use Zoomyboy\Tex\Engine;
|
use Zoomyboy\Tex\Engine;
|
||||||
use Zoomyboy\Tex\Template;
|
use Zoomyboy\Tex\Template;
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ use App\Invoice\Models\Invoice;
|
||||||
use App\Payment\Payment;
|
use App\Payment\Payment;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
use Modules\Invoice\InvoiceSettings;
|
||||||
use Zoomyboy\Tex\Document;
|
use Zoomyboy\Tex\Document;
|
||||||
use Zoomyboy\Tex\Engine;
|
use Zoomyboy\Tex\Engine;
|
||||||
use Zoomyboy\Tex\Template;
|
use Zoomyboy\Tex\Template;
|
||||||
|
|
|
@ -6,7 +6,6 @@ use App\Invoice\BillDocument;
|
||||||
use App\Invoice\BillKind;
|
use App\Invoice\BillKind;
|
||||||
use App\Invoice\Enums\InvoiceStatus;
|
use App\Invoice\Enums\InvoiceStatus;
|
||||||
use App\Invoice\InvoiceDocument;
|
use App\Invoice\InvoiceDocument;
|
||||||
use App\Invoice\InvoiceSettings;
|
|
||||||
use App\Invoice\RememberDocument;
|
use App\Invoice\RememberDocument;
|
||||||
use App\Invoice\Scopes\InvoiceFilterScope;
|
use App\Invoice\Scopes\InvoiceFilterScope;
|
||||||
use App\Member\Member;
|
use App\Member\Member;
|
||||||
|
@ -17,6 +16,7 @@ use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
use Modules\Invoice\InvoiceSettings;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
|
|
||||||
class Invoice extends Model
|
class Invoice extends Model
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace App\Prevention\Mails;
|
namespace App\Prevention\Mails;
|
||||||
|
|
||||||
use App\Invoice\InvoiceSettings;
|
|
||||||
use App\Lib\Editor\EditorData;
|
use App\Lib\Editor\EditorData;
|
||||||
use App\Prevention\Contracts\Preventable;
|
use App\Prevention\Contracts\Preventable;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
|
@ -11,6 +10,7 @@ use Illuminate\Mail\Mailable;
|
||||||
use Illuminate\Mail\Mailables\Content;
|
use Illuminate\Mail\Mailables\Content;
|
||||||
use Illuminate\Mail\Mailables\Envelope;
|
use Illuminate\Mail\Mailables\Envelope;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use Modules\Invoice\InvoiceSettings;
|
||||||
|
|
||||||
class PreventionRememberMail extends Mailable
|
class PreventionRememberMail extends Mailable
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,6 @@ class BaseServiceProvider extends ServiceProvider
|
||||||
return $condition ? $self->merge([$key => $attributes]) : $self;
|
return $condition ? $self->merge([$key => $attributes]) : $self;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Livewire::resolveMissingComponent(function ($name) {
|
Livewire::resolveMissingComponent(function ($name) {
|
||||||
'modules.dashboard.components.dashboard-component';
|
'modules.dashboard.components.dashboard-component';
|
||||||
if (str($name)->startsWith('modules.')) {
|
if (str($name)->startsWith('modules.')) {
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Setting\Data;
|
||||||
|
|
||||||
|
use Livewire\Mechanisms\HandleComponents\Synthesizers\Synth;
|
||||||
|
use Spatie\LaravelSettings\Settings;
|
||||||
|
|
||||||
|
class SettingSynthesizer extends Synth
|
||||||
|
{
|
||||||
|
public static $key = 'setting-class';
|
||||||
|
|
||||||
|
public static function match($target)
|
||||||
|
{
|
||||||
|
return $target instanceof Settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function dehydrate($target)
|
||||||
|
{
|
||||||
|
return [$target->toArray(), ['setting_class' => get_class($target)]];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hydrate($value, $meta)
|
||||||
|
{
|
||||||
|
return app($meta['setting_class'])->fill($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get(&$target, $key)
|
||||||
|
{
|
||||||
|
return $target->{$key};
|
||||||
|
}
|
||||||
|
|
||||||
|
public function set(&$target, $key, $value)
|
||||||
|
{
|
||||||
|
$target->{$key} = $value;
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,12 +4,14 @@ namespace App\Setting;
|
||||||
|
|
||||||
use App\Fileshare\FileshareSettings;
|
use App\Fileshare\FileshareSettings;
|
||||||
use App\Form\FormSettings;
|
use App\Form\FormSettings;
|
||||||
use App\Invoice\InvoiceSettings;
|
|
||||||
use App\Mailgateway\MailgatewaySettings;
|
use App\Mailgateway\MailgatewaySettings;
|
||||||
use Modules\Module\ModuleSettings;
|
use Modules\Module\ModuleSettings;
|
||||||
use App\Prevention\PreventionSettings;
|
use App\Prevention\PreventionSettings;
|
||||||
|
use App\Setting\Data\SettingSynthesizer;
|
||||||
use Illuminate\Routing\Router;
|
use Illuminate\Routing\Router;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Livewire\Livewire;
|
||||||
|
use Modules\Invoice\InvoiceSettings;
|
||||||
|
|
||||||
class SettingServiceProvider extends ServiceProvider
|
class SettingServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
@ -38,5 +40,7 @@ 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);
|
||||||
|
|
||||||
|
Livewire::propertySynthesizer(SettingSynthesizer::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\View\Form;
|
||||||
|
|
||||||
|
use App\View\Traits\HasFormDimensions;
|
||||||
|
use Illuminate\View\Component;
|
||||||
|
|
||||||
|
class Text extends Component
|
||||||
|
{
|
||||||
|
|
||||||
|
use HasFormDimensions;
|
||||||
|
|
||||||
|
public string $id;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
public string $name,
|
||||||
|
public string $size = 'default',
|
||||||
|
public ?string $hint = null,
|
||||||
|
public bool $required = false,
|
||||||
|
public string $label = '',
|
||||||
|
public string $type = 'text'
|
||||||
|
) {
|
||||||
|
$this->id = str()->uuid()->toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
return <<<'HTML'
|
||||||
|
<label class="flex flex-col group {{$heightClass}}" for="{{$id}}" style="{{$heightVars}}">
|
||||||
|
@if ($label)
|
||||||
|
<x-form::label :required="$required">{{$label}}</x-form::label>
|
||||||
|
@endif
|
||||||
|
<div class="relative flex-none flex">
|
||||||
|
<input
|
||||||
|
id="{{$id}}"
|
||||||
|
type="{{$type}}"
|
||||||
|
placeholder=""
|
||||||
|
class="
|
||||||
|
w-full h-[var(--height)] border-gray-600 border-solid text-gray-300 bg-gray-700 leading-none rounded-lg
|
||||||
|
group-[.size-default]:border-2 group-[.size-sm]:border
|
||||||
|
group-[.size-default]:text-sm group-[.size-sm]:text-xs
|
||||||
|
group-[.size-default]:p-2 group-[.size-sm]:p-1
|
||||||
|
"
|
||||||
|
{{ $attributes }}
|
||||||
|
/>
|
||||||
|
@if($hint)
|
||||||
|
<x-form::hint>{{$hint}}</x-form::hint>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
HTML;
|
||||||
|
}
|
||||||
|
}
|
|
@ -177,9 +177,10 @@ return [
|
||||||
App\Setting\SettingServiceProvider::class,
|
App\Setting\SettingServiceProvider::class,
|
||||||
// App\Dashboard\DashboardServiceProvider::class,
|
// App\Dashboard\DashboardServiceProvider::class,
|
||||||
App\Providers\PluginServiceProvider::class,
|
App\Providers\PluginServiceProvider::class,
|
||||||
|
App\Providers\BaseServiceProvider::class,
|
||||||
Modules\Dashboard\DashboardServiceProvider::class,
|
Modules\Dashboard\DashboardServiceProvider::class,
|
||||||
Modules\Module\ModuleServiceProvider::class,
|
Modules\Module\ModuleServiceProvider::class,
|
||||||
App\Providers\BaseServiceProvider::class,
|
Modules\Invoice\InvoiceServiceProvider::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Invoice\Components;
|
||||||
|
|
||||||
|
use App\Module\Module;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
use Livewire\Component;
|
||||||
|
use Modules\Invoice\InvoiceSettings;
|
||||||
|
use Modules\Module\ModuleSettings;
|
||||||
|
|
||||||
|
class SettingView extends Component
|
||||||
|
{
|
||||||
|
|
||||||
|
public $settingClass = InvoiceSettings::class;
|
||||||
|
public InvoiceSettings $settings;
|
||||||
|
|
||||||
|
public function mount(): void
|
||||||
|
{
|
||||||
|
$this->settings = app(InvoiceSettings::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function save(): void
|
||||||
|
{
|
||||||
|
$this->settings->save();
|
||||||
|
$this->dispatch('success', 'Einstellungen gespeichert.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
return <<<'HTML'
|
||||||
|
<x-page::setting-layout :active="$settingClass">
|
||||||
|
<x-slot:right>
|
||||||
|
<x-form::save-button form="billsettingform"></x-form::save-button>
|
||||||
|
</x-slot:right>
|
||||||
|
<form id="billsettingform" class="grow p-6 grid grid-cols-2 gap-3 items-start content-start" wire:submit.prevent="save">
|
||||||
|
<x-form::text name="from" wire:model="settings.from" label="Absender" hint="Absender-Name in Kurzform, i.d.R. der kurze Stammesname"></x-form::text>
|
||||||
|
<x-form::text name="from_long" wire:model="settings.from_long" label="Absender (lang)" hint="Absender-Name in Langform, i.d.R. der Stammesname"></x-form::text>
|
||||||
|
<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>
|
||||||
|
<x-form::text name="address" wire:model="settings.address" label="Straße"></x-form::text>
|
||||||
|
<x-form::text name="zip" wire:model="settings.zip" label="PLZ"></x-form::text>
|
||||||
|
<x-form::text name="place" wire:model="settings.place" label="Ort"></x-form::text>
|
||||||
|
<x-form::text name="email" wire:model="settings.email" label="E-Mail-Adresse"></x-form::text>
|
||||||
|
<x-form::text name="mobile" wire:model="settings.mobile" label="Telefonnummer"></x-form::text>
|
||||||
|
<x-form::text name="website" wire:model="settings.website" label="Webseite"></x-form::text>
|
||||||
|
<x-form::text name="iban" wire:model="settings.iban" label="IBAN"></x-form::text>
|
||||||
|
<x-form::text name="bic" wire:model="settings.bic" label="BIC"></x-form::text>
|
||||||
|
<x-form::text name="remember_weeks" wire:model="settings.rememberWeeks" type="number" label="Erinnerung alle X Wochen versenden"></x-form::text>
|
||||||
|
</form>
|
||||||
|
</x-page::setting-layout>
|
||||||
|
HTML;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Invoice;
|
||||||
|
|
||||||
|
use Illuminate\Routing\Router;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Modules\Invoice\Components\SettingView as ComponentsSettingView;
|
||||||
|
|
||||||
|
class InvoiceServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Register services.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bootstrap services.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
app(Router::class)->middleware(['web', 'auth:web'])->group(function ($router) {
|
||||||
|
$router->get('/setting/bill', ComponentsSettingView::class)->name('setting.bill');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Invoice;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
|
use Livewire\Livewire;
|
||||||
|
use Modules\Invoice\Components\SettingView;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
uses(TestCase::class);
|
||||||
|
uses(DatabaseTransactions::class);
|
||||||
|
|
||||||
|
it('it renders page', function () {
|
||||||
|
test()->withoutExceptionHandling()->login()->loginNami();
|
||||||
|
|
||||||
|
test()->get('/setting/bill')->assertSeeLivewire(SettingView::class);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('it displays settings', function () {
|
||||||
|
$this->withoutExceptionHandling()->login()->loginNami();
|
||||||
|
app(InvoiceSettings::class)->fill([
|
||||||
|
'from_long' => 'DPSG Stamm Muster',
|
||||||
|
'from' => 'Stamm Muster',
|
||||||
|
'mobile' => '+49 176 55555',
|
||||||
|
'email' => 'max@muster.de',
|
||||||
|
'website' => 'https://example.com',
|
||||||
|
'address' => 'Musterstr 4',
|
||||||
|
'place' => 'Solingen',
|
||||||
|
'zip' => '12345',
|
||||||
|
'iban' => 'DE05',
|
||||||
|
'bic' => 'SOLSDE',
|
||||||
|
'rememberWeeks' => 6
|
||||||
|
])->save();
|
||||||
|
|
||||||
|
Livewire::test(SettingView::class)
|
||||||
|
->assertSet('settings.from_long', 'DPSG Stamm Muster')
|
||||||
|
->assertSet('settings.from', 'Stamm Muster')
|
||||||
|
->assertSet('settings.mobile', '+49 176 55555')
|
||||||
|
->assertSet('settings.email', 'max@muster.de')
|
||||||
|
->assertSet('settings.website', 'https://example.com')
|
||||||
|
->assertSet('settings.address', 'Musterstr 4')
|
||||||
|
->assertSet('settings.place', 'Solingen')
|
||||||
|
->assertSet('settings.zip', '12345')
|
||||||
|
->assertSet('settings.iban', 'DE05')
|
||||||
|
->assertSet('settings.bic', 'SOLSDE')
|
||||||
|
->assertSet('settings.rememberWeeks', 6);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('testItCanChangeSettings', function () {
|
||||||
|
test()->withoutExceptionHandling()->login()->loginNami();
|
||||||
|
|
||||||
|
Livewire::test(SettingView::class)
|
||||||
|
->set('settings.from_long', 'DPSG Stamm Muster')
|
||||||
|
->set('settings.from', 'Stamm Muster')
|
||||||
|
->set('settings.mobile', '+49 176 55555')
|
||||||
|
->set('settings.email', 'max@muster.de')
|
||||||
|
->set('settings.website', 'https://example.com')
|
||||||
|
->set('settings.address', 'Musterstr 4')
|
||||||
|
->set('settings.place', 'Solingen')
|
||||||
|
->set('settings.zip', '12345')
|
||||||
|
->set('settings.iban', 'DE05')
|
||||||
|
->set('settings.bic', 'SOLSDE')
|
||||||
|
->set('settings.rememberWeeks', 10)
|
||||||
|
->call('save')
|
||||||
|
->assertDispatched('success', 'Einstellungen gespeichert.');
|
||||||
|
|
||||||
|
$settings = app(InvoiceSettings::class);
|
||||||
|
$this->assertEquals('DPSG Stamm Muster', $settings->from_long);
|
||||||
|
$this->assertEquals('DE05', $settings->iban);
|
||||||
|
$this->assertEquals('SOLSDE', $settings->bic);
|
||||||
|
$this->assertEquals(10, $settings->rememberWeeks);
|
||||||
|
});
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Invoice;
|
namespace Modules\Invoice;
|
||||||
|
|
||||||
use App\Setting\Contracts\Storeable;
|
use App\Setting\Contracts\Storeable;
|
||||||
use App\Setting\LocalSettings;
|
use App\Setting\LocalSettings;
|
|
@ -1,154 +0,0 @@
|
||||||
<template>
|
|
||||||
<label class="flex flex-col group" :for="id" :class="sizeClass(size)">
|
|
||||||
<f-label v-if="label" :required="required" :value="label"></f-label>
|
|
||||||
<div class="relative flex-none flex">
|
|
||||||
<input
|
|
||||||
:id="id"
|
|
||||||
:type="type"
|
|
||||||
:value="transformedValue"
|
|
||||||
:disabled="disabled"
|
|
||||||
placeholder=""
|
|
||||||
:min="min"
|
|
||||||
:max="max"
|
|
||||||
:class="[fieldHeight, fieldAppearance, paddingX]"
|
|
||||||
class="w-full"
|
|
||||||
@input="onInput"
|
|
||||||
@change="onChange"
|
|
||||||
@focus="focus = true"
|
|
||||||
@blur="focus = false"
|
|
||||||
/>
|
|
||||||
<f-hint v-if="hint" :value="hint"></f-hint>
|
|
||||||
</div>
|
|
||||||
</label>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import wNumb from 'wnumb';
|
|
||||||
import {ref, computed} from 'vue';
|
|
||||||
import useFieldSize from '../../composables/useFieldSize';
|
|
||||||
|
|
||||||
const {fieldHeight, fieldAppearance, paddingX, sizeClass} = useFieldSize();
|
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue']);
|
|
||||||
|
|
||||||
var numb = {
|
|
||||||
natural: wNumb({
|
|
||||||
mark: '',
|
|
||||||
thousand: '',
|
|
||||||
decimals: 0,
|
|
||||||
decoder: (a) => a * 100,
|
|
||||||
encoder: (a) => a / 100,
|
|
||||||
}),
|
|
||||||
area: wNumb({
|
|
||||||
mark: ',',
|
|
||||||
thousand: '',
|
|
||||||
decimals: 2,
|
|
||||||
decoder: (a) => a * 100,
|
|
||||||
encoder: (a) => a / 100,
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
|
|
||||||
var transformers = {
|
|
||||||
none: {
|
|
||||||
display: {
|
|
||||||
to: (v) => v,
|
|
||||||
from: (v) => v,
|
|
||||||
},
|
|
||||||
edit: {
|
|
||||||
to: (v) => v,
|
|
||||||
from: (v) => v,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
area: {
|
|
||||||
display: {
|
|
||||||
to: (v) => (v === null ? '' : numb.area.to(v)),
|
|
||||||
from: (v) => (v === '' ? null : numb.area.from(v)),
|
|
||||||
},
|
|
||||||
edit: {
|
|
||||||
to(v) {
|
|
||||||
if (v === null) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
if (Math.round(v / 100) * 100 === v) {
|
|
||||||
return numb.natural.to(v);
|
|
||||||
}
|
|
||||||
return numb.area.to(v);
|
|
||||||
},
|
|
||||||
from(v) {
|
|
||||||
if (v === '') {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (v.indexOf(',') === -1) {
|
|
||||||
return numb.natural.from(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
return numb.area.from(v);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
mode: {
|
|
||||||
type: String,
|
|
||||||
default: () => 'none',
|
|
||||||
},
|
|
||||||
required: {
|
|
||||||
type: Boolean,
|
|
||||||
default: () => false,
|
|
||||||
},
|
|
||||||
size: {
|
|
||||||
type: String,
|
|
||||||
default: () => 'base',
|
|
||||||
},
|
|
||||||
id: {
|
|
||||||
type: String,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
hint: {
|
|
||||||
type: String,
|
|
||||||
default: () => '',
|
|
||||||
},
|
|
||||||
modelValue: {
|
|
||||||
validator: (v) => typeof v === 'string' || v === null,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
label: {
|
|
||||||
type: String,
|
|
||||||
default: () => '',
|
|
||||||
},
|
|
||||||
type: {
|
|
||||||
type: String,
|
|
||||||
default: () => 'text',
|
|
||||||
},
|
|
||||||
disabled: {
|
|
||||||
default: () => false,
|
|
||||||
type: Boolean,
|
|
||||||
},
|
|
||||||
min: {
|
|
||||||
type: Number,
|
|
||||||
default: () => undefined,
|
|
||||||
},
|
|
||||||
max: {
|
|
||||||
type: Number,
|
|
||||||
default: () => undefined,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const focus = ref(false);
|
|
||||||
|
|
||||||
const transformedValue = computed({
|
|
||||||
get: () => transformers[props.mode][focus.value ? 'edit' : 'display'].to(props.modelValue),
|
|
||||||
set: (v) => emit('update:modelValue', transformers[props.mode][focus.value ? 'edit' : 'display'].from(v)),
|
|
||||||
});
|
|
||||||
function onChange(v) {
|
|
||||||
if (props.mode !== 'none') {
|
|
||||||
transformedValue.value = v.target.value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function onInput(v) {
|
|
||||||
if (props.mode === 'none') {
|
|
||||||
transformedValue.value = v.target.value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
|
@ -1,49 +0,0 @@
|
||||||
<template>
|
|
||||||
<page-layout>
|
|
||||||
<template #right>
|
|
||||||
<f-save-button form="billsettingform"></f-save-button>
|
|
||||||
</template>
|
|
||||||
<setting-layout>
|
|
||||||
<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_long" v-model="inner.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>
|
|
||||||
<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="zip" v-model="inner.zip" label="PLZ"></f-text>
|
|
||||||
<f-text id="place" v-model="inner.place" label="Ort"></f-text>
|
|
||||||
<f-text id="email" v-model="inner.email" label="E-Mail-Adresse"></f-text>
|
|
||||||
<f-text id="mobile" v-model="inner.mobile" label="Telefonnummer"></f-text>
|
|
||||||
<f-text id="website" v-model="inner.website" label="Webseite"></f-text>
|
|
||||||
<f-text id="iban" v-model="inner.iban" label="IBAN"></f-text>
|
|
||||||
<f-text id="bic" v-model="inner.bic" label="BIC"></f-text>
|
|
||||||
<f-text id="remember_weeks" v-model="inner.rememberWeeks" type="number" label="Erinnerung alle X Wochen versenden"></f-text>
|
|
||||||
</form>
|
|
||||||
</setting-layout>
|
|
||||||
</page-layout>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import SettingLayout from './Layout.vue';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
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>
|
|
|
@ -7,12 +7,12 @@ use App\Contribution\Documents\RdpNrwDocument;
|
||||||
use App\Contribution\Documents\CitySolingenDocument;
|
use App\Contribution\Documents\CitySolingenDocument;
|
||||||
use App\Country;
|
use App\Country;
|
||||||
use App\Gender;
|
use App\Gender;
|
||||||
use App\Invoice\InvoiceSettings;
|
|
||||||
use App\Member\Member;
|
use App\Member\Member;
|
||||||
use Generator;
|
use Generator;
|
||||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
use Laravel\Passport\Client;
|
use Laravel\Passport\Client;
|
||||||
use Laravel\Passport\Passport;
|
use Laravel\Passport\Passport;
|
||||||
|
use Modules\Invoice\InvoiceSettings;
|
||||||
use PHPUnit\Framework\Attributes\DataProvider;
|
use PHPUnit\Framework\Attributes\DataProvider;
|
||||||
use Tests\RequestFactories\ContributionMemberApiRequestFactory;
|
use Tests\RequestFactories\ContributionMemberApiRequestFactory;
|
||||||
use Tests\RequestFactories\ContributionRequestFactory;
|
use Tests\RequestFactories\ContributionRequestFactory;
|
||||||
|
|
|
@ -6,7 +6,6 @@ use App\Invoice\Actions\InvoiceSendAction;
|
||||||
use App\Invoice\BillDocument;
|
use App\Invoice\BillDocument;
|
||||||
use App\Invoice\BillKind;
|
use App\Invoice\BillKind;
|
||||||
use App\Invoice\Enums\InvoiceStatus;
|
use App\Invoice\Enums\InvoiceStatus;
|
||||||
use App\Invoice\InvoiceSettings;
|
|
||||||
use App\Invoice\Mails\BillMail;
|
use App\Invoice\Mails\BillMail;
|
||||||
use App\Invoice\Mails\RememberMail;
|
use App\Invoice\Mails\RememberMail;
|
||||||
use App\Invoice\Models\Invoice;
|
use App\Invoice\Models\Invoice;
|
||||||
|
@ -15,6 +14,7 @@ use App\Invoice\RememberDocument;
|
||||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Modules\Invoice\InvoiceSettings;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
use Zoomyboy\Tex\Tex;
|
use Zoomyboy\Tex\Tex;
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
namespace Tests\Feature\Invoice;
|
namespace Tests\Feature\Invoice;
|
||||||
|
|
||||||
use App\Invoice\InvoiceSettings;
|
|
||||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
|
use Modules\Invoice\InvoiceSettings;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class SettingTest extends TestCase
|
class SettingTest extends TestCase
|
||||||
|
|
|
@ -4,10 +4,10 @@ namespace Tests\Feature\Invoice;
|
||||||
|
|
||||||
use App\Invoice\BillDocument;
|
use App\Invoice\BillDocument;
|
||||||
use App\Invoice\BillKind;
|
use App\Invoice\BillKind;
|
||||||
use App\Invoice\InvoiceSettings;
|
|
||||||
use App\Invoice\Models\Invoice;
|
use App\Invoice\Models\Invoice;
|
||||||
use App\Invoice\Models\InvoicePosition;
|
use App\Invoice\Models\InvoicePosition;
|
||||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
|
use Modules\Invoice\InvoiceSettings;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
use Zoomyboy\Tex\Tex;
|
use Zoomyboy\Tex\Tex;
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
namespace Tests\Feature\Invoice;
|
namespace Tests\Feature\Invoice;
|
||||||
|
|
||||||
use App\Invoice\BillKind;
|
use App\Invoice\BillKind;
|
||||||
use App\Invoice\InvoiceSettings;
|
|
||||||
use App\Invoice\Models\Invoice;
|
use App\Invoice\Models\Invoice;
|
||||||
use App\Invoice\Models\InvoicePosition;
|
use App\Invoice\Models\InvoicePosition;
|
||||||
use App\Invoice\RememberDocument;
|
use App\Invoice\RememberDocument;
|
||||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
|
use Modules\Invoice\InvoiceSettings;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
use Zoomyboy\Tex\Tex;
|
use Zoomyboy\Tex\Tex;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ use App\Form\Enums\NamiType;
|
||||||
use App\Form\Enums\SpecialType;
|
use App\Form\Enums\SpecialType;
|
||||||
use App\Form\Models\Form;
|
use App\Form\Models\Form;
|
||||||
use App\Form\Models\Participant;
|
use App\Form\Models\Participant;
|
||||||
use App\Invoice\InvoiceSettings;
|
|
||||||
use App\Lib\Editor\Condition;
|
use App\Lib\Editor\Condition;
|
||||||
use App\Prevention\Mails\PreventionRememberMail;
|
use App\Prevention\Mails\PreventionRememberMail;
|
||||||
use App\Member\Member;
|
use App\Member\Member;
|
||||||
|
@ -17,6 +16,7 @@ use App\Prevention\PreventionSettings;
|
||||||
use Generator;
|
use Generator;
|
||||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use Modules\Invoice\InvoiceSettings;
|
||||||
use PHPUnit\Framework\Attributes\DataProvider;
|
use PHPUnit\Framework\Attributes\DataProvider;
|
||||||
use Tests\Lib\CreatesFormFields;
|
use Tests\Lib\CreatesFormFields;
|
||||||
use Tests\RequestFactories\EditorRequestFactory;
|
use Tests\RequestFactories\EditorRequestFactory;
|
||||||
|
|
|
@ -19,6 +19,7 @@ class InvoiceSettingsFake extends RequestFactory
|
||||||
'zip' => '12345',
|
'zip' => '12345',
|
||||||
'iban' => 'DE444',
|
'iban' => 'DE444',
|
||||||
'bic' => 'SOLSSSSS',
|
'bic' => 'SOLSSSSS',
|
||||||
|
'rememberWeeks' => 6
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue