all media edit and show page

This commit is contained in:
cuneytsenturk 2019-02-02 14:02:26 +03:00
parent 18e381f095
commit d4b5861120
16 changed files with 196 additions and 218 deletions

View File

@ -34,9 +34,14 @@ class Uploads extends Controller
* @param $id
* @return mixed
*/
public function show($id)
public function show($id, Request $request)
{
$file = false;
$column_name = 'attachment';
if ($request->has('column_name')) {
$column_name = $request->get('column_name');
}
$media = Media::find($id);
@ -53,7 +58,7 @@ class Uploads extends Controller
$file = $media;
$html = view('partials.media.file', compact('file'))->render();
$html = view('partials.media.file', compact('file', 'column_name'))->render();
return response()->json([
'success' => true,

View File

@ -36,7 +36,7 @@ class Roles extends Seeder
'common-companies' => 'c,r,u,d',
'common-import' => 'c',
'common-items' => 'c,r,u,d',
'common-uploads' => 'd',
'common-uploads' => 'r,d',
'common-notifications' => 'c,r,u,d',
'incomes-invoices' => 'c,r,u,d',
'incomes-revenues' => 'c,r,u,d',
@ -76,6 +76,7 @@ class Roles extends Seeder
'common-companies' => 'c,r,u,d',
'common-import' => 'c',
'common-items' => 'c,r,u,d',
'common-uploads' => 'r',
'common-notifications' => 'c,r,u,d',
'incomes-invoices' => 'c,r,u,d',
'incomes-revenues' => 'c,r,u,d',

View File

@ -86,31 +86,30 @@
text : '{{ trans('general.form.select.file') }}',
style : 'btn-default',
@if($user->picture)
placeholder : '<?php echo $user->picture->basename; ?>'
placeholder : '{{ $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);
$.ajax({
url: '{{ url('uploads/' . $user->picture->id . '/show') }}',
type: 'GET',
data: {column_name: 'picture'},
dataType: 'JSON',
success: function(json) {
if (json['success']) {
$('.fancy-file').after(json['html']);
}
}
});
@permission('delete-common-uploads')
$(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') !!}");
});
@endpermission
@endif
@endif

View File

@ -63,31 +63,30 @@
text : '{{ trans('general.form.select.file') }}',
style : 'btn-default',
@if($company->company_logo)
placeholder : '<?php echo $company->company_logo->basename; ?>'
placeholder : '{{ $company->company_logo->basename }}'
@else
placeholder : '{{ trans('general.form.no_file_selected') }}'
@endif
});
@if($company->company_logo)
attachment_html = '<span class="attachment">';
attachment_html += ' <a href="{{ url('uploads/' . $company->company_logo->id . '/download') }}">';
attachment_html += ' <span id="download-attachment" class="text-primary">';
attachment_html += ' <i class="fa fa-file-{{ $company->company_logo->aggregate_type }}-o"></i> {{ $company->company_logo->basename }}';
attachment_html += ' </span>';
attachment_html += ' </a>';
attachment_html += ' {!! Form::open(['id' => 'attachment-' . $company->company_logo->id, 'method' => 'DELETE', 'url' => [url('uploads/' . $company->company_logo->id)], 'style' => 'display:inline']) !!}';
attachment_html += ' <a id="remove-attachment" href="javascript:void();">';
attachment_html += ' <span class="text-danger"><i class="fa fa fa-times"></i></span>';
attachment_html += ' </a>';
attachment_html += ' {!! Form::close() !!}';
attachment_html += '</span>';
$('.fancy-file .fake-file').append(attachment_html);
$.ajax({
url: '{{ url('uploads/' . $company->company_logo->id . '/show') }}',
type: 'GET',
data: {column_name: 'attachment'},
dataType: 'JSON',
success: function(json) {
if (json['success']) {
$('.fancy-file').after(json['html']);
}
}
});
@permission('delete-common-uploads')
$(document).on('click', '#remove-attachment', function (e) {
confirmDelete("#attachment-{!! $company->company_logo->id !!}", "{!! trans('general.attachment') !!}", "{!! trans('general.delete_confirm', ['name' => '<strong>' . $company->company_logo->basename . '</strong>', 'type' => strtolower(trans('general.attachment'))]) !!}", "{!! trans('general.cancel') !!}", "{!! trans('general.delete') !!}");
});
@endpermission
@endif
});
</script>

