Build everything to deal with tax rates.
This commit is contained in:
86
resources/views/taxrate/create.blade.php
Normal file
86
resources/views/taxrate/create.blade.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
|
||||
{{ __('configuration.Create new taxrate') }}
|
||||
</h2>
|
||||
</x-slot>
|
||||
|
||||
<div class="py-12" x-data="taxForm()">
|
||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8 space-y-6">
|
||||
<!-- Customer data -->
|
||||
<div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
|
||||
<div class="max-w-xl">
|
||||
<section>
|
||||
<header>
|
||||
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
||||
{{ __('configuration.New taxrate') }}
|
||||
</h2>
|
||||
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
|
||||
{{ __("configuration.Enter your taxrate's information.") }}
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<form class="mt-6 space-y-6" @submit.prevent="">
|
||||
<p class="text-red-600 font-bold" x-text="message" x-show="error"></p>
|
||||
|
||||
<div>
|
||||
<x-input-label for="name" :value="__('common.Name')"/>
|
||||
<x-text-input id="name" name="name" type="text" class="mt-1 block w-full"
|
||||
:value="old('name')" required autofocus autocomplete="name"
|
||||
x-model="taxrate.name"/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<x-input-label for="email" :value="__('configuration.Taxrate')"/>
|
||||
<x-text-input id="email" name="email" type="number" class="mt-1 block w-full"
|
||||
:value="old('email')" required min="0" max="100" step=".01"
|
||||
x-model="taxrate.rate"/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<x-input-label for="active" :value="__('common.Is active')"/>
|
||||
<x-text-input id="active" name="active" type="checkbox" class="mt-1"
|
||||
:value="old('active')" autofocus
|
||||
x-model="taxrate.active"/>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-4">
|
||||
<x-primary-button @click="submit">{{ __('form.Save') }}</x-primary-button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</x-app-layout>
|
||||
|
||||
<script>
|
||||
function taxForm() {
|
||||
return {
|
||||
taxrate: {
|
||||
name: '',
|
||||
rate: 0,
|
||||
is_active: false,
|
||||
},
|
||||
|
||||
error: false,
|
||||
message: '',
|
||||
|
||||
submit() {
|
||||
let vm = this;
|
||||
|
||||
axios.post('/taxrate', this.taxrate)
|
||||
.then(function (response) {
|
||||
window.location.href = '/taxrate';
|
||||
})
|
||||
.catch(function(error) {
|
||||
vm.error = true;
|
||||
vm.message = error.response.data.message;
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user