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

@ -71,9 +71,34 @@
$('#picture').fancyfile({
text : '{{ trans('general.form.select.file') }}',
style : 'btn-default',
placeholder : '<?php echo $user->picture; ?>'
@if($user->picture)
placeholder : '<?php echo $user->picture->basename; ?>'
@else
placeholder : '{{ trans('general.form.no_file_selected') }}'
@endif
});
@if($user->picture)
picture_html = '<span class="picture">';
picture_html += ' <a href="{{ url('uploads/' . $user->picture->id . '/download') }}">';
picture_html += ' <span id="download-picture" class="text-primary">';
picture_html += ' <i class="fa fa-file-{{ $user->picture->aggregate_type }}-o"></i> {{ $user->picture->basename }}';
picture_html += ' </span>';
picture_html += ' </a>';
picture_html += ' {!! Form::open(['id' => 'picture-' . $user->picture->id, 'method' => 'DELETE', 'url' => [url('uploads/' . $user->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-{!! $user->picture->id !!}", "{!! trans('general.attachment') !!}", "{!! trans('general.delete_confirm', ['name' => '<strong>' . $user->picture->basename . '</strong>', 'type' => strtolower(trans('general.attachment'))]) !!}", "{!! trans('general.cancel') !!}", "{!! trans('general.delete') !!}");
});
@endif
$('input[type=checkbox]').iCheck({
checkboxClass: 'icheckbox_square-green',
radioClass: 'iradio_square-green',

View File

@ -44,7 +44,7 @@
<td>
<a href="{{ url('auth/users/' . $item->id . '/edit') }}">
@if ($item->picture)
<img src="{{ Storage::url($item->picture) }}" class="users-image" alt="{{ $item->name }}" title="{{ $item->name }}">
<img src="{{ Storage::url($item->picture->id) }}" class="users-image" alt="{{ $item->name }}" title="{{ $item->name }}">
@endif
{{ $item->name }}
</a>

View File

@ -63,6 +63,8 @@
style : 'btn-default',
@if($company->logo)
placeholder : '<?php echo $company->logo->basename; ?>'
@else
placeholder : '{{ trans('general.form.no_file_selected') }}'
@endif
});

View File

@ -62,7 +62,11 @@
$('#picture').fancyfile({
text : '{{ trans('general.form.select.file') }}',
style : 'btn-default',
@if($user->picture)
placeholder : '<?php echo $user->picture; ?>'
@else
placeholder : '{{ trans('general.form.no_file_selected') }}'
@endif
});
});
</script>

View File

@ -206,6 +206,8 @@
style : 'btn-default',
@if($bill->attachment)
placeholder : '<?php echo $bill->attachment->basename; ?>'
@else
placeholder : '{{ trans('general.form.no_file_selected') }}'
@endif
});

View File

@ -94,6 +94,8 @@
style : 'btn-default',
@if($payment->attachment)
placeholder : '<?php echo $payment->attachment->basename; ?>'
@else
placeholder : '{{ trans('general.form.no_file_selected') }}'
@endif
});

View File

@ -205,6 +205,8 @@
style : 'btn-default',
@if($invoice->attachment)
placeholder : '<?php echo $invoice->attachment->basename; ?>'
@else
placeholder : '{{ trans('general.form.no_file_selected') }}'
@endif
});

View File

@ -94,6 +94,8 @@
style : 'btn-default',
@if($revenue->attachment)
placeholder : '<?php echo $revenue->attachment->basename; ?>'
@else
placeholder : '{{ trans('general.form.no_file_selected') }}'
@endif
});

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>

View File

@ -166,7 +166,7 @@
@if (setting('general.use_gravatar', '0') == '1')
<img src="{{ $user->picture }}" class="user-image" alt="User Image">
@else
<img src="{{ Storage::url($user->picture) }}" class="user-image" alt="User Image">
<img src="{{ Storage::url($user->picture->id) }}" class="user-image" alt="User Image">
@endif
@else
<i class="fa fa-user-o"></i>
@ -182,7 +182,7 @@
@if (setting('general.use_gravatar', '0') == '1')
<img src="{{ $user->picture }}" class="img-circle" alt="User Image">
@else
<img src="{{ Storage::url($user->picture) }}" class="img-circle" alt="User Image">
<img src="{{ Storage::url($user->picture->id) }}" class="img-circle" alt="User Image">
@endif
@else
<i class="fa fa-4 fa-user-o" style="color: #fff; font-size: 7em;"></i>

View File

