Build everything to deal with tax rates.
This commit is contained in:
140
resources/views/taxrate/edit.blade.php
Normal file
140
resources/views/taxrate/edit.blade.php
Normal file
@@ -0,0 +1,140 @@
|
||||
<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">
|
||||
<!-- Tax 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.Edit 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="rate" :value="__('configuration.Taxrate')"/>
|
||||
<x-text-input id="rate" name="rate" type="number" class="mt-1 block w-full"
|
||||
:value="old('rate')" 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 class="max-w-7xl mx-auto sm:px-6 lg:px-8 space-y-6 mt-8">
|
||||
<!-- Delete tax -->
|
||||
<div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
|
||||
<section class="space-y-6">
|
||||
<header>
|
||||
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
||||
{{ __('configuration.Delete Taxrate') }}
|
||||
</h2>
|
||||
|
||||
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
|
||||
{{ __('configuration.Once the taxrate is deleted, all of its resources and data will be permanently deleted.') }}
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<x-danger-button
|
||||
x-data=""
|
||||
x-on:click.prevent="$dispatch('open-modal', 'confirm-taxrate-deletion')"
|
||||
>{{ __('configuration.Delete Taxrate') }}</x-danger-button>
|
||||
|
||||
<x-modal name="confirm-taxrate-deletion" :show="$errors->userDeletion->isNotEmpty()" focusable>
|
||||
<form class="p-6" @submit.prevent="">
|
||||
|
||||
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
||||
{{ __('configuration.Are you sure you want to delete this taxrate?') }}
|
||||
</h2>
|
||||
|
||||
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
|
||||
{{ __('configuration.Once the taxrate is deleted, all of its resources and data will be permanently deleted.') }}
|
||||
</p>
|
||||
|
||||
<div class="mt-6 flex justify-end">
|
||||
<x-secondary-button x-on:click="$dispatch('close')">
|
||||
{{ __('form.Cancel') }}
|
||||
</x-secondary-button>
|
||||
|
||||
<x-danger-button class="ms-3" x-on:click="deleteTax();$dispatch('close');">
|
||||
{{ __('configuration.Delete taxrate') }}
|
||||
</x-danger-button>
|
||||
</div>
|
||||
</form>
|
||||
</x-modal>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</x-app-layout>
|
||||
|
||||
<script>
|
||||
function taxForm() {
|
||||
return {
|
||||
taxrate: {!! $taxrate !!},
|
||||
|
||||
error: false,
|
||||
message: '',
|
||||
|
||||
submit() {
|
||||
let vm;
|
||||
axios.put('/taxrate/' + this.taxrate.id, this.taxrate)
|
||||
.then(function (response) {
|
||||
window.location.href = '/taxrate';
|
||||
})
|
||||
.catch(function (error) {
|
||||
vm.error = true;
|
||||
vm.message = error.response.data.message;
|
||||
})
|
||||
},
|
||||
|
||||
deleteTax() {
|
||||
let vm;
|
||||
axios.delete('/taxrate/' + this.taxrate.id)
|
||||
.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