feat: Moved InvoiceSettings Tab content to "tabs" directory -> modular approach

This commit is contained in:
IceToast 2022-01-02 19:38:13 +01:00
parent 41b0f03219
commit ef732d5426
2 changed files with 130 additions and 127 deletions

View file

@ -6,13 +6,13 @@
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>{{__('Settings')}}</h1>
<h1>{{ __('Settings') }}</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{route('home')}}">{{__('Dashboard')}}</a></li>
<li class="breadcrumb-item"><a href="{{ route('home') }}">{{ __('Dashboard') }}</a></li>
<li class="breadcrumb-item"><a class="text-muted"
href="{{route('admin.settings.index')}}">{{__('Settings')}}</a></li>
href="{{ route('admin.settings.index') }}">{{ __('Settings') }}</a></li>
</ol>
</div>
</div>
@ -28,7 +28,7 @@
<div class="card-header">
<div class="d-flex justify-content-between">
<h5 class="card-title"><i class="fas fa-tools mr-2"></i>{{__('Settings')}}</h5>
<h5 class="card-title"><i class="fas fa-tools mr-2"></i>{{ __('Settings') }}</h5>
</div>
</div>
@ -37,10 +37,15 @@
<!-- Nav pills -->
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link active" data-toggle="pill" href="#dashboard-icons">{{__('Dashboard icons')}}</a>
<a class="nav-link active" data-toggle="pill"
href="#dashboard-icons">{{ __('Dashboard icons') }}</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#invoice-settings">{{__('Invoice Settings')}}</a>
<a class="nav-link" data-toggle="pill"
href="#invoice-settings">{{ __('Invoice Settings') }}</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#invoice">{{ __('Invoice Settings2') }}</a>
</li>
</ul>
@ -49,7 +54,7 @@
<div class="tab-pane mt-3 active" id="dashboard-icons">
<form method="POST" enctype="multipart/form-data" class="mb-3"
action="{{route('admin.settings.update.icons')}}">
action="{{ route('admin.settings.update.icons') }}">
@csrf
@method('PATCH')
@ -58,147 +63,44 @@
<div class="form-group">
<div class="custom-file mb-3 mt-3">
<input type="file" accept="image/png,image/jpeg,image/jpg"
class="custom-file-input" name="icon" id="icon">
class="custom-file-input" name="icon" id="icon">
<label class="custom-file-label selected"
for="icon">{{__('Select panel icon')}}</label>
for="icon">{{ __('Select panel icon') }}</label>
</div>
@error('icon')
<span class="text-danger">
{{$message}}
</span>
<span class="text-danger">
{{ $message }}
</span>
@enderror
</div>
<div class="form-group">
<div class="custom-file mb-3">
<input type="file" accept="image/x-icon" class="custom-file-input"
name="favicon" id="favicon">
name="favicon" id="favicon">
<label class="custom-file-label selected"
for="favicon">{{__('Select panel favicon')}}</label>
for="favicon">{{ __('Select panel favicon') }}</label>
</div>
@error('favicon')
<span class="text-danger">
{{$message}}
</span>
<span class="text-danger">
{{ $message }}
</span>
@enderror
</div>
</div>
</div>
<button class="btn btn-primary">{{__('Submit')}}</button>
<button class="btn btn-primary">{{ __('Submit') }}</button>
</form>
<p class="text-muted">Images and Icons may be cached, use <code>CNTRL + F5</code><sup>(google
<p class="text-muted">Images and Icons may be cached, use <code>CNTRL +
F5</code><sup>(google
chrome hotkey)</sup> to reload without cache to see your changes appear :)</p>
</div>
<div class="tab-pane mt-3" id="invoice-settings">
<div class="float-right">
<a href="{{route('admin.settings.downloadAllInvoices')}}"><button class="btn btn-success">{{__('Download all Invoices')}}</button></a>
</div>
<form method="POST" enctype="multipart/form-data" class="mb-3"
action="{{route('admin.settings.update.invoicesettings')}}">
@csrf
@method('PATCH')
<div class="row">
<div class="col-md-6 col-lg-4 col-12">
<!-- Name -->
<div class="form-group">
<div class="custom-control mb-3">
<label for="company-name">{{__('Enter your companys name' )}}</label>
<input x-model="company-name" id="company-name" name="company-name"
type="text" value="{{$company_name}}"
class="form-control @error('company-name') is-invalid @enderror">
</div>
</div>
<!-- address -->
<div class="form-group">
<div class="custom-control mb-3">
<label
for="company-address">{{__('Enter your companys address' )}}</label>
<input x-model="company-address" id="company-address"
name="company-address" type="text" value="{{$company_adress}}"
class="form-control @error('company-address') is-invalid @enderror">
</div>
</div>
<!-- Phone -->
<div class="form-group">
<div class="custom-control mb-3">
<label
for="company-phone">{{__('Enter your companys phone number' )}}</label>
<input x-model="company-phone" id="company-phone" name="company-phone"
type="text" value="{{$company_phone}}"
class="form-control @error('company-phone') is-invalid @enderror">
</div>
</div>
<!-- VAT -->
<div class="form-group">
<div class="custom-control mb-3">
<label for="company-vat">{{__('Enter your companys VAT id' )}}</label>
<input x-model="company-vat" id="company-vat" name="company-vat"
type="text" value="{{$company_vat}}"
class="form-control @error('company-vat') is-invalid @enderror">
</div>
</div>
<!-- email -->
<div class="form-group">
<div class="custom-control mb-3">
<label
for="company-mail">{{__('Enter your companys email address' )}}</label>
<input x-model="company-mail" id="company-mail" name="company-mail"
type="text" value="{{$company_mail}}"
class="form-control @error('company-mail') is-invalid @enderror">
</div>
</div>
<!-- website -->
<div class="form-group">
<div class="custom-control mb-3">
<label
for="company-web">{{__('Enter your companys website' )}}</label>
<input x-model="company-web" id="company-web" name="company-web"
type="text" value="{{$company_web}}"
class="form-control @error('company-web') is-invalid @enderror">
</div>
</div>
<!-- website -->
<div class="form-group">
<div class="custom-control mb-3">
<label
for="invoice-prefix">{{__('Enter your custom invoice prefix' )}}</label>
<input x-model="invoice-prefix" id="invoice-prefix" name="invoice-prefix"
type="text" value="{{$invoice_prefix}}"
class="form-control @error('invoice-prefix') is-invalid @enderror">
</div>
</div>
<!-- logo -->
<div class="form-group">
<div class="custom-control mb-3">
<label for="logo">{{__('Logo')}}</label>
<div class="custom-file mb-3">
<input type="file" accept="image/png,image/jpeg,image/jpg" class="custom-file-input"
name="logo" id="logo">
<label class="custom-file-label selected"
for="favicon">{{__('Select Invoice Logo')}}</label>
</div>
</div>
@error('logo')
<span class="text-danger">
{{$message}}
</span>
@enderror
</div>
</div>
</div>
<button class="btn btn-primary">{{__('Submit')}}</button>
<!-- end -->
</div>
@foreach ($tabs as $tab)
@include($tab)
@endforeach
</div>
@ -219,7 +121,7 @@
<script>
// Add the following code if you want the name of the file appear on select
document.addEventListener('DOMContentLoaded', () => {
$(".custom-file-input").on("change", function () {
$(".custom-file-input").on("change", function() {
var fileName = $(this).val().split("\\").pop();
$(this).siblings(".custom-file-label").addClass("selected").html(fileName);
});

View file

@ -0,0 +1,101 @@
<div class="tab-pane mt-3" id="invoice">
<div class="float-right">
<a href="{{ route('admin.settings.downloadAllInvoices') }}"><button
class="btn btn-success">{{ __('Download all Invoices') }}</button></a>
</div>
<form method="POST" enctype="multipart/form-data" class="mb-3"
action="{{ route('admin.settings.update.invoicesettings') }}">
@csrf
@method('PATCH')
<div class="row">
<div class="col-md-6 col-lg-4 col-12">
<!-- Name -->
<div class="form-group">
<div class="custom-control mb-3">
<label for="company-name">{{ __('Enter your companys name') }}</label>
<input x-model="company-name" id="company-name" name="company-name" type="text"
value="{{ $invoiceSettings->company_name }}"
class="form-control @error('company-name') is-invalid @enderror">
</div>
</div>
<!-- address -->
<div class="form-group">
<div class="custom-control mb-3">
<label for="company-address">{{ __('Enter your companys address') }}</label>
<input x-model="company-address" id="company-address" name="company-address" type="text"
value="{{ $Invoices->invoiceSettings->company_address }}"
class="form-control @error('company-address') is-invalid @enderror">
</div>
</div>
<!-- Phone -->
<div class="form-group">
<div class="custom-control mb-3">
<label for="company-phone">{{ __('Enter your companys phone number') }}</label>
<input x-model="company-phone" id="company-phone" name="company-phone" type="text"
value="{{ $Invoices->invoiceSettings->company_phone }}"
class="form-control @error('company-phone') is-invalid @enderror">
</div>
</div>
<!-- VAT -->
<div class="form-group">
<div class="custom-control mb-3">
<label for="company-vat">{{ __('Enter your companys VAT id') }}</label>
<input x-model="company-vat" id="company-vat" name="company-vat" type="text"
value="{{ $Invoices->invoiceSettings->company_vat }}"
class="form-control @error('company-vat') is-invalid @enderror">
</div>
</div>
<!-- email -->
<div class="form-group">
<div class="custom-control mb-3">
<label for="company-mail">{{ __('Enter your companys email address') }}</label>
<input x-model="company-mail" id="company-mail" name="company-mail" type="text"
value="{{ $Invoices->invoiceSettings->company_mail }}"
class="form-control @error('company-mail') is-invalid @enderror">
</div>
</div>
<!-- website -->
<div class="form-group">
<div class="custom-control mb-3">
<label for="company-web">{{ __('Enter your companys website') }}</label>
<input x-model="company-web" id="company-web" name="company-web" type="text"
value="{{ $Invoices->invoiceSettings->company_web }}"
class="form-control @error('company-web') is-invalid @enderror">
</div>
</div>
<!-- website -->
<div class="form-group">
<div class="custom-control mb-3">
<label for="invoice-prefix">{{ __('Enter your custom invoice prefix') }}</label>
<input x-model="invoice-prefix" id="invoice-prefix" name="invoice-prefix" type="text"
value="{{ $Invoices->invoiceSettings->invoice_prefix }}"
class="form-control @error('invoice-prefix') is-invalid @enderror">
</div>
</div>
<!-- logo -->
<div class="form-group">
<div class="custom-control mb-3">
<label for="logo">{{ __('Logo') }}</label>
<div class="custom-file mb-3">
<input type="file" accept="image/png,image/jpeg,image/jpg" class="custom-file-input"
name="logo" id="logo">
<label class="custom-file-label selected"
for="favicon">{{ __('Select Invoice Logo') }}</label>
</div>
</div>
@error('logo')
<span class="text-danger">
{{ $Invoices->invoiceSettings->message }}
</span>
@enderror
</div>
</div>
</div>
<button class="btn btn-primary">{{ __('Submit') }}</button>
<!-- end -->
</div>