Introduce option model for storing necessary configuration data.
This commit is contained in:
@@ -27,6 +27,10 @@
|
||||
:active="\Illuminate\Support\Str::startsWith(request()->route()->getName(), 'taxrate.')">
|
||||
{{ __('configuration.Taxrates') }}
|
||||
</x-nav-link>
|
||||
<x-nav-link :href="route('option.index')"
|
||||
:active="\Illuminate\Support\Str::startsWith(request()->route()->getName(), 'option.')">
|
||||
{{ __('configuration.Options') }}
|
||||
</x-nav-link>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
283
resources/views/option/index.blade.php
Normal file
283
resources/views/option/index.blade.php
Normal file
@@ -0,0 +1,283 @@
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
|
||||
{{ __('configuration.Options') }}
|
||||
</h2>
|
||||
</x-slot>
|
||||
|
||||
<div class="py-12" x-data="optionForm">
|
||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8 space-y-6">
|
||||
|
||||
<!-- Company details -->
|
||||
<div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
|
||||
<div class="max-w">
|
||||
<section>
|
||||
<details>
|
||||
<summary class="text-lg font-medium text-gray-900 dark:text-gray-100 cursor-pointer">
|
||||
{{ __('configuration.Company details') }}
|
||||
</summary>
|
||||
<form class="mt-6 space-y-2" @submit.prevent="">
|
||||
<p class="text-red-600 font-bold" x-text="message" x-show="error"></p>
|
||||
<div class="flex flex-row items-start">
|
||||
<x-input-label class="w-1/4" for="company_logo"
|
||||
:value="__('configuration.Company logo')"/>
|
||||
<x-text-input id="company_logo" name="company_logo" type="file"
|
||||
class="mt-1 block w-full"
|
||||
x-show="options.company_logo == null"
|
||||
@change="updatePreview()"/>
|
||||
<div class="w-full flex flex-row" x-show="options.company_logo != null">
|
||||
<img class="w-1/4" :src="options.company_logo"/>
|
||||
<div class="ml-12">
|
||||
<x-primary-button class=""
|
||||
@click="clearPreview()">{{ __('form.Change') }}</x-primary-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row items-center">
|
||||
<x-input-label class="w-1/4" for="company_name"
|
||||
:value="__('configuration.Company name')"/>
|
||||
<x-text-input id="company_name" name="company_name" type="text"
|
||||
class="mt-1 block w-full"
|
||||
:value="old('company_name')" required autofocus
|
||||
autocomplete="company_name"
|
||||
x-model="options.company_name"/>
|
||||
</div>
|
||||
<div class="flex flex-row items-center">
|
||||
<x-input-label class="w-1/4" for="company_additional"
|
||||
:value="__('configuration.Company additional')"/>
|
||||
<x-text-input id="company_additional" name="company_additional" type="text"
|
||||
class="mt-1 block w-full"
|
||||
:value="old('company_additional')" autofocus
|
||||
autocomplete="company_additional"
|
||||
x-model="options.company_additional"/>
|
||||
</div>
|
||||
<div class="flex flex-row items-center">
|
||||
<x-input-label class="w-1/4" for="representative"
|
||||
:value="__('configuration.Representative')"/>
|
||||
<x-text-input id="representative" name="representative" type="text"
|
||||
class="mt-1 block w-full"
|
||||
:value="old('representative')" required autofocus
|
||||
autocomplete="representative"
|
||||
x-model="options.representative"/>
|
||||
</div>
|
||||
<div class="flex flex-row items-center">
|
||||
<x-input-label class="w-1/4" for="address" :value="__('configuration.Address')"/>
|
||||
<x-text-input id="address" name="address" type="text" class="mt-1 block w-full"
|
||||
:value="old('address')" required autofocus autocomplete="address"
|
||||
x-model="options.address"/>
|
||||
</div>
|
||||
<div class="flex flex-row items-center">
|
||||
<x-input-label class="w-1/4" for="zip" :value="__('configuration.Zip')"/>
|
||||
<x-text-input id="zip" name="zip" type="text" class="mt-1 block w-full"
|
||||
:value="old('zip')" required autofocus autocomplete="zip"
|
||||
x-model="options.zip"/>
|
||||
</div>
|
||||
<div class="flex flex-row items-center">
|
||||
<x-input-label class="w-1/4" for="city" :value="__('configuration.City')"/>
|
||||
<x-text-input id="city" name="city" type="text" class="mt-1 block w-full"
|
||||
:value="old('city')" required autofocus autocomplete="city"
|
||||
x-model="options.city"/>
|
||||
</div>
|
||||
<div class="flex flex-row items-center">
|
||||
<x-input-label class="w-1/4" for="phone" :value="__('configuration.Phone')"/>
|
||||
<x-text-input id="phone" name="phone" type="text" class="mt-1 block w-full"
|
||||
:value="old('phone')" autofocus autocomplete="phone"
|
||||
x-model="options.phone"/>
|
||||
</div>
|
||||
<div class="flex flex-row items-center">
|
||||
<x-input-label class="w-1/4" for="email" :value="__('configuration.Email')"/>
|
||||
<x-text-input id="email" name="email" type="email" class="mt-1 block w-full"
|
||||
:value="old('email')" required autofocus autocomplete="email"
|
||||
x-model="options.email"/>
|
||||
</div>
|
||||
<div class="flex flex-row items-center">
|
||||
<x-input-label class="w-1/4" for="website" :value="__('configuration.Website')"/>
|
||||
<x-text-input id="website" name="website" type="url" class="mt-1 block w-full"
|
||||
:value="old('website')" autofocus autocomplete="website"
|
||||
x-model="options.website"/>
|
||||
</div>
|
||||
<div class="flex flex-row items-center">
|
||||
<x-input-label class="w-1/4" for="tax_number"
|
||||
:value="__('configuration.Tax number')"/>
|
||||
<x-text-input id="tax_number" name="tax_number" type="text"
|
||||
class="mt-1 block w-full"
|
||||
:value="old('tax_number')" required autofocus
|
||||
autocomplete="tax_number"
|
||||
x-model="options.tax_number"/>
|
||||
</div>
|
||||
<div class="flex flex-row items-center">
|
||||
<x-input-label class="w-1/4" for="jurisdiction"
|
||||
:value="__('configuration.Jurisdiction')"/>
|
||||
<x-text-input id="jurisdiction" name="jurisdiction" type="text"
|
||||
class="mt-1 block w-full"
|
||||
:value="old('jurisdiction')" required autofocus
|
||||
autocomplete="jurisdiction"
|
||||
x-model="options.jurisdiction"/>
|
||||
</div>
|
||||
</form>
|
||||
</details>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Bank details -->
|
||||
<div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
|
||||
<div class="max-w">
|
||||
<section>
|
||||
<details>
|
||||
<summary class="text-lg font-medium text-gray-900 dark:text-gray-100 cursor-pointer">
|
||||
{{ __('configuration.Bank details') }}
|
||||
</summary>
|
||||
<form class="mt-6 space-y-2" @submit.prevent="">
|
||||
<div class="flex flex-row items-center">
|
||||
<x-input-label class="w-1/4" for="institute_1"
|
||||
:value="__('configuration.Institute'). ' 1'"/>
|
||||
<x-text-input id="institute_1" name="institute_1" type="text"
|
||||
class="mt-1 block w-full"
|
||||
:value="old('institute_1')" required autofocus
|
||||
autocomplete="institute_1"
|
||||
x-model="options.institute_1"/>
|
||||
</div>
|
||||
<div class="flex flex-row items-center">
|
||||
<x-input-label class="w-1/4" for="bic_1"
|
||||
:value="__('configuration.BIC'). ' 1'"/>
|
||||
<x-text-input id="bic_1" name="bic_1" type="text"
|
||||
class="mt-1 block w-full"
|
||||
:value="old('bic_1')" required autofocus
|
||||
autocomplete="bic_1"
|
||||
x-model="options.bic_1"/>
|
||||
</div>
|
||||
<div class="flex flex-row items-center">
|
||||
<x-input-label class="w-1/4" for="iban_1"
|
||||
:value="__('configuration.IBAN'). ' 1'"/>
|
||||
<x-text-input id="iban_1" name="iban_1" type="text"
|
||||
class="mt-1 block w-full"
|
||||
:value="old('iban_1')" required autofocus
|
||||
autocomplete="iban_1"
|
||||
x-model="options.iban_1"/>
|
||||
</div>
|
||||
<div class="flex flex-row items-center">
|
||||
<x-input-label class="w-1/4" for="institute_2"
|
||||
:value="__('configuration.Institute'). ' 2'"/>
|
||||
<x-text-input id="institute_2" name="institute_2" type="text"
|
||||
class="mt-1 block w-full"
|
||||
:value="old('institute_2')" required autofocus
|
||||
autocomplete="institute_2"
|
||||
x-model="options.institute_2"/>
|
||||
</div>
|
||||
<div class="flex flex-row items-center">
|
||||
<x-input-label class="w-1/4" for="bic_2"
|
||||
:value="__('configuration.BIC'). ' 2'"/>
|
||||
<x-text-input id="bic_2" name="bic_2" type="text"
|
||||
class="mt-1 block w-full"
|
||||
:value="old('bic_2')" required autofocus
|
||||
autocomplete="bic_2"
|
||||
x-model="options.bic_2"/>
|
||||
</div>
|
||||
<div class="flex flex-row items-center">
|
||||
<x-input-label class="w-1/4" for="iban_2"
|
||||
:value="__('configuration.IBAN'). ' 2'"/>
|
||||
<x-text-input id="iban_2" name="iban_2" type="text"
|
||||
class="mt-1 block w-full"
|
||||
:value="old('iban_2')" required autofocus
|
||||
autocomplete="iban_2"
|
||||
x-model="options.iban_2"/>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</details>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- correspondence -->
|
||||
<div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
|
||||
<div class="max-w">
|
||||
<section>
|
||||
<details>
|
||||
<summary class="text-lg font-medium text-gray-900 dark:text-gray-100 cursor-pointer">
|
||||
{{ __('configuration.Correspondence') }}
|
||||
</summary>
|
||||
<form class="mt-6 space-y-2" @submit.prevent="">
|
||||
<div class="flex flex-row items-center">
|
||||
<x-input-label class="w-1/4" for="color_1"
|
||||
:value="__('configuration.Color'). ' 1'"/>
|
||||
<x-text-input id="color_1" name="color_1" type="color"
|
||||
class="mt-1 block"
|
||||
:value="old('color_1')" required autofocus
|
||||
autocomplete="color_1"
|
||||
x-model="options.color_1"/>
|
||||
</div>
|
||||
<div class="flex flex-row items-center">
|
||||
<x-input-label class="w-1/4" for="color_2"
|
||||
:value="__('configuration.Color'). ' 2'"/>
|
||||
<x-text-input id="color_2" name="color_2" type="color"
|
||||
class="mt-1 block"
|
||||
:value="old('color_2')" required autofocus
|
||||
autocomplete="color_2"
|
||||
x-model="options.color_2"/>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</details>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-4">
|
||||
<x-primary-button @click="submit">{{ __('form.Save') }}</x-primary-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</x-app-layout>
|
||||
|
||||
<script>
|
||||
function optionForm() {
|
||||
return {
|
||||
options: {},
|
||||
error: false,
|
||||
message: '',
|
||||
|
||||
init() {
|
||||
let vm = this;
|
||||
axios.get('/option')
|
||||
.then(function (response) {
|
||||
response.data.forEach((value) => {
|
||||
vm.options[value.name] = value.value;
|
||||
});
|
||||
})
|
||||
},
|
||||
|
||||
updatePreview() {
|
||||
let reader, files = document.getElementById('company_logo').files;
|
||||
reader = new FileReader();
|
||||
reader.onload = e => {
|
||||
this.options.company_logo = e.target.result;
|
||||
console.log(e.target.result);
|
||||
|
||||
};
|
||||
reader.readAsDataURL(files[0]);
|
||||
},
|
||||
|
||||
clearPreview() {
|
||||
this.options.company_logo = null;
|
||||
},
|
||||
|
||||
submit() {
|
||||
let vm = this;
|
||||
console.log(vm.options);
|
||||
axios.post('/option', vm.options)
|
||||
.then(function (response) {
|
||||
console.log(response.data);
|
||||
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user