Skip to content

Commit

Permalink
Merge pull request #13606 from snipe/feature/sc-23705
Browse files Browse the repository at this point in the history
Fixed #13592 - unable to delete model from view page
  • Loading branch information
snipe authored Sep 15, 2023
2 parents a013ddf + 860e779 commit 8a8afef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions resources/lang/en/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@
'supplier' => 'Supplier',
'suppliers' => 'Suppliers',
'sure_to_delete' => 'Are you sure you wish to delete',
'sure_to_delete_var' => 'Are you sure you wish to delete :item?',
'delete_what' => 'Delete :item',
'submit' => 'Submit',
'target' => 'Target',
'time_and_date_display' => 'Time and Date Display',
Expand Down
16 changes: 13 additions & 3 deletions resources/views/models/view.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,12 @@ class="table table-striped snipe-table"
@if ($model->assets->count() > 0)

<div class="col-md-12" style="padding-bottom: 5px;">
<a href="{{ route('models.destroy', $model->id) }}" style="width: 100%;" class="btn btn-sm btn-danger hidden-print disabled">{{ trans('general.delete') }}</a>
<button class="btn btn-block btn-sm btn-danger hidden-print disabled" data-tooltip="true" data-placement="top" data-title="{{ trans('general.cannot_be_deleted') }}">{{ trans('general.delete') }}</button>
</div>
@else

<div class="col-md-12" style="padding-bottom: 10px;">
<a href="{{ route('models.destroy', $model->id) }}" style="width: 100%;" class="btn btn-sm btn-danger hidden-print">{{ trans('general.delete') }}</a>
<button class="btn btn-block btn-danger delete-asset" data-toggle="modal" title="{{ trans('general.delete_what', ['item'=> trans('general.asset_model')]) }}" data-content="{{ trans('general.sure_to_delete_var', ['item' => $model->name]) }}" data-target="#dataConfirmModal" data-tooltip="true" data-placement="top" data-title="{{ trans('general.delete_what', ['item'=> trans('general.asset_model')]) }}">{{ trans('general.delete') }} </button>
<span class="sr-only">{{ trans('general.delete') }}</span>
</div>
@endif
@endcan
Expand All @@ -357,6 +357,16 @@ class="table table-striped snipe-table"
@stop

@section('moar_scripts')

<script>
$('#dataConfirmModal').on('show.bs.modal', function (event) {
var content = $(event.relatedTarget).data('content');
var title = $(event.relatedTarget).data('title');
$(this).find(".modal-body").text(content);
$(this).find(".modal-header").text(title);
});
</script>

@include ('partials.bootstrap-table', ['exportFile' => 'manufacturer' . $model->name . '-export', 'search' => false])

@stop

0 comments on commit 8a8afef

Please sign in to comment.