Compare commits

..

1 Commits

Author SHA1 Message Date
snipe a6dc430dcd Use config variable instead of laravel built-in max attempts
Signed-off-by: snipe <snipe@snipe.net>
2025-06-02 00:24:07 +01:00
139 changed files with 324 additions and 1979 deletions
-9
View File
@@ -4171,15 +4171,6 @@
"contributions": [
"code"
]
},
{
"login": "amedranogil",
"name": "Alejandro Medrano",
"avatar_url": "https://avatars.githubusercontent.com/u/6515064?v=4",
"profile": "https://www.lst.tfo.upm.es/alejandro-medrano/",
"contributions": [
"code"
]
}
]
}
+1 -1
View File
@@ -67,7 +67,7 @@ Thanks goes to all of these wonderful people ([emoji key](https://github.com/ken
| [<img src="https://avatars.githubusercontent.com/u/80526133?v=4" width="110px;"/><br /><sub>AlexanderWPapyrus</sub>](https://github.com/AlexanderWPapyrus)<br />[💻](https://github.com/snipe/snipe-it/commits?author=AlexanderWPapyrus "Code") | [<img src="https://avatars.githubusercontent.com/u/306231?v=4" width="110px;"/><br /><sub>Alexandr Hacicheant</sub>](https://github.com/disc)<br />[💻](https://github.com/snipe/snipe-it/commits?author=disc "Code") | [<img src="https://avatars.githubusercontent.com/u/3032891?v=4" width="110px;"/><br /><sub>Hex</sub>](https://hex128.io/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=hex128 "Code") | [<img src="https://avatars.githubusercontent.com/u/8697942?v=4" width="110px;"/><br /><sub>Arunas Skirius</sub>](https://github.com/arukompas)<br />[💻](https://github.com/snipe/snipe-it/commits?author=arukompas "Code") | [<img src="https://avatars.githubusercontent.com/u/104396?v=4" width="110px;"/><br /><sub>Ben Periton</sub>](https://github.com/benperiton)<br />[💻](https://github.com/snipe/snipe-it/commits?author=benperiton "Code") | [<img src="https://avatars.githubusercontent.com/u/11906832?v=4" width="110px;"/><br /><sub>Byron Wolfman</sub>](https://wolfman.dev/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=byronwolfman "Code") | [<img src="https://avatars.githubusercontent.com/u/56485508?v=4" width="110px;"/><br /><sub>Calvin</sub>](https://github.com/CalvinSchwartz)<br />[💻](https://github.com/snipe/snipe-it/commits?author=CalvinSchwartz "Code") |
| [<img src="https://avatars.githubusercontent.com/u/181059?v=4" width="110px;"/><br /><sub>Juan Font</sub>](https://github.com/juanfont)<br />[💻](https://github.com/snipe/snipe-it/commits?author=juanfont "Code") | [<img src="https://avatars.githubusercontent.com/u/13137708?v=4" width="110px;"/><br /><sub>Juho Taipale</sub>](https://github.com/juhotaipale)<br />[💻](https://github.com/snipe/snipe-it/commits?author=juhotaipale "Code") | [<img src="https://avatars.githubusercontent.com/u/1007419?v=4" width="110px;"/><br /><sub>Korvin Szanto</sub>](https://github.com/KorvinSzanto)<br />[💻](https://github.com/snipe/snipe-it/commits?author=KorvinSzanto "Code") | [<img src="https://avatars.githubusercontent.com/u/8513053?v=4" width="110px;"/><br /><sub>Lewis Foster</sub>](https://lewisfoster.foo/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=sniff122 "Code") | [<img src="https://avatars.githubusercontent.com/u/33877541?v=4" width="110px;"/><br /><sub>Logan Swartzendruber</sub>](https://github.com/loganswartz)<br />[💻](https://github.com/snipe/snipe-it/commits?author=loganswartz "Code") | [<img src="https://avatars.githubusercontent.com/u/1156208?v=4" width="110px;"/><br /><sub>Lorenzo P.</sub>](https://github.com/lopezio)<br />[💻](https://github.com/snipe/snipe-it/commits?author=lopezio "Code") | [<img src="https://avatars.githubusercontent.com/u/33946590?v=4" width="110px;"/><br /><sub>Lukas Jung</sub>](https://github.com/m4us1ne)<br />[💻](https://github.com/snipe/snipe-it/commits?author=m4us1ne "Code") |
| [<img src="https://avatars.githubusercontent.com/u/10965027?v=4" width="110px;"/><br /><sub>Ellie</sub>](https://leafedfox.xyz/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=LeafedFox "Code") | [<img src="https://avatars.githubusercontent.com/u/20960555?v=4" width="110px;"/><br /><sub>GA Stamper</sub>](https://github.com/gastamper)<br />[💻](https://github.com/snipe/snipe-it/commits?author=gastamper "Code") | [<img src="https://avatars.githubusercontent.com/u/206553556?v=4" width="110px;"/><br /><sub>Guillaume Lefranc</sub>](https://github.com/gl-pup)<br />[💻](https://github.com/snipe/snipe-it/commits?author=gl-pup "Code") | [<img src="https://avatars.githubusercontent.com/u/733892?v=4" width="110px;"/><br /><sub>Hajo Möller</sub>](https://github.com/dasjoe)<br />[💻](https://github.com/snipe/snipe-it/commits?author=dasjoe "Code") | [<img src="https://avatars.githubusercontent.com/u/3420063?v=4" width="110px;"/><br /><sub>Istvan Basa</sub>](https://github.com/pottom)<br />[💻](https://github.com/snipe/snipe-it/commits?author=pottom "Code") | [<img src="https://avatars.githubusercontent.com/u/810824?v=4" width="110px;"/><br /><sub>JJ Asghar</sub>](https://jjasghar.github.io/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jjasghar "Code") | [<img src="https://avatars.githubusercontent.com/u/40404495?v=4" width="110px;"/><br /><sub>James E. Msenga</sub>](https://github.com/JemCdo)<br />[💻](https://github.com/snipe/snipe-it/commits?author=JemCdo "Code") |
| [<img src="https://avatars.githubusercontent.com/u/6865786?v=4" width="110px;"/><br /><sub>Jan Felix Wiebe</sub>](https://github.com/jfwiebe)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jfwiebe "Code") | [<img src="https://avatars.githubusercontent.com/u/43412008?v=4" width="110px;"/><br /><sub>Jo Drexl</sub>](https://www.nfon.com/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=drexljo "Code") | [<img src="https://avatars.githubusercontent.com/u/4807843?v=4" width="110px;"/><br /><sub>Austin Sasko</sub>](https://github.com/austinsasko)<br />[💻](https://github.com/snipe/snipe-it/commits?author=austinsasko "Code") | [<img src="https://avatars.githubusercontent.com/u/4875039?v=4" width="110px;"/><br /><sub>Jasson</sub>](http://jassoncordones.github.io)<br />[💻](https://github.com/snipe/snipe-it/commits?author=JassonCordones "Code") | [<img src="https://avatars.githubusercontent.com/u/76069640?v=4" width="110px;"/><br /><sub>Okean</sub>](https://github.com/Tinyblargon)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Tinyblargon "Code") | [<img src="https://avatars.githubusercontent.com/u/6515064?v=4" width="110px;"/><br /><sub>Alejandro Medrano</sub>](https://www.lst.tfo.upm.es/alejandro-medrano/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=amedranogil "Code") |
| [<img src="https://avatars.githubusercontent.com/u/6865786?v=4" width="110px;"/><br /><sub>Jan Felix Wiebe</sub>](https://github.com/jfwiebe)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jfwiebe "Code") | [<img src="https://avatars.githubusercontent.com/u/43412008?v=4" width="110px;"/><br /><sub>Jo Drexl</sub>](https://www.nfon.com/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=drexljo "Code") | [<img src="https://avatars.githubusercontent.com/u/4807843?v=4" width="110px;"/><br /><sub>Austin Sasko</sub>](https://github.com/austinsasko)<br />[💻](https://github.com/snipe/snipe-it/commits?author=austinsasko "Code") | [<img src="https://avatars.githubusercontent.com/u/4875039?v=4" width="110px;"/><br /><sub>Jasson</sub>](http://jassoncordones.github.io)<br />[💻](https://github.com/snipe/snipe-it/commits?author=JassonCordones "Code") | [<img src="https://avatars.githubusercontent.com/u/76069640?v=4" width="110px;"/><br /><sub>Okean</sub>](https://github.com/Tinyblargon)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Tinyblargon "Code") |
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
@@ -1,32 +0,0 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class FixUpAssignedTypeWithoutAssignedTo extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'snipeit:assigned-type-fixup';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Fixes up assets that have an assigned_type but no assigned_to';
/**
* Execute the console command.
*/
public function handle()
{
DB::table('assets')->whereNotNull('assigned_type')->whereNull('assigned_to')->update(['assigned_type' => null]);
$this->info("Assets with an assigned_type but no assigned_to are fixed");
}
}
+1 -1
View File
@@ -28,7 +28,7 @@ class CheckoutableCheckedIn
$this->checkedOutTo = $checkedOutTo;
$this->checkedInBy = $checkedInBy;
$this->note = $note;
$this->action_date = $action_date ?? date('Y-m-d H:i:s');
$this->action_date = $action_date ?? date('Y-m-d');
$this->originalValues = $originalValues;
}
}
-4
View File
@@ -1327,10 +1327,6 @@ class Helper
return 'fas fa-user';
case 'supplier':
return 'fa-solid fa-store';
case 'manufacturer':
return 'fa-solid fa-building';
case 'category':
return 'fa-solid fa-table-columns';
}
}
@@ -85,12 +85,6 @@ class AssetModelsController extends Controller
$assetmodels = $assetmodels->where('models.model_number', '=', $request->input('model_number'));
}
if ($request->input('requestable') == 'true') {
$assetmodels = $assetmodels->where('models.requestable', '=', '1');
} elseif ($request->input('requestable') == 'false') {
$assetmodels = $assetmodels->where('models.requestable', '=', '0');
}
if ($request->filled('notes')) {
$assetmodels = $assetmodels->where('models.notes', '=', $request->input('notes'));
}
@@ -237,12 +237,6 @@ class ImportController extends Controller
case 'supplier':
$redirectTo = 'suppliers.index';
break;
case 'manufacturer':
$redirectTo = 'manufacturers.index';
break;
case 'category':
$redirectTo = 'categories.index';
break;
}
if ($errors) { //Failure
@@ -67,10 +67,16 @@ class AssetMaintenancesController extends Controller
// We have to set this so that the correct property is set in the select2 ajax dropdown
$asset->asset_id = $asset->id;
}
// Prepare Asset Maintenance Type List
$assetMaintenanceType = [
'' => 'Select an asset maintenance type',
] + AssetMaintenance::getImprovementOptions();
// Mark the selected asset, if it came in
return view('asset_maintenances/edit')
->with('assetMaintenanceType', AssetMaintenance::getImprovementOptions())
->with('asset', $asset)
->with('assetMaintenanceType', $assetMaintenanceType)
->with('item', new AssetMaintenance);
}
@@ -85,47 +91,43 @@ class AssetMaintenancesController extends Controller
public function store(Request $request) : RedirectResponse
{
$this->authorize('update', Asset::class);
// create a new model instance
$assetMaintenance = new AssetMaintenance();
$assetMaintenance->supplier_id = $request->input('supplier_id');
$assetMaintenance->is_warranty = $request->input('is_warranty');
$assetMaintenance->cost = $request->input('cost');
$assetMaintenance->notes = $request->input('notes');
$asset = Asset::find($request->input('asset_id'));
$assets = Asset::whereIn('id', $request->input('selected_assets'))->get();
foreach ($assets as $asset) {
if ((! Company::isCurrentUserHasAccess($asset)) && ($asset != null)) {
return static::getInsufficientPermissionsRedirect();
}
$assetMaintenance = new AssetMaintenance();
$assetMaintenance->supplier_id = $request->input('supplier_id');
$assetMaintenance->is_warranty = $request->input('is_warranty');
$assetMaintenance->cost = $request->input('cost');
$assetMaintenance->notes = $request->input('notes');
// Save the asset maintenance data
$assetMaintenance->asset_id = $asset->id;
$assetMaintenance->asset_maintenance_type = $request->input('asset_maintenance_type');
$assetMaintenance->title = $request->input('title');
$assetMaintenance->start_date = $request->input('start_date');
$assetMaintenance->completion_date = $request->input('completion_date');
$assetMaintenance->created_by = auth()->id();
if (($assetMaintenance->completion_date !== null)
&& ($assetMaintenance->start_date !== '')
&& ($assetMaintenance->start_date !== '0000-00-00')
) {
$startDate = Carbon::parse($assetMaintenance->start_date);
$completionDate = Carbon::parse($assetMaintenance->completion_date);
$assetMaintenance->asset_maintenance_time = (int) $completionDate->diffInDays($startDate, true);
}
// Was the asset maintenance created?
if (!$assetMaintenance->save()) {
return redirect()->back()->withInput()->withErrors($assetMaintenance->getErrors());
}
if ((! Company::isCurrentUserHasAccess($asset)) && ($asset != null)) {
return static::getInsufficientPermissionsRedirect();
}
return redirect()->route('maintenances.index')
->with('success', trans('admin/asset_maintenances/message.create.success'));
// Save the asset maintenance data
$assetMaintenance->asset_id = $request->input('asset_id');
$assetMaintenance->asset_maintenance_type = $request->input('asset_maintenance_type');
$assetMaintenance->title = $request->input('title');
$assetMaintenance->start_date = $request->input('start_date');
$assetMaintenance->completion_date = $request->input('completion_date');
$assetMaintenance->created_by = auth()->id();
if (($assetMaintenance->completion_date !== null)
&& ($assetMaintenance->start_date !== '')
&& ($assetMaintenance->start_date !== '0000-00-00')
) {
$startDate = Carbon::parse($assetMaintenance->start_date);
$completionDate = Carbon::parse($assetMaintenance->completion_date);
$assetMaintenance->asset_maintenance_time = (int) $completionDate->diffInDays($startDate, true);
}
// Was the asset maintenance created?
if ($assetMaintenance->save()) {
// Redirect to the new asset maintenance page
return redirect()->route('maintenances.index')
->with('success', trans('admin/asset_maintenances/message.create.success'));
}
return redirect()->back()->withInput()->withErrors($assetMaintenance->getErrors());
}
/**
@@ -147,7 +149,7 @@ class AssetMaintenancesController extends Controller
}
// Prepare Improvement Type List
$assetMaintenanceType = ['' => trans('general.select')] + AssetMaintenance::getImprovementOptions();
$assetMaintenanceType = ['' => 'Select an improvement type'] + AssetMaintenance::getImprovementOptions();
return view('asset_maintenances/edit')
->with('selectedAsset', null)
@@ -188,31 +188,14 @@ class AssetsController extends Controller
// Validate the asset before saving
if ($asset->isValid() && $asset->save()) {
$target = null;
$location = null;
if ($userId = request('assigned_user')) {
$target = User::find($userId);
if (!$target) {
return redirect()->back()->withInput()->with('error', trans('admin/hardware/message.create.target_not_found.user'));
}
if (request('assigned_user')) {
$target = User::find(request('assigned_user'));
$location = $target->location_id;
} elseif ($assetId = request('assigned_asset')) {
$target = Asset::find($assetId);
if (!$target) {
return redirect()->back()->withInput()->with('error', trans('admin/hardware/message.create.target_not_found.asset'));
}
} elseif (request('assigned_asset')) {
$target = Asset::find(request('assigned_asset'));
$location = $target->location_id;
} elseif ($locationId = request('assigned_location')) {
$target = Location::find($locationId);
if (!$target) {
return redirect()->back()->withInput()->with('error', trans('admin/hardware/message.create.target_not_found.location'));
}
} elseif (request('assigned_location')) {
$target = Location::find(request('assigned_location'));
$location = $target->id;
}
@@ -463,7 +446,7 @@ class AssetsController extends Controller
event(new CheckoutableCheckedIn($asset, $target, auth()->user(), 'Checkin on delete', $checkin_at, $originalValues));
DB::table('assets')
->where('id', $asset->id)
->update(['assigned_to' => null, 'assigned_type' => null]);
->update(['assigned_to' => null]);
}
@@ -52,17 +52,11 @@ class BulkAssetsController extends Controller
}
$asset_ids = $request->input('ids');
if ($request->input('bulk_actions') === 'checkout') {
$request->session()->flashInput(['selected_assets' => $asset_ids]);
return redirect()->route('hardware.bulkcheckout.show');
}
if ($request->input('bulk_actions') === 'maintenance') {
$request->session()->flashInput(['selected_assets' => $asset_ids]);
return redirect()->route('maintenances.create');
}
// Figure out where we need to send the user after the update is complete, and store that in the session
$bulk_back_url = request()->headers->get('referer');
session(['bulk_back_url' => $bulk_back_url]);
@@ -568,10 +562,7 @@ class BulkAssetsController extends Controller
public function showCheckout() : View
{
$this->authorize('checkout', Asset::class);
$do_not_change = ['' => trans('general.do_not_change')];
$status_label_list = $do_not_change + Helper::deployableStatusLabelList();
return view('hardware/bulk-checkout')->with('statusLabel_list', $status_label_list);
return view('hardware/bulk-checkout');
}
/**
@@ -603,13 +594,13 @@ class BulkAssetsController extends Controller
}
$checkout_at = date('Y-m-d H:i:s');
if (($request->filled('checkout_at')) && ($request->get('checkout_at') != date('Y-m-d'))) {
$checkout_at = $request->get('checkout_at');
$checkout_at = e($request->get('checkout_at'));
}
$expected_checkin = '';
if ($request->filled('expected_checkin')) {
$expected_checkin = $request->get('expected_checkin');
$expected_checkin = e($request->get('expected_checkin'));
}
$errors = [];
@@ -617,11 +608,6 @@ class BulkAssetsController extends Controller
foreach ($assets as $asset) {
$this->authorize('checkout', $asset);
// See if there is a status label passed
if ($request->filled('status_id')) {
$asset->status_id = $request->get('status_id');
}
$checkout_success = $asset->checkOut($target, $admin, $checkout_at, $expected_checkin, e($request->get('note')), $asset->name, null);
//TODO - I think this logic is duplicated in the checkOut method?
@@ -650,7 +650,6 @@ class SettingsController extends Controller
$setting->alert_email = $alert_email;
$setting->admin_cc_email = $admin_cc_email;
$setting->admin_cc_always = $request->validated('admin_cc_always');
$setting->alerts_enabled = $request->input('alerts_enabled', '0');
$setting->alert_interval = $request->input('alert_interval');
$setting->alert_threshold = $request->input('alert_threshold');
+1 -1
View File
@@ -52,6 +52,7 @@ class Kernel extends HttpKernel
'auth:api',
\App\Http\Middleware\CheckLocale::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\App\Http\Middleware\SetAPIResponseHeaders::class,
],
'health' => [
@@ -73,7 +74,6 @@ class Kernel extends HttpKernel
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'api-throttle' => \App\Http\Middleware\SetAPIResponseHeaders::class,
'health' => null,
];
}
@@ -12,8 +12,8 @@ class SetAPIResponseHeaders extends ThrottleRequests
/**
* Add the rate limit headers to the response.
*
* This extends the original ThrottleRequests middleware to add the 'X-RateLimit-Reset' and 'Retry-After' headers, even
* if the rate limit is not exceeded.
* This extends the original ThrottleRequests middleware to add the 'X-RateLimit-Reset' and
* 'Retry-After' headers, even if the rate limit is not exceeded.
* @param $maxAttempts
* @param $remainingAttempts
* @param $retryAfter
@@ -22,6 +22,7 @@ class SetAPIResponseHeaders extends ThrottleRequests
*/
protected function getHeaders($maxAttempts, $remainingAttempts, $retryAfter = null, ?Response $response = null)
{
if ($response &&
! is_null($response->headers->get('X-RateLimit-Remaining')) &&
(int) $response->headers->get('X-RateLimit-Remaining') <= (int) $remainingAttempts) {
@@ -33,7 +34,7 @@ class SetAPIResponseHeaders extends ThrottleRequests
}
$headers = [
'X-RateLimit-Limit' => $maxAttempts,
'X-RateLimit-Limit' => config('app.api_throttle_per_minute'),
'X-RateLimit-Remaining' => $remainingAttempts,
];
@@ -58,8 +59,8 @@ class SetAPIResponseHeaders extends ThrottleRequests
protected function handleRequest($request, Closure $next, array $limits)
{
foreach ($limits as $limit) {
if ($this->limiter->tooManyAttempts($limit->key, $limit->maxAttempts)) {
throw $this->buildException($request, $limit->key, $limit->maxAttempts, $limit->responseCallback);
if ($this->limiter->tooManyAttempts($limit->key, config('app.api_throttle_per_minute'))) {
throw $this->buildException($request, $limit->key, config('app.api_throttle_per_minute'), $limit->responseCallback);
}
$this->limiter->hit($limit->key, $limit->decaySeconds);
@@ -70,8 +71,8 @@ class SetAPIResponseHeaders extends ThrottleRequests
foreach ($limits as $limit) {
$response = $this->addHeaders(
$response,
$limit->maxAttempts,
$this->calculateRemainingAttempts($limit->key, $limit->maxAttempts),
config('app.api_throttle_per_minute'),
$this->calculateRemainingAttempts($limit->key, config('app.api_throttle_per_minute')),
$this->getTimeUntilNextRetry($limit->key) // this is the only line we changed
);
}
@@ -5,7 +5,6 @@ namespace App\Http\Requests;
use App\Models\Accessory;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Gate;
use Illuminate\Validation\Rule;
class StoreNotificationSettings extends FormRequest
{
@@ -27,9 +26,6 @@ class StoreNotificationSettings extends FormRequest
return [
'alert_email' => 'email_array|nullable',
'admin_cc_email' => 'email_array|nullable',
'admin_cc_always' => [
Rule::in('0', '1'),
],
'alert_threshold' => 'numeric|nullable',
'alert_interval' => 'numeric|nullable|gt:0',
'audit_warning_days' => 'numeric|nullable',
+1 -10
View File
@@ -80,16 +80,7 @@ class AssetImporter extends ItemImporter
$asset_tag = Asset::autoincrement_asset();
}
if ($this->findCsvMatch($row, 'id')!='') {
// Override asset if an ID was given
\Log::debug('Finding asset by ID: '.$this->findCsvMatch($row, 'id'));
$asset = Asset::find($this->findCsvMatch($row, 'id'));
} else {
$asset = Asset::where(['asset_tag'=> (string) $asset_tag])->first();
}
$asset = Asset::where(['asset_tag'=> (string) $asset_tag])->first();
if ($asset) {
if (! $this->updating) {
$exists_error = trans('general.import_asset_tag_exists', ['asset_tag' => $asset_tag]);
-99
View File
@@ -1,99 +0,0 @@
<?php
namespace App\Importer;
use App\Models\Category;
use Illuminate\Support\Facades\Log;
/**
* When we are importing users via an Asset/etc import, we use createOrFetchUser() in
* Importer\Importer.php. [ALG]
*
* Class CategoryImporter
*/
class CategoryImporter extends ItemImporter
{
protected $categories;
public function __construct($filename)
{
parent::__construct($filename);
}
protected function handle($row)
{
parent::handle($row);
$this->createCategoryIfNotExists($row);
}
/**
* Create a category if a duplicate does not exist.
* @todo Investigate how this should interact with Importer::createCategoryIfNotExists
*
* @author A. Gianotto
* @since 6.1.0
* @param array $row
*/
public function createCategoryIfNotExists(array $row)
{
$editingCategory = false;
$category = Category::where('name', '=', $this->findCsvMatch($row, 'name'))->first();
if ($this->findCsvMatch($row, 'id')!='') {
// Override category if an ID was given
\Log::debug('Finding category by ID: '.$this->findCsvMatch($row, 'id'));
$category = Category::find($this->findCsvMatch($row, 'id'));
}
if ($category) {
if (! $this->updating) {
$this->log('A matching Category '.$this->item['name'].' already exists');
return;
}
$this->log('Updating Category');
$editingCategory = true;
} else {
$this->log('No Matching Category, Create a new one');
$category = new Category;
$category->created_by = auth()->id();
}
// Pull the records from the CSV to determine their values
$this->item['name'] = trim($this->findCsvMatch($row, 'name'));
$this->item['notes'] = trim($this->findCsvMatch($row, 'notes'));
$this->item['eula_text'] = trim($this->findCsvMatch($row, 'eula_text'));
$this->item['category_type'] = trim($this->findCsvMatch($row, 'category_type'));
$this->item['use_default_eula'] = trim(($this->fetchHumanBoolean($this->findCsvMatch($row, 'use_default_eula'))) == 1) ? 1 : 0;
$this->item['require_acceptance'] = trim(($this->fetchHumanBoolean($this->findCsvMatch($row, 'require_acceptance'))) == 1) ? 1 : 0;
$this->item['checkin_email'] = trim(($this->fetchHumanBoolean($this->findCsvMatch($row, 'checkin_email'))) == 1) ? 1 : 0;
Log::debug('Item array is: ');
Log::debug(print_r($this->item, true));
if ($editingCategory) {
Log::debug('Updating existing category');
$category->update($this->sanitizeItemForUpdating($category));
} else {
Log::debug('Creating category');
$category->fill($this->sanitizeItemForStoring($category));
}
if ($category->save()) {
$this->log('Category '.$category->name.' created or updated from CSV import');
return $category;
} else {
Log::debug($category->getErrors());
$this->logError($category, 'Category "'.$this->item['name'].'"');
return $category->errors;
}
}
}
+1 -1
View File
@@ -110,7 +110,7 @@ class ItemImporter extends Importer
protected function determineCheckout($row)
{
// Locations don't get checked out to anyone/anything
if ((get_class($this) == LocationImporter::class) || (get_class($this) == AssetModelImporter::class) || (get_class($this) == SupplierImporter::class) || (get_class($this) == ManufacturerImporter::class) || (get_class($this) == CategoryImporter::class)) {
if ((get_class($this) == LocationImporter::class) || (get_class($this) == AssetModelImporter::class) || (get_class($this) == SupplierImporter::class)) {
return;
}
-101
View File
@@ -1,101 +0,0 @@
<?php
namespace App\Importer;
use App\Models\Manufacturer;
use Illuminate\Support\Facades\Log;
/**
* When we are importing users via an Asset/etc import, we use createOrFetchUser() in
* Importer\Importer.php. [ALG]
*
* Class ManufacturerImporter
*/
class ManufacturerImporter extends ItemImporter
{
protected $manufacturers;
public function __construct($filename)
{
parent::__construct($filename);
}
protected function handle($row)
{
parent::handle($row);
$this->createManufacturerIfNotExists($row);
}
/**
* Create a supplier if a duplicate does not exist.
* @todo Investigate how this should interact with Importer::createManufacturerIfNotExists
*
* @author A. Gianotto
* @since 6.1.0
* @param array $row
*/
public function createManufacturerIfNotExists(array $row)
{
$editingManufacturer = false;
$supplier = Manufacturer::where('name', '=', $this->findCsvMatch($row, 'name'))->first();
if ($this->findCsvMatch($row, 'id')!='') {
// Override supplier if an ID was given
\Log::debug('Finding supplier by ID: '.$this->findCsvMatch($row, 'id'));
$supplier = Manufacturer::find($this->findCsvMatch($row, 'id'));
}
if ($supplier) {
if (! $this->updating) {
$this->log('A matching Manufacturer '.$this->item['name'].' already exists');
return;
}
$this->log('Updating Manufacturer');
$editingManufacturer = true;
} else {
$this->log('No Matching Manufacturer, Create a new one');
$supplier = new Manufacturer;
$supplier->created_by = auth()->id();
}
// Pull the records from the CSV to determine their values
$this->item['name'] = trim($this->findCsvMatch($row, 'name'));
$this->item['support_phone'] = trim($this->findCsvMatch($row, 'support_phone'));
$this->item['fax'] = trim($this->findCsvMatch($row, 'fax'));
$this->item['support_email'] = trim($this->findCsvMatch($row, 'support_email'));
$this->item['contact'] = trim($this->findCsvMatch($row, 'contact'));
$this->item['url'] = trim($this->findCsvMatch($row, 'url'));
$this->item['support_url'] = trim($this->findCsvMatch($row, 'support_url'));
$this->item['warranty_lookup_url'] = trim($this->findCsvMatch($row, 'warranty_lookup_url'));
$this->item['notes'] = trim($this->findCsvMatch($row, 'notes'));
Log::debug('Item array is: ');
Log::debug(print_r($this->item, true));
if ($editingManufacturer) {
Log::debug('Updating existing supplier');
$supplier->update($this->sanitizeItemForUpdating($supplier));
} else {
Log::debug('Creating supplier');
$supplier->fill($this->sanitizeItemForStoring($supplier));
}
if ($supplier->save()) {
$this->log('Manufacturer '.$supplier->name.' created or updated from CSV import');
return $supplier;
} else {
Log::debug($supplier->getErrors());
$this->logError($supplier, 'Manufacturer "'.$this->item['name'].'"');
return $supplier->errors;
}
}
}
+5 -15
View File
@@ -69,16 +69,16 @@ class CheckoutableListener
return;
}
$acceptance = $this->getCheckoutAcceptance($event);
$shouldSendEmailToUser = $this->shouldSendCheckoutEmailToUser($event->checkoutable);
$shouldSendEmailToAlertAddress = $this->shouldSendEmailToAlertAddress($acceptance);
$shouldSendEmailToAlertAddress = $this->shouldSendEmailToAlertAddress();
$shouldSendWebhookNotification = $this->shouldSendWebhookNotification();
if (!$shouldSendEmailToUser && !$shouldSendEmailToAlertAddress && !$shouldSendWebhookNotification) {
return;
}
$acceptance = $this->getCheckoutAcceptance($event);
if ($shouldSendEmailToUser || $shouldSendEmailToAlertAddress) {
$mailable = $this->getCheckoutMailType($event, $acceptance);
$notifiable = $this->getNotifiableUser($event);
@@ -419,19 +419,9 @@ class CheckoutableListener
return false;
}
private function shouldSendEmailToAlertAddress($acceptance = null): bool
private function shouldSendEmailToAlertAddress(): bool
{
$setting = Setting::getSettings();
if (!$setting) {
return false;
}
if (is_null($acceptance) && !$setting->admin_cc_always) {
return false;
}
return (bool) $setting->admin_cc_email;
return Setting::getSettings() && Setting::getSettings()->admin_cc_email;
}
private function getFormattedAlertAddresses(): array
-35
View File
@@ -41,8 +41,6 @@ class Importer extends Component
public $locations_fields;
public $consumables_fields;
public $components_fields;
public $manufacturers_fields;
public $categories_fields;
public $aliases_fields;
protected $rules = [
@@ -101,12 +99,6 @@ class Importer extends Component
case 'supplier':
$results = $this->suppliers_fields;
break;
case 'manufacturer':
$results = $this->manufacturers_fields;
break;
case 'category':
$results = $this->categories_fields;
break;
default:
$results = [];
}
@@ -179,8 +171,6 @@ class Importer extends Component
'location' => trans('general.locations'),
'user' => trans('general.users'),
'supplier' => trans('general.suppliers'),
'manufacturer' => trans('general.manufacturers'),
'category' => trans('general.categories'),
];
/**
@@ -203,7 +193,6 @@ class Importer extends Component
];
$this->assets_fields = [
'id' => trans('general.id'),
'asset_eol_date' => trans('admin/hardware/form.eol_date'),
'asset_model' => trans('general.model_name'),
'asset_notes' => trans('general.item_notes', ['item' => trans('admin/hardware/general.asset')]),
@@ -374,30 +363,6 @@ class Importer extends Component
'email' => trans('general.email'),
];
$this->manufacturers_fields = [
'id' => trans('general.id'),
'name' => trans('general.name'),
'notes' => trans('general.notes'),
'support_phone' => trans('admin/manufacturers/table.support_phone'),
'support_url' => trans('admin/manufacturers/table.support_url'),
'support_email' => trans('admin/manufacturers/table.support_email'),
'warranty_lookup_url' => trans('admin/manufacturers/table.warranty_lookup_url'),
'url' => trans('general.url'),
];
$this->categories_fields = [
'id' => trans('general.id'),
'name' => trans('general.name'),
'notes' => trans('general.notes'),
'category_type' => trans('admin/categories/general.import_category_type'),
'eula_text' => trans('admin/categories/general.import_eula_text'),
'use_default_eula' => trans('admin/categories/general.use_default_eula_column'),
'require_acceptance' => trans('admin/categories/general.import_require_acceptance'),
'checkin_email' => trans('admin/categories/general.import_checkin_email'),
];
$this->assetmodels_fields = [
'category' => trans('general.category'),
'eol' => trans('general.eol'),
+3 -3
View File
@@ -122,9 +122,9 @@ class Asset extends Depreciable
'assigned_to' => ['nullable', 'integer', 'required_with:assigned_type'],
'assigned_type' => ['nullable', 'required_with:assigned_to', 'in:'.User::class.",".Location::class.",".Asset::class],
'requestable' => ['nullable', 'boolean'],
'assigned_user' => ['integer', 'nullable', 'exists:users,id,deleted_at,NULL'],
'assigned_location' => ['integer', 'nullable', 'exists:locations,id,deleted_at,NULL', 'fmcs_location'],
'assigned_asset' => ['integer', 'nullable', 'exists:assets,id,deleted_at,NULL']
'assigned_user' => ['nullable', 'exists:users,id,deleted_at,NULL'],
'assigned_location' => ['nullable', 'exists:locations,id,deleted_at,NULL', 'fmcs_location'],
'assigned_asset' => ['nullable', 'exists:assets,id,deleted_at,NULL']
];
+1 -1
View File
@@ -26,7 +26,7 @@ class AssetMaintenance extends Model implements ICompanyableChild
protected $table = 'asset_maintenances';
protected $rules = [
'asset_id' => 'required|integer',
'supplier_id' => 'nullable|integer',
'supplier_id' => 'required|integer',
'asset_maintenance_type' => 'required',
'title' => 'required|max:100',
'is_warranty' => 'boolean',
+3 -3
View File
@@ -95,7 +95,7 @@ trait Loggable
$changed = [];
$array_to_flip = array_keys($fields_array);
$array_to_flip = array_merge($array_to_flip, ['name','status_id','location_id','expected_checkin']);
$array_to_flip = array_merge($array_to_flip, ['action_date','name','status_id','location_id','expected_checkin']);
$originalValues = array_intersect_key($originalValues, array_flip($array_to_flip));
@@ -182,7 +182,7 @@ trait Loggable
$log->note = $note;
$log->action_date = $action_date;
if (!$action_date) {
if (! $log->action_date) {
$log->action_date = date('Y-m-d H:i:s');
}
@@ -193,7 +193,7 @@ trait Loggable
$changed = [];
$array_to_flip = array_keys($fields_array);
$array_to_flip = array_merge($array_to_flip, ['name','status_id','location_id','expected_checkin']);
$array_to_flip = array_merge($array_to_flip, ['action_date','name','status_id','location_id','expected_checkin']);
$originalValues = array_intersect_key($originalValues, array_flip($array_to_flip));
-4
View File
@@ -62,7 +62,6 @@ class AssetObserver
$logAction = new Actionlog();
$logAction->item_type = Asset::class;
$logAction->item_id = $asset->id;
$logAction->action_date = date('Y-m-d H:i:s');
$logAction->created_at = date('Y-m-d H:i:s');
$logAction->created_by = auth()->id();
$logAction->log_meta = json_encode($changed);
@@ -109,7 +108,6 @@ class AssetObserver
$logAction = new Actionlog();
$logAction->item_type = Asset::class; // can we instead say $logAction->item = $asset ?
$logAction->item_id = $asset->id;
$logAction->action_date = date('Y-m-d H:i:s');
$logAction->created_at = date('Y-m-d H:i:s');
$logAction->created_by = auth()->id();
if($asset->imported) {
@@ -130,7 +128,6 @@ class AssetObserver
$logAction->item_type = Asset::class;
$logAction->item_id = $asset->id;
$logAction->created_at = date('Y-m-d H:i:s');
$logAction->action_date = date('Y-m-d H:i:s');
$logAction->created_by = auth()->id();
$logAction->logaction('delete');
}
@@ -146,7 +143,6 @@ class AssetObserver
$logAction = new Actionlog();
$logAction->item_type = Asset::class;
$logAction->item_id = $asset->id;
$logAction->action_date = date('Y-m-d H:i:s');
$logAction->created_at = date('Y-m-d H:i:s');
$logAction->created_by = auth()->id();
$logAction->logaction('restore');
+2 -14
View File
@@ -25,16 +25,6 @@ class Label implements View
*/
protected $data;
/**
* TCPDF output destination.
* "I" - inline by default.
* See TCPDF's Output method for details.
*
* @var string
*/
private string $destination = 'I';
public function __construct() {
$this->data = new Collection();
}
@@ -150,9 +140,7 @@ class Label implements View
$barcode2DTarget = $asset->serial;
break;
case 'location':
$barcode2DTarget = $asset->location_id
? route('locations.show', $asset->location_id)
: null;
$barcode2DTarget = route('locations.show', $asset->location_id);
break;
case 'hardware_id':
default:
@@ -232,7 +220,7 @@ class Label implements View
$template->writeAll($pdf, $data);
$filename = $assets->count() > 1 ? 'assets.pdf' : $assets->first()->asset_tag.'.pdf';
$pdf->Output($filename, $this->destination);
$pdf->Output($filename, 'I');
}
/**
+5 -5
View File
@@ -1,10 +1,10 @@
<?php
return array (
'app_version' => 'v8.1.15',
'full_app_version' => 'v8.1.15 - build 18405-ge4314cf42',
'build_version' => '18405',
'app_version' => 'v8.1.4',
'full_app_version' => 'v8.1.4 - build 18245-g101b8afb5',
'build_version' => '18245',
'prerelease_version' => '',
'hash_version' => 'ge4314cf42',
'full_hash' => 'v8.1.15-13-ge4314cf42',
'hash_version' => 'g101b8afb5',
'full_hash' => 'v8.1.4-180-g101b8afb5',
'branch' => 'develop',
);
-32
View File
@@ -201,36 +201,4 @@ class ImportFactory extends Factory
});
}
/**
* Create a supplier import type.
*
* @return static
*/
public function manufacturers()
{
return $this->state(function (array $attributes) {
$fileBuilder = Importing\ManufacturersImportFileBuilder::new();
$attributes['name'] = "Manufacturer {$attributes['name']}";
$attributes['import_type'] = 'manufacturer';
$attributes['header_row'] = $fileBuilder->toCsv()[0];
$attributes['first_row'] = $fileBuilder->firstRow();
return $attributes;
});
}
public function categories()
{
return $this->state(function (array $attributes) {
$fileBuilder = Importing\CategoriesImportFileBuilder::new();
$attributes['name'] = "Category {$attributes['name']}";
$attributes['import_type'] = 'category';
$attributes['header_row'] = $fileBuilder->toCsv()[0];
$attributes['first_row'] = $fileBuilder->firstRow();
return $attributes;
});
}
}
@@ -1,27 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('settings', function (Blueprint $table) {
$table->boolean('admin_cc_always')->after('admin_cc_email')->default(1);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('settings', function (Blueprint $table) {
$table->dropColumn('admin_cc_always');
});
}
};
@@ -1,23 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
DB::table('assets')->whereNotNull('assigned_type')->whereNull('assigned_to')->update(['assigned_type' => null]);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
}
};
@@ -1,28 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('action_logs', function (Blueprint $table) {
$table->index('deleted_at');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('action_logs', function (Blueprint $table) {
$table->dropIndex('deleted_at');
});
}
};
@@ -1,27 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('asset_maintenances', function (Blueprint $table) {
$table->integer('supplier_id')->nullable()->default(null)->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};
+2 -2
View File
@@ -21,7 +21,7 @@ services:
- .env.dev.docker
mariadb:
image: mariadb:11.4.7
image: mariadb:11.5.2
volumes:
- db:/var/lib/mysql
env_file:
@@ -36,7 +36,7 @@ services:
retries: 5
redis:
image: redis:7.4.3
image: redis:7.4.0
mailhog:
image: mailhog/mailhog:v1.0.1
+1 -1
View File
@@ -20,7 +20,7 @@ services:
- .env
db:
image: mariadb:11.4.7
image: mariadb:11.5.2
restart: unless-stopped
volumes:
- db_data:/var/lib/mysql
+7 -5
View File
@@ -100,12 +100,14 @@ chown -R docker:root /var/www/html/storage/framework/cache
# Fix php settings
if [ -v "PHP_UPLOAD_LIMIT" ]
then
PHP_INI_FILE=$(find /etc/php/*/apache2/php.ini)
if [ -e $PHP_INI_FILE ]
echo "Changing upload limit to ${PHP_UPLOAD_LIMIT}"
if [ -e /etc/php/*/apache2/php.ini ]
then
echo "Changing upload limit to ${PHP_UPLOAD_LIMIT}M in ${PHP_INI_FILE}"
sed -i "s/^upload_max_filesize.*/upload_max_filesize = ${PHP_UPLOAD_LIMIT}M/" $PHP_INI_FILE
sed -i "s/^post_max_size.*/post_max_size = ${PHP_UPLOAD_LIMIT}M/" $PHP_INI_FILE
sed -i "s/^upload_max_filesize.*/upload_max_filesize = ${PHP_UPLOAD_LIMIT}M/" /etc/php/*/apache2/php.ini
sed -i "s/^post_max_size.*/post_max_size = ${PHP_UPLOAD_LIMIT}M/" /etc/php/*/apache2/php.ini
else
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
fi
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -110,6 +110,6 @@
"/css/dist/skins/skin-yellow.min.css": "/css/dist/skins/skin-yellow.min.css?id=7b315b9612b8fde8f9c5b0ddb6bba690",
"/css/dist/bootstrap-table.css": "/css/dist/bootstrap-table.css?id=54d676a6ea8677dd48f6c4b3041292cf",
"/js/build/vendor.js": "/js/build/vendor.js?id=89dffa552c6e3abe3a2aac6c9c7b466b",
"/js/dist/bootstrap-table.js": "/js/dist/bootstrap-table.js?id=60097b6b56d80cbc76257d4ecf6f57b4",
"/js/dist/bootstrap-table.js": "/js/dist/bootstrap-table.js?id=783d3a8076337744f0176d60e1041ea4",
"/js/dist/all.js": "/js/dist/all.js?id=8c6d7286f667eeb62a0a28a09851a6c3"
}
@@ -1,7 +1,6 @@
<?php
return [
'select_type' => 'Select Maintenance Type',
'asset_maintenance_type' => 'Asset Maintenance Type',
'title' => 'Title',
'start_date' => 'Start Date',
@@ -21,9 +21,5 @@ return array(
'use_default_eula' => 'Use the <a href="#" data-toggle="modal" data-target="#eulaModal">primary default EULA</a> instead.',
'use_default_eula_disabled' => '<del>Use the primary default EULA instead.</del> No primary default EULA is set. Please add one in Settings.',
'use_default_eula_column' => 'Use default EULA',
'import_require_acceptance' => 'Require Acceptance',
'import_checkin_email' => 'Send Checkin Email',
'import_eula_text' => 'EULA text',
'import_category_type' => 'Category Type',
);
@@ -60,11 +60,5 @@ return [
'display_checkin' => 'Display in checkin forms',
'display_checkout' => 'Display in checkout forms',
'display_audit' => 'Display in audit forms',
'types' => [
'text' => 'Text Box',
'listbox' => 'List Box',
'textarea' => 'Textarea (multi-line)',
'checkbox' => 'Checkbox',
'radio' => 'Radio Buttons',
],
];
@@ -9,7 +9,6 @@ return [
'bulk_checkin' => 'Bulk Checkin',
'checkin' => 'Checkin Asset',
'checkout' => 'Checkout Asset',
'clear' => 'Clear',
'clone' => 'Clone Asset',
'deployable' => 'Deployable',
'deleted' => 'This asset has been deleted.',
@@ -19,11 +19,6 @@ return [
'success_linked' => 'Asset with tag :tag was created successfully. <strong><a href=":link" style="color: white;">Click here to view</a></strong>.',
'multi_success_linked' => 'Asset with tag :links was created successfully.|:count assets were created succesfully. :links.',
'partial_failure' => 'An asset was unable to be created. Reason: :failures|:count assets were unable to be created. Reasons: :failures',
'target_not_found' => [
'user' => 'The assigned user could not be found.',
'asset' => 'The assigned asset could not be found.',
'location' => 'The assigned location could not be found.',
],
],
'update' => [
@@ -9,8 +9,6 @@ return [
'ad_append_domain_help' => 'User isn\'t required to write "username@domain.local", they can just type "username".',
'admin_cc_email' => 'CC Email',
'admin_cc_email_help' => 'Send a copy of checkin/checkout emails to this address.',
'admin_cc_always' => 'Always send copy upon checkin/checkout',
'admin_cc_when_acceptance_required' => 'Only send copy upon checkout if acceptance is required',
'admin_settings' => 'Admin Settings',
'is_ad' => 'This is an Active Directory server',
'alerts' => 'Alerts',
@@ -486,7 +484,6 @@ return [
'php_overview' => 'phpinfo, system, info',
'purge' => 'permanently delete',
'security' => 'password, passwords, requirements, two factor, two-factor, common passwords, remote login, logout, authentication',
'notifications' => 'alerts, email, notifications, audit, threshold, email alerts, cc',
],
];
-78
View File
@@ -1,78 +0,0 @@
<?php
return array(
/*
|--------------------------------------------------------------------------
| Authentication Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used during authentication for various
| messages that we need to display to the user. You are free to modify
| these language lines according to your application's requirements.
|
*/
'today' => 'Today',
'clear' => 'Clear',
'days' => [
'sunday' => 'Sunday',
'monday' => 'Monday',
'tuesday' => 'Tuesday',
'wednesday' => 'Wednesday',
'thursday' => 'Thursday',
'friday' => 'Friday',
'saturday' => 'Saturday',
],
'short_days' => [
'sunday' => 'Sun',
'monday' => 'Mon',
'tuesday' => 'Tue',
'wednesday' => 'Wed',
'thursday' => 'Thu',
'friday' => 'Fri',
'saturday' => 'Sat',
],
'min_days' => [
'sunday' => 'Su',
'monday' => 'Mo',
'tuesday' => 'Tu',
'wednesday' => 'We',
'thursday' => 'Th',
'friday' => 'Fr',
'saturday' => 'Sa',
],
'months' => [
'january' => 'January',
'february' => 'February',
'march' => 'March',
'april' => 'April',
'may' => 'May',
'june' => 'June',
'july' => 'July',
'august' => 'August',
'september' => 'September',
'october' => 'October',
'november' => 'November',
'december' => 'December',
],
'months_short' => [
'january' => 'Jan',
'february' => 'Feb',
'march' => 'Mar',
'april' => 'Apr',
'may' => 'May',
'june' => 'Jun',
'july' => 'Jul',
'august' => 'Aug',
'september' => 'Sep',
'october' => 'Oct',
'november' => 'Nov',
'december' => 'Dec',
],
);
-3
View File
@@ -581,9 +581,6 @@ return [
'user_managed_passwords_allow' => 'Allow users to manage their own passwords',
'from' => 'From',
'by' => 'By',
'version' => 'Version',
'build' => 'build',
'footer_credit' => '<a target="_blank" href="https://snipeitapp.com" rel="noopener">Snipe-IT</a> is open source software, made with <i class="fa fa-heart" aria-hidden="true" style="color: #a94442; font-size: 10px" /></i><span class="sr-only">love</span> by <a href="https://bsky.app/profile/snipeitapp.com" rel="noopener">@snipeitapp.com</a>.',
// Add form placeholders here
'placeholders' => [
+19
View File
@@ -219,3 +219,22 @@ Form::macro('username_format', function ($name = 'username_format', $selected =
return $select;
});
Form::macro('customfield_elements', function ($name = 'customfield_elements', $selected = null, $class = null) {
$formats = [
'text' => 'Text Box',
'listbox' => 'List Box',
'textarea' => 'Textarea (multi-line) ',
'checkbox' => 'Checkbox',
'radio' => 'Radio Buttons',
];
$select = '<select name="'.$name.'" class="'.$class.'" style="width: 100%" aria-label="'.$name.'">';
foreach ($formats as $format => $label) {
$select .= '<option value="'.$format.'"'.($selected == $format ? ' selected="selected" role="option" aria-selected="true"' : ' aria-selected="false"').'>'.$label.'</option> '."\n";
}
$select .= '</select>';
return $select;
});
+1 -1
View File
@@ -22,7 +22,7 @@
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
@include ('partials.forms.edit.model_number')
@include ('partials.forms.edit.order_number')
@include ('partials.forms.edit.datepicker', ['translated_name' => trans('general.purchase_date'),'fieldname' => 'purchase_date'])
@include ('partials.forms.edit.purchase_date')
@include ('partials.forms.edit.purchase_cost', ['currency_type' => $item->location->currency ?? null])
@include ('partials.forms.edit.quantity')
@include ('partials.forms.edit.minimum_quantity')
@@ -26,9 +26,7 @@
data-cookie-id-table="accessoriesTable"
data-pagination="true"
data-id-table="accessoriesTable"
data-search-highlight="true"
data-search="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-fullscreen="true"
@@ -80,9 +80,7 @@
data-cookie-id-table="checkoutsTable"
data-pagination="true"
data-id-table="checkoutsTable"
data-search-highlight="true"
data-search="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-fullscreen="true"
@@ -118,9 +116,6 @@
data-show-refresh="true"
data-show-export="true"
data-sort-order="desc"
data-search-highlight="true"
data-search="true"
data-show-print="true"
data-export-options='{
"fileName": "export-{{ str_slug($accessory->name) }}-history-{{ date('Y-m-d') }}",
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
@@ -56,8 +56,6 @@
data-pagination="true"
data-id-table="requestableAssetsListingTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="false"
@@ -108,9 +106,6 @@
data-toolbar="#toolbar"
class="table table-striped snipe-table"
id="table"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-advanced-search="true"
data-id-table="advancedTable"
data-cookie-id-table="requestableAssets">
@@ -15,7 +15,6 @@
<div class="box-body">
<table
data-show-print="true"
data-cookie-id-table="userRequests"
data-pagination="true"
data-id-table="userRequests"
@@ -384,8 +384,6 @@
data-pagination="true"
data-id-table="userAssets"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="client"
data-show-columns="true"
data-show-export="true"
@@ -537,8 +535,6 @@
data-pagination="true"
data-id-table="userLicenses"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="client"
data-show-columns="true"
data-show-export="true"
@@ -606,8 +602,6 @@
data-id-table="userAccessoryTable"
id="userAccessoryTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-pagination="true"
data-side-pagination="client"
data-show-columns="true"
@@ -664,8 +658,6 @@
data-id-table="userConsumableTable"
id="userConsumableTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-pagination="true"
data-side-pagination="client"
data-show-columns="true"
@@ -54,20 +54,10 @@
</div>
@include ('partials.forms.edit.asset-select', [
'translated_name' => trans('general.assets'),
'fieldname' => 'selected_assets[]',
'multiple' => true,
'required' => true,
'select_id' => 'assigned_assets_select',
'asset_selector_div_id' => 'assets_to_checkout_div',
'asset_ids' => old('selected_assets')
])
@include ('partials.forms.edit.asset-select', ['translated_name' => trans('general.asset'), 'fieldname' => 'asset_id', 'required' => 'true'])
@include ('partials.forms.edit.supplier-select', ['translated_name' => trans('general.supplier'), 'fieldname' => 'supplier_id', 'required' => 'true'])
@include ('partials.forms.edit.maintenance_type')
@include ('partials.forms.edit.supplier-select', ['translated_name' => trans('general.supplier'), 'fieldname' => 'supplier_id'])
<!-- Start Date -->
@@ -75,12 +65,10 @@
<label for="start_date" class="col-md-3 control-label">{{ trans('admin/asset_maintenances/form.start_date') }}</label>
<div class="input-group col-md-3">
<x-input.datepicker
name="start_date"
:value="old('start_date', $item->start_date)"
placeholder="{{ trans('general.select_date') }}"
required="{{ Helper::checkIfRequired($item, 'start_date') }}"
/>
<div class="input-group date" data-provide="datepicker" data-date-format="yyyy-mm-dd" data-autoclose="true" data-date-clear-btn="true">
<input type="text" class="form-control" placeholder="{{ trans('general.select_date') }}" name="start_date" id="start_date" value="{{ old('start_date', $item->start_date) }}"{{ (Helper::checkIfRequired($item, 'start_date')) ? ' required' : '' }}>
<span class="input-group-addon"><x-icon type="calendar" /></span>
</div>
{!! $errors->first('start_date', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
@@ -92,12 +80,12 @@
<label for="start_date" class="col-md-3 control-label">{{ trans('admin/asset_maintenances/form.completion_date') }}</label>
<div class="input-group col-md-3">
<x-input.datepicker
name="completion_date"
:value="old('start_date', $item->start_date)"
placeholder="{{ trans('general.select_date') }}"
required="Helper::checkIfRequired($item, 'completion_date')"
/>
<div class="input-group date" data-date-clear-btn="true" data-provide="datepicker" data-date-format="yyyy-mm-dd" data-autoclose="true">
<input type="text" class="form-control" placeholder="{{ trans('general.select_date') }}" name="completion_date" id="completion_date" value="{{ old('completion_date', $item->completion_date) }}"{{ (Helper::checkIfRequired($item, 'completion_date')) ? ' required' : '' }}>
<span class="input-group-addon">
<x-icon type="calendar" />
</span>
</div>
{!! $errors->first('completion_date', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
@@ -25,9 +25,7 @@
data-columns="{{ \App\Presenters\AssetMaintenancesPresenter::dataTableLayout() }}"
data-cookie-id-table="maintenancesTable"
data-pagination="true"
data-search-highlight="true"
data-search="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-fullscreen="true"
@@ -13,8 +13,6 @@
data-id-table="{{ str_slug($object->name ?? $object->id) }}UploadsTable"
id="{{ str_slug($object->name ?? $object->id) }}UploadsTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-pagination="true"
data-side-pagination="client"
data-show-columns="true"
@@ -1,13 +0,0 @@
@props([
'value' => '',
'required' => '',
'end_date' => null,
'col_size_class' => null,
])
<!-- Datepicker -->
<div class="input-group date {{ $col_size_class }}" data-provide="datepicker" data-date-today-highlight="true" data-date-language="{{ auth()->user()->locale }}" data-date-locale="{{ auth()->user()->locale }}" data-date-format="yyyy-mm-dd" data-date-autoclose="true" data-date-clear-btn="true"{{ $end_date ? ' data-date-end-date=' . $end_date : '' }}>
<input type="text" placeholder="{{ trans('general.select_date') }}" value="{{ $value }}" maxlength="10" {{ $attributes->merge(['class' => 'form-control']) }} {{ $required=='1' ? 'required' : '' }}>
<span class="input-group-addon"><x-icon type="calendar" /></span>
</div>
+1 -1
View File
@@ -25,7 +25,7 @@
];
if ($includeBlankOption) {
$formats = ['' => trans('general.skins.site_default')] + $formats;
$formats = ['' => 'Site Default'] + $formats;
}
@endphp
@@ -25,8 +25,6 @@
data-pagination="true"
data-id-table="categoryTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-fullscreen="true"
@@ -128,8 +128,6 @@
data-pagination="true"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-show-footer="true"
data-side-pagination="server"
data-show-columns="true"
@@ -22,8 +22,6 @@
data-pagination="true"
data-id-table="companiesTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
-7
View File
@@ -95,8 +95,6 @@
data-pagination="true"
data-id-table="assetsListingTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
@@ -126,7 +124,6 @@
data-pagination="true"
data-id-table="licensesTable"
data-search="true"
data-search-highlight="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
@@ -153,7 +150,6 @@
data-pagination="true"
data-id-table="accessoriesTable"
data-search="true"
data-search-highlight="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
@@ -180,7 +176,6 @@
data-pagination="true"
data-id-table="consumablesTable"
data-search="true"
data-search-highlight="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
@@ -207,7 +202,6 @@
data-pagination="true"
data-id-table="componentsTable"
data-search="true"
data-search-highlight="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
@@ -234,7 +228,6 @@
data-pagination="true"
data-id-table="usersTable"
data-search="true"
data-search-highlight="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
+1 -1
View File
@@ -26,7 +26,7 @@
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
@include ('partials.forms.edit.supplier-select', ['translated_name' => trans('general.supplier'), 'fieldname' => 'supplier_id'])
@include ('partials.forms.edit.order_number')
@include ('partials.forms.edit.datepicker', ['translated_name' => trans('general.purchase_date'),'fieldname' => 'purchase_date'])
@include ('partials.forms.edit.purchase_date')
@include ('partials.forms.edit.purchase_cost')
@include ('partials.forms.edit.notes')
@include ('partials.forms.edit.image-upload', ['image_path' => app('components_upload_path')])
@@ -24,8 +24,6 @@
data-pagination="true"
data-id-table="componentsTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-footer-style="footerStyle"
data-show-columns="true"
@@ -99,8 +99,6 @@
data-pagination="true"
data-id-table="componentsCheckedoutTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
+1 -1
View File
@@ -22,7 +22,7 @@
@include ('partials.forms.edit.model_number')
@include ('partials.forms.edit.item_number')
@include ('partials.forms.edit.order_number')
@include ('partials.forms.edit.datepicker', ['translated_name' => trans('general.purchase_date'),'fieldname' => 'purchase_date'])
@include ('partials.forms.edit.purchase_date')
@include ('partials.forms.edit.purchase_cost')
@include ('partials.forms.edit.quantity')
@include ('partials.forms.edit.minimum_quantity')
@@ -26,8 +26,6 @@
data-pagination="true"
data-id-table="consumablesTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-footer-style="footerStyle"
data-show-columns="true"
@@ -399,7 +399,6 @@
data-pagination="true"
data-id-table="consumablesCheckedoutTable"
data-search="false"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
@@ -454,8 +453,6 @@
data-pagination="true"
data-id-table="consumableHistory"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-fullscreen="true"
@@ -58,19 +58,7 @@
</label>
<div class="col-md-8 required">
<x-input.select
name="element"
:selected="old('element', $field->element)"
class="field_element"
style="width: 100%;"
:options="[
'text' => trans('admin/custom_fields/general.types.text'),
'listbox' => trans('admin/custom_fields/general.types.listbox'),
'textarea' => trans('admin/custom_fields/general.types.textarea'),
'checkbox' => trans('admin/custom_fields/general.types.checkbox'),
'radio' => trans('admin/custom_fields/general.types.radio'),
]"
/>
{!! Form::customfield_elements('element', old('element', $field->element), 'field_element select2 form-control') !!}
{!! $errors->first('element', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
@@ -31,8 +31,6 @@
data-cookie-id-table="customFieldsetsTable"
data-id-table="customFieldsetsTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="client"
data-show-columns="true"
data-show-export="true"
@@ -133,8 +131,6 @@
data-cookie-id-table="customFieldsTable"
data-id-table="customFieldsTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="client"
data-show-columns="true"
data-show-export="true"
@@ -21,8 +21,6 @@
data-pagination="true"
data-id-table="departmentsTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-fullscreen="true"
@@ -29,8 +29,6 @@
data-pagination="true"
data-id-table="departmentsUsersTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-show-footer="true"
data-side-pagination="server"
data-show-columns="true"
@@ -25,8 +25,6 @@
data-pagination="true"
data-id-table="depreciationsTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
@@ -70,8 +70,6 @@
id="depreciationsAssetTable"
data-pagination="true"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
@@ -106,8 +104,6 @@
id="depreciationsLicenseTable"
data-pagination="true"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
@@ -153,8 +149,6 @@
id="depreciationsModelsTable"
data-pagination="true"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-toolbar="#toolbar"
data-side-pagination="server"
data-show-columns="true"
-2
View File
@@ -24,8 +24,6 @@
data-cookie-id-table="groupsTable"
data-pagination="true"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
-2
View File
@@ -29,8 +29,6 @@
data-cookie-id-table="groupsUsersTable"
data-pagination="true"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
+2 -4
View File
@@ -51,12 +51,10 @@
<table
data-click-to-select="true"
data-columns="{{ \App\Presenters\AssetAuditPresenter::dataTableLayout() }}"
data-cookie-id-table="dueAssetAuditListing"
data-cookie-id-table="dueAssetAuditListing"
data-pagination="true"
data-id-table="dueAssetAuditListing"
data-id-table="dueAssetAuditListing"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-fullscreen="true"
@@ -39,23 +39,6 @@
])
<!-- Status -->
<div class="form-group {{ $errors->has('status_id') ? 'error' : '' }}">
<label for="status_id" class="col-md-3 control-label">
{{ trans('admin/hardware/form.status') }}
</label>
<div class="col-md-7 required">
<x-input.select
name="status_id"
:options="$statusLabel_list"
:selected="old('status_id', $status_id ?? null)"
style="width: 100%;"
aria-label="status_id"
/>
{!! $errors->first('status_id', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
<!-- Checkout selector -->
@include ('partials.forms.checkout-selector', ['user_select' => 'true','asset_select' => 'true', 'location_select' => 'true'])
@@ -137,14 +120,6 @@
//if there's already a user selected, make sure their checked-out assets show up
// (if there isn't one, it won't do anything)
$('#assigned_user').change();
// Add the disabled attribute to empty inputs on submit to handle the case where someone does not pick a status ID
// and the form is submitted with an empty status ID which will fail validation via the form request
$("form").submit(function() {
$(this).find(":input").filter(function(){ return !this.value; }).attr("disabled", "disabled");
return true; // ensure form still submits
});
});
</script>
-13
View File
@@ -266,16 +266,3 @@
</div> <!--/.col-md-8-->
</div>
@stop
@section('moar_scripts')
<script>
document.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll('.clear-radio').forEach(function (button) {
button.addEventListener('click', function () {
const name = this.dataset.targetName;
const radios = document.querySelectorAll('input[type="radio"][name="' + name + '"]');
radios.forEach(radio => radio.checked = false);
});
});
});
</script>
@endsection
@@ -53,8 +53,6 @@
data-pagination="true"
data-id-table="dueAssetcheckinListing"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-fullscreen="true"
+28 -15
View File
@@ -110,15 +110,14 @@
{{ trans('admin/hardware/form.checkout_date') }}
</label>
<div class="col-md-8">
<x-input.datepicker
name="checkout_at"
end_date="0d"
col_size_class="col-md-7"
:value="old('expected_checkin', date('Y-m-d'))"
placeholder="{{ trans('general.select_date') }}"
required="{{ Helper::checkIfRequired($item, 'checkout_at') }}"
/>
<div class="input-group date col-md-7" data-provide="datepicker"
data-date-format="yyyy-mm-dd" data-date-end-date="0d" data-date-clear-btn="true">
<input type="text" class="form-control"
placeholder="{{ trans('general.select_date') }}" name="checkout_at"
id="checkout_at" value="{{ old('checkout_at', date('Y-m-d')) }}">
<span class="input-group-addon">
<x-icon type="calendar" /></span>
</div>
{!! $errors->first('checkout_at', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
@@ -130,12 +129,15 @@
</label>
<div class="col-md-8">
<x-input.datepicker
name="expected_checkin"
:value="old('expected_checkin', $item->expected_checkin)"
placeholder="{{ trans('general.select_date') }}"
required="{{ Helper::checkIfRequired($item, 'expected_checkin') }}"
/>
<div class="input-group date col-md-7" data-provide="datepicker"
data-date-format="yyyy-mm-dd" data-date-start-date="0d" data-date-clear-btn="true">
<input type="text" class="form-control"
placeholder="{{ trans('general.select_date') }}" name="expected_checkin"
id="expected_checkin" value="{{ old('expected_checkin') }}">
<span class="input-group-addon">
<x-icon type="calendar" />
</span>
</div>
{!! $errors->first('expected_checkin', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
@@ -222,4 +224,15 @@
@section('moar_scripts')
@include('partials/assets-assigned')
<script>
// $('#checkout_at').datepicker({
// clearBtn: true,
// todayHighlight: true,
// endDate: '0d',
// format: 'yyyy-mm-dd'
// });
</script>
@stop
+24 -4
View File
@@ -114,8 +114,28 @@
<div id="optional_details" class="col-md-12" style="display:none">
@include ('partials.forms.edit.name', ['translated_name' => trans('admin/hardware/form.name')])
@include ('partials.forms.edit.warranty')
@include ('partials.forms.edit.datepicker', ['translated_name' => trans('admin/hardware/form.expected_checkin'),'fieldname' => 'expected_checkin'])
@include ('partials.forms.edit.datepicker', ['translated_name' => trans('general.next_audit_date'),'fieldname' => 'next_audit_date', 'help_text' => trans('general.next_audit_date_help')])
<!-- Datepicker -->
<div class="form-group{{ $errors->has('next_audit_date') ? ' has-error' : '' }}">
<label class="col-md-3 control-label" for="next_audit_date">
{{ trans('general.next_audit_date') }}
</label>
<div class="input-group col-md-4">
<div class="input-group date" data-provide="datepicker" data-date-clear-btn="true" data-date-format="yyyy-mm-dd" data-autoclose="true">
<input type="text" class="form-control" placeholder="{{ trans('general.select_date') }}" name="next_audit_date" id="next_audit_date" value="{{ old('next_audit_date', $item->next_audit_date) }}" readonly style="background-color:inherit" maxlength="10">
<span class="input-group-addon"><x-icon type="calendar" /></span>
</div>
</div>
<div class="col-md-8 col-md-offset-3">
{!! $errors->first('next_audit_date', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
<p class="help-block">{!! trans('general.next_audit_date_help') !!}</p>
</div>
</div>
<!-- byod checkbox -->
<div class="form-group byod">
<div class="col-md-7 col-md-offset-3">
@@ -147,8 +167,8 @@
<div id='order_details' class="col-md-12" style="display:none">
@include ('partials.forms.edit.order_number')
@include ('partials.forms.edit.datepicker', ['translated_name' => trans('general.purchase_date'),'fieldname' => 'purchase_date'])
@include ('partials.forms.edit.datepicker', ['translated_name' => trans('admin/hardware/form.eol_date'),'fieldname' => 'asset_eol_date'])
@include ('partials.forms.edit.purchase_date')
@include ('partials.forms.edit.eol_date')
@include ('partials.forms.edit.supplier-select', ['translated_name' => trans('general.supplier'), 'fieldname' => 'supplier_id'])
@php
-2
View File
@@ -73,8 +73,6 @@
data-pagination="true"
data-id-table="assetsListingTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-search-text="{{ e(Session::get('search')) }}"
data-side-pagination="server"
data-show-columns="true"
@@ -28,8 +28,6 @@
id="requestedAssets"
data-advanced-search="true"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-show-columns="true"
data-show-export="true"
data-pagination="true"
-11
View File
@@ -1282,8 +1282,6 @@
data-pagination="true"
data-id-table="assetsTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-fullscreen="true"
@@ -1326,8 +1324,6 @@
data-pagination="true"
data-id-table="accessoriesAssignedListingTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
@@ -1364,8 +1360,6 @@
data-pagination="true"
data-id-table="assetMaintenancesTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-toolbar="#maintenance-toolbar"
data-show-columns="true"
@@ -1395,9 +1389,6 @@
data-pagination="true"
data-id-table="asseAuditHistory"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-fullscreen="true"
@@ -1443,8 +1434,6 @@
data-pagination="true"
data-id-table="assetHistory"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-fullscreen="true"
-2
View File
@@ -24,8 +24,6 @@
data-columns="{{ \App\Presenters\PredefinedKitPresenter::dataTableLayout() }}"
data-pagination="true"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-fullscreen="true"
+5 -66
View File
@@ -921,14 +921,15 @@ dir="{{ Helper::determineLanguageDirection() }}">
<footer class="main-footer hidden-print" style="display:grid;flex-direction:column;">
<div class="1hidden-xs pull-left">
<div class="pull-left">
{!! trans('general.footer_credit') !!}
<div class="pull-left" >
<a target="_blank" href="https://snipeitapp.com" rel="noopener">Snipe-IT</a> is open source software, made with <x-icon type="heart" style="color: #a94442; font-size: 10px" />
<span class="sr-only">love</span> by <a href="https://bsky.app/profile/snipeitapp.com" rel="noopener">@snipeitapp</a>.
</div>
<div class="pull-right">
@if ($snipeSettings->version_footer!='off')
@if (($snipeSettings->version_footer=='on') || (($snipeSettings->version_footer=='admin') && (Auth::user()->isSuperUser()=='1')))
&nbsp; <strong>{{ trans('general.version') }}</strong> {{ config('version.app_version') }} -
{{ trans('general.build') }} {{ config('version.build_version') }} ({{ config('version.branch') }})
&nbsp; <strong>Version</strong> {{ config('version.app_version') }} -
build {{ config('version.build_version') }} ({{ config('version.branch') }})
@endif
@endif
@@ -1028,68 +1029,6 @@ dir="{{ Helper::determineLanguageDirection() }}">
<script nonce="{{ csrf_token() }}">
$.fn.datepicker.dates['{{ app()->getLocale() }}'] = {
days: [
"{{ trans('datepicker.days.sunday') }}",
"{{ trans('datepicker.days.monday') }}",
"{{ trans('datepicker.days.tuesday') }}",
"{{ trans('datepicker.days.wednesday') }}",
"{{ trans('datepicker.days.thursday') }}",
"{{ trans('datepicker.days.friday') }}",
"{{ trans('datepicker.days.saturday') }}"
],
daysShort: [
"{{ trans('datepicker.short_days.sunday') }}",
"{{ trans('datepicker.short_days.monday') }}",
"{{ trans('datepicker.short_days.tuesday') }}",
"{{ trans('datepicker.short_days.wednesday') }}",
"{{ trans('datepicker.short_days.thursday') }}",
"{{ trans('datepicker.short_days.friday') }}",
"{{ trans('datepicker.short_days.saturday') }}"
],
daysMin: [
"{{ trans('datepicker.min_days.sunday') }}",
"{{ trans('datepicker.min_days.monday') }}",
"{{ trans('datepicker.min_days.tuesday') }}",
"{{ trans('datepicker.min_days.wednesday') }}",
"{{ trans('datepicker.min_days.thursday') }}",
"{{ trans('datepicker.min_days.friday') }}",
"{{ trans('datepicker.min_days.saturday') }}"
],
months: [
"{{ trans('datepicker.months.january') }}",
"{{ trans('datepicker.months.february') }}",
"{{ trans('datepicker.months.march') }}",
"{{ trans('datepicker.months.april') }}",
"{{ trans('datepicker.months.may') }}",
"{{ trans('datepicker.months.june') }}",
"{{ trans('datepicker.months.july') }}",
"{{ trans('datepicker.months.august') }}",
"{{ trans('datepicker.months.september') }}",
"{{ trans('datepicker.months.october') }}",
"{{ trans('datepicker.months.november') }}",
"{{ trans('datepicker.months.december') }}",
],
monthsShort: [
"{{ trans('datepicker.months_short.january') }}",
"{{ trans('datepicker.months_short.february') }}",
"{{ trans('datepicker.months_short.march') }}",
"{{ trans('datepicker.months_short.april') }}",
"{{ trans('datepicker.months_short.may') }}",
"{{ trans('datepicker.months_short.june') }}",
"{{ trans('datepicker.months_short.july') }}",
"{{ trans('datepicker.months_short.august') }}",
"{{ trans('datepicker.months_short.september') }}",
"{{ trans('datepicker.months_short.october') }}",
"{{ trans('datepicker.months_short.november') }}",
"{{ trans('datepicker.months_short.december') }}",
],
today: "{{ trans('datepicker.today') }}",
clear: "{{ trans('datepicker.clear') }}",
format: "yyyy-mm-dd",
weekStart: 0
};
var clipboard = new ClipboardJS('.js-copy-link');
clipboard.on('success', function(e) {
+1 -1
View File
@@ -78,7 +78,7 @@
@include ('partials.forms.edit.supplier-select', ['translated_name' => trans('general.supplier'), 'fieldname' => 'supplier_id'])
@include ('partials.forms.edit.order_number')
@include ('partials.forms.edit.purchase_cost')
@include ('partials.forms.edit.datepicker', ['translated_name' => trans('general.purchase_date'),'fieldname' => 'purchase_date'])
@include ('partials.forms.edit.purchase_date')
<!-- Expiration Date -->
<div class="form-group {{ $errors->has('expiration_date') ? ' has-error' : '' }}">
-2
View File
@@ -32,8 +32,6 @@
data-cookie-id-table="licensesTable"
data-pagination="true"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-footer-style="footerStyle"
data-show-columns="true"
-4
View File
@@ -440,7 +440,6 @@
id="seatsTable"
data-pagination="true"
data-search="false"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-fullscreen="true"
@@ -490,9 +489,6 @@
data-show-refresh="true"
data-show-export="true"
data-sort-order="desc"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-export-options='{
"fileName": "export-{{ str_slug($license->name) }}-history-{{ date('Y-m-d') }}",
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
+1 -1
View File
@@ -191,7 +191,7 @@
@if (($typeOfImport != 'location' && $typeOfImport!= 'assetModel' && $typeOfImport!= 'component' && $typeOfImport!= 'supplier') && $typeOfImport!= 'manufacturer' && $typeOfImport!= 'category' && ($typeOfImport!=''))
@if (($typeOfImport != 'location' && $typeOfImport!= 'assetModel' && $typeOfImport!= 'component') && ($typeOfImport!=''))
<label class="form-control">
<input type="checkbox" name="send_welcome" data-livewire-component="{{ $this->getId() }}" wire:model.live="send_welcome">
{{ trans('general.send_welcome_email_to_users') }}
@@ -30,8 +30,6 @@
data-bulk-button-id="#bulkLocationsEditButton"
data-bulk-form-id="#locationsBulkForm"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-fullscreen="true"
-18
View File
@@ -192,8 +192,6 @@
data-pagination="true"
data-id-table="usersTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
@@ -223,8 +221,6 @@
data-pagination="true"
data-id-table="assetsListingTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
@@ -257,8 +253,6 @@
data-pagination="true"
data-id-table="assetsAssignedListingTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
@@ -289,8 +283,6 @@
data-pagination="true"
data-id-table="RTDassetsListingTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
@@ -321,8 +313,6 @@
data-pagination="true"
data-id-table="accessoriesListingTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
@@ -350,8 +340,6 @@
data-pagination="true"
data-id-table="accessoriesAssignedListingTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
@@ -378,8 +366,6 @@
data-pagination="true"
data-id-table="consumablesListingTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
@@ -404,8 +390,6 @@
data-pagination="true"
data-id-table="componentsTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
@@ -448,8 +432,6 @@
data-pagination="true"
data-id-table="assetHistory"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-fullscreen="true"
@@ -54,8 +54,6 @@
data-pagination="true"
data-id-table="manufacturersTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-fullscreen="true"
@@ -111,8 +111,6 @@
data-bulk-button-id="#bulkAssetEditButton"
data-bulk-form-id="#assetsBulkForm"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-show-fullscreen="true"
data-side-pagination="server"
data-show-columns="true"
@@ -139,8 +137,6 @@
data-pagination="true"
data-id-table="licensesTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-show-footer="true"
data-side-pagination="server"
data-show-columns="true"
@@ -167,8 +163,6 @@
data-pagination="true"
data-id-table="accessoriesTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-show-footer="true"
data-side-pagination="server"
data-show-columns="true"
@@ -195,8 +189,6 @@
data-pagination="true"
data-id-table="consumablesTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-show-footer="true"
data-side-pagination="server"
data-show-columns="true"
@@ -222,8 +214,6 @@
data-pagination="true"
data-id-table="componentsTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-show-footer="true"
data-side-pagination="server"
data-show-columns="true"
@@ -35,9 +35,9 @@
@if($field->is_unique)
<input type="text" class="form-control" disabled value="{{ trans('/admin/hardware/form.bulk_update_custom_field_unique') }}">
@endif
@if(!$field->is_unique)
@if(!$field->is_unique)
<textarea class="col-md-6 form-control" id="{{ $field->db_column_name() }}" name="{{ $field->db_column_name() }}">{{ old($field->db_column_name(),(isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : $field->defaultValue($model->id))) }}</textarea>
@endif
@endif
@elseif ($field->element=='checkbox')
<!-- Checkboxes -->
@foreach ($field->formatFieldValuesAsArray() as $key => $value)
@@ -56,11 +56,7 @@
</label>
@endforeach
<button type="button"
class="btn btn-default btn-xs clear-radio"
data-target-name="{{ $field->db_column_name() }}">
{{ trans('/admin/hardware/general.clear') }}
</button>
@endif
@else
@@ -123,4 +119,4 @@
</div>
@endforeach
@endif
@endforeach
@endforeach
-2
View File
@@ -43,8 +43,6 @@
data-pagination="true"
data-id-table="asssetModelsTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-show-footer="true"
data-side-pagination="server"
data-footer-style="footerStyle"
-2
View File
@@ -91,8 +91,6 @@
data-pagination="true"
data-id-table="assetListingTable"
data-search="true"
data-search-highlight="true"
data-show-print="true"
data-side-pagination="server"
data-show-columns="true"
data-show-fullscreen="true"
@@ -24,7 +24,6 @@
@else
@can('update', \App\Models\Asset::class)
<option value="edit">{{ trans('button.edit') }}</option>
<option value="maintenance">{{ trans('button.add_maintenance') }}</option>
@endcan
@can('checkout', \App\Models\Asset::class)
<option value="checkout">{{ trans('general.bulk_checkout') }}</option>
@@ -2,21 +2,11 @@
<div class="form-group{{ $errors->has($fieldname) ? ' has-error' : '' }}">
<label for="{{ $fieldname }}" class="col-md-3 control-label">{{ $translated_name }}</label>
<div class="input-group col-md-4">
<x-input.datepicker
name="{{ $fieldname }}"
value="{{ old($fieldname, ($item->{$fieldname}) ? date('Y-m-d', strtotime($item->{$fieldname})) : '') }}"
placeholder="{{ trans('general.select_date') }}"
required="{{ Helper::checkIfRequired($item, 'start_date') }}"
/>
<div class="input-group date" data-provide="datepicker" data-date-clear-btn="true" data-date-format="yyyy-mm-dd" data-autoclose="true">
<input type="text" class="form-control" placeholder="{{ trans('general.select_date') }}" name="{{ $fieldname }}" id="{{ $fieldname }}" value="{{ old($fieldname, ($item->{$fieldname}) ? date('Y-m-d', strtotime($item->{$fieldname})) : '') }}" readonly style="background-color:inherit" maxlength="10">
<span class="input-group-addon"><x-icon type="calendar" /></span>
</div>
{!! $errors->first($fieldname, '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
@if (isset($help_text))
<div class="col-md-8 col-md-offset-3">
<p class="help-block">
{!! $help_text !!}
</p>
</div>
@endif
</div>
<!-- /Datepicker -->
@@ -0,0 +1,11 @@
<!-- EOL Date -->
<div class="form-group {{ $errors->has('asset_eol_date') ? ' has-error' : '' }}">
<label for="asset_eol_date" class="col-md-3 control-label">{{ trans('admin/hardware/form.eol_date') }}</label>
<div class="input-group col-md-4">
<div class="input-group date" data-provide="datepicker" data-date-clear-btn="true" data-date-format="yyyy-mm-dd" data-autoclose="true">
<input type="text" class="form-control" placeholder="{{ trans('general.select_date') }}" name="asset_eol_date" id="asset_eol_date" readonly value="{{ old('asset_eol_date', optional($item->asset_eol_date)->format('Y-m-d') ?? $item->asset_eol_date ?? '') }}" style="background-color:inherit" maxlength="20" />
<span class="input-group-addon"><x-icon type="calendar" /></span>
</div>
{!! $errors->first('asset_eol_date', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
@@ -8,8 +8,6 @@
:options="$assetMaintenanceType"
:selected="old('asset_maintenance_type', $item->asset_maintenance_type)"
:required="Helper::checkIfRequired($item, 'asset_maintenance_type')"
data-placeholder="{{ trans('admin/asset_maintenances/form.select_type')}}"
includeEmpty="true"
style="width:100%;"
aria-label="asset_maintenance_type"
/>

Some files were not shown because too many files have changed in this diff Show More