Merge pull request #14335 from mauro-miatello/develop

Copy encrypted custom fields
This commit is contained in:
snipe 2024-02-28 09:04:11 +00:00 committed by GitHub
commit fcb2bf7fea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 11 deletions

View file

@ -76,12 +76,12 @@
</span>
<span class="hidden-xs hidden-sm">{{ trans('general.assets') }}
{!! ($asset->assignedAssets()->count() > 0 ) ? '<badge class="badge badge-secondary">'.number_format($asset->assignedAssets()->count()).'</badge>' : '' !!}
</span>
</a>
</li>
<li>
<a href="#history" data-toggle="tab">
<span class="hidden-lg hidden-md">
@ -126,7 +126,7 @@
</a>
</li>
@can('update', \App\Models\Asset::class)
<li class="pull-right">
<a href="#" data-toggle="modal" data-target="#uploadFileModal">
@ -138,7 +138,7 @@
</ul>
<div class="tab-content">
<div class="tab-pane fade in active" id="details">
<div class="row">
@ -238,11 +238,11 @@
</strong>
</div>
<div class="col-md-6">
{{ \App\Helpers\Helper::getFormattedDateObject($audit_log->created_at, 'date', false) }}
@if ($audit_log->user)
{{ \App\Helpers\Helper::getFormattedDateObject($audit_log->created_at, 'date', false) }}
@if ($audit_log->user)
(by {{ link_to_route('users.show', $audit_log->user->present()->fullname(), [$audit_log->user->id]) }})
@endif
@endif
</div>
</div>
@endif
@ -415,6 +415,7 @@
@if ($field->isFieldDecryptable($asset->{$field->db_column_name()} ))
@can('assets.view.encrypted_custom_fields')
<span class="js-copy-{{ $field->id }}">
@if (($field->format=='URL') && ($asset->{$field->db_column_name()}!=''))
<a href="{{ Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) }}" target="_new">{{ Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) }}</a>
@elseif (($field->format=='DATE') && ($asset->{$field->db_column_name()}!=''))
@ -422,7 +423,11 @@
@else
{{ Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) }}
@endif
@else
</span>
<i class="fa-regular fa-clipboard js-copy-link" data-clipboard-target=".js-copy-{{ $field->id }}" aria-hidden="true" data-tooltip="true" data-placement="top" title="{{ trans('general.copy_to_clipboard') }}">
<span class="sr-only">{{ trans('general.copy_to_clipboard') }}</span>
</i>
@else
{{ strtoupper(trans('admin/custom_fields/general.encrypted')) }}
@endcan
@ -520,7 +525,7 @@
@endif
{{ Helper::formatCurrencyOutput($asset->getDepreciatedValue() )}}
</div>
</div>
@endif

View file

@ -960,7 +960,13 @@
var clipboard = new ClipboardJS('.js-copy-link');
clipboard.on('success', function(e) {
$('.js-copy-link').tooltip('hide').attr('data-original-title', '{{ trans('general.copied') }}').tooltip('show');
// Get the clicked element
var clickedElement = $(e.trigger);
// Get the target element selector from data attribute
var targetSelector = clickedElement.data('data-clipboard-target');
// Find the target element
var targetEl = $(targetSelector);
clickedElement.tooltip('hide').attr('data-original-title', '{{ trans('general.copied') }}').tooltip('show');
});
// ignore: 'input[type=hidden]' is required here to validate the select2 lists