mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-02 08:21:09 -08:00
adding total cost to user view
This commit is contained in:
parent
4a5426f959
commit
6872f8da7b
|
@ -766,4 +766,24 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
|
|||
{
|
||||
return $this->locale;
|
||||
}
|
||||
public function getUserTotalCost(){
|
||||
$total_cost= array();
|
||||
$asset_cost= 0;
|
||||
$license_cost= 0;
|
||||
$accessory_cost= 0;
|
||||
foreach ($this->assets as $asset){
|
||||
$asset_cost += $asset->purchase_cost;
|
||||
array_push($total_cost, $asset_cost);
|
||||
}
|
||||
foreach ($this->licenses as $license){
|
||||
$license_cost += $license->purchase_cost;
|
||||
array_push($total_cost, $license_cost);
|
||||
}
|
||||
foreach ($this->accessories as $accessory){
|
||||
$accessory_cost += $accessory->purchase_cost;
|
||||
array_push($total_cost, $accessory_cost);
|
||||
}
|
||||
|
||||
return $total_cost;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ return array(
|
|||
'show_deleted' => 'Show Deleted Users',
|
||||
'title' => 'Title',
|
||||
'to_restore_them' => 'to restore them.',
|
||||
'total_assets_cost' => "Total Assets Cost",
|
||||
'updateuser' => 'Update User',
|
||||
'username' => 'Username',
|
||||
'user_deleted_text' => 'This user has been marked as deleted.',
|
||||
|
|
|
@ -638,6 +638,26 @@
|
|||
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-3">
|
||||
{{ trans('admin/users/table.total_assets_cost') }}
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
{{Helper::formatCurrencyOutput(array_sum(array ($user->getUserTotalCost())))}}
|
||||
<a id="optional_info" class="text-primary">
|
||||
<i class="fa fa-caret-right fa-2x" id="optional_info_icon"></i>
|
||||
<strong>{{ trans('admin/hardware/form.optional_infos') }}</strong>
|
||||
</a>
|
||||
</div>
|
||||
<div id="optional_details" class="col-md-12" style="display:none">
|
||||
<br>
|
||||
<div class="col-md-9">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div> <!--/end striped container-->
|
||||
</div> <!-- end col-md-9 -->
|
||||
|
@ -1109,6 +1129,12 @@ $(function () {
|
|||
|
||||
}
|
||||
});
|
||||
$("#optional_info").on("click",function(){
|
||||
$('#optional_details').fadeToggle(100);
|
||||
$('#optional_info_icon').toggleClass('fa-caret-right fa-caret-down');
|
||||
var optional_info_open = $('#optional_info_icon').hasClass('fa-caret-down');
|
||||
document.cookie = "optional_info_open="+optional_info_open+'; path=/';
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in a new issue