Files
project/resources/views/excel.blade.php
2025-01-17 13:43:19 +01:00

65 lines
2.9 KiB
PHP

<x-app-layout>
<x-slot name="header">
<h2 class="grow font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
{{ __('excel.Excel export') }}
</h2>
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8 space-y-6">
<div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
<div class="max-w" x-data="excelForm">
<section>
<header>
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
{{ __('excel.Choose data') }}
</h2>
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
{{ __("excel.Choose data hint") }}
</p>
<div class="flex flex-row space-x-4 items-center mt-8">
<x-input-label for="from" :value="__('invoice.From')"/>
<x-text-input type="date" id="from" name="from" x-model="data.from"/>
<x-input-label for="end" :value="__('invoice.End')"/>
<x-text-input type="date" id="end" name="end" x-model="data.end"/>
<x-input-label for="report" :value="__('excel.Report')"/>
<select name="report" id="report" x-model="data.report" class="border-gray-300 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 focus:border-indigo-500 dark:focus:border-indigo-600 focus:ring-indigo-500 dark:focus:ring-indigo-600 rounded-md shadow-sm w-1/4">
<option value="invoice">{{ __('excel.Outgoing invoices') }}</option>
<option value="payment">{{ __('excel.Incoming payments') }}</option>
</select>
</div>
</header>
<x-primary-button @click="submit" class="mt-8" x-show="data.report !== ''">{{ __('excel.Generate') }}</x-primary-button>
</section>
</div>
</div>
</div>
</div>
</x-app-layout>
<script>
function excelForm() {
return {
data: {
from: "{{ \Illuminate\Support\Facades\Date::now()->firstOfMonth()->format('Y-m-d') }}",
end: "{{ \Illuminate\Support\Facades\Date::now()->format('Y-m-d') }}",
report: 'invoice',
},
submit() {
axios.post('/excel', this.data)
.then(function(response) {
console.log(response.data);
}).catch(function(error) {
console.log(error);
})
}
}
}
</script>