Add User, Companies, Settings picture media manager

This commit is contained in:
cuneytsenturk
2018-01-03 14:02:27 +03:00
parent e3b736d3e8
commit 43619d1db4
20 changed files with 205 additions and 47 deletions

View File

@ -70,8 +70,33 @@
$('#picture').fancyfile({
text : '{{ trans('general.form.select.file') }}',
style : 'btn-default',
placeholder : '<?php echo $item->picture; ?>'
@if($item->picture)
placeholder : '<?php echo $item->picture->basename; ?>'
@else
placeholder : '{{ trans('general.form.no_file_selected') }}'
@endif
});
@if($item->picture)
picture_html = '<span class="picture">';
picture_html += ' <a href="{{ url('uploads/' . $item->picture->id . '/download') }}">';
picture_html += ' <span id="download-picture" class="text-primary">';
picture_html += ' <i class="fa fa-file-{{ $item->picture->aggregate_type }}-o"></i> {{ $item->picture->basename }}';
picture_html += ' </span>';
picture_html += ' </a>';
picture_html += ' {!! Form::open(['id' => 'picture-' . $item->picture->id, 'method' => 'DELETE', 'url' => [url('uploads/' . $item->picture->id)], 'style' => 'display:inline']) !!}';
picture_html += ' <a id="remove-picture" href="javascript:void();">';
picture_html += ' <span class="text-danger"><i class="fa fa fa-times"></i></span>';
picture_html += ' </a>';
picture_html += ' {!! Form::close() !!}';
picture_html += '</span>';
$('.fancy-file .fake-file').append(picture_html);
$(document).on('click', '#remove-picture', function (e) {
confirmDelete("#picture-{!! $item->picture->id !!}", "{!! trans('general.attachment') !!}", "{!! trans('general.delete_confirm', ['name' => '<strong>' . $item->picture->basename . '</strong>', 'type' => strtolower(trans('general.attachment'))]) !!}", "{!! trans('general.cancel') !!}", "{!! trans('general.delete') !!}");
});
@endif
});
</script>
@endpush

View File

@ -46,7 +46,7 @@
<tbody>
@foreach($items as $item)
<tr>
<td class="hidden-xs"><img src="{{ $item->picture ? Storage::url($item->picture) : asset('public/img/akaunting-logo-green.png') }}" class="img-thumbnail" width="50" alt="{{ $item->name }}"></td>
<td class="hidden-xs"><img src="{{ $item->picture ? Storage::url($item->picture->id) : asset('public/img/akaunting-logo-green.png') }}" class="img-thumbnail" width="50" alt="{{ $item->name }}"></td>
<td><a href="{{ url('items/items/' . $item->id . '/edit') }}">{{ $item->name }}</a></td>
<td class="hidden-xs">{{ $item->category ? $item->category->name : trans('general.na') }}</td>
<td class="hidden-xs">{{ $item->quantity }}</td>