View File

@ -110,31 +110,30 @@
text : '{{ trans('general.form.select.file') }}',
style : 'btn-default',
@if($item->picture)
placeholder : '<?php echo $item->picture->basename; ?>'
placeholder : '{{ $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);
$.ajax({
url: '{{ url('uploads/' . $item->picture->id . '/show') }}',
type: 'GET',
data: {column_name: 'picture'},
dataType: 'JSON',
success: function(json) {
if (json['success']) {
$('.fancy-file').after(json['html']);
}
}
});
@permission('delete-common-uploads')
$(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') !!}");
});
@endpermission
@endif
});

View File

@ -64,31 +64,30 @@
text : '{{ trans('general.form.select.file') }}',
style : 'btn-default',
@if($user->picture)
placeholder : '<?php echo $user->picture->basename; ?>'
placeholder : '{{ $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);
$.ajax({
url: '{{ url('uploads/' . $user->picture->id . '/show') }}',
type: 'GET',
data: {column_name: 'picture'},
dataType: 'JSON',
success: function(json) {
if (json['success']) {
$('.fancy-file').after(json['html']);
}
}
});
@permission('delete-common-uploads')
$(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') !!}");
});
@endpermission
@endif
});
</script>

View File

@ -257,27 +257,24 @@
text : '{{ trans('general.form.select.file') }}',
style : 'btn-default',
@if($bill->attachment)
placeholder : '<?php echo $bill->attachment->basename; ?>'
placeholder : '{{ $bill->attachment->basename }}'
@else
placeholder : '{{ trans('general.form.no_file_selected') }}'
@endif
});
@if($bill->attachment)
attachment_html = '<span class="attachment">';
attachment_html += ' <a href="{{ url('uploads/' . $bill->attachment->id . '/download') }}">';
attachment_html += ' <span id="download-attachment" class="text-primary">';
attachment_html += ' <i class="fa fa-file-{{ $bill->attachment->aggregate_type }}-o"></i> {{ $bill->attachment->basename }}';
attachment_html += ' </span>';
attachment_html += ' </a>';
attachment_html += ' {!! Form::open(['id' => 'attachment-' . $bill->attachment->id, 'method' => 'DELETE', 'url' => [url('uploads/' . $bill->attachment->id)], 'style' => 'display:inline']) !!}';
attachment_html += ' <a id="remove-attachment" href="javascript:void();">';
attachment_html += ' <span class="text-danger"><i class="fa fa fa-times"></i></span>';
attachment_html += ' </a>';
attachment_html += ' {!! Form::close() !!}';
attachment_html += '</span>';
$('.fancy-file .fake-file').append(attachment_html);
$.ajax({
url: '{{ url('uploads/' . $bill->attachment->id . '/show') }}',
type: 'GET',
data: {column_name: 'attachment'},
dataType: 'JSON',
success: function(json) {
if (json['success']) {
$('.fancy-file').after(json['html']);
}
}
});
@endif
@if(old('item'))
@ -285,11 +282,13 @@
@endif
});
@permission('delete-common-uploads')
@if($bill->attachment)
$(document).on('click', '#remove-attachment', function (e) {
confirmDelete("#attachment-{!! $bill->attachment->id !!}", "{!! trans('general.attachment') !!}", "{!! trans('general.delete_confirm', ['name' => '<strong>' . $bill->attachment->basename . '</strong>', 'type' => strtolower(trans('general.attachment'))]) !!}", "{!! trans('general.cancel') !!}", "{!! trans('general.delete') !!}");
});
@endif
@endpermission
$(document).on('click', '#button-add-item', function (e) {
$.ajax({

View File

@ -311,23 +311,8 @@
</div>
@if($bill->attachment)
<span class="attachment">
<a href="{{ url('uploads/' . $bill->attachment->id . '/download') }}">
<span id="download-attachment" class="text-primary">
<i class="fa fa-file-{{ $bill->attachment->aggregate_type }}-o"></i> {{ $bill->attachment->basename }}
</span>
</a>
{!! Form::open([
'id' => 'attachment-' . $bill->attachment->id,
'method' => 'DELETE',
'url' => [url('uploads/' . $bill->attachment->id)],
'style' => 'display:inline'
]) !!}
<a id="remove-attachment" href="javascript:void();">
<span class="text-danger"><i class="fa fa fa-times"></i></span>
</a>
{!! Form::close() !!}
</span>
@php $file = $bill->attachment; @endphp
@include('partials.media.file')
@endif
</div>
</div>

View File

@ -137,31 +137,30 @@
text : '{{ trans('general.form.select.file') }}',
style : 'btn-default',
@if($payment->attachment)
placeholder : '<?php echo $payment->attachment->basename; ?>'
placeholder : '{{ $payment->attachment->basename }}'
@else
placeholder : '{{ trans('general.form.no_file_selected') }}'
@endif
});
@if($payment->attachment)
attachment_html = '<span class="attachment">';
attachment_html += ' <a href="{{ url('uploads/' . $payment->attachment->id . '/download') }}">';
attachment_html += ' <span id="download-attachment" class="text-primary">';
attachment_html += ' <i class="fa fa-file-{{ $payment->attachment->aggregate_type }}-o"></i> {{ $payment->attachment->basename }}';
attachment_html += ' </span>';
attachment_html += ' </a>';
attachment_html += ' {!! Form::open(['id' => 'attachment-' . $payment->attachment->id, 'method' => 'DELETE', 'url' => [url('uploads/' . $payment->attachment->id)], 'style' => 'display:inline']) !!}';
attachment_html += ' <a id="remove-attachment" href="javascript:void();">';
attachment_html += ' <span class="text-danger"><i class="fa fa fa-times"></i></span>';
attachment_html += ' </a>';
attachment_html += ' {!! Form::close() !!}';
attachment_html += '</span>';
$('.fancy-file .fake-file').append(attachment_html);
$.ajax({
url: '{{ url('uploads/' . $payment->attachment->id . '/show') }}',
type: 'GET',
data: {column_name: 'attachment'},
dataType: 'JSON',
success: function(json) {
if (json['success']) {
$('.fancy-file').after(json['html']);
}
}
});
@permission('delete-common-uploads')
$(document).on('click', '#remove-attachment', function (e) {
confirmDelete("#attachment-{!! $payment->attachment->id !!}", "{!! trans('general.attachment') !!}", "{!! trans('general.delete_confirm', ['name' => '<strong>' . $payment->attachment->basename . '</strong>', 'type' => strtolower(trans('general.attachment'))]) !!}", "{!! trans('general.cancel') !!}", "{!! trans('general.delete') !!}");
});
@endpermission
@endif
});

