|
1 | 1 | @extends(BaseHelper::getAdminMasterLayoutTemplate()) |
2 | 2 |
|
3 | 3 | @section('content') |
4 | | - @php |
5 | | - /** @var \Botble\DataSynchronize\Importer\Importer $importer */ |
6 | | -
|
7 | | - $acceptedFiles = Arr::join(array_map(fn ($item) => $item, $importer->getAcceptedFiles()), ','); |
8 | | - @endphp |
9 | | - |
10 | | - {!! apply_filters('data_synchronize_import_page_before', null, $importer) !!} |
11 | | - |
12 | | - <x-core::form |
13 | | - method="post" |
14 | | - :url="route('data-synchronize.upload')" |
15 | | - :data-validate-url="$importer->getValidateUrl()" |
16 | | - :data-import-url="$importer->getImportUrl()" |
17 | | - data-bb-toggle="import-form" |
18 | | - :data-accepted-files="$acceptedFiles" |
19 | | - :data-chunk-size="$importer->chunkSize()" |
20 | | - :data-uploading-message="trans('packages/data-synchronize::data-synchronize.import.uploading_message')" |
21 | | - :data-validate-failed-message="trans('packages/data-synchronize::data-synchronize.import.validating_failed_message')" |
22 | | - class="data-synchronize-import-form" |
23 | | - > |
24 | | - <x-core::card> |
25 | | - @if($importer->getHeading()) |
26 | | - <x-core::card.header> |
27 | | - <x-core::card.title> |
28 | | - {{ $importer->getHeading() }} |
29 | | - </x-core::card.title> |
30 | | - </x-core::card.header> |
31 | | - @endif |
32 | | - |
33 | | - <x-core::card.body> |
34 | | - @if($importer->getExportUrl()) |
35 | | - <x-core::alert |
36 | | - type="info" |
37 | | - :data-url="$importer->getExportUrl()" |
38 | | - > |
39 | | - {!! BaseHelper::clean(trans( |
40 | | - 'packages/data-synchronize::data-synchronize.import.form.quick_export_message', |
41 | | - [ |
42 | | - 'label' => $importer->getLabel(), |
43 | | - 'export_csv_link' => Html::tag('button', trans('packages/data-synchronize::data-synchronize.import.form.quick_export_button', ['format' => 'CSV']), [ |
44 | | - 'class' => 'data-synchronize-quick-export-button', |
45 | | - 'data-bb-toggle' => 'quick-export', |
46 | | - 'data-value' => 'csv', |
47 | | - ]), |
48 | | - 'export_excel_link' => Html::tag('button', trans('packages/data-synchronize::data-synchronize.import.form.quick_export_button', ['format' => 'Excel']), [ |
49 | | - 'class' => 'data-synchronize-quick-export-button', |
50 | | - 'data-bb-toggle' => 'quick-export', |
51 | | - 'data-value' => 'xlsx', |
52 | | - ]), |
53 | | - ] |
54 | | - )) !!} |
55 | | - </x-core::alert> |
56 | | - @endif |
57 | | - |
58 | | - {!! apply_filters('data_synchronize_import_form_before', null, $importer) !!} |
59 | | - |
60 | | - <div> |
61 | | - <div class="dropzone"> |
62 | | - <div class="dz-message"> |
63 | | - {{ trans('packages/data-synchronize::data-synchronize.import.form.dropzone_message') }} |
64 | | - </div> |
65 | | - </div> |
66 | | - |
67 | | - <x-core::form.helper-text class="mt-1"> |
68 | | - {{ trans('packages/data-synchronize::data-synchronize.import.form.allowed_extensions', ['extensions' => Arr::join($importer->getFileExtensions(), ', ')]) }} |
69 | | - </x-core::form.helper-text> |
70 | | - </div> |
71 | | - |
72 | | - {!! apply_filters('data_synchronize_import_form_after', null, $importer) !!} |
73 | | - |
74 | | - <pre class="mt-3 data-synchronize-import-output" style="display: none"></pre> |
75 | | - </x-core::card.body> |
76 | | - <x-core::card.footer> |
77 | | - <x-core::button type="submit" color="primary" :disabled="true"> |
78 | | - {{ trans('packages/data-synchronize::data-synchronize.import.form.import_button') }} |
79 | | - </x-core::button> |
80 | | - </x-core::card.footer> |
81 | | - </x-core::card> |
82 | | - |
83 | | - <x-core::alert class="mt-3" type="danger" style="display: none" data-bb-toggle="import-errors"> |
84 | | - <ul></ul> |
85 | | - </x-core::alert> |
86 | | - </x-core::form> |
87 | | - |
88 | | - {!! apply_filters('data_synchronize_import_page_after', null, $importer) !!} |
89 | | - |
90 | | - @if($importer->getExportUrl()) |
91 | | - <x-core::form |
92 | | - method="POST" |
93 | | - :url="$importer->getExportUrl()" |
94 | | - data-bb-toggle="export-data" |
95 | | - :data-success-message="trans('packages/data-synchronize::data-synchronize.export.success_message')" |
96 | | - :data-error-message="trans('packages/data-synchronize::data-synchronize.export.error_message')" |
97 | | - /> |
98 | | - @endif |
99 | | - |
100 | | - @if ($importer->getExamples()) |
101 | | - @include('packages/data-synchronize::partials.example') |
102 | | - @endif |
103 | | - |
104 | | - @includeWhen($importer->showRulesCheatSheet(), 'packages/data-synchronize::partials.rules') |
| 4 | + @include('packages/data-synchronize::partials.importer') |
105 | 5 | @stop |
106 | | - |
107 | | -@push('footer') |
108 | | - <x-core::custom-template id="data-synchronize-import-preview-template"> |
109 | | - <div class="position-relative d-flex gap-2 data-synchronize-import-preview-template"> |
110 | | - <x-core::icon name="ti ti-file" style="height: 2rem; width: 2rem" /> |
111 | | - <div> |
112 | | - <h4><span data-dz-name></span></h4> |
113 | | - <div class="d-flex align-items-center small text-muted"> |
114 | | - <span data-dz-size></span> |
115 | | - <button type="button" class="ms-1 text-danger cursor-pointer" data-dz-remove> |
116 | | - <x-core::icon name="ti ti-trash" /> |
117 | | - </button> |
118 | | - </div> |
119 | | - <div class="text-danger small" data-dz-errormessage></div> |
120 | | - </div> |
121 | | - </div> |
122 | | - </x-core::custom-template> |
123 | | - |
124 | | - {!! apply_filters('data_synchronize_import_page_footer', null, $importer) !!} |
125 | | -@endpush |
0 commit comments