From f62583a007e182811b102b9c3574683bf7d04a3a Mon Sep 17 00:00:00 2001 From: WBLKLeipe Date: Wed, 1 Dec 2021 13:30:40 +0100 Subject: [PATCH] clean UI --- .../Controllers/Admin/SettingsController.php | 38 +++--- app/Models/InvoiceSettings.php | 1 + .../views/admin/settings/index.blade.php | 113 +++++++----------- 3 files changed, 60 insertions(+), 92 deletions(-) diff --git a/app/Http/Controllers/Admin/SettingsController.php b/app/Http/Controllers/Admin/SettingsController.php index 625a1051..a38dec4f 100644 --- a/app/Http/Controllers/Admin/SettingsController.php +++ b/app/Http/Controllers/Admin/SettingsController.php @@ -3,12 +3,12 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; +use App\Models\invoiceSettings; use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\View; use Illuminate\Http\Request; use Illuminate\Http\Response; -use App\Models\invoiceSettings; class SettingsController extends Controller { @@ -19,7 +19,15 @@ class SettingsController extends Controller */ public function index() { - return view('admin.settings.index'); + return view('admin.settings.index', + [ + 'company_name' => invoiceSettings::get()->first()->company_name, + 'company_adress' => invoiceSettings::get()->first()->company_adress, + 'company_phone' => invoiceSettings::get()->first()->company_phone, + 'company_vat' => invoiceSettings::get()->first()->company_vat, + 'company_mail' => invoiceSettings::get()->first()->company_mail, + 'company_web' => invoiceSettings::get()->first()->company_web + ]); } public function updateIcons(Request $request) @@ -46,32 +54,18 @@ class SettingsController extends Controller 'logo' => 'nullable|max:10000|mimes:jpg,png,jpeg', ]); + invoiceSettings::updateOrCreate(['id' => "1"], ['company_name' => $request->get('company-name')]); + invoiceSettings::updateOrCreate(['id' => "1",], ['company_adress' => $request->get('company-adress')]); + invoiceSettings::updateOrCreate(['id' => "1",], ['company_phone' => $request->get('company-phone')]); + invoiceSettings::updateOrCreate(['id' => "1",], ['company_mail' => $request->get('company-email')]); + invoiceSettings::updateOrCreate(['id' => "1",], ['company_vat' => $request->get('company-vat')]); + invoiceSettings::updateOrCreate(['id' => "1",], ['company_web' => $request->get('company-web')]); - - if($request->filled('company-name')) { - invoiceSettings::updateOrCreate(['id' => "1"],['company_name' => $request->get('company-name')]); - } - if($request->filled('company-adress')) { - invoiceSettings::updateOrCreate(['id' => "1",],['company_adress' => $request->get('company-adress')]); - } - if($request->filled('company-phone')) { - invoiceSettings::updateOrCreate(['id' => "1",],['company_phone' => $request->get('company-phone')]); - } - if($request->filled('company-vat')) { - invoiceSettings::updateOrCreate(['id' => "1",],['company_vat' => $request->get('company-vat')]); - } - if($request->filled('company-mail')) { - invoiceSettings::updateOrCreate(['id' => "1",],['company_mail' => $request->get('company-mail')]); - } - if($request->filled('company-web')) { - invoiceSettings::updateOrCreate(['id' => "1",],['company_web' => $request->get('company-web')]); - } if ($request->hasFile('logo')) { $request->file('logo')->storeAs('public', 'logo.png'); } - return redirect()->route('admin.settings.index')->with('success', 'Invoice settings updated!'); } diff --git a/app/Models/InvoiceSettings.php b/app/Models/InvoiceSettings.php index c866c0d7..5bcaf3dc 100644 --- a/app/Models/InvoiceSettings.php +++ b/app/Models/InvoiceSettings.php @@ -15,6 +15,7 @@ class invoiceSettings extends Model 'company_name', 'company_adress', 'company_phone', + 'company_mail', 'company_vat', 'company_web' ]; diff --git a/resources/views/admin/settings/index.blade.php b/resources/views/admin/settings/index.blade.php index ce2bbc59..c2414bb3 100644 --- a/resources/views/admin/settings/index.blade.php +++ b/resources/views/admin/settings/index.blade.php @@ -92,7 +92,7 @@ -
+
@csrf @@ -102,89 +102,63 @@
-
- - +
+ +
- @error('company-name') - - {{$message}} - - @enderror
-
- - +
+ +
- @error('company-adress') - - {{$message}} - - @enderror
-
- - +
+ +
- @error('company-phone') - - {{$message}} - - @enderror
-
- - +
+ +
- @error('company-vat') - - {{$message}} - - @enderror
-
- - +
+ +
- @error('company-mail') - - {{$message}} - - @enderror
-
- - +
+ +
- @error('company-web') - - {{$message}} - - @enderror
@@ -204,21 +178,20 @@
- - -
-
- - - - +
+ + + +
+
+ @@ -228,7 +201,7 @@