diff --git a/app/Http/Transformers/AssetsTransformer.php b/app/Http/Transformers/AssetsTransformer.php index 171bccb642..49b74b1e96 100644 --- a/app/Http/Transformers/AssetsTransformer.php +++ b/app/Http/Transformers/AssetsTransformer.php @@ -98,6 +98,14 @@ class AssetsTransformer $decrypted = Helper::gracefulDecrypt($field, $asset->{$field->convertUnicodeDbSlug()}); $value = (Gate::allows('superadmin')) ? $decrypted : strtoupper(trans('admin/custom_fields/general.encrypted')); + if ($field->format == 'DATE'){ + if (Gate::allows('superadmin')){ + $value = Helper::getFormattedDateObject($value)['formatted']; + } else { + $value = strtoupper(trans('admin/custom_fields/general.encrypted')); + } + } + $fields_array[$field->name] = [ 'field' => e($field->convertUnicodeDbSlug()), 'value' => e($value), @@ -107,15 +115,19 @@ class AssetsTransformer ]; } else { + $value = $asset->{$field->convertUnicodeDbSlug()}; + + if ($field->format == 'DATE'){ + $value = Helper::getFormattedDateObject($value)['formatted']; + } $fields_array[$field->name] = [ 'field' => e($field->convertUnicodeDbSlug()), - 'value' => e($asset->{$field->convertUnicodeDbSlug()}), + 'value' => e($value), 'field_format' => $field->format, 'element' => $field->element, ]; - - } + $array['custom_fields'] = $fields_array; } } else { diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.php index a712cea863..588eaa9160 100644 --- a/resources/views/partials/bootstrap-table.blade.php +++ b/resources/views/partials/bootstrap-table.blade.php @@ -465,7 +465,7 @@ if ((row.custom_fields[field_column_plain].field_format) && (row.custom_fields[field_column_plain].value)) { if (row.custom_fields[field_column_plain].field_format=='URL') { return '' + row.custom_fields[field_column_plain].value + ''; - }else if (row.custom_fields[field_column_plain].field_format=='BOOLEAN') { + } else if (row.custom_fields[field_column_plain].field_format=='BOOLEAN') { return (row.custom_fields[field_column_plain].value == 1) ? "" : ""; } else if (row.custom_fields[field_column_plain].field_format=='EMAIL') { return '' + row.custom_fields[field_column_plain].value + '';