akaunting/resources/views/partials/form/file_group.blade.php

101 lines
4.4 KiB
PHP
Raw Normal View History

2018-08-04 19:07:32 +03:00
@stack($name . '_input_start')
2020-02-01 13:32:43 +03:00
2019-11-16 10:21:14 +03:00
<div
class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['readonly']) ? ' readonly' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
2021-03-25 23:34:16 +03:00
:class="[{'has-error': errors.{{ $name }}}]"
@if (isset($attributes['show']))
v-if="{{ $attributes['show'] }}"
@endif
>
@if (!empty($text))
{!! Form::label($name, $text, ['class' => 'form-control-label'])!!}
@endif
2018-08-04 19:07:32 +03:00
2020-12-30 11:11:39 +03:00
<div class="input-group input-group-merge">
<akaunting-dropzone-file-upload
2021-01-22 16:03:30 +03:00
text-drop-file="{{ trans('general.form.drop_file') }}"
text-choose-file="{{ trans('general.form.choose_file') }}"
2021-01-22 16:01:48 +03:00
2020-12-30 23:17:49 +03:00
@if (!empty($attributes['dropzone-class']))
class="{{ $attributes['dropzone-class'] }}"
@endif
2021-01-22 14:12:24 +03:00
2020-12-07 13:10:41 +03:00
@if (!empty($attributes['options']))
2021-01-22 14:12:24 +03:00
:options={{ json_encode($attributes['options']) }}
2020-12-07 13:10:41 +03:00
@endif
2021-01-22 14:12:24 +03:00
2021-01-29 17:25:28 +03:00
@if (!empty($attributes['preview']))
:preview={{ json_encode($attributes['preview']) }}
@endif
2020-12-07 13:10:41 +03:00
@if (!empty($attributes['multiple']))
multiple
@endif
2021-01-22 14:12:24 +03:00
@if (!empty($attributes['previewClasses']))
preview-classes="{{ $attributes['previewClasses'] }}"
@endif
@if (!empty($attributes['url']))
url="{{ $attributes['url'] }}"
2021-01-17 17:58:34 +03:00
@endif
2021-01-22 14:12:24 +03:00
2021-01-30 21:20:46 +03:00
@if (!empty($value))
@php
$attachments = [];
@endphp
2021-01-30 21:20:46 +03:00
@if (is_array($value))
@foreach($value as $attachment)
@php
$attachments[] = [
'id' => $attachment->id,
'name' => $attachment->filename . '.' . $attachment->extension,
'path' => route('uploads.get', $attachment->id),
'type' => $attachment->mime_type,
'size' => $attachment->size,
'downloadPath' => route('uploads.download', $attachment->id),
];
2021-01-30 21:20:46 +03:00
@endphp
@endforeach
@elseif ($value instanceof \Plank\Mediable\Media)
@php
$attachments[] = [
2021-02-10 12:07:33 +03:00
'id' => $value->id,
'name' => $value->filename . '.' . $value->extension,
'path' => route('uploads.get', $value->id),
2021-02-10 12:07:33 +03:00
'type' => $value->mime_type,
'size' => $value->size,
'downloadPath' => false,
];
2021-01-30 21:20:46 +03:00
@endphp
@else
@php
$attachment = \Plank\Mediable\Media::find($value);
$attachments[] = [
'id' => $attachment->id,
'name' => $attachment->filename . '.' . $attachment->extension,
'path' => route('uploads.get', $attachment->id),
'type' => $attachment->mime_type,
'size' => $attachment->size,
'downloadPath' => false,
];
2021-01-30 21:20:46 +03:00
@endphp
@endif
2021-01-30 21:20:46 +03:00
:attachments="{{ json_encode($attachments) }}"
@endif
2020-12-07 13:10:41 +03:00
v-model="{{ !empty($attributes['v-model']) ? $attributes['v-model'] : (!empty($attributes['data-field']) ? 'form.' . $attributes['data-field'] . '.'. $name : 'form.' . $name) }}"
></akaunting-dropzone-file-upload>
2019-11-16 10:21:14 +03:00
</div>
2018-08-04 19:07:32 +03:00
2019-11-16 10:21:14 +03:00
<div class="invalid-feedback d-block"
v-if="{{ isset($attributes['v-error']) ? $attributes['v-error'] : 'form.errors.has("' . $name . '")' }}"
v-html="{{ isset($attributes['v-error-message']) ? $attributes['v-error-message'] : 'form.errors.get("' . $name . '")' }}">
</div>
</div>
2020-02-01 13:32:43 +03:00
2018-08-04 19:07:32 +03:00
@stack($name . '_input_end')