mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 23:54:12 -08:00
Merge branch 'develop'
This commit is contained in:
commit
97f65ceac0
|
@ -782,6 +782,15 @@
|
|||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "TonisOrmisson",
|
||||
"name": "Tõnis Ormisson",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/6357451?v=4",
|
||||
"profile": "http://andmemasin.eu",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[![Build Status](https://travis-ci.org/snipe/snipe-it.svg?branch=develop)](https://travis-ci.org/snipe/snipe-it) [![Stories in Ready](https://badge.waffle.io/snipe/snipe-it.png?label=ready+for+dev&title=Ready+for+development)](http://waffle.io/snipe/snipe-it) [![Maintenance](https://img.shields.io/maintenance/yes/2017.svg)]() [![Crowdin](https://d322cqt584bo4o.cloudfront.net/snipe-it/localized.svg)](https://crowdin.com/project/snipe-it) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/snipe/snipe-it?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Docker Pulls](https://img.shields.io/docker/pulls/snipe/snipe-it.svg)](https://hub.docker.com/r/snipe/snipe-it/) [![Twitter Follow](https://img.shields.io/twitter/follow/snipeyhead.svg?style=social)](https://twitter.com/snipeyhead) [![Zenhub](https://img.shields.io/badge/Shipping_faster_with-ZenHub-5e60ba.svg)](https://zenhub.io) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/553ce52037fc43ea99149785afcfe641)](https://www.codacy.com/app/snipe/snipe-it?utm_source=github.com&utm_medium=referral&utm_content=snipe/snipe-it&utm_campaign=Badge_Grade)
|
||||
[![All Contributors](https://img.shields.io/badge/all_contributors-84-orange.svg?style=flat-square)](#contributors)
|
||||
[![All Contributors](https://img.shields.io/badge/all_contributors-85-orange.svg?style=flat-square)](#contributors)
|
||||
|
||||
|
||||
## Snipe-IT - Open Source Asset Management System
|
||||
|
@ -68,6 +68,7 @@ Thanks goes to all of these wonderful people ([emoji key](https://github.com/ken
|
|||
| [<img src="https://avatars2.githubusercontent.com/u/857740?v=3" width="110px;"/><br /><sub>Gil Rutkowski</sub>](http://FlashingCursor.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=flashingcursor "Code") | [<img src="https://avatars3.githubusercontent.com/u/129360?v=3" width="110px;"/><br /><sub>Desmond Morris</sub>](http://www.desmondmorris.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=desmondmorris "Code") | [<img src="https://avatars2.githubusercontent.com/u/52936?v=3" width="110px;"/><br /><sub>Nick Peelman</sub>](http://peelman.us)<br />[💻](https://github.com/snipe/snipe-it/commits?author=peelman "Code") | [<img src="https://avatars0.githubusercontent.com/u/53161?v=3" width="110px;"/><br /><sub>Abraham Vegh</sub>](https://abrahamvegh.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=abrahamvegh "Code") | [<img src="https://avatars0.githubusercontent.com/u/2818680?v=3" width="110px;"/><br /><sub>Mohamed Rashid</sub>](https://github.com/rashivkp)<br />[📖](https://github.com/snipe/snipe-it/commits?author=rashivkp "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/1509456?v=3" width="110px;"/><br /><sub>Kasey</sub>](http://hinchk.github.io)<br />[💻](https://github.com/snipe/snipe-it/commits?author=HinchK "Code") | [<img src="https://avatars2.githubusercontent.com/u/10522541?v=3" width="110px;"/><br /><sub>Brett</sub>](https://github.com/BrettFagerlund)<br />[⚠️](https://github.com/snipe/snipe-it/commits?author=BrettFagerlund "Tests") |
|
||||
| [<img src="https://avatars2.githubusercontent.com/u/16108587?v=3" width="110px;"/><br /><sub>Jason Spriggs</sub>](http://jasonspriggs.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jasonspriggs "Code") | [<img src="https://avatars2.githubusercontent.com/u/1134568?v=3" width="110px;"/><br /><sub>Nate Felton</sub>](http://n8felton.wordpress.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=n8felton "Code") | [<img src="https://avatars2.githubusercontent.com/u/14036694?v=3" width="110px;"/><br /><sub>Manasses Ferreira</sub>](http://homepages.dcc.ufmg.br/~manassesferreira)<br />[💻](https://github.com/snipe/snipe-it/commits?author=manassesferreira "Code") | [<img src="https://avatars0.githubusercontent.com/u/15913949?v=3" width="110px;"/><br /><sub>Steve</sub>](https://github.com/steveelwood)<br />[⚠️](https://github.com/snipe/snipe-it/commits?author=steveelwood "Tests") | [<img src="https://avatars1.githubusercontent.com/u/3361683?v=3" width="110px;"/><br /><sub>matc</sub>](http://twitter.com/matc)<br />[⚠️](https://github.com/snipe/snipe-it/commits?author=matc "Tests") | [<img src="https://avatars3.githubusercontent.com/u/7405702?v=3" width="110px;"/><br /><sub>Cole R. Davis</sub>](http://www.davisracingteam.com)<br />[⚠️](https://github.com/snipe/snipe-it/commits?author=VanillaNinjaD "Tests") | [<img src="https://avatars2.githubusercontent.com/u/10167681?v=3" width="110px;"/><br /><sub>gibsonjoshua55</sub>](https://github.com/gibsonjoshua55)<br />[💻](https://github.com/snipe/snipe-it/commits?author=gibsonjoshua55 "Code") |
|
||||
| [<img src="https://avatars2.githubusercontent.com/u/2809241?v=4" width="110px;"/><br /><sub>Robin Temme</sub>](https://github.com/zwerch)<br />[💻](https://github.com/snipe/snipe-it/commits?author=zwerch "Code") | [<img src="https://avatars0.githubusercontent.com/u/6961695?v=4" width="110px;"/><br /><sub>Iman</sub>](https://github.com/imanghafoori1)<br />[💻](https://github.com/snipe/snipe-it/commits?author=imanghafoori1 "Code") | [<img src="https://avatars1.githubusercontent.com/u/6551003?v=4" width="110px;"/><br /><sub>Richard Hofman</sub>](https://github.com/richardhofman6)<br />[💻](https://github.com/snipe/snipe-it/commits?author=richardhofman6 "Code") | [<img src="https://avatars0.githubusercontent.com/u/3697569?v=4" width="110px;"/><br /><sub>gizzmojr</sub>](https://github.com/gizzmojr)<br />[💻](https://github.com/snipe/snipe-it/commits?author=gizzmojr "Code") | [<img src="https://avatars3.githubusercontent.com/u/404729?v=4" width="110px;"/><br /><sub>Jenny Li</sub>](https://github.com/imjennyli)<br />[📖](https://github.com/snipe/snipe-it/commits?author=imjennyli "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/869227?v=4" width="110px;"/><br /><sub>Geoff Young</sub>](https://github.com/GeoffYoung)<br />[💻](https://github.com/snipe/snipe-it/commits?author=GeoffYoung "Code") | [<img src="https://avatars3.githubusercontent.com/u/1068477?v=4" width="110px;"/><br /><sub>Elliot Blackburn</sub>](http://www.elliotblackburn.com)<br />[📖](https://github.com/snipe/snipe-it/commits?author=BlueHatbRit "Documentation") |
|
||||
| [<img src="https://avatars1.githubusercontent.com/u/6357451?v=4" width="110px;"/><br /><sub>Tõnis Ormisson</sub>](http://andmemasin.eu)<br />[💻](https://github.com/snipe/snipe-it/commits?author=TonisOrmisson "Code") |
|
||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||
|
||||
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
|
||||
|
|
|
@ -48,6 +48,7 @@ class RecryptFromMcrypt extends Command
|
|||
// If not, we can try to use the current APP_KEY if looks like it's old
|
||||
$legacy_key = env('LEGACY_APP_KEY');
|
||||
$key_parts = explode(':', $legacy_key);
|
||||
$legacy_cipher = env('LEGACY_CIPHER');
|
||||
$errors = array();
|
||||
|
||||
if (!$legacy_key) {
|
||||
|
@ -60,6 +61,7 @@ class RecryptFromMcrypt extends Command
|
|||
if (strlen($legacy_key) == 32) {
|
||||
$legacy_length_check = true;
|
||||
} elseif (array_key_exists('1', $key_parts) && (strlen($key_parts[1])==44)) {
|
||||
$legacy_key = base64_decode($key_parts[1],true);
|
||||
$legacy_length_check = true;
|
||||
} else {
|
||||
$legacy_length_check = false;
|
||||
|
@ -91,13 +93,17 @@ class RecryptFromMcrypt extends Command
|
|||
}
|
||||
|
||||
|
||||
if($legacy_cipher){
|
||||
$mcrypter = new McryptEncrypter($legacy_key,$legacy_cipher);
|
||||
}else{
|
||||
$mcrypter = new McryptEncrypter($legacy_key);
|
||||
}
|
||||
$settings = Setting::getSettings();
|
||||
|
||||
if ($settings->ldap_password=='') {
|
||||
$this->comment('INFO: No LDAP password found. Skipping... ');
|
||||
}
|
||||
|
||||
/** @var CustomField[] $custom_fields */
|
||||
$custom_fields = CustomField::where('field_encrypted','=', 1)->get();
|
||||
$this->comment('INFO: Retrieving encrypted custom fields...');
|
||||
|
||||
|
@ -110,32 +116,22 @@ class RecryptFromMcrypt extends Command
|
|||
|
||||
|
||||
// Get all assets with a value in any of the fields that were encrypted
|
||||
/** @var Asset[] $assets */
|
||||
$assets = $query->get();
|
||||
|
||||
$bar = $this->output->createProgressBar(count($assets));
|
||||
|
||||
foreach ($custom_fields as $encrypted_field) {
|
||||
|
||||
// Try to decrypt the payload using the legacy app key
|
||||
try {
|
||||
$decrypted_field = $mcrypter->decrypt($encrypted_field);
|
||||
$this->comment($decrypted_field);
|
||||
} catch (\Exception $e) {
|
||||
$errors[] = ' - ERROR: Could not decrypt field ['.$encrypted_field->name.']: '.$e->getMessage();
|
||||
}
|
||||
$bar->advance();
|
||||
}
|
||||
|
||||
|
||||
foreach ($assets as $asset) {
|
||||
foreach ($custom_fields as $encrypted_field) {
|
||||
$columnName = $encrypted_field->db_column;
|
||||
|
||||
// Make sure the value isn't null
|
||||
if ($asset->{$encrypted_field}!='') {
|
||||
if ($asset->{$columnName}!='') {
|
||||
// Try to decrypt the payload using the legacy app key
|
||||
try {
|
||||
$decrypted_field = $mcrypter->decrypt($asset->{$encrypted_field});
|
||||
$asset->{$encrypted_field} = \Crypt::encrypt($decrypted_field);
|
||||
$decrypted_field = $mcrypter->decrypt($asset->{$columnName});
|
||||
$asset->{$columnName} = \Crypt::encrypt($decrypted_field);
|
||||
$this->comment($decrypted_field);
|
||||
} catch (\Exception $e) {
|
||||
$errors[] = ' - ERROR: Could not decrypt field ['.$encrypted_field->name.']: '.$e->getMessage();
|
||||
|
|
|
@ -113,8 +113,22 @@ class SuppliersController extends Controller
|
|||
public function destroy($id)
|
||||
{
|
||||
$this->authorize('delete', Supplier::class);
|
||||
$supplier = Supplier::findOrFail($id);
|
||||
$supplier = Supplier::with('asset_maintenances', 'assets', 'licenses')->withCount('asset_maintenances','assets', 'licenses')->findOrFail($id);
|
||||
$this->authorize('delete', $supplier);
|
||||
|
||||
|
||||
if ($supplier->assets_count > 0) {
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/suppliers/message.delete.assoc_assets', ['asset_count' => (int) $supplier->assets_count])));
|
||||
}
|
||||
|
||||
if ($supplier->asset_maintenances_count > 0) {
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/suppliers/message.delete.assoc_maintenances', ['asset_maintenances_count' => $supplier->asset_maintenances_count])));
|
||||
}
|
||||
|
||||
if ($supplier->licenses_count > 0) {
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/suppliers/message.delete.assoc_licenses', ['licenses_count' => (int) $supplier->licenses_count])));
|
||||
}
|
||||
|
||||
$supplier->delete();
|
||||
return response()->json(Helper::formatStandardApiResponse('success', null, trans('admin/suppliers/message.delete.success')));
|
||||
|
||||
|
|
|
@ -187,6 +187,7 @@ class LicensesController extends Controller
|
|||
$license->termination_date = $request->input('termination_date');
|
||||
$license->seats = e($request->input('seats'));
|
||||
$license->manufacturer_id = $request->input('manufacturer_id');
|
||||
$license->supplier_id = $request->input('supplier_id');
|
||||
|
||||
if ($license->save()) {
|
||||
return redirect()->route('licenses.show', ['license' => $licenseId])->with('success', trans('admin/licenses/message.update.success'));
|
||||
|
|
|
@ -189,23 +189,29 @@ class SuppliersController extends Controller
|
|||
*/
|
||||
public function destroy($supplierId)
|
||||
{
|
||||
// Check if the supplier exists
|
||||
if (is_null($supplier = Supplier::find($supplierId))) {
|
||||
// Redirect to the suppliers page
|
||||
if (is_null($supplier = Supplier::with('asset_maintenances', 'assets', 'licenses')->withCount('asset_maintenances','assets','licenses')->find($supplierId))) {
|
||||
return redirect()->route('suppliers.index')->with('error', trans('admin/suppliers/message.not_found'));
|
||||
}
|
||||
|
||||
if ($supplier->num_assets() == 0) {
|
||||
// Delete the supplier
|
||||
|
||||
if ($supplier->assets_count > 0) {
|
||||
return redirect()->route('suppliers.index')->with('error', trans('admin/suppliers/message.delete.assoc_assets', ['asset_count' => (int) $supplier->assets_count]));
|
||||
}
|
||||
|
||||
if ($supplier->asset_maintenances_count > 0) {
|
||||
return redirect()->route('suppliers.index')->with('error', trans('admin/suppliers/message.delete.assoc_maintenances', ['asset_maintenances_count' => $supplier->asset_maintenances_count]));
|
||||
}
|
||||
|
||||
if ($supplier->licenses_count > 0) {
|
||||
return redirect()->route('suppliers.index')->with('error', trans('admin/suppliers/message.delete.assoc_licenses', ['licenses_count' => (int) $supplier->licenses_count]));
|
||||
}
|
||||
|
||||
$supplier->delete();
|
||||
// Redirect to the suppliers management page
|
||||
return redirect()->route('suppliers.index')->with(
|
||||
'success',
|
||||
return redirect()->route('suppliers.index')->with('success',
|
||||
trans('admin/suppliers/message.delete.success')
|
||||
);
|
||||
}
|
||||
// Redirect to the asset management page
|
||||
return redirect()->route('suppliers.index')->with('error', trans('admin/suppliers/message.assoc_users'));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@ class AccessoryPresenter extends Presenter
|
|||
"searchable" => true,
|
||||
"sortable" => true,
|
||||
"title" => trans('general.purchase_cost'),
|
||||
"footerFormatter" => 'sumFormatter',
|
||||
], [
|
||||
"field" => "order_number",
|
||||
"searchable" => true,
|
||||
|
|
|
@ -139,6 +139,7 @@ class AssetPresenter extends Presenter
|
|||
"searchable" => true,
|
||||
"sortable" => true,
|
||||
"title" => trans('general.purchase_cost'),
|
||||
"footerFormatter" => 'sumFormatter',
|
||||
], [
|
||||
"field" => "order_number",
|
||||
"searchable" => true,
|
||||
|
|
|
@ -85,6 +85,7 @@ class ComponentPresenter extends Presenter
|
|||
"sortable" => true,
|
||||
"title" => trans('general.purchase_cost'),
|
||||
"visible" => true,
|
||||
"footerFormatter" => 'sumFormatter',
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
@ -89,6 +89,7 @@ class ConsumablePresenter extends Presenter
|
|||
"sortable" => true,
|
||||
"title" => trans('general.purchase_cost'),
|
||||
"visible" => true,
|
||||
"footerFormatter" => 'sumFormatter',
|
||||
],[
|
||||
"field" => "change",
|
||||
"searchable" => false,
|
||||
|
|
|
@ -98,6 +98,7 @@ class LicensePresenter extends Presenter
|
|||
"sortable" => true,
|
||||
"visible" => false,
|
||||
"title" => trans('general.purchase_cost'),
|
||||
"footerFormatter" => 'sumFormatter',
|
||||
], [
|
||||
"field" => "purchase_order",
|
||||
"searchable" => true,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
return array(
|
||||
|
||||
'does_not_exist' => 'Supplier does not exist.',
|
||||
'assoc_users' => 'This supplier is currently associated with at least one model and cannot be deleted. Please update your models to no longer reference this supplier and try again. ',
|
||||
|
||||
|
||||
'create' => array(
|
||||
'error' => 'Supplier was not created, please try again.',
|
||||
|
@ -18,7 +18,10 @@ return array(
|
|||
'delete' => array(
|
||||
'confirm' => 'Are you sure you wish to delete this supplier?',
|
||||
'error' => 'There was an issue deleting the supplier. Please try again.',
|
||||
'success' => 'Supplier was deleted successfully.'
|
||||
'success' => 'Supplier was deleted successfully.',
|
||||
'assoc_assets' => 'This supplier is currently associated with :asset_count asset(s) and cannot be deleted. Please update your assets to no longer reference this supplier and try again. ',
|
||||
'assoc_licenses' => 'This supplier is currently associated with :licenses_count licences(s) and cannot be deleted. Please update your licenses to no longer reference this supplier and try again. ',
|
||||
'assoc_maintenances' => 'This supplier is currently associated with :asset_maintenances_count asset maintenances(s) and cannot be deleted. Please update your asset maintenances to no longer reference this supplier and try again. ',
|
||||
)
|
||||
|
||||
);
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
@include ('partials.bootstrap-table', [
|
||||
'exportFile' => 'accessories-export',
|
||||
'search' => true,
|
||||
'showFooter' => true,
|
||||
'columns' => \App\Presenters\AccessoryPresenter::dataTableLayout()
|
||||
])
|
||||
@stop
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
@stop
|
||||
|
||||
@section('moar_scripts')
|
||||
@include ('partials.bootstrap-table', ['exportFile' => 'components-export', 'search' => true, 'columns' => \App\Presenters\ComponentPresenter::dataTableLayout()])
|
||||
@include ('partials.bootstrap-table', ['exportFile' => 'components-export', 'search' => true, 'showFooter' => true, 'columns' => \App\Presenters\ComponentPresenter::dataTableLayout()])
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -40,5 +40,5 @@
|
|||
@stop
|
||||
|
||||
@section('moar_scripts')
|
||||
@include ('partials.bootstrap-table', ['exportFile' => 'consumables-export', 'search' => true,'columns' => \App\Presenters\ConsumablePresenter::dataTableLayout()])
|
||||
@include ('partials.bootstrap-table', ['exportFile' => 'consumables-export', 'search' => true,'showFooter' => true, 'columns' => \App\Presenters\ConsumablePresenter::dataTableLayout()])
|
||||
@stop
|
||||
|
|
|
@ -101,6 +101,7 @@
|
|||
@include ('partials.bootstrap-table', [
|
||||
'exportFile' => 'assets-export',
|
||||
'search' => true,
|
||||
'showFooter' => true,
|
||||
'columns' => \App\Presenters\AssetPresenter::dataTableLayout()
|
||||
])
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
@include ('partials.bootstrap-table', [
|
||||
'exportFile' => 'licenses-export',
|
||||
'search' => true,
|
||||
'showFooter' => true,
|
||||
'columns' => \App\Presenters\LicensePresenter::dataTableLayout()])
|
||||
|
||||
@stop
|
||||
|
|
|
@ -38,6 +38,9 @@ $('.snipe-table').bootstrapTable({
|
|||
cookie: true,
|
||||
cookieExpire: '2y',
|
||||
showExport: true,
|
||||
@if (isset($showFooter))
|
||||
showFooter: true,
|
||||
@endif
|
||||
showColumns: true,
|
||||
trimOnSearch: false,
|
||||
|
||||
|
@ -202,7 +205,7 @@ $('.snipe-table').bootstrapTable({
|
|||
}
|
||||
|
||||
|
||||
// This handles
|
||||
// This handles the icons and display of polymorphic entries
|
||||
function polymorphicItemFormatter(value) {
|
||||
|
||||
var item_destination = '';
|
||||
|
@ -419,6 +422,15 @@ $('.snipe-table').bootstrapTable({
|
|||
}
|
||||
}
|
||||
|
||||
function sumFormatter(data) {
|
||||
var field = this.field;
|
||||
var total_sum = data.reduce(function(sum, row) {
|
||||
return (sum) + (parseFloat(row[field]) || 0);
|
||||
}, 0);
|
||||
return total_sum.toFixed(2);
|
||||
}
|
||||
|
||||
|
||||
$(function () {
|
||||
$('#bulkEdit').click(function () {
|
||||
var selectedIds = $('.snipe-table').bootstrapTable('getSelections');
|
||||
|
@ -429,7 +441,9 @@ $('.snipe-table').bootstrapTable({
|
|||
});
|
||||
});
|
||||
|
||||
// This is necessary to make the bootstrap tooltips work inside of the wenzhixin/bootstrap-table formatters
|
||||
|
||||
// This is necessary to make the bootstrap tooltips work inside of the
|
||||
// wenzhixin/bootstrap-table formatters
|
||||
$(function() {
|
||||
$('#table').on('post-body.bs.table', function () {
|
||||
$('[data-tooltip="true"]').tooltip({
|
||||
|
@ -439,4 +453,6 @@ $('.snipe-table').bootstrapTable({
|
|||
});
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
|
|
@ -17,78 +17,29 @@
|
|||
<table
|
||||
name="maintenancesReport"
|
||||
id="table"
|
||||
class="table table-striped snipe-table"
|
||||
data-url="{{route('api.maintenances.index') }}"
|
||||
data-cookie="true"
|
||||
data-click-to-select="true"
|
||||
data-cookie-id-table="maintenancesReportTable">
|
||||
|
||||
data-cookie-id-table="maintenancesReport-{{ config('version.hash_version') }}">
|
||||
<thead>
|
||||
<tr role="row">
|
||||
<th class="col-sm-1">{{ trans('admin/companies/table.title') }}</th>
|
||||
<th class="col-sm-1">{{ trans('admin/hardware/table.asset_tag') }}</th>
|
||||
<th class="col-sm-1">{{ trans('admin/asset_maintenances/table.asset_name') }}</th>
|
||||
<th class="col-sm-1">{{ trans('general.supplier') }}</th>
|
||||
<th class="col-sm-1">{{ trans('admin/asset_maintenances/form.asset_maintenance_type') }}</th>
|
||||
<th class="col-sm-1">{{ trans('admin/asset_maintenances/form.title') }}</th>
|
||||
<th class="col-sm-1">{{ trans('admin/asset_maintenances/form.start_date') }}</th>
|
||||
<th class="col-sm-1">{{ trans('admin/asset_maintenances/form.completion_date') }}</th>
|
||||
<th class="col-sm-1">{{ trans('admin/asset_maintenances/form.asset_maintenance_time') }}</th>
|
||||
<th class="col-sm-1">{{ trans('admin/asset_maintenances/form.cost') }}</th>
|
||||
<tr>
|
||||
<th data-field="company" data-sortable="false" data-visible="false">{{ trans('admin/companies/table.title') }}</th>
|
||||
<th data-sortable="true" data-field="id" data-visible="false">{{ trans('general.id') }}</th>
|
||||
<th data-sortable="false" data-field="asset_name" data-formatter="hardwareLinkObjFormatter">{{ trans('admin/asset_maintenances/table.asset_name') }}</th>
|
||||
<th data-sortable="false" data-field="supplier" data-formatter="suppliersLinkObjFormatter">{{ trans('general.supplier') }}</th>
|
||||
<th data-searchable="true" data-sortable="true" data-field="asset_maintenance_type">{{ trans('admin/asset_maintenances/form.asset_maintenance_type') }}</th>
|
||||
<th data-searchable="true" data-sortable="true" data-field="title">{{ trans('admin/asset_maintenances/form.title') }}</th>
|
||||
<th data-searchable="true" data-sortable="false" data-field="start_date" data-formatter="dateDisplayFormatter">{{ trans('admin/asset_maintenances/form.start_date') }}</th>
|
||||
<th data-searchable="true" data-sortable="true" data-field="completion_date" data-formatter="dateDisplayFormatter">{{ trans('admin/asset_maintenances/form.completion_date') }}</th>
|
||||
<th data-searchable="true" data-sortable="true" data-field="asset_maintenance_time">{{ trans('admin/asset_maintenances/form.asset_maintenance_time') }}</th>
|
||||
<th data-searchable="true" data-sortable="true" data-field="cost" class="text-right" data-footer-formatter="sumFormatter">{{ trans('admin/asset_maintenances/form.cost') }}</th>
|
||||
<th data-searchable="true" data-sortable="true" data-field="user_id" data-formatter="usersLinkObjFormatter">{{ trans('general.admin') }}</th>
|
||||
<th data-searchable="true" data-sortable="true" data-field="notes" data-visible="false">{{ trans('admin/asset_maintenances/form.notes') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$totalDays = 0;
|
||||
$totalCost = 0;
|
||||
?>
|
||||
@foreach ($assetMaintenances as $assetMaintenance)
|
||||
<?php $assetMaintenanceTime = intval($assetMaintenance->asset_maintenance_time); ?>
|
||||
@if ($assetMaintenance->asset)
|
||||
<tr>
|
||||
<td>{{ ($assetMaintenance->asset->company) ? $assetMaintenance->asset->company->name : '' }}</td>
|
||||
<td>{{ $assetMaintenance->asset->asset_tag }}</td>
|
||||
<td>{{ $assetMaintenance->asset->name }}</td>
|
||||
<td>
|
||||
@if ($assetMaintenance->supplier)
|
||||
{{ $assetMaintenance->supplier->name }}
|
||||
@else
|
||||
(deleted supplier)
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $assetMaintenance->asset_maintenance_type }}</td>
|
||||
<td>{{ $assetMaintenance->title }}</td>
|
||||
<td>{{ $assetMaintenance->start_date }}</td>
|
||||
<td>{{ is_null($assetMaintenance->completion_date) ? trans('admin/asset_maintenances/message.asset_maintenance_incomplete') : $assetMaintenance->completion_date }}</td>
|
||||
<?php
|
||||
|
||||
if (is_null($assetMaintenance->asset_maintenance_time)) {
|
||||
$assetMaintenanceTime = intval(Carbon::now()->diffInDays(Carbon::parse($assetMaintenance->start_date)));
|
||||
}
|
||||
|
||||
?>
|
||||
<td>{{ $assetMaintenanceTime }}</td>
|
||||
<td>
|
||||
{{ $snipeSettings->default_currency }}
|
||||
{{ number_format($assetMaintenance->cost,2) }}
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
<?php
|
||||
$totalDays += $assetMaintenanceTime;
|
||||
$totalCost += floatval($assetMaintenance->cost);
|
||||
?>
|
||||
@endforeach
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="6" align="right"><strong>Totals:</strong></td>
|
||||
<td>{{number_format($totalDays)}}</td>
|
||||
<td>
|
||||
{{ $snipeSettings->default_currency }}
|
||||
{{ number_format($totalCost,2) }}
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -97,42 +48,8 @@
|
|||
@stop
|
||||
|
||||
@section('moar_scripts')
|
||||
<script src="{{ asset('js/bootstrap-table.js') }}"></script>
|
||||
<script src="{{ asset('js/extensions/cookie/bootstrap-table-cookie.js') }}"></script>
|
||||
<script src="{{ asset('js/extensions/mobile/bootstrap-table-mobile.js') }}"></script>
|
||||
<script src="{{ asset('js/extensions/export/bootstrap-table-export.js') }}"></script>
|
||||
<script src="{{ asset('js/extensions/export/tableExport.js') }}"></script>
|
||||
<script src="{{ asset('js/extensions/export/jquery.base64.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
$('#table').bootstrapTable({
|
||||
classes: 'table table-responsive table-no-bordered',
|
||||
undefinedText: '',
|
||||
iconsPrefix: 'fa',
|
||||
showRefresh: true,
|
||||
search: true,
|
||||
pageSize: {{ $snipeSettings->per_page }},
|
||||
pagination: true,
|
||||
sidePagination: 'client',
|
||||
sortable: true,
|
||||
cookie: true,
|
||||
mobileResponsive: true,
|
||||
showExport: true,
|
||||
showColumns: true,
|
||||
exportDataType: 'all',
|
||||
exportTypes: ['csv', 'txt','json', 'xml'],
|
||||
maintainSelected: true,
|
||||
paginationFirstText: "{{ trans('general.first') }}",
|
||||
paginationLastText: "{{ trans('general.last') }}",
|
||||
paginationPreText: "{{ trans('general.previous') }}",
|
||||
paginationNextText: "{{ trans('general.next') }}",
|
||||
pageList: ['10','25','50','100','150','200'],
|
||||
icons: {
|
||||
paginationSwitchDown: 'fa-caret-square-o-down',
|
||||
paginationSwitchUp: 'fa-caret-square-o-up',
|
||||
columns: 'fa-columns',
|
||||
refresh: 'fa-refresh'
|
||||
},
|
||||
|
||||
});
|
||||
</script>
|
||||
@include ('partials.bootstrap-table',
|
||||
['exportFile' => 'maintenances-export',
|
||||
'search' => true,
|
||||
'showFooter' => true ])
|
||||
@stop
|
||||
|
|
Loading…
Reference in a new issue