This commit is contained in:
hackerESQ
2024-08-29 23:36:44 -05:00
parent 2febed20ae
commit df1071d628
13 changed files with 204 additions and 64 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
@livewire('import-portfolios-field')
@livewire('import-portfolios-field')
<x-section-border />
</div>
@@ -4,6 +4,7 @@ use Livewire\WithFileUploads;
use Livewire\Volt\Component;
use Mary\Traits\Toast;
use App\Imports\BackupImport;
use App\Exports\BackupExport;
use Livewire\Attributes\Rule;
new class extends Component {
@@ -17,7 +18,6 @@ new class extends Component {
// methods
public function import()
{
$this->validate();
try {
@@ -25,13 +25,16 @@ new class extends Component {
$import = (new BackupImport)->import($this->file);
} catch (\Throwable $e) {
dd($e);
return $this->error($e->getMessage());
}
$this->success(__('Successfully imported!'));
}
// Artisan::queue(RefreshHoldingData::class);
public function downloadTemplate()
{
return Excel::download(new BackupExport(empty: true), now()->format('Y_m_d') . '_investbrain_template.xlsx');
}
}; ?>
@@ -42,7 +45,8 @@ new class extends Component {
</x-slot>
<x-slot name="description">
{{ __('Upload or recover your Investbrain portfolio and holdings.') }}
{{ __('Upload or recover your Investbrain portfolio and holdings.') }}
<a href="#" title="{{ __('Click to download import template.') }}" @click="$wire.downloadTemplate()"> {{ __('Download import template.') }}</a>
</x-slot>
<x-slot name="form">