@ -60,7 +60,7 @@
<li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
@if ($user->picture)
<img src="{{ Storage::url($user->picture) }}" class="user-image" alt="User Image">
<img src="{{ Storage::url($user->picture->id) }}" class="user-image" alt="User Image">
@else
<i class="fa fa-user-o"></i>
@endif
@ -72,7 +72,7 @@
<!-- User image -->
<li class="user-header">
@if ($user->picture)
<img src="{{ Storage::url($user->picture) }}" class="img-circle" alt="User Image">
<img src="{{ Storage::url($user->picture->id) }}" class="img-circle" alt="User Image">
@else
<i class="fa fa-4 fa-user-o" style="color: #fff; font-size: 7em;"></i>
@endif

View File

@ -203,15 +203,64 @@
$('#company_logo').fancyfile({
text : '{{ trans('general.form.select.file') }}',
style : 'btn-default',
placeholder : '<?php echo $setting->pull('company_logo'); ?>'
@if($setting['company_logo'])
placeholder : '<?php echo $setting['company_logo']->basename; ?>'
@else
placeholder : '{{ trans('general.form.no_file_selected') }}'
@endif
});
@if($setting['company_logo'])
company_logo_html = '<span class="company_logo">';
company_logo_html += ' <a href="{{ url('uploads/' . $setting['company_logo']->id . '/download') }}">';
company_logo_html += ' <span id="download-company_logo" class="text-primary">';
company_logo_html += ' <i class="fa fa-file-{{ $setting['company_logo']->aggregate_type }}-o"></i> {{ $setting['company_logo']->basename }}';
company_logo_html += ' </span>';
company_logo_html += ' </a>';
company_logo_html += ' {!! Form::open(['id' => 'company_logo-' . $setting['company_logo']->id, 'method' => 'DELETE', 'url' => [url('uploads/' . $setting['company_logo']->id)], 'style' => 'display:inline']) !!}';
company_logo_html += ' <a id="remove-company_logo" href="javascript:void();">';
company_logo_html += ' <span class="text-danger"><i class="fa fa fa-times"></i></span>';
company_logo_html += ' </a>';
company_logo_html += ' {!! Form::close() !!}';
company_logo_html += '</span>';
$('#company .fancy-file .fake-file').append(company_logo_html);
$(document).on('click', '#remove-company_logo', function (e) {
confirmDelete("#company_logo-{!! $setting['company_logo']->id !!}", "{!! trans('general.attachment') !!}", "{!! trans('general.delete_confirm', ['name' => '<strong>' . $setting['company_logo']->basename . '</strong>', 'type' => strtolower(trans('general.attachment'))]) !!}", "{!! trans('general.cancel') !!}", "{!! trans('general.delete') !!}");
});
@endif
$('#invoice_logo').fancyfile({
text : '{{ trans('general.form.select.file') }}',
style : 'btn-default',
placeholder : '<?php echo $setting->pull('invoice_logo'); ?>'
@if($setting['invoice_logo'])
placeholder : '<?php echo $setting['invoice_logo']->basename; ?>'
@else
placeholder : '{{ trans('general.form.no_file_selected') }}'
@endif
});
@if($setting['invoice_logo'])
invoice_logo_html = '<span class="invoice_logo">';
invoice_logo_html += ' <a href="{{ url('uploads/' . $setting['invoice_logo']->id . '/download') }}">';
invoice_logo_html += ' <span id="download-invoice_logo" class="text-primary">';
invoice_logo_html += ' <i class="fa fa-file-{{ $setting['invoice_logo']->aggregate_type }}-o"></i> {{ $setting['invoice_logo']->basename }}';
invoice_logo_html += ' </span>';
invoice_logo_html += ' </a>';
invoice_logo_html += ' {!! Form::open(['id' => 'invoice_logo-' . $setting['invoice_logo']->id, 'method' => 'DELETE', 'url' => [url('uploads/' . $setting['invoice_logo']->id)], 'style' => 'display:inline']) !!}';
invoice_logo_html += ' <a id="remove-invoice_logo" href="javascript:void();">';
invoice_logo_html += ' <span class="text-danger"><i class="fa fa fa-times"></i></span>';
invoice_logo_html += ' </a>';
invoice_logo_html += ' {!! Form::close() !!}';
invoice_logo_html += '</span>';
$('#invoice .fancy-file .fake-file').append(invoice_logo_html);
$(document).on('click', '#remove-invoice_logo', function (e) {
confirmDelete("#invoice_logo-{!! $setting['invoice_logo']->id !!}", "{!! trans('general.attachment') !!}", "{!! trans('general.delete_confirm', ['name' => '<strong>' . $setting['invoice_logo']->basename . '</strong>', 'type' => strtolower(trans('general.attachment'))]) !!}", "{!! trans('general.cancel') !!}", "{!! trans('general.delete') !!}");
});
@endif
$("select[name='email_protocol']").on('change', function() {
var selection = $(this).val();