mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net> # Conflicts: # public/js/build/app.js # public/js/dist/all.js # public/mix-manifest.json
This commit is contained in:
commit
87c2dc5bb5
|
@ -3154,6 +3154,15 @@
|
|||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "r-xyz",
|
||||
"name": "r-xyz",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/100710244?v=4",
|
||||
"profile": "https://github.com/r-xyz",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
2
.github/workflows/codacy-analysis.yml
vendored
2
.github/workflows/codacy-analysis.yml
vendored
|
@ -36,7 +36,7 @@ jobs:
|
|||
|
||||
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
|
||||
- name: Run Codacy Analysis CLI
|
||||
uses: codacy/codacy-analysis-cli-action@v4.4.1
|
||||
uses: codacy/codacy-analysis-cli-action@v4.4.5
|
||||
with:
|
||||
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
|
||||
# You can also omit the token and run the tools that support default configurations
|
||||
|
|
|
@ -51,7 +51,7 @@ Thanks goes to all of these wonderful people ([emoji key](https://github.com/ken
|
|||
| [<img src="https://avatars.githubusercontent.com/u/111287779?v=4" width="110px;"/><br /><sub>NojoudAlshehri</sub>](https://github.com/NojoudAlshehri)<br />[💻](https://github.com/snipe/snipe-it/commits?author=NojoudAlshehri "Code") | [<img src="https://avatars.githubusercontent.com/u/54367449?v=4" width="110px;"/><br /><sub>Stefan Stidl</sub>](https://github.com/stefanstidlffg)<br />[💻](https://github.com/snipe/snipe-it/commits?author=stefanstidlffg "Code") | [<img src="https://avatars.githubusercontent.com/u/87803479?v=4" width="110px;"/><br /><sub>Quentin Aymard</sub>](https://github.com/qay21)<br />[💻](https://github.com/snipe/snipe-it/commits?author=qay21 "Code") | [<img src="https://avatars.githubusercontent.com/u/5396871?v=4" width="110px;"/><br /><sub>Grant Le Roux</sub>](https://github.com/cram42)<br />[💻](https://github.com/snipe/snipe-it/commits?author=cram42 "Code") | [<img src="https://avatars.githubusercontent.com/u/58479551?v=4" width="110px;"/><br /><sub>Bogdan</sub>](http://@singrity)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Singrity "Code") | [<img src="https://avatars.githubusercontent.com/u/3483684?v=4" width="110px;"/><br /><sub>mmanjos</sub>](https://github.com/mmanjos)<br />[💻](https://github.com/snipe/snipe-it/commits?author=mmanjos "Code") | [<img src="https://avatars.githubusercontent.com/u/7429229?v=4" width="110px;"/><br /><sub>Abdelaziz Faki</sub>](https://azooz2014.github.io/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Azooz2014 "Code") |
|
||||
| [<img src="https://avatars.githubusercontent.com/u/47315739?v=4" width="110px;"/><br /><sub>bilias</sub>](https://github.com/bilias)<br />[💻](https://github.com/snipe/snipe-it/commits?author=bilias "Code") | [<img src="https://avatars.githubusercontent.com/u/2565989?v=4" width="110px;"/><br /><sub>coach1988</sub>](https://github.com/coach1988)<br />[💻](https://github.com/snipe/snipe-it/commits?author=coach1988 "Code") | [<img src="https://avatars.githubusercontent.com/u/11910225?v=4" width="110px;"/><br /><sub>MrM</sub>](https://github.com/mauro-miatello)<br />[💻](https://github.com/snipe/snipe-it/commits?author=mauro-miatello "Code") | [<img src="https://avatars.githubusercontent.com/u/60405354?v=4" width="110px;"/><br /><sub>koiakoia</sub>](https://github.com/koiakoia)<br />[💻](https://github.com/snipe/snipe-it/commits?author=koiakoia "Code") | [<img src="https://avatars.githubusercontent.com/u/5323832?v=4" width="110px;"/><br /><sub>Mustafa Online</sub>](https://github.com/mustafa-online)<br />[💻](https://github.com/snipe/snipe-it/commits?author=mustafa-online "Code") | [<img src="https://avatars.githubusercontent.com/u/104601439?v=4" width="110px;"/><br /><sub>franceslui</sub>](https://github.com/franceslui)<br />[💻](https://github.com/snipe/snipe-it/commits?author=franceslui "Code") | [<img src="https://avatars.githubusercontent.com/u/125313163?v=4" width="110px;"/><br /><sub>Q4kK</sub>](https://github.com/Q4kK)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Q4kK "Code") |
|
||||
| [<img src="https://avatars.githubusercontent.com/u/55590532?v=4" width="110px;"/><br /><sub>squintfox</sub>](https://github.com/squintfox)<br />[💻](https://github.com/snipe/snipe-it/commits?author=squintfox "Code") | [<img src="https://avatars.githubusercontent.com/u/1380084?v=4" width="110px;"/><br /><sub>Jeff Clay</sub>](https://github.com/jeffclay)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jeffclay "Code") | [<img src="https://avatars.githubusercontent.com/u/52716446?v=4" width="110px;"/><br /><sub>Phil J R</sub>](https://github.com/PP-JN-RL)<br />[💻](https://github.com/snipe/snipe-it/commits?author=PP-JN-RL "Code") | [<img src="https://avatars.githubusercontent.com/u/1496725?v=4" width="110px;"/><br /><sub>i_virus</sub>](https://www.corelight.com/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=chandanchowdhury "Code") | [<img src="https://avatars.githubusercontent.com/u/1020541?v=4" width="110px;"/><br /><sub>Paul Grime</sub>](https://github.com/gitgrimbo)<br />[💻](https://github.com/snipe/snipe-it/commits?author=gitgrimbo "Code") | [<img src="https://avatars.githubusercontent.com/u/922815?v=4" width="110px;"/><br /><sub>Lee Porte</sub>](https://leeporte.co.uk)<br />[💻](https://github.com/snipe/snipe-it/commits?author=LeePorte "Code") | [<img src="https://avatars.githubusercontent.com/u/23613427?v=4" width="110px;"/><br /><sub>BRYAN </sub>](https://github.com/bryanlopezinc)<br />[💻](https://github.com/snipe/snipe-it/commits?author=bryanlopezinc "Code") [⚠️](https://github.com/snipe/snipe-it/commits?author=bryanlopezinc "Tests") |
|
||||
| [<img src="https://avatars.githubusercontent.com/u/64061710?v=4" width="110px;"/><br /><sub>U-H-T</sub>](https://github.com/U-H-T)<br />[💻](https://github.com/snipe/snipe-it/commits?author=U-H-T "Code") | [<img src="https://avatars.githubusercontent.com/u/5395363?v=4" width="110px;"/><br /><sub>Matt Tyree</sub>](https://github.com/Tyree)<br />[📖](https://github.com/snipe/snipe-it/commits?author=Tyree "Documentation") | [<img src="https://avatars.githubusercontent.com/u/292081?v=4" width="110px;"/><br /><sub>Florent Bervas</sub>](http://spoontux.net)<br />[💻](https://github.com/snipe/snipe-it/commits?author=FlorentDotMe "Code") | [<img src="https://avatars.githubusercontent.com/u/4498077?v=4" width="110px;"/><br /><sub>Daniel Albertsen</sub>](https://ditscheri.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=dbakan "Code") |
|
||||
| [<img src="https://avatars.githubusercontent.com/u/64061710?v=4" width="110px;"/><br /><sub>U-H-T</sub>](https://github.com/U-H-T)<br />[💻](https://github.com/snipe/snipe-it/commits?author=U-H-T "Code") | [<img src="https://avatars.githubusercontent.com/u/5395363?v=4" width="110px;"/><br /><sub>Matt Tyree</sub>](https://github.com/Tyree)<br />[📖](https://github.com/snipe/snipe-it/commits?author=Tyree "Documentation") | [<img src="https://avatars.githubusercontent.com/u/292081?v=4" width="110px;"/><br /><sub>Florent Bervas</sub>](http://spoontux.net)<br />[💻](https://github.com/snipe/snipe-it/commits?author=FlorentDotMe "Code") | [<img src="https://avatars.githubusercontent.com/u/4498077?v=4" width="110px;"/><br /><sub>Daniel Albertsen</sub>](https://ditscheri.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=dbakan "Code") | [<img src="https://avatars.githubusercontent.com/u/100710244?v=4" width="110px;"/><br /><sub>r-xyz</sub>](https://github.com/r-xyz)<br />[💻](https://github.com/snipe/snipe-it/commits?author=r-xyz "Code") |
|
||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||
|
||||
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
|
||||
|
|
|
@ -251,6 +251,7 @@ class LdapSync extends Command
|
|||
// Creating a new user.
|
||||
$user = new User;
|
||||
$user->password = $user->noPassword();
|
||||
$user->locale = app()->getLocale();
|
||||
$user->activated = 1; // newly created users can log in by default, unless AD's UAC is in use, or an active flag is set (below)
|
||||
$item['createorupdate'] = 'created';
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ class Helper
|
|||
'nl' => 'nl-NL', // Dutch
|
||||
'no' => 'no-NO', // Norwegian
|
||||
'pl' => 'pl-PL', // Polish
|
||||
'pt' => 'pt-PT', // Portuguese
|
||||
'ro' => 'ro-RO', // Romanian
|
||||
'ru' => 'ru-RU', // Russian
|
||||
'sk' => 'sk-SK', // Slovak
|
||||
|
@ -1440,7 +1441,6 @@ class Helper
|
|||
|
||||
foreach (self::$language_map as $legacy => $new) {
|
||||
if ($language_code == $legacy) {
|
||||
Log::debug('Current language is '.$legacy.', using '.$new.' instead');
|
||||
return $new;
|
||||
}
|
||||
}
|
||||
|
@ -1451,6 +1451,7 @@ class Helper
|
|||
|
||||
public static function mapBackToLegacyLocale($new_locale = null)
|
||||
{
|
||||
|
||||
if (strlen($new_locale) <= 4) {
|
||||
return $new_locale; //"new locale" apparently wasn't quite so new
|
||||
}
|
||||
|
@ -1458,12 +1459,21 @@ class Helper
|
|||
// This does a *reverse* search against our new language map array - given the value, find the *key* for it
|
||||
$legacy_locale = array_search($new_locale, self::$language_map);
|
||||
|
||||
if($legacy_locale !== false) {
|
||||
if ($legacy_locale !== false) {
|
||||
return $legacy_locale;
|
||||
}
|
||||
return $new_locale; // better that you have some weird locale that doesn't fit into our mappings anywhere than 'void'
|
||||
}
|
||||
|
||||
public static function determineLanguageDirection() {
|
||||
return in_array(app()->getLocale(),
|
||||
[
|
||||
'ar-SA',
|
||||
'fa-IR',
|
||||
'he-IL'
|
||||
]) ? 'rtl' : 'ltr';
|
||||
}
|
||||
|
||||
|
||||
static public function getRedirectOption($request, $id, $table, $asset_id = null)
|
||||
{
|
||||
|
|
|
@ -4,12 +4,12 @@ namespace App\Http\Controllers\Accessories;
|
|||
|
||||
use App\Events\CheckoutableCheckedOut;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\AccessoryCheckoutRequest;
|
||||
use App\Models\Accessory;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use \Illuminate\Contracts\View\View;
|
||||
use \Illuminate\Http\RedirectResponse;
|
||||
|
||||
|
@ -57,44 +57,29 @@ class AccessoryCheckoutController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param Request $request
|
||||
* @param int $accessoryId
|
||||
* @param int $accessory
|
||||
*/
|
||||
public function store(Request $request, $accessoryId) : RedirectResponse
|
||||
public function store(AccessoryCheckoutRequest $request, Accessory $accessory) : RedirectResponse
|
||||
{
|
||||
// Check if the accessory exists
|
||||
if (is_null($accessory = Accessory::withCount('users as users_count')->find($accessoryId))) {
|
||||
// Redirect to the accessory management page with error
|
||||
return redirect()->route('accessories.index')->with('error', trans('admin/accessories/message.user_not_found'));
|
||||
}
|
||||
|
||||
$this->authorize('checkout', $accessory);
|
||||
$accessory->assigned_to = $request->input('assigned_to');
|
||||
$user = User::find($request->input('assigned_to'));
|
||||
$accessory->checkout_qty = $request->input('checkout_qty', 1);
|
||||
|
||||
if (!$user = User::find($request->input('assigned_to'))) {
|
||||
return redirect()->route('accessories.checkout.show', $accessory->id)->with('error', trans('admin/accessories/message.checkout.user_does_not_exist'));
|
||||
for ($i = 0; $i < $accessory->checkout_qty; $i++) {
|
||||
$accessory->users()->attach($accessory->id, [
|
||||
'accessory_id' => $accessory->id,
|
||||
'created_at' => Carbon::now(),
|
||||
'user_id' => Auth::id(),
|
||||
'assigned_to' => $request->input('assigned_to'),
|
||||
'note' => $request->input('note'),
|
||||
]);
|
||||
}
|
||||
|
||||
// Make sure there is at least one available to checkout
|
||||
if ($accessory->numRemaining() <= 0){
|
||||
return redirect()->route('accessories.index')->with('error', trans('admin/accessories/message.checkout.unavailable'));
|
||||
}
|
||||
|
||||
|
||||
// Update the accessory data
|
||||
$accessory->assigned_to = e($request->input('assigned_to'));
|
||||
|
||||
$accessory->users()->attach($accessory->id, [
|
||||
'accessory_id' => $accessory->id,
|
||||
'created_at' => Carbon::now(),
|
||||
'user_id' => Auth::id(),
|
||||
'assigned_to' => $request->get('assigned_to'),
|
||||
'note' => $request->input('note'),
|
||||
]);
|
||||
|
||||
DB::table('accessories_users')->where('assigned_to', '=', $accessory->assigned_to)->where('accessory_id', '=', $accessory->id)->first();
|
||||
|
||||
event(new CheckoutableCheckedOut($accessory, $user, auth()->user(), $request->input('note')));
|
||||
|
||||
// Redirect to the new accessory page
|
||||
return redirect()->route('accessories.index')->with('success', trans('admin/accessories/message.checkout.success'));
|
||||
return redirect()->route('accessories.index')
|
||||
->with('success', trans('admin/accessories/message.checkout.success'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ namespace App\Http\Controllers\Api;
|
|||
use App\Events\CheckoutableCheckedOut;
|
||||
use App\Helpers\Helper;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\AccessoryCheckoutRequest;
|
||||
use App\Http\Requests\StoreAccessoryRequest;
|
||||
use App\Http\Transformers\AccessoriesTransformer;
|
||||
use App\Http\Transformers\SelectlistTransformer;
|
||||
use App\Models\Accessory;
|
||||
|
@ -121,12 +123,12 @@ class AccessoriesController extends Controller
|
|||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\ImageUploadRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v4.0]
|
||||
* @param \App\Http\Requests\ImageUploadRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(ImageUploadRequest $request)
|
||||
public function store(StoreAccessoryRequest $request)
|
||||
{
|
||||
$this->authorize('create', Accessory::class);
|
||||
$accessory = new Accessory;
|
||||
|
@ -144,10 +146,10 @@ class AccessoriesController extends Controller
|
|||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return array
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v4.0]
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
|
@ -161,10 +163,10 @@ class AccessoriesController extends Controller
|
|||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return array
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v4.0]
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function accessory_detail($id)
|
||||
{
|
||||
|
@ -273,43 +275,31 @@ class AccessoriesController extends Controller
|
|||
* If Slack is enabled and/or asset acceptance is enabled, it will also
|
||||
* trigger a Slack message and send an email.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $accessoryId
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
*/
|
||||
public function checkout(Request $request, $accessoryId)
|
||||
public function checkout(AccessoryCheckoutRequest $request, Accessory $accessory)
|
||||
{
|
||||
// Check if the accessory exists
|
||||
if (is_null($accessory = Accessory::withCount('users as users_count')->find($accessoryId))) {
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/accessories/message.does_not_exist')));
|
||||
}
|
||||
|
||||
$this->authorize('checkout', $accessory);
|
||||
$accessory->assigned_to = $request->input('assigned_to');
|
||||
$user = User::find($request->input('assigned_to'));
|
||||
$accessory->checkout_qty = $request->input('checkout_qty', 1);
|
||||
|
||||
|
||||
if ($accessory->numRemaining() > 0) {
|
||||
|
||||
if (! $user = User::find($request->input('assigned_to'))) {
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/accessories/message.checkout.user_does_not_exist')));
|
||||
}
|
||||
|
||||
// Update the accessory data
|
||||
$accessory->assigned_to = $request->input('assigned_to');
|
||||
|
||||
for ($i = 0; $i < $accessory->checkout_qty; $i++) {
|
||||
$accessory->users()->attach($accessory->id, [
|
||||
'accessory_id' => $accessory->id,
|
||||
'created_at' => Carbon::now(),
|
||||
'user_id' => Auth::id(),
|
||||
'assigned_to' => $request->get('assigned_to'),
|
||||
'note' => $request->get('note'),
|
||||
'assigned_to' => $request->input('assigned_to'),
|
||||
'note' => $request->input('note'),
|
||||
]);
|
||||
|
||||
event(new CheckoutableCheckedOut($accessory, $user, auth()->user(), $request->input('note')));
|
||||
|
||||
return response()->json(Helper::formatStandardApiResponse('success', null, trans('admin/accessories/message.checkout.success')));
|
||||
}
|
||||
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, 'No accessories remaining'));
|
||||
// Set this value to be able to pass the qty through to the event
|
||||
event(new CheckoutableCheckedOut($accessory, $user, auth()->user(), $request->input('note')));
|
||||
|
||||
return response()->json(Helper::formatStandardApiResponse('success', null, trans('admin/accessories/message.checkout.success')));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ class CustomFieldsetsController extends Controller
|
|||
return redirect()->route('fieldsets.show', [$id])->with('success', trans('admin/custom_fields/message.field.create.assoc_success'));
|
||||
}
|
||||
|
||||
return redirect()->route('fieldsets.show', [$id])->with('error', 'No field selected.');
|
||||
return redirect()->route('fieldsets.show', [$id])->with('error', trans('admin/custom_fields/message.field.none_selected'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -94,14 +94,14 @@ class LicenseCheckoutController extends Controller
|
|||
|
||||
if (! $licenseSeat) {
|
||||
if ($seatId) {
|
||||
throw new \Illuminate\Http\Exceptions\HttpResponseException(redirect()->route('licenses.index')->with('error', 'This Seat is not available for checkout.'));
|
||||
throw new \Illuminate\Http\Exceptions\HttpResponseException(redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.checkout.unavailable')));
|
||||
}
|
||||
|
||||
throw new \Illuminate\Http\Exceptions\HttpResponseException(redirect()->route('licenses.index')->with('error', 'There are no available seats for this license.'));
|
||||
throw new \Illuminate\Http\Exceptions\HttpResponseException(redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.checkout.not_enough_seats')));
|
||||
}
|
||||
|
||||
if (! $licenseSeat->license->is($license)) {
|
||||
throw new \Illuminate\Http\Exceptions\HttpResponseException(redirect()->route('licenses.index')->with('error', 'The license seat provided does not match the license.'));
|
||||
throw new \Illuminate\Http\Exceptions\HttpResponseException(redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.checkout.mismatch')));
|
||||
}
|
||||
|
||||
return $licenseSeat;
|
||||
|
|
|
@ -43,10 +43,12 @@ class Kernel extends HttpKernel
|
|||
\Laravel\Passport\Http\Middleware\CreateFreshApiToken::class,
|
||||
\App\Http\Middleware\AssetCountForSidebar::class,
|
||||
\Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
'auth:api',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ class CheckLocale
|
|||
|
||||
}
|
||||
|
||||
\App::setLocale(Helper::mapLegacyLocale($language));
|
||||
app()->setLocale(Helper::mapLegacyLocale($language));
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
|
79
app/Http/Requests/AccessoryCheckoutRequest.php
Normal file
79
app/Http/Requests/AccessoryCheckoutRequest.php
Normal file
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Models\Accessory;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
|
||||
class AccessoryCheckoutRequest extends ImageUploadRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return Gate::allows('checkout', new Accessory);
|
||||
}
|
||||
|
||||
public function prepareForValidation(): void
|
||||
{
|
||||
|
||||
if ($this->accessory) {
|
||||
|
||||
$this->diff = ($this->accessory->numRemaining() - $this->checkout_qty);
|
||||
$this->merge([
|
||||
'checkout_qty' => $this->checkout_qty ?? 1,
|
||||
'number_remaining_after_checkout' => (int) ($this->accessory->numRemaining() - $this->checkout_qty),
|
||||
'number_currently_remaining' => (int) $this->accessory->numRemaining(),
|
||||
'checkout_difference' => (int) $this->diff,
|
||||
]);
|
||||
|
||||
\Log::debug('---------------------------------------------');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
|
||||
return array_merge(
|
||||
[
|
||||
'assigned_to' => [
|
||||
'required',
|
||||
'integer',
|
||||
'exists:users,id,deleted_at,NULL',
|
||||
'not_array'
|
||||
],
|
||||
|
||||
'number_remaining_after_checkout' => [
|
||||
'min:0',
|
||||
'required',
|
||||
'integer',
|
||||
],
|
||||
|
||||
'checkout_qty' => [
|
||||
'integer',
|
||||
'lte:number_currently_remaining',
|
||||
'min:1',
|
||||
],
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
$messages = [
|
||||
'checkout_qty.lte' => trans_choice('admin/accessories/message.checkout.checkout_qty.lte', $this->number_currently_remaining, [
|
||||
'number_currently_remaining' => $this->number_currently_remaining,
|
||||
'checkout_qty' => $this->checkout_qty,
|
||||
]),
|
||||
];
|
||||
return $messages;
|
||||
}
|
||||
}
|
56
app/Http/Requests/StoreAccessoryRequest.php
Normal file
56
app/Http/Requests/StoreAccessoryRequest.php
Normal file
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Models\Accessory;
|
||||
use App\Models\Category;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
|
||||
class StoreAccessoryRequest extends ImageUploadRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return Gate::allows('create', new Accessory);
|
||||
}
|
||||
|
||||
public function prepareForValidation(): void
|
||||
{
|
||||
|
||||
if ($this->category_id) {
|
||||
if ($category = Category::find($this->category_id)) {
|
||||
$this->merge([
|
||||
'category_type' => $category->category_type ?? null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return array_merge(
|
||||
['category_type' => 'in:accessory'],
|
||||
parent::rules(),
|
||||
);
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
$messages = ['category_type.in' => trans('admin/accessories/message.invalid_category_type')];
|
||||
return $messages;
|
||||
}
|
||||
|
||||
public function response(array $errors)
|
||||
{
|
||||
return $this->redirector->back()->withInput()->withErrors($errors, $this->errorBag);
|
||||
}
|
||||
}
|
|
@ -256,7 +256,7 @@ class ActionlogsTransformer
|
|||
|
||||
$clean_meta['rtd_location_id']['old'] = $clean_meta['rtd_location_id']['old'] ? "[id: ".$clean_meta['rtd_location_id']['old']."] ". $oldRtdName : '';
|
||||
$clean_meta['rtd_location_id']['new'] = $clean_meta['rtd_location_id']['new'] ? "[id: ".$clean_meta['rtd_location_id']['new']."] ". $newRtdName : '';
|
||||
$clean_meta['Default Location'] = $clean_meta['rtd_location_id'];
|
||||
$clean_meta[trans('admin/hardware/form.default_location')] = $clean_meta['rtd_location_id'];
|
||||
unset($clean_meta['rtd_location_id']);
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ class ActionlogsTransformer
|
|||
|
||||
$clean_meta['location_id']['old'] = $clean_meta['location_id']['old'] ? "[id: ".$clean_meta['location_id']['old']."] ". $oldLocationName : '';
|
||||
$clean_meta['location_id']['new'] = $clean_meta['location_id']['new'] ? "[id: ".$clean_meta['location_id']['new']."] ". $newLocationName : '';
|
||||
$clean_meta['Current Location'] = $clean_meta['location_id'];
|
||||
$clean_meta[trans('admin/locations/message.current_location')] = $clean_meta['location_id'];
|
||||
unset($clean_meta['location_id']);
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,7 @@ class ActionlogsTransformer
|
|||
$clean_meta['model_id']['old'] = "[id: ".$clean_meta['model_id']['old']."] ".$oldModelName;
|
||||
$clean_meta['model_id']['new'] = "[id: ".$clean_meta['model_id']['new']."] ".$newModelName; /** model is required at asset creation */
|
||||
|
||||
$clean_meta['Model'] = $clean_meta['model_id'];
|
||||
$clean_meta[trans('admin/hardware/form.model')] = $clean_meta['model_id'];
|
||||
unset($clean_meta['model_id']);
|
||||
}
|
||||
if(array_key_exists('company_id', $clean_meta)) {
|
||||
|
@ -300,7 +300,7 @@ class ActionlogsTransformer
|
|||
|
||||
$clean_meta['company_id']['old'] = $clean_meta['company_id']['old'] ? "[id: ".$clean_meta['company_id']['old']."] ". $oldCompanyName : trans('general.unassigned');
|
||||
$clean_meta['company_id']['new'] = $clean_meta['company_id']['new'] ? "[id: ".$clean_meta['company_id']['new']."] ". $newCompanyName : trans('general.unassigned');
|
||||
$clean_meta['Company'] = $clean_meta['company_id'];
|
||||
$clean_meta[trans('general.company')] = $clean_meta['company_id'];
|
||||
unset($clean_meta['company_id']);
|
||||
}
|
||||
if(array_key_exists('supplier_id', $clean_meta)) {
|
||||
|
@ -313,7 +313,7 @@ class ActionlogsTransformer
|
|||
|
||||
$clean_meta['supplier_id']['old'] = $clean_meta['supplier_id']['old'] ? "[id: ".$clean_meta['supplier_id']['old']."] ". $oldSupplierName : trans('general.unassigned');
|
||||
$clean_meta['supplier_id']['new'] = $clean_meta['supplier_id']['new'] ? "[id: ".$clean_meta['supplier_id']['new']."] ". $newSupplierName : trans('general.unassigned');
|
||||
$clean_meta['Supplier'] = $clean_meta['supplier_id'];
|
||||
$clean_meta[trans('general.supplier')] = $clean_meta['supplier_id'];
|
||||
unset($clean_meta['supplier_id']);
|
||||
}
|
||||
if(array_key_exists('status_id', $clean_meta)) {
|
||||
|
@ -326,11 +326,11 @@ class ActionlogsTransformer
|
|||
|
||||
$clean_meta['status_id']['old'] = $clean_meta['status_id']['old'] ? "[id: ".$clean_meta['status_id']['old']."] ". $oldStatusName : trans('general.unassigned');
|
||||
$clean_meta['status_id']['new'] = $clean_meta['status_id']['new'] ? "[id: ".$clean_meta['status_id']['new']."] ". $newStatusName : trans('general.unassigned');
|
||||
$clean_meta['Status'] = $clean_meta['status_id'];
|
||||
$clean_meta[trans('general.status_label')] = $clean_meta['status_id'];
|
||||
unset($clean_meta['status_id']);
|
||||
}
|
||||
if(array_key_exists('asset_eol_date', $clean_meta)) {
|
||||
$clean_meta['EOL date'] = $clean_meta['asset_eol_date'];
|
||||
$clean_meta[trans('admin/hardware/form.eol_date')] = $clean_meta['asset_eol_date'];
|
||||
unset($clean_meta['asset_eol_date']);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ class LicenseSeatsTransformer
|
|||
];
|
||||
|
||||
if ($seat_count != 0) {
|
||||
$array['name'] = 'Seat '.$seat_count;
|
||||
$array['name'] = trans('admin/licenses/general.seat_count', ['count' => $seat_count]);
|
||||
}
|
||||
|
||||
$permissions_array['available_actions'] = [
|
||||
|
|
|
@ -63,7 +63,7 @@ class Accessory extends SnipeModel
|
|||
'company_id' => 'integer|nullable',
|
||||
'min_amt' => 'integer|min:0|nullable',
|
||||
'purchase_cost' => 'numeric|nullable|gte:0',
|
||||
'purchase_date' => 'date_format:Y-m-d|nullable',
|
||||
'purchase_date' => 'date_format:Y-m-d|nullable',
|
||||
];
|
||||
|
||||
|
||||
|
@ -329,11 +329,24 @@ class Accessory extends SnipeModel
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check how many items within an accessory are checked out
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v5.0]
|
||||
* @return int
|
||||
*/
|
||||
public function numCheckedOut()
|
||||
{
|
||||
return $this->users_count ?? $this->users()->count();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check how many items of an accessory remain.
|
||||
*
|
||||
* In order to use this model method, you MUST call withCount('users as users_count')
|
||||
* on the eloquent query in the controller, otherwise $this->>users_count will be null and
|
||||
* on the eloquent query in the controller, otherwise $this->users_count will be null and
|
||||
* bad things happen.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
|
@ -342,11 +355,11 @@ class Accessory extends SnipeModel
|
|||
*/
|
||||
public function numRemaining()
|
||||
{
|
||||
$checkedout = $this->users_count;
|
||||
$checkedout = $this->numCheckedOut();
|
||||
$total = $this->qty;
|
||||
$remaining = $total - $checkedout;
|
||||
|
||||
return (int) $remaining;
|
||||
return $remaining;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -229,6 +229,7 @@ class Ldap extends Model
|
|||
$item['department'] = $ldapattributes[$ldap_result_dept][0] ?? '';
|
||||
$item['manager'] = $ldapattributes[$ldap_result_manager][0] ?? '';
|
||||
$item['location'] = $ldapattributes[$ldap_result_location][0] ?? '';
|
||||
$item['locale'] = app()->getLocale();
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
@ -239,7 +240,7 @@ class Ldap extends Model
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v3.0]
|
||||
* @param $ldapatttibutes
|
||||
* @return array|bool
|
||||
* @return User | bool
|
||||
*/
|
||||
public static function createUserFromLdap($ldapatttibutes, $password)
|
||||
{
|
||||
|
@ -252,6 +253,7 @@ class Ldap extends Model
|
|||
$user->last_name = $item['lastname'];
|
||||
$user->username = $item['username'];
|
||||
$user->email = $item['email'];
|
||||
$user->locale = $item['locale'];
|
||||
$user->password = $user->noPassword();
|
||||
|
||||
if (Setting::getSettings()->ldap_pw_sync == '1') {
|
||||
|
|
|
@ -30,6 +30,7 @@ class CheckoutAccessoryNotification extends Notification
|
|||
$this->item = $accessory;
|
||||
$this->admin = $checkedOutBy;
|
||||
$this->note = $note;
|
||||
$this->checkout_qty = $accessory->checkout_qty;
|
||||
$this->target = $checkedOutTo;
|
||||
$this->acceptance = $acceptance;
|
||||
$this->settings = Setting::getSettings();
|
||||
|
@ -107,7 +108,7 @@ class CheckoutAccessoryNotification extends Notification
|
|||
->from($botname)
|
||||
->to($channel)
|
||||
->attachment(function ($attachment) use ($item, $note, $admin, $fields) {
|
||||
$attachment->title(htmlspecialchars_decode($item->present()->name), $item->present()->viewUrl())
|
||||
$attachment->title(htmlspecialchars_decode($this->checkout_qty.' x '.$item->present()->name), $item->present()->viewUrl())
|
||||
->fields($fields)
|
||||
->content($note);
|
||||
});
|
||||
|
@ -127,6 +128,7 @@ class CheckoutAccessoryNotification extends Notification
|
|||
->addStartGroupToSection('activityText')
|
||||
->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle')
|
||||
->fact(trans('mail.assigned_to'), $target->present()->name)
|
||||
->fact(trans('general.qty'), $this->checkout_qty)
|
||||
->fact(trans('mail.checkedout_from'), $item->location->name ? $item->location->name : '')
|
||||
->fact(trans('mail.Accessory_Checkout_Notification') . " by ", $admin->present()->fullName())
|
||||
->fact(trans('admin/consumables/general.remaining'), $item->numRemaining())
|
||||
|
@ -184,6 +186,7 @@ class CheckoutAccessoryNotification extends Notification
|
|||
'eula' => $eula,
|
||||
'req_accept' => $req_accept,
|
||||
'accept_url' => $accept_url,
|
||||
'checkout_qty' => $this->checkout_qty,
|
||||
])
|
||||
->subject(trans('mail.Confirm_accessory_delivery'));
|
||||
}
|
||||
|
|
|
@ -39,6 +39,14 @@ chown -R apache:root /var/lib/snipeit/data/*
|
|||
chown -R apache:root /var/lib/snipeit/dumps
|
||||
chown -R apache:root /var/lib/snipeit/keys
|
||||
|
||||
# Fix php settings
|
||||
if [ ! -z "${PHP_UPLOAD_LIMIT}" ]
|
||||
then
|
||||
echo "Changing upload limit to ${PHP_UPLOAD_LIMIT}"
|
||||
sed -i "s/^upload_max_filesize.*/upload_max_filesize = ${PHP_UPLOAD_LIMIT}M/" /etc/php*/php.ini
|
||||
sed -i "s/^post_max_size.*/post_max_size = ${PHP_UPLOAD_LIMIT}M/" /etc/php*/php.ini
|
||||
fi
|
||||
|
||||
# If the Oauth DB files are not present copy the vendor files over to the db migrations
|
||||
if [ ! -f "/var/www/html/database/migrations/*create_oauth*" ]
|
||||
then
|
||||
|
|
BIN
public/js/select2/i18n/af.js
vendored
Normal file
BIN
public/js/select2/i18n/af.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/ar.js
vendored
Normal file
BIN
public/js/select2/i18n/ar.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/az.js
vendored
Normal file
BIN
public/js/select2/i18n/az.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/bg.js
vendored
Normal file
BIN
public/js/select2/i18n/bg.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/bn.js
vendored
Normal file
BIN
public/js/select2/i18n/bn.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/bs.js
vendored
Normal file
BIN
public/js/select2/i18n/bs.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/build.txt
Normal file
BIN
public/js/select2/i18n/build.txt
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/ca.js
vendored
Normal file
BIN
public/js/select2/i18n/ca.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/cs.js
vendored
Normal file
BIN
public/js/select2/i18n/cs.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/da.js
vendored
Normal file
BIN
public/js/select2/i18n/da.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/de.js
vendored
Normal file
BIN
public/js/select2/i18n/de.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/dsb.js
vendored
Normal file
BIN
public/js/select2/i18n/dsb.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/el.js
vendored
Normal file
BIN
public/js/select2/i18n/el.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/en.js
vendored
Normal file
BIN
public/js/select2/i18n/en.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/es.js
vendored
Normal file
BIN
public/js/select2/i18n/es.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/et.js
vendored
Normal file
BIN
public/js/select2/i18n/et.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/eu.js
vendored
Normal file
BIN
public/js/select2/i18n/eu.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/fa.js
vendored
Normal file
BIN
public/js/select2/i18n/fa.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/fi.js
vendored
Normal file
BIN
public/js/select2/i18n/fi.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/fr.js
vendored
Normal file
BIN
public/js/select2/i18n/fr.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/gl.js
vendored
Normal file
BIN
public/js/select2/i18n/gl.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/he.js
vendored
Normal file
BIN
public/js/select2/i18n/he.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/hi.js
vendored
Normal file
BIN
public/js/select2/i18n/hi.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/hr.js
vendored
Normal file
BIN
public/js/select2/i18n/hr.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/hsb.js
vendored
Normal file
BIN
public/js/select2/i18n/hsb.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/hu.js
vendored
Normal file
BIN
public/js/select2/i18n/hu.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/hy.js
vendored
Normal file
BIN
public/js/select2/i18n/hy.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/id.js
vendored
Normal file
BIN
public/js/select2/i18n/id.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/is.js
vendored
Normal file
BIN
public/js/select2/i18n/is.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/it.js
vendored
Normal file
BIN
public/js/select2/i18n/it.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/ja.js
vendored
Normal file
BIN
public/js/select2/i18n/ja.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/ka.js
vendored
Normal file
BIN
public/js/select2/i18n/ka.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/km.js
vendored
Normal file
BIN
public/js/select2/i18n/km.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/ko.js
vendored
Normal file
BIN
public/js/select2/i18n/ko.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/lt.js
vendored
Normal file
BIN
public/js/select2/i18n/lt.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/lv.js
vendored
Normal file
BIN
public/js/select2/i18n/lv.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/mk.js
vendored
Normal file
BIN
public/js/select2/i18n/mk.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/ms.js
vendored
Normal file
BIN
public/js/select2/i18n/ms.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/nb.js
vendored
Normal file
BIN
public/js/select2/i18n/nb.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/ne.js
vendored
Normal file
BIN
public/js/select2/i18n/ne.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/nl.js
vendored
Normal file
BIN
public/js/select2/i18n/nl.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/pl.js
vendored
Normal file
BIN
public/js/select2/i18n/pl.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/ps.js
vendored
Normal file
BIN
public/js/select2/i18n/ps.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/pt-BR.js
vendored
Normal file
BIN
public/js/select2/i18n/pt-BR.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/pt.js
vendored
Normal file
BIN
public/js/select2/i18n/pt.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/ro.js
vendored
Normal file
BIN
public/js/select2/i18n/ro.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/ru.js
vendored
Normal file
BIN
public/js/select2/i18n/ru.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/sk.js
vendored
Normal file
BIN
public/js/select2/i18n/sk.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/sl.js
vendored
Normal file
BIN
public/js/select2/i18n/sl.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/sq.js
vendored
Normal file
BIN
public/js/select2/i18n/sq.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/sr-Cyrl.js
vendored
Normal file
BIN
public/js/select2/i18n/sr-Cyrl.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/sr.js
vendored
Normal file
BIN
public/js/select2/i18n/sr.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/sv.js
vendored
Normal file
BIN
public/js/select2/i18n/sv.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/th.js
vendored
Normal file
BIN
public/js/select2/i18n/th.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/tk.js
vendored
Normal file
BIN
public/js/select2/i18n/tk.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/tr.js
vendored
Normal file
BIN
public/js/select2/i18n/tr.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/uk.js
vendored
Normal file
BIN
public/js/select2/i18n/uk.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/vi.js
vendored
Normal file
BIN
public/js/select2/i18n/vi.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/zh-CN.js
vendored
Normal file
BIN
public/js/select2/i18n/zh-CN.js
vendored
Normal file
Binary file not shown.
BIN
public/js/select2/i18n/zh-TW.js
vendored
Normal file
BIN
public/js/select2/i18n/zh-TW.js
vendored
Normal file
Binary file not shown.
|
@ -219,6 +219,8 @@ $(document).ready(function () {
|
|||
*/
|
||||
placeholder: '',
|
||||
allowClear: true,
|
||||
language: $('meta[name="language"]').attr('content'),
|
||||
dir: $('meta[name="language-direction"]').attr('content'),
|
||||
|
||||
ajax: {
|
||||
|
||||
|
|
|
@ -26,7 +26,11 @@ return array(
|
|||
'error' => 'Accessory was not checked out, please try again',
|
||||
'success' => 'Accessory checked out successfully.',
|
||||
'unavailable' => 'Accessory is not available for checkout. Check quantity available',
|
||||
'user_does_not_exist' => 'That user is invalid. Please try again.'
|
||||
'user_does_not_exist' => 'That user is invalid. Please try again.',
|
||||
'checkout_qty' => array(
|
||||
'lte' => 'There is currently only one available accessory of this type, and you are trying to check out :checkout_qty. Please adjust the checkout quantity or the total stock of this accessory and try again.|There are :number_currently_remaining total available accessories, and you are trying to check out :checkout_qty. Please adjust the checkout quantity or the total stock of this accessory and try again.',
|
||||
),
|
||||
|
||||
),
|
||||
|
||||
'checkin' => array(
|
||||
|
|
|
@ -5,6 +5,7 @@ return array(
|
|||
'field' => array(
|
||||
'invalid' => 'That field does not exist.',
|
||||
'already_added' => 'Field already added',
|
||||
'none_selected' => 'No field selected',
|
||||
|
||||
'create' => array(
|
||||
'error' => 'Field was not created, please try again.',
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
return [
|
||||
|
||||
'undeployable' => '<strong>Warning: </strong> This asset has been marked as currently undeployable.
|
||||
If this status has changed, please update the asset status.',
|
||||
'undeployable' => '<strong>Warning: </strong> This asset has been marked as currently undeployable. If this status has changed, please update the asset status.',
|
||||
'does_not_exist' => 'Asset does not exist.',
|
||||
'does_not_exist_var'=> 'Asset with tag :asset_tag not found.',
|
||||
'no_tag' => 'No asset tag provided.',
|
||||
|
@ -52,6 +51,7 @@ return [
|
|||
],
|
||||
|
||||
'import' => [
|
||||
'import_button' => 'Process Import',
|
||||
'error' => 'Some items did not import correctly.',
|
||||
'errorDetail' => 'The following Items were not imported because of errors.',
|
||||
'success' => 'Your file has been imported',
|
||||
|
|
|
@ -14,6 +14,7 @@ return array(
|
|||
'info' => 'License Info',
|
||||
'license_seats' => 'License Seats',
|
||||
'seat' => 'Seat',
|
||||
'seat_count' => 'Seat :count',
|
||||
'seats' => 'Seats',
|
||||
'software_licenses' => 'Software Licenses',
|
||||
'user' => 'User',
|
||||
|
@ -23,12 +24,12 @@ return array(
|
|||
[
|
||||
'checkin_all' => [
|
||||
'button' => 'Checkin All Seats',
|
||||
'modal' => 'This will action checkin one seat. | This action will checkin all :checkedout_seats_count seats for this license.',
|
||||
'modal' => 'This action will checkin one seat. | This action will checkin all :checkedout_seats_count seats for this license.',
|
||||
'enabled_tooltip' => 'Checkin ALL seats for this license from both users and assets',
|
||||
'disabled_tooltip' => 'This is disabled because there are no seats currently checked out',
|
||||
'disabled_tooltip_reassignable' => 'This is disabled because the License is not reassignable',
|
||||
'success' => 'License successfully checked in! | All licenses were successfully checked in!',
|
||||
'log_msg' => 'Checked in via bulk license checkout in license GUI',
|
||||
'log_msg' => 'Checked in via bulk license checkin in license GUI',
|
||||
],
|
||||
|
||||
'checkout_all' => [
|
||||
|
|
|
@ -44,6 +44,8 @@ return array(
|
|||
'error' => 'There was an issue checking out the license. Please try again.',
|
||||
'success' => 'The license was checked out successfully',
|
||||
'not_enough_seats' => 'Not enough license seats available for checkout',
|
||||
'mismatch' => 'The license seat provided does not match the license',
|
||||
'unavailable' => 'This seat is not available for checkout.',
|
||||
),
|
||||
|
||||
'checkin' => array(
|
||||
|
|
|
@ -94,7 +94,7 @@ return [
|
|||
'ldap_login_sync_help' => 'This only tests that LDAP can sync correctly. If your LDAP Authentication query is not correct, users may still not be able to login. YOU MUST SAVE YOUR UPDATED LDAP SETTINGS FIRST.',
|
||||
'ldap_manager' => 'LDAP Manager',
|
||||
'ldap_server' => 'LDAP Server',
|
||||
'ldap_server_help' => 'This should start with ldap:// (for unencrypted or TLS) or ldaps:// (for SSL)',
|
||||
'ldap_server_help' => 'This should start with ldap:// (for unencrypted) or ldaps:// (for TLS or SSL)',
|
||||
'ldap_server_cert' => 'LDAP SSL certificate validation',
|
||||
'ldap_server_cert_ignore' => 'Allow invalid SSL Certificate',
|
||||
'ldap_server_cert_help' => 'Select this checkbox if you are using a self signed SSL cert and would like to accept an invalid SSL certificate.',
|
||||
|
|
|
@ -556,5 +556,6 @@ return [
|
|||
'something_went_wrong' => 'Something went wrong with your request.',
|
||||
'close' => 'Close',
|
||||
'expires' => 'Expires',
|
||||
'map_fields'=> 'Map :item_type Field',
|
||||
|
||||
];
|
||||
|
|
|
@ -13,87 +13,148 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'accepted' => 'The :attribute must be accepted.',
|
||||
'active_url' => 'The :attribute is not a valid URL.',
|
||||
'after' => 'The :attribute must be a date after :date.',
|
||||
'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
|
||||
'alpha' => 'The :attribute may only contain letters.',
|
||||
'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.',
|
||||
'alpha_num' => 'The :attribute may only contain letters and numbers.',
|
||||
'array' => 'The :attribute must be an array.',
|
||||
'before' => 'The :attribute must be a date before :date.',
|
||||
'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
|
||||
'between' => [
|
||||
'numeric' => 'The :attribute must be between :min - :max.',
|
||||
'file' => 'The :attribute must be between :min - :max kilobytes.',
|
||||
'string' => 'The :attribute must be between :min - :max characters.',
|
||||
'array' => 'The :attribute must have between :min and :max items.',
|
||||
'accepted' => 'The :attribute field must be accepted.',
|
||||
'accepted_if' => 'The :attribute field must be accepted when :other is :value.',
|
||||
'active_url' => 'The :attribute field must be a valid URL.',
|
||||
'after' => 'The :attribute field must be a date after :date.',
|
||||
'after_or_equal' => 'The :attribute field must be a date after or equal to :date.',
|
||||
'alpha' => 'The :attribute field must only contain letters.',
|
||||
'alpha_dash' => 'The :attribute field must only contain letters, numbers, dashes, and underscores.',
|
||||
'alpha_num' => 'The :attribute field must only contain letters and numbers.',
|
||||
'array' => 'The :attribute field must be an array.',
|
||||
'ascii' => 'The :attribute field must only contain single-byte alphanumeric characters and symbols.',
|
||||
'before' => 'The :attribute field must be a date before :date.',
|
||||
'before_or_equal' => 'The :attribute field must be a date before or equal to :date.',
|
||||
'between' => [
|
||||
'array' => 'The :attribute field must have between :min and :max items.',
|
||||
'file' => 'The :attribute field must be between :min and :max kilobytes.',
|
||||
'numeric' => 'The :attribute field must be between :min and :max.',
|
||||
'string' => 'The :attribute field must be between :min and :max characters.',
|
||||
],
|
||||
'boolean' => 'The :attribute must be true or false.',
|
||||
'confirmed' => 'The :attribute confirmation does not match.',
|
||||
'date' => 'The :attribute is not a valid date.',
|
||||
'date_format' => 'The :attribute does not match the format :format.',
|
||||
'different' => 'The :attribute and :other must be different.',
|
||||
'digits' => 'The :attribute must be :digits digits.',
|
||||
'digits_between' => 'The :attribute must be between :min and :max digits.',
|
||||
'dimensions' => 'The :attribute has invalid image dimensions.',
|
||||
'distinct' => 'The :attribute field has a duplicate value.',
|
||||
'email' => 'The :attribute format is invalid.',
|
||||
'exists' => 'The selected :attribute is invalid.',
|
||||
'file' => 'The :attribute must be a file.',
|
||||
'filled' => 'The :attribute field must have a value.',
|
||||
'image' => 'The :attribute must be an image.',
|
||||
'boolean' => 'The :attribute field must be true or false.',
|
||||
'can' => 'The :attribute field contains an unauthorized value.',
|
||||
'confirmed' => 'The :attribute field confirmation does not match.',
|
||||
'contains' => 'The :attribute field is missing a required value.',
|
||||
'current_password' => 'The password is incorrect.',
|
||||
'date' => 'The :attribute field must be a valid date.',
|
||||
'date_equals' => 'The :attribute field must be a date equal to :date.',
|
||||
'date_format' => 'The :attribute field must match the format :format.',
|
||||
'decimal' => 'The :attribute field must have :decimal decimal places.',
|
||||
'declined' => 'The :attribute field must be declined.',
|
||||
'declined_if' => 'The :attribute field must be declined when :other is :value.',
|
||||
'different' => 'The :attribute field and :other must be different.',
|
||||
'digits' => 'The :attribute field must be :digits digits.',
|
||||
'digits_between' => 'The :attribute field must be between :min and :max digits.',
|
||||
'dimensions' => 'The :attribute field has invalid image dimensions.',
|
||||
'distinct' => 'The :attribute field has a duplicate value.',
|
||||
'doesnt_end_with' => 'The :attribute field must not end with one of the following: :values.',
|
||||
'doesnt_start_with' => 'The :attribute field must not start with one of the following: :values.',
|
||||
'email' => 'The :attribute field must be a valid email address.',
|
||||
'ends_with' => 'The :attribute field must end with one of the following: :values.',
|
||||
'enum' => 'The selected :attribute is invalid.',
|
||||
'exists' => 'The selected :attribute is invalid.',
|
||||
'extensions' => 'The :attribute field must have one of the following extensions: :values.',
|
||||
'file' => 'The :attribute field must be a file.',
|
||||
'filled' => 'The :attribute field must have a value.',
|
||||
'gt' => [
|
||||
'array' => 'The :attribute field must have more than :value items.',
|
||||
'file' => 'The :attribute field must be greater than :value kilobytes.',
|
||||
'numeric' => 'The :attribute field must be greater than :value.',
|
||||
'string' => 'The :attribute field must be greater than :value characters.',
|
||||
],
|
||||
'gte' => [
|
||||
'array' => 'The :attribute field must have :value items or more.',
|
||||
'file' => 'The :attribute field must be greater than or equal to :value kilobytes.',
|
||||
'numeric' => 'The :attribute field must be greater than or equal to :value.',
|
||||
'string' => 'The :attribute field must be greater than or equal to :value characters.',
|
||||
],
|
||||
'hex_color' => 'The :attribute field must be a valid hexadecimal color.',
|
||||
'image' => 'The :attribute field must be an image.',
|
||||
'import_field_empty' => 'The value for :fieldname cannot be null.',
|
||||
'in' => 'The selected :attribute is invalid.',
|
||||
'in_array' => 'The :attribute field does not exist in :other.',
|
||||
'integer' => 'The :attribute must be an integer.',
|
||||
'ip' => 'The :attribute must be a valid IP address.',
|
||||
'ipv4' => 'The :attribute must be a valid IPv4 address.',
|
||||
'ipv6' => 'The :attribute must be a valid IPv6 address.',
|
||||
'is_unique_department' => 'The :attribute must be unique to this Company Location',
|
||||
'json' => 'The :attribute must be a valid JSON string.',
|
||||
'max' => [
|
||||
'numeric' => 'The :attribute may not be greater than :max.',
|
||||
'file' => 'The :attribute may not be greater than :max kilobytes.',
|
||||
'string' => 'The :attribute may not be greater than :max characters.',
|
||||
'array' => 'The :attribute may not have more than :max items.',
|
||||
'in' => 'The selected :attribute is invalid.',
|
||||
'in_array' => 'The :attribute field must exist in :other.',
|
||||
'integer' => 'The :attribute field must be an integer.',
|
||||
'ip' => 'The :attribute field must be a valid IP address.',
|
||||
'ipv4' => 'The :attribute field must be a valid IPv4 address.',
|
||||
'ipv6' => 'The :attribute field must be a valid IPv6 address.',
|
||||
'json' => 'The :attribute field must be a valid JSON string.',
|
||||
'list' => 'The :attribute field must be a list.',
|
||||
'lowercase' => 'The :attribute field must be lowercase.',
|
||||
'lt' => [
|
||||
'array' => 'The :attribute field must have less than :value items.',
|
||||
'file' => 'The :attribute field must be less than :value kilobytes.',
|
||||
'numeric' => 'The :attribute field must be less than :value.',
|
||||
'string' => 'The :attribute field must be less than :value characters.',
|
||||
],
|
||||
'mimes' => 'The :attribute must be a file of type: :values.',
|
||||
'mimetypes' => 'The :attribute must be a file of type: :values.',
|
||||
'min' => [
|
||||
'numeric' => 'The :attribute must be at least :min.',
|
||||
'file' => 'The :attribute must be at least :min kilobytes.',
|
||||
'string' => 'The :attribute must be at least :min characters.',
|
||||
'array' => 'The :attribute must have at least :min items.',
|
||||
'lte' => [
|
||||
'array' => 'The :attribute field must not have more than :value items.',
|
||||
'file' => 'The :attribute field must be less than or equal to :value kilobytes.',
|
||||
'numeric' => 'The :attribute field must be less than or equal to :value.',
|
||||
'string' => 'The :attribute field must be less than or equal to :value characters.',
|
||||
],
|
||||
'starts_with' => 'The :attribute must start with one of the following: :values.',
|
||||
'ends_with' => 'The :attribute must end with one of the following: :values.',
|
||||
|
||||
'not_in' => 'The selected :attribute is invalid.',
|
||||
'numeric' => 'The :attribute must be a number.',
|
||||
'present' => 'The :attribute field must be present.',
|
||||
'valid_regex' => 'That is not a valid regex. ',
|
||||
'regex' => 'The :attribute format is invalid.',
|
||||
'required' => 'The :attribute field is required.',
|
||||
'required_if' => 'The :attribute field is required when :other is :value.',
|
||||
'required_unless' => 'The :attribute field is required unless :other is in :values.',
|
||||
'required_with' => 'The :attribute field is required when :values is present.',
|
||||
'required_with_all' => 'The :attribute field is required when :values is present.',
|
||||
'required_without' => 'The :attribute field is required when :values is not present.',
|
||||
'mac_address' => 'The :attribute field must be a valid MAC address.',
|
||||
'max' => [
|
||||
'array' => 'The :attribute field must not have more than :max items.',
|
||||
'file' => 'The :attribute field must not be greater than :max kilobytes.',
|
||||
'numeric' => 'The :attribute field must not be greater than :max.',
|
||||
'string' => 'The :attribute field must not be greater than :max characters.',
|
||||
],
|
||||
'max_digits' => 'The :attribute field must not have more than :max digits.',
|
||||
'mimes' => 'The :attribute field must be a file of type: :values.',
|
||||
'mimetypes' => 'The :attribute field must be a file of type: :values.',
|
||||
'min' => [
|
||||
'array' => 'The :attribute field must have at least :min items.',
|
||||
'file' => 'The :attribute field must be at least :min kilobytes.',
|
||||
'numeric' => 'The :attribute field must be at least :min.',
|
||||
'string' => 'The :attribute field must be at least :min characters.',
|
||||
],
|
||||
'min_digits' => 'The :attribute field must have at least :min digits.',
|
||||
'missing' => 'The :attribute field must be missing.',
|
||||
'missing_if' => 'The :attribute field must be missing when :other is :value.',
|
||||
'missing_unless' => 'The :attribute field must be missing unless :other is :value.',
|
||||
'missing_with' => 'The :attribute field must be missing when :values is present.',
|
||||
'missing_with_all' => 'The :attribute field must be missing when :values are present.',
|
||||
'multiple_of' => 'The :attribute field must be a multiple of :value.',
|
||||
'not_in' => 'The selected :attribute is invalid.',
|
||||
'not_regex' => 'The :attribute field format is invalid.',
|
||||
'numeric' => 'The :attribute field must be a number.',
|
||||
'password' => [
|
||||
'letters' => 'The :attribute field must contain at least one letter.',
|
||||
'mixed' => 'The :attribute field must contain at least one uppercase and one lowercase letter.',
|
||||
'numbers' => 'The :attribute field must contain at least one number.',
|
||||
'symbols' => 'The :attribute field must contain at least one symbol.',
|
||||
'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.',
|
||||
],
|
||||
'present' => 'The :attribute field must be present.',
|
||||
'present_if' => 'The :attribute field must be present when :other is :value.',
|
||||
'present_unless' => 'The :attribute field must be present unless :other is :value.',
|
||||
'present_with' => 'The :attribute field must be present when :values is present.',
|
||||
'present_with_all' => 'The :attribute field must be present when :values are present.',
|
||||
'prohibited' => 'The :attribute field is prohibited.',
|
||||
'prohibited_if' => 'The :attribute field is prohibited when :other is :value.',
|
||||
'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.',
|
||||
'prohibits' => 'The :attribute field prohibits :other from being present.',
|
||||
'regex' => 'The :attribute field format is invalid.',
|
||||
'required' => 'The :attribute field is required.',
|
||||
'required_array_keys' => 'The :attribute field must contain entries for: :values.',
|
||||
'required_if' => 'The :attribute field is required when :other is :value.',
|
||||
'required_if_accepted' => 'The :attribute field is required when :other is accepted.',
|
||||
'required_if_declined' => 'The :attribute field is required when :other is declined.',
|
||||
'required_unless' => 'The :attribute field is required unless :other is in :values.',
|
||||
'required_with' => 'The :attribute field is required when :values is present.',
|
||||
'required_with_all' => 'The :attribute field is required when :values are present.',
|
||||
'required_without' => 'The :attribute field is required when :values is not present.',
|
||||
'required_without_all' => 'The :attribute field is required when none of :values are present.',
|
||||
'same' => 'The :attribute and :other must match.',
|
||||
'size' => [
|
||||
'numeric' => 'The :attribute must be :size.',
|
||||
'file' => 'The :attribute must be :size kilobytes.',
|
||||
'string' => 'The :attribute must be :size characters.',
|
||||
'array' => 'The :attribute must contain :size items.',
|
||||
'same' => 'The :attribute field must match :other.',
|
||||
'size' => [
|
||||
'array' => 'The :attribute field must contain :size items.',
|
||||
'file' => 'The :attribute field must be :size kilobytes.',
|
||||
'numeric' => 'The :attribute field must be :size.',
|
||||
'string' => 'The :attribute field must be :size characters.',
|
||||
],
|
||||
'starts_with' => 'The :attribute field must start with one of the following: :values.',
|
||||
'string' => 'The :attribute must be a string.',
|
||||
'timezone' => 'The :attribute must be a valid zone.',
|
||||
'two_column_unique_undeleted' => 'The :attribute must be unique across :table1 and :table2. ',
|
||||
'unique' => 'The :attribute has already been taken.',
|
||||
'uploaded' => 'The :attribute failed to upload.',
|
||||
'url' => 'The :attribute format is invalid.',
|
||||
'unique_undeleted' => 'The :attribute must be unique.',
|
||||
'non_circular' => 'The :attribute must not create a circular reference.',
|
||||
'not_array' => ':attribute cannot be an array.',
|
||||
|
@ -102,12 +163,13 @@ return [
|
|||
'numbers' => 'Password must contain at least one number.',
|
||||
'case_diff' => 'Password must use mixed case.',
|
||||
'symbols' => 'Password must contain symbols.',
|
||||
'gte' => [
|
||||
'numeric' => 'Value cannot be negative'
|
||||
],
|
||||
'checkboxes' => ':attribute contains invalid options.',
|
||||
'radio_buttons' => ':attribute is invalid.',
|
||||
|
||||
'timezone' => 'The :attribute field must be a valid timezone.',
|
||||
'unique' => 'The :attribute has already been taken.',
|
||||
'uploaded' => 'The :attribute failed to upload.',
|
||||
'uppercase' => 'The :attribute field must be uppercase.',
|
||||
'url' => 'The :attribute field must be a valid URL.',
|
||||
'ulid' => 'The :attribute field must be a valid ULID.',
|
||||
'uuid' => 'The :attribute field must be a valid UUID.',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -129,7 +191,7 @@ return [
|
|||
|
||||
// date_format validation with slightly less stupid messages. It duplicates a lot, but it gets the job done :(
|
||||
// We use this because the default error message for date_format is reflects php Y-m-d, which non-PHP
|
||||
// people won't know how to format.
|
||||
// people won't know how to format.
|
||||
'purchase_date.date_format' => 'The :attribute must be a valid date in YYYY-MM-DD format',
|
||||
'last_audit_date.date_format' => 'The :attribute must be a valid date in YYYY-MM-DD hh:mm:ss format',
|
||||
'expiration_date.date_format' => 'The :attribute must be a valid date in YYYY-MM-DD format',
|
||||
|
@ -137,9 +199,10 @@ return [
|
|||
'expected_checkin.date_format' => 'The :attribute must be a valid date in YYYY-MM-DD format',
|
||||
'start_date.date_format' => 'The :attribute must be a valid date in YYYY-MM-DD format',
|
||||
'end_date.date_format' => 'The :attribute must be a valid date in YYYY-MM-DD format',
|
||||
|
||||
],
|
||||
|
||||
'checkboxes' => ':attribute contains invalid options.',
|
||||
'radio_buttons' => ':attribute is invalid.',
|
||||
'invalid_value_in_field' => 'Invalid value included in this field',
|
||||
],
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Custom Validation Attributes
|
||||
|
@ -155,8 +218,16 @@ return [
|
|||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Generic Validation Messages
|
||||
| Generic Validation Messages - we use these in the jquery validation where we don't have
|
||||
| access to the :attribute
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'invalid_value_in_field' => 'Invalid value included in this field',
|
||||
|
||||
'generic' => [
|
||||
'invalid_value_in_field' => 'Invalid value included in this field',
|
||||
'required' => 'This field is required',
|
||||
'email' => 'Please enter a valid email address',
|
||||
],
|
||||
|
||||
|
||||
];
|
||||
|
|
|
@ -49,9 +49,35 @@
|
|||
</div>
|
||||
@endif
|
||||
|
||||
<!-- total -->
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{{ trans('admin/components/general.total') }}</label>
|
||||
<div class="col-md-6">
|
||||
<p class="form-control-static">{{ $accessory->qty }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- remaining -->
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{{ trans('admin/components/general.remaining') }}</label>
|
||||
<div class="col-md-6">
|
||||
<p class="form-control-static">{{ $accessory->numRemaining() }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- User -->
|
||||
|
||||
@include ('partials.forms.edit.user-select', ['translated_name' => trans('general.select_user'), 'fieldname' => 'assigned_to'])
|
||||
@include ('partials.forms.edit.user-select', ['translated_name' => trans('general.select_user'), 'fieldname' => 'assigned_to', 'required'=> 'true'])
|
||||
|
||||
<!-- Checkout QTY -->
|
||||
<div class="form-group {{ $errors->has('checkout_qty') ? 'error' : '' }} ">
|
||||
<label for="checkout_qty" class="col-md-3 control-label">{{ trans('general.qty') }}</label>
|
||||
<div class="col-md-7 col-sm-12 required">
|
||||
<div class="col-md-2" style="padding-left:0px">
|
||||
<input class="form-control" type="number" name="checkout_qty" id="checkout_qty" value="{{ old('checkout_qty', 1) }}" min="1" max="{{ $accessory->numRemaining() }}" />
|
||||
</div>
|
||||
</div>
|
||||
{!! $errors->first('checkout_qty', '<div class="col-md-8 col-md-offset-3"><span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span></div>') !!}
|
||||
</div>
|
||||
|
||||
|
||||
@if ($accessory->requireAcceptance() || $accessory->getEula() || ($snipeSettings->webhook_endpoint!=''))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}"
|
||||
dir="{{ in_array(app()->getLocale(),['ar-SA','fa-IR', 'he-IL']) ? 'rtl' : 'ltr' }}">
|
||||
dir="{{ Helper::determineLanguageDirection() }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
|
@ -24,6 +24,8 @@ dir="{{ in_array(app()->getLocale(),['ar-SA','fa-IR', 'he-IL']) ? 'rtl' : 'ltr'
|
|||
|
||||
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<meta name="language" content="{{ Helper::mapBackToLegacyLocale(app()->getLocale()) }}">
|
||||
<meta name="language-direction" content="{{ Helper::determineLanguageDirection() }}">
|
||||
<meta name="baseUrl" content="{{ config('app.url') }}/">
|
||||
|
||||
<script nonce="{{ csrf_token() }}">
|
||||
|
@ -947,8 +949,11 @@ dir="{{ in_array(app()->getLocale(),['ar-SA','fa-IR', 'he-IL']) ? 'rtl' : 'ltr'
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{{-- Javascript files --}}
|
||||
<script src="{{ url(mix('js/dist/all.js')) }}" nonce="{{ csrf_token() }}"></script>
|
||||
<script src="{{ url('js/select2/i18n/'.Helper::mapBackToLegacyLocale(app()->getLocale()).'.js') }}"></script>
|
||||
|
||||
<!-- v5-beta: This pGenerator call must remain here for v5 - until fixed - so that the JS password generator works for the user create modal. -->
|
||||
<script src="{{ url('js/pGenerator.jquery.js') }}"></script>
|
||||
|
@ -974,7 +979,7 @@ dir="{{ in_array(app()->getLocale(),['ar-SA','fa-IR', 'he-IL']) ? 'rtl' : 'ltr'
|
|||
});
|
||||
|
||||
// Reference: https://jqueryvalidation.org/validate/
|
||||
$('#create-form').validate({
|
||||
var validator = $('#create-form').validate({
|
||||
ignore: 'input[type=hidden]',
|
||||
errorClass: 'alert-msg',
|
||||
errorElement: 'span',
|
||||
|
@ -992,6 +997,12 @@ dir="{{ in_array(app()->getLocale(),['ar-SA','fa-IR', 'he-IL']) ? 'rtl' : 'ltr'
|
|||
onfocusout: function(element) {
|
||||
return $(element).valid();
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
$.extend($.validator.messages, {
|
||||
required: "{{ trans('validation.generic.required') }}",
|
||||
email: "{{ trans('validation.generic.email') }}"
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -11,30 +11,30 @@
|
|||
@include ('partials.forms.edit.category-select', ['translated_name' => trans('admin/categories/general.category_name'), 'fieldname' => 'category_id', 'required' => 'true', 'category_type' => 'license'])
|
||||
|
||||
|
||||
<!-- Serial-->
|
||||
@can('viewKeys', $item)
|
||||
<div class="form-group {{ $errors->has('serial') ? ' has-error' : '' }}">
|
||||
<label for="serial" class="col-md-3 control-label">{{ trans('admin/licenses/form.license_key') }}</label>
|
||||
<div class="col-md-7{{ (Helper::checkIfRequired($item, 'serial')) ? ' required' : '' }}">
|
||||
<textarea class="form-control" type="text" name="serial" id="serial">{{ old('serial', $item->serial) }}</textarea>
|
||||
{!! $errors->first('serial', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
@endcan
|
||||
|
||||
|
||||
<!-- Seats -->
|
||||
<div class="form-group {{ $errors->has('seats') ? ' has-error' : '' }}">
|
||||
<label for="seats" class="col-md-3 control-label">{{ trans('admin/licenses/form.seats') }}</label>
|
||||
<div class="col-md-7 col-sm-12 required">
|
||||
<div class="col-md-2" style="padding-left:0px">
|
||||
<input class="form-control" type="text" name="seats" id="seats" value="{{ old('seats', $item->seats) }}" />
|
||||
<div class="col-md-12" style="padding-left:0px">
|
||||
<input class="form-control" type="text" name="seats" id="seats" value="{{ old('seats', $item->seats) }}" minlength="1" required style="width: 97px;">
|
||||
</div>
|
||||
</div>
|
||||
{!! $errors->first('seats', '<div class="col-md-8 col-md-offset-3"><span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span></div>') !!}
|
||||
</div>
|
||||
@include ('partials.forms.edit.minimum_quantity')
|
||||
|
||||
<!-- Serial-->
|
||||
@can('viewKeys', $item)
|
||||
<div class="form-group {{ $errors->has('serial') ? ' has-error' : '' }}">
|
||||
<label for="serial" class="col-md-3 control-label">{{ trans('admin/licenses/form.license_key') }}</label>
|
||||
<div class="col-md-7{{ (Helper::checkIfRequired($item, 'serial')) ? ' required' : '' }}">
|
||||
<textarea class="form-control" type="text" name="serial" id="serial">{{ old('serial', $item->serial) }}</textarea>
|
||||
{!! $errors->first('serial', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
@endcan
|
||||
|
||||
@include ('partials.forms.edit.company-select', ['translated_name' => trans('general.company'), 'fieldname' => 'company_id'])
|
||||
@include ('partials.forms.edit.manufacturer-select', ['translated_name' => trans('general.manufacturer'), 'fieldname' => 'manufacturer_id',])
|
||||
|
||||
|
@ -51,7 +51,7 @@
|
|||
<div class="form-group {{ $errors->has('license_email') ? ' has-error' : '' }}">
|
||||
<label for="license_email" class="col-md-3 control-label">{{ trans('admin/licenses/form.to_email') }}</label>
|
||||
<div class="col-md-7">
|
||||
<input class="form-control" type="text" name="license_email" id="license_email" value="{{ old('license_email', $item->license_email) }}" />
|
||||
<input class="form-control" type="email" name="license_email" id="license_email" value="{{ old('license_email', $item->license_email) }}" />
|
||||
{!! $errors->first('license_email', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
</div>
|
||||
@endif
|
||||
|
||||
<div class="col-md-2 col-sm-5 col-xs-12 text-right pull-right">
|
||||
<div class="col-md-4 col-sm-5 col-xs-12 text-right pull-right">
|
||||
|
||||
<!-- The fileinput-button span is used to style the file input field as button -->
|
||||
@if (!config('app.lock_passwords'))
|
||||
|
@ -198,7 +198,11 @@
|
|||
@if ($activeFile->import_type)
|
||||
<div class="form-group col-md-12">
|
||||
<hr style="border-top: 1px solid lightgray">
|
||||
<h3><i class="{{ Helper::iconTypeByItem($activeFile->import_type) }}"></i> Map {{ ucwords($activeFile->import_type) }} Import Fields</h3>
|
||||
<h3>
|
||||
<i class="{{ Helper::iconTypeByItem($activeFile->import_type) }}">
|
||||
</i>
|
||||
{{ trans('general.map_fields', ['item_type' => ucwords($activeFile->import_type)]) }}
|
||||
</h3>
|
||||
<hr style="border-top: 1px solid lightgray">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
|
@ -254,7 +258,7 @@
|
|||
<a href="#" wire:click.prevent="$set('activeFile',null)">{{ trans('general.cancel') }}</a>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<button type="submit" class="btn btn-primary col-md-5" id="import">Import</button>
|
||||
<button type="submit" class="btn btn-primary col-md-5" id="import">{{ trans('admin/hardware/message.import.import_button') }}</button>
|
||||
<br><br>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
@if (isset($item->model_no))
|
||||
| **{{ trans('general.model_no') }}** | {{ $item->model_no }} |
|
||||
@endif
|
||||
@if (isset($checkout_qty))
|
||||
| **{{ trans('general.qty') }}** | {{ $checkout_qty }} |
|
||||
@endif
|
||||
@if ($note)
|
||||
| **{{ trans('mail.additional_notes') }}** | {{ $note }} |
|
||||
@endif
|
||||
|
|
|
@ -432,7 +432,7 @@
|
|||
if ((row.available_actions.checkout === true) && (row.user_can_checkout === true) && ((!row.asset_id) && (!row.assigned_to))) {
|
||||
return '<a href="{{ config('app.url') }}/licenses/' + row.license_id + '/checkout/'+row.id+'" class="btn btn-sm bg-maroon" data-tooltip="true" title="{{ trans('general.checkout_tooltip') }}">{{ trans('general.checkout') }}</a>';
|
||||
} else {
|
||||
return '<a href="{{ config('app.url') }}/licenses/' + row.id + '/checkin" class="btn btn-sm bg-purple" data-tooltip="true" title="Check in this license seat.">{{ trans('general.checkin') }}</a>';
|
||||
return '<a href="{{ config('app.url') }}/licenses/' + row.id + '/checkin" class="btn btn-sm bg-purple" data-tooltip="true" title="{{ trans('general.checkin_tooltip') }}">{{ trans('general.checkin') }}</a>';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -106,9 +106,9 @@
|
|||
{{ trans('general.location') }}
|
||||
</label>
|
||||
|
||||
<label class="form-control">
|
||||
<label class="form-control" style="margin-left: 25px;">
|
||||
{{ Form::checkbox('location_address', '1', '1') }}
|
||||
- {{ trans('general.address') }}
|
||||
{{ trans('general.address') }}
|
||||
</label>
|
||||
|
||||
<label class="form-control">
|
||||
|
@ -116,9 +116,9 @@
|
|||
{{ trans('admin/hardware/form.default_location') }}
|
||||
</label>
|
||||
|
||||
<label class="form-control">
|
||||
<label class="form-control" style="margin-left: 25px;">
|
||||
{{ Form::checkbox('rtd_location_address', '1', '1') }}
|
||||
- {{ trans('general.address') }}
|
||||
{{ trans('general.address') }}
|
||||
</label>
|
||||
|
||||
<label class="form-control">
|
||||
|
@ -181,9 +181,9 @@
|
|||
{{ trans('general.notes') }}
|
||||
</label>
|
||||
|
||||
<label class="form-control">
|
||||
<label class="form-control" style="margin-left: 25px;">
|
||||
{{ Form::checkbox('url', '1', '1') }}
|
||||
- {{ trans('general.url') }}
|
||||
{{ trans('general.url') }}
|
||||
</label>
|
||||
|
||||
|
||||
|
@ -298,10 +298,10 @@
|
|||
|
||||
<!-- Purchase Date -->
|
||||
<div class="form-group purchase-range{{ ($errors->has('purchase_start') || $errors->has('purchase_end')) ? ' has-error' : '' }}">
|
||||
<label for="purchase_start" class="col-md-3 control-label">{{ trans('general.purchase_date') }} {{ trans('general.range') }}</label>
|
||||
<label for="purchase_start" class="col-md-3 control-label">{{ trans('general.purchase_date') }}</label>
|
||||
<div class="input-daterange input-group col-md-7" id="datepicker">
|
||||
<input type="text" class="form-control" name="purchase_start" aria-label="purchase_start" value="{{ old('purchase_start') }}">
|
||||
<span class="input-group-addon">to</span>
|
||||
<span class="input-group-addon">{{ strtolower(trans('general.to')) }}</span>
|
||||
<input type="text" class="form-control" name="purchase_end" aria-label="purchase_end" value="{{ old('purchase_end') }}">
|
||||
</div>
|
||||
|
||||
|
@ -316,10 +316,10 @@
|
|||
|
||||
<!-- Created Date -->
|
||||
<div class="form-group purchase-range{{ ($errors->has('created_start') || $errors->has('created_end')) ? ' has-error' : '' }}">
|
||||
<label for="created_start" class="col-md-3 control-label">{{ trans('general.created_at') }} {{ trans('general.range') }}</label>
|
||||
<label for="created_start" class="col-md-3 control-label">{{ trans('general.created_at') }} </label>
|
||||
<div class="input-daterange input-group col-md-7" id="datepicker">
|
||||
<input type="text" class="form-control" name="created_start" aria-label="created_start" value="{{ old('created_start') }}">
|
||||
<span class="input-group-addon">to</span>
|
||||
<span class="input-group-addon">{{ strtolower(trans('general.to')) }}</span>
|
||||
<input type="text" class="form-control" name="created_end" aria-label="created_end" value="{{ old('created_end') }}">
|
||||
</div>
|
||||
|
||||
|
@ -333,10 +333,10 @@
|
|||
|
||||
<!-- Checkout Date -->
|
||||
<div class="form-group checkout-range{{ ($errors->has('checkout_date_start') || $errors->has('checkout_date_end')) ? ' has-error' : '' }}">
|
||||
<label for="checkout_date" class="col-md-3 control-label">{{ trans('general.checkout') }} {{ trans('general.range') }}</label>
|
||||
<label for="checkout_date" class="col-md-3 control-label">{{ trans('general.checkout') }} </label>
|
||||
<div class="input-daterange input-group col-md-7" id="datepicker">
|
||||
<input type="text" class="form-control" name="checkout_date_start" aria-label="checkout_date_start" value="{{ old('checkout_date_start') }}">
|
||||
<span class="input-group-addon">to</span>
|
||||
<span class="input-group-addon">{{ strtolower(trans('general.to')) }}</span>
|
||||
<input type="text" class="form-control" name="checkout_date_end" aria-label="checkout_date_end" value="{{ old('checkout_date_end') }}">
|
||||
</div>
|
||||
|
||||
|
@ -371,7 +371,7 @@
|
|||
<label for="expected_checkin_start" class="col-md-3 control-label">{{ trans('admin/hardware/form.expected_checkin') }}</label>
|
||||
<div class="input-daterange input-group col-md-7" id="datepicker">
|
||||
<input type="text" class="form-control" name="expected_checkin_start" aria-label="expected_checkin_start" value="{{ old('expected_checkin_start') }}">
|
||||
<span class="input-group-addon">to</span>
|
||||
<span class="input-group-addon">{{ strtolower(trans('general.to')) }}</span>
|
||||
<input type="text" class="form-control" name="expected_checkin_end" aria-label="expected_checkin_end" value="{{ old('expected_checkin_end') }}">
|
||||
</div>
|
||||
|
||||
|
@ -389,7 +389,7 @@
|
|||
<label for="last_audit_start" class="col-md-3 control-label">{{ trans('general.last_audit') }}</label>
|
||||
<div class="input-daterange input-group col-md-7" id="datepicker">
|
||||
<input type="text" class="form-control" name="last_audit_start" aria-label="last_audit_start" value="{{ old('last_audit_start') }}">
|
||||
<span class="input-group-addon">to</span>
|
||||
<span class="input-group-addon">{{ strtolower(trans('general.to')) }}</span>
|
||||
<input type="text" class="form-control" name="last_audit_end" aria-label="last_audit_end" value="{{ old('last_audit_end') }}">
|
||||
</div>
|
||||
|
||||
|
@ -406,7 +406,7 @@
|
|||
<label for="next_audit_start" class="col-md-3 control-label">{{ trans('general.next_audit_date') }}</label>
|
||||
<div class="input-daterange input-group col-md-7" id="datepicker">
|
||||
<input type="text" class="form-control" name="next_audit_start" aria-label="next_audit_start" value="{{ old('next_audit_start') }}">
|
||||
<span class="input-group-addon">to</span>
|
||||
<span class="input-group-addon">{{ strtolower(trans('general.to')) }}</span>
|
||||
<input type="text" class="form-control" name="next_audit_end" aria-label="next_audit_end" value="{{ old('next_audit_end') }}">
|
||||
</div>
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@
|
|||
</label>
|
||||
|
||||
@if ($errors->has('pwd_secure_complexity.*'))
|
||||
<span class="alert-msg">{{ trans('validation.invalid_value_in_field') }}</span>
|
||||
<span class="alert-msg">{{ trans('validation.generic.invalid_value_in_field') }}</span>
|
||||
@endif
|
||||
<p class="help-block">
|
||||
{{ trans('admin/settings/general.pwd_secure_complexity_help') }}
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
size: A4;
|
||||
}
|
||||
|
||||
|
||||
.print-logo {
|
||||
max-height: 40px;
|
||||
}
|
||||
|
@ -42,8 +41,6 @@
|
|||
margin-top: 20px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<script nonce="{{ csrf_token() }}">
|
||||
|
@ -80,7 +77,10 @@
|
|||
{{ ($show_user->employee_num!='') ? ' (#'.$show_user->employee_num.') ' : '' }}
|
||||
{{ ($show_user->jobtitle!='' ? ' - '.$show_user->jobtitle : '') }}
|
||||
</h3>
|
||||
<p></p>{{ trans('admin/users/general.all_assigned_list_generation')}} {{ Helper::getFormattedDateObject(now(), 'datetime', false) }}</body>
|
||||
<p></p>{{ trans('admin/users/general.all_assigned_list_generation')}} {{ Helper::getFormattedDateObject(now(), 'datetime', false) }}
|
||||
|
||||
</body>
|
||||
|
||||
@if ($assets->count() > 0)
|
||||
@php
|
||||
$counter = 1;
|
||||
|
@ -120,7 +120,9 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
@foreach ($assets as $asset)
|
||||
|
||||
@php
|
||||
if ($asset->model->category->getEula()) $eulas[] = $asset->model->category->getEula()
|
||||
@endphp
|
||||
<tr>
|
||||
<td>{{ $counter }}</td>
|
||||
<td>
|
||||
|
@ -148,7 +150,6 @@
|
|||
$assignedCounter = 1;
|
||||
@endphp
|
||||
@foreach ($asset->assignedAssets as $asset)
|
||||
|
||||
<tr>
|
||||
<td>{{ $counter }}.{{ $assignedCounter }}</td>
|
||||
<td>
|
||||
|
@ -216,7 +217,9 @@
|
|||
@endphp
|
||||
|
||||
@foreach ($licenses as $license)
|
||||
|
||||
@php
|
||||
if ($license->category->getEula()) $eulas[] = $license->category->getEula()
|
||||
@endphp
|
||||
<tr>
|
||||
<td>{{ $lcounter }}</td>
|
||||
<td>{{ $license->name }}</td>
|
||||
|
@ -272,6 +275,9 @@
|
|||
|
||||
@foreach ($accessories as $accessory)
|
||||
@if ($accessory)
|
||||
@php
|
||||
if ($accessory->category->getEula()) $eulas[] = $accessory->category->getEula()
|
||||
@endphp
|
||||
<tr>
|
||||
<td>{{ $acounter }}</td>
|
||||
<td>
|
||||
|
@ -332,10 +338,11 @@
|
|||
|
||||
@foreach ($consumables as $consumable)
|
||||
@if ($consumable)
|
||||
@php
|
||||
if ($consumable->category->getEula()) $eulas[] = $consumable->category->getEula()
|
||||
@endphp
|
||||
<tr>
|
||||
<td>{{ $ccounter }}</td>
|
||||
|
||||
|
||||
<td>
|
||||
@if ($consumable->deleted_at!='')
|
||||
<td>{{ ($consumable->manufacturer) ? $consumable->manufacturer->name : '' }} {{ $consumable->name }} {{ $consumable->model_number }}</td>
|
||||
|
@ -359,12 +366,32 @@
|
|||
</table>
|
||||
@endif
|
||||
|
||||
<p></p>
|
||||
<div class="pull-right">
|
||||
<button class="btn btn-default hidden-print" type="button" data-toggle="collapse" data-target="#eula-row" aria-expanded="false" aria-controls="eula-row" title="EULAs">
|
||||
<i class="fa fa-eye-slash"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<table style="margin-top: 80px;">
|
||||
<tr class="collapse" id="eula-row">
|
||||
<td style="padding-right: 10px; vertical-align: top; font-weight: bold;">EULA</td>
|
||||
<td style="padding-right: 10px; vertical-align: top; padding-bottom: 80px;" colspan="3">
|
||||
@php
|
||||
if (!empty($eulas)) $eulas = array_unique($eulas);
|
||||
@endphp
|
||||
@if (!empty($eulas))
|
||||
@foreach ($eulas as $key => $eula)
|
||||
{!! $eula !!}
|
||||
@endforeach
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-right: 10px; vertical-align: top; font-weight: bold;">{{ trans('general.signed_off_by') }}:</td>
|
||||
<td style="padding-right: 10px; vertical-align: top;">________________________________________________________</td>
|
||||
<td style="padding-right: 10px; vertical-align: top;">________________________________________________________</td>
|
||||
<td>_____________________</td>
|
||||
<td style="padding-right: 10px; vertical-align: top;">______________________________________</td>
|
||||
<td style="padding-right: 10px; vertical-align: top;">______________________________________</td>
|
||||
<td>_____________</td>
|
||||
</tr>
|
||||
<tr style="height: 80px;">
|
||||
<td></td>
|
||||
|
@ -372,12 +399,11 @@
|
|||
<td style="padding-right: 10px; vertical-align: top;">Signature</td>
|
||||
<td style="padding-right: 10px; vertical-align: top;">{{ trans('general.date') }}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="padding-right: 10px; vertical-align: top; font-weight: bold;">{{ trans('admin/users/table.manager') }}:</td>
|
||||
<td style="padding-right: 10px; vertical-align: top;">________________________________________________________</td>
|
||||
<td style="padding-right: 10px; vertical-align: top;">________________________________________________________</td>
|
||||
<td>_____________________</td>
|
||||
<td style="padding-right: 10px; vertical-align: top;">______________________________________</td>
|
||||
<td style="padding-right: 10px; vertical-align: top;">______________________________________</td>
|
||||
<td>_____________</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
|
@ -392,11 +418,6 @@
|
|||
{{-- Javascript files --}}
|
||||
<script src="{{ url(mix('js/dist/all.js')) }}" nonce="{{ csrf_token() }}"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="{{ url(mix('js/dist/bootstrap-table.js')) }}"></script>
|
||||
|
||||
<script>
|
||||
|
@ -475,7 +496,5 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -13,7 +13,7 @@ Route::group(['prefix' => 'accessories', 'middleware' => ['auth']], function ()
|
|||
)->name('accessories.checkout.show');
|
||||
|
||||
Route::post(
|
||||
'{accessoryID}/checkout',
|
||||
'{accessory}/checkout',
|
||||
[Accessories\AccessoryCheckoutController::class, 'store']
|
||||
)->name('accessories.checkout.store');
|
||||
|
||||
|
|
|
@ -33,20 +33,110 @@ class AccessoryCheckoutTest extends TestCase
|
|||
->postJson(route('api.accessories.checkout', Accessory::factory()->withoutItemsRemaining()->create()), [
|
||||
'assigned_to' => User::factory()->create()->id,
|
||||
])
|
||||
->assertStatusMessageIs('error');
|
||||
->assertOk()
|
||||
->assertStatusMessageIs('error')
|
||||
->assertJson(
|
||||
[
|
||||
'status' => 'error',
|
||||
'messages' =>
|
||||
[
|
||||
'checkout_qty' =>
|
||||
[
|
||||
trans_choice('admin/accessories/message.checkout.checkout_qty.lte', 0,
|
||||
[
|
||||
'number_currently_remaining' => 0,
|
||||
'checkout_qty' => 1,
|
||||
'number_remaining_after_checkout' => 0
|
||||
])
|
||||
],
|
||||
|
||||
],
|
||||
'payload' => null,
|
||||
])
|
||||
->assertStatus(200)
|
||||
->json();
|
||||
}
|
||||
|
||||
public function testAccessoryCanBeCheckedOut()
|
||||
public function testAccessoryCanBeCheckedOutWithoutQty()
|
||||
{
|
||||
$accessory = Accessory::factory()->create();
|
||||
$user = User::factory()->create();
|
||||
$admin = User::factory()->checkoutAccessories()->create();
|
||||
|
||||
$this->actingAsForApi($admin)
|
||||
->postJson(route('api.accessories.checkout', $accessory), [
|
||||
'assigned_to' => $user->id,
|
||||
])
|
||||
->assertOk()
|
||||
->assertStatusMessageIs('success')
|
||||
->assertStatus(200)
|
||||
->assertJson(['messages' => trans('admin/accessories/message.checkout.success')])
|
||||
->json();
|
||||
|
||||
$this->assertTrue($accessory->users->contains($user));
|
||||
|
||||
$this->assertEquals(
|
||||
1,
|
||||
Actionlog::where([
|
||||
'action_type' => 'checkout',
|
||||
'target_id' => $user->id,
|
||||
'target_type' => User::class,
|
||||
'item_id' => $accessory->id,
|
||||
'item_type' => Accessory::class,
|
||||
'user_id' => $admin->id,
|
||||
])->count(),'Log entry either does not exist or there are more than expected'
|
||||
);
|
||||
}
|
||||
|
||||
public function testAccessoryCanBeCheckedOutWithQty()
|
||||
{
|
||||
$accessory = Accessory::factory()->create(['qty' => 20]);
|
||||
$user = User::factory()->create();
|
||||
$admin = User::factory()->checkoutAccessories()->create();
|
||||
|
||||
$this->actingAsForApi($admin)
|
||||
->postJson(route('api.accessories.checkout', $accessory), [
|
||||
'assigned_to' => $user->id,
|
||||
'checkout_qty' => 2,
|
||||
])
|
||||
->assertOk()
|
||||
->assertStatusMessageIs('success')
|
||||
->assertStatus(200)
|
||||
->assertJson(['messages' => trans('admin/accessories/message.checkout.success')])
|
||||
->json();
|
||||
|
||||
$this->assertTrue($accessory->users->contains($user));
|
||||
|
||||
$this->assertEquals(
|
||||
1,
|
||||
Actionlog::where([
|
||||
'action_type' => 'checkout',
|
||||
'target_id' => $user->id,
|
||||
'target_type' => User::class,
|
||||
'item_id' => $accessory->id,
|
||||
'item_type' => Accessory::class,
|
||||
'user_id' => $admin->id,
|
||||
])->count(),
|
||||
'Log entry either does not exist or there are more than expected'
|
||||
);
|
||||
}
|
||||
|
||||
public function testAccessoryCannotBeCheckedOutToInvalidUser()
|
||||
{
|
||||
$accessory = Accessory::factory()->create();
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAsForApi(User::factory()->checkoutAccessories()->create())
|
||||
->postJson(route('api.accessories.checkout', $accessory), [
|
||||
'assigned_to' => $user->id,
|
||||
]);
|
||||
'assigned_to' => 'invalid-user-id',
|
||||
'note' => 'oh hi there',
|
||||
])
|
||||
->assertOk()
|
||||
->assertStatusMessageIs('error')
|
||||
->assertStatus(200)
|
||||
->json();
|
||||
|
||||
$this->assertTrue($accessory->users->contains($user));
|
||||
$this->assertFalse($accessory->users->contains($user));
|
||||
}
|
||||
|
||||
public function testUserSentNotificationUponCheckout()
|
||||
|
|
|
@ -20,23 +20,36 @@ class AccessoryCheckoutTest extends TestCase
|
|||
|
||||
public function testValidationWhenCheckingOutAccessory()
|
||||
{
|
||||
$this->actingAs(User::factory()->checkoutAccessories()->create())
|
||||
->post(route('accessories.checkout.store', Accessory::factory()->create()), [
|
||||
$accessory = Accessory::factory()->create();
|
||||
$response = $this->actingAs(User::factory()->superuser()->create())
|
||||
->from(route('accessories.checkout.show', $accessory))
|
||||
->post(route('accessories.checkout.store', $accessory), [
|
||||
// missing assigned_to
|
||||
])
|
||||
->assertSessionHas('error');
|
||||
->assertStatus(302)
|
||||
->assertSessionHas('errors')
|
||||
->assertRedirect(route('accessories.checkout.store', $accessory));
|
||||
|
||||
$this->followRedirects($response)->assertSee(trans('general.error'));
|
||||
}
|
||||
|
||||
public function testAccessoryMustBeAvailableWhenCheckingOut()
|
||||
public function testAccessoryMustHaveAvailableItemsForCheckoutWhenCheckingOut()
|
||||
{
|
||||
$this->actingAs(User::factory()->checkoutAccessories()->create())
|
||||
->post(route('accessories.checkout.store', Accessory::factory()->withoutItemsRemaining()->create()), [
|
||||
|
||||
$accessory = Accessory::factory()->withoutItemsRemaining()->create();
|
||||
$response = $this->actingAs(User::factory()->viewAccessories()->checkoutAccessories()->create())
|
||||
->from(route('accessories.checkout.show', $accessory))
|
||||
->post(route('accessories.checkout.store', $accessory), [
|
||||
'assigned_to' => User::factory()->create()->id,
|
||||
])
|
||||
->assertSessionHas('error');
|
||||
->assertStatus(302)
|
||||
->assertSessionHas('errors')
|
||||
->assertRedirect(route('accessories.checkout.store', $accessory));
|
||||
$response->assertInvalid(['checkout_qty']);
|
||||
$this->followRedirects($response)->assertSee(trans('general.error'));
|
||||
}
|
||||
|
||||
public function testAccessoryCanBeCheckedOut()
|
||||
public function testAccessoryCanBeCheckedOutWithoutQuantity()
|
||||
{
|
||||
$accessory = Accessory::factory()->create();
|
||||
$user = User::factory()->create();
|
||||
|
@ -44,9 +57,44 @@ class AccessoryCheckoutTest extends TestCase
|
|||
$this->actingAs(User::factory()->checkoutAccessories()->create())
|
||||
->post(route('accessories.checkout.store', $accessory), [
|
||||
'assigned_to' => $user->id,
|
||||
'note' => 'oh hi there',
|
||||
]);
|
||||
|
||||
$this->assertTrue($accessory->users->contains($user));
|
||||
|
||||
$this->assertDatabaseHas('action_logs', [
|
||||
'action_type' => 'checkout',
|
||||
'target_id' => $user->id,
|
||||
'target_type' => User::class,
|
||||
'item_id' => $accessory->id,
|
||||
'item_type' => Accessory::class,
|
||||
'note' => 'oh hi there',
|
||||
]);
|
||||
}
|
||||
|
||||
public function testAccessoryCanBeCheckedOutWithQuantity()
|
||||
{
|
||||
$accessory = Accessory::factory()->create(['qty'=>5]);
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs(User::factory()->checkoutAccessories()->create())
|
||||
->from(route('accessories.checkout.show', $accessory))
|
||||
->post(route('accessories.checkout.store', $accessory), [
|
||||
'assigned_to' => $user->id,
|
||||
'checkout_qty' => 3,
|
||||
'note' => 'oh hi there',
|
||||
]);
|
||||
|
||||
$this->assertTrue($accessory->users->contains($user));
|
||||
|
||||
$this->assertDatabaseHas('action_logs', [
|
||||
'action_type' => 'checkout',
|
||||
'target_id' => $user->id,
|
||||
'target_type' => User::class,
|
||||
'item_id' => $accessory->id,
|
||||
'item_type' => Accessory::class,
|
||||
'note' => 'oh hi there',
|
||||
]);
|
||||
}
|
||||
|
||||
public function testUserSentNotificationUponCheckout()
|
||||
|
@ -57,6 +105,7 @@ class AccessoryCheckoutTest extends TestCase
|
|||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs(User::factory()->checkoutAccessories()->create())
|
||||
->from(route('accessories.checkout.show', $accessory))
|
||||
->post(route('accessories.checkout.store', $accessory), [
|
||||
'assigned_to' => $user->id,
|
||||
]);
|
||||
|
@ -71,6 +120,7 @@ class AccessoryCheckoutTest extends TestCase
|
|||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($actor)
|
||||
->from(route('accessories.checkout.show', $accessory))
|
||||
->post(route('accessories.checkout.store', $accessory), [
|
||||
'assigned_to' => $user->id,
|
||||
'note' => 'oh hi there',
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue