diff --git a/app/Http/Controllers/Api/OptionController.php b/app/Http/Controllers/Api/OptionController.php new file mode 100644 index 0000000..fc4e403 --- /dev/null +++ b/app/Http/Controllers/Api/OptionController.php @@ -0,0 +1,33 @@ +json(Option::all(['name', 'value'])); + } + + /** + * Store a newly created resource in storage. + */ + public function store(Request $request): JsonResponse + { + foreach ($request->all() as $key => $value) { + $option = Option::firstOrNew(['name' => $key]); + + $option->value = $value; + $option->save(); + } + return response()->json($request->all()); + } +} diff --git a/app/Http/Controllers/OptionController.php b/app/Http/Controllers/OptionController.php new file mode 100644 index 0000000..25220ef --- /dev/null +++ b/app/Http/Controllers/OptionController.php @@ -0,0 +1,16 @@ + + */ + protected $fillable = [ + 'name', + 'value', + ]; + +} diff --git a/database/migrations/2025_01_04_132935_create_options_table.php b/database/migrations/2025_01_04_132935_create_options_table.php new file mode 100644 index 0000000..14692d5 --- /dev/null +++ b/database/migrations/2025_01_04_132935_create_options_table.php @@ -0,0 +1,29 @@ +id(); + $table->string('name')->unique(); + $table->longText('value')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('options'); + } +}; diff --git a/lang/de/configuration.php b/lang/de/configuration.php index 3609e6c..256fa13 100644 --- a/lang/de/configuration.php +++ b/lang/de/configuration.php @@ -4,10 +4,10 @@ return [ /* |------------------------------------------------- ------------------------- - | Übersetzungen der Einstellungen + | Übersetzungen Konfigurationen |------------------------------------------------- ------------------------- | - | Die folgenden Sprachzeilen werden für die Einstellungen verwendet. + | Die folgenden Sprachzeilen werden für allgemeine Einstellungen verwendet. | */ @@ -23,5 +23,25 @@ return [ 'Are you sure you want to delete this taxrate?' => 'Sicher, dass der Steuersatz gelöscht werden soll?', 'Once the taxrate is deleted, all of its resources and data will be permanently deleted.' => 'Sobald der Steuersatz gelöscht wird, werden alle Ressourcen und Daten dauerhaft gelöscht.', 'Enter your taxrate\'s information.' => 'Gib die Informationen des Steuersatzes ein.', + 'Options' => 'Einstellungen', + 'Company details' => 'Firmendaten', + 'Company name' => 'Firmenname', + 'Company additional' => 'Firmenzusatz', + 'Representative' => 'gesetzlicher Vertreter', + 'Address' => 'Adresse', + 'Zip' => 'Postleitzahl', + 'City' => 'Stadt', + 'Phone' => 'Telefon', + 'Email' => 'E-Mail', + 'Website' => 'Webseite', + 'Tax number' => 'Steuernummer', + 'Jurisdiction' => 'Gerichtsstand', + 'Bank details' => 'Bankverbindung', + 'Institute' => 'Institut', + 'BIC' => 'BIC', + 'IBAN' => 'IBAN', + 'Correspondence' => 'Schriftverkehr', + 'Color' => 'Farbe', + 'Company logo' => 'Firmenlogo', ]; diff --git a/lang/de/form.php b/lang/de/form.php index fdf8f67..dbb1736 100644 --- a/lang/de/form.php +++ b/lang/de/form.php @@ -15,6 +15,7 @@ return [ 'Edit' => 'Bearbeiten', 'Delete' => 'Löschen', 'Save' => 'Speichern', + 'Change' => 'Ändern', 'SaveAndContinue' => 'Speichern und Weiter', 'Saved' => 'Gespeichert', 'Cancel' => 'Abbrechen', diff --git a/resources/views/layouts/navigation.blade.php b/resources/views/layouts/navigation.blade.php index d6cee55..73b5754 100644 --- a/resources/views/layouts/navigation.blade.php +++ b/resources/views/layouts/navigation.blade.php @@ -27,6 +27,10 @@ :active="\Illuminate\Support\Str::startsWith(request()->route()->getName(), 'taxrate.')"> {{ __('configuration.Taxrates') }} + + {{ __('configuration.Options') }} + diff --git a/resources/views/option/index.blade.php b/resources/views/option/index.blade.php new file mode 100644 index 0000000..a3398e4 --- /dev/null +++ b/resources/views/option/index.blade.php @@ -0,0 +1,283 @@ + + + + {{ __('configuration.Options') }} + + + + + + + + + + + + + {{ __('configuration.Company details') }} + + + + + + + + + + {{ __('form.Change') }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ __('configuration.Bank details') }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ __('configuration.Correspondence') }} + + + + + + + + + + + + + + + + + + + {{ __('form.Save') }} + + + + + + + diff --git a/routes/api.php b/routes/api.php index 6c52e18..63ab152 100644 --- a/routes/api.php +++ b/routes/api.php @@ -5,6 +5,7 @@ use App\Http\Controllers\Api\AuthController; use App\Http\Controllers\Api\CustomerController; use App\Http\Controllers\Api\InvoiceController; use App\Http\Controllers\Api\InvoiceitemController; +use App\Http\Controllers\Api\OptionController; use App\Http\Controllers\Api\TaxrateController; use Illuminate\Http\Request; use Illuminate\Support\Facades\Route; @@ -26,6 +27,8 @@ Route::group(['as' => 'api.'], function () { Route::apiResource('/taxrate', TaxRateController::class)->except(['show']); Route::get('/invoice/{start?}/{end?}', [InvoiceController::class, 'index'])->name('invoice.index'); Route::apiResource('/invoice.item', InvoiceItemController::class)->shallow(); + Route::get('/option', [OptionController::class, 'index'])->name('option.index'); + Route::post('/option', [OptionController::class, 'store'])->name('option.store'); }); }); diff --git a/routes/web.php b/routes/web.php index dcacbca..047e84c 100644 --- a/routes/web.php +++ b/routes/web.php @@ -2,6 +2,7 @@ use App\Http\Controllers\CustomerController; use App\Http\Controllers\InvoiceController; +use App\Http\Controllers\OptionController; use App\Http\Controllers\ProfileController; use App\Http\Controllers\TaxrateController; use Illuminate\Support\Facades\Route; @@ -22,6 +23,7 @@ Route::middleware('auth')->group(function () { Route::resource('/customer', CustomerController::class)->only(['index', 'create', 'edit']); Route::resource('/taxrate', TaxrateController::class)->only(['index', 'create', 'edit']); Route::resource('/invoice', InvoiceController::class)->only(['index', 'create', 'show', 'edit']); + Route::get('/option', [OptionController::class, 'index'])->name('option.index'); }); require __DIR__.'/auth.php';