This commit is contained in:
snipe 2021-09-28 20:03:35 -07:00
commit 8e437a66af
19 changed files with 64 additions and 475 deletions

View file

@ -403,6 +403,19 @@ class Helper
*/ */
public static function ParseFloat($floatString) public static function ParseFloat($floatString)
{ {
/*******
*
* WARNING: This does conversions based on *locale* - a Unix-ey-like thing.
*
* Everything else in the system tends to convert based on the Snipe-IT settings
*
* So it's very likely this is *not* what you want - instead look for the new
*
* ParseCurrency($currencyString)
*
* Which should be directly below here
*
*/
$LocaleInfo = localeconv(); $LocaleInfo = localeconv();
$floatString = str_replace(",", "", $floatString); $floatString = str_replace(",", "", $floatString);
$floatString = str_replace($LocaleInfo["decimal_point"], ".", $floatString); $floatString = str_replace($LocaleInfo["decimal_point"], ".", $floatString);
@ -416,6 +429,26 @@ class Helper
$floatString = str_replace($currencySymbol, '', $floatString); $floatString = str_replace($currencySymbol, '', $floatString);
return floatval($floatString); return floatval($floatString);
} }
/**
* Format currency using comma or period for thousands, and period or comma for decimal, based on settings.
*
* @author [B. Wetherington] [<bwetherington@grokability.com>]
* @since [v5.2]
* @return Float
*/
public static function ParseCurrency($currencyString) {
$without_currency = str_replace(Setting::getSettings()->default_currency, '', $currencyString); //generally shouldn't come up, since we don't do this in fields, but just in case it does...
if(Setting::getSettings()->digit_separator=='1.234,56') {
//EU format
$without_thousands = str_replace('.', '', $without_currency);
$corrected_decimal = str_replace(',', '.', $without_thousands);
} else {
$without_thousands = str_replace(',', '', $without_currency);
$corrected_decimal = $without_thousands; // decimal is already OK
}
return floatval($corrected_decimal);
}
/** /**
* Get the list of status labels in an array to make a dropdown menu * Get the list of status labels in an array to make a dropdown menu

View file

@ -74,7 +74,7 @@ class AccessoriesController extends Controller
$accessory->manufacturer_id = request('manufacturer_id'); $accessory->manufacturer_id = request('manufacturer_id');
$accessory->model_number = request('model_number'); $accessory->model_number = request('model_number');
$accessory->purchase_date = request('purchase_date'); $accessory->purchase_date = request('purchase_date');
$accessory->purchase_cost = Helper::ParseFloat(request('purchase_cost')); $accessory->purchase_cost = Helper::ParseCurrency(request('purchase_cost'));
$accessory->qty = request('qty'); $accessory->qty = request('qty');
$accessory->user_id = Auth::user()->id; $accessory->user_id = Auth::user()->id;
$accessory->supplier_id = request('supplier_id'); $accessory->supplier_id = request('supplier_id');
@ -137,7 +137,7 @@ class AccessoriesController extends Controller
$accessory->order_number = request('order_number'); $accessory->order_number = request('order_number');
$accessory->model_number = request('model_number'); $accessory->model_number = request('model_number');
$accessory->purchase_date = request('purchase_date'); $accessory->purchase_date = request('purchase_date');
$accessory->purchase_cost = request('purchase_cost'); $accessory->purchase_cost = Helper::ParseCurrency(request('purchase_cost'));
$accessory->qty = request('qty'); $accessory->qty = request('qty');
$accessory->supplier_id = request('supplier_id'); $accessory->supplier_id = request('supplier_id');

View file

@ -105,7 +105,7 @@ class AssetMaintenancesController extends Controller
$assetMaintenance = new AssetMaintenance(); $assetMaintenance = new AssetMaintenance();
$assetMaintenance->supplier_id = $request->input('supplier_id'); $assetMaintenance->supplier_id = $request->input('supplier_id');
$assetMaintenance->is_warranty = $request->input('is_warranty'); $assetMaintenance->is_warranty = $request->input('is_warranty');
$assetMaintenance->cost = e($request->input('cost')); $assetMaintenance->cost = Helper::ParseCurrency($request->input('cost'));
$assetMaintenance->notes = e($request->input('notes')); $assetMaintenance->notes = e($request->input('notes'));
$asset = Asset::find(e($request->input('asset_id'))); $asset = Asset::find(e($request->input('asset_id')));
@ -162,7 +162,7 @@ class AssetMaintenancesController extends Controller
$assetMaintenance->supplier_id = e($request->input('supplier_id')); $assetMaintenance->supplier_id = e($request->input('supplier_id'));
$assetMaintenance->is_warranty = e($request->input('is_warranty')); $assetMaintenance->is_warranty = e($request->input('is_warranty'));
$assetMaintenance->cost = Helper::ParseFloat(e($request->input('cost'))); $assetMaintenance->cost = Helper::ParseCurrency($request->input('cost'));
$assetMaintenance->notes = e($request->input('notes')); $assetMaintenance->notes = e($request->input('notes'));
$asset = Asset::find(request('asset_id')); $asset = Asset::find(request('asset_id'));

View file

@ -493,7 +493,7 @@ class AssetsController extends Controller
$asset->depreciate = '0'; $asset->depreciate = '0';
$asset->status_id = $request->get('status_id', 0); $asset->status_id = $request->get('status_id', 0);
$asset->warranty_months = $request->get('warranty_months', null); $asset->warranty_months = $request->get('warranty_months', null);
$asset->purchase_cost = Helper::ParseFloat($request->get('purchase_cost')); $asset->purchase_cost = Helper::ParseCurrency($request->get('purchase_cost')); // this is the API's store method, so I don't know that I want to do this? Confusing. FIXME (or not?!)
$asset->purchase_date = $request->get('purchase_date', null); $asset->purchase_date = $request->get('purchase_date', null);
$asset->assigned_to = $request->get('assigned_to', null); $asset->assigned_to = $request->get('assigned_to', null);
$asset->supplier_id = $request->get('supplier_id', 0); $asset->supplier_id = $request->get('supplier_id', 0);

View file

@ -100,7 +100,7 @@ class AssetMaintenancesController extends Controller
$assetMaintenance = new AssetMaintenance(); $assetMaintenance = new AssetMaintenance();
$assetMaintenance->supplier_id = $request->input('supplier_id'); $assetMaintenance->supplier_id = $request->input('supplier_id');
$assetMaintenance->is_warranty = $request->input('is_warranty'); $assetMaintenance->is_warranty = $request->input('is_warranty');
$assetMaintenance->cost = $request->input('cost'); $assetMaintenance->cost = Helper::ParseCurrency($request->input('cost'));
$assetMaintenance->notes = $request->input('notes'); $assetMaintenance->notes = $request->input('notes');
$asset = Asset::find($request->input('asset_id')); $asset = Asset::find($request->input('asset_id'));
@ -211,7 +211,7 @@ class AssetMaintenancesController extends Controller
$assetMaintenance->supplier_id = $request->input('supplier_id'); $assetMaintenance->supplier_id = $request->input('supplier_id');
$assetMaintenance->is_warranty = $request->input('is_warranty'); $assetMaintenance->is_warranty = $request->input('is_warranty');
$assetMaintenance->cost = Helper::ParseFloat($request->input('cost')); $assetMaintenance->cost = Helper::ParseCurrency($request->input('cost'));
$assetMaintenance->notes = $request->input('notes'); $assetMaintenance->notes = $request->input('notes');
$asset = Asset::find(request('asset_id')); $asset = Asset::find(request('asset_id'));

View file

@ -138,7 +138,7 @@ class AssetsController extends Controller
$asset->depreciate = '0'; $asset->depreciate = '0';
$asset->status_id = request('status_id', 0); $asset->status_id = request('status_id', 0);
$asset->warranty_months = request('warranty_months', null); $asset->warranty_months = request('warranty_months', null);
$asset->purchase_cost = Helper::ParseFloat($request->get('purchase_cost')); $asset->purchase_cost = Helper::ParseCurrency($request->get('purchase_cost'));
$asset->purchase_date = request('purchase_date', null); $asset->purchase_date = request('purchase_date', null);
$asset->assigned_to = request('assigned_to', null); $asset->assigned_to = request('assigned_to', null);
$asset->supplier_id = request('supplier_id', 0); $asset->supplier_id = request('supplier_id', 0);
@ -302,7 +302,7 @@ class AssetsController extends Controller
$asset->status_id = $request->input('status_id', null); $asset->status_id = $request->input('status_id', null);
$asset->warranty_months = $request->input('warranty_months', null); $asset->warranty_months = $request->input('warranty_months', null);
$asset->purchase_cost = Helper::ParseFloat($request->input('purchase_cost', null)); $asset->purchase_cost = Helper::ParseCurrency($request->input('purchase_cost', null));
$asset->purchase_date = $request->input('purchase_date', null); $asset->purchase_date = $request->input('purchase_date', null);
$asset->supplier_id = $request->input('supplier_id', null); $asset->supplier_id = $request->input('supplier_id', null);
$asset->expected_checkin = $request->input('expected_checkin', null); $asset->expected_checkin = $request->input('expected_checkin', null);

View file

@ -102,7 +102,7 @@ class BulkAssetsController extends Controller
->conditionallyAddItem('warranty_months'); ->conditionallyAddItem('warranty_months');
if ($request->filled('purchase_cost')) { if ($request->filled('purchase_cost')) {
$this->update_array['purchase_cost'] = Helper::ParseFloat($request->input('purchase_cost')); $this->update_array['purchase_cost'] = Helper::ParseCurrency($request->input('purchase_cost'));
} }
if ($request->filled('company_id')) { if ($request->filled('company_id')) {

View file

@ -5,6 +5,7 @@ use App\Http\Controllers\Controller;
use App\Http\Requests\ImageUploadRequest; use App\Http\Requests\ImageUploadRequest;
use App\Models\Company; use App\Models\Company;
use App\Models\Component; use App\Models\Component;
use App\Helpers\Helper;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
@ -74,7 +75,7 @@ class ComponentsController extends Controller
$component->min_amt = $request->input('min_amt', null); $component->min_amt = $request->input('min_amt', null);
$component->serial = $request->input('serial', null); $component->serial = $request->input('serial', null);
$component->purchase_date = $request->input('purchase_date', null); $component->purchase_date = $request->input('purchase_date', null);
$component->purchase_cost = $request->input('purchase_cost', null); $component->purchase_cost = Helper::ParseCurrency($request->input('purchase_cost', null));
$component->qty = $request->input('qty'); $component->qty = $request->input('qty');
$component->user_id = Auth::id(); $component->user_id = Auth::id();
@ -144,7 +145,7 @@ class ComponentsController extends Controller
$component->min_amt = $request->input('min_amt'); $component->min_amt = $request->input('min_amt');
$component->serial = $request->input('serial'); $component->serial = $request->input('serial');
$component->purchase_date = $request->input('purchase_date'); $component->purchase_date = $request->input('purchase_date');
$component->purchase_cost = request('purchase_cost'); $component->purchase_cost = Helper::ParseCurrency(request('purchase_cost'));
$component->qty = $request->input('qty'); $component->qty = $request->input('qty');
$component = $request->handleImages($component); $component = $request->handleImages($component);

View file

@ -75,7 +75,7 @@ class ConsumablesController extends Controller
$consumable->model_number = $request->input('model_number'); $consumable->model_number = $request->input('model_number');
$consumable->item_no = $request->input('item_no'); $consumable->item_no = $request->input('item_no');
$consumable->purchase_date = $request->input('purchase_date'); $consumable->purchase_date = $request->input('purchase_date');
$consumable->purchase_cost = Helper::ParseFloat($request->input('purchase_cost')); $consumable->purchase_cost = Helper::ParseCurrency($request->input('purchase_cost'));
$consumable->qty = $request->input('qty'); $consumable->qty = $request->input('qty');
$consumable->user_id = Auth::id(); $consumable->user_id = Auth::id();
@ -141,7 +141,7 @@ class ConsumablesController extends Controller
$consumable->model_number = $request->input('model_number'); $consumable->model_number = $request->input('model_number');
$consumable->item_no = $request->input('item_no'); $consumable->item_no = $request->input('item_no');
$consumable->purchase_date = $request->input('purchase_date'); $consumable->purchase_date = $request->input('purchase_date');
$consumable->purchase_cost = Helper::ParseFloat($request->input('purchase_cost')); $consumable->purchase_cost = Helper::ParseCurrency($request->input('purchase_cost'));
$consumable->qty = Helper::ParseFloat($request->input('qty')); $consumable->qty = Helper::ParseFloat($request->input('qty'));
$consumable = $request->handleImages($consumable); $consumable = $request->handleImages($consumable);

View file

@ -88,7 +88,7 @@ class LicensesController extends Controller
$license->name = $request->input('name'); $license->name = $request->input('name');
$license->notes = $request->input('notes'); $license->notes = $request->input('notes');
$license->order_number = $request->input('order_number'); $license->order_number = $request->input('order_number');
$license->purchase_cost = $request->input('purchase_cost'); $license->purchase_cost = Helper::ParseCurrency($request->input('purchase_cost'));
$license->purchase_date = $request->input('purchase_date'); $license->purchase_date = $request->input('purchase_date');
$license->purchase_order = $request->input('purchase_order'); $license->purchase_order = $request->input('purchase_order');
$license->purchase_order = $request->input('purchase_order'); $license->purchase_order = $request->input('purchase_order');
@ -165,7 +165,7 @@ class LicensesController extends Controller
$license->name = $request->input('name'); $license->name = $request->input('name');
$license->notes = $request->input('notes'); $license->notes = $request->input('notes');
$license->order_number = $request->input('order_number'); $license->order_number = $request->input('order_number');
$license->purchase_cost = $request->input('purchase_cost'); $license->purchase_cost = Helper::ParseCurrency($request->input('purchase_cost'));
$license->purchase_date = $request->input('purchase_date'); $license->purchase_date = $request->input('purchase_date');
$license->purchase_order = $request->input('purchase_order'); $license->purchase_order = $request->input('purchase_order');
$license->reassignable = $request->input('reassignable', 0); $license->reassignable = $request->input('reassignable', 0);

View file

@ -559,7 +559,7 @@ class ReportsController extends Controller
foreach ($customfields as $customfield) { foreach ($customfields as $customfield) {
if (e($request->input($customfield->db_column_name())) == '1') { if ($request->input($customfield->db_column_name()) == '1') {
$header[] = $customfield->name; $header[] = $customfield->name;
} }
} }

View file

@ -31,7 +31,8 @@ class LicensesTransformer
'purchase_date' => Helper::getFormattedDateObject($license->purchase_date, 'date'), 'purchase_date' => Helper::getFormattedDateObject($license->purchase_date, 'date'),
'termination_date' => Helper::getFormattedDateObject($license->termination_date, 'date'), 'termination_date' => Helper::getFormattedDateObject($license->termination_date, 'date'),
'depreciation' => ($license->depreciation) ? ['id' => (int) $license->depreciation->id,'name'=> e($license->depreciation->name)] : null, 'depreciation' => ($license->depreciation) ? ['id' => (int) $license->depreciation->id,'name'=> e($license->depreciation->name)] : null,
'purchase_cost' => e($license->purchase_cost), 'purchase_cost' => Helper::formatCurrencyOutput($license->purchase_cost),
'purchase_cost_numeric' => $license->purchase_cost,
'notes' => e($license->notes), 'notes' => e($license->notes),
'expiration_date' => Helper::getFormattedDateObject($license->expiration_date, 'date'), 'expiration_date' => Helper::getFormattedDateObject($license->expiration_date, 'date'),
'seats' => (int) $license->seats, 'seats' => (int) $license->seats,

View file

@ -407,6 +407,7 @@ return [
'Google2FA' => PragmaRX\Google2FALaravel\Facade::class, 'Google2FA' => PragmaRX\Google2FALaravel\Facade::class,
'Image' => Intervention\Image\ImageServiceProvider::class, 'Image' => Intervention\Image\ImageServiceProvider::class,
'Carbon' => Carbon\Carbon::class, 'Carbon' => Carbon\Carbon::class,
'Helper' => App\Helpers\Helper::class, // makes it much easier to use 'Helper::blah' in blades (which is where we usually use this)
], ],

View file

@ -81,7 +81,7 @@ use Carbon\Carbon;
<div class="row"> <div class="row">
<div class="col-md-3 col-sm-3" style="padding-bottom: 10px; margin-left: 15px; word-wrap: break-word;"> <div class="col-md-3 col-sm-3" style="padding-bottom: 10px; margin-left: 15px; word-wrap: break-word;">
<strong>{{ trans('admin/asset_maintenances/form.cost') }}: </strong> <strong>{{ trans('admin/asset_maintenances/form.cost') }}: </strong>
{{ sprintf( trans( 'general.currency' ) . '%01.2f', $assetMaintenance->cost) }} {{ trans( 'general.currency' ) . Helper::formatCurrencyOutput($assetMaintenance->cost) }}
</div> </div>
<div class="col-md-3 col-sm-3" style="padding-bottom: 10px; margin-left: 15px; word-wrap: break-word;"> <div class="col-md-3 col-sm-3" style="padding-bottom: 10px; margin-left: 15px; word-wrap: break-word;">
<strong>{{ trans('admin/asset_maintenances/form.is_warranty') }}: </strong> <strong>{{ trans('admin/asset_maintenances/form.is_warranty') }}: </strong>

View file

@ -1,447 +0,0 @@
@extends('layouts/default')
{{-- Page title --}}
@section('title')
{{ trans('admin/hardware/general.view') }} {{ $asset->asset_tag }}
@parent
@stop
{{-- Page content --}}
@section('content')
<div class="row header">
<div class="col-md-12">
<h2 class="name">
{{ trans('admin/hardware/general.view') }}
{{ $asset->asset_tag }}
@if ($asset->name)
({{ $asset->name }})
@endif
</h2>
<div class="btn-group pull-right">
<div class="dropdown">
<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" aria-labelledby="dropdownMenu1">
@if ($asset->status_id == 1)
@if ($asset->assigned_to != 0)
<li role="presentation"><a href="{{ route('checkin/hardware', $asset->id) }}">{{ trans('admin/hardware/general.checkin') }}</a></li>
@endif
@elseif ($asset->status_id == 0)
<li role="presentation"><a href="{{ route('checkout/hardware', $asset->id) }}">{{ trans('admin/hardware/general.checkout') }}</a></li>
@endif
<li role="presentation"><a href="{{ route('hardware.edit', $asset->id) }}">{{ trans('admin/hardware/general.edit') }}</a></li>
<li role="presentation"><a href="{{ route('clone/hardware', $asset->id) }}">{{ trans('admin/hardware/general.clone') }}</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="user-profile">
<div class="row profile">
<div class="col-md-9 bio">
<div class="col-md-12">
@if ($asset->model->deleted_at!='')
<div class="alert alert-warning alert-block">
<i class="fa fa-warning"></i>
{{ trans('admin/hardware/general.model_deleted', array('model_id' => $asset->model->id)) }}
</div>
@elseif ($asset->deleted_at!='')
<div class="alert alert-warning alert-block">
<i class="fa fa-warning"></i>
{{ trans('admin/hardware/general.deleted', array('asset_id' => $asset->id)) }}
</div>
@endif
@if ($asset->serial)
<div class="col-md-12" style="padding-bottom: 5px;"><strong>{{ trans('admin/hardware/form.serial') }}: </strong>
<em>{{ $asset->serial }}</em></div>
@endif
@if ($asset->mac_address!='')
<div class="col-md-12" style="padding-bottom: 5px;"><strong>{{ trans('admin/hardware/form.mac_address') }}:</strong>
{{ $asset->mac_address }}
</div>
@endif
@if ($asset->model->manufacturer)
<div class="col-md-12" style="padding-bottom: 5px;">
<strong>{{ trans('admin/hardware/form.manufacturer') }}: </strong>
<a href="{{ route('manufacturers.edit', $asset->model->manufacturer->id) }}">
{{ $asset->model->manufacturer->name }}
</a>
</div>
<div class="col-md-12" style="padding-bottom: 5px;">
<strong>{{ trans('admin/hardware/form.model') }}:</strong>
<a href="{{ route('models.show', $asset->model->id) }}">
{{ $asset->model->name }}
</a>
/ {{ $asset->model->model_number }}
</div>
@endif
@if ($asset->purchase_date)
<div class="col-md-12" style="padding-bottom: 5px;">
<strong>{{ trans('admin/hardware/form.date') }}: </strong>
{{ $asset->purchase_date }}
</div>
@endif
@if ($asset->purchase_cost)
<div class="col-md-12" style="padding-bottom: 5px;">
<strong>{{ trans('admin/hardware/form.cost') }}:</strong>
{{ $snipeSettings->default_currency }}
{{ number_format($asset->purchase_cost,2) }}
</div>
@endif
@if ($asset->order_number)
<div class="col-md-12" style="padding-bottom: 5px;">
<strong>{{ trans('admin/hardware/form.order') }}:</strong>
{{ $asset->order_number }}
</div>
@endif
@if ($asset->supplier_id)
<div class="col-md-6" style="padding-bottom: 5px;">
<strong>{{ trans('admin/hardware/form.supplier') }}: </strong>
<a href="{{ route('suppliers.show', $asset->supplier_id) }}">
{{ $asset->supplier->name }}
</a>
</div>
@endif
@if ($asset->warranty_months)
<div class="col-md-12" style="padding-bottom: 5px;">
<strong>{{ trans('admin/hardware/form.warranty') }}:</strong>
{{ $asset->warranty_months }}
{{ trans('admin/hardware/form.months') }}
</div>
<div class="col-md-12 {{ $asset->present()->warrantee_expires() < date("Y-m-d H:i:s") ? 'ui-state-highlight' : '' }}" style="padding-bottom: 5px;">
<strong>{{ trans('admin/hardware/form.expires') }}:</strong>
{{ $asset->present()->warrantee_expires() }}
</div>
@endif
@if ($asset->depreciation)
<div class="col-md-12" style="padding-bottom: 5px;">
<strong>{{ trans('admin/hardware/form.depreciation') }}: </strong>
{{ $asset->depreciation->name }}
({{ $asset->depreciation->months }}
{{ trans('admin/hardware/form.months') }}
)
</div>
<div class="col-md-12" style="padding-bottom: 5px;">
<strong>{{ trans('admin/hardware/form.fully_depreciated') }}: </strong>
@if ($asset->time_until_depreciated()->y > 0)
{{ $asset->time_until_depreciated()->y }}
{{ trans('admin/hardware/form.years') }},
@endif
{{ $asset->time_until_depreciated()->m }}
{{ trans('admin/hardware/form.months') }}
({{ $asset->depreciated_date()->format('Y-m-d') }})
</div>
@endif
@if ($asset->model->eol)
<div class="col-md-12" style="padding-bottom: 5px;">
<strong>{{ trans('admin/hardware/form.eol_rate') }}: </strong>
{{ $asset->model->eol }}
{{ trans('admin/hardware/form.months') }}
</div>
<div class="col-md-12" style="padding-bottom: 5px;">
<strong>{{ trans('admin/hardware/form.eol_date') }}: </strong>
{{ $asset->present()->eol_date() }}
@if ($asset->present()->months_until_eol())
(
@if ($asset->present()->months_until_eol()->y > 0) {{ $asset->present()->months_until_eol()->y }}
{{ trans('general.years') }},
@endif
{{ $asset->present()->months_until_eol()->m }}
{{ trans('general.months') }}
)
@endif
</div>
@endif
</div>
<div class="col-md-12">
<!-- Licenses assets table -->
<h6>Software Assigned </h6>
<br>
<!-- checked out assets table -->
@if ($asset->licenses->count()) > 0)
<table class="table table-hover">
<thead>
<tr>
<th class="col-md-4"><span class="line"></span>{{ trans('general.name') }}</th>
<th class="col-md-4"><span class="line"></span>{{ trans('admin/licenses/form.license_key') }}</th>
<th class="col-md-1"><span class="line"></span>{{ trans('table.actions') }}</th>
</tr>
</thead>
<tbody>
@foreach ($asset->licenseseats as $seat)
<tr>
<td><a href="{{ route('licenses.show', $seat->license->id) }}">{{ $seat->license->name }}</a></td>
<td>{{ $seat->license->serial }}</td>
<td><a href="{{ route('licenses.checkin', $seat->id) }}" class="btn-flat info">{{ trans('general.checkin') }}</a>
</td>
</tr>
@endforeach
</tbody>
</table>
@else
<div class="col-md-12">
<div class="alert alert-info alert-block">
<i class="fa fa-info-circle"></i>
{{ trans('general.no_results') }}
</div>
</div>
@endif
</div>
<div class="col-md-12">
<h6>
{{ trans('general.file_uploads') }} [ <a href="#" data-toggle="modal" data-target="#uploadFileModal">{{trans('button.add')}} </a> ]
</h6>
<table class="table table-hover">
<thead>
<tr>
<th class="col-md-5">{{ trans('general.notes') }}</th>
<th class="col-md-5"><span class="line"></span>{{ trans('general.file_name') }}</th>
<th class="col-md-2"></th>
<th class="col-md-2"></th>
</tr>
</thead>
<tbody>
@if ($asset->uploads->count() > 0)
@foreach ($asset->uploads as $file)
<tr>
<td>
@if ($file->note)
{{ $file->note }}
@endif
</td>
<td>
{{ $file->filename }}
</td>
<td>
@if ($file->filename)
<a href="{{ route('show/assetfile', [$asset->id, $file->id]) }}" class="btn btn-default">{{ trans('general.download') }}</a>
@endif
</td>
<td>
<a class="btn delete-asset btn-danger btn-sm"
href="{{ route('delete/assetfile', [$asset->id, $file->id]) }}"
data-html="false" data-toggle="modal"
data-title="{{ trans('admin/hardware/message.deletefile.confirm') }}"
data-content="{{ trans('admin/hardware/message.deletefile.confirm-more',array('filename' => $file->filename)) }} " onClick="return false;">
<i class="fa fa-trash icon-white" aria-hidden="true"></i>
</a>
</td>
</tr>
@endforeach
@else
<tr>
<td colspan="4">
{{ trans('general.no_results') }}
</td>
</tr>
@endif
</tbody>
</table>
</div>
<div class="col-md-12">
<!-- checked out assets table -->
<table class="table table-hover table-fixed break-word">
<thead>
<tr>
<th class="col-md-3">{{ trans('general.date') }}</th>
<th class="col-md-2"><span class="line"></span>{{ trans('general.admin') }}</th>
<th class="col-md-2"><span class="line"></span>{{ trans('table.actions') }}</th>
<th class="col-md-2"><span class="line"></span>{{ trans('general.user') }}</th>
<th class="col-md-3"><span class="line"></span>{{ trans('general.notes') }}</th>
</tr>
</thead>
<tbody>
'icon' => '<i class="'.$this->parseItemIcon().'"></i>',
'created_at' => date("M d, Y g:iA", strtotime($this->created_at)),
'action_type' => strtolower(trans('general.'.str_replace(' ', '_', $this->action_type))),
'admin' => $this->model->user ? $this->model->user->present()->nameUrl() : '',
'target' => $this->target(),
'item' => $this->item(),
'item_type' => $this->itemType(),
'note' => e($this->note),
@if (count($asset->assetlog) > 0)
@foreach ($asset->assetlog as $log)
@php $result = $log->present()->forDataTable();
@endphp
<tr>
<td>{{ $result['created_at'] }}</td>
<td>
{!! $result['admin'] !!}
</td>
<td>{{ $result['action_type'] }}</td>
<td>
{!! $result['target'] !!}
</td>
<td>
{{ $result['note'] }}
</td>
</tr>
@endforeach
@endif
<tr>
<td>{{ $asset->created_at }}</td>
<td>
@if (isset($asset->adminuser->id)) {{ $asset->adminuser->present()->fullName() }}
@else
{{ trans('general.unknown_admin') }}
@endif
</td>
<td>{{ trans('general.created_asset') }}</td>
<td></td>
<td>
</td>
</tr>
</tbody>
</table>
</div>
</div> <!--/.col-md-9.bio-->
<!-- side address column -->
<div class="col-md-3">
<!-- Asset notes -->
@if ($asset->notes)
<h6>{{ trans('admin/hardware/form.notes') }}:</h6>
<div class="break-word">{{ nl2br(e($asset->notes)) }}</div>
@endif
@if ($qr_code->display)
<h6>{{ trans('admin/hardware/form.qr') }}</h6>
<ul>
<li>
<img src="{{ $qr_code->url }}" />
</li>
</ul>
@endif
@if (($asset->checkedOutToUser()) && ($asset->assigned_to > 0) && ($asset->deleted_at==''))
{{-- @TODO This should be extnded for details about non users --}}
<h6><br>{{ trans('admin/hardware/form.checkedout_to') }}</h6>
<ul>
<li>
<img src="{{ $asset->assignedTo->present()->gravatar() }}" class="img-circle" style="width: 100px; margin-right: 20px;" /><br /><br />
</li>
<li>
{{ $asset->assignedTo->present()->nameUrl() }}
</li>
@if (isset($asset->location->address))
<li>
{{ $asset->location->address }}
@if (isset($asset->location->address2))
{{ $asset->location->address2 }}
@endif
</li>
@if (isset($asset->location->city))
<li>{{ $asset->location->city }}, {{ $asset->location->state }} {{ $asset->location->zip }}</li>
@endif
@endif
@if (isset($asset->assignedTo->email))
<li><br /><i class="fa fa-envelope-o"></i> <a href="mailto:{{ $asset->assignedTo->email }}">{{ $asset->assignedTo->email }}</a></li>
@endif
@if ((isset($asset->assignedTo->phone)) && ($asset->assignedTo->phone!=''))
<li><i class="fa fa-phone"></i> {{ $asset->assignedTo->phone }}</li>
@endif
</ul>
@endif
@if (($asset->status_id ) && ($asset->status_id > 0))
<!-- Status Info -->
@if ($asset->assetstatus)
<h6><br>
@if (($asset->assetstatus->deployable=='1') && ($asset->assigned_to > 0))
{{ trans('admin/hardware/general.asset') }}
{{ trans('general.deployed') }}
@else
{{ $asset->assetstatus->name }}
{{ trans('admin/hardware/general.asset') }}
@endif
<ul>
@if (($asset->assetstatus->deployable=='1') && ($asset->assigned_to > 0) && ($asset->deleted_at==''))
<li><br /><a href="{{ route('checkin/hardware', $asset->id) }}" class="btn btn-primary btn-sm">{{ trans('admin/hardware/general.checkin') }}</a></li>
@elseif ((($asset->assetstatus->deployable=='1') && (($asset->assigned_to=='') || ($asset->assigned_to==0))) && ($asset->deleted_at==''))
<li><br /><a href="{{ route('checkout/hardware', $asset->id) }}" class="btn btn-info btn-sm">{{ trans('admin/hardware/general.checkout') }}</a></li>
@elseif (($asset->deleted_at!='') && ($asset->model->deleted_at==''))
<li><br /><a href="{{ route('restore/hardware', $asset->id) }}" class="btn-flat large info ">{{ trans('admin/hardware/general.restore') }}</a></li>
@endif
</ul>
@if (($asset->assetstatus->notes) && ($asset->assigned_to==''))
<div class="col-md-12">
<div class="alert alert-info alert-block">
<i class="fa fa-info-circle"></i>
{{ $asset->assetstatus->notes }}
</div>
</div>
@endif
@endif
@endif
</div> <!-- /.col-md-3-->
</div> <!--/.row.profile-->
</div> <!--/.user-profile-->
<!-- Modal -->
<div class="modal fade" id="uploadFileModal" tabindex="-1" role="dialog" aria-labelledby="uploadFileModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h2 class="modal-title" id="uploadFileModalLabel">Upload File</h4>
</div>
{{ Form::open([
'method' => 'POST',
'route' => ['upload/asset', $asset->id],
'files' => true, 'class' => 'form-horizontal' ]) }}
<div class="modal-body">
<p><p>{{ trans('admin/hardware/general.filetype_info') }}</p>.</p>
<div class="form-group col-md-12">
<div class="input-group col-md-12">
<input class="col-md-12 form-control" type="text" name="notes" id="notes" placeholder="Notes">
</div>
</div>
<div class="form-group col-md-12">
<div class="input-group col-md-12">
{{ Form::file('assetfile[]', ['multiple' => 'multiple']) }}
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('button.cancel') }}</button>
<button type="submit" class="btn btn-primary btn-sm">{{ trans('button.upload') }}</button>
</div>
{{ Form::close() }}
</div>
</div>
</div>
@stop

View file

@ -874,7 +874,7 @@
<a href="{{ route('components.show', $component->id) }}">{{ $component->name }}</a> <a href="{{ route('components.show', $component->id) }}">{{ $component->name }}</a>
</td> </td>
<td>{{ $component->pivot->assigned_qty }}</td> <td>{{ $component->pivot->assigned_qty }}</td>
<td>{{ $component->purchase_cost }} each</td> <td>{{ Helper::formatCurrencyOutput($component->purchase_cost) }} each</td>
<?php $totalCost = $totalCost + ($component->purchase_cost *$component->pivot->assigned_qty) ?> <?php $totalCost = $totalCost + ($component->purchase_cost *$component->pivot->assigned_qty) ?>
</tr> </tr>
@endif @endif
@ -885,7 +885,7 @@
<tr> <tr>
<td colspan="2"> <td colspan="2">
</td> </td>
<td>{{ $totalCost }}</td> <td>{{ Helper::formatCurrencyOutput($totalCost) }}</td>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>

View file

@ -601,8 +601,8 @@
} }
if ("{{$snipeSettings->digit_separator}}" == "1.234,56") { if ("{{$snipeSettings->digit_separator}}" == "1.234,56") {
// yank periods, change commas to periods // yank periods, change commas to periods
periodless = number.toString().replace("\.",""); periodless = number.toString().replace(/\./g,"");
decimalfixed = periodless.replace(",","."); decimalfixed = periodless.replace(/,/g,".");
} else { } else {
// yank commas, that's it. // yank commas, that's it.
decimalfixed = number.toString().replace(",",""); decimalfixed = number.toString().replace(",","");

View file

@ -191,7 +191,7 @@
<td>{{ $improvement->start_date }}</td> <td>{{ $improvement->start_date }}</td>
<td>{{ $improvement->completion_date }}</td> <td>{{ $improvement->completion_date }}</td>
<td>{{ $improvement->is_warranty ? trans('admin/asset_maintenances/message.warranty') : trans('admin/asset_maintenances/message.not_warranty') }}</td> <td>{{ $improvement->is_warranty ? trans('admin/asset_maintenances/message.warranty') : trans('admin/asset_maintenances/message.not_warranty') }}</td>
<td>{{ sprintf( $snipeSettings->default_currency. '%01.2f', $improvement->cost) }}</td> <td>{{ $snipeSettings->default_currency. ' '. Helper::formatCurrencyOutput($improvement->cost) }}</td>
<?php $totalCost += $improvement->cost; ?> <?php $totalCost += $improvement->cost; ?>
<td><a href="{{ route('maintenances.edit', $improvement->id) }}" class="btn btn-warning"><i class="fa fa-pencil icon-white" aria-hidden="true"></i></a> <td><a href="{{ route('maintenances.edit', $improvement->id) }}" class="btn btn-warning"><i class="fa fa-pencil icon-white" aria-hidden="true"></i></a>
</td> </td>
@ -207,7 +207,7 @@
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
<td>{{sprintf($snipeSettings->default_currency . '%01.2f', $totalCost)}}</td> <td>{{ $snipeSettings->default_currency . ' '.Helper::formatCurrencyOutput($totalCost) }}</td>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>

View file

@ -460,7 +460,7 @@
@endcan @endcan
</td> </td>
<td class="col-md-2"> <td class="col-md-2">
{{ $license->purchase_cost }} {{ Helper::formatCurrencyOutput($license->purchase_cost) }}
</td> </td>
<td> <td>
{{ $license->purchase_order }} {{ $license->purchase_order }}
@ -512,7 +512,7 @@
<tr> <tr>
<td>{!!$accessory->present()->nameUrl()!!}</td> <td>{!!$accessory->present()->nameUrl()!!}</td>
<td> <td>
{!! $accessory->purchase_cost !!} {!! Helper::formatCurrencyOutput($accessory->purchase_cost) !!}
</td> </td>
<td class="hidden-print"> <td class="hidden-print">
@can('checkin', $accessory) @can('checkin', $accessory)
@ -558,7 +558,7 @@
<tr> <tr>
<td>{!! $consumable->present()->nameUrl() !!}</td> <td>{!! $consumable->present()->nameUrl() !!}</td>
<td> <td>
{!! $consumable->purchase_cost !!} {!! Helper::formatCurrencyOutput($consumable->purchase_cost) !!}
</td> </td>
<td>{{ $consumable->created_at }}</td> <td>{{ $consumable->created_at }}</td>
</tr> </tr>