Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmcclean committed Oct 24, 2024
1 parent 116a826 commit dab0581
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion resources/js/components/Mappings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div v-else class="flex flex-col gap-6">
<div class="content max-w-lg">
<h2>{{ __('Configuration') }}</h2>
<p>{{ __('You can add or modify your Blueprint fields to customize what data is imported and what fieldtype it will be stored in. You can save, refresh, and com back to this import config later until it\'s ready to run.') }}</p>
<p>{{ __('You can add or modify your Blueprint fields to customize what data is imported and what fieldtype it will be stored in. You can save, refresh, and come back to this import config later until it\'s ready to run.') }}</p>
</div>
<div>
<label class="font-semibold text-sm mb-1">{{ __('Field Mappings') }}</label>
Expand Down Expand Up @@ -57,6 +57,10 @@
</tbody>
</table>

<div v-if="errors?.hasOwnProperty('mappings')">
<small class="help-block text-red-500 mt-2 mb-0" v-for="(error, i) in errors.mappings" :key="i" v-text="error" />
</div>

<div>
<label class="font-semibold text-sm mb-1">{{ __('Unique Field') }}</label>
<div class="help-block mb-2">
Expand Down
6 changes: 5 additions & 1 deletion src/Http/Requests/UpdateImportRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ public function rules(): array
{
return [
'run' => ['nullable', 'boolean'],
'mappings' => ['required', 'array'],
'mappings' => ['required', 'array', function ($attribute, $value, $fail) {
if (collect($value)->reject(fn (array $mapping) => empty($mapping['key']))->isEmpty()) {
$fail('You must map at least one field.')->translate();
}
}],
'mappings.*.key' => ['nullable', 'string'],
'unique_field' => ['required', 'string'],
];
Expand Down

0 comments on commit dab0581

Please sign in to comment.