diff --git a/Dockerfile b/Dockerfile index 09e511ba8..ed942e258 100644 --- a/Dockerfile +++ b/Dockerfile @@ -96,6 +96,8 @@ RUN \ && rm -r "/var/www/html/storage/app/backups" && ln -fs "/var/lib/snipeit/dumps" "/var/www/html/storage/app/backups" \ && mkdir -p "/var/lib/snipeit/keys" && ln -fs "/var/lib/snipeit/keys/oauth-private.key" "/var/www/html/storage/oauth-private.key" \ && ln -fs "/var/lib/snipeit/keys/oauth-public.key" "/var/www/html/storage/oauth-public.key" \ + && ln -fs "/var/lib/snipeit/keys/ldap_client_tls.cert" "/var/www/html/storage/ldap_client_tls.cert" \ + && ln -fs "/var/lib/snipeit/keys/ldap_client_tls.key" "/var/www/html/storage/ldap_client_tls.key" \ && chown docker "/var/lib/snipeit/keys/" \ && chown -h docker "/var/www/html/storage/" \ && chmod +x /var/www/html/artisan \ diff --git a/app/Console/Commands/RestoreFromBackup.php b/app/Console/Commands/RestoreFromBackup.php index 8f8114229..0ebda27d8 100644 --- a/app/Console/Commands/RestoreFromBackup.php +++ b/app/Console/Commands/RestoreFromBackup.php @@ -14,7 +14,7 @@ class RestoreFromBackup extends Command */ protected $signature = 'snipeit:restore {--force : Skip the danger prompt; assuming you hit "y"} - {filename : The zip file to be migrated} + {filename : The full path of the .zip file to be migrated} {--no-progress : Don\'t show a progress bar}'; /** @@ -22,7 +22,7 @@ class RestoreFromBackup extends Command * * @var string */ - protected $description = 'Restore from a previously created backup'; + protected $description = 'Restore from a previously created Snipe-IT backup file'; /** * Create a new command instance. @@ -34,6 +34,8 @@ class RestoreFromBackup extends Command parent::__construct(); } + public static $buffer_size = 1024 * 1024; // use a 1MB buffer, ought to work fine for most cases? + /** * Execute the console command. * @@ -42,7 +44,10 @@ class RestoreFromBackup extends Command public function handle() { $dir = getcwd(); - echo "Current working directory is: $dir\n"; + if( $dir != base_path() ) { // usually only the case when running via webserver, not via command-line + \Log::debug("Current working directory is: $dir, changing directory to: ".base_path()); + chdir(base_path()); // TODO - is this *safe* to change on a running script?! + } // $filename = $this->argument('filename'); @@ -67,7 +72,7 @@ class RestoreFromBackup extends Command ZipArchive::ER_INCONS => 'Zip archive inconsistent.', ZipArchive::ER_INVAL => 'Invalid argument.', ZipArchive::ER_MEMORY => 'Malloc failure.', - ZipArchive::ER_NOENT => 'No such file.', + ZipArchive::ER_NOENT => 'No such file ('.$filename.') in directory '.$dir.'.', ZipArchive::ER_NOZIP => 'Not a zip archive.', ZipArchive::ER_OPEN => "Can't open file.", ZipArchive::ER_READ => 'Read error.', @@ -144,7 +149,7 @@ class RestoreFromBackup extends Command continue; } if (@pathinfo($raw_path)['extension'] == 'sql') { - echo "Found a sql file!\n"; + \Log::debug("Found a sql file!"); $sqlfiles[] = $raw_path; $sqlfile_indices[] = $i; continue; @@ -206,7 +211,13 @@ class RestoreFromBackup extends Command $env_vars = getenv(); $env_vars['MYSQL_PWD'] = config('database.connections.mysql.password'); - $proc_results = proc_open('mysql -h '.escapeshellarg(config('database.connections.mysql.host')).' -u '.escapeshellarg(config('database.connections.mysql.username')).' '.escapeshellarg(config('database.connections.mysql.database')), // yanked -p since we pass via ENV + // TODO notes: we are stealing the dump_binary_path (which *probably* also has your copy of the mysql binary in it. But it might not, so we might need to extend this) + // we unilaterally prepend a slash to the `mysql` command. This might mean your path could look like /blah/blah/blah//mysql - which should be fine. But maybe in some environments it isn't? + $mysql_binary = config('database.connections.mysql.dump.dump_binary_path').'/mysql'; + if( ! file_exists($mysql_binary) ) { + return $this->error("mysql tool at: '$mysql_binary' does not exist, cannot restore. Please edit DB_DUMP_PATH in your .env to point to a directory that contains the mysqldump and mysql binary"); + } + $proc_results = proc_open("$mysql_binary -h ".escapeshellarg(config('database.connections.mysql.host')).' -u '.escapeshellarg(config('database.connections.mysql.username')).' '.escapeshellarg(config('database.connections.mysql.database')), // yanked -p since we pass via ENV [0 => ['pipe', 'r'], 1 => ['pipe', 'w'], 2 => ['pipe', 'w']], $pipes, null, @@ -233,9 +244,10 @@ class RestoreFromBackup extends Command return false; } - - while (($buffer = fgets($sql_contents)) !== false) { - //$this->info("Buffer is: '$buffer'"); + $bytes_read = 0; + while (($buffer = fgets($sql_contents, self::$buffer_size)) !== false) { + $bytes_read += strlen($buffer); + // \Log::debug("Buffer is: '$buffer'"); $bytes_written = fwrite($pipes[0], $buffer); if ($bytes_written === false) { $stdout = fgets($pipes[1]); @@ -246,6 +258,10 @@ class RestoreFromBackup extends Command return false; } } + if (!feof($sql_contents) || $bytes_read == 0) { + return $this->error("Not at end of file for sql file, or zero bytes read. aborting!"); + } + fclose($pipes[0]); fclose($sql_contents); @@ -273,7 +289,7 @@ class RestoreFromBackup extends Command $fp = $za->getStream($ugly_file_name); //$this->info("Weird problem, here are file details? ".print_r($file_details,true)); $migrated_file = fopen($file_details['dest'].'/'.basename($pretty_file_name), 'w'); - while (($buffer = fgets($fp)) !== false) { + while (($buffer = fgets($fp, self::$buffer_size)) !== false) { fwrite($migrated_file, $buffer); } fclose($migrated_file); diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index 6e56b317d..cdf37a903 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -171,6 +171,7 @@ class AssetsController extends Controller // case we override with the actual count, so we should return 0 items. $offset = (($assets) && ($request->get('offset') > $assets->count())) ? $assets->count() : $request->get('offset', 0); + // Check to make sure the limit is not higher than the max allowed ((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results'); @@ -336,6 +337,7 @@ class AssetsController extends Controller return (new $transformer)->transformAssets($assets, $total, $request); } + /** * Returns JSON with information about an asset (by tag) for detail view. * @@ -373,9 +375,19 @@ class AssetsController extends Controller } return response()->json(Helper::formatStandardApiResponse('error', null, 'Asset not found'), 200); + $assets = Asset::with('assetstatus')->with('assignedTo'); + if ($request->input('deleted', 'false') === 'true') { + $assets = $assets->withTrashed(); } + $assets = $assets->where('serial', $serial)->get(); + if ($assets) { + return (new AssetsTransformer)->transformAssets($assets, $assets->count()); + } else { + return response()->json(Helper::formatStandardApiResponse('error', null, 'Asset not found'), 200); + } + } /** * Returns JSON with information about an asset for detail view. @@ -677,6 +689,8 @@ class AssetsController extends Controller return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/hardware/message.does_not_exist')), 200); } + + /** * Restore a soft-deleted asset. * @@ -899,7 +913,7 @@ class AssetsController extends Controller } } - return response()->json(Helper::formatStandardApiResponse('error', ['asset_tag'=> e($request->input('asset_tag'))], 'Asset with tag '.$request->input('asset_tag').' not found')); + return response()->json(Helper::formatStandardApiResponse('error', ['asset_tag'=> e($request->input('asset_tag'))], 'Asset with tag '.e($request->input('asset_tag')).' not found')); diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index a52598592..bf6ad5333 100755 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -11,7 +11,6 @@ use App\Models\Setting; use App\Models\User; use App\Notifications\FirstAdminNotification; use App\Notifications\MailTest; -use Artisan; use Auth; use Crypt; use DB; @@ -22,6 +21,8 @@ use Image; use Input; use Redirect; use Response; +use Illuminate\Support\Str; +use Illuminate\Support\Facades\Artisan; /** * This controller handles all actions related to Settings for @@ -1018,17 +1019,25 @@ class SettingsController extends Controller $backup_files = Storage::files($path); $files_raw = []; + if (count($backup_files) > 0) { for ($f = 0; $f < count($backup_files); $f++) { // Skip dotfiles like .gitignore and .DS_STORE if ((substr(basename($backup_files[$f]), 0, 1) != '.')) { + //$lastmodified = Carbon::parse(Storage::lastModified($backup_files[$f]))->toDatetimeString(); + $file_timestamp = Storage::lastModified($backup_files[$f]); + + $files_raw[] = [ 'filename' => basename($backup_files[$f]), 'filesize' => Setting::fileSizeConvert(Storage::size($backup_files[$f])), - 'modified' => Storage::lastModified($backup_files[$f]), + 'modified_value' => $file_timestamp, + 'modified_display' => Helper::getFormattedDateObject($file_timestamp, $type = 'datetime', false), + ]; } + } } @@ -1128,6 +1137,115 @@ class SettingsController extends Controller } } + + /** + * Uploads a backup file + * + * @author [A. Gianotto] [] + * + * @since [v6.0] + * + * @return Redirect + */ + + public function postUploadBackup(Request $request) { + + if (! config('app.lock_passwords')) { + if (!$request->hasFile('file')) { + return redirect()->route('settings.backups.index')->with('error', 'No file uploaded'); + } else { + $max_file_size = Helper::file_upload_max_size(); + + $rules = [ + 'file' => 'required|mimes:zip|max:'.$max_file_size, + ]; + + $validator = \Validator::make($request->all(), $rules); + + if ($validator->passes()) { + + $upload_filename = 'uploaded-'.date('U').'-'.Str::slug(pathinfo($request->file('file')->getClientOriginalName(), PATHINFO_FILENAME)).'.zip'; + + Storage::putFileAs('app/backups', $request->file('file'), $upload_filename); + + return redirect()->route('settings.backups.index')->with('success', 'File uploaded'); + } else { + return redirect()->route('settings.backups.index')->withErrors($request->getErrors()); + } + } + + } else { + return redirect()->route('settings.backups.index')->with('error', trans('general.feature_disabled')); + } + + + + } + + /** + * Restore the backup file. + * + * @author [A. Gianotto] [] + * + * @since [v6.0] + * + * @return View + */ + public function postRestore($filename = null) + { + + if (! config('app.lock_passwords')) { + $path = 'app/backups'; + + if (Storage::exists($path.'/'.$filename)) { + + // grab the user's info so we can make sure they exist in the system + $user = User::find(Auth::user()->id); + + + // TODO: run a backup + + // TODO: add db:wipe + + + // run the restore command + Artisan::call('snipeit:restore', + [ + '--force' => true, + '--no-progress' => true, + 'filename' => storage_path($path).'/'.$filename + ]); + + $output = Artisan::output(); + + + // If it's greater than 300, it probably worked + if (strlen($output) > 300) { + \Auth::logout(); + return redirect()->route('login')->with('success', 'Your system has been restored. Please login again.'); + } else { + return redirect()->route('settings.backups.index')->with('error', $output); + + } + //dd($output); + + // TODO: insert the user if they are not there in the old one + + + + + // log the user out + + + + } else { + return redirect()->route('settings.backups.index')->with('error', trans('admin/settings/message.backup.file_not_found')); + } + } else { + return redirect()->route('settings.backups.index')->with('error', trans('general.feature_disabled')); + } + } + /** * Return a form to allow a super admin to update settings. * diff --git a/app/Http/Requests/AssetFileRequest.php b/app/Http/Requests/AssetFileRequest.php index 1aa1fadb8..f8631f23b 100644 --- a/app/Http/Requests/AssetFileRequest.php +++ b/app/Http/Requests/AssetFileRequest.php @@ -21,7 +21,7 @@ class AssetFileRequest extends Request */ public function rules() { - $max_file_size = Helper::file_upload_max_size(); + $max_file_size = \App\Helpers\Helper::file_upload_max_size(); return [ 'file.*' => 'required|mimes:png,gif,jpg,svg,jpeg,doc,docx,pdf,txt,zip,rar,xls,xlsx,lic,xml,rtf,webp|max:'.$max_file_size, diff --git a/app/Http/Requests/ImageUploadRequest.php b/app/Http/Requests/ImageUploadRequest.php index c49201111..45d7bca5e 100644 --- a/app/Http/Requests/ImageUploadRequest.php +++ b/app/Http/Requests/ImageUploadRequest.php @@ -90,11 +90,6 @@ class ImageUploadRequest extends Request $use_db_field = $db_fieldname; } - \Log::info('Image path is: '.$path); - \Log::debug('Type is: '.$type); - \Log::debug('Form fieldname is: '.$form_fieldname); - \Log::debug('DB fieldname is: '.$use_db_field); - \Log::debug('Trying to upload to '. $path); // ConvertBase64ToFiles just changes object type, // as it cannot currently insert files to $this->files diff --git a/app/Http/Transformers/AssetsTransformer.php b/app/Http/Transformers/AssetsTransformer.php index 8af6f62c6..f3b6ba812 100644 --- a/app/Http/Transformers/AssetsTransformer.php +++ b/app/Http/Transformers/AssetsTransformer.php @@ -93,15 +93,15 @@ class AssetsTransformer $value = (Gate::allows('superadmin')) ? $decrypted : strtoupper(trans('admin/custom_fields/general.encrypted')); $fields_array[$field->name] = [ - 'field' => $field->convertUnicodeDbSlug(), - 'value' => $value, + 'field' => e($field->convertUnicodeDbSlug()), + 'value' => e($value), 'field_format' => $field->format, ]; } else { $fields_array[$field->name] = [ - 'field' => $field->convertUnicodeDbSlug(), - 'value' => $asset->{$field->convertUnicodeDbSlug()}, + 'field' => e($field->convertUnicodeDbSlug()), + 'value' => e($asset->{$field->convertUnicodeDbSlug()}), 'field_format' => $field->format, ]; @@ -114,24 +114,13 @@ class AssetsTransformer } $permissions_array['available_actions'] = [ - 'checkout' => Gate::allows('checkout', Asset::class), - 'checkin' => Gate::allows('checkin', Asset::class), - 'clone' => false, - 'restore' => false, - 'update' => (bool) Gate::allows('update', Asset::class), - 'delete' => ($asset->assigned_to == '' && Gate::allows('delete', Asset::class)), - ]; - - if ($asset->deleted_at != '') { - $permissions_array['available_actions'] = [ - 'checkout' => true, - 'checkin' => false, - 'clone' => Gate::allows('create', Asset::class), - 'restore' => Gate::allows('create', Asset::class), - 'update' => false, - 'delete' => false, - ]; - } + 'checkout' => ($asset->deleted_at=='' && Gate::allows('checkout', Asset::class)) ? true : false, + 'checkin' => ($asset->deleted_at=='' && Gate::allows('checkin', Asset::class)) ? true : false, + 'clone' => Gate::allows('create', Asset::class) ? true : false, + 'restore' => ($asset->deleted_at!='' && Gate::allows('create', Asset::class)) ? true : false, + 'update' => ($asset->deleted_at=='' && Gate::allows('update', Asset::class)) ? true : false, + 'delete' => ($asset->deleted_at=='' && $asset->assigned_to =='' && Gate::allows('delete', Asset::class)) ? true : false, + ]; if (request('components')=='true') { diff --git a/app/Importer/Importer.php b/app/Importer/Importer.php index f80b869d5..f5b0ae44d 100644 --- a/app/Importer/Importer.php +++ b/app/Importer/Importer.php @@ -76,6 +76,7 @@ abstract class Importer 'department' => 'department', 'manager_first_name' => 'manager first name', 'manager_last_name' => 'manager last name', + 'min_amt' => 'minimum quantity', ]; /** * Map of item fields->csv names @@ -196,11 +197,11 @@ abstract class Importer $val = $default; $key = $this->lookupCustomKey($key); - // $this->log("Custom Key: ${key}"); + $this->log("Custom Key: ${key}"); if (array_key_exists($key, $array)) { $val = Encoding::toUTF8(trim($array[$key])); } - // $this->log("${key}: ${val}"); + $this->log("${key}: ${val}"); return $val; } diff --git a/app/Importer/import_mappings.md b/app/Importer/import_mappings.md index 7899cf679..211a68bc9 100644 --- a/app/Importer/import_mappings.md +++ b/app/Importer/import_mappings.md @@ -29,6 +29,7 @@ | serial number | serial | Asset, license | | status | status | Asset ? All | | supplier | supplier | Asset ? All | +| minimum quantity | min_amt | Consumable | | termination date | termination_date | License | | warranty months | warranty_months | Asset | | User Related Fields | assigned_to | Asset | diff --git a/app/Models/Consumable.php b/app/Models/Consumable.php index 2d456e12c..13591123d 100644 --- a/app/Models/Consumable.php +++ b/app/Models/Consumable.php @@ -68,6 +68,7 @@ class Consumable extends SnipeModel 'purchase_cost', 'purchase_date', 'qty', + 'min_amt', 'requestable', ]; @@ -185,6 +186,7 @@ class Consumable extends SnipeModel return $this->belongsTo(\App\Models\Category::class, 'category_id'); } + /** * Establishes the component -> action logs relationship * @@ -209,8 +211,8 @@ class Consumable extends SnipeModel if ($this->image) { return Storage::disk('public')->url(app('consumables_upload_path').$this->image); } - return false; + } /** @@ -225,6 +227,7 @@ class Consumable extends SnipeModel return $this->belongsToMany(\App\Models\User::class, 'consumables_users', 'consumable_id', 'assigned_to')->withPivot('user_id')->withTrashed()->withTimestamps(); } + /** * Determine whether to send a checkin/checkout email based on * asset model category diff --git a/config/version.php b/config/version.php index 008ac1325..98c575552 100644 --- a/config/version.php +++ b/config/version.php @@ -1,10 +1,10 @@ 'v6-pre-alpha', - 'full_app_version' => 'v6-pre-alpha - build 6109-gace7abc1a', - 'build_version' => '6109', + 'full_app_version' => 'v6-pre-alpha - build 6506-ge75a5f13e', + 'build_version' => '6506', 'prerelease_version' => '', - 'hash_version' => 'gace7abc1a', - 'full_hash' => 'v6-pre-alpha-71-gace7abc1a', - 'branch' => 'develop-v6-integration', + 'hash_version' => 'ge75a5f13e', + 'full_hash' => 'v6-pre-alpha-13-ge75a5f13e', + 'branch' => 'develop', ); \ No newline at end of file diff --git a/docker/supervisor-exit-event-listener b/docker/supervisor-exit-event-listener index 84201634e..409ca0565 100644 --- a/docker/supervisor-exit-event-listener +++ b/docker/supervisor-exit-event-listener @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # A supervisor event listener which terminates supervisord if any of its child # processes enter the FATAL state. # https://stackoverflow.com/a/37527488/119527 diff --git a/package-lock.json b/package-lock.json index 463ca7dc3..5b7b74c72 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2955,9 +2955,9 @@ "integrity": "sha1-EQPWvADPv6jPyaJZmrUYxVZD2j8=" }, "bootstrap-table": { - "version": "1.18.3", - "resolved": "https://registry.npmjs.org/bootstrap-table/-/bootstrap-table-1.18.3.tgz", - "integrity": "sha512-/eFLkldDlNFi37qC/d9THfRVxMUGD34E8fQBFtXJLDHLBOVKWDTq7BV+udoP7k3FfCEyhM1jWQnQ0rMQdBv//w==" + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/bootstrap-table/-/bootstrap-table-1.19.1.tgz", + "integrity": "sha512-WvV+l1AI/C+zThaKmfHmi/IuayVNB0qdFyEhFx1jyZhO0oLtNJNANkCR3rvJf6Dkh72dsLElxpE/bzK9seEQLA==" }, "brace-expansion": { "version": "1.1.11", @@ -15845,7 +15845,7 @@ "jquery": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", - "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==" + "integrity": "sha1-xyoJ8Vwb3OFC9J2/EXC9+K2sJHA=" }, "jquery-form-validator": { "version": "2.3.79", @@ -15881,9 +15881,12 @@ "integrity": "sha1-G+i3twTdOFcVJwiu+x1KSzpp+zM=" }, "jquery-ui": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/jquery-ui/-/jquery-ui-1.12.1.tgz", - "integrity": "sha1-vLQEXI3QU5wTS8FIjN0+dop6nlE=" + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/jquery-ui/-/jquery-ui-1.13.0.tgz", + "integrity": "sha512-Osf7ECXNTYHtKBkn9xzbIf9kifNrBhfywFEKxOeB/OVctVmLlouV9mfc2qXCp6uyO4Pn72PXKOnj09qXetopCw==", + "requires": { + "jquery": ">=1.8.0 <4.0.0" + } }, "jquery-ui-bundle": { "version": "1.12.1", diff --git a/package.json b/package.json index 08a18509f..bbb2b879f 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "bootstrap-colorpicker": "^2.5.3", "bootstrap-datepicker": "^1.9.0", "bootstrap-less": "^3.3.8", - "bootstrap-table": "^1.18.3", + "bootstrap-table": "^1.19.1", "chart.js": "^2.9.4", "css-loader": "^3.6.0", "ekko-lightbox": "^5.1.1", @@ -41,7 +41,7 @@ "imagemin": "^5.3.1", "jquery-form-validator": "^2.3.79", "jquery-slimscroll": "^1.3.8", - "jquery-ui": "^1.12.1", + "jquery-ui": "^1.13.0", "jquery-ui-bundle": "^1.12.1", "jquery.iframe-transport": "^1.0.0", "less": "^4.1.1", diff --git a/public/css/build/overrides.css b/public/css/build/overrides.css index 2ce2c2327..c676b59b6 100644 --- a/public/css/build/overrides.css +++ b/public/css/build/overrides.css @@ -554,7 +554,6 @@ th.css-accessory > .th-inner::before { .form-group.has-error label { color: #a94442; } - .select2-container--default .select2-selection--multiple { border-radius: 0px; } diff --git a/public/css/dist/all.css b/public/css/dist/all.css index d0ae4b8a2..0c6cf6750 100644 --- a/public/css/dist/all.css +++ b/public/css/dist/all.css @@ -19168,7 +19168,7 @@ a.ui-button:active, /*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImVra28tbGlnaHRib3guY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGVBQ0UsOEJBQXlCLEFBQXpCLHVCQUF5QixBQUN6QixzQkFBb0IsQUFBcEIsbUJBQW9CLEFBQ3BCLHFCQUF3QixBQUF4Qix1QkFBd0IsQUFDeEIseUJBQTZCLENBQzlCLEFBQ0QseUJBQ0UsaUJBQW1CLENBQ3BCLEFBQ0QsZ0RBQ0Usa0JBQW1CLEFBQ25CLE1BQU8sQUFDUCxPQUFRLEFBQ1IsU0FBVSxBQUNWLFFBQVMsQUFDVCxVQUFZLENBQ2IsQUFDRCxzQkFDRSxXQUFZLEFBQ1osV0FBYSxDQUNkLEFBQ0QsMkJBQ0UsVUFBYSxBQUNiLGtCQUFtQixBQUNuQixNQUFPLEFBQ1AsT0FBUSxBQUNSLFdBQVksQUFDWixZQUFhLEFBQ2Isb0JBQWMsQUFBZCxZQUFjLENBQ2YsQUFDRCw2QkFDRSxXQUFRLEFBQVIsT0FBUSxBQUNSLG9CQUFjLEFBQWQsYUFBYyxBQUNkLHNCQUFvQixBQUFwQixtQkFBb0IsQUFDcEIsVUFBVyxBQUNYLHVCQUF5QixBQUN6QixXQUFZLEFBQ1osZUFBZ0IsQUFDaEIsU0FBYSxDQUNkLEFBQ0QsK0JBQ0Usb0JBQWEsQUFBYixXQUFhLENBQ2QsQUFDRCxvQ0FDRSxZQUFjLENBQ2YsQUFDRCxrQ0FDRSxjQUFnQixDQUNqQixBQUNELDZDQUNFLGdCQUFrQixDQUNuQixBQUNELG1DQUNFLG9CQUFzQixDQUN2QixBQUNELG1DQUNFLFlBQWMsQ0FDZixBQUNELHNDQUNFLGVBQWdCLEFBQ2hCLGlCQUFtQixDQUNwQixBQUNELHVCQUNFLFVBQVcsQUFDWCxvQkFBc0IsQ0FDdkIsQUFDRCw2QkFDRSxZQUFjLENBQ2YsQUFDRCw2QkFDRSxlQUFpQixDQUNsQixBQUNELHNCQUNFLGtCQUFtQixBQUNuQixNQUFPLEFBQ1AsT0FBUSxBQUNSLFNBQVUsQUFDVixRQUFTLEFBQ1QsV0FBWSxBQUNaLG9CQUFjLEFBQWQsYUFBYyxBQUVkLDBCQUF1QixBQUF2QixzQkFBdUIsQUFFdkIscUJBQXdCLEFBQXhCLHVCQUF3QixBQUV4QixzQkFBb0IsQUFBcEIsa0JBQW9CLENBQ3JCLEFBQ0QsMEJBQ0UsV0FBWSxBQUNaLFlBQWEsQUFDYixrQkFBbUIsQUFDbkIsaUJBQW1CLENBQ3BCLEFBQ0QsOEJBQ0UsV0FBWSxBQUNaLFlBQWEsQUFDYixrQkFBbUIsQUFDbkIsc0JBQXVCLEFBQ3ZCLFdBQWEsQUFDYixrQkFBbUIsQUFDbkIsTUFBTyxBQUNQLE9BQVEsQUFDUixtQ0FBNkMsQ0FDOUMsQUFDRCx5Q0FDRSxtQkFBcUIsQ0FDdEIsQUFDRCw0Q0FDRSxxQkFBdUIsQ0FDeEIsQUFVRCxhQUNFLE1BRUUsbUJBQW9CLEFBQ3BCLDBCQUE0QixDQUM3QixBQUNELElBQ0UsbUJBQW9CLEFBQ3BCLDBCQUE0QixDQUM3QixDQUNGIiwiZmlsZSI6ImVra28tbGlnaHRib3guY3NzIiwic291cmNlc0NvbnRlbnQiOlsiLmVra28tbGlnaHRib3gge1xuICBkaXNwbGF5OiBmbGV4ICFpbXBvcnRhbnQ7XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gIGp1c3RpZnktY29udGVudDogY2VudGVyO1xuICBwYWRkaW5nLXJpZ2h0OiAwcHghaW1wb3J0YW50O1xufVxuLmVra28tbGlnaHRib3gtY29udGFpbmVyIHtcbiAgcG9zaXRpb246IHJlbGF0aXZlO1xufVxuLmVra28tbGlnaHRib3gtY29udGFpbmVyID4gZGl2LmVra28tbGlnaHRib3gtaXRlbSB7XG4gIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgdG9wOiAwO1xuICBsZWZ0OiAwO1xuICBib3R0b206IDA7XG4gIHJpZ2h0OiAwO1xuICB3aWR0aDogMTAwJTtcbn1cbi5la2tvLWxpZ2h0Ym94IGlmcmFtZSB7XG4gIHdpZHRoOiAxMDAlO1xuICBoZWlnaHQ6IDEwMCU7XG59XG4uZWtrby1saWdodGJveC1uYXYtb3ZlcmxheSB7XG4gIHotaW5kZXg6IDEwMDtcbiAgcG9zaXRpb246IGFic29sdXRlO1xuICB0b3A6IDA7XG4gIGxlZnQ6IDA7XG4gIHdpZHRoOiAxMDAlO1xuICBoZWlnaHQ6IDEwMCU7XG4gIGRpc3BsYXk6IGZsZXg7XG59XG4uZWtrby1saWdodGJveC1uYXYtb3ZlcmxheSBhIHtcbiAgZmxleDogMTtcbiAgZGlzcGxheTogZmxleDtcbiAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbiAgb3BhY2l0eTogMDtcbiAgdHJhbnNpdGlvbjogb3BhY2l0eSAwLjVzO1xuICBjb2xvcjogI2ZmZjtcbiAgZm9udC1zaXplOiAzMHB4O1xuICB6LWluZGV4OiAxMDA7XG59XG4uZWtrby1saWdodGJveC1uYXYtb3ZlcmxheSBhID4gKiB7XG4gIGZsZXgtZ3JvdzogMTtcbn1cbi5la2tvLWxpZ2h0Ym94LW5hdi1vdmVybGF5IGEgPiAqOmZvY3VzIHtcbiAgb3V0bGluZTogbm9uZTtcbn1cbi5la2tvLWxpZ2h0Ym94LW5hdi1vdmVybGF5IGEgc3BhbiB7XG4gIHBhZGRpbmc6IDAgMzBweDtcbn1cbi5la2tvLWxpZ2h0Ym94LW5hdi1vdmVybGF5IGE6bGFzdC1jaGlsZCBzcGFuIHtcbiAgdGV4dC1hbGlnbjogcmlnaHQ7XG59XG4uZWtrby1saWdodGJveC1uYXYtb3ZlcmxheSBhOmhvdmVyIHtcbiAgdGV4dC1kZWNvcmF0aW9uOiBub25lO1xufVxuLmVra28tbGlnaHRib3gtbmF2LW92ZXJsYXkgYTpmb2N1cyB7XG4gIG91dGxpbmU6IG5vbmU7XG59XG4uZWtrby1saWdodGJveC1uYXYtb3ZlcmxheSBhLmRpc2FibGVkIHtcbiAgY3Vyc29yOiBkZWZhdWx0O1xuICB2aXNpYmlsaXR5OiBoaWRkZW47XG59XG4uZWtrby1saWdodGJveCBhOmhvdmVyIHtcbiAgb3BhY2l0eTogMTtcbiAgdGV4dC1kZWNvcmF0aW9uOiBub25lO1xufVxuLmVra28tbGlnaHRib3ggLm1vZGFsLWRpYWxvZyB7XG4gIGRpc3BsYXk6IG5vbmU7XG59XG4uZWtrby1saWdodGJveCAubW9kYWwtZm9vdGVyIHtcbiAgdGV4dC1hbGlnbjogbGVmdDtcbn1cbi5la2tvLWxpZ2h0Ym94LWxvYWRlciB7XG4gIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgdG9wOiAwO1xuICBsZWZ0OiAwO1xuICBib3R0b206IDA7XG4gIHJpZ2h0OiAwO1xuICB3aWR0aDogMTAwJTtcbiAgZGlzcGxheTogZmxleDtcbiAgLyogZXN0YWJsaXNoIGZsZXggY29udGFpbmVyICovXG4gIGZsZXgtZGlyZWN0aW9uOiBjb2x1bW47XG4gIC8qIG1ha2UgbWFpbiBheGlzIHZlcnRpY2FsICovXG4gIGp1c3RpZnktY29udGVudDogY2VudGVyO1xuICAvKiBjZW50ZXIgaXRlbXMgdmVydGljYWxseSwgaW4gdGhpcyBjYXNlICovXG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG59XG4uZWtrby1saWdodGJveC1sb2FkZXIgPiBkaXYge1xuICB3aWR0aDogNDBweDtcbiAgaGVpZ2h0OiA0MHB4O1xuICBwb3NpdGlvbjogcmVsYXRpdmU7XG4gIHRleHQtYWxpZ246IGNlbnRlcjtcbn1cbi5la2tvLWxpZ2h0Ym94LWxvYWRlciA+IGRpdiA+IGRpdiB7XG4gIHdpZHRoOiAxMDAlO1xuICBoZWlnaHQ6IDEwMCU7XG4gIGJvcmRlci1yYWRpdXM6IDUwJTtcbiAgYmFja2dyb3VuZC1jb2xvcjogI2ZmZjtcbiAgb3BhY2l0eTogMC42O1xuICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gIHRvcDogMDtcbiAgbGVmdDogMDtcbiAgYW5pbWF0aW9uOiBzay1ib3VuY2UgMnMgaW5maW5pdGUgZWFzZS1pbi1vdXQ7XG59XG4uZWtrby1saWdodGJveC1sb2FkZXIgPiBkaXYgPiBkaXY6bGFzdC1jaGlsZCB7XG4gIGFuaW1hdGlvbi1kZWxheTogLTFzO1xufVxuLm1vZGFsLWRpYWxvZyAuZWtrby1saWdodGJveC1sb2FkZXIgPiBkaXYgPiBkaXYge1xuICBiYWNrZ3JvdW5kLWNvbG9yOiAjMzMzO1xufVxuQC13ZWJraXQta2V5ZnJhbWVzIHNrLWJvdW5jZSB7XG4gIDAlLFxuICAxMDAlIHtcbiAgICAtd2Via2l0LXRyYW5zZm9ybTogc2NhbGUoMCk7XG4gIH1cbiAgNTAlIHtcbiAgICAtd2Via2l0LXRyYW5zZm9ybTogc2NhbGUoMSk7XG4gIH1cbn1cbkBrZXlmcmFtZXMgc2stYm91bmNlIHtcbiAgMCUsXG4gIDEwMCUge1xuICAgIHRyYW5zZm9ybTogc2NhbGUoMCk7XG4gICAgLXdlYmtpdC10cmFuc2Zvcm06IHNjYWxlKDApO1xuICB9XG4gIDUwJSB7XG4gICAgdHJhbnNmb3JtOiBzY2FsZSgxKTtcbiAgICAtd2Via2l0LXRyYW5zZm9ybTogc2NhbGUoMSk7XG4gIH1cbn1cbiJdfQ== */ /** * @author zhixin wen - * version: 1.18.3 + * version: 1.19.1 * https://github.com/wenzhixin/bootstrap-table/ */ .bootstrap-table .fixed-table-toolbar::after { @@ -19371,6 +19371,7 @@ a.ui-button:active, position: absolute; bottom: 0; width: 100%; + max-width: 100%; z-index: 1000; transition: visibility 0s, opacity 0.15s ease-in-out; opacity: 0; @@ -20465,6 +20466,7 @@ th.css-accessory > .th-inner::before { border-radius: 0px; } + .select2-container { box-sizing: border-box; display: inline-block; diff --git a/public/css/dist/bootstrap-table.css b/public/css/dist/bootstrap-table.css index c6485ceb4..9ea548eaf 100644 --- a/public/css/dist/bootstrap-table.css +++ b/public/css/dist/bootstrap-table.css @@ -1,6 +1,6 @@ /** * @author zhixin wen - * version: 1.18.3 + * version: 1.19.1 * https://github.com/wenzhixin/bootstrap-table/ */ .bootstrap-table .fixed-table-toolbar::after { @@ -203,6 +203,7 @@ position: absolute; bottom: 0; width: 100%; + max-width: 100%; z-index: 1000; transition: visibility 0s, opacity 0.15s ease-in-out; opacity: 0; diff --git a/public/js/build/app.js b/public/js/build/app.js index 041da5eee..2e9db85e5 100644 --- a/public/js/build/app.js +++ b/public/js/build/app.js @@ -334,6 +334,9 @@ __webpack_require__.r(__webpack_exports__); }, { id: 'model_number', text: "Model Number" + }, { + id: 'min_amt', + text: "Minimum Quantity" }], licenses: [{ id: 'asset_tag', @@ -427,6 +430,7 @@ __webpack_require__.r(__webpack_exports__); return this.columnOptions.general.concat(this.columnOptions.accessories).sort(sorter); case 'consumable': + console.log('Returned consumable'); return this.columnOptions.general.concat(this.columnOptions.consumables).sort(sorter); case 'license': @@ -1695,7 +1699,36 @@ var baseUrl = $('meta[name="baseUrl"]').attr('content'); (function ($, settings) { var Components = {}; - Components.modals = {}; // confirm delete modal + Components.modals = {}; // confirm restore modal + + Components.modals.confirmRestore = function () { + var $el = $('table'); + var events = { + 'click': function click(evnt) { + var $context = $(this); + var $restoreConfirmModal = $('#restoreConfirmModal'); + var href = $context.attr('href'); + var message = $context.attr('data-content'); + var title = $context.attr('data-title'); + $('#restoreConfirmModalLabel').text(title); + $restoreConfirmModal.find('.modal-body').text(message); + $('#restoreForm').attr('action', href); + $restoreConfirmModal.modal({ + show: true + }); + return false; + } + }; + + var render = function render() { + $el.on('click', '.restore-asset', events['click']); + }; + + return { + render: render + }; + }; // confirm delete modal + Components.modals.confirmDelete = function () { var $el = $('table'); @@ -1731,6 +1764,7 @@ var baseUrl = $('meta[name="baseUrl"]').attr('content'); $(function () { + new Components.modals.confirmRestore().render(); new Components.modals.confirmDelete().render(); }); })(jQuery, window.snipeit.settings); @@ -1886,10 +1920,10 @@ $(document).ready(function () { return x !== 0; }); // makes sure we're not selecting the same thing twice for multiples - var filteredResponse = response.items.filter(function (item) { + var filteredResponse = response.results.filter(function (item) { return currentlySelected.indexOf(+item.id) < 0; }); - var first = currentlySelected.length > 0 ? filteredResponse[0] : response.items[0]; + var first = currentlySelected.length > 0 ? filteredResponse[0] : response.results[0]; if (first && first.id) { first.selected = true; @@ -2095,7 +2129,7 @@ $(document).ready(function () { for (var i = 0; i < this.files.length; i++) { total_size += this.files[i].size; - $(id + '-info').append('' + this.files[i].name + ' (' + formatBytes(this.files[i].size) + ') '); + $(id + '-info').append('' + htmlEntities(this.files[i].name) + ' (' + formatBytes(this.files[i].size) + ') '); } console.log('Max size is: ' + max_size); @@ -2111,10 +2145,15 @@ $(document).ready(function () { } }); }); + +function htmlEntities(str) { + return String(str).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"'); +} /** * Toggle disabled */ + (function ($) { $.fn.toggleDisabled = function (callback) { return this.each(function () { @@ -6282,6 +6321,8 @@ if (typeof jQuery === 'undefined') { /***/ ((module, exports, __webpack_require__) => { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;( function( factory ) { + "use strict"; + if ( true ) { // AMD. Register as an anonymous module. @@ -6290,13 +6331,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else {} -} ( function( $ ) { +} )( function( $ ) { +"use strict"; $.ui = $.ui || {}; -return $.ui.version = "1.12.1"; +return $.ui.version = "1.13.0"; -} ) ); +} ); /***/ }), @@ -6308,7 +6350,7 @@ return $.ui.version = "1.12.1"; /***/ ((module, exports, __webpack_require__) => { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! - * jQuery UI Widget 1.12.1 + * jQuery UI Widget 1.13.0 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors @@ -6323,6 +6365,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ //>>demos: http://jqueryui.com/widget/ ( function( factory ) { + "use strict"; + if ( true ) { // AMD. Register as an anonymous module. @@ -6331,25 +6375,23 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else {} -}( function( $ ) { +} )( function( $ ) { +"use strict"; var widgetUuid = 0; +var widgetHasOwnProperty = Array.prototype.hasOwnProperty; var widgetSlice = Array.prototype.slice; $.cleanData = ( function( orig ) { return function( elems ) { var events, elem, i; for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) { - try { - // Only trigger remove when necessary to save time - events = $._data( elem, "events" ); - if ( events && events.remove ) { - $( elem ).triggerHandler( "remove" ); - } - - // Http://bugs.jquery.com/ticket/8235 - } catch ( e ) {} + // Only trigger remove when necessary to save time + events = $._data( elem, "events" ); + if ( events && events.remove ) { + $( elem ).triggerHandler( "remove" ); + } } orig( elems ); }; @@ -6371,12 +6413,12 @@ $.widget = function( name, base, prototype ) { base = $.Widget; } - if ( $.isArray( prototype ) ) { + if ( Array.isArray( prototype ) ) { prototype = $.extend.apply( null, [ {} ].concat( prototype ) ); } // Create selector for plugin - $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { + $.expr.pseudos[ fullName.toLowerCase() ] = function( elem ) { return !!$.data( elem, fullName ); }; @@ -6416,7 +6458,7 @@ $.widget = function( name, base, prototype ) { // inheriting from basePrototype.options = $.widget.extend( {}, basePrototype.options ); $.each( prototype, function( prop, value ) { - if ( !$.isFunction( value ) ) { + if ( typeof value !== "function" ) { proxiedPrototype[ prop ] = value; return; } @@ -6495,7 +6537,7 @@ $.widget.extend = function( target ) { for ( ; inputIndex < inputLength; inputIndex++ ) { for ( key in input[ inputIndex ] ) { value = input[ inputIndex ][ key ]; - if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { + if ( widgetHasOwnProperty.call( input[ inputIndex ], key ) && value !== undefined ) { // Clone objects if ( $.isPlainObject( value ) ) { @@ -6544,7 +6586,8 @@ $.widget.bridge = function( name, object ) { "attempted to call method '" + options + "'" ); } - if ( !$.isFunction( instance[ options ] ) || options.charAt( 0 ) === "_" ) { + if ( typeof instance[ options ] !== "function" || + options.charAt( 0 ) === "_" ) { return $.error( "no such method '" + options + "' for " + name + " widget instance" ); } @@ -6805,12 +6848,30 @@ $.Widget.prototype = { classes: this.options.classes || {} }, options ); + function bindRemoveEvent() { + options.element.each( function( _, element ) { + var isTracked = $.map( that.classesElementLookup, function( elements ) { + return elements; + } ) + .some( function( elements ) { + return elements.is( element ); + } ); + + if ( !isTracked ) { + that._on( $( element ), { + remove: "_untrackClassesElement" + } ); + } + } ); + } + function processClassString( classes, checkOption ) { var current, i; for ( i = 0; i < classes.length; i++ ) { current = that.classesElementLookup[ classes[ i ] ] || $(); if ( options.add ) { - current = $( $.unique( current.get().concat( options.element.get() ) ) ); + bindRemoveEvent(); + current = $( $.uniqueSort( current.get().concat( options.element.get() ) ) ); } else { current = $( current.not( options.element ).get() ); } @@ -6822,10 +6883,6 @@ $.Widget.prototype = { } } - this._on( options.element, { - "remove": "_untrackClassesElement" - } ); - if ( options.keys ) { processClassString( options.keys.match( /\S+/g ) || [], true ); } @@ -6843,6 +6900,8 @@ $.Widget.prototype = { that.classesElementLookup[ key ] = $( value.not( event.target ).get() ); } } ); + + this._off( $( event.target ) ); }, _removeClass: function( element, keys, extra ) { @@ -6923,7 +6982,7 @@ $.Widget.prototype = { _off: function( element, eventName ) { eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace; - element.off( eventName ).off( eventName ); + element.off( eventName ); // Clear the stack to avoid memory leaks (#10056) this.bindings = $( this.bindings.not( element ).get() ); @@ -6989,7 +7048,7 @@ $.Widget.prototype = { } this.element.trigger( event, data ); - return !( $.isFunction( callback ) && + return !( typeof callback === "function" && callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false || event.isDefaultPrevented() ); } @@ -7011,6 +7070,8 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { options = options || {}; if ( typeof options === "number" ) { options = { duration: options }; + } else if ( options === true ) { + options = {}; } hasOptions = !$.isEmptyObject( options ); @@ -7038,7 +7099,7 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { return $.widget; -} ) ); +} ); /***/ }), diff --git a/public/js/build/app.js.LICENSE.txt b/public/js/build/app.js.LICENSE.txt index c50b3aa8d..eff7f713b 100644 --- a/public/js/build/app.js.LICENSE.txt +++ b/public/js/build/app.js.LICENSE.txt @@ -36,7 +36,7 @@ */ /*! - * jQuery UI Widget 1.12.1 + * jQuery UI Widget 1.13.0 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors diff --git a/public/js/dist/all.js b/public/js/dist/all.js index f22f12b48..a677c9f01 100644 --- a/public/js/dist/all.js +++ b/public/js/dist/all.js @@ -59472,6 +59472,9 @@ __webpack_require__.r(__webpack_exports__); }, { id: 'model_number', text: "Model Number" + }, { + id: 'min_amt', + text: "Minimum Quantity" }], licenses: [{ id: 'asset_tag', @@ -59565,6 +59568,7 @@ __webpack_require__.r(__webpack_exports__); return this.columnOptions.general.concat(this.columnOptions.accessories).sort(sorter); case 'consumable': + console.log('Returned consumable'); return this.columnOptions.general.concat(this.columnOptions.consumables).sort(sorter); case 'license': @@ -60833,7 +60837,36 @@ var baseUrl = $('meta[name="baseUrl"]').attr('content'); (function ($, settings) { var Components = {}; - Components.modals = {}; // confirm delete modal + Components.modals = {}; // confirm restore modal + + Components.modals.confirmRestore = function () { + var $el = $('table'); + var events = { + 'click': function click(evnt) { + var $context = $(this); + var $restoreConfirmModal = $('#restoreConfirmModal'); + var href = $context.attr('href'); + var message = $context.attr('data-content'); + var title = $context.attr('data-title'); + $('#restoreConfirmModalLabel').text(title); + $restoreConfirmModal.find('.modal-body').text(message); + $('#restoreForm').attr('action', href); + $restoreConfirmModal.modal({ + show: true + }); + return false; + } + }; + + var render = function render() { + $el.on('click', '.restore-asset', events['click']); + }; + + return { + render: render + }; + }; // confirm delete modal + Components.modals.confirmDelete = function () { var $el = $('table'); @@ -60869,6 +60902,7 @@ var baseUrl = $('meta[name="baseUrl"]').attr('content'); $(function () { + new Components.modals.confirmRestore().render(); new Components.modals.confirmDelete().render(); }); })(jQuery, window.snipeit.settings); @@ -61024,10 +61058,10 @@ $(document).ready(function () { return x !== 0; }); // makes sure we're not selecting the same thing twice for multiples - var filteredResponse = response.items.filter(function (item) { + var filteredResponse = response.results.filter(function (item) { return currentlySelected.indexOf(+item.id) < 0; }); - var first = currentlySelected.length > 0 ? filteredResponse[0] : response.items[0]; + var first = currentlySelected.length > 0 ? filteredResponse[0] : response.results[0]; if (first && first.id) { first.selected = true; @@ -61233,7 +61267,7 @@ $(document).ready(function () { for (var i = 0; i < this.files.length; i++) { total_size += this.files[i].size; - $(id + '-info').append('' + this.files[i].name + ' (' + formatBytes(this.files[i].size) + ') '); + $(id + '-info').append('' + htmlEntities(this.files[i].name) + ' (' + formatBytes(this.files[i].size) + ') '); } console.log('Max size is: ' + max_size); @@ -61249,10 +61283,15 @@ $(document).ready(function () { } }); }); + +function htmlEntities(str) { + return String(str).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"'); +} /** * Toggle disabled */ + (function ($) { $.fn.toggleDisabled = function (callback) { return this.each(function () { @@ -65420,6 +65459,8 @@ if (typeof jQuery === 'undefined') { /***/ ((module, exports, __webpack_require__) => { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;( function( factory ) { + "use strict"; + if ( true ) { // AMD. Register as an anonymous module. @@ -65428,13 +65469,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else {} -} ( function( $ ) { +} )( function( $ ) { +"use strict"; $.ui = $.ui || {}; -return $.ui.version = "1.12.1"; +return $.ui.version = "1.13.0"; -} ) ); +} ); /***/ }), @@ -65446,7 +65488,7 @@ return $.ui.version = "1.12.1"; /***/ ((module, exports, __webpack_require__) => { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! - * jQuery UI Widget 1.12.1 + * jQuery UI Widget 1.13.0 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors @@ -65461,6 +65503,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ //>>demos: http://jqueryui.com/widget/ ( function( factory ) { + "use strict"; + if ( true ) { // AMD. Register as an anonymous module. @@ -65469,25 +65513,23 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else {} -}( function( $ ) { +} )( function( $ ) { +"use strict"; var widgetUuid = 0; +var widgetHasOwnProperty = Array.prototype.hasOwnProperty; var widgetSlice = Array.prototype.slice; $.cleanData = ( function( orig ) { return function( elems ) { var events, elem, i; for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) { - try { - // Only trigger remove when necessary to save time - events = $._data( elem, "events" ); - if ( events && events.remove ) { - $( elem ).triggerHandler( "remove" ); - } - - // Http://bugs.jquery.com/ticket/8235 - } catch ( e ) {} + // Only trigger remove when necessary to save time + events = $._data( elem, "events" ); + if ( events && events.remove ) { + $( elem ).triggerHandler( "remove" ); + } } orig( elems ); }; @@ -65509,12 +65551,12 @@ $.widget = function( name, base, prototype ) { base = $.Widget; } - if ( $.isArray( prototype ) ) { + if ( Array.isArray( prototype ) ) { prototype = $.extend.apply( null, [ {} ].concat( prototype ) ); } // Create selector for plugin - $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { + $.expr.pseudos[ fullName.toLowerCase() ] = function( elem ) { return !!$.data( elem, fullName ); }; @@ -65554,7 +65596,7 @@ $.widget = function( name, base, prototype ) { // inheriting from basePrototype.options = $.widget.extend( {}, basePrototype.options ); $.each( prototype, function( prop, value ) { - if ( !$.isFunction( value ) ) { + if ( typeof value !== "function" ) { proxiedPrototype[ prop ] = value; return; } @@ -65633,7 +65675,7 @@ $.widget.extend = function( target ) { for ( ; inputIndex < inputLength; inputIndex++ ) { for ( key in input[ inputIndex ] ) { value = input[ inputIndex ][ key ]; - if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { + if ( widgetHasOwnProperty.call( input[ inputIndex ], key ) && value !== undefined ) { // Clone objects if ( $.isPlainObject( value ) ) { @@ -65682,7 +65724,8 @@ $.widget.bridge = function( name, object ) { "attempted to call method '" + options + "'" ); } - if ( !$.isFunction( instance[ options ] ) || options.charAt( 0 ) === "_" ) { + if ( typeof instance[ options ] !== "function" || + options.charAt( 0 ) === "_" ) { return $.error( "no such method '" + options + "' for " + name + " widget instance" ); } @@ -65943,12 +65986,30 @@ $.Widget.prototype = { classes: this.options.classes || {} }, options ); + function bindRemoveEvent() { + options.element.each( function( _, element ) { + var isTracked = $.map( that.classesElementLookup, function( elements ) { + return elements; + } ) + .some( function( elements ) { + return elements.is( element ); + } ); + + if ( !isTracked ) { + that._on( $( element ), { + remove: "_untrackClassesElement" + } ); + } + } ); + } + function processClassString( classes, checkOption ) { var current, i; for ( i = 0; i < classes.length; i++ ) { current = that.classesElementLookup[ classes[ i ] ] || $(); if ( options.add ) { - current = $( $.unique( current.get().concat( options.element.get() ) ) ); + bindRemoveEvent(); + current = $( $.uniqueSort( current.get().concat( options.element.get() ) ) ); } else { current = $( current.not( options.element ).get() ); } @@ -65960,10 +66021,6 @@ $.Widget.prototype = { } } - this._on( options.element, { - "remove": "_untrackClassesElement" - } ); - if ( options.keys ) { processClassString( options.keys.match( /\S+/g ) || [], true ); } @@ -65981,6 +66038,8 @@ $.Widget.prototype = { that.classesElementLookup[ key ] = $( value.not( event.target ).get() ); } } ); + + this._off( $( event.target ) ); }, _removeClass: function( element, keys, extra ) { @@ -66061,7 +66120,7 @@ $.Widget.prototype = { _off: function( element, eventName ) { eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace; - element.off( eventName ).off( eventName ); + element.off( eventName ); // Clear the stack to avoid memory leaks (#10056) this.bindings = $( this.bindings.not( element ).get() ); @@ -66127,7 +66186,7 @@ $.Widget.prototype = { } this.element.trigger( event, data ); - return !( $.isFunction( callback ) && + return !( typeof callback === "function" && callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false || event.isDefaultPrevented() ); } @@ -66149,6 +66208,8 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { options = options || {}; if ( typeof options === "number" ) { options = { duration: options }; + } else if ( options === true ) { + options = {}; } hasOptions = !$.isEmptyObject( options ); @@ -66176,7 +66237,7 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { return $.widget; -} ) ); +} ); /***/ }), diff --git a/public/js/dist/bootstrap-table.js b/public/js/dist/bootstrap-table.js index 11e73e214..452049ad2 100644 --- a/public/js/dist/bootstrap-table.js +++ b/public/js/dist/bootstrap-table.js @@ -187,9 +187,10 @@ // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global_1 = - /* global globalThis -- safe */ + // eslint-disable-next-line es/no-global-this -- safe check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || + // eslint-disable-next-line no-restricted-globals -- safe check(typeof self == 'object' && self) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) || // eslint-disable-next-line no-new-func -- fallback @@ -205,21 +206,23 @@ // Detect IE8's incomplete defineProperty implementation var descriptors = !fails(function () { + // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; }); - var nativePropertyIsEnumerable = {}.propertyIsEnumerable; + var $propertyIsEnumerable = {}.propertyIsEnumerable; + // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var getOwnPropertyDescriptor$4 = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug - var NASHORN_BUG = getOwnPropertyDescriptor$4 && !nativePropertyIsEnumerable.call({ 1: 2 }, 1); + var NASHORN_BUG = getOwnPropertyDescriptor$4 && !$propertyIsEnumerable.call({ 1: 2 }, 1); // `Object.prototype.propertyIsEnumerable` method implementation // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable var f$4 = NASHORN_BUG ? function propertyIsEnumerable(V) { var descriptor = getOwnPropertyDescriptor$4(this, V); return !!descriptor && descriptor.enumerable; - } : nativePropertyIsEnumerable; + } : $propertyIsEnumerable; var objectPropertyIsEnumerable = { f: f$4 @@ -299,20 +302,22 @@ // Thank's IE8 for his funny defineProperty var ie8DomDefine = !descriptors && !fails(function () { + // eslint-disable-next-line es/no-object-defineproperty -- requied for testing return Object.defineProperty(documentCreateElement('div'), 'a', { get: function () { return 7; } }).a != 7; }); - var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe + var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor - var f$3 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { + var f$3 = descriptors ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { O = toIndexedObject(O); P = toPrimitive(P, true); if (ie8DomDefine) try { - return nativeGetOwnPropertyDescriptor(O, P); + return $getOwnPropertyDescriptor(O, P); } catch (error) { /* empty */ } if (has$1(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]); }; @@ -327,16 +332,17 @@ } return it; }; - var nativeDefineProperty = Object.defineProperty; + // eslint-disable-next-line es/no-object-defineproperty -- safe + var $defineProperty = Object.defineProperty; // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty - var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) { + var f$2 = descriptors ? $defineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); anObject(Attributes); if (ie8DomDefine) try { - return nativeDefineProperty(O, P, Attributes); + return $defineProperty(O, P, Attributes); } catch (error) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported'); if ('value' in Attributes) O[P] = Attributes.value; @@ -386,7 +392,7 @@ (module.exports = function (key, value) { return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {}); })('versions', []).push({ - version: '3.9.1', + version: '3.10.1', mode: 'global', copyright: '© 2021 Denis Pushkarev (zloirock.ru)' }); @@ -598,6 +604,7 @@ // `Object.getOwnPropertyNames` method // https://tc39.es/ecma262/#sec-object.getownpropertynames + // eslint-disable-next-line es/no-object-getownpropertynames -- safe var f$1 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return objectKeysInternal(O, hiddenKeys); }; @@ -606,6 +613,7 @@ f: f$1 }; + // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe var f = Object.getOwnPropertySymbols; var objectGetOwnPropertySymbols = { @@ -795,7 +803,7 @@ return RegExp(s, f); } - var UNSUPPORTED_Y$2 = fails(function () { + var UNSUPPORTED_Y$3 = fails(function () { // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError var re = RE('a', 'y'); re.lastIndex = 2; @@ -810,15 +818,12 @@ }); var regexpStickyHelpers = { - UNSUPPORTED_Y: UNSUPPORTED_Y$2, + UNSUPPORTED_Y: UNSUPPORTED_Y$3, BROKEN_CARET: BROKEN_CARET }; var nativeExec = RegExp.prototype.exec; - // This always refers to the native implementation, because the - // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js, - // which loads this file before patching the method. - var nativeReplace = String.prototype.replace; + var nativeReplace = shared('native-string-replace', String.prototype.replace); var patchedExec = nativeExec; @@ -830,19 +835,19 @@ return re1.lastIndex !== 0 || re2.lastIndex !== 0; })(); - var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET; + var UNSUPPORTED_Y$2 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET; // nonparticipating capturing group, copied from es5-shim's String#split patch. // eslint-disable-next-line regexp/no-assertion-capturing-group, regexp/no-empty-group -- required for testing var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined; - var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1; + var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$2; if (PATCH) { patchedExec = function exec(str) { var re = this; var lastIndex, reCopy, match, i; - var sticky = UNSUPPORTED_Y$1 && re.sticky; + var sticky = UNSUPPORTED_Y$2 && re.sticky; var flags = regexpFlags.call(re); var source = re.source; var charsAdded = 0; @@ -927,16 +932,19 @@ var engineV8Version = version && +version; + // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () { - /* global Symbol -- required for testing */ + // eslint-disable-next-line es/no-symbol -- required for testing return !Symbol.sham && // Chrome 38 Symbol has incorrect toString conversion // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances (engineIsNode ? engineV8Version === 38 : engineV8Version > 37 && engineV8Version < 41); }); + /* eslint-disable es/no-symbol -- required for testing */ + + var useSymbolAsUid = nativeSymbol - /* global Symbol -- safe */ && !Symbol.sham && typeof Symbol.iterator == 'symbol'; @@ -961,7 +969,6 @@ - var SPECIES$5 = wellKnownSymbol('species'); var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () { @@ -980,6 +987,7 @@ // IE <= 11 replaces $0 with the whole match, as if it was $& // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0 var REPLACE_KEEPS_$0 = (function () { + // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing return 'a'.replace(/./, '$0') === '$0'; })(); @@ -1049,7 +1057,7 @@ ) { var nativeRegExpMethod = /./[SYMBOL]; var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) { - if (regexp.exec === regexpExec) { + if (regexp.exec === RegExp.prototype.exec) { if (DELEGATES_TO_SYMBOL && !forceStringMethod) { // The native String method already delegates to @@method (this // polyfilled function), leasing to infinite recursion. @@ -1157,13 +1165,11 @@ return regexpExec.call(R, S); }; + var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y; var arrayPush = [].push; var min$4 = Math.min; var MAX_UINT32 = 0xFFFFFFFF; - // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError - var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); }); - // @@split logic fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) { var internalSplit; @@ -1246,11 +1252,11 @@ var flags = (rx.ignoreCase ? 'i' : '') + (rx.multiline ? 'm' : '') + (rx.unicode ? 'u' : '') + - (SUPPORTS_Y ? 'y' : 'g'); + (UNSUPPORTED_Y$1 ? 'g' : 'y'); // ^(? + rx + ) is needed, in combination with some S slicing, to // simulate the 'y' flag. - var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags); + var splitter = new C(UNSUPPORTED_Y$1 ? '^(?:' + rx.source + ')' : rx, flags); var lim = limit === undefined ? MAX_UINT32 : limit >>> 0; if (lim === 0) return []; if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : []; @@ -1258,12 +1264,12 @@ var q = 0; var A = []; while (q < S.length) { - splitter.lastIndex = SUPPORTS_Y ? q : 0; - var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q)); + splitter.lastIndex = UNSUPPORTED_Y$1 ? 0 : q; + var z = regexpExecAbstract(splitter, UNSUPPORTED_Y$1 ? S.slice(q) : S); var e; if ( z === null || - (e = min$4(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p + (e = min$4(toLength(splitter.lastIndex + (UNSUPPORTED_Y$1 ? q : 0)), S.length)) === p ) { q = advanceStringIndex(S, q, unicodeMatching); } else { @@ -1280,16 +1286,58 @@ return A; } ]; - }, !SUPPORTS_Y); + }, UNSUPPORTED_Y$1); // `Object.keys` method // https://tc39.es/ecma262/#sec-object.keys + // eslint-disable-next-line es/no-object-keys -- safe var objectKeys = Object.keys || function keys(O) { return objectKeysInternal(O, enumBugKeys); }; + var propertyIsEnumerable = objectPropertyIsEnumerable.f; + + // `Object.{ entries, values }` methods implementation + var createMethod$1 = function (TO_ENTRIES) { + return function (it) { + var O = toIndexedObject(it); + var keys = objectKeys(O); + var length = keys.length; + var i = 0; + var result = []; + var key; + while (length > i) { + key = keys[i++]; + if (!descriptors || propertyIsEnumerable.call(O, key)) { + result.push(TO_ENTRIES ? [key, O[key]] : O[key]); + } + } + return result; + }; + }; + + var objectToArray = { + // `Object.entries` method + // https://tc39.es/ecma262/#sec-object.entries + entries: createMethod$1(true), + // `Object.values` method + // https://tc39.es/ecma262/#sec-object.values + values: createMethod$1(false) + }; + + var $entries = objectToArray.entries; + + // `Object.entries` method + // https://tc39.es/ecma262/#sec-object.entries + _export({ target: 'Object', stat: true }, { + entries: function entries(O) { + return $entries(O); + } + }); + // `Object.defineProperties` method // https://tc39.es/ecma262/#sec-object.defineproperties + // eslint-disable-next-line es/no-object-defineproperties -- safe var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) { anObject(O); var keys = objectKeys(Properties); @@ -1406,6 +1454,7 @@ // `IsArray` abstract operation // https://tc39.es/ecma262/#sec-isarray + // eslint-disable-next-line es/no-array-isarray -- safe var isArray = Array.isArray || function isArray(arg) { return classofRaw(arg) == 'Array'; }; @@ -1530,7 +1579,7 @@ var push = [].push; // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterOut }` methods implementation - var createMethod$1 = function (TYPE) { + var createMethod = function (TYPE) { var IS_MAP = TYPE == 1; var IS_FILTER = TYPE == 2; var IS_SOME = TYPE == 3; @@ -1570,28 +1619,28 @@ var arrayIteration = { // `Array.prototype.forEach` method // https://tc39.es/ecma262/#sec-array.prototype.foreach - forEach: createMethod$1(0), + forEach: createMethod(0), // `Array.prototype.map` method // https://tc39.es/ecma262/#sec-array.prototype.map - map: createMethod$1(1), + map: createMethod(1), // `Array.prototype.filter` method // https://tc39.es/ecma262/#sec-array.prototype.filter - filter: createMethod$1(2), + filter: createMethod(2), // `Array.prototype.some` method // https://tc39.es/ecma262/#sec-array.prototype.some - some: createMethod$1(3), + some: createMethod(3), // `Array.prototype.every` method // https://tc39.es/ecma262/#sec-array.prototype.every - every: createMethod$1(4), + every: createMethod(4), // `Array.prototype.find` method // https://tc39.es/ecma262/#sec-array.prototype.find - find: createMethod$1(5), + find: createMethod(5), // `Array.prototype.findIndex` method // https://tc39.es/ecma262/#sec-array.prototype.findIndex - findIndex: createMethod$1(6), + findIndex: createMethod(6), // `Array.prototype.filterOut` method // https://github.com/tc39/proposal-array-filtering - filterOut: createMethod$1(7) + filterOut: createMethod(7) }; var $find = arrayIteration.find; @@ -1688,6 +1737,7 @@ // https://tc39.es/ecma262/#sec-array.prototype.foreach var arrayForEach = !STRICT_METHOD$2 ? function forEach(callbackfn /* , thisArg */) { return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + // eslint-disable-next-line es/no-array-prototype-foreach -- safe } : [].forEach; for (var COLLECTION_NAME$1 in domIterables) { @@ -1721,45 +1771,7 @@ parseFloat: numberParseFloat }); - var propertyIsEnumerable = objectPropertyIsEnumerable.f; - - // `Object.{ entries, values }` methods implementation - var createMethod = function (TO_ENTRIES) { - return function (it) { - var O = toIndexedObject(it); - var keys = objectKeys(O); - var length = keys.length; - var i = 0; - var result = []; - var key; - while (length > i) { - key = keys[i++]; - if (!descriptors || propertyIsEnumerable.call(O, key)) { - result.push(TO_ENTRIES ? [key, O[key]] : O[key]); - } - } - return result; - }; - }; - - var objectToArray = { - // `Object.entries` method - // https://tc39.es/ecma262/#sec-object.entries - entries: createMethod(true), - // `Object.values` method - // https://tc39.es/ecma262/#sec-object.values - values: createMethod(false) - }; - - var $entries = objectToArray.entries; - - // `Object.entries` method - // https://tc39.es/ecma262/#sec-object.entries - _export({ target: 'Object', stat: true }, { - entries: function entries(O) { - return $entries(O); - } - }); + /* eslint-disable es/no-array-prototype-indexof -- required for testing */ var $indexOf = arrayIncludes.indexOf; @@ -1934,14 +1946,16 @@ ]; }); - var nativeAssign = Object.assign; + // eslint-disable-next-line es/no-object-assign -- safe + var $assign = Object.assign; + // eslint-disable-next-line es/no-object-defineproperty -- required for testing var defineProperty$3 = Object.defineProperty; // `Object.assign` method // https://tc39.es/ecma262/#sec-object.assign - var objectAssign = !nativeAssign || fails(function () { + var objectAssign = !$assign || fails(function () { // should have correct order of operations (Edge bug) - if (descriptors && nativeAssign({ b: 1 }, nativeAssign(defineProperty$3({}, 'a', { + if (descriptors && $assign({ b: 1 }, $assign(defineProperty$3({}, 'a', { enumerable: true, get: function () { defineProperty$3(this, 'b', { @@ -1953,12 +1967,12 @@ // should work with symbols and should have deterministic property order (V8 bug) var A = {}; var B = {}; - /* global Symbol -- required for testing */ + // eslint-disable-next-line es/no-symbol -- safe var symbol = Symbol(); var alphabet = 'abcdefghijklmnopqrst'; A[symbol] = 7; alphabet.split('').forEach(function (chr) { B[chr] = chr; }); - return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet; + return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet; }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length` var T = toObject(target); var argumentsLength = arguments.length; @@ -1976,10 +1990,11 @@ if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key]; } } return T; - } : nativeAssign; + } : $assign; // `Object.assign` method // https://tc39.es/ecma262/#sec-object.assign + // eslint-disable-next-line es/no-object-assign -- required for testing _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, { assign: objectAssign }); @@ -2000,6 +2015,7 @@ // `SameValue` abstract operation // https://tc39.es/ecma262/#sec-samevalue + // eslint-disable-next-line es/no-object-is -- safe var sameValue = Object.is || function is(x, y) { // eslint-disable-next-line no-self-compare -- NaN check return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; @@ -2100,11 +2116,13 @@ // `Object.setPrototypeOf` method // https://tc39.es/ecma262/#sec-object.setprototypeof // Works with __proto__ only. Old v8 can't work with null proto objects. + // eslint-disable-next-line es/no-object-setprototypeof -- safe var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () { var CORRECT_SETTER = false; var test = {}; var setter; try { + // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set; setter.call(test, []); CORRECT_SETTER = test instanceof Array; @@ -2330,6 +2348,7 @@ var correctPrototypeGetter = !fails(function () { function F() { /* empty */ } F.prototype.constructor = null; + // eslint-disable-next-line es/no-object-getprototypeof -- required for testing return Object.getPrototypeOf(new F()) !== F.prototype; }); @@ -2338,6 +2357,7 @@ // `Object.getPrototypeOf` method // https://tc39.es/ecma262/#sec-object.getprototypeof + // eslint-disable-next-line es/no-object-getprototypeof -- safe var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) { O = toObject(O); if (has$1(O, IE_PROTO)) return O[IE_PROTO]; @@ -2355,6 +2375,7 @@ // https://tc39.es/ecma262/#sec-%iteratorprototype%-object var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator; + /* eslint-disable es/no-array-prototype-keys -- safe */ if ([].keys) { arrayIterator = [].keys(); // Safari 8 has buggy iterators w/o `next` @@ -2696,7 +2717,7 @@ /* eslint-disable no-unused-vars */ - var VERSION = '1.18.3'; + var VERSION = '1.19.1'; var bootstrapVersion = 4; try { @@ -2813,19 +2834,19 @@ } }, 5: { - iconsPrefix: 'fa', + iconsPrefix: 'bi', icons: { - paginationSwitchDown: 'fa-caret-square-down', - paginationSwitchUp: 'fa-caret-square-up', - refresh: 'fa-sync', - toggleOff: 'fa-toggle-off', - toggleOn: 'fa-toggle-on', - columns: 'fa-th-list', - detailOpen: 'fa-plus', - detailClose: 'fa-minus', - fullscreen: 'fa-arrows-alt', - search: 'fa-search', - clearSearch: 'fa-trash' + paginationSwitchDown: 'bi-caret-down-square', + paginationSwitchUp: 'bi-caret-up-square', + refresh: 'bi-arrow-clockwise', + toggleOff: 'bi-toggle-off', + toggleOn: 'bi-toggle-on', + columns: 'bi-list-ul', + detailOpen: 'bi-plus', + detailClose: 'bi-dash', + fullscreen: 'bi-arrows-move', + search: 'bi-search', + clearSearch: 'bi-trash' }, classes: { buttonsPrefix: 'btn', @@ -2853,7 +2874,7 @@ pagination: ['
    ', '
'], paginationItem: '
  • %s
  • ', icon: '', - inputGroup: '
    %s
    %s
    ', + inputGroup: '
    %s%s
    ', searchInput: '', searchButton: '', searchClearButton: '' @@ -2938,6 +2959,7 @@ searchHighlight: false, searchOnEnterKey: false, strictSearch: false, + regexSearch: false, searchSelector: false, visibleSearch: false, showButtonIcons: true, @@ -3089,6 +3111,9 @@ }, onScrollBody: function onScrollBody() { return false; + }, + onTogglePagination: function onTogglePagination(newState) { + return false; } }; var EN = { @@ -3229,7 +3254,9 @@ 'refresh-options.bs.table': 'onRefreshOptions', 'reset-view.bs.table': 'onResetView', 'refresh.bs.table': 'onRefresh', - 'scroll-body.bs.table': 'onScrollBody' + 'scroll-body.bs.table': 'onScrollBody', + 'toggle-pagination.bs.table': 'onTogglePagination', + 'virtual-scroll.bs.table': 'onVirtualScroll' }; Object.assign(DEFAULTS, EN); var Constants = { @@ -3256,6 +3283,43 @@ } }); + // @@match logic + fixRegexpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) { + return [ + // `String.prototype.match` method + // https://tc39.es/ecma262/#sec-string.prototype.match + function match(regexp) { + var O = requireObjectCoercible(this); + var matcher = regexp == undefined ? undefined : regexp[MATCH]; + return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); + }, + // `RegExp.prototype[@@match]` method + // https://tc39.es/ecma262/#sec-regexp.prototype-@@match + function (regexp) { + var res = maybeCallNative(nativeMatch, regexp, this); + if (res.done) return res.value; + + var rx = anObject(regexp); + var S = String(this); + + if (!rx.global) return regexpExecAbstract(rx, S); + + var fullUnicode = rx.unicode; + rx.lastIndex = 0; + var A = []; + var n = 0; + var result; + while ((result = regexpExecAbstract(rx, S)) !== null) { + var matchStr = String(result[0]); + A[n] = matchStr; + if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode); + n++; + } + return n === 0 ? null : A; + } + ]; + }); + var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f; @@ -3263,7 +3327,8 @@ - var nativeStartsWith = ''.startsWith; + // eslint-disable-next-line es/no-string-prototype-startswith -- safe + var $startsWith = ''.startsWith; var min$1 = Math.min; var CORRECT_IS_REGEXP_LOGIC$1 = correctIsRegexpLogic('startsWith'); @@ -3281,8 +3346,8 @@ notARegexp(searchString); var index = toLength(min$1(arguments.length > 1 ? arguments[1] : undefined, that.length)); var search = String(searchString); - return nativeStartsWith - ? nativeStartsWith.call(that, search, index) + return $startsWith + ? $startsWith.call(that, search, index) : that.slice(index, index + search.length) === search; } }); @@ -3294,7 +3359,8 @@ - var nativeEndsWith = ''.endsWith; + // eslint-disable-next-line es/no-string-prototype-endswith -- safe + var $endsWith = ''.endsWith; var min = Math.min; var CORRECT_IS_REGEXP_LOGIC = correctIsRegexpLogic('endsWith'); @@ -3314,8 +3380,8 @@ var len = toLength(that.length); var end = endPosition === undefined ? len : min(toLength(endPosition), len); var search = String(searchString); - return nativeEndsWith - ? nativeEndsWith.call(that, search, end) + return $endsWith + ? $endsWith.call(that, search, end) : that.slice(end - search.length, end) === search; } }); @@ -3582,19 +3648,30 @@ return true; }, + regexCompare: function regexCompare(value, search) { + try { + var regexpParts = search.match(/^\/(.*?)\/([gim]*)$/); + + if (value.toString().search(regexpParts ? new RegExp(regexpParts[1], regexpParts[2]) : new RegExp(search, 'gim')) !== -1) { + return true; + } + } catch (e) { + return false; + } + }, escapeHTML: function escapeHTML(text) { - if (typeof text === 'string') { - return text.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/`/g, '`'); + if (!text) { + return text; } - return text; + return text.toString().replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, '''); }, unescapeHTML: function unescapeHTML(text) { - if (typeof text === 'string') { - return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, '\'').replace(/`/g, '`'); + if (!text) { + return text; } - return text; + return text.toString().replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, '\''); }, getRealDataAttr: function getRealDataAttr(dataAttr) { for (var _i3 = 0, _Object$entries = Object.entries(dataAttr); _i3 < _Object$entries.length; _i3++) { @@ -3823,7 +3900,7 @@ if (_this.lastCluster !== (_this.lastCluster = _this.getNum())) { _this.initDOM(_this.rows); - _this.callback(); + _this.callback(_this.startIndex, _this.endIndex); } }; @@ -3863,6 +3940,8 @@ html.push(this.getExtra('bottom', data.bottomOffset)); } + this.startIndex = data.start; + this.endIndex = data.end; this.contentEl.innerHTML = html.join(''); if (fixedScroll) { @@ -3919,6 +3998,8 @@ } return { + start: start, + end: end, topOffset: topOffset, bottomOffset: bottomOffset, rowsAbove: rowsAbove, @@ -4007,12 +4088,26 @@ parts[1] = parts[1].toUpperCase(); } + var localesToExtend = {}; + if (locales[this.options.locale]) { - $__default['default'].extend(this.options, locales[this.options.locale]); + localesToExtend = locales[this.options.locale]; } else if (locales[parts.join('-')]) { - $__default['default'].extend(this.options, locales[parts.join('-')]); + localesToExtend = locales[parts.join('-')]; } else if (locales[parts[0]]) { - $__default['default'].extend(this.options, locales[parts[0]]); + localesToExtend = locales[parts[0]]; + } + + for (var _i = 0, _Object$entries = Object.entries(localesToExtend); _i < _Object$entries.length; _i++) { + var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), + formatName = _Object$entries$_i[0], + func = _Object$entries$_i[1]; + + if (this.options[formatName] !== BootstrapTable.DEFAULTS[formatName]) { + continue; + } + + this.options[formatName] = func; } } } @@ -4199,10 +4294,10 @@ var classes = ''; if (headerStyle && headerStyle.css) { - for (var _i = 0, _Object$entries = Object.entries(headerStyle.css); _i < _Object$entries.length; _i++) { - var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), - key = _Object$entries$_i[0], - value = _Object$entries$_i[1]; + for (var _i2 = 0, _Object$entries2 = Object.entries(headerStyle.css); _i2 < _Object$entries2.length; _i2++) { + var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2), + key = _Object$entries2$_i[0], + value = _Object$entries2$_i[1]; csses.push("".concat(key, ": ").concat(value)); } @@ -4294,16 +4389,6 @@ _this2.onSort(e); } }); - this.$header.children().children().off('keypress').on('keypress', function (e) { - if (_this2.options.sortable && $__default['default'](e.currentTarget).data().sortable) { - var code = e.keyCode || e.which; - - if (code === 13) { - // Enter keycode - _this2.onSort(e); - } - } - }); var resizeEvent = Utils.getEventName('resize.bootstrap-table', this.$el.attr('id')); $__default['default'](window).off(resizeEvent); @@ -4582,10 +4667,10 @@ }); var buttonsHtml = {}; - for (var _i2 = 0, _Object$entries2 = Object.entries(this.buttons); _i2 < _Object$entries2.length; _i2++) { - var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2), - buttonName = _Object$entries2$_i[0], - buttonConfig = _Object$entries2$_i[1]; + for (var _i3 = 0, _Object$entries3 = Object.entries(this.buttons); _i3 < _Object$entries3.length; _i3++) { + var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i3], 2), + buttonName = _Object$entries3$_i[0], + buttonConfig = _Object$entries3$_i[1]; var buttonHtml = void 0; @@ -4599,10 +4684,10 @@ buttonHtml = "\n \n ") : "\n
    \n \n
    \n ") + html: function html() { + if (exportTypes.length === 1) { + return "\n
    \n \n
    \n "); + } + + var html = []; + html.push("\n
    \n \n ").concat(_this.constants.html.toolbarDropdown[0], "\n ")); + + var _iterator = _createForOfIteratorHelper(exportTypes), + _step; + + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var type = _step.value; + + if (TYPE_NAME.hasOwnProperty(type)) { + var $item = $__default['default'](Utils.sprintf(_this.constants.html.pageDropdownItem, '', TYPE_NAME[type])); + $item.attr('data-type', type); + html.push($item.prop('outerHTML')); + } + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + + html.push(_this.constants.html.toolbarDropdown[1], '
    '); + return html.join(''); + } } }); } @@ -10713,40 +10902,14 @@ return; } - var $menu = $__default['default'](this.constants.html.toolbarDropdown.join('')); - var $items = this.$export; + this.updateExportButton(); + var $exportButtons = this.$export.find('[data-type]'); - if (exportTypes.length > 1) { - this.$export.append($menu); // themes support - - if ($menu.children().length) { - $menu = $menu.children().eq(0); - } - - var _iterator = _createForOfIteratorHelper(exportTypes), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var type = _step.value; - - if (TYPE_NAME.hasOwnProperty(type)) { - var $item = $__default['default'](Utils.sprintf(this.constants.html.pageDropdownItem, '', TYPE_NAME[type])); - $item.attr('data-type', type); - $menu.append($item); - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - $items = $menu.children(); + if (exportTypes.length === 1) { + $exportButtons = this.$export.find('button'); } - this.updateExportButton(); - $items.click(function (e) { + $exportButtons.click(function (e) { e.preventDefault(); var type = $__default['default'](e.currentTarget).data('type'); var exportOptions = { @@ -11164,9 +11327,10 @@ // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global_1 = - /* global globalThis -- safe */ + // eslint-disable-next-line es/no-global-this -- safe check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || + // eslint-disable-next-line no-restricted-globals -- safe check(typeof self == 'object' && self) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) || // eslint-disable-next-line no-new-func -- fallback @@ -11182,21 +11346,23 @@ // Detect IE8's incomplete defineProperty implementation var descriptors = !fails(function () { + // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; }); - var nativePropertyIsEnumerable = {}.propertyIsEnumerable; + var $propertyIsEnumerable = {}.propertyIsEnumerable; + // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug - var NASHORN_BUG = getOwnPropertyDescriptor$1 && !nativePropertyIsEnumerable.call({ 1: 2 }, 1); + var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1); // `Object.prototype.propertyIsEnumerable` method implementation // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable var f$4 = NASHORN_BUG ? function propertyIsEnumerable(V) { var descriptor = getOwnPropertyDescriptor$1(this, V); return !!descriptor && descriptor.enumerable; - } : nativePropertyIsEnumerable; + } : $propertyIsEnumerable; var objectPropertyIsEnumerable = { f: f$4 @@ -11276,20 +11442,22 @@ // Thank's IE8 for his funny defineProperty var ie8DomDefine = !descriptors && !fails(function () { + // eslint-disable-next-line es/no-object-defineproperty -- requied for testing return Object.defineProperty(documentCreateElement('div'), 'a', { get: function () { return 7; } }).a != 7; }); - var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe + var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor - var f$3 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { + var f$3 = descriptors ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { O = toIndexedObject(O); P = toPrimitive(P, true); if (ie8DomDefine) try { - return nativeGetOwnPropertyDescriptor(O, P); + return $getOwnPropertyDescriptor(O, P); } catch (error) { /* empty */ } if (has$1(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]); }; @@ -11304,16 +11472,17 @@ } return it; }; - var nativeDefineProperty = Object.defineProperty; + // eslint-disable-next-line es/no-object-defineproperty -- safe + var $defineProperty = Object.defineProperty; // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty - var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) { + var f$2 = descriptors ? $defineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); anObject(Attributes); if (ie8DomDefine) try { - return nativeDefineProperty(O, P, Attributes); + return $defineProperty(O, P, Attributes); } catch (error) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported'); if ('value' in Attributes) O[P] = Attributes.value; @@ -11363,7 +11532,7 @@ (module.exports = function (key, value) { return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {}); })('versions', []).push({ - version: '3.9.1', + version: '3.10.1', mode: 'global', copyright: '© 2021 Denis Pushkarev (zloirock.ru)' }); @@ -11575,6 +11744,7 @@ // `Object.getOwnPropertyNames` method // https://tc39.es/ecma262/#sec-object.getownpropertynames + // eslint-disable-next-line es/no-object-getownpropertynames -- safe var f$1 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return objectKeysInternal(O, hiddenKeys); }; @@ -11583,6 +11753,7 @@ f: f$1 }; + // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe var f = Object.getOwnPropertySymbols; var objectGetOwnPropertySymbols = { @@ -11682,6 +11853,7 @@ // `IsArray` abstract operation // https://tc39.es/ecma262/#sec-isarray + // eslint-disable-next-line es/no-array-isarray -- safe var isArray = Array.isArray || function isArray(arg) { return classofRaw(arg) == 'Array'; }; @@ -11720,16 +11892,19 @@ var engineV8Version = version && +version; + // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () { - /* global Symbol -- required for testing */ + // eslint-disable-next-line es/no-symbol -- required for testing return !Symbol.sham && // Chrome 38 Symbol has incorrect toString conversion // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances (engineIsNode ? engineV8Version === 38 : engineV8Version > 37 && engineV8Version < 41); }); + /* eslint-disable es/no-symbol -- required for testing */ + + var useSymbolAsUid = nativeSymbol - /* global Symbol -- safe */ && !Symbol.sham && typeof Symbol.iterator == 'symbol'; @@ -11870,7 +12045,7 @@ return RegExp(s, f); } - var UNSUPPORTED_Y$1 = fails(function () { + var UNSUPPORTED_Y$2 = fails(function () { // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError var re = RE('a', 'y'); re.lastIndex = 2; @@ -11885,15 +12060,12 @@ }); var regexpStickyHelpers = { - UNSUPPORTED_Y: UNSUPPORTED_Y$1, + UNSUPPORTED_Y: UNSUPPORTED_Y$2, BROKEN_CARET: BROKEN_CARET }; var nativeExec = RegExp.prototype.exec; - // This always refers to the native implementation, because the - // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js, - // which loads this file before patching the method. - var nativeReplace = String.prototype.replace; + var nativeReplace = shared('native-string-replace', String.prototype.replace); var patchedExec = nativeExec; @@ -11905,19 +12077,19 @@ return re1.lastIndex !== 0 || re2.lastIndex !== 0; })(); - var UNSUPPORTED_Y = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET; + var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET; // nonparticipating capturing group, copied from es5-shim's String#split patch. // eslint-disable-next-line regexp/no-assertion-capturing-group, regexp/no-empty-group -- required for testing var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined; - var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y; + var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1; if (PATCH) { patchedExec = function exec(str) { var re = this; var lastIndex, reCopy, match, i; - var sticky = UNSUPPORTED_Y && re.sticky; + var sticky = UNSUPPORTED_Y$1 && re.sticky; var flags = regexpFlags.call(re); var source = re.source; var charsAdded = 0; @@ -11987,7 +12159,6 @@ - var SPECIES$1 = wellKnownSymbol('species'); var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () { @@ -12006,6 +12177,7 @@ // IE <= 11 replaces $0 with the whole match, as if it was $& // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0 var REPLACE_KEEPS_$0 = (function () { + // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing return 'a'.replace(/./, '$0') === '$0'; })(); @@ -12075,7 +12247,7 @@ ) { var nativeRegExpMethod = /./[SYMBOL]; var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) { - if (regexp.exec === regexpExec) { + if (regexp.exec === RegExp.prototype.exec) { if (DELEGATES_TO_SYMBOL && !forceStringMethod) { // The native String method already delegates to @@method (this // polyfilled function), leasing to infinite recursion. @@ -12183,13 +12355,11 @@ return regexpExec.call(R, S); }; + var UNSUPPORTED_Y = regexpStickyHelpers.UNSUPPORTED_Y; var arrayPush = [].push; var min$1 = Math.min; var MAX_UINT32 = 0xFFFFFFFF; - // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError - var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); }); - // @@split logic fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) { var internalSplit; @@ -12272,11 +12442,11 @@ var flags = (rx.ignoreCase ? 'i' : '') + (rx.multiline ? 'm' : '') + (rx.unicode ? 'u' : '') + - (SUPPORTS_Y ? 'y' : 'g'); + (UNSUPPORTED_Y ? 'g' : 'y'); // ^(? + rx + ) is needed, in combination with some S slicing, to // simulate the 'y' flag. - var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags); + var splitter = new C(UNSUPPORTED_Y ? '^(?:' + rx.source + ')' : rx, flags); var lim = limit === undefined ? MAX_UINT32 : limit >>> 0; if (lim === 0) return []; if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : []; @@ -12284,12 +12454,12 @@ var q = 0; var A = []; while (q < S.length) { - splitter.lastIndex = SUPPORTS_Y ? q : 0; - var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q)); + splitter.lastIndex = UNSUPPORTED_Y ? 0 : q; + var z = regexpExecAbstract(splitter, UNSUPPORTED_Y ? S.slice(q) : S); var e; if ( z === null || - (e = min$1(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p + (e = min$1(toLength(splitter.lastIndex + (UNSUPPORTED_Y ? q : 0)), S.length)) === p ) { q = advanceStringIndex(S, q, unicodeMatching); } else { @@ -12306,7 +12476,7 @@ return A; } ]; - }, !SUPPORTS_Y); + }, UNSUPPORTED_Y); var floor = Math.floor; var replace = ''.replace; @@ -12571,6 +12741,7 @@ // https://tc39.es/ecma262/#sec-array.prototype.foreach var arrayForEach = !STRICT_METHOD ? function forEach(callbackfn /* , thisArg */) { return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + // eslint-disable-next-line es/no-array-prototype-foreach -- safe } : [].forEach; for (var COLLECTION_NAME in domIterables) { @@ -12648,12 +12819,14 @@ // `Object.keys` method // https://tc39.es/ecma262/#sec-object.keys + // eslint-disable-next-line es/no-object-keys -- safe var objectKeys = Object.keys || function keys(O) { return objectKeysInternal(O, enumBugKeys); }; // `Object.defineProperties` method // https://tc39.es/ecma262/#sec-object.defineproperties + // eslint-disable-next-line es/no-object-defineproperties -- safe var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) { anObject(O); var keys = objectKeys(Properties); @@ -12804,6 +12977,7 @@ // `SameValue` abstract operation // https://tc39.es/ecma262/#sec-samevalue + // eslint-disable-next-line es/no-object-is -- safe var sameValue = Object.is || function is(x, y) { // eslint-disable-next-line no-self-compare -- NaN check return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; @@ -12848,9 +13022,11 @@ cookieIds: { sortOrder: 'bs.table.sortOrder', sortName: 'bs.table.sortName', + sortPriority: 'bs.table.sortPriority', pageNumber: 'bs.table.pageNumber', pageList: 'bs.table.pageList', columns: 'bs.table.columns', + cardView: 'bs.table.cardView', searchText: 'bs.table.searchText', reorderColumns: 'bs.table.reorderColumns', filterControl: 'bs.table.filterControl', @@ -13106,7 +13282,7 @@ cookieSecure: null, cookieSameSite: 'Lax', cookieIdTable: '', - cookiesEnabled: ['bs.table.sortOrder', 'bs.table.sortName', 'bs.table.pageNumber', 'bs.table.pageList', 'bs.table.columns', 'bs.table.searchText', 'bs.table.filterControl', 'bs.table.filterBy', 'bs.table.reorderColumns'], + cookiesEnabled: ['bs.table.sortOrder', 'bs.table.sortName', 'bs.table.sortPriority', 'bs.table.pageNumber', 'bs.table.pageList', 'bs.table.columns', 'bs.table.searchText', 'bs.table.filterControl', 'bs.table.filterBy', 'bs.table.reorderColumns', 'bs.table.cardView'], cookieStorage: 'cookieStorage', // localStorage, sessionStorage, customStorage cookieCustomStorageGet: null, @@ -13232,35 +13408,57 @@ if (this.options.sortName === undefined || this.options.sortOrder === undefined) { UtilsCookie.deleteCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.sortName); UtilsCookie.deleteCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.sortOrder); - return; + } else { + this.options.sortPriority = null; + UtilsCookie.deleteCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.sortPriority); + UtilsCookie.setCookie(this, UtilsCookie.cookieIds.sortOrder, this.options.sortOrder); + UtilsCookie.setCookie(this, UtilsCookie.cookieIds.sortName, this.options.sortName); } - - UtilsCookie.setCookie(this, UtilsCookie.cookieIds.sortOrder, this.options.sortOrder); - UtilsCookie.setCookie(this, UtilsCookie.cookieIds.sortName, this.options.sortName); } }, { - key: "onPageNumber", - value: function onPageNumber() { + key: "onMultipleSort", + value: function onMultipleSort() { var _get5; for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { args[_key4] = arguments[_key4]; } - (_get5 = _get(_getPrototypeOf(_class.prototype), "onPageNumber", this)).call.apply(_get5, [this].concat(args)); + (_get5 = _get(_getPrototypeOf(_class.prototype), "onMultipleSort", this)).call.apply(_get5, [this].concat(args)); - UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber); + if (this.options.sortPriority === undefined) { + UtilsCookie.deleteCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.sortPriority); + } else { + this.options.sortName = undefined; + this.options.sortOrder = undefined; + UtilsCookie.deleteCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.sortName); + UtilsCookie.deleteCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.sortOrder); + UtilsCookie.setCookie(this, UtilsCookie.cookieIds.sortPriority, JSON.stringify(this.options.sortPriority)); + } } }, { - key: "onPageListChange", - value: function onPageListChange() { + key: "onPageNumber", + value: function onPageNumber() { var _get6; for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { args[_key5] = arguments[_key5]; } - (_get6 = _get(_getPrototypeOf(_class.prototype), "onPageListChange", this)).call.apply(_get6, [this].concat(args)); + (_get6 = _get(_getPrototypeOf(_class.prototype), "onPageNumber", this)).call.apply(_get6, [this].concat(args)); + + UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber); + } + }, { + key: "onPageListChange", + value: function onPageListChange() { + var _get7; + + for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { + args[_key6] = arguments[_key6]; + } + + (_get7 = _get(_getPrototypeOf(_class.prototype), "onPageListChange", this)).call.apply(_get7, [this].concat(args)); UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageList, this.options.pageSize); UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber); @@ -13268,39 +13466,39 @@ }, { key: "onPagePre", value: function onPagePre() { - var _get7; - - for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { - args[_key6] = arguments[_key6]; - } - - (_get7 = _get(_getPrototypeOf(_class.prototype), "onPagePre", this)).call.apply(_get7, [this].concat(args)); - - UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber); - } - }, { - key: "onPageNext", - value: function onPageNext() { var _get8; for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) { args[_key7] = arguments[_key7]; } - (_get8 = _get(_getPrototypeOf(_class.prototype), "onPageNext", this)).call.apply(_get8, [this].concat(args)); + (_get8 = _get(_getPrototypeOf(_class.prototype), "onPagePre", this)).call.apply(_get8, [this].concat(args)); UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber); } }, { - key: "_toggleColumn", - value: function _toggleColumn() { + key: "onPageNext", + value: function onPageNext() { var _get9; for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) { args[_key8] = arguments[_key8]; } - (_get9 = _get(_getPrototypeOf(_class.prototype), "_toggleColumn", this)).call.apply(_get9, [this].concat(args)); + (_get9 = _get(_getPrototypeOf(_class.prototype), "onPageNext", this)).call.apply(_get9, [this].concat(args)); + + UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber); + } + }, { + key: "_toggleColumn", + value: function _toggleColumn() { + var _get10; + + for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) { + args[_key9] = arguments[_key9]; + } + + (_get10 = _get(_getPrototypeOf(_class.prototype), "_toggleColumn", this)).call.apply(_get10, [this].concat(args)); UtilsCookie.setCookie(this, UtilsCookie.cookieIds.columns, JSON.stringify(this.getVisibleColumns().map(function (column) { return column.field; @@ -13309,18 +13507,25 @@ }, { key: "_toggleAllColumns", value: function _toggleAllColumns() { - var _get10; + var _get11; - for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) { - args[_key9] = arguments[_key9]; + for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) { + args[_key10] = arguments[_key10]; } - (_get10 = _get(_getPrototypeOf(_class.prototype), "_toggleAllColumns", this)).call.apply(_get10, [this].concat(args)); + (_get11 = _get(_getPrototypeOf(_class.prototype), "_toggleAllColumns", this)).call.apply(_get11, [this].concat(args)); UtilsCookie.setCookie(this, UtilsCookie.cookieIds.columns, JSON.stringify(this.getVisibleColumns().map(function (column) { return column.field; }))); } + }, { + key: "toggleView", + value: function toggleView() { + _get(_getPrototypeOf(_class.prototype), "toggleView", this).call(this); + + UtilsCookie.setCookie(this, UtilsCookie.cookieIds.cardView, this.options.cardView); + } }, { key: "selectPage", value: function selectPage(page) { @@ -13342,17 +13547,17 @@ }, { key: "initHeader", value: function initHeader() { - var _get11; + var _get12; if (this.options.reorderableColumns) { this.columnsSortOrder = JSON.parse(UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.reorderColumns)); } - for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) { - args[_key10] = arguments[_key10]; + for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) { + args[_key11] = arguments[_key11]; } - (_get11 = _get(_getPrototypeOf(_class.prototype), "initHeader", this)).call.apply(_get11, [this].concat(args)); + (_get12 = _get(_getPrototypeOf(_class.prototype), "initHeader", this)).call.apply(_get12, [this].concat(args)); } }, { key: "persistReorderColumnsState", @@ -13362,13 +13567,13 @@ }, { key: "filterBy", value: function filterBy() { - var _get12; + var _get13; - for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) { - args[_key11] = arguments[_key11]; + for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) { + args[_key12] = arguments[_key12]; } - (_get12 = _get(_getPrototypeOf(_class.prototype), "filterBy", this)).call.apply(_get12, [this].concat(args)); + (_get13 = _get(_getPrototypeOf(_class.prototype), "filterBy", this)).call.apply(_get13, [this].concat(args)); UtilsCookie.setCookie(this, UtilsCookie.cookieIds.filterBy, JSON.stringify(this.filterColumns)); } @@ -13390,9 +13595,11 @@ var sortOrderCookie = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.sortOrder); var sortOrderNameCookie = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.sortName); + var sortPriorityCookie = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.sortPriority); var pageNumberCookie = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.pageNumber); var pageListCookie = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.pageList); var searchTextCookie = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.searchText); + var cardViewCookie = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.cardView); var columnsCookieValue = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.columns); if (typeof columnsCookieValue === 'boolean' && !columnsCookieValue) { @@ -13405,18 +13612,42 @@ columnsCookie = JSON.parse(columnsCookieValue); } catch (e) { throw new Error('Could not parse the json of the columns cookie!', columnsCookieValue); + } + + try { + sortPriorityCookie = JSON.parse(sortPriorityCookie); + } catch (e) { + throw new Error('Could not parse the json of the sortPriority cookie!', sortPriorityCookie); } // sortOrder - this.options.sortOrder = sortOrderCookie ? sortOrderCookie : this.options.sortOrder; // sortName + this.options.sortOrder = undefined; // sortName + + this.options.sortName = undefined; + + if (!sortPriorityCookie) { + // sortOrder + this.options.sortOrder = sortOrderCookie ? sortOrderCookie : this.options.sortOrder; // sortName + + this.options.sortName = sortOrderNameCookie ? sortOrderNameCookie : this.options.sortName; + } // sortPriority + + + this.options.sortPriority = sortPriorityCookie ? sortPriorityCookie : this.options.sortPriority; + + if (this.options.sortOrder || this.options.sortName) { + // sortPriority + this.options.sortPriority = null; + } // pageNumber - this.options.sortName = sortOrderNameCookie ? sortOrderNameCookie : this.options.sortName; // pageNumber this.options.pageNumber = pageNumberCookie ? +pageNumberCookie : this.options.pageNumber; // pageSize this.options.pageSize = pageListCookie ? pageListCookie === this.options.formatAllRows() ? pageListCookie : +pageListCookie : this.options.pageSize; // searchText - this.options.searchText = searchTextCookie ? searchTextCookie : ''; + this.options.searchText = searchTextCookie ? searchTextCookie : ''; // cardView + + this.options.cardView = cardViewCookie === 'true' ? cardViewCookie : false; if (columnsCookie) { var _iterator = _createForOfIteratorHelper(this.columns), @@ -13425,7 +13656,7 @@ try { var _loop = function _loop() { var column = _step.value; - column.visible = columnsCookie.filter(function (columnField) { + var filteredColumns = columnsCookie.filter(function (columnField) { if (_this.isSelectionColumn(column)) { return true; } @@ -13441,7 +13672,8 @@ } return columnField === column.field; - }).length > 0 || !column.switchable; + }); + column.visible = (filteredColumns.length > 0 || !column.switchable) && column.visible; }; for (_iterator.s(); !(_step = _iterator.n()).done;) { @@ -13717,9 +13949,10 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global_1 = - /* global globalThis -- safe */ + // eslint-disable-next-line es/no-global-this -- safe check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || + // eslint-disable-next-line no-restricted-globals -- safe check(typeof self == 'object' && self) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) || // eslint-disable-next-line no-new-func -- fallback @@ -13735,21 +13968,23 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") // Detect IE8's incomplete defineProperty implementation var descriptors = !fails(function () { + // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; }); - var nativePropertyIsEnumerable = {}.propertyIsEnumerable; + var $propertyIsEnumerable = {}.propertyIsEnumerable; + // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug - var NASHORN_BUG = getOwnPropertyDescriptor$1 && !nativePropertyIsEnumerable.call({ 1: 2 }, 1); + var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1); // `Object.prototype.propertyIsEnumerable` method implementation // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable var f$4 = NASHORN_BUG ? function propertyIsEnumerable(V) { var descriptor = getOwnPropertyDescriptor$1(this, V); return !!descriptor && descriptor.enumerable; - } : nativePropertyIsEnumerable; + } : $propertyIsEnumerable; var objectPropertyIsEnumerable = { f: f$4 @@ -13829,20 +14064,22 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") // Thank's IE8 for his funny defineProperty var ie8DomDefine = !descriptors && !fails(function () { + // eslint-disable-next-line es/no-object-defineproperty -- requied for testing return Object.defineProperty(documentCreateElement('div'), 'a', { get: function () { return 7; } }).a != 7; }); - var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe + var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor - var f$3 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { + var f$3 = descriptors ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { O = toIndexedObject(O); P = toPrimitive(P, true); if (ie8DomDefine) try { - return nativeGetOwnPropertyDescriptor(O, P); + return $getOwnPropertyDescriptor(O, P); } catch (error) { /* empty */ } if (has$1(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]); }; @@ -13857,16 +14094,17 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") } return it; }; - var nativeDefineProperty = Object.defineProperty; + // eslint-disable-next-line es/no-object-defineproperty -- safe + var $defineProperty = Object.defineProperty; // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty - var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) { + var f$2 = descriptors ? $defineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); anObject(Attributes); if (ie8DomDefine) try { - return nativeDefineProperty(O, P, Attributes); + return $defineProperty(O, P, Attributes); } catch (error) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported'); if ('value' in Attributes) O[P] = Attributes.value; @@ -13916,7 +14154,7 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") (module.exports = function (key, value) { return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {}); })('versions', []).push({ - version: '3.9.1', + version: '3.10.1', mode: 'global', copyright: '© 2021 Denis Pushkarev (zloirock.ru)' }); @@ -14128,6 +14366,7 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") // `Object.getOwnPropertyNames` method // https://tc39.es/ecma262/#sec-object.getownpropertynames + // eslint-disable-next-line es/no-object-getownpropertynames -- safe var f$1 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return objectKeysInternal(O, hiddenKeys); }; @@ -14136,6 +14375,7 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") f: f$1 }; + // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe var f = Object.getOwnPropertySymbols; var objectGetOwnPropertySymbols = { @@ -14235,6 +14475,7 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") // `IsArray` abstract operation // https://tc39.es/ecma262/#sec-isarray + // eslint-disable-next-line es/no-array-isarray -- safe var isArray = Array.isArray || function isArray(arg) { return classofRaw(arg) == 'Array'; }; @@ -14273,16 +14514,19 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") var engineV8Version = version && +version; + // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () { - /* global Symbol -- required for testing */ + // eslint-disable-next-line es/no-symbol -- required for testing return !Symbol.sham && // Chrome 38 Symbol has incorrect toString conversion // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances (engineIsNode ? engineV8Version === 38 : engineV8Version > 37 && engineV8Version < 41); }); + /* eslint-disable es/no-symbol -- required for testing */ + + var useSymbolAsUid = nativeSymbol - /* global Symbol -- safe */ && !Symbol.sham && typeof Symbol.iterator == 'symbol'; @@ -14480,12 +14724,14 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") // `Object.keys` method // https://tc39.es/ecma262/#sec-object.keys + // eslint-disable-next-line es/no-object-keys -- safe var objectKeys = Object.keys || function keys(O) { return objectKeysInternal(O, enumBugKeys); }; // `Object.defineProperties` method // https://tc39.es/ecma262/#sec-object.defineproperties + // eslint-disable-next-line es/no-object-defineproperties -- safe var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) { anObject(O); var keys = objectKeys(Properties); @@ -14764,8 +15010,11 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") if (top > start && top <= end) { // ensure clone and source column widths are the same - this.$stickyHeader.find('tr:eq(0)').find('th').each(function (index, el) { - $__default['default'](el).css('min-width', _this4.$header.find('tr:eq(0)').find('th').eq(index).css('width')); + this.$stickyHeader.find('tr').each(function (indexRows, rows) { + var columns = $__default['default'](rows).find('th'); + columns.each(function (indexColumns, celd) { + $__default['default'](celd).css('min-width', _this4.$header.find("tr:eq(".concat(indexRows, ")")).find("th:eq(".concat(indexColumns, ")")).css('width')); + }); }); // match bootstrap table style this.$stickyContainer.show().addClass('fix-sticky fixed-table-container'); // stick it in position @@ -15098,9 +15347,10 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global_1 = - /* global globalThis -- safe */ + // eslint-disable-next-line es/no-global-this -- safe check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || + // eslint-disable-next-line no-restricted-globals -- safe check(typeof self == 'object' && self) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) || // eslint-disable-next-line no-new-func -- fallback @@ -15116,21 +15366,23 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") // Detect IE8's incomplete defineProperty implementation var descriptors = !fails(function () { + // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; }); - var nativePropertyIsEnumerable = {}.propertyIsEnumerable; + var $propertyIsEnumerable = {}.propertyIsEnumerable; + // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug - var NASHORN_BUG = getOwnPropertyDescriptor$1 && !nativePropertyIsEnumerable.call({ 1: 2 }, 1); + var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1); // `Object.prototype.propertyIsEnumerable` method implementation // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable var f$4 = NASHORN_BUG ? function propertyIsEnumerable(V) { var descriptor = getOwnPropertyDescriptor$1(this, V); return !!descriptor && descriptor.enumerable; - } : nativePropertyIsEnumerable; + } : $propertyIsEnumerable; var objectPropertyIsEnumerable = { f: f$4 @@ -15210,20 +15462,22 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") // Thank's IE8 for his funny defineProperty var ie8DomDefine = !descriptors && !fails(function () { + // eslint-disable-next-line es/no-object-defineproperty -- requied for testing return Object.defineProperty(documentCreateElement('div'), 'a', { get: function () { return 7; } }).a != 7; }); - var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe + var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor - var f$3 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { + var f$3 = descriptors ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { O = toIndexedObject(O); P = toPrimitive(P, true); if (ie8DomDefine) try { - return nativeGetOwnPropertyDescriptor(O, P); + return $getOwnPropertyDescriptor(O, P); } catch (error) { /* empty */ } if (has$1(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]); }; @@ -15238,16 +15492,17 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") } return it; }; - var nativeDefineProperty = Object.defineProperty; + // eslint-disable-next-line es/no-object-defineproperty -- safe + var $defineProperty = Object.defineProperty; // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty - var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) { + var f$2 = descriptors ? $defineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); anObject(Attributes); if (ie8DomDefine) try { - return nativeDefineProperty(O, P, Attributes); + return $defineProperty(O, P, Attributes); } catch (error) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported'); if ('value' in Attributes) O[P] = Attributes.value; @@ -15297,7 +15552,7 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") (module.exports = function (key, value) { return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {}); })('versions', []).push({ - version: '3.9.1', + version: '3.10.1', mode: 'global', copyright: '© 2021 Denis Pushkarev (zloirock.ru)' }); @@ -15509,6 +15764,7 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") // `Object.getOwnPropertyNames` method // https://tc39.es/ecma262/#sec-object.getownpropertynames + // eslint-disable-next-line es/no-object-getownpropertynames -- safe var f$1 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return objectKeysInternal(O, hiddenKeys); }; @@ -15517,6 +15773,7 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") f: f$1 }; + // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe var f = Object.getOwnPropertySymbols; var objectGetOwnPropertySymbols = { @@ -15654,10 +15911,7 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") }; var nativeExec = RegExp.prototype.exec; - // This always refers to the native implementation, because the - // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js, - // which loads this file before patching the method. - var nativeReplace = String.prototype.replace; + var nativeReplace = shared('native-string-replace', String.prototype.replace); var patchedExec = nativeExec; @@ -15766,16 +16020,19 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") var engineV8Version = version && +version; + // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () { - /* global Symbol -- required for testing */ + // eslint-disable-next-line es/no-symbol -- required for testing return !Symbol.sham && // Chrome 38 Symbol has incorrect toString conversion // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances (engineIsNode ? engineV8Version === 38 : engineV8Version > 37 && engineV8Version < 41); }); + /* eslint-disable es/no-symbol -- required for testing */ + + var useSymbolAsUid = nativeSymbol - /* global Symbol -- safe */ && !Symbol.sham && typeof Symbol.iterator == 'symbol'; @@ -15800,7 +16057,6 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") - var SPECIES$2 = wellKnownSymbol('species'); var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () { @@ -15819,6 +16075,7 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") // IE <= 11 replaces $0 with the whole match, as if it was $& // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0 var REPLACE_KEEPS_$0 = (function () { + // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing return 'a'.replace(/./, '$0') === '$0'; })(); @@ -15888,7 +16145,7 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") ) { var nativeRegExpMethod = /./[SYMBOL]; var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) { - if (regexp.exec === regexpExec) { + if (regexp.exec === RegExp.prototype.exec) { if (DELEGATES_TO_SYMBOL && !forceStringMethod) { // The native String method already delegates to @@method (this // polyfilled function), leasing to infinite recursion. @@ -15921,6 +16178,7 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") // `SameValue` abstract operation // https://tc39.es/ecma262/#sec-samevalue + // eslint-disable-next-line es/no-object-is -- safe var sameValue = Object.is || function is(x, y) { // eslint-disable-next-line no-self-compare -- NaN check return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; @@ -15975,6 +16233,7 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") // `Object.keys` method // https://tc39.es/ecma262/#sec-object.keys + // eslint-disable-next-line es/no-object-keys -- safe var objectKeys = Object.keys || function keys(O) { return objectKeysInternal(O, enumBugKeys); }; @@ -15985,14 +16244,16 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") return Object(requireObjectCoercible(argument)); }; - var nativeAssign = Object.assign; + // eslint-disable-next-line es/no-object-assign -- safe + var $assign = Object.assign; + // eslint-disable-next-line es/no-object-defineproperty -- required for testing var defineProperty = Object.defineProperty; // `Object.assign` method // https://tc39.es/ecma262/#sec-object.assign - var objectAssign = !nativeAssign || fails(function () { + var objectAssign = !$assign || fails(function () { // should have correct order of operations (Edge bug) - if (descriptors && nativeAssign({ b: 1 }, nativeAssign(defineProperty({}, 'a', { + if (descriptors && $assign({ b: 1 }, $assign(defineProperty({}, 'a', { enumerable: true, get: function () { defineProperty(this, 'b', { @@ -16004,12 +16265,12 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") // should work with symbols and should have deterministic property order (V8 bug) var A = {}; var B = {}; - /* global Symbol -- required for testing */ + // eslint-disable-next-line es/no-symbol -- safe var symbol = Symbol(); var alphabet = 'abcdefghijklmnopqrst'; A[symbol] = 7; alphabet.split('').forEach(function (chr) { B[chr] = chr; }); - return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet; + return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet; }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length` var T = toObject(target); var argumentsLength = arguments.length; @@ -16027,10 +16288,11 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key]; } } return T; - } : nativeAssign; + } : $assign; // `Object.assign` method // https://tc39.es/ecma262/#sec-object.assign + // eslint-disable-next-line es/no-object-assign -- required for testing _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, { assign: objectAssign }); @@ -16087,6 +16349,7 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") // `IsArray` abstract operation // https://tc39.es/ecma262/#sec-isarray + // eslint-disable-next-line es/no-array-isarray -- safe var isArray = Array.isArray || function isArray(arg) { return classofRaw(arg) == 'Array'; }; @@ -16177,6 +16440,7 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") // `Object.defineProperties` method // https://tc39.es/ecma262/#sec-object.defineproperties + // eslint-disable-next-line es/no-object-defineproperties -- safe var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) { anObject(O); var keys = objectKeys(Properties); @@ -16422,6 +16686,8 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") } }); + /* eslint-disable es/no-array-prototype-indexof -- required for testing */ + var $indexOf = arrayIncludes.indexOf; @@ -16572,7 +16838,7 @@ if(r.bookProps){v.Props=u;v.Custprops=d}if(r.bookSheets&&typeof i!=="undefined") }, bootstrap5: { icons: { - advancedSearchIcon: 'fa-chevron-down' + advancedSearchIcon: 'bi-chevron-down' }, html: { modal: "\n
    \n
    \n
    \n
    \n

    %s

    \n \n
    \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n
    \n " diff --git a/public/js/snipeit.js b/public/js/snipeit.js index cfa646d9e..81c79c884 100644 --- a/public/js/snipeit.js +++ b/public/js/snipeit.js @@ -172,6 +172,36 @@ pieOptions = { $el.on('click', '.delete-asset', events['click']); }; + return { + render: render + }; + + // confirm restore modal + Components.modals.confirmRestore = function () { + var $el = $('table'); + + var events = { + 'click': function click(evnt) { + var $context = $(this); + var $dataConfirmModal = $('#restoreConfirmModal'); + var href = $context.attr('href'); + var message = $context.attr('data-content'); + var title = $context.attr('data-title'); + + $('#myModalLabel').text(title); + $dataConfirmModal.find('.modal-body').text(message); + $('#confirmRestoreForm').attr('action', href); + $dataConfirmModal.modal({ + show: true + }); + return false; + } + }; + + var render = function render() { + $el.on('click', '.restore-modal', events['click']); + }; + return { render: render }; diff --git a/public/mix-manifest.json b/public/mix-manifest.json index cd55b16f0..038314dd4 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -1,5 +1,5 @@ { - "/js/build/app.js": "/js/build/app.js?id=c8a70594c0d99275266d", + "/js/build/app.js": "/js/build/app.js?id=16ac5c8f218827150ce0", "/css/dist/skins/skin-blue.css": "/css/dist/skins/skin-blue.css?id=83e39e254b7f9035eddc", "/css/build/overrides.css": "/css/build/overrides.css?id=b1866ec98d44c0a8ceea", "/css/build/app.css": "/css/build/app.css?id=61d5535cb27cce41d422", @@ -18,15 +18,15 @@ "/css/dist/skins/skin-green.css": "/css/dist/skins/skin-green.css?id=efda2335fa5243175850", "/css/dist/skins/skin-contrast.css": "/css/dist/skins/skin-contrast.css?id=6a9d0ac448c28b88e5d6", "/css/dist/skins/skin-red.css": "/css/dist/skins/skin-red.css?id=c24716a423d375902723", - "/css/dist/all.css": "/css/dist/all.css?id=138874c5ffe57b679997", + "/css/dist/all.css": "/css/dist/all.css?id=3480eded2be4cd65a83e", "/css/blue.png": "/css/blue.png?id=e83a6c29e04fe851f212", "/css/blue@2x.png": "/css/blue@2x.png?id=51135dd4d24f88f5de0b", "/css/dist/signature-pad.css": "/css/dist/signature-pad.css?id=6a89d3cd901305e66ced", "/css/dist/signature-pad.min.css": "/css/dist/signature-pad.min.css?id=6a89d3cd901305e66ced", - "/css/dist/bootstrap-table.css": "/css/dist/bootstrap-table.css?id=93c24b4c89490bbfd73e", + "/css/dist/bootstrap-table.css": "/css/dist/bootstrap-table.css?id=810d7e520c3057ee500e", "/js/build/vendor.js": "/js/build/vendor.js?id=651427cc4b45d8e68d0c", - "/js/dist/bootstrap-table.js": "/js/dist/bootstrap-table.js?id=867755a1544f6c0ea828", - "/js/dist/all.js": "/js/dist/all.js?id=a233dcde4650f5d34491", + "/js/dist/bootstrap-table.js": "/js/dist/bootstrap-table.js?id=0f09ee116517a9573dd0", + "/js/dist/all.js": "/js/dist/all.js?id=fbc9a3fb41192f2724e8", "/css/dist/skins/skin-green.min.css": "/css/dist/skins/skin-green.min.css?id=efda2335fa5243175850", "/css/dist/skins/skin-green-dark.min.css": "/css/dist/skins/skin-green-dark.min.css?id=6e35fb4cb2f1063b3047", "/css/dist/skins/skin-black.min.css": "/css/dist/skins/skin-black.min.css?id=ec96c42439cdeb022133", diff --git a/resources/assets/js/components/importer/importer-file.vue b/resources/assets/js/components/importer/importer-file.vue index 83970614e..86a83ace2 100644 --- a/resources/assets/js/components/importer/importer-file.vue +++ b/resources/assets/js/components/importer/importer-file.vue @@ -158,6 +158,7 @@ consumables: [ {id: 'item_no', text: "Item Number"}, {id: 'model_number', text: "Model Number"}, + {id: 'min_amt', text: "Minimum Quantity"}, ], licenses: [ {id: 'asset_tag', text: 'Assigned To Asset'}, @@ -216,6 +217,7 @@ .concat(this.columnOptions.accessories) .sort(sorter); case 'consumable': + console.log('Returned consumable'); return this.columnOptions.general .concat(this.columnOptions.consumables) .sort(sorter); @@ -309,4 +311,4 @@ select2: require('../select2.vue').default } } - \ No newline at end of file + diff --git a/resources/assets/js/snipeit.js b/resources/assets/js/snipeit.js index c74340b10..f55d16a87 100755 --- a/resources/assets/js/snipeit.js +++ b/resources/assets/js/snipeit.js @@ -84,6 +84,37 @@ var baseUrl = $('meta[name="baseUrl"]').attr('content'); var Components = {}; Components.modals = {}; + // confirm restore modal + Components.modals.confirmRestore = function() { + var $el = $('table'); + + var events = { + 'click': function(evnt) { + var $context = $(this); + var $restoreConfirmModal = $('#restoreConfirmModal'); + var href = $context.attr('href'); + var message = $context.attr('data-content'); + var title = $context.attr('data-title'); + + $('#restoreConfirmModalLabel').text(title); + $restoreConfirmModal.find('.modal-body').text(message); + $('#restoreForm').attr('action', href); + $restoreConfirmModal.modal({ + show: true + }); + return false; + } + }; + + var render = function() { + $el.on('click', '.restore-asset', events['click']); + }; + + return { + render: render + }; + }; + // confirm delete modal Components.modals.confirmDelete = function() { var $el = $('table'); @@ -121,6 +152,7 @@ var baseUrl = $('meta[name="baseUrl"]').attr('content'); * Component definition stays out of load event, execution only happens. */ $(function() { + new Components.modals.confirmRestore().render(); new Components.modals.confirmDelete().render(); }); }(jQuery, window.snipeit.settings)); diff --git a/resources/lang/en/general.php b/resources/lang/en/general.php index a4df7e6f8..e2d1c4436 100644 --- a/resources/lang/en/general.php +++ b/resources/lang/en/general.php @@ -124,6 +124,8 @@ 'image' => 'Image', 'image_delete' => 'Delete Image', 'image_upload' => 'Upload Image', + 'filetypes_accepted_help' => 'Accepted filetype is :types. Max upload size allowed is :size.|Accepted filetypes are :types. Max upload size allowed is :size.', + 'filetypes_size_help' => 'Max upload size allowed is :size.', 'image_filetypes_help' => 'Accepted filetypes are jpg, webp, png, gif, and svg. Max upload size allowed is :size.', 'import' => 'Import', 'importing' => 'Importing', diff --git a/resources/views/custom_fields/fieldsets/view.blade.php b/resources/views/custom_fields/fieldsets/view.blade.php index 82b9498fa..892b56f16 100644 --- a/resources/views/custom_fields/fieldsets/view.blade.php +++ b/resources/views/custom_fields/fieldsets/view.blade.php @@ -58,20 +58,29 @@ {{ $field->field_encrypted=='1' ? trans('general.yes') : trans('general.no') }} @if ($field->pivot->required) - - - {{ trans('admin/custom_fields/general.make_optional') }} - +
    + @csrf + +
    + @else - - - {{ trans('admin/custom_fields/general.make_required') }} - + +
    + @csrf + +
    @endif @can('update', $custom_fieldset) +<<<<<<< HEAD {{ trans('button.remove') }} +======= +
    + @csrf + +
    +>>>>>>> 476e17055beb3a2f989946812010d9f23851ca89 @endcan diff --git a/resources/views/layouts/default.blade.php b/resources/views/layouts/default.blade.php index 45ee90610..43cc8ba94 100644 --- a/resources/views/layouts/default.blade.php +++ b/resources/views/layouts/default.blade.php @@ -109,14 +109,14 @@ @if ($snipeSettings->brand == '3') @elseif ($snipeSettings->brand == '2') @@ -355,10 +355,17 @@ @endcan
  • - - - {{ trans('general.logout') }} + + + {{ trans('general.logout') }} + {{ csrf_field() }} + + + +
  • @@ -852,6 +859,28 @@ + + + {{-- Javascript files --}} @@ -925,6 +954,7 @@ @endif + @livewireScripts diff --git a/resources/views/licenses/view.blade.php b/resources/views/licenses/view.blade.php index 76df196c1..502f4fa9e 100755 --- a/resources/views/licenses/view.blade.php +++ b/resources/views/licenses/view.blade.php @@ -47,7 +47,7 @@ - {{ $license->availCount()->count() }} / {{ $license->seats }} + {{ $license->availCount()->count() }} / {{ $license->seats }} diff --git a/resources/views/settings/backups.blade.php b/resources/views/settings/backups.blade.php index 78537bb92..2018fe121 100644 --- a/resources/views/settings/backups.blade.php +++ b/resources/views/settings/backups.blade.php @@ -7,7 +7,15 @@ @stop @section('header_right') - {{ trans('general.back') }} + + {{ trans('general.back') }} + + +
    + {{ Form::hidden('_token', csrf_token()) }} + +
    + @stop {{-- Page content --}} @@ -15,10 +23,16 @@
    -
    + +
    +
    + + +
    + - - - + + + + + + @foreach ($files as $file) @@ -43,52 +60,164 @@ {{ $file['filename'] }} - + + @endforeach
    FileCreatedSize
    FileCreatedSize {{ trans('general.delete') }}
    {{ date("M d, Y g:i A", $file['modified']) }} {{ $file['modified_display'] }} {{ $file['modified_value'] }} {{ $file['filesize'] }} @can('superadmin') + class="btn delete-asset btn-danger btn-sm {{ (config('app.lock_passwords')) ? ' disabled': '' }}" data-toggle="modal" href="{{ route('settings.backups.destroy', $file['filename']) }}" data-content="{{ trans('admin/settings/message.backup.delete_confirm') }}" data-title="{{ trans('general.delete') }} {{ e($file['filename']) }} ?" onClick="return false;"> {{ trans('general.delete') }} + + + + Restore + + @endcan
    +
    +
    +
    +
    + + +
    + +
    +
    +

    + + Upload Backup

    +
    +
    +
    + +
    + +

    Backup files on the server are stored in: {{ $path }}

    + + @if (config('app.lock_passwords')===true) +

    {{ trans('general.feature_disabled') }}

    + @else + + {{ Form::open([ + 'method' => 'POST', + 'route' => 'settings.backups.upload', + 'files' => true, + 'class' => 'form-horizontal' ]) }} + @csrf + + +
    +
    + + + + + +
    +
    + +
    +
    + +

    + +

    {{ trans_choice('general.filetypes_accepted_help', 1, ['size' => Helper::file_upload_max_size_readable(), 'types' => '.zip']) }}

    + {!! $errors->first('image', '') !!} + + +
    + +
    + + {{ Form::close() }} + @endif
    -
    -
    - -
    - -
    - {{ Form::hidden('_token', csrf_token()) }} - -

    - -

    - - @if (config('app.lock_passwords')) -

    {{ trans('general.feature_disabled') }}

    - @endif - - -
    -

    Backup files are located in: {{ $path }}

    - +
    +
    +

    + Restoring from Backup

    +
    +
    +
    +
    + +

    + Use the restore button to + restore from a previous backup. (This does not currently with with S3 file storage.)

    + +

    Your entire {{ config('app.name') }} database and any uploaded files will be completely replaced by what's in the backup file. +

    + +

    + You will be logged out once your restore is complete. +

    +

    + Very large backups may time out on the restore attempt and may still need to be run via command line. +

    + +
    + +
    +
    + + @stop @section('moar_scripts') + @include ('partials.bootstrap-table') + + + @stop diff --git a/routes/web.php b/routes/web.php index c1c439638..a17c51151 100644 --- a/routes/web.php +++ b/routes/web.php @@ -189,6 +189,14 @@ Route::group(['prefix' => 'admin', 'middleware' => ['auth', 'authorize:superuser [SettingsController::class, 'postBackups'] )->name('settings.backups.create'); + Route::post('/restore/{filename}', + [SettingsController::class, 'postRestore'] + )->name('settings.backups.restore'); + + Route::post('/upload', + [SettingsController::class, 'postUploadBackup'] + )->name('settings.backups.upload'); + Route::get('/', [SettingsController::class, 'getBackups'])->name('settings.backups.index'); }); diff --git a/routes/web/fields.php b/routes/web/fields.php index 50fd46efe..312138985 100644 --- a/routes/web/fields.php +++ b/routes/web/fields.php @@ -8,51 +8,39 @@ use Illuminate\Support\Facades\Route; * Custom Fields Routes */ -Route::group(['prefix' => 'fields', 'middleware' => ['auth']], function () { - Route::get( + +Route::group([ 'prefix' => 'fields','middleware' => ['auth'] ], function () { + + Route::post( 'required/{fieldset_id}/{field_id}', - [ - CustomFieldsetsController::class, - 'makeFieldRequired' - ] + [CustomFieldsetsController::class, 'makeFieldRequired'] )->name('fields.required'); - Route::get( + Route::post( 'optional/{fieldset_id}/{field_id}', - [ - CustomFieldsetsController::class, - 'makeFieldOptional' - ] + [CustomFieldsetsController::class, 'makeFieldOptional'] )->name('fields.optional'); - Route::get( + Route::post( '{field_id}/fieldset/{fieldset_id}/disassociate', - [ - CustomFieldsetsController::class, - 'deleteFieldFromFieldset' - ] + [CustomFieldsController::class, 'deleteFieldFromFieldset'] )->name('fields.disassociate'); Route::post( 'fieldsets/{id}/associate', - [ - CustomFieldsetsController::class, - 'associate' - ] + [CustomFieldsController::class, 'associate'] )->name('fieldsets.associate'); Route::resource('fieldsets', CustomFieldsetsController::class, [ - 'parameters' => ['fieldset' => 'field_id', 'field' => 'field_id'], - ]); + 'parameters' => ['fieldset' => 'field_id', 'field' => 'field_id'] + ]); }); - Route::resource('fields', CustomFieldsController::class, [ - 'parameters' => ['field' => 'field_id'], + 'middleware' => ['auth'], + 'parameters' => ['field' => 'field_id', 'fieldset' => 'fieldset_id'], ]); - - diff --git a/routes/web/users.php b/routes/web/users.php index 48e5e4414..bc6cd32c6 100644 --- a/routes/web/users.php +++ b/routes/web/users.php @@ -1,17 +1,50 @@ 'Users\UsersController@postCreate' ]); - Route::post('{userId}/restore', [ 'as' => 'restore/user', 'uses' => 'Users\UsersController@getRestore' ]); - Route::get('{userId}/unsuspend', [ 'as' => 'unsuspend/user', 'uses' => 'Users\UsersController@getUnsuspend' ]); - Route::post('{userId}/upload', [ 'as' => 'upload/user', 'uses' => 'Users\UserFilesController@store' ]); + // User Management + Route::post( + '{userId}/clone', + [ + Users\UsersController::class, + 'postCreate' + ] + ); + + Route::post( + '{userId}/restore', + [ + Users\UsersController::class, + 'getRestore' + ] + )->name('restore/user'); + + Route::get( + '{userId}/unsuspend', + [ + Users\UsersController::class, + 'getUnsuspend' + ] + )->name('unsuspend/user'); + + Route::post( + '{userId}/upload', + [ + Users\UserFilesController::class, + 'store' + ] + )->name('upload/user'); + Route::delete( '{userId}/deletefile/{fileId}', - [ 'as' => 'userfile.destroy', 'uses' => 'Users\UserFilesController@destroy' ] - ); + [ + Users\UserFilesController::class, + 'destroy' + ] + )->name('userfile.destroy'); + Route::group(['prefix' => 'users', 'middleware' => ['auth']], function () { diff --git a/upgrade.php b/upgrade.php index e5d00aea2..09937e6c2 100644 --- a/upgrade.php +++ b/upgrade.php @@ -178,7 +178,7 @@ echo "--------------------------------------------------------\n\n"; // can cause issues with funky caching $unused_files = [ "bootstrap/cache/compiled.php", - "bootsrap/cache/services.php", + "bootstrap/cache/services.php", "bootstrap/cache/config.php", ];