View File

@ -69,31 +69,30 @@
text : '{{ trans('general.form.select.file') }}',
style : 'btn-default',
@if($vendor->logo)
placeholder : '<?php echo $vendor->logo->basename; ?>'
placeholder : '{{ $vendor->logo->basename }}'
@else
placeholder : '{{ trans('general.form.no_file_selected') }}'
@endif
});
@if($vendor->logo)
logo_html = '<span class="logo">';
logo_html += ' <a href="{{ url('uploads/' . $vendor->logo->id . '/download') }}">';
logo_html += ' <span id="download-logo" class="text-primary">';
logo_html += ' <i class="fa fa-file-{{ $vendor->logo->aggregate_type }}-o"></i> {{ $vendor->logo->basename }}';
logo_html += ' </span>';
logo_html += ' </a>';
logo_html += ' {!! Form::open(['id' => 'logo-' . $vendor->logo->id, 'method' => 'DELETE', 'url' => [url('uploads/' . $vendor->logo->id)], 'style' => 'display:inline']) !!}';
logo_html += ' <a id="remove-logo" href="javascript:void();">';
logo_html += ' <span class="text-danger"><i class="fa fa fa-times"></i></span>';
logo_html += ' </a>';
logo_html += ' {!! Form::close() !!}';
logo_html += '</span>';
$('.fancy-file .fake-file').append(logo_html);
$.ajax({
url: '{{ url('uploads/' . $vendor->logo->id . '/show') }}',
type: 'GET',
data: {column_name: 'logo'},
dataType: 'JSON',
success: function(json) {
if (json['success']) {
$('.fancy-file').after(json['html']);
}
}
});
@permission('delete-common-uploads')
$(document).on('click', '#remove-logo', function (e) {
confirmDelete("#logo-{!! $vendor->logo->id !!}", "{!! trans('general.attachment') !!}", "{!! trans('general.delete_confirm', ['name' => '<strong>' . $vendor->logo->basename . '</strong>', 'type' => strtolower(trans('general.attachment'))]) !!}", "{!! trans('general.cancel') !!}", "{!! trans('general.delete') !!}");
});
@endpermission
@endif
});
</script>

