edit page and show pages media delete issue solved.
This commit is contained in:
parent
d4b5861120
commit
8708512b96
@ -37,12 +37,20 @@ class Uploads extends Controller
|
|||||||
public function show($id, Request $request)
|
public function show($id, Request $request)
|
||||||
{
|
{
|
||||||
$file = false;
|
$file = false;
|
||||||
|
$options = false;
|
||||||
$column_name = 'attachment';
|
$column_name = 'attachment';
|
||||||
|
|
||||||
if ($request->has('column_name')) {
|
if ($request->has('column_name')) {
|
||||||
$column_name = $request->get('column_name');
|
$column_name = $request->get('column_name');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($request->has('page')) {
|
||||||
|
$options = [
|
||||||
|
'page' => $request->get('page'),
|
||||||
|
'key' => $request->get('key'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
$media = Media::find($id);
|
$media = Media::find($id);
|
||||||
|
|
||||||
// Get file path
|
// Get file path
|
||||||
@ -58,7 +66,7 @@ class Uploads extends Controller
|
|||||||
|
|
||||||
$file = $media;
|
$file = $media;
|
||||||
|
|
||||||
$html = view('partials.media.file', compact('file', 'column_name'))->render();
|
$html = view('partials.media.file', compact('file', 'column_name', 'options'))->render();
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'success' => true,
|
'success' => true,
|
||||||
|
@ -431,11 +431,13 @@
|
|||||||
|
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@permission('delete-common-uploads')
|
||||||
@if($bill->attachment)
|
@if($bill->attachment)
|
||||||
$(document).on('click', '#remove-attachment', function (e) {
|
$(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') !!}");
|
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
|
@endif
|
||||||
|
@endpermission
|
||||||
|
|
||||||
$(document).on('click', '#button-payment', function (e) {
|
$(document).on('click', '#button-payment', function (e) {
|
||||||
$('#modal-add-payment').remove();
|
$('#modal-add-payment').remove();
|
||||||
|
@ -459,11 +459,13 @@
|
|||||||
|
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@permission('delete-common-uploads')
|
||||||
@if($invoice->attachment)
|
@if($invoice->attachment)
|
||||||
$(document).on('click', '#remove-attachment', function (e) {
|
$(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') !!}");
|
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
|
@endif
|
||||||
|
@endpermission
|
||||||
|
|
||||||
$(document).on('click', '#button-payment', function (e) {
|
$(document).on('click', '#button-payment', function (e) {
|
||||||
$('#modal-add-payment').remove();
|
$('#modal-add-payment').remove();
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
@php
|
||||||
|
$column_name = !empty($column_name) ? $column_name : 'attachment';
|
||||||
|
$options = !empty($options) ? $options : false;
|
||||||
|
@endphp
|
||||||
|
|
||||||
<ul class="mailbox-attachments clearfix margin-top">
|
<ul class="mailbox-attachments clearfix margin-top">
|
||||||
<li>
|
<li>
|
||||||
@if ($file->aggregate_type != 'image')
|
@if ($file->aggregate_type != 'image')
|
||||||
@ -20,18 +25,24 @@
|
|||||||
<span class="mailbox-attachment-size">
|
<span class="mailbox-attachment-size">
|
||||||
{{ $file->readableSize() }}
|
{{ $file->readableSize() }}
|
||||||
|
|
||||||
|
@permission('delete-common-uploads')
|
||||||
{!! Form::open([
|
{!! Form::open([
|
||||||
'id' => $column_name. '-' . $file->id,
|
'id' => $column_name. '-' . $file->id,
|
||||||
'method' => 'DELETE',
|
'method' => 'DELETE',
|
||||||
'url' => [url('uploads/' . $file->id)],
|
'url' => [url('uploads/' . $file->id)],
|
||||||
'style' => 'display:inline'
|
'style' => 'display:inline'
|
||||||
]) !!}
|
]) !!}
|
||||||
@permission('delete-common-uploads')
|
|
||||||
<a href="javascript:void();" id="remove-{{ $column_name }}" class="btn btn-danger btn-xs pull-right mailbox-attachment-remove">
|
<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>
|
<i class="fa fa fa-times"></i>
|
||||||
</a>
|
</a>
|
||||||
@endpermission
|
|
||||||
|
@if ($options)
|
||||||
|
<input type="hidden" name="page" value="{{ $options['page'] }}" />
|
||||||
|
<input type="hidden" name="key" value="{{ $options['key'] }}" />
|
||||||
|
<input type="hidden" name="value" value="{{ $file->id }}" />
|
||||||
|
@endif
|
||||||
{!! Form::close() !!}
|
{!! Form::close() !!}
|
||||||
|
@endpermission
|
||||||
|
|
||||||
<a href="{{ url('uploads/' . $file->id . '/download') }}" class="btn btn-info btn-xs pull-right mailbox-attachment-download">
|
<a href="{{ url('uploads/' . $file->id . '/download') }}" class="btn btn-info btn-xs pull-right mailbox-attachment-download">
|
||||||
<i class="fa fa-cloud-download"></i>
|
<i class="fa fa-cloud-download"></i>
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
@php
|
||||||
|
$column_name = !empty($column_name) ? $column_name : 'attachment';
|
||||||
|
$options = !empty($options) ? $options : false;
|
||||||
|
@endphp
|
||||||
|
|
||||||
<ul class="mailbox-attachments clearfix margin-top">
|
<ul class="mailbox-attachments clearfix margin-top">
|
||||||
@foreach ($files as $file)
|
@foreach ($files as $file)
|
||||||
<li>
|
<li>
|
||||||
@ -21,18 +26,24 @@
|
|||||||
<span class="mailbox-attachment-size">
|
<span class="mailbox-attachment-size">
|
||||||
{{ $file->readableSize() }}
|
{{ $file->readableSize() }}
|
||||||
|
|
||||||
|
@permission('delete-common-uploads')
|
||||||
{!! Form::open([
|
{!! Form::open([
|
||||||
'id' => 'attachment-' . $file->id,
|
'id' => 'attachment-' . $file->id,
|
||||||
'method' => 'DELETE',
|
'method' => 'DELETE',
|
||||||
'url' => [url('uploads/' . $file->id)],
|
'url' => [url('uploads/' . $file->id)],
|
||||||
'style' => 'display:inline'
|
'style' => 'display:inline'
|
||||||
]) !!}
|
]) !!}
|
||||||
@permission('delete-common-uploads')
|
|
||||||
<a href="javascript:void();" id="remove-attachment" class="btn btn-danger btn-xs pull-right mailbox-attachment-remove">
|
<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>
|
<i class="fa fa fa-times"></i>
|
||||||
</a>
|
</a>
|
||||||
@endpermission
|
|
||||||
|
@if ($options)
|
||||||
|
<input type="hidden" name="page" value="{{ $options['page'] }}" />
|
||||||
|
<input type="hidden" name="key" value="{{ $options['key'] }}" />
|
||||||
|
<input type="hidden" name="value" value="{{ $file->id }}" />
|
||||||
|
@endif
|
||||||
{!! Form::close() !!}
|
{!! Form::close() !!}
|
||||||
|
@endpermission
|
||||||
|
|
||||||
<a href="{{ url('uploads/' . $file->id . '/download') }}" class="btn btn-info btn-xs pull-right mailbox-attachment-download">
|
<a href="{{ url('uploads/' . $file->id . '/download') }}" class="btn btn-info btn-xs pull-right mailbox-attachment-download">
|
||||||
<i class="fa fa-cloud-download"></i>
|
<i class="fa fa-cloud-download"></i>
|
||||||
|
@ -249,7 +249,7 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
url: '{{ url('uploads/' . $setting['company_logo']->id . '/show') }}',
|
url: '{{ url('uploads/' . $setting['company_logo']->id . '/show') }}',
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
data: {column_name: 'company_logo'},
|
data: {column_name: 'company_logo', page: 'setting', key: 'general.company_logo'},
|
||||||
dataType: 'JSON',
|
dataType: 'JSON',
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
if (json['success']) {
|
if (json['success']) {
|
||||||
@ -285,7 +285,7 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
url: '{{ url('uploads/' . $setting['invoice_logo']->id . '/show') }}',
|
url: '{{ url('uploads/' . $setting['invoice_logo']->id . '/show') }}',
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
data: {column_name: 'invoice_logo'},
|
data: {column_name: 'invoice_logo', page: 'setting', key: 'general.invoice_logo'},
|
||||||
dataType: 'JSON',
|
dataType: 'JSON',
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
if (json['success']) {
|
if (json['success']) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user