Skip to content

A free open source IT asset/license management system

Added translation, removed commented out code

snipe1b0d855c00b9
diff --git a/app/Http/Controllers/Api/PredefinedKitsController.php b/app/Http/Controllers/Api/PredefinedKitsController.php
index 6cf0f7bca1..97e179ecb3 100644
--- a/app/Http/Controllers/Api/PredefinedKitsController.php
+++ b/app/Http/Controllers/Api/PredefinedKitsController.php
@@ -55,7 +55,7 @@ class PredefinedKitsController extends Controller
$kit->fill($request->all());
if ($kit->save()) {
- return response()->json(Helper::formatStandardApiResponse('success', $kit, 'Created was successfull')); // TODO: trans
+ return response()->json(Helper::formatStandardApiResponse('success', $kit, trans('admin/kits/general.create_success')));
}
return response()->json(Helper::formatStandardApiResponse('error', null, $kit->getErrors()));
@@ -89,7 +89,7 @@ class PredefinedKitsController extends Controller
$kit->fill($request->all());
if ($kit->save()) {
- return response()->json(Helper::formatStandardApiResponse('success', $kit, 'Update was successfull')); // TODO: trans
+ return response()->json(Helper::formatStandardApiResponse('success', $kit, trans('admin/kits/general.update_success'))); // TODO: trans
}
return response()->json(Helper::formatStandardApiResponse('error', null, $kit->getErrors()));
@@ -113,7 +113,7 @@ class PredefinedKitsController extends Controller
$kit->accessories()->detach();
$kit->delete();
- return response()->json(Helper::formatStandardApiResponse('success', null, 'Delete was successfull')); // TODO: trans
+ return response()->json(Helper::formatStandardApiResponse('success', null, trans('admin/kits/general.delete_success'))); // TODO: trans
}
@@ -214,7 +214,7 @@ class PredefinedKitsController extends Controller
$kit = PredefinedKit::findOrFail($kit_id);
$kit->licenses()->detach($license_id);
- return response()->json(Helper::formatStandardApiResponse('success', $kit, 'Delete was successfull')); // TODO: trans
+ return response()->json(Helper::formatStandardApiResponse('success', $kit, trans('admin/kits/general.delete_success')));
}
/**
@@ -238,7 +238,7 @@ class PredefinedKitsController extends Controller
*/
public function storeModel(Request $request, $kit_id)
{
- //return response()->json(Helper::formatStandardApiResponse('error', 'string11', dd($request))); // TODO: trans
+
$this->authorize('update', PredefinedKit::class);
@@ -256,7 +256,7 @@ class PredefinedKitsController extends Controller
}
$relation->attach($model_id, ['quantity' => $quantity]);
- return response()->json(Helper::formatStandardApiResponse('success', $kit, 'Model added successfull')); // TODO: trans
+ return response()->json(Helper::formatStandardApiResponse('success', $kit, 'Model added successfull'));
}
/**
@@ -291,7 +291,7 @@ class PredefinedKitsController extends Controller
$kit = PredefinedKit::findOrFail($kit_id);
$kit->models()->detach($model_id);
- return response()->json(Helper::formatStandardApiResponse('success', $kit, 'Delete was successfull')); // TODO: trans
+ return response()->json(Helper::formatStandardApiResponse('success', $kit, trans('admin/kits/general.model_removed_success')));
}
diff --git a/app/Services/PredefinedKitCheckoutService.php b/app/Services/PredefinedKitCheckoutService.php
index abc95b31a9..4249e9613b 100644
--- a/app/Services/PredefinedKitCheckoutService.php
+++ b/app/Services/PredefinedKitCheckoutService.php
@@ -95,7 +95,7 @@ class PredefinedKitCheckoutService
}
}
if ($quantity > 0) {
- $errors[] = "Don't have available assets for model " . $model->name . '. Need ' . $model->pivot->quantity . ' assets.'; // TODO: trans
+ $errors[] = trans('admin/kits/general.none_models', ['model'=> $model->name, 'qty' => $model->pivot->quantity]);
}
}
@@ -111,7 +111,7 @@ class PredefinedKitCheckoutService
foreach ($licenses as $license) {
$quantity = $license->pivot->quantity;
if ($quantity > count($license->freeSeats)) {
- $errors[] = "Don't have free seats for license " . $license->name . '. Need ' . $quantity . ' seats.'; // TODO: trans
+ $errors[] = trans('admin/kits/general.none_licenses', ['license'=> $license->name, 'qty' => $license->pivot->quantity]);
}
for ($i = 0; $i < $quantity; $i++) {
$seats_to_add[] = $license->freeSeats[$i];
@@ -122,11 +122,10 @@ class PredefinedKitCheckoutService
protected function getConsumablesToAdd($kit, &$errors)
{
- // $consumables = $kit->consumables()->withCount('consumableAssignments as consumable_assignments_count')->get();
$consumables = $kit->consumables()->with('users')->get();
foreach ($consumables as $consumable) {
if ($consumable->numRemaining() < $consumable->pivot->quantity) {
- $errors[] = "Don't have available consumable " . $consumable->name . '. Need ' . $consumable->pivot->quantity; // TODO: trans
+ $errors[] = trans('admin/kits/general.none_consumables', ['consumable'=> $consumable->name, 'qty' => $consumable->pivot->quantity]);
}
}
return $consumables;
@@ -135,9 +134,9 @@ class PredefinedKitCheckoutService
protected function getAccessoriesToAdd($kit, &$errors)
{
$accessories = $kit->accessories()->with('users')->get();
- foreach ($accessories as $accossory) {
- if ($accossory->numRemaining() < $accossory->pivot->quantity) {
- $errors[] = "Don't have available accossory " . $accossory->name . '. Need ' . $accossory->pivot->quantity; // TODO: trans
+ foreach ($accessories as $accessory) {
+ if ($accessory->numRemaining() < $accessory->pivot->quantity) {
+ $errors[] = trans('admin/kits/general.none_accessory', ['consumable'=> $accessory->name, 'qty' => $accessory->pivot->quantity]);
}
}
return $accessories;
diff --git a/resources/lang/en/admin/kits/general.php b/resources/lang/en/admin/kits/general.php
new file mode 100644
index 0000000000..030f790677
--- /dev/null
+++ b/resources/lang/en/admin/kits/general.php
@@ -0,0 +1,16 @@
+<?php
+
+return array(
+ 'about_kits' => 'About Predefined Kits',
+ 'checkout' => 'Checkout Kit ',
+ 'create_success' => 'Kit was successfully created.',
+ 'create' => 'Create Predefined Kit',
+ 'update' => 'Update Predefined Kit',
+ 'delete_success' => 'Kit was successfully deleted.',
+ 'update_success' => 'Kit was successfully updated.',
+ 'none_models' => 'There are not enough available assets for :model to checkout. :qty are required. ',
+ 'none_licenses' => 'There are not enough available seats for :license to checkout. :qty are required. ',
+ 'none_consumables' => 'There are not enough available units of :consumable to checkout. :qty are required. ',
+ 'none_accessory' => 'There are not enough available units of :accessory to checkout. :qty are required. ',
+
+);
diff --git a/resources/lang/en/general.php b/resources/lang/en/general.php
index 3c902c24eb..ec823a4877 100644
--- a/resources/lang/en/general.php
+++ b/resources/lang/en/general.php
@@ -112,6 +112,7 @@
'asset_maintenances' => 'Asset Maintenances',
'item' => 'Item',
'insufficient_permissions' => 'Insufficient permissions!',
+ 'kits' => 'Predefined Kits',
'language' => 'Language',
'last' => 'Last',
'last_login' => 'Last Login',
diff --git a/resources/views/kits/checkout.blade.php b/resources/views/kits/checkout.blade.php
index d9ca25f55f..b8e836778b 100644
--- a/resources/views/kits/checkout.blade.php
+++ b/resources/views/kits/checkout.blade.php
@@ -2,7 +2,7 @@
{{-- Page title --}}
@section('title')
- Apply predefined kit{{-- TODO: trans --}}
+ {{ trans('admin/kits/general.checkout') }}
@parent
@stop
@@ -20,9 +20,6 @@
<!-- left column -->
<div class="col-md-7">
<div class="box box-default">
- <div class="box-header with-border">
- <h3 class="box-title"> Apply predefined kit {{ $kit->name }} to user {{-- TODO: trans --}} </h3>
- </div>
<div class="box-body">
<form class="form-horizontal" method="post" action="" autocomplete="off">
{{ csrf_field() }}
@@ -64,7 +61,7 @@
</div> <!--./box-body-->
<div class="box-footer">
- <a class="btn btn-link" href="{{ URL::previous() }}"> {{ trans('button.cancel') }}</a>
+ <a class="btn btn-link" href="{{ route('kits.index') }}"> {{ trans('button.cancel') }}</a>
<button type="submit" class="btn btn-success pull-right"><i class="fa fa-check icon-white"></i> {{ trans('general.checkout') }}</button>
</div>
</div>
diff --git a/resources/views/kits/create.blade.php b/resources/views/kits/create.blade.php
index 4be2bb5dca..801f4c4800 100644
--- a/resources/views/kits/create.blade.php
+++ b/resources/views/kits/create.blade.php
@@ -1,10 +1,10 @@
@extends('layouts/edit-form', [
- 'createText' => 'Create kit',
- 'updateText' => 'Update kit',
+ 'createText' => trans('admin/kits/general.create'),
+ 'updateText' => trans('admin/kits/general.update'),
'formAction' => ($item) ? route('kits.update', ['kit' => $item->id]) : route('kits.store'),
])
{{-- Page content --}}
@section('inputFields')
-@include ('partials.forms.edit.name', ['translated_name' => 'Name']) {{-- TODO: trans --}}
-@stop
\ No newline at end of file
+@include ('partials.forms.edit.name', ['translated_name' => trans('general.name')])
+@stop
diff --git a/resources/views/kits/edit.blade.php b/resources/views/kits/edit.blade.php
index 7d26142d02..60b1c9e2d9 100644
--- a/resources/views/kits/edit.blade.php
+++ b/resources/views/kits/edit.blade.php
@@ -1,6 +1,6 @@
@extends('layouts/edit-form', [
- 'createText' => 'Create kit',
- 'updateText' => 'Update kit',
+ 'createText' => trans('admin/kits/general.create'),
+ 'updateText' => trans('admin/kits/general.update'),
'formAction' => ($item) ? route('kits.update', ['kit' => $item->id]) : route('kits.store'),
])
@@ -16,8 +16,7 @@
<div class="col-md-12">
<div class="box box-default">
<div class="box-header with-border">
- {{-- <h3 class="box-title"><span>Models </span><a href="{{ route('modal.kit.model', ['kit' => $item->id]) }}" data-toggle="modal" data-target="#createModal" class="btn btn-sm btn-primary"><i class="fa fa-plus icon-white"></i> Append</a></h3> --}}
- <h3 class="box-title"><span>Assets (by models){{-- TODO: trans --}}</span></h3>
+ <h3 class="box-title"><span>{{ trans('general.asset_models') }}</span></h3>
</div>
<div class="box-body">
<div class="table-responsive">
@@ -152,4 +151,4 @@
@section('moar_scripts')
@include ('partials.bootstrap-table')
-@stop
\ No newline at end of file
+@stop
diff --git a/resources/views/kits/index.blade.php b/resources/views/kits/index.blade.php
index 6cf41e73f7..ffc808f80d 100644
--- a/resources/views/kits/index.blade.php
+++ b/resources/views/kits/index.blade.php
@@ -2,7 +2,7 @@
{{-- Web site Title --}}
@section('title')
-Kits
+ {{ trans('general.kits') }}
@parent
@stop
@@ -39,28 +39,7 @@ Kits
}'>
</table>
</div>
- {{-- <h2>Test</h2>
- <div class="table-responsive">
- <table
- data-cookie-id-table="kitModelsTable"
- data-columns="{{ \App\Presenters\PredefinedKitPresenter::dataTableModels() }}"
- data-pagination="true"
- data-search="true"
- data-side-pagination="server"
- data-show-columns="true"
- data-show-export="true"
- data-show-refresh="true"
- data-sort-order="asc"
- data-sort-name="name"
- id="kitModelsTable"
- class="table table-striped snipe-table"
- data-url="{{ route('api.kits.models.index', 1) }}"
- data-export-options='{
- "fileName": "export-kit-models-{{ date('Y-m-d') }}",
- "ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
- }'>
- </table>
- </div> --}}
+
</div> <!--.box-body-->
</div> <!-- /.box.box-default-->
</div> <!-- .col-md-12-->