View File

@ -267,6 +267,7 @@
$.ajax({
url: '{{ url('uploads/' . $invoice->attachment->id . '/show') }}',
type: 'GET',
data: {column_name: 'attachment'},
dataType: 'JSON',
success: function(json) {
if (json['success']) {
@ -281,11 +282,13 @@
@endif
});
@permission('delete-common-uploads')
@if($invoice->attachment)
$(document).on('click', '#remove-attachment', function (e) {
confirmDelete("#attachment-{!! $invoice->attachment->id !!}", "{!! trans('general.attachment') !!}", "{!! trans('general.delete_confirm', ['name' => '<strong>' . $invoice->attachment->basename . '</strong>', 'type' => strtolower(trans('general.attachment'))]) !!}", "{!! trans('general.cancel') !!}", "{!! trans('general.delete') !!}");
});
@endif
@endpermission
$(document).on('click', '#button-add-item', function (e) {
$.ajax({

View File

@ -137,32 +137,31 @@
text : '{{ trans('general.form.select.file') }}',
style : 'btn-default',
@if($revenue->attachment)
placeholder : '<?php echo $revenue->attachment->basename; ?>'
placeholder : '{{ $revenue->attachment->basename }}'
@else
placeholder : '{{ trans('general.form.no_file_selected') }}'
@endif
});
@if($revenue->attachment)
attachment_html = '<span class="attachment">';
attachment_html += ' <a href="{{ url('uploads/' . $revenue->attachment->id . '/download') }}">';
attachment_html += ' <span id="download-attachment" class="text-primary">';
attachment_html += ' <i class="fa fa-file-{{ $revenue->attachment->aggregate_type }}-o"></i> {{ $revenue->attachment->basename }}';
attachment_html += ' </span>';
attachment_html += ' </a>';
attachment_html += ' {!! Form::open(['id' => 'attachment-' . $revenue->attachment->id, 'method' => 'DELETE', 'url' => [url('uploads/' . $revenue->attachment->id)], 'style' => 'display:inline']) !!}';
attachment_html += ' <a id="remove-attachment" href="javascript:void();">';
attachment_html += ' <span class="text-danger"><i class="fa fa fa-times"></i></span>';
attachment_html += ' </a>';
attachment_html += ' {!! Form::close() !!}';
attachment_html += '</span>';
$('.fancy-file .fake-file').append(attachment_html);
$.ajax({
url: '{{ url('uploads/' . $revenue->attachment->id . '/show') }}',
type: 'GET',
data: {column_name: 'attachment'},
dataType: 'JSON',
success: function(json) {
if (json['success']) {
$('.fancy-file').after(json['html']);
}
}
});
@permission('delete-common-uploads')
$(document).on('click', '#remove-attachment', function (e) {
confirmDelete("#attachment-{!! $revenue->attachment->id !!}", "{!! trans('general.attachment') !!}", "{!! trans('general.delete_confirm', ['name' => '<strong>' . $revenue->attachment->basename . '</strong>', 'type' => strtolower(trans('general.attachment'))]) !!}", "{!! trans('general.cancel') !!}", "{!! trans('general.delete') !!}");
});
@endif
@endpermission
});
$(document).on('change', '#account_id', function (e) {

View File

@ -21,14 +21,16 @@
{{ $file->readableSize() }}
{!! Form::open([
'id' => 'attachment-' . $file->id,
'id' => $column_name. '-' . $file->id,
'method' => 'DELETE',
'url' => [url('uploads/' . $file->id)],
'style' => 'display:inline'
]) !!}
<a id="remove-attachment" href="javascript:void();" class="btn btn-danger btn-xs pull-right">
@permission('delete-common-uploads')
<a href="javascript:void();" id="remove-{{ $column_name }}" class="btn btn-danger btn-xs pull-right mailbox-attachment-remove">
<i class="fa fa fa-times"></i>
</a>
@endpermission
{!! Form::close() !!}
<a href="{{ url('uploads/' . $file->id . '/download') }}" class="btn btn-info btn-xs pull-right mailbox-attachment-download">

View File

@ -27,9 +27,11 @@
'url' => [url('uploads/' . $file->id)],
'style' => 'display:inline'
]) !!}
<a id="remove-attachment" href="javascript:void();" class="btn btn-danger btn-xs pull-right">
@permission('delete-common-uploads')
<a href="javascript:void();" id="remove-attachment" class="btn btn-danger btn-xs pull-right mailbox-attachment-remove">
<i class="fa fa fa-times"></i>
</a>
@endpermission
{!! Form::close() !!}
<a href="{{ url('uploads/' . $file->id . '/download') }}" class="btn btn-info btn-xs pull-right mailbox-attachment-download">

View File

@ -246,27 +246,23 @@
});
@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 += ' <input type="hidden" name="page" value="setting" />';
company_logo_html += ' <input type="hidden" name="key" value="general.company_logo" />';
company_logo_html += ' <input type="hidden" name="value" value="{{ $setting['company_logo']->id }}" />';
company_logo_html += ' {!! Form::close() !!}';
company_logo_html += '</span>';
$('#company .fancy-file .fake-file').append(company_logo_html);
$.ajax({
url: '{{ url('uploads/' . $setting['company_logo']->id . '/show') }}',
type: 'GET',
data: {column_name: 'company_logo'},
dataType: 'JSON',
success: function(json) {
if (json['success']) {
$('#company .fancy-file').after(json['html']);
}
}
});
@permission('delete-common-uploads')
$(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') !!}");
});
@endpermission
@endif
var invoice_file = false;
@ -286,27 +282,23 @@
});
@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 += ' <input type="hidden" name="page" value="setting" />';
invoice_logo_html += ' <input type="hidden" name="key" value="general.invoice_logo" />';
invoice_logo_html += ' <input type="hidden" name="value" value="{{ $setting['invoice_logo']->id }}" />';
invoice_logo_html += ' {!! Form::close() !!}';
invoice_logo_html += '</span>';
$(target + ' .fancy-file .fake-file').append(invoice_logo_html);
$.ajax({
url: '{{ url('uploads/' . $setting['invoice_logo']->id . '/show') }}',
type: 'GET',
data: {column_name: 'invoice_logo'},
dataType: 'JSON',
success: function(json) {
if (json['success']) {
$(target + ' .fancy-file').after(json['html']);
}
}
});
@permission('delete-common-uploads')
$(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') !!}");
});
@endpermission
@endif
invoice_file = true;

