Skip to content

Commit 2de1243

Browse files
Merge pull request #2316 from suraj-webkul/issue#2312
Issue #2312 has been fixed.
2 parents d61fb43 + 4a7322a commit 2de1243

File tree

2 files changed

+54
-30
lines changed

2 files changed

+54
-30
lines changed

packages/Webkul/Admin/src/Resources/views/settings/data-transfer/imports/edit.blade.php

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
{!! view_render_event('admin.settings.data_transfers.edit.breadcrumbs.before') !!}
2020

2121
<!-- Breadcrumbs -->
22-
<x-admin::breadcrumbs
22+
<x-admin::breadcrumbs
2323
name="settings.data_transfers.edit"
2424
:entity="$import"
2525
/>
@@ -69,29 +69,31 @@ class="primary-button"
6969
@lang('admin::app.settings.data-transfer.imports.edit.type')
7070
</x-admin::form.control-group.label>
7171

72-
<x-admin::form.control-group.control
73-
type="select"
74-
name="type"
75-
id="type"
76-
:value="old('type') ?? $import->type"
77-
ref="importType"
78-
rules="required"
79-
:label="trans('admin::app.settings.data-transfer.imports.edit.type')"
80-
>
81-
@foreach (config('importers') as $code => $importer)
82-
<option value="{{ $code }}">@lang($importer['title'])</option>
83-
@endforeach
84-
</x-admin::form.control-group.control>
85-
86-
<!-- Source Sample Download Links -->
87-
<a
88-
:href="'{{ route('admin.settings.data_transfer.imports.download_sample') }}/' + $refs['importType']?.value"
89-
target="_blank"
90-
id="source-sample-link"
91-
class="mt-1 cursor-pointer text-sm text-brandColor transition-all hover:underline"
92-
>
93-
@lang('admin::app.settings.data-transfer.imports.edit.download-sample')
94-
</a>
72+
<div class="flex flex-col gap-0.5">
73+
<x-admin::form.control-group.control
74+
type="select"
75+
name="type"
76+
id="type"
77+
:value="old('type') ?? $import->type"
78+
ref="importType"
79+
rules="required"
80+
:label="trans('admin::app.settings.data-transfer.imports.edit.type')"
81+
>
82+
@foreach (config('importers') as $code => $importer)
83+
<option value="{{ $code }}">@lang($importer['title'])</option>
84+
@endforeach
85+
</x-admin::form.control-group.control>
86+
87+
<!-- Source Sample Download Links -->
88+
<a
89+
:href="'{{ route('admin.settings.data_transfer.imports.download_sample') }}/' + $refs['importType']?.value"
90+
target="_blank"
91+
id="source-sample-link"
92+
class="mt-1 cursor-pointer text-sm text-brandColor transition-all hover:underline"
93+
>
94+
@lang('admin::app.settings.data-transfer.imports.edit.download-sample')
95+
</a>
96+
</div>
9597

9698
<x-admin::form.control-group.error control-name="type" />
9799
</x-admin::form.control-group>
@@ -102,13 +104,27 @@ class="mt-1 cursor-pointer text-sm text-brandColor transition-all hover:underlin
102104
@lang('admin::app.settings.data-transfer.imports.edit.file')
103105
</x-admin::form.control-group.label>
104106

105-
<x-admin::form.control-group.control
106-
type="file"
107-
name="file"
108-
:label="trans('admin::app.settings.data-transfer.imports.edit.file')"
109-
/>
107+
<div class="flex flex-col gap-0.5">
108+
<x-admin::form.control-group.control
109+
type="file"
110+
name="file"
111+
:label="trans('admin::app.settings.data-transfer.imports.edit.file')"
112+
/>
110113

111-
<x-admin::form.control-group.error control-name="file" />
114+
<x-admin::form.control-group.error control-name="file" />
115+
116+
@if ($import?->file_path)
117+
<!-- Uploaded File Link -->
118+
<a
119+
href="{{ route('admin.settings.data_transfer.imports.download', $import?->id) }}"
120+
target="_blank"
121+
id="uploaded-file-link"
122+
class="mt-1 cursor-pointer text-sm text-brandColor transition-all hover:underline"
123+
>
124+
{{ $import?->file_name }}
125+
</a>
126+
@endif
127+
</div>
112128
</x-admin::form.control-group>
113129
</div>
114130

packages/Webkul/DataTransfer/src/Models/Import.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,12 @@ public function batches(): HasMany
5252
{
5353
return $this->hasMany(ImportBatchProxy::modelClass());
5454
}
55+
56+
/**
57+
* Get the file name.
58+
*/
59+
public function getFileNameAttribute(): string
60+
{
61+
return preg_replace('/^.*?\/\d+-/', '', $this->file_path);
62+
}
5563
}

0 commit comments

Comments
 (0)