Merge pull request #12982 from akemidx/feature/sc-23214

Buttons on the Accessory View Page
This commit is contained in:
snipe 2023-05-09 14:26:28 -07:00 committed by GitHub
commit 2d5da67b1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 94 deletions

View file

@ -17,5 +17,6 @@ return array(
'use_default_eula' => 'Use the <a href="#" data-toggle="modal" data-target="#eulaModal">primary default EULA</a> instead.',
'use_default_eula_disabled' => '<del>Use the primary default EULA instead.</del> No primary default EULA is set. Please add one in Settings.',
'clone' => 'Clone Accessory',
'delete_disabled' => 'This accessory cannot be deleted yet because some items are still checked out.',
);

View file

@ -92,6 +92,7 @@ return [
'debug_warning_text' => 'This application is running in production mode with debugging enabled. This can expose sensitive data if your application is accessible to the outside world. Disable debug mode by setting the <code>APP_DEBUG</code> value in your <code>.env</code> file to <code>false</code>.',
'delete' => 'Delete',
'delete_confirm' => 'Are you sure you wish to delete :item?',
'delete_confirm_no_undo' => 'Are you sure you wish to delete :item? This can not be undone.',
'deleted' => 'Deleted',
'delete_seats' => 'Deleted Seats',
'deletion_failed' => 'Deletion failed',

View file

@ -12,43 +12,6 @@
@parent
@stop
{{-- Right header --}}
@section('header_right')
@can('manage', \App\Models\Accessory::class)
<div class="dropdown pull-right">
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
{{ trans('button.actions') }}
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right" role="menu">
@if ($accessory->assigned_to != '')
@can('checkin', \App\Models\Accessory::class)
<li role="menuitem">
<a href="{{ route('accessories.checkin.show', $accessory->id) }}">{{ trans('admin/accessories/general.checkin') }}</a>
</li>
@endcan
@else
@can('checkout', \App\Models\Accessory::class)
<li role="menuitem">
<a href="{{ route('accessories.checkout.show', $accessory->id) }}">{{ trans('admin/accessories/general.checkout') }}</a>
</li>
@endcan
@endif
@can('update', \App\Models\Accessory::class)
<li role="menuitem">
<a href="{{ route('accessories.edit', $accessory->id) }}">{{ trans('admin/accessories/general.edit') }}</a>
</li>
@endcan
@can('update', \App\Models\Accessory::class)
<li role="menuitem">
<a href="{{ route('clone/accessories', $accessory->id) }}">{{ trans('admin/accessories/general.clone') }}</a>
</li>
@endcan
</ul>
</div>
@endcan
@stop
{{-- Page content --}}
@section('content')
{{-- Page content --}}
@ -136,7 +99,7 @@
</div>
</div>
<!-- histor tab pane -->
<!-- history tab pane -->
<div class="tab-pane fade" id="history">
<div class="table table-responsive">
<div class="row">
@ -274,10 +237,10 @@
</div>
</div> <!-- /.tab-pane -->
@endcan
</div>
</div>
</div>
</div>
</div>
</div>
<!-- side address column -->
@ -347,58 +310,44 @@
{{ $accessory->users_count }}
</div>
</div>
</div>
<div class="col-md-3 pull-right">
@can('checkout', \App\Models\Accessory::class)
<div class="row">
<div class="col-md-12 text-center">
<div class="text-center" style="padding-top:5px;">
<a href="{{ route('accessories.checkout.show', $accessory->id) }}" style="margin-right:5px; width:100%" class="btn btn-primary btn-sm" {{ (($accessory->numRemaining() > 0 ) ? '' : ' disabled') }}>{{ trans('general.checkout') }}</a>
</div>
@endcan
@can('update', \App\Models\Accessory::class)
<div class="text-center" style="padding-top:5px;">
<a href="{{ route('accessories.edit', $accessory->id) }}" style="margin-right:5px; width:100%" class="btn btn-primary btn-sm">{{ trans('admin/accessories/general.edit') }}</a>
</div>
@endcan
@can('update', \App\Models\Accessory::class)
<div class="text-center" style="padding-top:5px;">
<a href="{{ route('clone/accessories', $accessory->id) }}" style="margin-right:5px; width:100%" class="btn btn-primary btn-sm">{{ trans('admin/accessories/general.clone') }}</a>
</div>
@endcan
<div class="tab-pane fade" id="history">
<div class="row">
<div class="col-md-12">
<table
class="table table-striped snipe-table"
data-cookie-id-table="AccessoryHistoryTable"
data-id-table="AccessoryHistoryTable"
id="AccessoryHistoryTable"
data-pagination="true"
data-show-columns="true"
data-side-pagination="server"
data-show-refresh="true"
data-show-export="true"
data-sort-order="desc"
data-export-options='{
"fileName": "export-{{ str_slug($accessory->name) }}-history-{{ date('Y-m-d') }}",
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
}'
data-url="{{ route('api.activity.index', ['item_id' => $accessory->id, 'item_type' => 'accessory']) }}">
<thead>
<tr>
<th class="col-sm-2" data-visible="false" data-sortable="true" data-field="created_at" data-formatter="dateDisplayFormatter">{{ trans('general.record_created') }}</th>
<th class="col-sm-2"data-visible="true" data-sortable="true" data-field="admin" data-formatter="usersLinkObjFormatter">{{ trans('general.admin') }}</th>
<th class="col-sm-2" data-sortable="true" data-visible="true" data-field="action_type">{{ trans('general.action') }}</th>
<th class="col-sm-2" data-sortable="true" data-visible="true" data-field="item" data-formatter="polymorphicItemFormatter">{{ trans('general.item') }}</th>
<th class="col-sm-2" data-visible="true" data-field="target" data-formatter="polymorphicItemFormatter">{{ trans('general.target') }}</th>
<th class="col-sm-2" data-sortable="true" data-visible="true" data-field="note">{{ trans('general.notes') }}</th>
<th class="col-sm-2" data-visible="true" data-field="action_date" data-formatter="dateDisplayFormatter">{{ trans('general.date') }}</th>
@if ($snipeSettings->require_accept_signature=='1')
<th class="col-md-3" data-field="signature_file" data-visible="false" data-formatter="imageFormatter">{{ trans('general.signature') }}</th>
@can('delete', $accessory)
@if ($accessory->users_count == 0)
<div class="text-center" style="padding-top:5px;">
<button class="btn btn-block btn-danger delete-asset" style="padding-top:5px;" data-toggle="modal" data-title="{{ trans('general.delete') }}" data-content="{{ trans('general.delete_confirm_no_undo', ['item' => $accessory->name]) }}" data-target="#dataConfirmModal">
{{ trans('general.delete') }}
</button>
</div>
@else
<div class="text-center" style="padding-top:5px;">
<span data-tooltip="true" title=" {{ trans('admin/accessories/general.delete_disabled') }}">
<a href="#" class="btn btn-block btn-danger disabled">
{{ trans('general.delete') }}
</a>
</span>
</div>
@endif
</tr>
</thead>
</table>
</div> <!-- /.col-md-12-->
</div> <!-- /.row-->
</div><!--tab history-->
</div><!--col-md-3-->
</div><!--row-->
@endcan
</div>
</div>
@ -411,5 +360,13 @@
@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')
@stop