View File

@ -116,27 +116,23 @@
});
@if($company->company_logo)
company_logo_html = '<span class="company_logo">';
company_logo_html += ' <a href="{{ url('uploads/' . $company->company_logo->id . '/download') }}">';
company_logo_html += ' <span id="download-company_logo" class="text-primary">';
company_logo_html += ' <i class="fa fa-file-{{ $company->company_logo->aggregate_type }}-o"></i> {{ $company->company_logo->basename }}';
company_logo_html += ' </span>';
company_logo_html += ' </a>';
company_logo_html += ' {!! Form::open(['id' => 'company_logo-' . $company->company_logo->id, 'method' => 'DELETE', 'url' => [url('uploads/' . $company->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 += ' <input type="hidden" name="page" value="setting" />';
company_logo_html += ' <input type="hidden" name="key" value="general.company_logo" />';
company_logo_html += ' <input type="hidden" name="value" value="{{ $company->company_logo->id }}" />';
company_logo_html += ' {!! Form::close() !!}';
company_logo_html += '</span>';
$('.form-group.col-md-6 .fancy-file .fake-file').append(company_logo_html);
$.ajax({
url: '{{ url('uploads/' . $company->company_logo->id . '/show') }}',
type: 'GET',
data: {column_name: 'company_logo'},
dataType: 'JSON',
success: function(json) {
if (json['success']) {
$('.form-group.col-md-6 .fancy-file').after(json['html']);
}
}
});
@permission('delete-common-uploads')
$(document).on('click', '#remove-company_logo', function (e) {
confirmDelete("#company_logo-{!! $company->company_logo->id !!}", "{!! trans('general.attachment') !!}", "{!! trans('general.delete_confirm', ['name' => '<strong>' . $company->company_logo->basename . '</strong>', 'type' => strtolower(trans('general.attachment'))]) !!}", "{!! trans('general.cancel') !!}", "{!! trans('general.delete') !!}");
});
@endpermission
@endif
});
</script>