diff --git a/.chipperci.yml b/.chipperci.yml index 0c1ad8ba15..0c18b253c9 100644 --- a/.chipperci.yml +++ b/.chipperci.yml @@ -20,10 +20,8 @@ on: pipeline: - name: Setup cmd: | - cp -v .env.example .env -# This is simply to allow passing the guard in TestCase@setUp() -# https://chipperci.com/docs/builds/env - touch .env.testing + cp -v .env.testing.example .env + cp -v .env.testing.example .env.testing composer install --no-interaction --prefer-dist --optimize-autoloader - name: Generate Key @@ -36,15 +34,15 @@ pipeline: - name: Run Migrations cmd: | - # php artisan migrate --force + php artisan migrate --force - name: PHPUnit Unit Tests cmd: | - # php artisan test --testsuite Unit + php artisan test --testsuite Unit - name: PHPUnit Feature Tests cmd: | - # php artisan test --testsuite Feature + php artisan test --testsuite Feature # - name: Browser Tests # cmd: | diff --git a/app/Console/Commands/LdapSync.php b/app/Console/Commands/LdapSync.php index 136a81f62e..c72de8cb72 100755 --- a/app/Console/Commands/LdapSync.php +++ b/app/Console/Commands/LdapSync.php @@ -262,6 +262,10 @@ class LdapSync extends Command if($ldap_result_dept != null){ $user->department_id = $department->id; } + if($ldap_result_location != null){ + $user->location_id = $location ? $location->id : null; + } + if($ldap_result_manager != null){ if($item['manager'] != null) { // Check Cache first diff --git a/app/Http/Controllers/Accessories/AccessoriesController.php b/app/Http/Controllers/Accessories/AccessoriesController.php index 111cbb3c8b..8221868f73 100755 --- a/app/Http/Controllers/Accessories/AccessoriesController.php +++ b/app/Http/Controllers/Accessories/AccessoriesController.php @@ -131,7 +131,8 @@ class AccessoriesController extends Controller // Check if the asset exists if (is_null($accessory_to_clone = Accessory::find($accessoryId))) { // Redirect to the asset management page - return redirect()->route('accessory.index')->with('error', trans('admin/accessories/message.does_not_exist')); + return redirect()->route('accessories.index') + ->with('error', trans('admin/accessories/message.does_not_exist', ['id' => $accessoryId])); } $accessory = clone $accessory_to_clone; diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index 0f078326c9..c9a88ea0f1 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -590,7 +590,7 @@ class ReportsController extends Controller $executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']; \Log::debug('Added headers: '.$executionTime); - $assets = \App\Models\Company::scopeCompanyables(Asset::select('assets.*'))->with( + $assets = Asset::select('assets.*')->with( 'location', 'assetstatus', 'company', 'defaultLoc', 'assignedTo', 'model.category', 'model.manufacturer', 'supplier'); diff --git a/app/Http/Livewire/CategoryEditForm.php b/app/Http/Livewire/CategoryEditForm.php new file mode 100644 index 0000000000..05a1fe9d45 --- /dev/null +++ b/app/Http/Livewire/CategoryEditForm.php @@ -0,0 +1,67 @@ +originalSendCheckInEmailValue = $this->sendCheckInEmail; + + if ($this->eulaText || $this->useDefaultEula) { + $this->sendCheckInEmail = 1; + } + } + + public function render() + { + return view('livewire.category-edit-form'); + } + + public function updated($property, $value) + { + if (! in_array($property, ['eulaText', 'useDefaultEula'])) { + return; + } + + $this->sendCheckInEmail = $this->eulaText || $this->useDefaultEula ? 1 : $this->originalSendCheckInEmailValue; + } + + public function getShouldDisplayEmailMessageProperty(): bool + { + return $this->eulaText || $this->useDefaultEula; + } + + public function getEmailMessageProperty(): string + { + if ($this->useDefaultEula) { + return trans('admin/categories/general.email_will_be_sent_due_to_global_eula'); + } + + return trans('admin/categories/general.email_will_be_sent_due_to_category_eula'); + } + + public function getEulaTextDisabledProperty() + { + return (bool)$this->useDefaultEula; + } + + public function getSendCheckInEmailDisabledProperty() + { + return $this->eulaText || $this->useDefaultEula; + } +} diff --git a/app/Http/Livewire/Importer.php b/app/Http/Livewire/Importer.php index 2e1137bcd2..7899182a60 100644 --- a/app/Http/Livewire/Importer.php +++ b/app/Http/Livewire/Importer.php @@ -215,6 +215,7 @@ class Importer extends Component 'manufacturer' => trans('general.manufacturer'), 'order_number' => trans('general.order_number'), 'image' => trans('general.importer.image_filename'), + 'asset_eol_date' => trans('admin/hardware/form.eol_date'), /** * Checkout fields: * Assets can be checked out to other assets, people, or locations, but we currently diff --git a/config/services.php b/config/services.php index de8c4ed71a..21acb6778a 100644 --- a/config/services.php +++ b/config/services.php @@ -25,6 +25,7 @@ return [ 'mailgun' => [ 'domain' => env('MAILGUN_DOMAIN'), 'secret' => env('MAILGUN_SECRET'), + 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), ], 'mandrill' => [ diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 2445a351f3..db13224616 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -432,4 +432,13 @@ class UserFactory extends Factory ]; }); } + + public function canViewReports() + { + return $this->state(function () { + return [ + 'permissions' => '{"reports.view":"1"}', + ]; + }); + } } diff --git a/database/migrations/2023_08_01_174150_change_webhook_settings_variable_type.php b/database/migrations/2023_08_01_174150_change_webhook_settings_variable_type.php new file mode 100644 index 0000000000..59c9728e2e --- /dev/null +++ b/database/migrations/2023_08_01_174150_change_webhook_settings_variable_type.php @@ -0,0 +1,33 @@ +text('webhook_endpoint')->change(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('settings', function (Blueprint $table) { + $table->varchar('webhook_endpoint')->change(); + }); + + } +} diff --git a/package-lock.json b/package-lock.json index 2c334fd025..649581f940 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1565,9 +1565,9 @@ } }, "@types/eslint": { - "version": "8.44.0", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.0.tgz", - "integrity": "sha512-gsF+c/0XOguWgaOgvFs+xnnRqt9GwgTvIks36WpE6ueeI4KCEHHd8K/CKHqhOqrJKsYH8m27kRzQEvWXAwXUTw==", + "version": "8.44.2", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.2.tgz", + "integrity": "sha512-sdPRb9K6iL5XZOmBubg8yiFp5yS/JdUDQsq5e6h95km91MCYMuvp7mh1fjPEYUhvHepKpZOjnEaMBR4PxjWDzg==", "requires": { "@types/estree": "*", "@types/json-schema": "*" @@ -15962,9 +15962,9 @@ } }, "jspdf-autotable": { - "version": "3.5.25", - "resolved": "https://registry.npmjs.org/jspdf-autotable/-/jspdf-autotable-3.5.25.tgz", - "integrity": "sha512-BIbDd/cilRbVm5PmR+ZonolSqRtm0AvZDpTz+rrWed7BnFj5mqF7x7lkxDAMzPudLapktHUk6cxipcvUzal8cg==" + "version": "3.5.31", + "resolved": "https://registry.npmjs.org/jspdf-autotable/-/jspdf-autotable-3.5.31.tgz", + "integrity": "sha512-Lc1KuLGDQWW/5t57Z/+c2E94XQV3jV2QVU3xMRiwvcm/nMx79aCkpPCsxLzJZVFneZvz4XoA8+egQR1QajYiWw==" }, "junk": { "version": "3.1.0", @@ -19705,9 +19705,9 @@ } }, "webpack": { - "version": "5.88.1", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.88.1.tgz", - "integrity": "sha512-FROX3TxQnC/ox4N+3xQoWZzvGXSuscxR32rbzjpXgEzWudJFEJBpdlkkob2ylrv5yzzufD1zph1OoFsLtm6stQ==", + "version": "5.88.2", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.88.2.tgz", + "integrity": "sha512-JmcgNZ1iKj+aiR0OvTYtWQqJwq37Pf683dY9bVORwVbUrDhLhdn/PlO2sHsFHPkj7sHNQF3JwaAkp49V+Sq1tQ==", "requires": { "@types/eslint-scope": "^3.7.3", "@types/estree": "^1.0.0", @@ -19736,22 +19736,22 @@ }, "dependencies": { "@jridgewell/resolve-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==" + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==" }, "@jridgewell/sourcemap-codec": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" }, "@jridgewell/trace-mapping": { - "version": "0.3.18", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", - "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", + "version": "0.3.19", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz", + "integrity": "sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==", "requires": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, "@types/json-schema": { @@ -19788,9 +19788,9 @@ } }, "terser": { - "version": "5.18.2", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.18.2.tgz", - "integrity": "sha512-Ah19JS86ypbJzTzvUCX7KOsEIhDaRONungA4aYBjEP3JZRf4ocuDzTg4QWZnPn9DEMiMYGJPiSOy7aykoCc70w==", + "version": "5.19.2", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.19.2.tgz", + "integrity": "sha512-qC5+dmecKJA4cpYxRa5aVkKehYsQKc+AHeKl0Oe62aYjBL8ZA33tTljktDHJSaxxMnbI5ZYw+o/S2DxxLu8OfA==", "requires": { "@jridgewell/source-map": "^0.3.3", "acorn": "^8.8.2", diff --git a/package.json b/package.json index 0752f284e7..67b5988541 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "jquery-ui": "^1.13.2", "jquery-ui-bundle": "^1.12.1", "jquery.iframe-transport": "^1.0.0", - "jspdf-autotable": "^3.5.24", + "jspdf-autotable": "^3.5.30", "less": "^4.1.2", "less-loader": "^5.0", "list.js": "^1.5.0", @@ -54,6 +54,6 @@ "tableexport.jquery.plugin": "1.28.0", "tether": "^1.4.0", "vue-resource": "^1.5.2", - "webpack": "^5.87.0" + "webpack": "^5.88.2" } } diff --git a/public/css/dist/all.css b/public/css/dist/all.css index 3313bdac45..6a556a42bf 100644 --- a/public/css/dist/all.css +++ b/public/css/dist/all.css @@ -22385,7 +22385,7 @@ a.ui-button:active, /*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImVra28tbGlnaHRib3guY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGVBQ0UsOEJBQXlCLEFBQXpCLHVCQUF5QixBQUN6QixzQkFBb0IsQUFBcEIsbUJBQW9CLEFBQ3BCLHFCQUF3QixBQUF4Qix1QkFBd0IsQUFDeEIseUJBQTZCLENBQzlCLEFBQ0QseUJBQ0UsaUJBQW1CLENBQ3BCLEFBQ0QsZ0RBQ0Usa0JBQW1CLEFBQ25CLE1BQU8sQUFDUCxPQUFRLEFBQ1IsU0FBVSxBQUNWLFFBQVMsQUFDVCxVQUFZLENBQ2IsQUFDRCxzQkFDRSxXQUFZLEFBQ1osV0FBYSxDQUNkLEFBQ0QsMkJBQ0UsVUFBYSxBQUNiLGtCQUFtQixBQUNuQixNQUFPLEFBQ1AsT0FBUSxBQUNSLFdBQVksQUFDWixZQUFhLEFBQ2Isb0JBQWMsQUFBZCxZQUFjLENBQ2YsQUFDRCw2QkFDRSxXQUFRLEFBQVIsT0FBUSxBQUNSLG9CQUFjLEFBQWQsYUFBYyxBQUNkLHNCQUFvQixBQUFwQixtQkFBb0IsQUFDcEIsVUFBVyxBQUNYLHVCQUF5QixBQUN6QixXQUFZLEFBQ1osZUFBZ0IsQUFDaEIsU0FBYSxDQUNkLEFBQ0QsK0JBQ0Usb0JBQWEsQUFBYixXQUFhLENBQ2QsQUFDRCxvQ0FDRSxZQUFjLENBQ2YsQUFDRCxrQ0FDRSxjQUFnQixDQUNqQixBQUNELDZDQUNFLGdCQUFrQixDQUNuQixBQUNELG1DQUNFLG9CQUFzQixDQUN2QixBQUNELG1DQUNFLFlBQWMsQ0FDZixBQUNELHNDQUNFLGVBQWdCLEFBQ2hCLGlCQUFtQixDQUNwQixBQUNELHVCQUNFLFVBQVcsQUFDWCxvQkFBc0IsQ0FDdkIsQUFDRCw2QkFDRSxZQUFjLENBQ2YsQUFDRCw2QkFDRSxlQUFpQixDQUNsQixBQUNELHNCQUNFLGtCQUFtQixBQUNuQixNQUFPLEFBQ1AsT0FBUSxBQUNSLFNBQVUsQUFDVixRQUFTLEFBQ1QsV0FBWSxBQUNaLG9CQUFjLEFBQWQsYUFBYyxBQUVkLDBCQUF1QixBQUF2QixzQkFBdUIsQUFFdkIscUJBQXdCLEFBQXhCLHVCQUF3QixBQUV4QixzQkFBb0IsQUFBcEIsa0JBQW9CLENBQ3JCLEFBQ0QsMEJBQ0UsV0FBWSxBQUNaLFlBQWEsQUFDYixrQkFBbUIsQUFDbkIsaUJBQW1CLENBQ3BCLEFBQ0QsOEJBQ0UsV0FBWSxBQUNaLFlBQWEsQUFDYixrQkFBbUIsQUFDbkIsc0JBQXVCLEFBQ3ZCLFdBQWEsQUFDYixrQkFBbUIsQUFDbkIsTUFBTyxBQUNQLE9BQVEsQUFDUixtQ0FBNkMsQ0FDOUMsQUFDRCx5Q0FDRSxtQkFBcUIsQ0FDdEIsQUFDRCw0Q0FDRSxxQkFBdUIsQ0FDeEIsQUFVRCxhQUNFLE1BRUUsbUJBQW9CLEFBQ3BCLDBCQUE0QixDQUM3QixBQUNELElBQ0UsbUJBQW9CLEFBQ3BCLDBCQUE0QixDQUM3QixDQUNGIiwiZmlsZSI6ImVra28tbGlnaHRib3guY3NzIiwic291cmNlc0NvbnRlbnQiOlsiLmVra28tbGlnaHRib3gge1xuICBkaXNwbGF5OiBmbGV4ICFpbXBvcnRhbnQ7XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gIGp1c3RpZnktY29udGVudDogY2VudGVyO1xuICBwYWRkaW5nLXJpZ2h0OiAwcHghaW1wb3J0YW50O1xufVxuLmVra28tbGlnaHRib3gtY29udGFpbmVyIHtcbiAgcG9zaXRpb246IHJlbGF0aXZlO1xufVxuLmVra28tbGlnaHRib3gtY29udGFpbmVyID4gZGl2LmVra28tbGlnaHRib3gtaXRlbSB7XG4gIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgdG9wOiAwO1xuICBsZWZ0OiAwO1xuICBib3R0b206IDA7XG4gIHJpZ2h0OiAwO1xuICB3aWR0aDogMTAwJTtcbn1cbi5la2tvLWxpZ2h0Ym94IGlmcmFtZSB7XG4gIHdpZHRoOiAxMDAlO1xuICBoZWlnaHQ6IDEwMCU7XG59XG4uZWtrby1saWdodGJveC1uYXYtb3ZlcmxheSB7XG4gIHotaW5kZXg6IDEwMDtcbiAgcG9zaXRpb246IGFic29sdXRlO1xuICB0b3A6IDA7XG4gIGxlZnQ6IDA7XG4gIHdpZHRoOiAxMDAlO1xuICBoZWlnaHQ6IDEwMCU7XG4gIGRpc3BsYXk6IGZsZXg7XG59XG4uZWtrby1saWdodGJveC1uYXYtb3ZlcmxheSBhIHtcbiAgZmxleDogMTtcbiAgZGlzcGxheTogZmxleDtcbiAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbiAgb3BhY2l0eTogMDtcbiAgdHJhbnNpdGlvbjogb3BhY2l0eSAwLjVzO1xuICBjb2xvcjogI2ZmZjtcbiAgZm9udC1zaXplOiAzMHB4O1xuICB6LWluZGV4OiAxMDA7XG59XG4uZWtrby1saWdodGJveC1uYXYtb3ZlcmxheSBhID4gKiB7XG4gIGZsZXgtZ3JvdzogMTtcbn1cbi5la2tvLWxpZ2h0Ym94LW5hdi1vdmVybGF5IGEgPiAqOmZvY3VzIHtcbiAgb3V0bGluZTogbm9uZTtcbn1cbi5la2tvLWxpZ2h0Ym94LW5hdi1vdmVybGF5IGEgc3BhbiB7XG4gIHBhZGRpbmc6IDAgMzBweDtcbn1cbi5la2tvLWxpZ2h0Ym94LW5hdi1vdmVybGF5IGE6bGFzdC1jaGlsZCBzcGFuIHtcbiAgdGV4dC1hbGlnbjogcmlnaHQ7XG59XG4uZWtrby1saWdodGJveC1uYXYtb3ZlcmxheSBhOmhvdmVyIHtcbiAgdGV4dC1kZWNvcmF0aW9uOiBub25lO1xufVxuLmVra28tbGlnaHRib3gtbmF2LW92ZXJsYXkgYTpmb2N1cyB7XG4gIG91dGxpbmU6IG5vbmU7XG59XG4uZWtrby1saWdodGJveC1uYXYtb3ZlcmxheSBhLmRpc2FibGVkIHtcbiAgY3Vyc29yOiBkZWZhdWx0O1xuICB2aXNpYmlsaXR5OiBoaWRkZW47XG59XG4uZWtrby1saWdodGJveCBhOmhvdmVyIHtcbiAgb3BhY2l0eTogMTtcbiAgdGV4dC1kZWNvcmF0aW9uOiBub25lO1xufVxuLmVra28tbGlnaHRib3ggLm1vZGFsLWRpYWxvZyB7XG4gIGRpc3BsYXk6IG5vbmU7XG59XG4uZWtrby1saWdodGJveCAubW9kYWwtZm9vdGVyIHtcbiAgdGV4dC1hbGlnbjogbGVmdDtcbn1cbi5la2tvLWxpZ2h0Ym94LWxvYWRlciB7XG4gIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgdG9wOiAwO1xuICBsZWZ0OiAwO1xuICBib3R0b206IDA7XG4gIHJpZ2h0OiAwO1xuICB3aWR0aDogMTAwJTtcbiAgZGlzcGxheTogZmxleDtcbiAgLyogZXN0YWJsaXNoIGZsZXggY29udGFpbmVyICovXG4gIGZsZXgtZGlyZWN0aW9uOiBjb2x1bW47XG4gIC8qIG1ha2UgbWFpbiBheGlzIHZlcnRpY2FsICovXG4gIGp1c3RpZnktY29udGVudDogY2VudGVyO1xuICAvKiBjZW50ZXIgaXRlbXMgdmVydGljYWxseSwgaW4gdGhpcyBjYXNlICovXG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG59XG4uZWtrby1saWdodGJveC1sb2FkZXIgPiBkaXYge1xuICB3aWR0aDogNDBweDtcbiAgaGVpZ2h0OiA0MHB4O1xuICBwb3NpdGlvbjogcmVsYXRpdmU7XG4gIHRleHQtYWxpZ246IGNlbnRlcjtcbn1cbi5la2tvLWxpZ2h0Ym94LWxvYWRlciA+IGRpdiA+IGRpdiB7XG4gIHdpZHRoOiAxMDAlO1xuICBoZWlnaHQ6IDEwMCU7XG4gIGJvcmRlci1yYWRpdXM6IDUwJTtcbiAgYmFja2dyb3VuZC1jb2xvcjogI2ZmZjtcbiAgb3BhY2l0eTogMC42O1xuICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gIHRvcDogMDtcbiAgbGVmdDogMDtcbiAgYW5pbWF0aW9uOiBzay1ib3VuY2UgMnMgaW5maW5pdGUgZWFzZS1pbi1vdXQ7XG59XG4uZWtrby1saWdodGJveC1sb2FkZXIgPiBkaXYgPiBkaXY6bGFzdC1jaGlsZCB7XG4gIGFuaW1hdGlvbi1kZWxheTogLTFzO1xufVxuLm1vZGFsLWRpYWxvZyAuZWtrby1saWdodGJveC1sb2FkZXIgPiBkaXYgPiBkaXYge1xuICBiYWNrZ3JvdW5kLWNvbG9yOiAjMzMzO1xufVxuQC13ZWJraXQta2V5ZnJhbWVzIHNrLWJvdW5jZSB7XG4gIDAlLFxuICAxMDAlIHtcbiAgICAtd2Via2l0LXRyYW5zZm9ybTogc2NhbGUoMCk7XG4gIH1cbiAgNTAlIHtcbiAgICAtd2Via2l0LXRyYW5zZm9ybTogc2NhbGUoMSk7XG4gIH1cbn1cbkBrZXlmcmFtZXMgc2stYm91bmNlIHtcbiAgMCUsXG4gIDEwMCUge1xuICAgIHRyYW5zZm9ybTogc2NhbGUoMCk7XG4gICAgLXdlYmtpdC10cmFuc2Zvcm06IHNjYWxlKDApO1xuICB9XG4gIDUwJSB7XG4gICAgdHJhbnNmb3JtOiBzY2FsZSgxKTtcbiAgICAtd2Via2l0LXRyYW5zZm9ybTogc2NhbGUoMSk7XG4gIH1cbn1cbiJdfQ== */ /** * @author zhixin wen - * version: 1.22.0 + * version: 1.22.1 * https://github.com/wenzhixin/bootstrap-table/ */ /* stylelint-disable annotation-no-unknown, max-line-length */ diff --git a/public/css/dist/bootstrap-table.css b/public/css/dist/bootstrap-table.css index c8749ad4b4..301c592a5d 100644 --- a/public/css/dist/bootstrap-table.css +++ b/public/css/dist/bootstrap-table.css @@ -1,6 +1,6 @@ /** * @author zhixin wen - * version: 1.22.0 + * version: 1.22.1 * https://github.com/wenzhixin/bootstrap-table/ */ /* stylelint-disable annotation-no-unknown, max-line-length */ diff --git a/public/js/dist/bootstrap-table.js b/public/js/dist/bootstrap-table.js index 53d6e2d52d..c01fba3e19 100644 --- a/public/js/dist/bootstrap-table.js +++ b/public/js/dist/bootstrap-table.js @@ -2,7 +2,7 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) : typeof define === 'function' && define.amd ? define(['jquery'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.BootstrapTable = factory(global.jQuery)); -})(this, (function ($$o) { 'use strict'; +})(this, (function ($$p) { 'use strict'; function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; @@ -181,7 +181,7 @@ var objectGetOwnPropertyDescriptor = {}; - var fails$u = function (exec) { + var fails$v = function (exec) { try { return !!exec(); } catch (error) { @@ -189,17 +189,17 @@ } }; - var fails$t = fails$u; + var fails$u = fails$v; // Detect IE8's incomplete defineProperty implementation - var descriptors = !fails$t(function () { + var descriptors = !fails$u(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; }); - var fails$s = fails$u; + var fails$t = fails$v; - var functionBindNative = !fails$s(function () { + var functionBindNative = !fails$t(function () { // eslint-disable-next-line es/no-function-prototype-bind -- safe var test = (function () { /* empty */ }).bind(); // eslint-disable-next-line no-prototype-builtins -- safe @@ -261,14 +261,14 @@ }; var uncurryThis$y = functionUncurryThis; - var fails$r = fails$u; + var fails$s = fails$v; var classof$7 = classofRaw$2; var $Object$4 = Object; var split = uncurryThis$y(''.split); // fallback for non-array-like ES3 and non-enumerable old V8 strings - var indexedObject = fails$r(function () { + var indexedObject = fails$s(function () { // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 // eslint-disable-next-line no-prototype-builtins -- safe return !$Object$4('z').propertyIsEnumerable(0); @@ -383,10 +383,10 @@ /* eslint-disable es/no-symbol -- required for testing */ var V8_VERSION$2 = engineV8Version; - var fails$q = fails$u; + var fails$r = fails$v; // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing - var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$q(function () { + var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$r(function () { var symbol = Symbol(); // Chrome 38 Symbol has incorrect toString conversion // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances @@ -511,12 +511,12 @@ // `ToObject` abstract operation // https://tc39.es/ecma262/#sec-toobject - var toObject$9 = function (argument) { + var toObject$a = function (argument) { return $Object$2(requireObjectCoercible$9(argument)); }; var uncurryThis$w = functionUncurryThis; - var toObject$8 = toObject$9; + var toObject$9 = toObject$a; var hasOwnProperty = uncurryThis$w({}.hasOwnProperty); @@ -524,7 +524,7 @@ // https://tc39.es/ecma262/#sec-hasownproperty // eslint-disable-next-line es/no-object-hasown -- safe var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) { - return hasOwnProperty(toObject$8(it), key); + return hasOwnProperty(toObject$9(it), key); }; var uncurryThis$v = functionUncurryThis; @@ -604,11 +604,11 @@ }; var DESCRIPTORS$e = descriptors; - var fails$p = fails$u; + var fails$q = fails$v; var createElement = documentCreateElement$2; // Thanks to IE8 for its funny defineProperty - var ie8DomDefine = !DESCRIPTORS$e && !fails$p(function () { + var ie8DomDefine = !DESCRIPTORS$e && !fails$q(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty(createElement('div'), 'a', { get: function () { return 7; } @@ -641,11 +641,11 @@ var objectDefineProperty = {}; var DESCRIPTORS$c = descriptors; - var fails$o = fails$u; + var fails$p = fails$v; // V8 ~ Chrome 36- // https://bugs.chromium.org/p/v8/issues/detail?id=3334 - var v8PrototypeDefineBug = DESCRIPTORS$c && fails$o(function () { + var v8PrototypeDefineBug = DESCRIPTORS$c && fails$p(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty(function () { /* empty */ }, 'prototype', { value: 42, @@ -848,7 +848,7 @@ }; var uncurryThis$t = functionUncurryThis; - var fails$n = fails$u; + var fails$o = fails$v; var isCallable$b = isCallable$j; var hasOwn$7 = hasOwnProperty_1; var DESCRIPTORS$8 = descriptors; @@ -865,7 +865,7 @@ var replace$4 = uncurryThis$t(''.replace); var join = uncurryThis$t([].join); - var CONFIGURABLE_LENGTH = DESCRIPTORS$8 && !fails$n(function () { + var CONFIGURABLE_LENGTH = DESCRIPTORS$8 && !fails$o(function () { return defineProperty$7(function () { /* empty */ }, 'length', { value: 8 }).length !== 8; }); @@ -1098,7 +1098,7 @@ } }; - var fails$m = fails$u; + var fails$n = fails$v; var isCallable$9 = isCallable$j; var replacement = /#|\.prototype\./; @@ -1107,7 +1107,7 @@ var value = data[normalize(feature)]; return value == POLYFILL ? true : value == NATIVE ? false - : isCallable$9(detection) ? fails$m(detection) + : isCallable$9(detection) ? fails$n(detection) : !!detection; }; @@ -1189,11 +1189,11 @@ var DESCRIPTORS$7 = descriptors; var uncurryThis$q = functionUncurryThis; var call$9 = functionCall; - var fails$l = fails$u; + var fails$m = fails$v; var objectKeys$2 = objectKeys$3; var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols; var propertyIsEnumerableModule = objectPropertyIsEnumerable; - var toObject$7 = toObject$9; + var toObject$8 = toObject$a; var IndexedObject$2 = indexedObject; // eslint-disable-next-line es/no-object-assign -- safe @@ -1204,7 +1204,7 @@ // `Object.assign` method // https://tc39.es/ecma262/#sec-object.assign - var objectAssign = !$assign || fails$l(function () { + var objectAssign = !$assign || fails$m(function () { // should have correct order of operations (Edge bug) if (DESCRIPTORS$7 && $assign({ b: 1 }, $assign(defineProperty$6({}, 'a', { enumerable: true, @@ -1225,7 +1225,7 @@ alphabet.split('').forEach(function (chr) { B[chr] = chr; }); return $assign({}, A)[symbol] != 7 || objectKeys$2($assign({}, B)).join('') != alphabet; }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length` - var T = toObject$7(target); + var T = toObject$8(target); var argumentsLength = arguments.length; var index = 1; var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; @@ -1243,13 +1243,13 @@ } return T; } : $assign; - var $$n = _export; + var $$o = _export; var assign = objectAssign; // `Object.assign` method // https://tc39.es/ecma262/#sec-object.assign // eslint-disable-next-line es/no-object-assign -- required for testing - $$n({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, { + $$o({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, { assign: assign }); @@ -1337,7 +1337,7 @@ }; var PROPER_FUNCTION_NAME$2 = functionName.PROPER; - var fails$k = fails$u; + var fails$l = fails$v; var whitespaces$2 = whitespaces$4; var non = '\u200B\u0085\u180E'; @@ -1345,36 +1345,36 @@ // check that a method works with the correct list // of whitespaces and has a correct name var stringTrimForced = function (METHOD_NAME) { - return fails$k(function () { + return fails$l(function () { return !!whitespaces$2[METHOD_NAME]() || non[METHOD_NAME]() !== non || (PROPER_FUNCTION_NAME$2 && whitespaces$2[METHOD_NAME].name !== METHOD_NAME); }); }; - var $$m = _export; + var $$n = _export; var $trim = stringTrim.trim; var forcedStringTrimMethod = stringTrimForced; // `String.prototype.trim` method // https://tc39.es/ecma262/#sec-string.prototype.trim - $$m({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, { + $$n({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, { trim: function trim() { return $trim(this); } }); - var fails$j = fails$u; + var fails$k = fails$v; var arrayMethodIsStrict$4 = function (METHOD_NAME, argument) { var method = [][METHOD_NAME]; - return !!method && fails$j(function () { + return !!method && fails$k(function () { // eslint-disable-next-line no-useless-call -- required for testing method.call(null, argument || function () { return 1; }, 1); }); }; - var $$l = _export; + var $$m = _export; var uncurryThis$o = functionUncurryThis; var IndexedObject$1 = indexedObject; var toIndexedObject$4 = toIndexedObject$8; @@ -1387,7 +1387,7 @@ // `Array.prototype.join` method // https://tc39.es/ecma262/#sec-array.prototype.join - $$l({ target: 'Array', proto: true, forced: FORCED$6 }, { + $$m({ target: 'Array', proto: true, forced: FORCED$6 }, { join: function join(separator) { return nativeJoin(toIndexedObject$4(this), separator === undefined ? ',' : separator); } @@ -1411,13 +1411,13 @@ return result; }; - var fails$i = fails$u; + var fails$j = fails$v; var global$a = global$k; // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError var $RegExp$2 = global$a.RegExp; - var UNSUPPORTED_Y$3 = fails$i(function () { + var UNSUPPORTED_Y$3 = fails$j(function () { var re = $RegExp$2('a', 'y'); re.lastIndex = 2; return re.exec('abcd') != null; @@ -1425,11 +1425,11 @@ // UC Browser bug // https://github.com/zloirock/core-js/issues/1008 - var MISSED_STICKY$1 = UNSUPPORTED_Y$3 || fails$i(function () { + var MISSED_STICKY$1 = UNSUPPORTED_Y$3 || fails$j(function () { return !$RegExp$2('a', 'y').sticky; }); - var BROKEN_CARET = UNSUPPORTED_Y$3 || fails$i(function () { + var BROKEN_CARET = UNSUPPORTED_Y$3 || fails$j(function () { // https://bugzilla.mozilla.org/show_bug.cgi?id=773687 var re = $RegExp$2('^r', 'gy'); re.lastIndex = 2; @@ -1554,24 +1554,24 @@ return Properties === undefined ? result : definePropertiesModule.f(result, Properties); }; - var fails$h = fails$u; + var fails$i = fails$v; var global$9 = global$k; // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError var $RegExp$1 = global$9.RegExp; - var regexpUnsupportedDotAll = fails$h(function () { + var regexpUnsupportedDotAll = fails$i(function () { var re = $RegExp$1('.', 's'); return !(re.dotAll && re.exec('\n') && re.flags === 's'); }); - var fails$g = fails$u; + var fails$h = fails$v; var global$8 = global$k; // babel-minify and Closure Compiler transpiles RegExp('(?b)', 'g') -> /(?b)/g and it causes SyntaxError var $RegExp = global$8.RegExp; - var regexpUnsupportedNcg = fails$g(function () { + var regexpUnsupportedNcg = fails$h(function () { var re = $RegExp('(?b)', 'g'); return re.exec('b').groups.a !== 'b' || 'b'.replace(re, '$c') !== 'bc'; @@ -1694,12 +1694,12 @@ var regexpExec$3 = patchedExec; - var $$k = _export; + var $$l = _export; var exec$4 = regexpExec$3; // `RegExp.prototype.exec` method // https://tc39.es/ecma262/#sec-regexp.prototype.exec - $$k({ target: 'RegExp', proto: true, forced: /./.exec !== exec$4 }, { + $$l({ target: 'RegExp', proto: true, forced: /./.exec !== exec$4 }, { exec: exec$4 }); @@ -1729,7 +1729,7 @@ var uncurryThis$l = functionUncurryThisClause; var defineBuiltIn$5 = defineBuiltIn$7; var regexpExec$2 = regexpExec$3; - var fails$f = fails$u; + var fails$g = fails$v; var wellKnownSymbol$f = wellKnownSymbol$j; var createNonEnumerableProperty$4 = createNonEnumerableProperty$7; @@ -1739,14 +1739,14 @@ var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) { var SYMBOL = wellKnownSymbol$f(KEY); - var DELEGATES_TO_SYMBOL = !fails$f(function () { + var DELEGATES_TO_SYMBOL = !fails$g(function () { // String methods call symbol-named RegEp methods var O = {}; O[SYMBOL] = function () { return 7; }; return ''[KEY](O) != 7; }); - var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails$f(function () { + var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails$g(function () { // Symbol-named RegExp methods call .exec var execCalled = false; var re = /a/; @@ -1812,7 +1812,7 @@ }; var uncurryThis$k = functionUncurryThis; - var fails$e = fails$u; + var fails$f = fails$v; var isCallable$7 = isCallable$j; var classof$3 = classof$6; var getBuiltIn$1 = getBuiltIn$5; @@ -1856,7 +1856,7 @@ // `IsConstructor` abstract operation // https://tc39.es/ecma262/#sec-isconstructor - var isConstructor$3 = !construct || fails$e(function () { + var isConstructor$3 = !construct || fails$f(function () { var called; return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) @@ -2000,7 +2000,7 @@ var callRegExpExec = regexpExecAbstract; var regexpExec = regexpExec$3; var stickyHelpers$1 = regexpStickyHelpers; - var fails$d = fails$u; + var fails$e = fails$v; var UNSUPPORTED_Y$1 = stickyHelpers$1.UNSUPPORTED_Y; var MAX_UINT32 = 0xFFFFFFFF; @@ -2012,7 +2012,7 @@ // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec // Weex JS has frozen built-in prototypes, so use try / catch wrapper - var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails$d(function () { + var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails$e(function () { // eslint-disable-next-line regexp/no-empty-group -- required for testing var re = /(?:)/; var originalExec = re.exec; @@ -2177,12 +2177,12 @@ values: createMethod$1(false) }; - var $$j = _export; + var $$k = _export; var $entries = objectToArray.entries; // `Object.entries` method // https://tc39.es/ecma262/#sec-object.entries - $$j({ target: 'Object', stat: true }, { + $$k({ target: 'Object', stat: true }, { entries: function entries(O) { return $entries(O); } @@ -2209,20 +2209,20 @@ ArrayPrototype[UNSCOPABLES][key] = true; }; - var $$i = _export; + var $$j = _export; var $includes = arrayIncludes.includes; - var fails$c = fails$u; + var fails$d = fails$v; var addToUnscopables$3 = addToUnscopables$4; // FF99+ bug - var BROKEN_ON_SPARSE = fails$c(function () { + var BROKEN_ON_SPARSE = fails$d(function () { // eslint-disable-next-line es/no-array-prototype-includes -- detection return !Array(1).includes(); }); // `Array.prototype.includes` method // https://tc39.es/ecma262/#sec-array.prototype.includes - $$i({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, { + $$j({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, { includes: function includes(el /* , fromIndex = 0 */) { return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); } @@ -2279,7 +2279,7 @@ return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length); }; - var fails$b = fails$u; + var fails$c = fails$v; var wellKnownSymbol$a = wellKnownSymbol$j; var V8_VERSION$1 = engineV8Version; @@ -2289,7 +2289,7 @@ // We can't use this feature detection in V8 since it causes // deoptimization and serious performance degradation // https://github.com/zloirock/core-js/issues/677 - return V8_VERSION$1 >= 51 || !fails$b(function () { + return V8_VERSION$1 >= 51 || !fails$c(function () { var array = []; var constructor = array.constructor = {}; constructor[SPECIES$2] = function () { @@ -2299,11 +2299,11 @@ }); }; - var $$h = _export; - var fails$a = fails$u; + var $$i = _export; + var fails$b = fails$v; var isArray$3 = isArray$5; var isObject$3 = isObject$b; - var toObject$6 = toObject$9; + var toObject$7 = toObject$a; var lengthOfArrayLike$4 = lengthOfArrayLike$7; var doesNotExceedSafeInteger$1 = doesNotExceedSafeInteger$2; var createProperty$2 = createProperty$4; @@ -2317,7 +2317,7 @@ // We can't use this feature detection in V8 since it causes // deoptimization and serious performance degradation // https://github.com/zloirock/core-js/issues/679 - var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails$a(function () { + var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails$b(function () { var array = []; array[IS_CONCAT_SPREADABLE] = false; return array.concat()[0] !== array; @@ -2334,10 +2334,10 @@ // `Array.prototype.concat` method // https://tc39.es/ecma262/#sec-array.prototype.concat // with adding support of @@isConcatSpreadable and @@species - $$h({ target: 'Array', proto: true, arity: 1, forced: FORCED$5 }, { + $$i({ target: 'Array', proto: true, arity: 1, forced: FORCED$5 }, { // eslint-disable-next-line no-unused-vars -- required for `.length` concat: function concat(arg) { - var O = toObject$6(this); + var O = toObject$7(this); var A = arraySpeciesCreate$2(O, 0); var n = 0; var i, k, length, len, E; @@ -2374,7 +2374,7 @@ var bind = functionBindContext; var uncurryThis$f = functionUncurryThis; var IndexedObject = indexedObject; - var toObject$5 = toObject$9; + var toObject$6 = toObject$a; var lengthOfArrayLike$3 = lengthOfArrayLike$7; var arraySpeciesCreate$1 = arraySpeciesCreate$3; @@ -2390,7 +2390,7 @@ var IS_FILTER_REJECT = TYPE == 7; var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; return function ($this, callbackfn, that, specificCreate) { - var O = toObject$5($this); + var O = toObject$6($this); var self = IndexedObject(O); var boundFunction = bind(callbackfn, that); var length = lengthOfArrayLike$3(self); @@ -2445,7 +2445,7 @@ filterReject: createMethod(7) }; - var $$g = _export; + var $$h = _export; var $find = arrayIteration.find; var addToUnscopables$2 = addToUnscopables$4; @@ -2457,7 +2457,7 @@ // `Array.prototype.find` method // https://tc39.es/ecma262/#sec-array.prototype.find - $$g({ target: 'Array', proto: true, forced: SKIPS_HOLES$1 }, { + $$h({ target: 'Array', proto: true, forced: SKIPS_HOLES$1 }, { find: function find(callbackfn /* , that = undefined */) { return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } @@ -2511,7 +2511,7 @@ } return false; }; - var $$f = _export; + var $$g = _export; var uncurryThis$e = functionUncurryThis; var notARegExp$2 = notARegexp; var requireObjectCoercible$5 = requireObjectCoercible$b; @@ -2522,7 +2522,7 @@ // `String.prototype.includes` method // https://tc39.es/ecma262/#sec-string.prototype.includes - $$f({ target: 'String', proto: true, forced: !correctIsRegExpLogic$2('includes') }, { + $$g({ target: 'String', proto: true, forced: !correctIsRegExpLogic$2('includes') }, { includes: function includes(searchString /* , position = 0 */) { return !!~stringIndexOf$2( toString$9(requireObjectCoercible$5(this)), @@ -2612,7 +2612,7 @@ handlePrototype$1(DOMTokenListPrototype$1); var global$6 = global$k; - var fails$9 = fails$u; + var fails$a = fails$v; var uncurryThis$d = functionUncurryThis; var toString$8 = toString$f; var trim$2 = stringTrim.trim; @@ -2624,7 +2624,7 @@ var ITERATOR$4 = Symbol$2 && Symbol$2.iterator; var FORCED$4 = 1 / $parseFloat$1(whitespaces$1 + '-0') !== -Infinity // MS Edge 18- broken with boxed symbols - || (ITERATOR$4 && !fails$9(function () { $parseFloat$1(Object(ITERATOR$4)); })); + || (ITERATOR$4 && !fails$a(function () { $parseFloat$1(Object(ITERATOR$4)); })); // `parseFloat` method // https://tc39.es/ecma262/#sec-parsefloat-string @@ -2634,32 +2634,32 @@ return result === 0 && charAt$2(trimmedString, 0) == '-' ? -0 : result; } : $parseFloat$1; - var $$e = _export; + var $$f = _export; var $parseFloat = numberParseFloat; // `parseFloat` method // https://tc39.es/ecma262/#sec-parsefloat-string - $$e({ global: true, forced: parseFloat != $parseFloat }, { + $$f({ global: true, forced: parseFloat != $parseFloat }, { parseFloat: $parseFloat }); - var $$d = _export; - var toObject$4 = toObject$9; + var $$e = _export; + var toObject$5 = toObject$a; var nativeKeys = objectKeys$3; - var fails$8 = fails$u; + var fails$9 = fails$v; - var FAILS_ON_PRIMITIVES = fails$8(function () { nativeKeys(1); }); + var FAILS_ON_PRIMITIVES$1 = fails$9(function () { nativeKeys(1); }); // `Object.keys` method // https://tc39.es/ecma262/#sec-object.keys - $$d({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, { + $$e({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$1 }, { keys: function keys(it) { - return nativeKeys(toObject$4(it)); + return nativeKeys(toObject$5(it)); } }); /* eslint-disable es/no-array-prototype-indexof -- required for testing */ - var $$c = _export; + var $$d = _export; var uncurryThis$c = functionUncurryThisClause; var $indexOf = arrayIncludes.indexOf; var arrayMethodIsStrict$1 = arrayMethodIsStrict$4; @@ -2671,7 +2671,7 @@ // `Array.prototype.indexOf` method // https://tc39.es/ecma262/#sec-array.prototype.indexof - $$c({ target: 'Array', proto: true, forced: FORCED$3 }, { + $$d({ target: 'Array', proto: true, forced: FORCED$3 }, { indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { var fromIndex = arguments.length > 1 ? arguments[1] : undefined; return NEGATIVE_ZERO @@ -2750,14 +2750,14 @@ var engineWebkitVersion = !!webkit && +webkit[1]; - var $$b = _export; + var $$c = _export; var uncurryThis$b = functionUncurryThis; var aCallable$1 = aCallable$4; - var toObject$3 = toObject$9; + var toObject$4 = toObject$a; var lengthOfArrayLike$2 = lengthOfArrayLike$7; var deletePropertyOrThrow$1 = deletePropertyOrThrow$2; var toString$7 = toString$f; - var fails$7 = fails$u; + var fails$8 = fails$v; var internalSort = arraySort; var arrayMethodIsStrict = arrayMethodIsStrict$4; var FF = engineFfVersion; @@ -2770,17 +2770,17 @@ var push$1 = uncurryThis$b(test$1.push); // IE8- - var FAILS_ON_UNDEFINED = fails$7(function () { + var FAILS_ON_UNDEFINED = fails$8(function () { test$1.sort(undefined); }); // V8 bug - var FAILS_ON_NULL = fails$7(function () { + var FAILS_ON_NULL = fails$8(function () { test$1.sort(null); }); // Old WebKit var STRICT_METHOD = arrayMethodIsStrict('sort'); - var STABLE_SORT = !fails$7(function () { + var STABLE_SORT = !fails$8(function () { // feature detection can be too slow, so check engines versions if (V8) return V8 < 70; if (FF && FF > 3) return; @@ -2828,11 +2828,11 @@ // `Array.prototype.sort` method // https://tc39.es/ecma262/#sec-array.prototype.sort - $$b({ target: 'Array', proto: true, forced: FORCED$2 }, { + $$c({ target: 'Array', proto: true, forced: FORCED$2 }, { sort: function sort(comparefn) { if (comparefn !== undefined) aCallable$1(comparefn); - var array = toObject$3(this); + var array = toObject$4(this); if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn); @@ -2857,7 +2857,7 @@ }); var uncurryThis$a = functionUncurryThis; - var toObject$2 = toObject$9; + var toObject$3 = toObject$a; var floor = Math.floor; var charAt$1 = uncurryThis$a(''.charAt); @@ -2874,7 +2874,7 @@ var m = captures.length; var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED; if (namedCaptures !== undefined) { - namedCaptures = toObject$2(namedCaptures); + namedCaptures = toObject$3(namedCaptures); symbols = SUBSTITUTION_SYMBOLS; } return replace$1(replacement, symbols, function (match, ch) { @@ -2906,7 +2906,7 @@ var call$4 = functionCall; var uncurryThis$9 = functionUncurryThis; var fixRegExpWellKnownSymbolLogic$2 = fixRegexpWellKnownSymbolLogic; - var fails$6 = fails$u; + var fails$7 = fails$v; var anObject$4 = anObject$d; var isCallable$5 = isCallable$j; var isNullOrUndefined$2 = isNullOrUndefined$7; @@ -2947,7 +2947,7 @@ return false; })(); - var REPLACE_SUPPORTS_NAMED_GROUPS = !fails$6(function () { + var REPLACE_SUPPORTS_NAMED_GROUPS = !fails$7(function () { var re = /./; re.exec = function () { var result = []; @@ -3039,7 +3039,7 @@ ]; }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE); - var $$a = _export; + var $$b = _export; var $filter = arrayIteration.filter; var arrayMethodHasSpeciesSupport$3 = arrayMethodHasSpeciesSupport$5; @@ -3048,7 +3048,7 @@ // `Array.prototype.filter` method // https://tc39.es/ecma262/#sec-array.prototype.filter // with adding support of @@species - $$a({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$3 }, { + $$b({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$3 }, { filter: function filter(callbackfn /* , thisArg */) { return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } @@ -3101,7 +3101,7 @@ }); var global$5 = global$k; - var fails$5 = fails$u; + var fails$6 = fails$v; var uncurryThis$8 = functionUncurryThis; var toString$4 = toString$f; var trim$1 = stringTrim.trim; @@ -3114,7 +3114,7 @@ var exec$1 = uncurryThis$8(hex.exec); var FORCED$1 = $parseInt$1(whitespaces + '08') !== 8 || $parseInt$1(whitespaces + '0x16') !== 22 // MS Edge 18- broken with boxed symbols - || (ITERATOR$3 && !fails$5(function () { $parseInt$1(Object(ITERATOR$3)); })); + || (ITERATOR$3 && !fails$6(function () { $parseInt$1(Object(ITERATOR$3)); })); // `parseInt` method // https://tc39.es/ecma262/#sec-parseint-string-radix @@ -3123,16 +3123,16 @@ return $parseInt$1(S, (radix >>> 0) || (exec$1(hex, S) ? 16 : 10)); } : $parseInt$1; - var $$9 = _export; + var $$a = _export; var $parseInt = numberParseInt; // `parseInt` method // https://tc39.es/ecma262/#sec-parseint-string-radix - $$9({ global: true, forced: parseInt != $parseInt }, { + $$a({ global: true, forced: parseInt != $parseInt }, { parseInt: $parseInt }); - var $$8 = _export; + var $$9 = _export; var $map = arrayIteration.map; var arrayMethodHasSpeciesSupport$2 = arrayMethodHasSpeciesSupport$5; @@ -3141,13 +3141,13 @@ // `Array.prototype.map` method // https://tc39.es/ecma262/#sec-array.prototype.map // with adding support of @@species - $$8({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 }, { + $$9({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 }, { map: function map(callbackfn /* , thisArg */) { return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); - var $$7 = _export; + var $$8 = _export; var $findIndex = arrayIteration.findIndex; var addToUnscopables$1 = addToUnscopables$4; @@ -3159,7 +3159,7 @@ // `Array.prototype.findIndex` method // https://tc39.es/ecma262/#sec-array.prototype.findindex - $$7({ target: 'Array', proto: true, forced: SKIPS_HOLES }, { + $$8({ target: 'Array', proto: true, forced: SKIPS_HOLES }, { findIndex: function findIndex(callbackfn /* , that = undefined */) { return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } @@ -3299,7 +3299,7 @@ var stickyHelpers = regexpStickyHelpers; var proxyAccessor = proxyAccessor$1; var defineBuiltIn$3 = defineBuiltIn$7; - var fails$4 = fails$u; + var fails$5 = fails$v; var hasOwn$3 = hasOwnProperty_1; var enforceInternalState = internalState.enforce; var setSpecies = setSpecies$1; @@ -3328,7 +3328,7 @@ var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y; var BASE_FORCED = DESCRIPTORS$3 && - (!CORRECT_NEW || MISSED_STICKY || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG || fails$4(function () { + (!CORRECT_NEW || MISSED_STICKY || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG || fails$5(function () { re2[MATCH] = false; // RegExp constructor can alter flags and IsRegExp works correct with @@match return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i'; @@ -3480,14 +3480,14 @@ var defineBuiltIn$2 = defineBuiltIn$7; var anObject$1 = anObject$d; var $toString = toString$f; - var fails$3 = fails$u; + var fails$4 = fails$v; var getRegExpFlags = regexpGetFlags; var TO_STRING = 'toString'; var RegExpPrototype = RegExp.prototype; var nativeToString = RegExpPrototype[TO_STRING]; - var NOT_GENERIC = fails$3(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; }); + var NOT_GENERIC = fails$4(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; }); // FF44- RegExp#toString has a wrong name var INCORRECT_NAME = PROPER_FUNCTION_NAME$1 && nativeToString.name != TO_STRING; @@ -3506,7 +3506,7 @@ var arraySlice = uncurryThis$5([].slice); - var $$6 = _export; + var $$7 = _export; var isArray$2 = isArray$5; var isConstructor = isConstructor$3; var isObject$1 = isObject$b; @@ -3527,7 +3527,7 @@ // `Array.prototype.slice` method // https://tc39.es/ecma262/#sec-array.prototype.slice // fallback for not array-like ES3 strings and DOM objects - $$6({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 }, { + $$7({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 }, { slice: function slice(start, end) { var O = toIndexedObject$1(this); var length = lengthOfArrayLike$1(O); @@ -3557,9 +3557,9 @@ var iterators = {}; - var fails$2 = fails$u; + var fails$3 = fails$v; - var correctPrototypeGetter = !fails$2(function () { + var correctPrototypeGetter = !fails$3(function () { function F() { /* empty */ } F.prototype.constructor = null; // eslint-disable-next-line es/no-object-getprototypeof -- required for testing @@ -3568,9 +3568,9 @@ var hasOwn$2 = hasOwnProperty_1; var isCallable$2 = isCallable$j; - var toObject$1 = toObject$9; + var toObject$2 = toObject$a; var sharedKey = sharedKey$3; - var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter; + var CORRECT_PROTOTYPE_GETTER$1 = correctPrototypeGetter; var IE_PROTO = sharedKey('IE_PROTO'); var $Object = Object; @@ -3579,8 +3579,8 @@ // `Object.getPrototypeOf` method // https://tc39.es/ecma262/#sec-object.getprototypeof // eslint-disable-next-line es/no-object-getprototypeof -- safe - var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) { - var object = toObject$1(O); + var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER$1 ? $Object.getPrototypeOf : function (O) { + var object = toObject$2(O); if (hasOwn$2(object, IE_PROTO)) return object[IE_PROTO]; var constructor = object.constructor; if (isCallable$2(constructor) && object instanceof constructor) { @@ -3588,7 +3588,7 @@ } return object instanceof $Object ? ObjectPrototype : null; }; - var fails$1 = fails$u; + var fails$2 = fails$v; var isCallable$1 = isCallable$j; var isObject = isObject$b; var getPrototypeOf$1 = objectGetPrototypeOf; @@ -3613,7 +3613,7 @@ } } - var NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype$2) || fails$1(function () { + var NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype$2) || fails$2(function () { var test = {}; // FF44- legacy iterators case return IteratorPrototype$2[ITERATOR$2].call(test) !== test; @@ -3663,7 +3663,7 @@ return IteratorConstructor; }; - var $$5 = _export; + var $$6 = _export; var call$1 = functionCall; var FunctionName = functionName; var isCallable = isCallable$j; @@ -3748,7 +3748,7 @@ if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) { defineBuiltIn(IterablePrototype, KEY, methods[KEY]); } - } else $$5({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods); + } else $$6({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods); } // define iterator @@ -3893,8 +3893,8 @@ return O.length = length; }; - var $$4 = _export; - var toObject = toObject$9; + var $$5 = _export; + var toObject$1 = toObject$a; var toAbsoluteIndex = toAbsoluteIndex$4; var toIntegerOrInfinity = toIntegerOrInfinity$5; var lengthOfArrayLike = lengthOfArrayLike$7; @@ -3913,9 +3913,9 @@ // `Array.prototype.splice` method // https://tc39.es/ecma262/#sec-array.prototype.splice // with adding support of @@species - $$4({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { + $$5({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { splice: function splice(start, deleteCount /* , ...items */) { - var O = toObject(this); + var O = toObject$1(this); var len = lengthOfArrayLike(O); var actualStart = toAbsoluteIndex(start, len); var argumentsLength = arguments.length; @@ -3970,7 +3970,7 @@ // https://tc39.es/ecma262/#sec-thisnumbervalue var thisNumberValue$1 = uncurryThis$4(1.0.valueOf); - var $$3 = _export; + var $$4 = _export; var IS_PURE = isPure; var DESCRIPTORS = descriptors; var global$1 = global$k; @@ -3982,7 +3982,7 @@ var isPrototypeOf = objectIsPrototypeOf; var isSymbol = isSymbol$3; var toPrimitive = toPrimitive$2; - var fails = fails$u; + var fails$1 = fails$v; var getOwnPropertyNames = objectGetOwnPropertyNames.f; var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f; var defineProperty = objectDefineProperty.f; @@ -4038,7 +4038,7 @@ var calledWithNew = function (dummy) { // includes check on 1..constructor(foo) case - return isPrototypeOf(NumberPrototype, dummy) && fails(function () { thisNumberValue(dummy); }); + return isPrototypeOf(NumberPrototype, dummy) && fails$1(function () { thisNumberValue(dummy); }); }; // `Number` constructor @@ -4051,7 +4051,7 @@ NumberWrapper.prototype = NumberPrototype; if (FORCED && !IS_PURE) NumberPrototype.constructor = NumberWrapper; - $$3({ global: true, constructor: true, wrap: true, forced: FORCED }, { + $$4({ global: true, constructor: true, wrap: true, forced: FORCED }, { Number: NumberWrapper }); @@ -4072,7 +4072,7 @@ }; if (FORCED || IS_PURE) copyConstructorProperties(path[NUMBER], NativeNumber); - var $$2 = _export; + var $$3 = _export; var uncurryThis$2 = functionUncurryThis; var isArray = isArray$5; @@ -4083,7 +4083,7 @@ // https://tc39.es/ecma262/#sec-array.prototype.reverse // fix for Safari 12.0 bug // https://bugs.webkit.org/show_bug.cgi?id=188794 - $$2({ target: 'Array', proto: true, forced: String(test) === String(test.reverse()) }, { + $$3({ target: 'Array', proto: true, forced: String(test) === String(test.reverse()) }, { reverse: function reverse() { // eslint-disable-next-line no-self-assign -- dirty hack if (isArray(this)) this.length = this.length; @@ -4091,6 +4091,22 @@ } }); + var $$2 = _export; + var fails = fails$v; + var toObject = toObject$a; + var nativeGetPrototypeOf = objectGetPrototypeOf; + var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter; + + var FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); }); + + // `Object.getPrototypeOf` method + // https://tc39.es/ecma262/#sec-object.getprototypeof + $$2({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !CORRECT_PROTOTYPE_GETTER }, { + getPrototypeOf: function getPrototypeOf(it) { + return nativeGetPrototypeOf(toObject(it)); + } + }); + var call = functionCall; var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic; var anObject = anObject$d; @@ -4215,7 +4231,7 @@ getBootstrapVersion: function getBootstrapVersion() { var bootstrapVersion = 5; try { - var rawVersion = $$o.fn.dropdown.Constructor.VERSION; + var rawVersion = $$p.fn.dropdown.Constructor.VERSION; // Only try to parse VERSION if it is defined. // It is undefined in older versions of Bootstrap (tested with 3.1.1). @@ -4320,7 +4336,7 @@ }, getSearchInput: function getSearchInput(that) { if (typeof that.options.searchSelector === 'string') { - return $$o(that.options.searchSelector); + return $$p(that.options.searchSelector); } return that.$toolbar.find('.search input'); }, @@ -4416,7 +4432,14 @@ return flag ? str : ''; }, isObject: function isObject(obj) { - return _typeof(obj) === 'object' && obj !== null && !Array.isArray(obj); + if (_typeof(obj) !== 'object' || obj === null) { + return false; + } + var proto = obj; + while (Object.getPrototypeOf(proto) !== null) { + proto = Object.getPrototypeOf(proto); + } + return Object.getPrototypeOf(obj) === proto; }, isEmptyObject: function isEmptyObject() { var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; @@ -4579,10 +4602,10 @@ }, getScrollBarWidth: function getScrollBarWidth() { if (this.cachedWidth === undefined) { - var $inner = $$o('
').addClass('fixed-table-scroll-inner'); - var $outer = $$o('
').addClass('fixed-table-scroll-outer'); + var $inner = $$p('
').addClass('fixed-table-scroll-inner'); + var $outer = $$p('
').addClass('fixed-table-scroll-outer'); $outer.append($inner); - $$o('body').append($outer); + $$p('body').append($outer); var w1 = $inner[0].offsetWidth; $outer.css('overflow', 'scroll'); var w2 = $inner[0].offsetWidth; @@ -4738,7 +4761,7 @@ var data = []; var m = []; $els.each(function (y, el) { - var $el = $$o(el); + var $el = $$p(el); var row = {}; // save tr's id, class and data-* attributes @@ -4747,7 +4770,7 @@ row._data = _this2.getRealDataAttr($el.data()); row._style = $el.attr('style'); $el.find('>td,>th').each(function (_x, el) { - var $el = $$o(el); + var $el = $$p(el); var cspan = +$el.attr('colspan') || 1; var rspan = +$el.attr('rowspan') || 1; var x = _x; @@ -4882,7 +4905,7 @@ } }; - var VERSION = '1.22.0'; + var VERSION = '1.22.1'; var bootstrapVersion = Utils.getBootstrapVersion(); var CONSTANTS = { 3: { @@ -5522,7 +5545,7 @@ function BootstrapTable(el, options) { _classCallCheck(this, BootstrapTable); this.options = options; - this.$el = $$o(el); + this.$el = $$p(el); this.$el_ = this.$el.clone(); this.timeoutId_ = 0; this.timeoutFooter_ = 0; @@ -5548,17 +5571,17 @@ value: function initConstants() { var opts = this.options; this.constants = Constants.CONSTANTS; - this.constants.theme = $$o.fn.bootstrapTable.theme; + this.constants.theme = $$p.fn.bootstrapTable.theme; this.constants.dataToggle = this.constants.html.dataToggle || 'data-toggle'; // init iconsPrefix and icons - var iconsPrefix = Utils.getIconsPrefix($$o.fn.bootstrapTable.theme); + var iconsPrefix = Utils.getIconsPrefix($$p.fn.bootstrapTable.theme); var icons = Utils.getIcons(iconsPrefix); if (typeof opts.icons === 'string') { opts.icons = Utils.calculateObjectValue(null, opts.icons); } - opts.iconsPrefix = opts.iconsPrefix || $$o.fn.bootstrapTable.defaults.iconsPrefix || iconsPrefix; - opts.icons = Object.assign(icons, $$o.fn.bootstrapTable.defaults.icons, opts.icons); + opts.iconsPrefix = opts.iconsPrefix || $$p.fn.bootstrapTable.defaults.iconsPrefix || iconsPrefix; + opts.icons = Object.assign(icons, $$p.fn.bootstrapTable.defaults.icons, opts.icons); // init buttons class var buttonsPrefix = opts.buttonsPrefix ? "".concat(opts.buttonsPrefix, "-") : ''; @@ -5572,7 +5595,7 @@ key: "initLocale", value: function initLocale() { if (this.options.locale) { - var locales = $$o.fn.bootstrapTable.locales; + var locales = $$p.fn.bootstrapTable.locales; var parts = this.options.locale.split(/-|_/); parts[0] = parts[0].toLowerCase(); if (parts[1]) { @@ -5603,7 +5626,7 @@ var topPagination = ['top', 'both'].includes(this.options.paginationVAlign) ? '
' : ''; var bottomPagination = ['bottom', 'both'].includes(this.options.paginationVAlign) ? '
' : ''; var loadingTemplate = Utils.calculateObjectValue(this.options, this.options.loadingTemplate, [this.options.formatLoadingMessage()]); - this.$container = $$o("\n
\n
\n ").concat(topPagination, "\n
\n
\n
\n
\n ").concat(loadingTemplate, "\n
\n
\n
\n
\n ").concat(bottomPagination, "\n
\n ")); + this.$container = $$p("\n
\n
\n ").concat(topPagination, "\n
\n
\n
\n
\n ").concat(loadingTemplate, "\n
\n
\n
\n
\n ").concat(bottomPagination, "\n
\n ")); this.$container.insertAfter(this.$el); this.$tableContainer = this.$container.find('.fixed-table-container'); this.$tableHeader = this.$container.find('.fixed-table-header'); @@ -5612,7 +5635,7 @@ this.$tableFooter = this.$el.find('tfoot'); // checking if custom table-toolbar exists or not if (this.options.buttonsToolbar) { - this.$toolbar = $$o('body').find(this.options.buttonsToolbar); + this.$toolbar = $$p('body').find(this.options.buttonsToolbar); } else { this.$toolbar = this.$container.find('.fixed-table-toolbar'); } @@ -5641,17 +5664,17 @@ var columns = []; this.$header = this.$el.find('>thead'); if (!this.$header.length) { - this.$header = $$o("")).appendTo(this.$el); + this.$header = $$p("")).appendTo(this.$el); } else if (this.options.theadClasses) { this.$header.addClass(this.options.theadClasses); } this._headerTrClasses = []; this._headerTrStyles = []; this.$header.find('tr').each(function (i, el) { - var $tr = $$o(el); + var $tr = $$p(el); var column = []; $tr.find('th').each(function (i, el) { - var $th = $$o(el); + var $th = $$p(el); // #2014: getFieldIndex and elsewhere assume this is string, causes issues if not if (typeof $th.data('field') !== 'undefined') { @@ -5659,7 +5682,7 @@ } var _data = Object.assign({}, $th.data()); for (var key in _data) { - if ($$o.fn.bootstrapTable.columnDefaults.hasOwnProperty(key)) { + if ($$p.fn.bootstrapTable.columnDefaults.hasOwnProperty(key)) { delete _data[key]; } } @@ -5840,10 +5863,10 @@ }); this.$header.html(headerHtml.join('')); this.$header.find('th[data-field]').each(function (i, el) { - $$o(el).data(visibleColumns[$$o(el).data('field')]); + $$p(el).data(visibleColumns[$$p(el).data('field')]); }); this.$container.off('click', '.th-inner').on('click', '.th-inner', function (e) { - var $this = $$o(e.currentTarget); + var $this = $$p(e.currentTarget); if (_this2.options.detailView && !$this.parent().hasClass('bs-checkbox')) { if ($this.closest('.bootstrap-table')[0] !== _this2.$container[0]) { return false; @@ -5854,7 +5877,7 @@ } }); var resizeEvent = Utils.getEventName('resize.bootstrap-table', this.$el.attr('id')); - $$o(window).off(resizeEvent); + $$p(window).off(resizeEvent); if (!this.options.showHeader || this.options.cardView) { this.$header.hide(); this.$tableHeader.hide(); @@ -5865,14 +5888,14 @@ this.$tableLoading.css('top', this.$header.outerHeight() + 1); // Assign the correct sortable arrow this.getCaret(); - $$o(window).on(resizeEvent, function () { + $$p(window).on(resizeEvent, function () { return _this2.resetView(); }); } this.$selectAll = this.$header.find('[name="btSelectAll"]'); this.$selectAll.off('click').on('click', function (e) { e.stopPropagation(); - var checked = $$o(e.currentTarget).prop('checked'); + var checked = $$p(e.currentTarget).prop('checked'); _this2[checked ? 'checkAll' : 'uncheckAll'](); _this2.updateSelected(); }); @@ -5956,7 +5979,7 @@ value: function onSort(_ref) { var type = _ref.type, currentTarget = _ref.currentTarget; - var $this = type === 'keypress' ? $$o(currentTarget) : $$o(currentTarget).parent(); + var $this = type === 'keypress' ? $$p(currentTarget) : $$p(currentTarget).parent(); var $this_ = this.$header.find('th').eq($this.index()); this.$header.add(this.$header_).find('span.order').remove(); if (this.options.sortName === $this.data('field')) { @@ -6012,11 +6035,11 @@ var $keepOpen; var switchableCount = 0; if (this.$toolbar.find('.bs-bars').children().length) { - $$o('body').append($$o(opts.toolbar)); + $$p('body').append($$p(opts.toolbar)); } this.$toolbar.html(''); if (typeof opts.toolbar === 'string' || _typeof(opts.toolbar) === 'object') { - $$o(Utils.sprintf('
', this.constants.classes.pull, opts.toolbarAlign)).appendTo(this.$toolbar).append($$o(opts.toolbar)); + $$p(Utils.sprintf('
', this.constants.classes.pull, opts.toolbarAlign)).appendTo(this.$toolbar).append($$p(opts.toolbar)); } // showColumns, showToggle, showRefresh @@ -6218,7 +6241,7 @@ }); $checkboxes.off('click').on('click', function (_ref2) { var currentTarget = _ref2.currentTarget; - var $this = $$o(currentTarget); + var $this = $$p(currentTarget); _this4._toggleColumn($this.val(), $this.prop('checked'), false); _this4.trigger('column-switch', $this.data('field'), $this.prop('checked')); $toggleAll.prop('checked', $checkboxes.filter(':checked').length === _this4.columns.filter(function (column) { @@ -6227,19 +6250,19 @@ }); $toggleAll.off('click').on('click', function (_ref3) { var currentTarget = _ref3.currentTarget; - _this4._toggleAllColumns($$o(currentTarget).prop('checked')); - _this4.trigger('column-switch-all', $$o(currentTarget).prop('checked')); + _this4._toggleAllColumns($$p(currentTarget).prop('checked')); + _this4.trigger('column-switch-all', $$p(currentTarget).prop('checked')); }); if (opts.showColumnsSearch) { var $columnsSearch = $keepOpen.find('[name="columnsSearch"]'); var $listItems = $keepOpen.find('.dropdown-item-marker'); $columnsSearch.on('keyup paste change', function (_ref4) { var currentTarget = _ref4.currentTarget; - var $this = $$o(currentTarget); + var $this = $$p(currentTarget); var searchValue = $this.val().toLowerCase(); $listItems.show(); $checkboxes.each(function (i, el) { - var $checkbox = $$o(el); + var $checkbox = $$p(el); var $listItem = $checkbox.parents('.dropdown-item-marker'); var text = $listItem.text().toLowerCase(); if (!text.includes(searchValue)) { @@ -6313,16 +6336,16 @@ currentTarget = _ref5.currentTarget, firedByInitSearchText = _ref5.firedByInitSearchText; var overwriteSearchText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - if (currentTarget !== undefined && $$o(currentTarget).length && overwriteSearchText) { - var text = $$o(currentTarget).val().trim(); - if (this.options.trimOnSearch && $$o(currentTarget).val() !== text) { - $$o(currentTarget).val(text); + if (currentTarget !== undefined && $$p(currentTarget).length && overwriteSearchText) { + var text = $$p(currentTarget).val().trim(); + if (this.options.trimOnSearch && $$p(currentTarget).val() !== text) { + $$p(currentTarget).val(text); } if (this.searchText === text) { return; } var $searchInput = Utils.getSearchInput(this); - var $currentTarget = currentTarget instanceof jQuery ? currentTarget : $$o(currentTarget); + var $currentTarget = currentTarget instanceof jQuery ? currentTarget : $$p(currentTarget); if ($currentTarget.is($searchInput) || $currentTarget.hasClass('search-input')) { this.searchText = text; this.options.searchText = text; @@ -6673,7 +6696,7 @@ key: "updatePagination", value: function updatePagination(event) { // Fix #171: IE disabled button can be clicked bug. - if (event && $$o(event.currentTarget).hasClass('disabled')) { + if (event && $$p(event.currentTarget).hasClass('disabled')) { return; } if (!this.options.maintainMetaData) { @@ -6691,7 +6714,7 @@ key: "onPageListChange", value: function onPageListChange(event) { event.preventDefault(); - var $this = $$o(event.currentTarget); + var $this = $$p(event.currentTarget); $this.parent().addClass(this.constants.classes.dropdownActive).siblings().removeClass(this.constants.classes.dropdownActive); this.options.pageSize = $this.text().toUpperCase() === this.options.formatAllRows().toUpperCase() ? this.options.formatAllRows() : +$this.text(); this.$toolbar.find('.page-size').text(this.options.pageSize); @@ -6701,7 +6724,7 @@ }, { key: "onPagePre", value: function onPagePre(event) { - if ($$o(event.target).hasClass('disabled')) { + if ($$p(event.target).hasClass('disabled')) { return; } event.preventDefault(); @@ -6716,7 +6739,7 @@ }, { key: "onPageNext", value: function onPageNext(event) { - if ($$o(event.target).hasClass('disabled')) { + if ($$p(event.target).hasClass('disabled')) { return; } event.preventDefault(); @@ -6732,10 +6755,10 @@ key: "onPageNumber", value: function onPageNumber(event) { event.preventDefault(); - if (this.options.pageNumber === +$$o(event.currentTarget).text()) { + if (this.options.pageNumber === +$$p(event.currentTarget).text()) { return; } - this.options.pageNumber = +$$o(event.currentTarget).text(); + this.options.pageNumber = +$$p(event.currentTarget).text(); this.updatePagination(event); return false; } @@ -6945,7 +6968,7 @@ this.trigger('pre-body', data); this.$body = this.$el.find('>tbody'); if (!this.$body.length) { - this.$body = $$o('').appendTo(this.$el); + this.$body = $$p('').appendTo(this.$el); } // Fix #389 Bootstrap-table-flatJSON is not working @@ -6954,7 +6977,7 @@ this.pageTo = data.length; } var rows = []; - var trFragments = $$o(document.createDocumentFragment()); + var trFragments = $$p(document.createDocumentFragment()); var hasTr = false; var toExpand = []; this.autoMergeCells = Utils.checkAutoMergeCells(data.slice(this.pageFrom - 1, this.pageTo)); @@ -7026,13 +7049,13 @@ var _this9 = this; // click to select by column this.$body.find('> tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) { - var $td = $$o(e.currentTarget); + var $td = $$p(e.currentTarget); if ($td.find('.detail-icon').length || $td.index() - Utils.getDetailViewIndexOffset(_this9.options) < 0) { return; } var $tr = $td.parent(); - var $cardViewArr = $$o(e.target).parents('.card-views').children(); - var $cardViewTarget = $$o(e.target).parents('.card-view'); + var $cardViewArr = $$p(e.target).parents('.card-views').children(); + var $cardViewTarget = $$p(e.target).parents('.card-view'); var rowIndex = $tr.data('index'); var item = _this9.data[rowIndex]; var index = _this9.options.cardView ? $cardViewArr.index($cardViewTarget) : $td[0].cellIndex; @@ -7060,13 +7083,13 @@ }); this.$body.find('> tr[data-index] > td > .detail-icon').off('click').on('click', function (e) { e.preventDefault(); - _this9.toggleDetailView($$o(e.currentTarget).parent().parent().data('index')); + _this9.toggleDetailView($$p(e.currentTarget).parent().parent().data('index')); return false; }); this.$selectItem = this.$body.find(Utils.sprintf('[name="%s"]', this.options.selectItemName)); this.$selectItem.off('click').on('click', function (e) { e.stopImmediatePropagation(); - var $this = $$o(e.currentTarget); + var $this = $$p(e.currentTarget); _this9._toggleCheck($this.prop('checked'), $this.data('index')); }); this.header.events.forEach(function (_events, i) { @@ -7093,7 +7116,7 @@ } var event = events[key]; _this9.$body.find('>tr:not(.no-records-found)').each(function (i, tr) { - var $tr = $$o(tr); + var $tr = $$p(tr); var $td = $tr.find(_this9.options.cardView ? '.card-views>.card-view' : '>td').eq(fieldIndex); var index = key.indexOf(' '); var name = key.substring(0, index); @@ -7223,7 +7246,7 @@ this._xhrAbort = true; this._xhr.abort(); } - this._xhr = $$o.ajax(request); + this._xhr = $$p.ajax(request); } return data; } @@ -7247,7 +7270,7 @@ value: function getCaret() { var _this11 = this; this.$header.find('th').each(function (i, th) { - $$o(th).find('.sortable').removeClass('desc asc').addClass($$o(th).data('field') === _this11.options.sortName ? _this11.options.sortOrder : 'both'); + $$p(th).find('.sortable').removeClass('desc asc').addClass($$p(th).data('field') === _this11.options.sortName ? _this11.options.sortOrder : 'both'); }); } }, { @@ -7256,7 +7279,7 @@ var checkAll = this.$selectItem.filter(':enabled').length && this.$selectItem.filter(':enabled').length === this.$selectItem.filter(':enabled').filter(':checked').length; this.$selectAll.add(this.$selectAll_).prop('checked', checkAll); this.$selectItem.each(function (i, el) { - $$o(el).closest('tr')[$$o(el).prop('checked') ? 'addClass' : 'removeClass']('selected'); + $$p(el).closest('tr')[$$p(el).prop('checked') ? 'addClass' : 'removeClass']('selected'); }); } }, { @@ -7264,7 +7287,7 @@ value: function updateRows() { var _this12 = this; this.$selectItem.each(function (i, el) { - _this12.data[$$o(el).data('index')][_this12.header.stateField] = $$o(el).prop('checked'); + _this12.data[$$p(el).data('index')][_this12.header.stateField] = $$p(el).prop('checked'); }); } }, { @@ -7297,11 +7320,11 @@ args[_key4 - 1] = arguments[_key4]; } (_this$options = this.options)[BootstrapTable.EVENTS[name]].apply(_this$options, [].concat(args, [this])); - this.$el.trigger($$o.Event(name, { + this.$el.trigger($$p.Event(name, { sender: this }), args); (_this$options2 = this.options).onAll.apply(_this$options2, [name].concat([].concat(args, [this]))); - this.$el.trigger($$o.Event('all.bs.table', { + this.$el.trigger($$p.Event('all.bs.table', { sender: this }), [name, args]); } @@ -7346,7 +7369,7 @@ this.$selectAll_ = this.$header_.find('[name="btSelectAll"]'); this.$tableHeader.css('margin-right', scrollWidth).find('table').css('width', this.$el.outerWidth()).html('').attr('class', this.$el.attr('class')).append(this.$header_); this.$tableLoading.css('width', this.$el.outerWidth()); - var focusedTemp = $$o('.focus-temp:visible:eq(0)'); + var focusedTemp = $$p('.focus-temp:visible:eq(0)'); if (focusedTemp.length > 0) { focusedTemp.focus(); this.$header.find('.focus-temp').removeClass('focus-temp'); @@ -7354,7 +7377,7 @@ // fix bug: $.data() is not working as expected after $.append() this.$header.find('th[data-field]').each(function (i, el) { - _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', $$o(el).data('field'))).data($$o(el).data()); + _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', $$p(el).data('field'))).data($$p(el).data()); }); var visibleFields = this.getVisibleFields(); var $ths = this.$header_.find('th'); @@ -7364,7 +7387,7 @@ } var trLength = $tr.find('> *').length; $tr.find('> *').each(function (i, el) { - var $this = $$o(el); + var $this = $$p(el); if (Utils.hasDetailViewIcon(_this14.options)) { if (i === 0 && _this14.options.detailViewAlign !== 'right' || i === trLength - 1 && _this14.options.detailViewAlign === 'right') { var $thDetail = $ths.filter('.detail'); @@ -7376,7 +7399,7 @@ var index = i - Utils.getDetailViewIndexOffset(_this14.options); var $th = _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', visibleFields[index])); if ($th.length > 1) { - $th = $$o($ths[$this[0].cellIndex]); + $th = $$p($ths[$this[0].cellIndex]); } var zoomWidth = $th.innerWidth() - $th.find('.fht-cell').width(); $th.find('.fht-cell').width($this.innerWidth() - zoomWidth); @@ -7489,7 +7512,7 @@ } var trLength = $tr.find('> *').length; $tr.find('> *').each(function (i, el) { - var $this = $$o(el); + var $this = $$p(el); if (Utils.hasDetailViewIcon(_this15.options)) { if (i === 0 && _this15.options.detailViewAlign === 'left' || i === trLength - 1 && _this15.options.detailViewAlign === 'right') { var $thDetail = $ths.filter('.detail'); @@ -7821,7 +7844,7 @@ return; } fieldIndex += Utils.getDetailViewIndexOffset(this.options); - this.$body.find(">tr[data-index=".concat(index, "]")).find(">td:eq(".concat(fieldIndex, ")")).replaceWith($$o(rowHtml).find(">td:eq(".concat(fieldIndex, ")"))); + this.$body.find(">tr[data-index=".concat(index, "]")).find(">td:eq(".concat(fieldIndex, ")")).replaceWith($$p(rowHtml).find(">td:eq(".concat(fieldIndex, ")"))); this.initBodyEvent(); this.initFooter(); this.resetView(); @@ -8026,7 +8049,7 @@ } else { $items.get().reverse().forEach(function (item) { if ($items.filter(':checked').length > _this23.options.minimumCountColumns) { - $$o(item).prop('checked', visible); + $$p(item).prop('checked', visible); } }); } @@ -8088,7 +8111,7 @@ var $items = this.$selectItem.filter(':enabled'); var checked = $items.filter(':checked'); $items.each(function (i, el) { - $$o(el).prop('checked', !$$o(el).prop('checked')); + $$p(el).prop('checked', !$$p(el).prop('checked')); }); this.updateRows(); this.updateSelected(); @@ -8202,13 +8225,13 @@ key: "destroy", value: function destroy() { this.$el.insertBefore(this.$container); - $$o(this.options.toolbar).insertBefore(this.$el); + $$p(this.options.toolbar).insertBefore(this.$el); this.$container.next().remove(); this.$container.remove(); this.$el.html(this.$el_.html()).css('margin-top', '0').attr('class', this.$el_.attr('class') || ''); // reset the class var resizeEvent = Utils.getEventName('resize.bootstrap-table', this.$el.attr('id')); - $$o(window).off(resizeEvent); + $$p(window).off(resizeEvent); } }, { key: "resetView", @@ -8355,7 +8378,7 @@ if (options.unit === 'rows') { scrollTo = 0; this.$body.find("> tr:lt(".concat(options.value, ")")).each(function (i, el) { - scrollTo += $$o(el).outerHeight(true); + scrollTo += $$p(el).outerHeight(true); }); } this.$tableBody.scrollTop(scrollTo); @@ -8457,7 +8480,7 @@ value: function expandAllRows() { var trs = this.$body.find('> tr[data-index][data-has-detail-view]'); for (var i = 0; i < trs.length; i++) { - this.expandRow($$o(trs[i]).data('index')); + this.expandRow($$p(trs[i]).data('index')); } } }, { @@ -8465,7 +8488,7 @@ value: function collapseAllRows() { var trs = this.$body.find('> tr[data-index][data-has-detail-view]'); for (var i = 0; i < trs.length; i++) { - this.collapseRow($$o(trs[i]).data('index')); + this.collapseRow($$p(trs[i]).data('index')); } } }, { @@ -8477,8 +8500,8 @@ this.columns[this.fieldsColumnsIndex[params.field]].title = this.options.escape && this.options.escapeTitle ? Utils.escapeHTML(params.title) : params.title; if (this.columns[this.fieldsColumnsIndex[params.field]].visible) { this.$header.find('th[data-field]').each(function (i, el) { - if ($$o(el).data('field') === params.field) { - $$o($$o(el).find('.th-inner')[0]).text(params.title); + if ($$p(el).data('field') === params.field) { + $$p($$p(el).find('.th-inner')[0]).text(params.title); return false; } }); @@ -8515,14 +8538,14 @@ // BOOTSTRAP TABLE PLUGIN DEFINITION // ======================= - $$o.BootstrapTable = BootstrapTable; - $$o.fn.bootstrapTable = function (option) { + $$p.BootstrapTable = BootstrapTable; + $$p.fn.bootstrapTable = function (option) { for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key5 = 1; _key5 < _len2; _key5++) { args[_key5 - 1] = arguments[_key5]; } var value; this.each(function (i, el) { - var data = $$o(el).data('bootstrap.table'); + var data = $$p(el).data('bootstrap.table'); if (typeof option === 'string') { var _data2; if (!Constants.METHODS.includes(option)) { @@ -8533,7 +8556,7 @@ } value = (_data2 = data)[option].apply(_data2, args); if (option === 'destroy') { - $$o(el).removeData('bootstrap.table'); + $$p(el).removeData('bootstrap.table'); } return; } @@ -8541,28 +8564,28 @@ console.warn('You cannot initialize the table more than once!'); return; } - var options = Utils.extend(true, {}, BootstrapTable.DEFAULTS, $$o(el).data(), _typeof(option) === 'object' && option); - data = new $$o.BootstrapTable(el, options); - $$o(el).data('bootstrap.table', data); + var options = Utils.extend(true, {}, BootstrapTable.DEFAULTS, $$p(el).data(), _typeof(option) === 'object' && option); + data = new $$p.BootstrapTable(el, options); + $$p(el).data('bootstrap.table', data); data.init(); }); return typeof value === 'undefined' ? this : value; }; - $$o.fn.bootstrapTable.Constructor = BootstrapTable; - $$o.fn.bootstrapTable.theme = Constants.THEME; - $$o.fn.bootstrapTable.VERSION = Constants.VERSION; - $$o.fn.bootstrapTable.defaults = BootstrapTable.DEFAULTS; - $$o.fn.bootstrapTable.columnDefaults = BootstrapTable.COLUMN_DEFAULTS; - $$o.fn.bootstrapTable.events = BootstrapTable.EVENTS; - $$o.fn.bootstrapTable.locales = BootstrapTable.LOCALES; - $$o.fn.bootstrapTable.methods = BootstrapTable.METHODS; - $$o.fn.bootstrapTable.utils = Utils; + $$p.fn.bootstrapTable.Constructor = BootstrapTable; + $$p.fn.bootstrapTable.theme = Constants.THEME; + $$p.fn.bootstrapTable.VERSION = Constants.VERSION; + $$p.fn.bootstrapTable.defaults = BootstrapTable.DEFAULTS; + $$p.fn.bootstrapTable.columnDefaults = BootstrapTable.COLUMN_DEFAULTS; + $$p.fn.bootstrapTable.events = BootstrapTable.EVENTS; + $$p.fn.bootstrapTable.locales = BootstrapTable.LOCALES; + $$p.fn.bootstrapTable.methods = BootstrapTable.METHODS; + $$p.fn.bootstrapTable.utils = Utils; // BOOTSTRAP TABLE INIT // ======================= - $$o(function () { - $$o('[data-toggle="table"]').bootstrapTable(); + $$p(function () { + $$p('[data-toggle="table"]').bootstrapTable(); }); return BootstrapTable; @@ -16733,19 +16756,123 @@ jQuery.base64 = (function($) { }; }(jQuery)); -/** - * @preserve tableExport.jquery.plugin - * - * Version 1.27.0 - * - * Copyright (c) 2015-2023 hhurz, - * https://github.com/hhurz/tableExport.jquery.plugin - * - * Based on https://github.com/kayalshri/tableExport.jquery.plugin - * - * Licensed under the MIT License - **/ -"use strict";(function($){$.fn.tableExport=function(options){let docData;const defaults={csvEnclosure:'"',csvSeparator:",",csvUseBOM:true,date:{html:"dd/mm/yyyy"},displayTableName:false,escape:false,exportHiddenCells:false,fileName:"tableExport",htmlContent:false,htmlHyperlink:"content",ignoreColumn:[],ignoreRow:[],jsonScope:"all",jspdf:{orientation:"p",unit:"pt",format:"a4",margins:{left:20,right:10,top:10,bottom:10},onDocCreated:null,autotable:{styles:{cellPadding:2,rowHeight:12,fontSize:8,fillColor:255,textColor:50,fontStyle:"normal",overflow:"ellipsize",halign:"inherit",valign:"middle"},headerStyles:{fillColor:[52,73,94],textColor:255,fontStyle:"bold",halign:"inherit",valign:"middle"},alternateRowStyles:{fillColor:245},tableExport:{doc:null,onAfterAutotable:null,onBeforeAutotable:null,onAutotableText:null,onTable:null,outputImages:true}}},mso:{fileFormat:"xlshtml",onMsoNumberFormat:null,pageFormat:"a4",pageOrientation:"portrait",rtl:false,styles:[],worksheetName:"",xlsx:{formatId:{date:14,numbers:2,currency:164},format:{currency:"$#,##0.00;[Red]-$#,##0.00"},onHyperlink:null}},numbers:{html:{decimalMark:".",thousandsSeparator:","},output:{decimalMark:".",thousandsSeparator:","}},onAfterSaveToFile:null,onBeforeSaveToFile:null,onCellData:null,onCellHtmlData:null,onCellHtmlHyperlink:null,onIgnoreRow:null,onTableExportBegin:null,onTableExportEnd:null,outputMode:"file",pdfmake:{enabled:false,docDefinition:{pageSize:"A4",pageOrientation:"portrait",styles:{header:{background:"#34495E",color:"#FFFFFF",bold:true,alignment:"center",fillColor:"#34495E"},alternateRow:{fillColor:"#f5f5f5"}},defaultStyle:{color:"#000000",fontSize:8,font:"Roboto"}},fonts:{}},preserve:{leadingWS:false,trailingWS:false},preventInjection:true,sql:{tableEnclosure:"`",columnEnclosure:"`"},tbodySelector:"tr",tfootSelector:"tr",theadSelector:"tr",tableName:"Table",type:"csv"};const pageFormats={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};const jsPdfThemes={striped:{table:{fillColor:255,textColor:80,fontStyle:"normal",fillStyle:"F"},header:{textColor:255,fillColor:[41,128,185],rowHeight:23,fontStyle:"bold"},body:{},alternateRow:{fillColor:245}},grid:{table:{fillColor:255,textColor:80,fontStyle:"normal",lineWidth:.1,fillStyle:"DF"},header:{textColor:255,fillColor:[26,188,156],rowHeight:23,fillStyle:"F",fontStyle:"bold"},body:{},alternateRow:{}},plain:{header:{fontStyle:"bold"}}};let jsPdfDefaultStyles={cellPadding:5,fontSize:10,fontName:"helvetica",lineColor:200,lineWidth:.1,fontStyle:"normal",overflow:"ellipsize",fillColor:255,textColor:20,halign:"left",valign:"top",fillStyle:"F",rowHeight:20,columnWidth:"auto"};const FONT_ROW_RATIO=1.15;const el=this;let DownloadEvt=null;let $head_rows=[];let $rows=[];let rowIndex=0;let trData="";let colNames=[];let ranges=[];let blob;let $hiddenTableElements=[];let checkCellVisibility=false;$.extend(true,defaults,options);if(defaults.type==="xlsx"){defaults.mso.fileFormat=defaults.type;defaults.type="excel"}if(typeof defaults.excelFileFormat!=="undefined"&&typeof defaults.mso.fileFormat==="undefined")defaults.mso.fileFormat=defaults.excelFileFormat;if(typeof defaults.excelPageFormat!=="undefined"&&typeof defaults.mso.pageFormat==="undefined")defaults.mso.pageFormat=defaults.excelPageFormat;if(typeof defaults.excelPageOrientation!=="undefined"&&typeof defaults.mso.pageOrientation==="undefined")defaults.mso.pageOrientation=defaults.excelPageOrientation;if(typeof defaults.excelRTL!=="undefined"&&typeof defaults.mso.rtl==="undefined")defaults.mso.rtl=defaults.excelRTL;if(typeof defaults.excelstyles!=="undefined"&&typeof defaults.mso.styles==="undefined")defaults.mso.styles=defaults.excelstyles;if(typeof defaults.onMsoNumberFormat!=="undefined"&&typeof defaults.mso.onMsoNumberFormat==="undefined")defaults.mso.onMsoNumberFormat=defaults.onMsoNumberFormat;if(typeof defaults.worksheetName!=="undefined"&&typeof defaults.mso.worksheetName==="undefined")defaults.mso.worksheetName=defaults.worksheetName;if(typeof defaults.mso.xslx!=="undefined"&&typeof defaults.mso.xlsx==="undefined")defaults.mso.xlsx=defaults.mso.xslx;defaults.mso.pageOrientation=defaults.mso.pageOrientation.substr(0,1)==="l"?"landscape":"portrait";defaults.date.html=defaults.date.html||"";if(defaults.date.html.length){const patt=[];patt["dd"]="(3[01]|[12][0-9]|0?[1-9])";patt["mm"]="(1[012]|0?[1-9])";patt["yyyy"]="((?:1[6-9]|2[0-2])\\d{2})";patt["yy"]="(\\d{2})";const separator=defaults.date.html.match(/[^a-zA-Z0-9]/)[0];const formatItems=defaults.date.html.toLowerCase().split(separator);defaults.date.regex="^\\s*";defaults.date.regex+=patt[formatItems[0]];defaults.date.regex+="(.)";defaults.date.regex+=patt[formatItems[1]];defaults.date.regex+="\\2";defaults.date.regex+=patt[formatItems[2]];defaults.date.regex+="\\s*$";defaults.date.pattern=new RegExp(defaults.date.regex,"g");let f=formatItems.indexOf("dd")+1;defaults.date.match_d=f+(f>1?1:0);f=formatItems.indexOf("mm")+1;defaults.date.match_m=f+(f>1?1:0);f=(formatItems.indexOf("yyyy")>=0?formatItems.indexOf("yyyy"):formatItems.indexOf("yy"))+1;defaults.date.match_y=f+(f>1?1:0)}colNames=GetColumnNames(el);if(typeof defaults.onTableExportBegin==="function")defaults.onTableExportBegin();if(defaults.type==="csv"||defaults.type==="tsv"||defaults.type==="txt"){let csvData="";let rowLength=0;ranges=[];rowIndex=0;const csvString=function(cell,rowIndex,colIndex){let result="";if(cell!==null){const dataString=parseString(cell,rowIndex,colIndex);const csvValue=dataString===null||dataString===""?"":dataString.toString();if(defaults.type==="tsv"){if(dataString instanceof Date)dataString.toLocaleString();result=replaceAll(csvValue,"\t"," ")}else{if(dataString instanceof Date)result=defaults.csvEnclosure+dataString.toLocaleString()+defaults.csvEnclosure;else{result=preventInjection(csvValue);result=replaceAll(result,defaults.csvEnclosure,defaults.csvEnclosure+defaults.csvEnclosure);if(result.indexOf(defaults.csvSeparator)>=0||/[\r\n ]/g.test(result))result=defaults.csvEnclosure+result+defaults.csvEnclosure}}}return result};const CollectCsvData=function($rows,rowselector,length){$rows.each(function(){trData="";ForEachVisibleCell(this,rowselector,rowIndex,length+$rows.length,function(cell,row,col){trData+=csvString(cell,row,col)+(defaults.type==="tsv"?"\t":defaults.csvSeparator)});trData=$.trim(trData).substring(0,trData.length-1);if(trData.length>0){if(csvData.length>0)csvData+="\n";csvData+=trData}rowIndex++});return $rows.length};rowLength+=CollectCsvData($(el).find("thead").first().find(defaults.theadSelector),"th,td",rowLength);findTableElements($(el),"tbody").each(function(){rowLength+=CollectCsvData(findTableElements($(this),defaults.tbodySelector),"td,th",rowLength)});if(defaults.tfootSelector.length)CollectCsvData($(el).find("tfoot").first().find(defaults.tfootSelector),"td,th",rowLength);csvData+="\n";if(defaults.outputMode==="string")return csvData;if(defaults.outputMode==="base64")return base64encode(csvData);if(defaults.outputMode==="window"){downloadFile(false,"data:text/"+(defaults.type==="csv"?"csv":"plain")+";charset=utf-8,",csvData);return}saveToFile(csvData,defaults.fileName+"."+defaults.type,"text/"+(defaults.type==="csv"?"csv":"plain"),"utf-8","",defaults.type==="csv"&&defaults.csvUseBOM)}else if(defaults.type==="sql"){rowIndex=0;ranges=[];let tdData="INSERT INTO "+defaults.sql.tableEnclosure+defaults.tableName+defaults.sql.tableEnclosure+" (";$head_rows=collectHeadRows($(el));$($head_rows).each(function(){ForEachVisibleCell(this,"th,td",rowIndex,$head_rows.length,function(cell,row,col){let colName=parseString(cell,row,col)||"";if(colName.indexOf(defaults.sql.columnEnclosure)>-1)colName=replaceAll(colName.toString(),defaults.sql.columnEnclosure,defaults.sql.columnEnclosure+defaults.sql.columnEnclosure);tdData+=defaults.sql.columnEnclosure+colName+defaults.sql.columnEnclosure+","});rowIndex++;tdData=$.trim(tdData).substring(0,tdData.length-1)});tdData+=") VALUES ";$rows=collectRows($(el));$($rows).each(function(){trData="";ForEachVisibleCell(this,"td,th",rowIndex,$head_rows.length+$rows.length,function(cell,row,col){let dataString=parseString(cell,row,col)||"";if(dataString.indexOf("'")>-1)dataString=replaceAll(dataString.toString(),"'","''");trData+="'"+dataString+"',"});if(trData.length>3){tdData+="("+trData;tdData=$.trim(tdData).substring(0,tdData.length-1);tdData+="),"}rowIndex++});tdData=$.trim(tdData).substring(0,tdData.length-1);tdData+=";";if(defaults.outputMode==="string")return tdData;if(defaults.outputMode==="base64")return base64encode(tdData);saveToFile(tdData,defaults.fileName+".sql","application/sql","utf-8","",false)}else if(defaults.type==="json"){const jsonHeaderArray=[];ranges=[];$head_rows=collectHeadRows($(el));$($head_rows).each(function(){const jsonArrayTd=[];ForEachVisibleCell(this,"th,td",rowIndex,$head_rows.length,function(cell,row,col){jsonArrayTd.push(parseString(cell,row,col))});jsonHeaderArray.push(jsonArrayTd)});const jsonArray=[];$rows=collectRows($(el));$($rows).each(function(){const jsonObjectTd={};let colIndex=0;ForEachVisibleCell(this,"td,th",rowIndex,$head_rows.length+$rows.length,function(cell,row,col){if(jsonHeaderArray.length){jsonObjectTd[jsonHeaderArray[jsonHeaderArray.length-1][colIndex]]=parseString(cell,row,col)}else{jsonObjectTd[colIndex]=parseString(cell,row,col)}colIndex++});if($.isEmptyObject(jsonObjectTd)===false)jsonArray.push(jsonObjectTd);rowIndex++});let save_data;if(defaults.jsonScope==="head")save_data=JSON.stringify(jsonHeaderArray);else if(defaults.jsonScope==="data")save_data=JSON.stringify(jsonArray);else save_data=JSON.stringify({header:jsonHeaderArray,data:jsonArray});if(defaults.outputMode==="string")return save_data;if(defaults.outputMode==="base64")return base64encode(save_data);saveToFile(save_data,defaults.fileName+".json","application/json","utf-8","base64",false)}else if(defaults.type==="xml"){rowIndex=0;ranges=[];let xml='';xml+="";$head_rows=collectHeadRows($(el));$($head_rows).each(function(){ForEachVisibleCell(this,"th,td",rowIndex,$head_rows.length,function(cell,row,col){xml+=""+parseString(cell,row,col)+""});rowIndex++});xml+="";let rowCount=1;$rows=collectRows($(el));$($rows).each(function(){let colCount=1;trData="";ForEachVisibleCell(this,"td,th",rowIndex,$head_rows.length+$rows.length,function(cell,row,col){trData+=""+parseString(cell,row,col)+"";colCount++});if(trData.length>0&&trData!==""){xml+=''+trData+"";rowCount++}rowIndex++});xml+="";if(defaults.outputMode==="string")return xml;if(defaults.outputMode==="base64")return base64encode(xml);saveToFile(xml,defaults.fileName+".xml","application/xml","utf-8","base64",false)}else if(defaults.type==="excel"&&defaults.mso.fileFormat==="xmlss"){const sheetData=[];const docNames=[];$(el).filter(function(){return isVisible($(this))}).each(function(){const $table=$(this);let ssName="";if(typeof defaults.mso.worksheetName==="string"&&defaults.mso.worksheetName.length)ssName=defaults.mso.worksheetName+" "+(docNames.length+1);else if(typeof defaults.mso.worksheetName[docNames.length]!=="undefined")ssName=defaults.mso.worksheetName[docNames.length];if(!ssName.length)ssName=$table.find("caption").text()||"";if(!ssName.length)ssName="Table "+(docNames.length+1);ssName=$.trim(ssName.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31));docNames.push($("
").text(ssName).html());if(defaults.exportHiddenCells===false){$hiddenTableElements=$table.find("tr, th, td").filter(":hidden");checkCellVisibility=$hiddenTableElements.length>0}rowIndex=0;colNames=GetColumnNames(this);docData="\r";function CollectXmlssData($rows,rowselector,length){const spans=[];$($rows).each(function(){let ssIndex=0;let nCols=0;trData="";ForEachVisibleCell(this,"td,th",rowIndex,length+$rows.length,function(cell,row,col){if(cell!==null){let style="";let data=parseString(cell,row,col);let type="String";if(jQuery.isNumeric(data)!==false){type="Number"}else{const number=parsePercent(data);if(number!==false){data=number;type="Number";style+=' ss:StyleID="pct1"'}}if(type!=="Number")data=data.replace(/\n/g,"
");let colspan=getColspan(cell);let rowspan=getRowspan(cell);$.each(spans,function(){const range=this;if(rowIndex>=range.s.r&&rowIndex<=range.e.r&&nCols>=range.s.c&&nCols<=range.e.c){for(let i=0;i<=range.e.c-range.s.c;++i){nCols++;ssIndex++}}});if(rowspan||colspan){rowspan=rowspan||1;colspan=colspan||1;spans.push({s:{r:rowIndex,c:nCols},e:{r:rowIndex+rowspan-1,c:nCols+colspan-1}})}if(colspan>1){style+=' ss:MergeAcross="'+(colspan-1)+'"';nCols+=colspan-1}if(rowspan>1){style+=' ss:MergeDown="'+(rowspan-1)+'" ss:StyleID="rsp1"'}if(ssIndex>0){style+=' ss:Index="'+(nCols+1)+'"';ssIndex=0}trData+="'+$("
").text(data).html()+"\r";nCols++}});if(trData.length>0)docData+='\r'+trData+"\r";rowIndex++});return $rows.length}const rowLength=CollectXmlssData(collectHeadRows($table),"th,td",0);CollectXmlssData(collectRows($table),"td,th",rowLength);docData+="
\r";sheetData.push(docData)});const count={};const firstOccurrences={};let item,itemCount;for(let n=0,c=docNames.length;n1)docNames[n]=docNames[n].substring(0,29)+"-"+count[item];else firstOccurrences[item]=n}const CreationDate=(new Date).toISOString();let xmlssDocFile='\r'+'\r'+'\r'+'\r'+" "+CreationDate+"\r"+"\r"+'\r'+" \r"+"\r"+'\r'+" 9000\r"+" 13860\r"+" 0\r"+" 0\r"+" False\r"+" False\r"+"\r"+"\r"+' \r"+' \r"+' \r"+"\r";for(let j=0;j\r'+sheetData[j];if(defaults.mso.rtl){xmlssDocFile+='\r'+"\r"+"\r"}else xmlssDocFile+='\r';xmlssDocFile+="\r"}xmlssDocFile+="\r";if(defaults.outputMode==="string")return xmlssDocFile;if(defaults.outputMode==="base64")return base64encode(xmlssDocFile);saveToFile(xmlssDocFile,defaults.fileName+".xml","application/xml","utf-8","base64",false)}else if(defaults.type==="excel"&&defaults.mso.fileFormat==="xlsx"){const sheetNames=[];const workbook=XLSX.utils.book_new();$(el).filter(function(){return isVisible($(this))}).each(function(){const $table=$(this);const ws=xlsxTableToSheet(this);let sheetName="";if(typeof defaults.mso.worksheetName==="string"&&defaults.mso.worksheetName.length)sheetName=defaults.mso.worksheetName+" "+(sheetNames.length+1);else if(typeof defaults.mso.worksheetName[sheetNames.length]!=="undefined")sheetName=defaults.mso.worksheetName[sheetNames.length];if(!sheetName.length)sheetName=$table.find("caption").text()||"";if(!sheetName.length)sheetName="Table "+(sheetNames.length+1);sheetName=$.trim(sheetName.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31));sheetNames.push(sheetName);XLSX.utils.book_append_sheet(workbook,ws,sheetName)});const wbData=XLSX.write(workbook,{type:"binary",bookType:defaults.mso.fileFormat,bookSST:false});saveToFile(xlsxWorkbookToArrayBuffer(wbData),defaults.fileName+"."+defaults.mso.fileFormat,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","UTF-8","",false)}else if(defaults.type==="excel"||defaults.type==="xls"||defaults.type==="word"||defaults.type==="doc"){const MSDocType=defaults.type==="excel"||defaults.type==="xls"?"excel":"word";const MSDocExt=MSDocType==="excel"?"xls":"doc";const MSDocSchema='xmlns:x="urn:schemas-microsoft-com:office:'+MSDocType+'"';docData="";let docName="";$(el).filter(function(){return isVisible($(this))}).each(function(){const $table=$(this);if(docName===""){docName=defaults.mso.worksheetName||$table.find("caption").text()||"Table";docName=$.trim(docName.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31))}if(defaults.exportHiddenCells===false){$hiddenTableElements=$table.find("tr, th, td").filter(":hidden");checkCellVisibility=$hiddenTableElements.length>0}rowIndex=0;ranges=[];colNames=GetColumnNames(this);docData+="";$head_rows=collectHeadRows($table);$($head_rows).each(function(){const $row=$(this);trData="";ForEachVisibleCell(this,"th,td",rowIndex,$head_rows.length,function(cell,row,col){if(cell!==null){let thStyle="";trData+="0)trData+=' colspan="'+tdColspan+'"';const tdRowspan=getRowspan(cell);if(tdRowspan>0)trData+=' rowspan="'+tdRowspan+'"';trData+=">"+parseString(cell,row,col)+""}});if(trData.length>0)docData+=""+trData+"";rowIndex++});docData+="";$rows=collectRows($table);$($rows).each(function(){const $row=$(this);trData="";ForEachVisibleCell(this,"td,th",rowIndex,$head_rows.length+$rows.length,function(cell,row,col){if(cell!==null){let tdValue=parseString(cell,row,col);let tdStyle="";let tdCss=$(cell).attr("data-tableexport-msonumberformat");if(typeof tdCss==="undefined"&&typeof defaults.mso.onMsoNumberFormat==="function")tdCss=defaults.mso.onMsoNumberFormat(cell,row,col);if(typeof tdCss!=="undefined"&&tdCss!=="")tdStyle="style=\"mso-number-format:'"+tdCss+"'";if(defaults.mso.styles.length){const cellStyles=document.defaultView.getComputedStyle(cell,null);const rowStyles=document.defaultView.getComputedStyle($row[0],null);for(let cssStyle in defaults.mso.styles){tdCss=cellStyles[defaults.mso.styles[cssStyle]];if(tdCss==="")tdCss=rowStyles[defaults.mso.styles[cssStyle]];if(tdCss!==""&&tdCss!=="0px none rgb(0, 0, 0)"&&tdCss!=="rgba(0, 0, 0, 0)"){tdStyle+=tdStyle===""?'style="':";";tdStyle+=defaults.mso.styles[cssStyle]+":"+tdCss}}}trData+="0)trData+=' colspan="'+tdColspan+'"';const tdRowspan=getRowspan(cell);if(tdRowspan>0)trData+=' rowspan="'+tdRowspan+'"';if(typeof tdValue==="string"&&tdValue!==""){tdValue=preventInjection(tdValue);tdValue=tdValue.replace(/\n/g,"
")}trData+=">"+tdValue+""}});if(trData.length>0)docData+="
"+trData+"";rowIndex++});if(defaults.displayTableName)docData+="";docData+="
"+parseString($("

"+defaults.tableName+"

"))+"
"});let docFile='';docFile+='';docFile+="";if(MSDocType==="excel"){docFile+="\x3c!--[if gte mso 9]>";docFile+="";docFile+="";docFile+="";docFile+="";docFile+="";docFile+=docName;docFile+="";docFile+="";docFile+="";if(defaults.mso.rtl)docFile+="";docFile+="";docFile+="";docFile+="";docFile+="";docFile+="";docFile+="";docFile+="@page { size:"+defaults.mso.pageOrientation+"; mso-page-orientation:"+defaults.mso.pageOrientation+"; }";docFile+="@page Section1 {size:"+pageFormats[defaults.mso.pageFormat][0]+"pt "+pageFormats[defaults.mso.pageFormat][1]+"pt";docFile+="; margin:1.0in 1.25in 1.0in 1.25in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}";docFile+="div.Section1 {page:Section1;}";docFile+="@page Section2 {size:"+pageFormats[defaults.mso.pageFormat][1]+"pt "+pageFormats[defaults.mso.pageFormat][0]+"pt";docFile+=";mso-page-orientation:"+defaults.mso.pageOrientation+";margin:1.25in 1.0in 1.25in 1.0in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}";docFile+="div.Section2 {page:Section2;}";docFile+="br {mso-data-placement:same-cell;}";docFile+="";docFile+="";docFile+="";docFile+='
';docFile+=docData;docFile+="
";docFile+="";docFile+="";if(defaults.outputMode==="string")return docFile;if(defaults.outputMode==="base64")return base64encode(docFile);saveToFile(docFile,defaults.fileName+"."+MSDocExt,"application/vnd.ms-"+MSDocType,"","base64",false)}else if(defaults.type==="png"){html2canvas($(el)[0]).then(function(canvas){const image=canvas.toDataURL();const byteString=atob(image.substring(22));const buffer=new ArrayBuffer(byteString.length);const intArray=new Uint8Array(buffer);for(let i=0;i1||rowspan>1){cellContent["colSpan"]=colspan||1;cellContent["rowSpan"]=rowspan||1}}else cellContent={text:" "};if(colselector.indexOf("th")>=0)cellContent["style"]="header";r.push(cellContent)});if(r.length)body.push(r);if(rLengthmw){if(w>pageFormats.a0[0]){rk="a0";ro="l"}for(let key in pageFormats){if(pageFormats.hasOwnProperty(key)){if(pageFormats[key][1]>w){rk=key;ro="l";if(pageFormats[key][0]>w)ro="p"}}}mw=w}}});defaults.jspdf.format=rk===""?"a4":rk;defaults.jspdf.orientation=ro===""?"w":ro}if(teOptions.doc==null){teOptions.doc=new jspdf.jsPDF(defaults.jspdf.orientation,defaults.jspdf.unit,defaults.jspdf.format);teOptions.wScaleFactor=1;teOptions.hScaleFactor=1;if(typeof defaults.jspdf.onDocCreated==="function")defaults.jspdf.onDocCreated(teOptions.doc)}jsPdfDefaultStyles.fontName=teOptions.doc.getFont().fontName;if(teOptions.outputImages===true)teOptions.images={};if(typeof teOptions.images!=="undefined"){$(el).filter(function(){return isVisible($(this))}).each(function(){let rowCount=0;ranges=[];if(defaults.exportHiddenCells===false){$hiddenTableElements=$(this).find("tr, th, td").filter(":hidden");checkCellVisibility=$hiddenTableElements.length>0}$head_rows=collectHeadRows($(this));$rows=collectRows($(this));$($rows).each(function(){ForEachVisibleCell(this,"td,th",$head_rows.length+rowCount,$head_rows.length+$rows.length,function(cell){collectImages(cell,$(cell).children(),teOptions)});rowCount++})});$head_rows=[];$rows=[]}loadImages(teOptions,function(){$(el).filter(function(){return isVisible($(this))}).each(function(){let colKey;rowIndex=0;ranges=[];if(defaults.exportHiddenCells===false){$hiddenTableElements=$(this).find("tr, th, td").filter(":hidden");checkCellVisibility=$hiddenTableElements.length>0}colNames=GetColumnNames(this);teOptions.columns=[];teOptions.rows=[];teOptions.teCells={};if(typeof teOptions.onTable==="function")if(teOptions.onTable($(this),defaults)===false)return true;defaults.jspdf.autotable.tableExport=null;const atOptions=$.extend(true,{},defaults.jspdf.autotable);defaults.jspdf.autotable.tableExport=teOptions;atOptions.margin={};$.extend(true,atOptions.margin,defaults.jspdf.margins);atOptions.tableExport=teOptions;if(typeof atOptions.createdHeaderCell!=="function"){atOptions.createdHeaderCell=function(cell,data){if(typeof teOptions.columns[data.column.dataKey]!=="undefined"){const col=teOptions.columns[data.column.dataKey];if(typeof col.rect!=="undefined"){let rh;cell.contentWidth=col.rect.width;if(typeof teOptions.heightRatio==="undefined"||teOptions.heightRatio===0){if(data.row.raw[data.column.dataKey].rowspan)rh=data.row.raw[data.column.dataKey].rect.height/data.row.raw[data.column.dataKey].rowspan;else rh=data.row.raw[data.column.dataKey].rect.height;teOptions.heightRatio=cell.styles.rowHeight/rh}rh=data.row.raw[data.column.dataKey].rect.height*teOptions.heightRatio;if(rh>cell.styles.rowHeight)cell.styles.rowHeight=rh}cell.styles.halign=atOptions.headerStyles.halign==="inherit"?"center":atOptions.headerStyles.halign;cell.styles.valign=atOptions.headerStyles.valign;if(typeof col.style!=="undefined"&&col.style.hidden!==true){if(atOptions.headerStyles.halign==="inherit")cell.styles.halign=col.style.align;if(atOptions.styles.fillColor==="inherit")cell.styles.fillColor=col.style.bcolor;if(atOptions.styles.textColor==="inherit")cell.styles.textColor=col.style.color;if(atOptions.styles.fontStyle==="inherit")cell.styles.fontStyle=col.style.fstyle}}}}if(typeof atOptions.createdCell!=="function"){atOptions.createdCell=function(cell,data){const tecell=teOptions.teCells[data.row.index+":"+data.column.dataKey];cell.styles.halign=atOptions.styles.halign==="inherit"?"center":atOptions.styles.halign;cell.styles.valign=atOptions.styles.valign;if(typeof tecell!=="undefined"&&typeof tecell.style!=="undefined"&&tecell.style.hidden!==true){if(atOptions.styles.halign==="inherit")cell.styles.halign=tecell.style.align;if(atOptions.styles.fillColor==="inherit")cell.styles.fillColor=tecell.style.bcolor;if(atOptions.styles.textColor==="inherit")cell.styles.textColor=tecell.style.color;if(atOptions.styles.fontStyle==="inherit")cell.styles.fontStyle=tecell.style.fstyle}}}if(typeof atOptions.drawHeaderCell!=="function"){atOptions.drawHeaderCell=function(cell,data){const colopt=teOptions.columns[data.column.dataKey];if((colopt.style.hasOwnProperty("hidden")!==true||colopt.style.hidden!==true)&&colopt.rowIndex>=0)return prepareAutoTableText(cell,data,colopt);else return false}}if(typeof atOptions.drawCell!=="function"){atOptions.drawCell=function(cell,data){const teCell=teOptions.teCells[data.row.index+":"+data.column.dataKey];const draw2canvas=typeof teCell!=="undefined"&&teCell.isCanvas;if(draw2canvas!==true){if(prepareAutoTableText(cell,data,teCell)){teOptions.doc.rect(cell.x,cell.y,cell.width,cell.height,cell.styles.fillStyle);if(typeof teCell!=="undefined"&&(typeof teCell.hasUserDefText==="undefined"||teCell.hasUserDefText!==true)&&typeof teCell.elements!=="undefined"&&teCell.elements.length){const hScale=cell.height/teCell.rect.height;if(hScale>teOptions.hScaleFactor)teOptions.hScaleFactor=hScale;teOptions.wScaleFactor=cell.width/teCell.rect.width;const ySave=cell.textPos.y;drawAutotableElements(cell,teCell.elements,teOptions);cell.textPos.y=ySave;drawAutotableText(cell,teCell.elements,teOptions)}else drawAutotableText(cell,{},teOptions)}}else{const container=teCell.elements[0];const imgId=$(container).attr("data-tableexport-canvas");const r=container.getBoundingClientRect();cell.width=r.width*teOptions.wScaleFactor;cell.height=r.height*teOptions.hScaleFactor;data.row.height=cell.height;jsPdfDrawImage(cell,container,imgId,teOptions)}return false}}teOptions.headerrows=[];$head_rows=collectHeadRows($(this));$($head_rows).each(function(){colKey=0;teOptions.headerrows[rowIndex]=[];ForEachVisibleCell(this,"th,td",rowIndex,$head_rows.length,function(cell,row,col){const obj=getCellStyles(cell);obj.title=parseString(cell,row,col);obj.key=colKey++;obj.rowIndex=rowIndex;teOptions.headerrows[rowIndex].push(obj)});rowIndex++});if(rowIndex>0){let lastrow=rowIndex-1;while(lastrow>=0){$.each(teOptions.headerrows[lastrow],function(){let obj=this;if(lastrow>0&&this.rect===null)obj=teOptions.headerrows[lastrow-1][this.key];if(obj!==null&&obj.rowIndex>=0&&(obj.style.hasOwnProperty("hidden")!==true||obj.style.hidden!==true))teOptions.columns.push(obj)});lastrow=teOptions.columns.length>0?-1:lastrow-1}}let rowCount=0;$rows=[];$rows=collectRows($(this));$($rows).each(function(){const rowData=[];colKey=0;ForEachVisibleCell(this,"td,th",rowIndex,$head_rows.length+$rows.length,function(cell,row,col){let obj;if(typeof teOptions.columns[colKey]==="undefined"){obj={title:"",key:colKey,style:{hidden:true}};teOptions.columns.push(obj)}rowData.push(parseString(cell,row,col));if(typeof cell!=="undefined"&&cell!==null){obj=getCellStyles(cell);obj.isCanvas=cell.hasAttribute("data-tableexport-canvas");obj.elements=obj.isCanvas?$(cell):$(cell).children();if(typeof $(cell).data("teUserDefText")!=="undefined")obj.hasUserDefText=true;teOptions.teCells[rowCount+":"+colKey++]=obj}else{obj=$.extend(true,{},teOptions.teCells[rowCount+":"+(colKey-1)]);obj.colspan=-1;teOptions.teCells[rowCount+":"+colKey++]=obj}});if(rowData.length){teOptions.rows.push(rowData);rowCount++}rowIndex++});if(typeof teOptions.onBeforeAutotable==="function")teOptions.onBeforeAutotable($(this),teOptions.columns,teOptions.rows,atOptions);jsPdfAutoTable(atOptions.tableExport.doc,teOptions.columns,teOptions.rows,atOptions);if(typeof teOptions.onAfterAutotable==="function")teOptions.onAfterAutotable($(this),atOptions);defaults.jspdf.autotable.startY=jsPdfAutoTableEndPosY()+atOptions.margin.top});jsPdfOutput(teOptions.doc,typeof teOptions.images!=="undefined"&&jQuery.isEmptyObject(teOptions.images)===false);if(typeof teOptions.headerrows!=="undefined")teOptions.headerrows.length=0;if(typeof teOptions.columns!=="undefined")teOptions.columns.length=0;if(typeof teOptions.rows!=="undefined")teOptions.rows.length=0;delete teOptions.doc;teOptions.doc=null})}}function collectHeadRows($table){const result=[];findTableElements($table,"thead").each(function(){result.push.apply(result,findTableElements($(this),defaults.theadSelector).toArray())});return result}function collectRows($table){const result=[];findTableElements($table,"tbody").each(function(){result.push.apply(result,findTableElements($(this),defaults.tbodySelector).toArray())});if(defaults.tfootSelector.length){findTableElements($table,"tfoot").each(function(){result.push.apply(result,findTableElements($(this),defaults.tfootSelector).toArray())})}return result}function findTableElements($parent,selector){const parentSelector=$parent[0].tagName;const parentLevel=$parent.parents(parentSelector).length;return $parent.find(selector).filter(function(){return parentLevel===$(this).closest(parentSelector).parents(parentSelector).length})}function GetColumnNames(table){const result=[];let maxCols=0;let row=0;let col=0;$(table).find("thead").first().find("th").each(function(index,el){const hasDataField=$(el).attr("data-field")!==undefined;if(typeof el.parentNode.rowIndex!=="undefined"&&row!==el.parentNode.rowIndex){row=el.parentNode.rowIndex;col=0;maxCols=0}const colSpan=getColspan(el);maxCols+=colSpan?colSpan:1;while(col0){if($.inArray(colIndex,defaults.ignoreColumn)!==-1||$.inArray(colIndex-rowLength,defaults.ignoreColumn)!==-1||colNames.length>colIndex&&typeof colNames[colIndex]!=="undefined"&&$.inArray(colNames[colIndex],defaults.ignoreColumn)!==-1)result=true}}else result=true;return result}function ForEachVisibleCell(tableRow,selector,rowIndex,rowCount,cellcallback){if(typeof cellcallback==="function"){let ignoreRow=false;if(typeof defaults.onIgnoreRow==="function")ignoreRow=defaults.onIgnoreRow($(tableRow),rowIndex);if(ignoreRow===false&&(defaults.ignoreRow.length===0||$.inArray(rowIndex,defaults.ignoreRow)===-1&&$.inArray(rowIndex-rowCount,defaults.ignoreRow)===-1)&&isVisible($(tableRow))){const $cells=findTableElements($(tableRow),selector);let cellsCount=$cells.length;let colCount=0;let colIndex=0;$cells.each(function(){const $cell=$(this);let colspan=getColspan(this);let rowspan=getRowspan(this);let c;$.each(ranges,function(){const range=this;if(rowIndex>range.s.r&&rowIndex<=range.e.r&&colCount>=range.s.c&&colCount<=range.e.c){for(c=0;c<=range.e.c-range.s.c;++c){cellsCount++;colIndex++;cellcallback(null,rowIndex,colCount++)}}});if(rowspan||colspan){rowspan=rowspan||1;colspan=colspan||1;ranges.push({s:{r:rowIndex,c:colCount},e:{r:rowIndex+rowspan-1,c:colCount+colspan-1}})}if(isColumnIgnored($cell,cellsCount,colIndex++)===false){cellcallback(this,rowIndex,colCount++)}if(colspan>1){for(c=0;c=range.s.r&&rowIndex<=range.e.r&&colCount>=range.s.c&&colCount<=range.e.c){for(let c=0;c<=range.e.c-range.s.c;++c){cellcallback(null,rowIndex,colCount++)}}})}}}function jsPdfDrawImage(cell,container,imgId,teOptions){if(typeof teOptions.images!=="undefined"){const image=teOptions.images[imgId];if(typeof image!=="undefined"){const r=container.getBoundingClientRect();const arCell=cell.width/cell.height;const arImg=r.width/r.height;let imgWidth=cell.width;let imgHeight=cell.height;const px2pt=.264583*72/25.4;let uy=0;if(arImg<=arCell){imgHeight=Math.min(cell.height,r.height);imgWidth=r.width*imgHeight/r.height}else if(arImg>arCell){imgWidth=Math.min(cell.width,r.width);imgHeight=r.height*imgWidth/r.width}imgWidth*=px2pt;imgHeight*=px2pt;if(imgHeight=0){let cellWidth=cell.width;let textPosX=cell.textPos.x;const i=data.table.columns.indexOf(data.column);for(let c=1;c1){if(cell.styles.halign==="right")textPosX=cell.textPos.x+cellWidth-cell.width;else if(cell.styles.halign==="center")textPosX=cell.textPos.x+(cellWidth-cell.width)/2}cell.width=cellWidth;cell.textPos.x=textPosX;if(typeof cellopt!=="undefined"&&cellopt.rowspan>1)cell.height=cell.height*cellopt.rowspan;if(cell.styles.valign==="middle"||cell.styles.valign==="bottom"){const splittedText=typeof cell.text==="string"?cell.text.split(/\r\n|\r|\n/g):cell.text;const lineCount=splittedText.length||1;if(lineCount>2)cell.textPos.y-=(2-FONT_ROW_RATIO)/2*data.row.styles.fontSize*(lineCount-2)/3}return true}else return false}function collectImages(cell,elements,teOptions){if(typeof cell!=="undefined"&&cell!==null){if(cell.hasAttribute("data-tableexport-canvas")){const imgId=(new Date).getTime();$(cell).attr("data-tableexport-canvas",imgId);teOptions.images[imgId]={url:'[data-tableexport-canvas="'+imgId+'"]',src:null}}else if(elements!=="undefined"&&elements!=null){elements.each(function(){if($(this).is("img")){const imgId=strHashCode(this.src);teOptions.images[imgId]={url:this.src,src:this.src}}collectImages(cell,$(this).children(),teOptions)})}}}function loadImages(teOptions,callback){let imageCount=0;let pendingCount=0;function done(){callback(imageCount)}function loadImage(image){if(image.url){if(!image.src){const $imgContainer=$(image.url);if($imgContainer.length){imageCount=++pendingCount;html2canvas($imgContainer[0]).then(function(canvas){image.src=canvas.toDataURL("image/png");if(!--pendingCount)done()})}}else{const img=new Image;imageCount=++pendingCount;img.crossOrigin="Anonymous";img.onerror=img.onload=function(){if(img.complete){if(img.src.indexOf("data:image/")===0){img.width=image.width||img.width||0;img.height=image.height||img.height||0}if(img.width+img.height){const canvas=document.createElement("canvas");const ctx=canvas.getContext("2d");canvas.width=img.width;canvas.height=img.height;ctx.drawImage(img,0,0);image.src=canvas.toDataURL("image/png")}}if(!--pendingCount)done()};img.src=image.url}}}if(typeof teOptions.images!=="undefined"){for(let i in teOptions.images)if(teOptions.images.hasOwnProperty(i))loadImage(teOptions.images[i])}return pendingCount||done()}function drawAutotableElements(cell,elements,teOptions){elements.each(function(){if($(this).is("div")){const bColor=rgb2array(getStyle(this,"background-color"),[255,255,255]);const lColor=rgb2array(getStyle(this,"border-top-color"),[0,0,0]);const lWidth=getPropertyUnitValue(this,"border-top-width",defaults.jspdf.unit);const r=this.getBoundingClientRect();const ux=this.offsetLeft*teOptions.wScaleFactor;const uy=this.offsetTop*teOptions.hScaleFactor;const uw=r.width*teOptions.wScaleFactor;const uh=r.height*teOptions.hScaleFactor;teOptions.doc.setDrawColor.apply(undefined,lColor);teOptions.doc.setFillColor.apply(undefined,bColor);teOptions.doc.setLineWidth(lWidth);teOptions.doc.rect(cell.x+ux,cell.y+uy,uw,uh,lWidth?"FD":"F")}else if($(this).is("img")){const imgId=strHashCode(this.src);jsPdfDrawImage(cell,this,imgId,teOptions)}drawAutotableElements(cell,$(this).children(),teOptions)})}function drawAutotableText(cell,texttags,teOptions){if(typeof teOptions.onAutotableText==="function"){teOptions.onAutotableText(teOptions.doc,cell,texttags)}else{let x=cell.textPos.x;let y=cell.textPos.y;const style={halign:cell.styles.halign,valign:cell.styles.valign};if(texttags.length){let tag=texttags[0];while(tag.previousSibling)tag=tag.previousSibling;let b=false,i=false;while(tag){let txt=tag.innerText||tag.textContent||"";const leadingSpace=txt.length&&txt[0]===" "?" ":"";const trailingSpace=txt.length>1&&txt[txt.length-1]===" "?" ":"";if(defaults.preserve.leadingWS!==true)txt=leadingSpace+trimLeft(txt);if(defaults.preserve.trailingWS!==true)txt=trimRight(txt)+trailingSpace;if($(tag).is("br")){x=cell.textPos.x;y+=teOptions.doc.internal.getFontSize()}if($(tag).is("b"))b=true;else if($(tag).is("i"))i=true;if(b||i)teOptions.doc.setFont("undefined ",b&&i?"bolditalic":b?"bold":"italic");let w=teOptions.doc.getStringUnitWidth(txt)*teOptions.doc.internal.getFontSize();if(w){if(cell.styles.overflow==="linebreak"&&x>cell.textPos.x&&x+w>cell.textPos.x+cell.width){const chars=".,!%*;:=-";if(chars.indexOf(txt.charAt(0))>=0){const s=txt.charAt(0);w=teOptions.doc.getStringUnitWidth(s)*teOptions.doc.internal.getFontSize();if(x+w<=cell.textPos.x+cell.width){jsPdfAutoTableText(s,x,y,style);txt=txt.substring(1,txt.length)}w=teOptions.doc.getStringUnitWidth(txt)*teOptions.doc.internal.getFontSize()}x=cell.textPos.x;y+=teOptions.doc.internal.getFontSize()}if(cell.styles.overflow!=="visible"){while(txt.length&&x+w>cell.textPos.x+cell.width){txt=txt.substring(0,txt.length-1);w=teOptions.doc.getStringUnitWidth(txt)*teOptions.doc.internal.getFontSize()}}jsPdfAutoTableText(txt,x,y,style);x+=w}if(b||i){if($(tag).is("b"))b=false;else if($(tag).is("i"))i=false;teOptions.doc.setFont("undefined ",!b&&!i?"normal":b?"bold":"italic")}tag=tag.nextSibling}cell.textPos.x=x;cell.textPos.y=y}else{jsPdfAutoTableText(cell.text,cell.textPos.x,cell.textPos.y,style)}}}function escapeRegExp(string){return string==null?"":string.toString().replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")}function replaceAll(string,find,replace){return string==null?"":string.toString().replace(new RegExp(escapeRegExp(find),"g"),replace)}function trimLeft(string){return string==null?"":string.toString().replace(/^\s+/,"")}function trimRight(string){return string==null?"":string.toString().replace(/\s+$/,"")}function parseDateUTC(s){if(defaults.date.html.length===0)return false;defaults.date.pattern.lastIndex=0;const match=defaults.date.pattern.exec(s);if(match==null)return false;const y=+match[defaults.date.match_y];if(y<0||y>8099)return false;const m=match[defaults.date.match_m]*1;const d=match[defaults.date.match_d]*1;if(!isFinite(d))return false;const o=new Date(y,m-1,d,0,0,0);if(o.getFullYear()===y&&o.getMonth()===m-1&&o.getDate()===d)return new Date(Date.UTC(y,m-1,d,0,0,0));else return false}function parseNumber(value){value=value||"0";if(""!==defaults.numbers.html.thousandsSeparator)value=replaceAll(value,defaults.numbers.html.thousandsSeparator,"");if("."!==defaults.numbers.html.decimalMark)value=replaceAll(value,defaults.numbers.html.decimalMark,".");return typeof value==="number"||jQuery.isNumeric(value)!==false?value:false}function parsePercent(value){if(value.indexOf("%")>-1){value=parseNumber(value.replace(/%/g,""));if(value!==false)value=value/100}else value=false;return value}function parseString(cell,rowIndex,colIndex,cellInfo){let result="";let cellType="text";if(cell!==null){const $cell=$(cell);let htmlData;$cell.removeData("teUserDefText");if($cell[0].hasAttribute("data-tableexport-canvas")){htmlData=""}else if($cell[0].hasAttribute("data-tableexport-value")){htmlData=$cell.attr("data-tableexport-value");htmlData=htmlData?htmlData+"":"";$cell.data("teUserDefText",1)}else{htmlData=$cell.html();if(typeof defaults.onCellHtmlData==="function"){htmlData=defaults.onCellHtmlData($cell,rowIndex,colIndex,htmlData);$cell.data("teUserDefText",1)}else if(htmlData!==""){const html=$.parseHTML("
"+htmlData+"
",null,false);let inputIndex=0;let selectIndex=0;htmlData="";$.each(html,function(){if($(this).is("input")){htmlData+=$cell.find("input").eq(inputIndex++).val()}else if($(this).is("select")){htmlData+=$cell.find("select option:selected").eq(selectIndex++).text()}else if($(this).is("br")){htmlData+="
"}else{if(typeof $(this).html()==="undefined")htmlData+=$(this).text();else if(jQuery().bootstrapTable===undefined||$(this).hasClass("fht-cell")===false&&$(this).hasClass("filterControl")===false&&$cell.parents(".detail-view").length===0)htmlData+=$(this).html();if($(this).is("a")){const href=$cell.find("a").attr("href")||"";if(typeof defaults.onCellHtmlHyperlink==="function"){result+=defaults.onCellHtmlHyperlink($cell,rowIndex,colIndex,href,htmlData)}else if(defaults.htmlHyperlink==="href"){result+=href}else{result+=htmlData}htmlData=""}}})}}if(htmlData&&htmlData!==""&&defaults.htmlContent===true){result=$.trim(htmlData)}else if(htmlData&&htmlData!==""){const cellFormat=$cell.attr("data-tableexport-cellformat");if(cellFormat!==""){let text=htmlData.replace(/\n/g,"\u2028").replace(/(<\s*br([^>]*)>)/gi,"⁠");const obj=$("
").html(text).contents();let number=false;text="";$.each(obj.text().split("\u2028"),function(i,v){if(i>0)text+=" ";if(defaults.preserve.leadingWS!==true)v=trimLeft(v);text+=defaults.preserve.trailingWS!==true?trimRight(v):v});$.each(text.split("⁠"),function(i,v){if(i>0)result+="\n";if(defaults.preserve.leadingWS!==true)v=trimLeft(v);if(defaults.preserve.trailingWS!==true)v=trimRight(v);result+=v.replace(/\u00AD/g,"")});result=result.replace(/\u00A0/g," ");if(defaults.type==="json"||defaults.type==="excel"&&defaults.mso.fileFormat==="xmlss"||defaults.numbers.output===false){number=parseNumber(result);if(number!==false){cellType="number";result=Number(number)}}else if(defaults.numbers.html.decimalMark!==defaults.numbers.output.decimalMark||defaults.numbers.html.thousandsSeparator!==defaults.numbers.output.thousandsSeparator){number=parseNumber(result);if(number!==false){const frac=(""+number.substr(number<0?1:0)).split(".");if(frac.length===1)frac[1]="";const mod=frac[0].length>3?frac[0].length%3:0;cellType="number";result=(number<0?"-":"")+(defaults.numbers.output.thousandsSeparator?(mod?frac[0].substr(0,mod)+defaults.numbers.output.thousandsSeparator:"")+frac[0].substr(mod).replace(/(\d{3})(?=\d)/g,"$1"+defaults.numbers.output.thousandsSeparator):frac[0])+(frac[1].length?defaults.numbers.output.decimalMark+frac[1]:"")}}}else result=htmlData}if(defaults.escape===true){result=escape(result)}if(typeof defaults.onCellData==="function"){result=defaults.onCellData($cell,rowIndex,colIndex,result,cellType);$cell.data("teUserDefText",1)}}if(cellInfo!==undefined)cellInfo.type=cellType;return result}function preventInjection(str){if(str.length>0&&defaults.preventInjection===true){const chars="=+-@";if(chars.indexOf(str.charAt(0))>=0)return"'"+str}return str}function hyphenate(a,b,c){return b+"-"+c.toLowerCase()}function rgb2array(rgb_string,default_result){const re=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/;const bits=re.exec(rgb_string);let result=default_result;if(bits)result=[parseInt(bits[1]),parseInt(bits[2]),parseInt(bits[3])];return result}function getCellStyles(cell){let a=getStyle(cell,"text-align");const fw=getStyle(cell,"font-weight");const fs=getStyle(cell,"font-style");let f="";if(a==="start")a=getStyle(cell,"direction")==="rtl"?"right":"left";if(fw>=700)f="bold";if(fs==="italic")f+=fs;if(f==="")f="normal";const result={style:{align:a,bcolor:rgb2array(getStyle(cell,"background-color"),[255,255,255]),color:rgb2array(getStyle(cell,"color"),[0,0,0]),fstyle:f},colspan:getColspan(cell),rowspan:getRowspan(cell)};if(cell!==null){const r=cell.getBoundingClientRect();result.rect={width:r.width,height:r.height}}return result}function getColspan(cell){let result=$(cell).attr("data-tableexport-colspan");if(typeof result==="undefined"&&$(cell).is("[colspan]"))result=$(cell).attr("colspan");return parseInt(result)||0}function getRowspan(cell){let result=$(cell).attr("data-tableexport-rowspan");if(typeof result==="undefined"&&$(cell).is("[rowspan]"))result=$(cell).attr("rowspan");return parseInt(result)||0}function getStyle(target,prop){try{if(window.getComputedStyle){prop=prop.replace(/([a-z])([A-Z])/,hyphenate);return window.getComputedStyle(target,null).getPropertyValue(prop)}if(target.currentStyle){return target.currentStyle[prop]}return target.style[prop]}catch(e){}return""}function getUnitValue(parent,value,unit){const baseline=100;const temp=document.createElement("div");temp.style.overflow="hidden";temp.style.visibility="hidden";parent.appendChild(temp);temp.style.width=baseline+unit;const factor=baseline/temp.offsetWidth;parent.removeChild(temp);return value*factor}function getPropertyUnitValue(target,prop,unit){const value=getStyle(target,prop);let numeric=value.match(/\d+/);if(numeric!==null){numeric=numeric[0];return getUnitValue(target.parentElement,numeric,unit)}return 0}function xlsxWorkbookToArrayBuffer(s){const buf=new ArrayBuffer(s.length);const view=new Uint8Array(buf);for(let i=0;i!==s.length;++i)view[i]=s.charCodeAt(i)&255;return buf}function xlsxTableToSheet(table){let ssfId;const ws={};const rows=table.getElementsByTagName("tr");const sheetRows=Math.min(1e7,rows.length);const range={s:{r:0,c:0},e:{r:0,c:0}};let merges=[],midx=0;let _R=0,R=0,_C=0,C=0,RS=0,CS=0;let elt;const ssfTable=XLSX.SSF.get_table();for(;_R0||CS>1)merges.push({s:{r:R,c:C},e:{r:R+(RS||1)-1,c:C+CS-1}});const cellInfo={type:""};let v=parseString(elt,_R,_C+CSOffset,cellInfo);let o={t:"s",v:v};let _t="";const cellFormat=$(elt).attr("data-tableexport-cellformat")||undefined;if(cellFormat!==""){ssfId=parseInt($(elt).attr("data-tableexport-xlsxformatid")||0);if(ssfId===0&&typeof defaults.mso.xlsx.formatId.numbers==="function")ssfId=defaults.mso.xlsx.formatId.numbers($(elt),_R,_C+CSOffset);if(ssfId===0&&typeof defaults.mso.xlsx.formatId.date==="function")ssfId=defaults.mso.xlsx.formatId.date($(elt),_R,_C+CSOffset);if(ssfId===49||ssfId==="@")_t="s";else if(cellInfo.type==="number"||ssfId>0&&ssfId<14||ssfId>36&&ssfId<41||ssfId===48)_t="n";else if(cellInfo.type==="date"||ssfId>13&&ssfId<37||ssfId>44&&ssfId<48||ssfId===56)_t="d"}else _t="s";if(v!=null){let vd;if(v.length===0){o.t="z"}else if(v.trim().length===0){}else if(_t==="s"){}else if(cellInfo.type==="function"){o={f:v}}else if(v==="TRUE"){o={t:"b",v:true}}else if(v==="FALSE"){o={t:"b",v:false}}else if(_t==="n"||isFinite(xlsxToNumber(v,defaults.numbers.output))){const vn=xlsxToNumber(v,defaults.numbers.output);if(ssfId===0&&typeof defaults.mso.xlsx.formatId.numbers!=="function"){ssfId=defaults.mso.xlsx.formatId.numbers}if(isFinite(vn)||isFinite(v))o={t:"n",v:isFinite(vn)?vn:v,z:typeof ssfId==="string"?ssfId:ssfId in ssfTable?ssfTable[ssfId]:ssfId===defaults.mso.xlsx.formatId.currency?defaults.mso.xlsx.format.currency:"0.00"}}else if((vd=parseDateUTC(v))!==false||_t==="d"){if(ssfId===0&&typeof defaults.mso.xlsx.formatId.date!=="function"){ssfId=defaults.mso.xlsx.formatId.date}o={t:"d",v:vd!==false?vd:v,z:typeof ssfId==="string"?ssfId:ssfId in ssfTable?ssfTable[ssfId]:"m/d/yy"}}const $aTag=$(elt).find("a");if($aTag&&$aTag.length){const href=$aTag[0].hasAttribute("href")?$aTag.attr("href"):"";const content=defaults.htmlHyperlink!=="href"||href===""?v:"";const hyperlink=href!==""?'=HYPERLINK("'+href+(content.length?'","'+content:"")+'")':"";if(hyperlink!==""){if(typeof defaults.mso.xlsx.onHyperlink==="function"){v=defaults.mso.xlsx.onHyperlink($(elt),_R,_C,href,content,hyperlink);if(v.indexOf("=HYPERLINK")!==0){o={t:"s",v:v}}else{o={f:v}}}else{o={f:hyperlink}}}}}ws[xlsxEncodeCell({c:C,r:R})]=o;if(range.e.c=sheetRows){ws["!fullref"]=xlsxEncodeRange((range.e.r=rows.length-_R+R-1,range))}return ws}function xlsxEncodeRow(row){return""+(row+1)}function xlsxEncodeCol(col){let s="";for(++col;col;col=Math.floor((col-1)/26)){s=String.fromCharCode((col-1)%26+65)+s}return s}function xlsxEncodeCell(cell){return xlsxEncodeCol(cell.c)+xlsxEncodeRow(cell.r)}function xlsxEncodeRange(cs,ce){if(typeof ce==="undefined"||typeof ce==="number"){return xlsxEncodeRange(cs.s,cs.e)}if(typeof cs!=="string"){cs=xlsxEncodeCell(cs)}if(typeof ce!=="string"){ce=xlsxEncodeCell(ce)}return cs===ce?cs:cs+":"+ce}function xlsxToNumber(s,numbersFormat){let v=Number(s);if(isFinite(v))return v;let wt=1;let ss=s;if(""!==numbersFormat.thousandsSeparator)ss=ss.replace(new RegExp("([\\d])"+numbersFormat.thousandsSeparator+"([\\d])","g"),"$1$2");if("."!==numbersFormat.decimalMark)ss=ss.replace(new RegExp("([\\d])"+numbersFormat.decimalMark+"([\\d])","g"),"$1.$2");ss=ss.replace(/[$]/g,"").replace(/[%]/g,function(){wt*=100;return""});if(isFinite(v=Number(ss)))return v/wt;ss=ss.replace(/[(](.*)[)]/,function($$,$1){wt=-wt;return $1});if(isFinite(v=Number(ss)))return v/wt;return v}function strHashCode(str){let hash=0,i,chr,len;if(str.length===0)return hash;for(i=0,len=str.length;i0||!!ua.match(/Trident.*rv\:11\./))){const frame=document.createElement("iframe");if(frame){document.body.appendChild(frame);frame.setAttribute("style","display:none");frame.contentDocument.open("txt/plain","replace");frame.contentDocument.write(data);frame.contentDocument.close();frame.contentWindow.focus();const extension=filename.substr(filename.lastIndexOf(".")+1);switch(extension){case"doc":case"json":case"png":case"pdf":case"xls":case"xlsx":filename+=".txt";break}frame.contentDocument.execCommand("SaveAs",true,filename);document.body.removeChild(frame)}}else{const DownloadLink=document.createElement("a");if(DownloadLink){let blobUrl=null;DownloadLink.style.display="none";if(filename!==false)DownloadLink.download=filename;else DownloadLink.target="_blank";if(typeof data==="object"){window.URL=window.URL||window.webkitURL;const binaryData=[];binaryData.push(data);blobUrl=window.URL.createObjectURL(new Blob(binaryData,{type:header}));DownloadLink.href=blobUrl}else if(header.toLowerCase().indexOf("base64,")>=0){DownloadLink.href=header+base64encode(data)}else{DownloadLink.href=header+encodeURIComponent(data)}document.body.appendChild(DownloadLink);if(document.createEvent){if(DownloadEvt===null)DownloadEvt=document.createEvent("MouseEvents");DownloadEvt.initEvent("click",true,false);DownloadLink.dispatchEvent(DownloadEvt)}else if(document.createEventObject)DownloadLink.fireEvent("onclick");else if(typeof DownloadLink.onclick==="function")DownloadLink.onclick();setTimeout(function(){if(blobUrl)window.URL.revokeObjectURL(blobUrl);document.body.removeChild(DownloadLink);if(typeof defaults.onAfterSaveToFile==="function")defaults.onAfterSaveToFile(data,filename)},100)}}}function utf8Encode(text){if(typeof text==="string"){text=text.replace(/\x0d\x0a/g,"\n");let utfText="";for(let n=0;n127&&c<2048){utfText+=String.fromCharCode(c>>6|192);utfText+=String.fromCharCode(c&63|128)}else{utfText+=String.fromCharCode(c>>12|224);utfText+=String.fromCharCode(c>>6&63|128);utfText+=String.fromCharCode(c&63|128)}}return utfText}return text}function base64encode(input){let chr1,chr2,chr3,enc1,enc2,enc3,enc4;const keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let output="";let i=0;input=utf8Encode(input);while(i>2;enc2=(chr1&3)<<4|chr2>>4;enc3=(chr2&15)<<2|chr3>>6;enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64}else if(isNaN(chr3)){enc4=64}output=output+keyStr.charAt(enc1)+keyStr.charAt(enc2)+keyStr.charAt(enc3)+keyStr.charAt(enc4)}return output}var jsPdfDoc,jsPdfCursor,jsPdfSettings,jsPdfPageCount,jsPdfTable;function jsPdfAutoTable(doc,headers,data,options){jsPdfValidateInput(headers,data,options);jsPdfDoc=doc;jsPdfSettings=jsPdfInitOptions(options||{});jsPdfPageCount=1;jsPdfCursor={y:jsPdfSettings.startY===false?jsPdfSettings.margin.top:jsPdfSettings.startY};const userStyles={textColor:30,fontSize:jsPdfDoc.internal.getFontSize(),fontStyle:jsPdfDoc.internal.getFont().fontStyle,fontName:jsPdfDoc.internal.getFont().fontName};jsPdfCreateModels(headers,data);jsPdfCalculateWidths();const firstRowHeight=jsPdfTable.rows[0]&&jsPdfSettings.pageBreak==="auto"?jsPdfTable.rows[0].height:0;let minTableBottomPos=jsPdfSettings.startY+jsPdfSettings.margin.bottom+jsPdfTable.headerRow.height+firstRowHeight;if(jsPdfSettings.pageBreak==="avoid"){minTableBottomPos+=jsPdfTable.height}if(jsPdfSettings.pageBreak==="always"&&jsPdfSettings.startY!==false||jsPdfSettings.startY!==false&&minTableBottomPos>jsPdfDoc.internal.pageSize.height){jsPdfDoc.addPage();jsPdfCursor.y=jsPdfSettings.margin.top}jsPdfApplyStyles(userStyles);jsPdfSettings.beforePageContent(jsPdfHooksData());if(jsPdfSettings.drawHeaderRow(jsPdfTable.headerRow,jsPdfHooksData({row:jsPdfTable.headerRow}))!==false){jsPdfPrintRow(jsPdfTable.headerRow,jsPdfSettings.drawHeaderCell)}jsPdfApplyStyles(userStyles);jsPdfPrintRows();jsPdfSettings.afterPageContent(jsPdfHooksData());jsPdfApplyStyles(userStyles);return jsPdfDoc}function jsPdfAutoTableEndPosY(){if(typeof jsPdfCursor==="undefined"||typeof jsPdfCursor.y==="undefined"){return 0}return jsPdfCursor.y}function jsPdfAutoTableText(text,x,y,styles){if(typeof x!=="number"||typeof y!=="number"){console.error("The x and y parameters are required. Missing for the text: ",text)}const fontSize=jsPdfDoc.internal.getFontSize()/jsPdfDoc.internal.scaleFactor;const lineHeightProportion=FONT_ROW_RATIO;const splitRegex=/\r\n|\r|\n/g;let splittedText=null;let lineCount=1;if(styles.valign==="middle"||styles.valign==="bottom"||styles.halign==="center"||styles.halign==="right"){splittedText=typeof text==="string"?text.split(splitRegex):text;lineCount=splittedText.length||1}y+=fontSize*(2-lineHeightProportion);if(styles.valign==="middle")y-=lineCount/2*fontSize;else if(styles.valign==="bottom")y-=lineCount*fontSize;if(styles.halign==="center"||styles.halign==="right"){let alignSize=fontSize;if(styles.halign==="center")alignSize*=.5;if(splittedText&&lineCount>=1){for(let iLine=0;iLinecolumn.contentWidth){column.contentWidth=cellWidth}});column.width=column.contentWidth;tableContentWidth+=column.contentWidth});jsPdfTable.contentWidth=tableContentWidth;const maxTableWidth=jsPdfDoc.internal.pageSize.width-jsPdfSettings.margin.left-jsPdfSettings.margin.right;let preferredTableWidth=maxTableWidth;if(typeof jsPdfSettings.tableWidth==="number"){preferredTableWidth=jsPdfSettings.tableWidth}else if(jsPdfSettings.tableWidth==="wrap"){preferredTableWidth=jsPdfTable.contentWidth}jsPdfTable.width=preferredTableWidthjsPdfTable.width){column.width=column.contentWidth}else{dynamicColumns.push(column);dynamicColumnsContentWidth+=column.contentWidth;column.width=0}}staticWidth+=column.width});jsPdfDistributeWidth(dynamicColumns,staticWidth,dynamicColumnsContentWidth,fairWidth);jsPdfTable.height=0;const all=jsPdfTable.rows.concat(jsPdfTable.headerRow);all.forEach(function(row,i){let lineBreakCount=0;let cursorX=jsPdfTable.x;jsPdfTable.columns.forEach(function(col){const cell=row.cells[col.dataKey];col.x=cursorX;jsPdfApplyStyles(cell.styles);const textSpace=col.width-cell.styles.cellPadding*2;if(cell.styles.overflow==="linebreak"){cell.text=jsPdfDoc.splitTextToSize(cell.text,textSpace+1,{fontSize:cell.styles.fontSize})}else if(cell.styles.overflow==="ellipsize"){cell.text=jsPdfEllipsize(cell.text,textSpace,cell.styles)}else if(cell.styles.overflow==="visible"){}else if(cell.styles.overflow==="hidden"){cell.text=jsPdfEllipsize(cell.text,textSpace,cell.styles,"")}else if(typeof cell.styles.overflow==="function"){cell.text=cell.styles.overflow(cell.text,textSpace)}else{console.error("Unrecognized overflow type: "+cell.styles.overflow)}const count=Array.isArray(cell.text)?cell.text.length-1:0;if(count>lineBreakCount){lineBreakCount=count}cursorX+=col.width});row.heightStyle=row.styles.rowHeight;row.height=row.heightStyle+lineBreakCount*row.styles.fontSize*FONT_ROW_RATIO+(2-FONT_ROW_RATIO)/2*row.styles.fontSize;jsPdfTable.height+=row.height})}function jsPdfDistributeWidth(dynamicColumns,staticWidth,dynamicColumnsContentWidth,fairWidth){const extraWidth=jsPdfTable.width-staticWidth-dynamicColumnsContentWidth;for(let i=0;i=jsPdfDoc.internal.pageSize.height}function jsPdfPrintRow(row,hookHandler){for(let i=0;i=jsPdfGetStringWidth(text,styles)){return text}while(widthe&&"undefined"!==typeof fa[e]&&-1!==d.inArray(fa[e],b.ignoreColumn))&&(h=!0):h=!0;return h}function G(a,c,e,h,f){if("function"===typeof f){var x=!1;"function"===typeof b.onIgnoreRow&&(x=b.onIgnoreRow(d(a),e));if(!1===x&&(0===b.ignoreRow.length||-1===d.inArray(e,b.ignoreRow)&&-1===d.inArray(e-h,b.ignoreRow))&&O(d(a))){a= +P(d(a),c);var m=a.length,g=0,p=0;a.each(function(){var a=d(this),c=Q(this),b=ha(this),h;d.each(N,function(){if(e>this.s.r&&e<=this.e.r&&g>=this.s.c&&g<=this.e.c)for(h=0;h<=this.e.c-this.s.c;++h)m++,p++,f(null,e,g++)});if(b||c)c=c||1,N.push({s:{r:e,c:g},e:{r:e+(b||1)-1,c:g+c-1}});!1===Va(a,m,p++)&&f(this,e,g++);if(1=this.s.r&&e<=this.e.r&&g>=this.s.c&&g<=this.e.c)for(var a=0;a<=this.e.c-this.s.c;++a)f(null,e,g++)})}}}function Wa(a,c, +b,h){if("undefined"!==typeof h.images&&(b=h.images[b],"undefined"!==typeof b)){c=c.getBoundingClientRect();var e=a.width/a.height,d=c.width/c.height,m=a.width,g=a.height,p=19.049976/25.4,B=0;d<=e?(g=Math.min(a.height,c.height),m=c.width*g/c.height):d>e&&(m=Math.min(a.width,c.width),g=c.height*m/c.width);m*=p;g*=p;ga.textPos.x&&h+B>a.textPos.x+a.width&&(0<=".,!%*;:=-".indexOf(p.charAt(0))&&(z=p.charAt(0),B=e.doc.getStringUnitWidth(z)*e.doc.internal.getFontSize(),h+B<=a.textPos.x+a.width&&(za(z,h,f,x),p=p.substring(1,p.length)),B=e.doc.getStringUnitWidth(p)*e.doc.internal.getFontSize()),h=a.textPos.x,f+=e.doc.internal.getFontSize()); +if("visible"!==a.styles.overflow)for(;p.length&&h+B>a.textPos.x+a.width;)p=p.substring(0,p.length-1),B=e.doc.getStringUnitWidth(p)*e.doc.internal.getFontSize();za(p,h,f,x);h+=B}if(m||g)d(c).is("b")?m=!1:d(c).is("i")&&(g=!1),e.doc.setFont("undefined ",m||g?m?"bold":"italic":"normal");c=c.nextSibling}a.textPos.x=h;a.textPos.y=f}else za(a.text,a.textPos.x,a.textPos.y,x)}}function la(a,c,b){return null==a?"":a.toString().replace(new RegExp(null==c?"":c.toString().replace(/([.*+?^=!:${}()|\[\]\/\\])/g, +"\\$1"),"g"),b)}function Ha(a){return null==a?"":a.toString().replace(/^\s+/,"")}function Ia(a){return null==a?"":a.toString().replace(/\s+$/,"")}function ob(a){if(0===b.date.html.length)return!1;b.date.pattern.lastIndex=0;var c=b.date.pattern.exec(a);if(null==c)return!1;a=+c[b.date.match_y];if(0>a||8099"+g+"
",null,!1);var p=0,B=0;g="";d.each(a,function(){if(d(this).is("input"))g+=m.find("input").eq(p++).val();else if(d(this).is("select"))g+=m.find("select option:selected").eq(B++).text();else if(d(this).is("br"))g+="
";else{if("undefined"===typeof d(this).html())g+=d(this).text(); +else if(void 0===jQuery().bootstrapTable||!1===d(this).hasClass("fht-cell")&&!1===d(this).hasClass("filterControl")&&0===m.parents(".detail-view").length)g+=d(this).html();if(d(this).is("a")){var a=m.find("a").attr("href")||"";f="function"===typeof b.onCellHtmlHyperlink?f+b.onCellHtmlHyperlink(m,c,e,a,g):"href"===b.htmlHyperlink?f+a:f+g;g=""}}})}if(g&&""!==g&&!0===b.htmlContent)f=d.trim(g);else if(g&&""!==g)if(""!==m.attr("data-tableexport-cellformat")){var z=g.replace(/\n/g,"\u2028").replace(/(<\s*br([^>]*)>)/gi, +"\u2060"),k=d("
").html(z).contents();a=!1;z="";d.each(k.text().split("\u2028"),function(a,c){0a?1:0)).split(".");1===k.length&&(k[1]="");var l=3a?"-":"")+(b.numbers.output.thousandsSeparator?(l?k[0].substr(0,l)+b.numbers.output.thousandsSeparator:"")+k[0].substr(l).replace(/(\d{3})(?=\d)/g,"$1"+b.numbers.output.thousandsSeparator):k[0])+(k[1].length?b.numbers.output.decimalMark+ +k[1]:"")}}else f=g;!0===b.escape&&(f=escape(f));"function"===typeof b.onCellData&&(f=b.onCellData(m,c,e,f,x),m.data("teUserDefText",1))}void 0!==h&&(h.type=x);return f}function db(a){return 0x?f+=String.fromCharCode(x):(127x?f+=String.fromCharCode(x>>6|192):(f+=String.fromCharCode(x>>12|224),f+=String.fromCharCode(x>>6&63|128)),f+=String.fromCharCode(x&63|128))}a=f}for(;d>2;m=(m&3)<<4|f>>4;var g=(f&15)<<2|c>>6;var p=c&63;isNaN(f)?g=p=64:isNaN(c)&&(p=64);b=b+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(x)+ +"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(m)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(p)}return b}function sb(a,c,b,d){c&&"object"===typeof c||console.error("The headers should be an object or array, is: "+typeof c);b&&"object"===typeof b||console.error("The data should be an object or array, is: "+typeof b);d&&"object"!==typeof d&&console.error("The data should be an object or array, is: "+ +typeof b);Array.prototype.forEach||console.error("The current browser does not support Array.prototype.forEach which is required for jsPDF-AutoTable");y=a;l=tb(d||{});Ma=1;F={y:!1===l.startY?l.margin.top:l.startY};a={textColor:30,fontSize:y.internal.getFontSize(),fontStyle:y.internal.getFont().fontStyle,fontName:y.internal.getFont().fontName};ub(c,b);vb();c=l.startY+l.margin.bottom+q.headerRow.height+(q.rows[0]&&"auto"===l.pageBreak?q.rows[0].height:0);"avoid"===l.pageBreak&&(c+=q.height);if("always"=== +l.pageBreak&&!1!==l.startY||!1!==l.startY&&c>y.internal.pageSize.height)y.addPage(),F.y=l.margin.top;ma(a);l.beforePageContent(U());!1!==l.drawHeaderRow(q.headerRow,U({row:q.headerRow}))&&Na(q.headerRow,l.drawHeaderCell);ma(a);wb();l.afterPageContent(U());ma(a);return y}function za(a,c,b,d){"number"===typeof c&&"number"===typeof b||console.error("The x and y parameters are required. Missing for the text: ",a);var e=y.internal.getFontSize()/y.internal.scaleFactor,h=/\r\n|\r|\n/g,m=null,g=1;if("middle"=== +d.valign||"bottom"===d.valign||"center"===d.halign||"right"===d.halign)m="string"===typeof a?a.split(h):a,g=m.length||1;b+=e*(2-1.15);"middle"===d.valign?b-=g/2*e:"bottom"===d.valign&&(b-=g*e);if("center"===d.halign||"right"===d.halign){h=e;"center"===d.halign&&(h*=.5);if(m&&1<=g){for(a=0;ab.contentWidth&&(b.contentWidth=a)});b.width=b.contentWidth;a+=b.contentWidth});q.contentWidth=a;var b=y.internal.pageSize.width-l.margin.left-l.margin.right,d=b;"number"===typeof l.tableWidth?d=l.tableWidth:"wrap"===l.tableWidth&&(d=q.contentWidth);q.width=dq.width?a.width=a.contentWidth:(h.push(a),f+=a.contentWidth,a.width=0);m+=a.width});hb(h,m,f,k);q.height=0;q.rows.concat(q.headerRow).forEach(function(a,b){var c=0,d=q.x;q.columns.forEach(function(b){var e=a.cells[b.dataKey];b.x=d;ma(e.styles);var g=b.width- +2*e.styles.cellPadding;"linebreak"===e.styles.overflow?e.text=y.splitTextToSize(e.text,g+1,{fontSize:e.styles.fontSize}):"ellipsize"===e.styles.overflow?e.text=Oa(e.text,g,e.styles):"visible"!==e.styles.overflow&&("hidden"===e.styles.overflow?e.text=Oa(e.text,g,e.styles,""):"function"===typeof e.styles.overflow?e.text=e.styles.overflow(e.text,g):console.error("Unrecognized overflow type: "+e.styles.overflow));e=Array.isArray(e.text)?e.text.length-1:0;e>c&&(c=e);d+=b.width});a.heightStyle=a.styles.rowHeight; +a.height=a.heightStyle+c*a.styles.fontSize*1.15+(2-1.15)/2*a.styles.fontSize;q.height+=a.height})}function hb(a,b,d,h){for(var c=q.width-b-d,e=0;ec&&p){a.splice(e,1);d-=m.contentWidth;m.width=h;b+=m.width;hb(a,b,d,h);break}else m.width=m.contentWidth+c*g}}function wb(){q.rows.forEach(function(a,b){F.y+a.height+l.margin.bottom>=y.internal.pageSize.height&&(l.afterPageContent(U()),y.addPage(),Ma++,F={x:l.margin.left,y:l.margin.top}, +l.beforePageContent(U()),!1!==l.drawHeaderRow(q.headerRow,U({row:q.headerRow}))&&Na(q.headerRow,l.drawHeaderCell));a.y=F.y;!1!==l.drawRow(a,U({row:a}))&&Na(a,l.drawCell)})}function Na(a,b){for(var c=0;c= +Ca(a,d))return a;for(;ba.length);)a=a.substring(0,a.length-1);return a.trim()+h}function Ca(a,b){ma(b);return y.getStringUnitWidth(a)*b.fontSize}function Z(a){var b={},d;for(d in a)a.hasOwnProperty(d)&&(b[d]=a[d]);for(var h=1;h"+E(a,b,d)+""});r++});da+="";var ib=1;A=Y(d(u));d(A).each(function(){var a=1;t="";G(this,"td,th",r,v.length+A.length,function(b,d,h){t+=""+E(b,d,h)+"";a++});0"!==t&&(da+=''+t+"",ib++);r++});da+="";if("string"=== +b.outputMode)return da;if("base64"===b.outputMode)return S(da);T(da,b.fileName+".xml","application/xml","utf-8","base64",!1)}else if("excel"===b.type&&"xmlss"===b.mso.fileFormat){var Sa=[],M=[];d(u).filter(function(){return O(d(this))}).each(function(){function a(a,b,c){var e=[];d(a).each(function(){var b=0,f=0;t="";G(this,"td,th",r,c+a.length,function(a,c,g){if(null!==a){var m="";c=E(a,c,g);g="String";if(!1!==jQuery.isNumeric(c))g="Number";else{var h=pb(c);!1!==h&&(c=h,g="Number",m+=' ss:StyleID="pct1"')}"Number"!== +g&&(c=c.replace(/\n/g,"
"));h=Q(a);a=ha(a);d.each(e,function(){if(r>=this.s.r&&r<=this.e.r&&f>=this.s.c&&f<=this.e.c)for(var a=0;a<=this.e.c-this.s.c;++a)f++,b++});if(a||h)a=a||1,h=h||1,e.push({s:{r:r,c:f},e:{r:r+a-1,c:f+h-1}});1'+d("
").text(c).html()+"\r";f++}});0\r'+ +t+"\r");r++});return a.length}var c=d(this),e="";"string"===typeof b.mso.worksheetName&&b.mso.worksheetName.length?e=b.mso.worksheetName+" "+(M.length+1):"undefined"!==typeof b.mso.worksheetName[M.length]&&(e=b.mso.worksheetName[M.length]);e.length||(e=c.find("caption").text()||"");e.length||(e="Table "+(M.length+1));e=d.trim(e.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31));M.push(d("
").text(e).html());!1===b.exportHiddenCells&&(R=c.find("tr, th, td").filter(":hidden"),ka=0\r";e=a(X(c),"th,td",0);a(Y(c),"td,th",e);L+="\r";Sa.push(L)});for(var Da={},Ta={},ea,ra,oa=0,yb=M.length;oa\r\r\r \r\r\r 9000\r 13860\r 0\r 0\r False\r False\r\r\r \r \r \r\r', +Ea=0;Ea\r'+Sa[Ea],W=b.mso.rtl?W+'\r\r\r':W+'\r',W+="\r";W+="\r";if("string"===b.outputMode)return W;if("base64"===b.outputMode)return S(W);T(W,b.fileName+".xml","application/xml","utf-8","base64",!1)}else if("excel"=== +b.type&&"xlsx"===b.mso.fileFormat){var sa=[],jb=XLSX.utils.book_new();d(u).filter(function(){return O(d(this))}).each(function(){for(var a=d(this),c,e={},h=this.getElementsByTagName("tr"),f=Math.min(1E7,h.length),k={s:{r:0,c:0},e:{r:0,c:0}},m=[],g,p=0,B=0,z,l,r,q,n,t=XLSX.SSF.get_table();pc||36c||48===c)u="n";else{if("date"===w.type||13c||44c||56===c)u="d"}else u="s";if(null!=C){if(0===C.length)g.t="z";else if(0!==C.trim().length&&"s"!==u)if("function"===w.type)g={f:C};else if("TRUE"===C)g={t:"b",v:!0};else if("FALSE"===C)g={t:"b",v:!1};else if("n"===u||isFinite(fb(C,b.numbers.output))){if(u= +fb(C,b.numbers.output),0===c&&"function"!==typeof b.mso.xlsx.formatId.numbers&&(c=b.mso.xlsx.formatId.numbers),isFinite(u)||isFinite(C))g={t:"n",v:isFinite(u)?u:C,z:"string"===typeof c?c:c in t?t[c]:c===b.mso.xlsx.formatId.currency?b.mso.xlsx.format.currency:"0.00"}}else if(!1!==(w=ob(C))||"d"===u)0===c&&"function"!==typeof b.mso.xlsx.formatId.date&&(c=b.mso.xlsx.formatId.date),g={t:"d",v:!1!==w?w:C,z:"string"===typeof c?c:c in t?t[c]:"m/d/yy"};(u=d(n).find("a"))&&u.length&&(u=u[0].hasAttribute("href")? +u.attr("href"):"",C="href"!==b.htmlHyperlink||""===u?C:"",w=""!==u?'=HYPERLINK("'+u+(C.length?'","'+C:"")+'")':"",""!==w&&("function"===typeof b.mso.xlsx.onHyperlink?(C=b.mso.xlsx.onHyperlink(d(n),p,z,u,C,w),g=0!==C.indexOf("=HYPERLINK")?{t:"s",v:C}:{f:C}):g={f:w}))}e[Ka({c:l,r:B})]=g;k.e.c=f&&(e["!fullref"]=La((k.e.r=h.length-p+B-1,k)));c="";"string"===typeof b.mso.worksheetName&& +b.mso.worksheetName.length?c=b.mso.worksheetName+" "+(sa.length+1):"undefined"!==typeof b.mso.worksheetName[sa.length]&&(c=b.mso.worksheetName[sa.length]);c.length||(c=a.find("caption").text()||"");c.length||(c="Table "+(sa.length+1));c=d.trim(c.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31));sa.push(c);XLSX.utils.book_append_sheet(jb,e,c)});var zb=XLSX.write(jb,{type:"binary",bookType:b.mso.fileFormat,bookSST:!1});T(rb(zb),b.fileName+"."+b.mso.fileFormat,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", +"UTF-8","",!1)}else if("excel"===b.type||"xls"===b.type||"word"===b.type||"doc"===b.type){var ta="excel"===b.type||"xls"===b.type?"excel":"word",Ab="excel"===ta?"xls":"doc",Bb='xmlns:x="urn:schemas-microsoft-com:office:'+ta+'"',ua=L="";d(u).filter(function(){return O(d(this))}).each(function(){var a=d(this);""===ua&&(ua=b.mso.worksheetName||a.find("caption").text()||"Table",ua=d.trim(ua.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31)));!1===b.exportHiddenCells&&(R=a.find("tr, th, td").filter(":hidden"), +ka=0";v=X(a);d(v).each(function(){var a=d(this),e=document.defaultView.getComputedStyle(a[0],null);t="";G(this,"th,td",r,v.length,function(a,c,d){if(null!==a){var f="";t+=""}});0"+t+"");r++});L+="";A=Y(a);d(A).each(function(){var a=d(this),e=null,h=null;t="";G(this,"td,th",r,v.length+A.length,function(c,k,m){if(null!==c){var g=E(c,k,m),f="",l=d(c).attr("data-tableexport-msonumberformat");"undefined"===typeof l&&"function"===typeof b.mso.onMsoNumberFormat&&(l=b.mso.onMsoNumberFormat(c,k,m));"undefined"!==typeof l&&""!==l&&(f="style=\"mso-number-format:'"+ +l+"'");if(b.mso.styles.length){e=document.defaultView.getComputedStyle(c,null);h=null;for(var n in b.mso.styles)k=b.mso.styles[n],l=H(e,k),""===l&&(null===h&&(h=document.defaultView.getComputedStyle(a[0],null)),l=H(h,k)),""!==l&&"0px none rgb(0, 0, 0)"!==l&&"rgba(0, 0, 0, 0)"!==l&&(f+=""===f?'style="':";",f+=k+":"+l)}t+=""));t+=">"+g+""}}); +0"+t+"");r++});b.displayTableName&&(L+=""+E(d("

"+b.tableName+"

"))+"");L+=""});var n='';n+="";n+='';"excel"===ta&&(n+="\x3c!--[if gte mso 9]>",n+="",n+="",n+="",n+="", +n+="",n+=ua,n+="",n+="",n+="",b.mso.rtl&&(n+=""),n+="",n+="",n+="",n+="",n+="",n+="";n+="@page { size:"+b.mso.pageOrientation+"; mso-page-orientation:"+b.mso.pageOrientation+"; }";n+="@page Section1 {size:"+V[b.mso.pageFormat][0]+"pt "+V[b.mso.pageFormat][1]+"pt";n+="; margin:1.0in 1.25in 1.0in 1.25in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}"; +n+="div.Section1 {page:Section1;}";n+="@page Section2 {size:"+V[b.mso.pageFormat][1]+"pt "+V[b.mso.pageFormat][0]+"pt";n+=";mso-page-orientation:"+b.mso.pageOrientation+";margin:1.25in 1.0in 1.25in 1.0in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}";n+="div.Section2 {page:Section2;}";n+="br {mso-data-placement:same-cell;}";n+="";n+="";n+="";n+='
';n+=L;n+="
";n+="";n+=""; +if("string"===b.outputMode)return n;if("base64"===b.outputMode)return S(n);T(n,b.fileName+"."+Ab,"application/vnd.ms-"+ta,"","base64",!1)}else if("png"===b.type)html2canvas(d(u)[0]).then(function(a){a=a.toDataURL();for(var c=atob(a.substring(22)),d=new ArrayBuffer(c.length),h=new Uint8Array(d),f=0;fkb){a>V.a0[0]&&(Fa="a0",va="l");for(var b in V)V.hasOwnProperty(b)&&V[b][1]>a&&(Fa=b,va="l",V[b][0]>a&&(va="p"));kb=a}}});b.jspdf.format=""===Fa?"a4":Fa;b.jspdf.orientation=""===va?"w":va}if(null== +k.doc&&(k.doc=new jspdf.jsPDF(b.jspdf.orientation,b.jspdf.unit,b.jspdf.format),k.wScaleFactor=1,k.hScaleFactor=1,"function"===typeof b.jspdf.onDocCreated))b.jspdf.onDocCreated(k.doc);Ba.fontName=k.doc.getFont().fontName;!0===k.outputImages&&(k.images={});"undefined"!==typeof k.images&&(d(u).filter(function(){return O(d(this))}).each(function(){var a=0;N=[];!1===b.exportHiddenCells&&(R=d(this).find("tr, th, td").filter(":hidden"),ka=0a.styles.rowHeight&&(a.styles.rowHeight=e)}a.styles.halign="inherit"===c.headerStyles.halign?"center":c.headerStyles.halign;a.styles.valign=c.headerStyles.valign;"undefined"!==typeof d.style&&!0!==d.style.hidden&&("inherit"===c.headerStyles.halign&&(a.styles.halign=d.style.align),"inherit"===c.styles.fillColor&&(a.styles.fillColor=d.style.bcolor),"inherit"===c.styles.textColor&&(a.styles.textColor=d.style.color),"inherit"=== +c.styles.fontStyle&&(a.styles.fontStyle=d.style.fstyle))}});"function"!==typeof c.createdCell&&(c.createdCell=function(a,b){b=k.teCells[b.row.index+":"+b.column.dataKey];a.styles.halign="inherit"===c.styles.halign?"center":c.styles.halign;a.styles.valign=c.styles.valign;"undefined"!==typeof b&&"undefined"!==typeof b.style&&!0!==b.style.hidden&&("inherit"===c.styles.halign&&(a.styles.halign=b.style.align),"inherit"===c.styles.fillColor&&(a.styles.fillColor=b.style.bcolor),"inherit"===c.styles.textColor&& +(a.styles.textColor=b.style.color),"inherit"===c.styles.fontStyle&&(a.styles.fontStyle=b.style.fstyle))});"function"!==typeof c.drawHeaderCell&&(c.drawHeaderCell=function(a,b){var c=k.columns[b.column.dataKey];return(!0!==c.style.hasOwnProperty("hidden")||!0!==c.style.hidden)&&0<=c.rowIndex?Ya(a,b,c):!1});"function"!==typeof c.drawCell&&(c.drawCell=function(a,b){var c=k.teCells[b.row.index+":"+b.column.dataKey];if(!0!==("undefined"!==typeof c&&c.isCanvas))Ya(a,b,c)&&(k.doc.rect(a.x,a.y,a.width,a.height, +a.styles.fillStyle),"undefined"===typeof c||"undefined"!==typeof c.hasUserDefText&&!0===c.hasUserDefText||"undefined"===typeof c.elements||!c.elements.length?cb(a,{},k):(b=a.height/c.rect.height,b>k.hScaleFactor&&(k.hScaleFactor=b),k.wScaleFactor=a.width/c.rect.width,b=a.textPos.y,ab(a,c.elements,k),a.textPos.y=b,cb(a,c.elements,k)));else{c=c.elements[0];var e=d(c).attr("data-tableexport-canvas"),f=c.getBoundingClientRect();a.width=f.width*k.wScaleFactor;a.height=f.height*k.hScaleFactor;b.row.height= +a.height;Wa(a,c,e,k)}return!1});k.headerrows=[];v=X(d(this));d(v).each(function(){a=0;k.headerrows[r]=[];G(this,"th,td",r,v.length,function(b,c,d){var e=eb(b);e.title=E(b,c,d);e.key=a++;e.rowIndex=r;k.headerrows[r].push(e)});r++});if(0 'Clone Category', 'create' => 'Create Category', 'edit' => 'Edit Category', + 'email_will_be_sent_due_to_global_eula' => 'An email will be sent to the user because the global EULA is being used.', + 'email_will_be_sent_due_to_category_eula' => 'An email will be sent to the user because a EULA is set for this category.', 'eula_text' => 'Category EULA', 'eula_text_help' => 'This field allows you to customize your EULAs for specific types of assets. If you only have one EULA for all of your assets, you can check the box below to use the primary default.', 'name' => 'Category Name', diff --git a/resources/views/categories/edit.blade.php b/resources/views/categories/edit.blade.php index 813e8463e9..1ef3b7aa6a 100755 --- a/resources/views/categories/edit.blade.php +++ b/resources/views/categories/edit.blade.php @@ -23,59 +23,13 @@
- - - -
- -
- {{ Form::textarea('eula_text', old('eula_text', $item->eula_text), array('class' => 'form-control', 'aria-label'=>'eula_text')) }} -

{!! trans('admin/categories/general.eula_text_help') !!}

-

{!! trans('admin/settings/general.eula_markdown') !!}

- - {!! $errors->first('eula_text', '') !!} -
-
- - -
-
- @if ($snipeSettings->default_eula_text!='') - - @else - - @endif -
-
- - - -
-
- -
-
- - - -
-
- -
-
- + @include ('partials.forms.edit.image-upload', ['image_path' => app('categories_upload_path')]) diff --git a/resources/views/layouts/default.blade.php b/resources/views/layouts/default.blade.php index d11d3c541f..4363584972 100644 --- a/resources/views/layouts/default.blade.php +++ b/resources/views/layouts/default.blade.php @@ -973,7 +973,12 @@ $(function () { - $('[data-tooltip="true"]').tooltip(); + // Invoke Bootstrap 3's tooltip + $('[data-tooltip="true"]').tooltip({ + container: 'body', + animation: true, + }); + $('[data-toggle="popover"]').popover(); $('.select2 span').addClass('needsclick'); $('.select2 span').removeAttr('title'); diff --git a/resources/views/livewire/category-edit-form.blade.php b/resources/views/livewire/category-edit-form.blade.php new file mode 100644 index 0000000000..33b41b71e9 --- /dev/null +++ b/resources/views/livewire/category-edit-form.blade.php @@ -0,0 +1,61 @@ +
+ +
+ +
+ {{ Form::textarea('eula_text', null, ['wire:model' => 'eulaText', 'class' => 'form-control', 'aria-label'=>'eula_text', 'disabled' => $this->eulaTextDisabled]) }} +

{!! trans('admin/categories/general.eula_text_help') !!}

+

{!! trans('admin/settings/general.eula_markdown') !!}

+ {!! $errors->first('eula_text', '') !!} +
+ @if ($this->eulaTextDisabled) + + @endif +
+ + +
+
+ @if ($defaultEulaText!='') + + @else + + @endif +
+
+ + +
+
+ +
+
+ + +
+
+ + @if ($this->shouldDisplayEmailMessage) +
+ + {{ $this->emailMessage }} +
+ @endif + @if ($this->sendCheckInEmailDisabled) + + @endif +
+
+
diff --git a/resources/views/models/custom_fields_form.blade.php b/resources/views/models/custom_fields_form.blade.php index 011ad4ca9b..bae98373e4 100644 --- a/resources/views/models/custom_fields_form.blade.php +++ b/resources/views/models/custom_fields_form.blade.php @@ -85,3 +85,12 @@
@endforeach @endif + + + diff --git a/resources/views/reports/asset_maintenances.blade.php b/resources/views/reports/asset_maintenances.blade.php index 9845553363..ea12df34d1 100644 --- a/resources/views/reports/asset_maintenances.blade.php +++ b/resources/views/reports/asset_maintenances.blade.php @@ -48,7 +48,7 @@ {{ trans('admin/asset_maintenances/form.cost') }} {{ trans('general.location') }} {{ trans('admin/hardware/form.default_location') }} - {{ trans('admin/asset_maintenances/table.is_warranty') }} + {{ trans('admin/asset_maintenances/table.is_warranty') }} {{ trans('general.admin') }} {{ trans('admin/asset_maintenances/form.notes') }} diff --git a/tests/Feature/Livewire/CategoryEditFormTest.php b/tests/Feature/Livewire/CategoryEditFormTest.php new file mode 100644 index 0000000000..26719e4041 --- /dev/null +++ b/tests/Feature/Livewire/CategoryEditFormTest.php @@ -0,0 +1,105 @@ +assertStatus(200); + } + + public function testSendEmailCheckboxIsCheckedOnLoadWhenSendEmailIsExistingSetting() + { + Livewire::test(CategoryEditForm::class, [ + 'sendCheckInEmail' => true, + 'eulaText' => '', + 'useDefaultEula' => false, + ])->assertSet('sendCheckInEmail', true); + } + + public function testSendEmailCheckboxIsCheckedOnLoadWhenCategoryEulaSet() + { + Livewire::test(CategoryEditForm::class, [ + 'sendCheckInEmail' => false, + 'eulaText' => 'Some Content', + 'useDefaultEula' => false, + ])->assertSet('sendCheckInEmail', true); + } + + public function testSendEmailCheckboxIsCheckedOnLoadWhenUsingDefaultEula() + { + Livewire::test(CategoryEditForm::class, [ + 'sendCheckInEmail' => false, + 'eulaText' => '', + 'useDefaultEula' => true, + ])->assertSet('sendCheckInEmail', true); + } + + public function testSendEmailCheckBoxIsUncheckedOnLoadWhenSendEmailIsFalseNoCategoryEulaSetAndNotUsingDefaultEula() + { + Livewire::test(CategoryEditForm::class, [ + 'sendCheckInEmail' => false, + 'eulaText' => '', + 'useDefaultEula' => false, + ])->assertSet('sendCheckInEmail', false); + } + + public function testSendEmailCheckboxIsCheckedWhenCategoryEulaEntered() + { + Livewire::test(CategoryEditForm::class, [ + 'sendCheckInEmail' => false, + 'useDefaultEula' => false, + ])->assertSet('sendCheckInEmail', false) + ->set('eulaText', 'Some Content') + ->assertSet('sendCheckInEmail', true); + } + + public function testSendEmailCheckboxCheckedAndDisabledAndEulaTextDisabledWhenUseDefaultEulaSelected() + { + Livewire::test(CategoryEditForm::class, [ + 'sendCheckInEmail' => false, + 'useDefaultEula' => false, + ])->assertSet('sendCheckInEmail', false) + ->set('useDefaultEula', true) + ->assertSet('sendCheckInEmail', true) + ->assertSet('eulaTextDisabled', true) + ->assertSet('sendCheckInEmailDisabled', true); + } + + public function testSendEmailCheckboxEnabledAndSetToOriginalValueWhenNoCategoryEulaAndNotUsingGlobalEula() + { + Livewire::test(CategoryEditForm::class, [ + 'eulaText' => 'Some Content', + 'sendCheckInEmail' => false, + 'useDefaultEula' => true, + ]) + ->set('useDefaultEula', false) + ->set('eulaText', '') + ->assertSet('sendCheckInEmail', false) + ->assertSet('sendCheckInEmailDisabled', false); + + Livewire::test(CategoryEditForm::class, [ + 'eulaText' => 'Some Content', + 'sendCheckInEmail' => true, + 'useDefaultEula' => true, + ]) + ->set('useDefaultEula', false) + ->set('eulaText', '') + ->assertSet('sendCheckInEmail', true) + ->assertSet('sendCheckInEmailDisabled', false); + } + + public function testEulaFieldEnabledOnLoadWhenNotUsingDefaultEula() + { + Livewire::test(CategoryEditForm::class, [ + 'sendCheckInEmail' => false, + 'eulaText' => '', + 'useDefaultEula' => false, + ])->assertSet('eulaTextDisabled', false); + } +} diff --git a/tests/Feature/Reports/CustomReportTest.php b/tests/Feature/Reports/CustomReportTest.php new file mode 100644 index 0000000000..b27ebc27ef --- /dev/null +++ b/tests/Feature/Reports/CustomReportTest.php @@ -0,0 +1,110 @@ +streamedContent())->getRecords()) + ->pluck(0) + ->contains($needle) + ); + + return $this; + } + ); + + TestResponse::macro( + 'assertDontSeeTextInStreamedResponse', + function (string $needle) { + Assert::assertFalse( + collect(Reader::createFromString($this->streamedContent())->getRecords()) + ->pluck(0) + ->contains($needle) + ); + + return $this; + } + ); + } + + public function testCustomAssetReport() + { + Asset::factory()->create(['name' => 'Asset A']); + Asset::factory()->create(['name' => 'Asset B']); + + $this->actingAs(User::factory()->canViewReports()->create()) + ->post('reports/custom', [ + 'asset_name' => '1', + 'asset_tag' => '1', + 'serial' => '1', + ])->assertOk() + ->assertHeader('content-type', 'text/csv; charset=UTF-8') + ->assertSeeTextInStreamedResponse('Asset A') + ->assertSeeTextInStreamedResponse('Asset B'); + } + + public function testCustomAssetReportAdheresToCompanyScoping() + { + [$companyA, $companyB] = Company::factory()->count(2)->create(); + + Asset::factory()->for($companyA)->create(['name' => 'Asset A']); + Asset::factory()->for($companyB)->create(['name' => 'Asset B']); + + $superUser = $companyA->users()->save(User::factory()->superuser()->make()); + $userInCompanyA = $companyA->users()->save(User::factory()->canViewReports()->make()); + $userInCompanyB = $companyB->users()->save(User::factory()->canViewReports()->make()); + + $this->settings->disableMultipleFullCompanySupport(); + + $this->actingAs($superUser) + ->post('reports/custom', ['asset_name' => '1', 'asset_tag' => '1', 'serial' => '1']) + ->assertSeeTextInStreamedResponse('Asset A') + ->assertSeeTextInStreamedResponse('Asset B'); + + $this->actingAs($userInCompanyA) + ->post('reports/custom', ['asset_name' => '1', 'asset_tag' => '1', 'serial' => '1']) + ->assertSeeTextInStreamedResponse('Asset A') + ->assertSeeTextInStreamedResponse('Asset B'); + + $this->actingAs($userInCompanyB) + ->post('reports/custom', ['asset_name' => '1', 'asset_tag' => '1', 'serial' => '1']) + ->assertSeeTextInStreamedResponse('Asset A') + ->assertSeeTextInStreamedResponse('Asset B'); + + $this->settings->enableMultipleFullCompanySupport(); + + $this->actingAs($superUser) + ->post('reports/custom', ['asset_name' => '1', 'asset_tag' => '1', 'serial' => '1']) + ->assertSeeTextInStreamedResponse('Asset A') + ->assertSeeTextInStreamedResponse('Asset B'); + + $this->actingAs($userInCompanyA) + ->post('reports/custom', ['asset_name' => '1', 'asset_tag' => '1', 'serial' => '1']) + ->assertSeeTextInStreamedResponse('Asset A') + ->assertDontSeeTextInStreamedResponse('Asset B'); + + $this->actingAs($userInCompanyB) + ->post('reports/custom', ['asset_name' => '1', 'asset_tag' => '1', 'serial' => '1']) + ->assertDontSeeTextInStreamedResponse('Asset A') + ->assertSeeTextInStreamedResponse('Asset B'); + } +} diff --git a/tests/Support/CustomTestMacros.php b/tests/Support/CustomTestMacros.php index 0a30d7c243..4242b28653 100644 --- a/tests/Support/CustomTestMacros.php +++ b/tests/Support/CustomTestMacros.php @@ -24,7 +24,10 @@ trait CustomTestMacros function (Model $model, string $property = 'name') use ($guardAgainstNullProperty) { $guardAgainstNullProperty($model, $property); - Assert::assertTrue(collect($this['rows'])->pluck($property)->contains($model->{$property})); + Assert::assertTrue( + collect($this['rows'])->pluck($property)->contains(e($model->{$property})), + "Response did not contain the expected value: {$model->{$property}}" + ); return $this; } @@ -35,7 +38,10 @@ trait CustomTestMacros function (Model $model, string $property = 'name') use ($guardAgainstNullProperty) { $guardAgainstNullProperty($model, $property); - Assert::assertFalse(collect($this['rows'])->pluck($property)->contains($model->{$property})); + Assert::assertFalse( + collect($this['rows'])->pluck($property)->contains(e($model->{$property})), + "Response contained unexpected value: {$model->{$property}}" + ); return $this; } @@ -46,7 +52,10 @@ trait CustomTestMacros function (Model $model, string $property = 'id') use ($guardAgainstNullProperty) { $guardAgainstNullProperty($model, $property); - Assert::assertTrue(collect($this->json('results'))->pluck('id')->contains($model->{$property})); + Assert::assertTrue( + collect($this->json('results'))->pluck('id')->contains(e($model->{$property})), + "Response did not contain the expected value: {$model->{$property}}" + ); return $this; } @@ -57,7 +66,10 @@ trait CustomTestMacros function (Model $model, string $property = 'id') use ($guardAgainstNullProperty) { $guardAgainstNullProperty($model, $property); - Assert::assertFalse(collect($this->json('results'))->pluck('id')->contains($model->{$property})); + Assert::assertFalse( + collect($this->json('results'))->pluck('id')->contains(e($model->{$property})), + "Response contained unexpected value: {$model->{$property}}" + ); return $this; } diff --git a/tests/Unit/_bootstrap.php b/tests/Unit/_bootstrap.php deleted file mode 100644 index 62817a53c4..0000000000 --- a/tests/Unit/_bootstrap.php +++ /dev/null @@ -1,3 +0,0 @@ -loadSessionSnapshot('login')) return; - - // logging in - $I->amOnPage('/login'); - $I->fillField('username', 'snipe'); - $I->fillField('password', 'password'); - $I->click('Login'); - //$I->saveSessionSnapshot('login'); - } -} diff --git a/tests/_support/ApiTester.php b/tests/_support/ApiTester.php deleted file mode 100644 index f76364bc19..0000000000 --- a/tests/_support/ApiTester.php +++ /dev/null @@ -1,58 +0,0 @@ -createPersonalAccessClient($user->id, 'Codeception API Test Client', - 'http://localhost/'); - - \Illuminate\Support\Facades\DB::table('oauth_personal_access_clients')->insert([ - 'client_id' => $client->id, - 'created_at' => new DateTime, - 'updated_at' => new DateTime, - ]); - - $user->permissions = json_encode(['superuser' => true]); - $user->save(); - - $token = $user->createToken('CodeceptionAPItestToken')->accessToken; - - return $token; - } - - /** - * Remove Timestamps from transformed array - * This fixes false negatives when comparing json due to timestamp second rounding issues - * @param array $array Array returned from the transformer - * @return array Transformed item striped of created_at and updated_at - */ - public function removeTimeStamps($array) - { - unset($array['created_at']); - unset($array['updated_at']); - - return $array; - } -} diff --git a/tests/_support/FunctionalTester.php b/tests/_support/FunctionalTester.php deleted file mode 100644 index 7eabf4cf4b..0000000000 --- a/tests/_support/FunctionalTester.php +++ /dev/null @@ -1,151 +0,0 @@ - first()->id; - } - - public function getCategoryId() - { - return Category::inRandomOrder()->first()->id; - } - - public function getManufacturerId() - { - return Manufacturer::inRandomOrder()->first()->id; - } - - public function getLocationId() - { - return Location::inRandomOrder()->first()->id; - } - - /** - * @return mixed Random Accessory Id - */ - public function getAccessoryId() - { - return Accessory::inRandomOrder()->first()->id; - } - - /** - * @return mixed Random Asset Model Id; - */ - public function getModelId() - { - return AssetModel::inRandomOrder()->first()->id; - } - - /** - * @return mixed Id of Empty Asset Model - */ - public function getEmptyModelId() - { - return AssetModel::doesntHave('assets')->first()->id; - } - - /** - * @return mixed Id of random status - */ - public function getStatusId() - { - return StatusLabel::inRandomOrder()->first()->id; - } - - /** - * Id of random user - * @return mixed - */ - public function getUserId() - { - return User::inRandomOrder()->first()->id; - } - - /** - * @return mixed Id of random supplier - */ - public function getSupplierId() - { - return Supplier::inRandomOrder()->first()->id; - } - - /** - * @return mixed Id of Random Asset - */ - public function getAssetId() - { - return Asset::inRandomOrder()->first()->id; - } - - /** - * An Empty category - * @return mixed Id of Empty Category - */ - public function getEmptyCategoryId() - { - return Category::where('category_type', 'asset')->doesntHave('models')->first()->id; - } - - /** - * A random component id for testing - * @return mixed Id of random component - */ - public function getComponentId() - { - return Component::inRandomOrder()->first()->id; - } - - /** - * A random consumable Id for testing - * @return mixed - */ - public function getConsumableId() - { - return Consumable::inRandomOrder()->first()->id; - } - - /** - * Return a random depreciation id for tests. - * @return mixed - */ - public function getDepreciationId() - { - return Depreciation::inRandomOrder()->first()->id; - } -} diff --git a/tests/_support/Helper/Acceptance.php b/tests/_support/Helper/Acceptance.php deleted file mode 100644 index 2dd1562b13..0000000000 --- a/tests/_support/Helper/Acceptance.php +++ /dev/null @@ -1,10 +0,0 @@ -validateHTML(); - * - * Validate the HTML of the current page, but ignore errors containing the string "Ignoreit": - * $I->validateHTML(["Ignoreme"]); - * - * - * - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @author Tobias Hößl - */ - -namespace Helper; - -use Codeception\TestCase; - -class HTMLValidator extends \Codeception\Module -{ - /** - * @param string $html - * @return array - * @throws \Exception - */ - private function validateByVNU($html) - { - $javaPath = $this->_getConfig('javaPath'); - if (! $javaPath) { - $javaPath = 'java'; - } - $vnuPath = $this->_getConfig('vnuPath'); - if (! $vnuPath) { - $vnuPath = '/usr/local/bin/vnu.jar'; - } - - $filename = DIRECTORY_SEPARATOR.'tmp'.DIRECTORY_SEPARATOR.uniqid('html-validate').'.html'; - file_put_contents($filename, $html); - exec($javaPath.' -Xss1024k -jar '.$vnuPath.' --format json '.$filename.' 2>&1', $return); - $data = json_decode($return[0], true); - if (! $data || ! isset($data['messages']) || ! is_array($data['messages'])) { - throw new \Exception('Invalid data returned from validation service: '.$return); - } - - return $data['messages']; - } - - /** - * @return string - * @throws \Codeception\Exception\ModuleException - * @throws \Exception - */ - private function getPageSource() - { - if (! $this->hasModule('WebDriver')) { - throw new \Exception('This validator needs WebDriver to work'); - } - - /** @var \Codeception\Module\WebDriver $webdriver */ - $webdriver = $this->getModule('WebDriver'); - - return $webdriver->webDriver->getPageSource(); - } - - /** - * @param string[] $ignoreMessages - */ - public function validateHTML($ignoreMessages = []) - { - $source = $this->getPageSource(); - try { - $messages = $this->validateByVNU($source); - } catch (\Exception $e) { - $this->fail($e->getMessage()); - - return; - } - $failMessages = []; - $lines = explode("\n", $source); - foreach ($messages as $message) { - if ($message['type'] == 'error') { - $formattedMsg = '- Line '.$message['lastLine'].', column '.$message['lastColumn'].': '. - $message['message']."\n > ".$lines[$message['lastLine'] - 1]; - $ignoring = false; - foreach ($ignoreMessages as $ignoreMessage) { - if (mb_stripos($formattedMsg, $ignoreMessage) !== false) { - $ignoring = true; - } - } - if (! $ignoring) { - $failMessages[] = $formattedMsg; - } - } - } - if (count($failMessages) > 0) { - \PHPUnit_Framework_Assert::fail('Invalid HTML: '."\n".implode("\n", $failMessages)); - } - } -} diff --git a/tests/_support/Helper/Unit.php b/tests/_support/Helper/Unit.php deleted file mode 100644 index 4d27aa3599..0000000000 --- a/tests/_support/Helper/Unit.php +++ /dev/null @@ -1,10 +0,0 @@ -am('logged in user'); -$I->wantTo('ensure that the accessories listing page loads without errors'); -$I->lookForwardTo('seeing it load without errors'); -$I->amOnPage('/accessories'); -$I->waitForElement('.table', 5); // secs -$I->seeNumberOfElements('table[name="accessories"] tr', [5, 30]); -$I->seeInTitle('Accessories'); -$I->see('Accessories'); -$I->seeInPageSource('accessories/create'); -$I->dontSee('Accessories', '.page-header'); -$I->see('Accessories', 'h1.pull-left'); - -/* Create Form */ -$I->wantTo('ensure that the create accessories form loads without errors'); -$I->lookForwardTo('seeing it load without errors'); -$I->click(['link' => 'Create New']); -$I->amOnPage('/accessories/create'); -$I->dontSee('Create Accessory', '.page-header'); -$I->see('Create Accessory', 'h1.pull-left'); -$I->dontSee('<span class="'); diff --git a/tests/acceptance/AssetsCept.php b/tests/acceptance/AssetsCept.php deleted file mode 100644 index 6cc39e028c..0000000000 --- a/tests/acceptance/AssetsCept.php +++ /dev/null @@ -1,24 +0,0 @@ -am('logged in user'); -$I->wantTo('ensure that assets page loads without errors'); -$I->amGoingTo('go to the assets listing page'); -$I->lookForwardTo('seeing it load without errors'); -$I->amOnPage('/hardware'); -$I->waitForElement('.table', 5); // secs -$I->seeNumberOfElements('table[name="assets"] tr', [5, 50]); -$I->seeInTitle('Assets'); -$I->see('Assets'); -$I->seeInPageSource('hardware/create'); -$I->dontSee('Assets', '.page-header'); -$I->see('Assets', 'h1.pull-left'); - -/* Create Form */ -$I->wantTo('ensure that the create assets form loads without errors'); -$I->lookForwardTo('seeing it load without errors'); -$I->amOnPage('/hardware/create'); -$I->dontSee('Create Asset', '.page-header'); -$I->see('Create Asset', 'h1.pull-left'); -$I->dontSee('<span class="'); diff --git a/tests/acceptance/AssetsCest.php b/tests/acceptance/AssetsCest.php deleted file mode 100644 index 51011ce830..0000000000 --- a/tests/acceptance/AssetsCest.php +++ /dev/null @@ -1,33 +0,0 @@ -am('logged in user'); - $I->wantTo('ensure that assets page loads without errors'); - $I->amGoingTo('go to the assets listing page'); - $I->lookForwardTo('seeing it load without errors'); - $I->amOnPage('/hardware'); - $I->waitForElement('.table', 20); // secs - $I->seeNumberOfElements('table[name="assets"] tr', [5, 50]); - $I->seeInTitle(trans('general.assets')); - $I->see(trans('general.assets')); - $I->seeInPageSource('hardware/create'); - $I->see(trans('general.assets'), 'h1.pull-left'); - } - - public function createAsset(AcceptanceTester $I) - { - $I->wantTo('ensure that the create assets form loads without errors'); - $I->lookForwardTo('seeing it load without errors'); - $I->amOnPage('/hardware/create'); - $I->dontSee('Create Asset', '.page-header'); - $I->see('Create Asset', 'h1.pull-left'); - } -} diff --git a/tests/acceptance/CategoriesCept.php b/tests/acceptance/CategoriesCept.php deleted file mode 100644 index 75a6d2be11..0000000000 --- a/tests/acceptance/CategoriesCept.php +++ /dev/null @@ -1,24 +0,0 @@ -am('logged in user'); -$I->wantTo('ensure that the categories listing page loads without errors'); -$I->lookForwardTo('seeing it load without errors'); -$I->amOnPage('/categories'); -$I->waitForElement('.table', 5); // secs -$I->seeNumberOfElements('table[name="categories"] tr', [5, 30]); -$I->seeInTitle('Categories'); -$I->see('Categories'); -$I->seeInPageSource('/categories/create'); -$I->dontSee('Categories', '.page-header'); -$I->see('Categories', 'h1.pull-left'); - -/* Create Form */ -$I->wantTo('ensure that the create category form loads without errors'); -$I->lookForwardTo('seeing it load without errors'); -$I->click(['link' => 'Create New']); -$I->amOnPage('/categories/create'); -$I->dontSee('Create Category', '.page-header'); -$I->see('Create Category', 'h1.pull-left'); -$I->dontSee('<span class="'); diff --git a/tests/acceptance/CompaniesCept.php b/tests/acceptance/CompaniesCept.php deleted file mode 100644 index 98a06a6bfb..0000000000 --- a/tests/acceptance/CompaniesCept.php +++ /dev/null @@ -1,25 +0,0 @@ -am('logged in user'); -$I->wantTo('ensure that the company listing page loads without errors'); -$I->lookForwardTo('seeing it load without errors'); -$I->amOnPage('/companies'); -$I->waitForElement('.table', 5); // secs -$I->seeNumberOfElements('table[name="companies"] tr', [5, 30]); -$I->seeInTitle('Companies'); -$I->see('Companies'); -$I->seeInPageSource('companies/create'); -$I->dontSee('Companies', '.page-header'); -$I->see('Companies', 'h1.pull-left'); - -/* Create Form */ -$I->wantTo('ensure that the create company form loads without errors'); -$I->lookForwardTo('seeing it load without errors'); -$I->click(['link' => 'Create New']); -$I->amOnPage('/companies/create'); -$I->dontSee('Create Company', '.page-header'); -$I->see('Create Company', 'h1.pull-left'); -$I->dontSee('<span class="'); diff --git a/tests/acceptance/ConsumablesCept.php b/tests/acceptance/ConsumablesCept.php deleted file mode 100644 index 9461c232c3..0000000000 --- a/tests/acceptance/ConsumablesCept.php +++ /dev/null @@ -1,24 +0,0 @@ -am('logged in user'); -$I->wantTo('ensure that the consumables listing page loads without errors'); -$I->lookForwardTo('seeing it load without errors'); -$I->amOnPage('/consumables'); -$I->waitForElement('.table', 5); // secs -$I->seeNumberOfElements('table[name="consumables"] tr', [5, 30]); -$I->seeInTitle('Consumables'); -$I->see('Consumables'); -$I->seeInPageSource('/consumables/create'); -$I->dontSee('Consumables', '.page-header'); -$I->see('Consumables', 'h1.pull-left'); - -/* Create Form */ -$I->wantTo('ensure that the create consumables form loads without errors'); -$I->lookForwardTo('seeing it load without errors'); -$I->click(['link' => 'Create New']); -$I->amOnPage('/consumables/create'); -$I->dontSee('Create Consumable', '.page-header'); -$I->see('Create Consumable', 'h1.pull-left'); -$I->dontSee('<span class="'); diff --git a/tests/acceptance/CustomfieldsCept.php b/tests/acceptance/CustomfieldsCept.php deleted file mode 100644 index 9526316999..0000000000 --- a/tests/acceptance/CustomfieldsCept.php +++ /dev/null @@ -1,14 +0,0 @@ -am('logged in user'); -$I->wantTo('ensure that the custom fields page loads without errors'); -$I->lookForwardTo('seeing it load without errors'); -$I->amOnPage('/fields'); -$I->seeInTitle('Custom Fields'); -$I->see('Custom Fields'); -$I->seeInPageSource('/fields/create'); -$I->dontSee('Custom Fields', '.page-header'); -$I->dontSee('Fieldsets', '.page-header'); -$I->see('Manage Custom Fields', 'h1.pull-left'); diff --git a/tests/acceptance/DepartmentsCept.php b/tests/acceptance/DepartmentsCept.php deleted file mode 100644 index e9f6fd6b9c..0000000000 --- a/tests/acceptance/DepartmentsCept.php +++ /dev/null @@ -1,25 +0,0 @@ -am('logged in user'); -$I->wantTo('ensure that the department listing page loads without errors'); -$I->lookForwardTo('seeing it load without errors'); -$I->amOnPage('/departments'); -$I->waitForElement('.table', 5); // secs -$I->seeNumberOfElements('table[name="departments"] tr', [5, 30]); -$I->seeInTitle('Departments'); -$I->see('Departments'); -$I->seeInPageSource('departments/create'); -$I->dontSee('Departments', '.page-header'); -$I->see('Departments', 'h1.pull-left'); - -/* Create Form */ -$I->wantTo('ensure that the create department form loads without errors'); -$I->lookForwardTo('seeing it load without errors'); -$I->click(['link' => 'Create New']); -$I->amOnPage('/department/create'); -$I->dontSee('Create Department', '.page-header'); -$I->see('Create Department', 'h1.pull-left'); -$I->dontSee('<span class="'); diff --git a/tests/acceptance/DepreciationsCept.php b/tests/acceptance/DepreciationsCept.php deleted file mode 100644 index d0f43ad4e5..0000000000 --- a/tests/acceptance/DepreciationsCept.php +++ /dev/null @@ -1,25 +0,0 @@ -am('logged in user'); -$I->wantTo('ensure that depreciations page loads without errors'); -$I->amGoingTo('go to the depreciations listing page'); -$I->lookForwardTo('seeing it load without errors'); -$I->amOnPage('/depreciations'); -$I->seeInTitle('Depreciations'); -$I->waitForElement('.table', 5); // secs -$I->seeNumberOfElements('table[name="depreciations"] tbody tr', [1, 5]); -$I->seeInPageSource('/depreciations/create'); -$I->dontSee('Depreciations', '.page-header'); -$I->see('Depreciations', 'h1.pull-left'); - -/* Create Form */ -$I->wantTo('ensure that the create depreciation form loads without errors'); -$I->lookForwardTo('seeing it load without errors'); -$I->click(['link' => 'Create New']); -$I->amOnPage('/depreciations/create'); -$I->seeInTitle('Create Depreciation'); -$I->dontSee('Create Depreciation', '.page-header'); -$I->see('Create Depreciation', 'h1.pull-left'); -$I->dontSee('<span class="'); diff --git a/tests/acceptance/LocationsCept.php b/tests/acceptance/LocationsCept.php deleted file mode 100644 index 600b5c2822..0000000000 --- a/tests/acceptance/LocationsCept.php +++ /dev/null @@ -1,24 +0,0 @@ -am('logged in user'); -$I->wantTo('ensure that the locations listing page loads without errors'); -$I->lookForwardTo('seeing it load without errors'); -$I->amOnPage('/locations'); -$I->waitForElement('.table', 5); // secs -$I->seeNumberOfElements('tr', [5, 30]); -$I->seeInTitle('Locations'); -$I->see('Locations'); -$I->seeInPageSource('/locations/create'); -$I->dontSee('Locations', '.page-header'); -$I->see('Locations', 'h1.pull-left'); - -/* Create Form */ -$I->wantTo('ensure that the create location form loads without errors'); -$I->lookForwardTo('seeing it load without errors'); -$I->click(['link' => 'Create New']); -$I->amOnPage('/locations/create'); -$I->dontSee('Create Location', '.page-header'); -$I->see('Create Location', 'h1.pull-left'); -$I->dontSee('<span class="'); diff --git a/tests/acceptance/LoginCest.php b/tests/acceptance/LoginCest.php deleted file mode 100644 index 97fdbf5921..0000000000 --- a/tests/acceptance/LoginCest.php +++ /dev/null @@ -1,18 +0,0 @@ -wantTo('sign in'); - $I->amOnPage('/login'); - $I->see(trans('auth/general.login_prompt')); - $I->seeElement('input[type=text]'); - $I->seeElement('input[type=password]'); - } -} diff --git a/tests/acceptance/ManufacturersCept.php b/tests/acceptance/ManufacturersCept.php deleted file mode 100644 index 69d0c0e6da..0000000000 --- a/tests/acceptance/ManufacturersCept.php +++ /dev/null @@ -1,23 +0,0 @@ -am('logged in user'); -$I->wantTo('ensure that the manufacturers listing page loads without errors'); -$I->lookForwardTo('seeing it load without errors'); -$I->amOnPage('/manufacturers'); -$I->seeNumberOfElements('table[name="manufacturers"] tr', [5, 30]); -$I->see('Manufacturers'); -$I->seeInTitle('Manufacturers'); -$I->seeInPageSource('manufacturers/create'); -$I->dontSee('Manufacturers', '.page-header'); -$I->see('Manufacturers', 'h1.pull-left'); - -/* Create Form */ -$I->wantTo('ensure that the create manufacturer form loads without errors'); -$I->lookForwardTo('seeing it load without errors'); -$I->click(['link' => 'Create New']); -$I->amOnPage('/manufacturers/create'); -$I->dontSee('Create Manufacturer', '.page-header'); -$I->see('Create Manufacturer', 'h1.pull-left'); -$I->dontSee('<span class="'); diff --git a/tests/acceptance/StatuslabelsCept.php b/tests/acceptance/StatuslabelsCept.php deleted file mode 100644 index 224a713250..0000000000 --- a/tests/acceptance/StatuslabelsCept.php +++ /dev/null @@ -1,24 +0,0 @@ -am('logged in user'); -$I->wantTo('ensure the status labels listing page loads without errors'); -$I->lookForwardTo('seeing it load without errors'); -$I->amOnPage('/statuslabels'); -$I->waitForElement('.table', 5); // secs -$I->seeNumberOfElements('tr', [1, 30]); -$I->seeInTitle('Status Labels'); -$I->see('Status Labels'); -$I->seeInPageSource('statuslabels/create'); -$I->dontSee('Status Labels', '.page-header'); -$I->see('Status Labels', 'h1.pull-left'); - -/* Create Form */ -$I->wantTo('ensure the create status labels form loads without errors'); -$I->lookForwardTo('seeing it load without errors'); -$I->click(['link' => 'Create New']); -$I->amOnPage('/statuslabels/create'); -$I->dontSee('Create Status Label', '.page-header'); -$I->see('Create Status Label', 'h1.pull-left'); -$I->dontSee('<span class="'); diff --git a/tests/acceptance/SuppliersCept.php b/tests/acceptance/SuppliersCept.php deleted file mode 100644 index 59840dfd9d..0000000000 --- a/tests/acceptance/SuppliersCept.php +++ /dev/null @@ -1,24 +0,0 @@ -am('logged in user'); -$I->wantTo('ensure that the suppliers listing page loads without errors'); -$I->lookForwardTo('seeing it load without errors'); -$I->amOnPage('/suppliers'); -$I->waitForElement('.table', 5); // secs -$I->seeNumberOfElements('table[name="suppliers"] tr', [5, 25]); -$I->seeInTitle('Suppliers'); -$I->see('Suppliers'); -$I->seeInPageSource('suppliers/create'); -$I->dontSee('Suppliers', '.page-header'); -$I->see('Suppliers', 'h1.pull-left'); - -/* Create Form */ -$I->wantTo('ensure the create supplier form loads without errors'); -$I->lookForwardTo('seeing it load without errors'); -$I->click(['link' => 'Create New']); -$I->amOnPage('/suppliers/create'); -$I->dontSee('Create Supplier', '.page-header'); -$I->see('Create Supplier', 'h1.pull-left'); -$I->dontSee('<span class="'); diff --git a/tests/acceptance/UsersCept.php b/tests/acceptance/UsersCept.php deleted file mode 100644 index ddad283ef1..0000000000 --- a/tests/acceptance/UsersCept.php +++ /dev/null @@ -1,63 +0,0 @@ -am('logged in user'); -$I->wantTo('ensure that the users listing page loads without errors'); -$I->lookForwardTo('seeing it load without errors'); -$I->amOnPage('/users'); -//$I->waitForJS("return $.active == 0;", 60); -$I->waitForElement('.table', 5); // secs -//$I->seeNumberOfElements('tr', [1,10]); -$I->seeInTitle('Users'); -$I->see('Users'); -$I->seeInPageSource('users/create'); -$I->dontSee('Users', '.page-header'); -$I->see('Users', 'h1.pull-left'); -$I->seeLink('Create New'); // matches
Logout - -/* Create form */ -$I->am('logged in admin'); -$I->wantTo('ensure that you get errors when you submit an incomplete form'); -$I->lookForwardTo('seeing errors display'); -$I->click(['link' => 'Create New']); -$I->amOnPage('users/create'); -$I->dontSee('Create User', '.page-header'); -$I->see('Create User', 'h1.pull-left'); - -/* Submit form and expect errors */ -$I->click(['name' => 'email']); -$I->submitForm('#userForm', [ - 'email' => 'me@example.com', -]); -$I->seeElement('.alert-danger'); -$I->dontSeeInSource('<br><'); - -/* Submit form and expect errors */ -$I->click(['name' => 'email']); -$I->click(['name' => 'username']); -$I->submitForm('#userForm', [ - 'email' => Helper::generateRandomString(15).'@example.com', - 'first_name' => 'Joe', - 'last_name' => 'Smith', - 'username' => Helper::generateRandomString(15), -]); - -$I->seeElement('.alert-danger'); -$I->dontSeeInSource('<br><'); - -/* Submit form and expect success */ -$I->wantTo('submit the form successfully'); -$I->click(['name' => 'email']); -$I->fillField(['name' => 'email'], Helper::generateRandomString(15).'@example.com'); -$I->fillField(['name' => 'first_name'], 'Joe'); -$I->fillField(['name' => 'last_name'], 'Smith'); -$I->click(['name' => 'username']); -$I->fillField(['name' => 'username'], Helper::generateRandomString(15)); -$I->click(['name' => 'password']); -$I->fillField(['name' => 'password'], 'password'); -$I->click(['name' => 'password_confirmation']); -$I->fillField(['name' => 'password_confirmation'], 'password'); -$I->click('Save'); -$I->seeElement('.alert-success'); -$I->dontSeeInSource('<br><'); diff --git a/tests/acceptance/_bootstrap.php b/tests/acceptance/_bootstrap.php deleted file mode 100644 index 62817a53c4..0000000000 --- a/tests/acceptance/_bootstrap.php +++ /dev/null @@ -1,3 +0,0 @@ -user = \App\Models\User::find(1); - $I->haveHttpHeader('Accept', 'application/json'); - $I->amBearerAuthenticated($I->getToken($this->user)); - } - - /** @test */ - public function indexAccessories(ApiTester $I) - { - $I->wantTo('Get a list of accessories'); - - // call - $I->sendGET('/accessories?limit=10'); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse(), true); - // sample verify - $accessory = App\Models\Accessory::orderByDesc('created_at')->take(10)->get()->shuffle()->first(); - $I->seeResponseContainsJson($I->removeTimestamps((new AccessoriesTransformer)->transformAccessory($accessory))); - } - - /** @test */ - public function createAccessory(ApiTester $I, $scenario) - { - $I->wantTo('Create a new accessory'); - - $temp_accessory = \App\Models\Accessory::factory()->appleBtKeyboard()->make([ - 'name' => 'Test Accessory Name', - 'company_id' => 2, - ]); - - // setup - $data = [ - 'category_id' => $temp_accessory->category_id, - 'company_id' => $temp_accessory->company->id, - 'location_id' => $temp_accessory->location_id, - 'name' => $temp_accessory->name, - 'order_number' => $temp_accessory->order_number, - 'purchase_cost' => $temp_accessory->purchase_cost, - 'purchase_date' => $temp_accessory->purchase_date, - 'model_number' => $temp_accessory->model_number, - 'manufacturer_id' => $temp_accessory->manufacturer_id, - 'supplier_id' => $temp_accessory->supplier_id, - 'qty' => $temp_accessory->qty, - ]; - - // create - $I->sendPOST('/accessories', $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - } - - // Put is routed to the same method in the controller - // DO we actually need to test both? - - /** @test */ - public function updateAccessoryWithPatch(ApiTester $I, $scenario) - { - $I->wantTo('Update an accessory with PATCH'); - - // create - $accessory = \App\Models\Accessory::factory()->appleBtKeyboard()->create([ - 'name' => 'Original Accessory Name', - 'company_id' => 2, - 'location_id' => 3, - ]); - $I->assertInstanceOf(\App\Models\Accessory::class, $accessory); - - $temp_accessory = \App\Models\Accessory::factory()->microsoftMouse()->make([ - 'company_id' => 3, - 'name' => 'updated accessory name', - 'location_id' => 1, - ]); - - $data = [ - 'category_id' => $temp_accessory->category_id, - 'company_id' => $temp_accessory->company->id, - 'location_id' => $temp_accessory->location_id, - 'name' => $temp_accessory->name, - 'order_number' => $temp_accessory->order_number, - 'purchase_cost' => $temp_accessory->purchase_cost, - 'purchase_date' => $temp_accessory->purchase_date, - 'model_number' => $temp_accessory->model_number, - 'manufacturer_id' => $temp_accessory->manufacturer_id, - 'supplier_id' => $temp_accessory->supplier_id, - 'image' => $temp_accessory->image, - 'qty' => $temp_accessory->qty, - ]; - - $I->assertNotEquals($accessory->name, $data['name']); - - // update - $I->sendPATCH('/accessories/'.$accessory->id, $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/accessories/message.update.success'), $response->messages); - $I->assertEquals($accessory->id, $response->payload->id); // accessory id does not change - $I->assertEquals($temp_accessory->company_id, $response->payload->company_id); // company_id updated - $I->assertEquals($temp_accessory->name, $response->payload->name); // accessory name updated - $I->assertEquals($temp_accessory->location_id, $response->payload->location_id); // accessory location_id updated - $temp_accessory->created_at = Carbon::parse($response->payload->created_at); - $temp_accessory->updated_at = Carbon::parse($response->payload->updated_at); - $temp_accessory->id = $accessory->id; - // verify - $I->sendGET('/accessories/'.$accessory->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - $I->seeResponseContainsJson((new AccessoriesTransformer)->transformAccessory($temp_accessory)); - } - - /** @test */ - public function deleteAccessoryTest(ApiTester $I, $scenario) - { - $I->wantTo('Delete an accessory'); - - // create - $accessory = \App\Models\Accessory::factory()->appleBtKeyboard()->create([ - 'name' => 'Soon to be deleted', - ]); - $I->assertInstanceOf(\App\Models\Accessory::class, $accessory); - - // delete - $I->sendDELETE('/accessories/'.$accessory->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/accessories/message.delete.success'), $response->messages); - - // verify, expect a 200 - $I->sendGET('/accessories/'.$accessory->id); - $I->seeResponseCodeIs(200); - $I->seeResponseIsJson(); - } -} diff --git a/tests/api/ApiAssetsCest.php b/tests/api/ApiAssetsCest.php deleted file mode 100644 index 554d4c4230..0000000000 --- a/tests/api/ApiAssetsCest.php +++ /dev/null @@ -1,168 +0,0 @@ -faker = \Faker\Factory::create(); - $this->user = \App\Models\User::find(1); - Setting::getSettings()->time_display_format = 'H:i'; - $I->amBearerAuthenticated($I->getToken($this->user)); - } - - /** @test */ - public function indexAssets(ApiTester $I) - { - $I->wantTo('Get a list of assets'); - - // call - $I->sendGET('/hardware?limit=20&sort=id&order=desc'); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - // FIXME: This is disabled because the statuslabel join is doing something weird in Api/AssetsController@index - // However, it's hiding other real test errors in other parts of the code, so disabling this for now until we can fix. -// $response = json_decode($I->grabResponse(), true); - - // sample verify -// $asset = Asset::orderByDesc('id')->take(20)->get()->first(); - - // -// $I->seeResponseContainsJson($I->removeTimestamps((new AssetsTransformer)->transformAsset($asset))); - } - - /** @test */ - public function createAsset(ApiTester $I, $scenario) - { - $I->wantTo('Create a new asset'); - - $temp_asset = \App\Models\Asset::factory()->laptopMbp()->make([ - 'asset_tag' => 'Test Asset Tag', - 'company_id' => 2, - ]); - - // setup - $data = [ - 'asset_tag' => $temp_asset->asset_tag, - 'assigned_to' => $temp_asset->assigned_to, - 'company_id' => $temp_asset->company->id, - 'image' => $temp_asset->image, - 'model_id' => $temp_asset->model_id, - 'name' => $temp_asset->name, - 'notes' => $temp_asset->notes, - 'purchase_cost' => $temp_asset->purchase_cost, - 'purchase_date' => $temp_asset->purchase_date, - 'rtd_location_id' => $temp_asset->rtd_location_id, - 'serial' => $temp_asset->serial, - 'status_id' => $temp_asset->status_id, - 'supplier_id' => $temp_asset->supplier_id, - 'warranty_months' => $temp_asset->warranty_months, - ]; - - // create - $I->sendPOST('/hardware', $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - } - - /** @test */ - public function updateAssetWithPatch(ApiTester $I, $scenario) - { - $I->wantTo('Update an asset with PATCH'); - - // create - $asset = \App\Models\Asset::factory()->laptopMbp()->create([ - 'company_id' => 2, - 'rtd_location_id' => 3, - ]); - $I->assertInstanceOf(\App\Models\Asset::class, $asset); - - $temp_asset = \App\Models\Asset::factory()->laptopAir()->make([ - 'company_id' => 3, - 'name' => 'updated asset name', - 'rtd_location_id' => 1, - ]); - - $data = [ - 'asset_tag' => $temp_asset->asset_tag, - 'assigned_to' => $temp_asset->assigned_to, - 'company_id' => $temp_asset->company->id, - 'image' => $temp_asset->image, - 'model_id' => $temp_asset->model_id, - 'name' => $temp_asset->name, - 'notes' => $temp_asset->notes, - 'order_number' => $temp_asset->order_number, - 'purchase_cost' => $temp_asset->purchase_cost, - 'purchase_date' => $temp_asset->purchase_date->format('Y-m-d'), - 'rtd_location_id' => $temp_asset->rtd_location_id, - 'serial' => $temp_asset->serial, - 'status_id' => $temp_asset->status_id, - 'supplier_id' => $temp_asset->supplier_id, - 'warranty_months' => $temp_asset->warranty_months, - ]; - - $I->assertNotEquals($asset->name, $data['name']); - - // update - $I->sendPATCH('/hardware/'.$asset->id, $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - // dd($response); - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/hardware/message.update.success'), $response->messages); - $I->assertEquals($asset->id, $response->payload->id); // asset id does not change - $I->assertEquals($temp_asset->asset_tag, $response->payload->asset_tag); // asset tag updated - $I->assertEquals($temp_asset->name, $response->payload->name); // asset name updated - $I->assertEquals($temp_asset->rtd_location_id, $response->payload->rtd_location_id); // asset rtd_location_id updated - $temp_asset->created_at = Carbon::parse($response->payload->created_at); - $temp_asset->updated_at = Carbon::parse($response->payload->updated_at); - $temp_asset->id = $asset->id; - $temp_asset->location_id = $response->payload->rtd_location_id; - - // verify - $I->sendGET('/hardware/'.$asset->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - $I->seeResponseContainsJson((new AssetsTransformer)->transformAsset($temp_asset)); - } - - /** @test */ - public function deleteAssetTest(ApiTester $I, $scenario) - { - $I->wantTo('Delete an asset'); - - // create - $asset = \App\Models\Asset::factory()->laptopMbp()->create(); - $I->assertInstanceOf(\App\Models\Asset::class, $asset); - - // delete - $I->sendDELETE('/hardware/'.$asset->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/hardware/message.delete.success'), $response->messages); - - // verify, expect a 200 - $I->sendGET('/hardware/'.$asset->id); - $I->seeResponseCodeIs(200); - $I->seeResponseIsJson(); - - // Make sure we're soft deleted. - $response = json_decode($I->grabResponse()); - $I->assertNotNull($response->deleted_at); - } -} diff --git a/tests/api/ApiCategoriesCest.php b/tests/api/ApiCategoriesCest.php deleted file mode 100644 index 7605872a17..0000000000 --- a/tests/api/ApiCategoriesCest.php +++ /dev/null @@ -1,141 +0,0 @@ -user = \App\Models\User::find(1); - $I->haveHttpHeader('Accept', 'application/json'); - $I->amBearerAuthenticated($I->getToken($this->user)); - } - - /** @test */ - public function indexCategorys(ApiTester $I) - { - $I->wantTo('Get a list of categories'); - - // call - $I->sendGET('/categories?order_by=id&limit=10'); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse(), true); - // sample verify - $category = App\Models\Category::withCount('assets as assets_count', 'accessories as accessories_count', 'consumables as consumables_count', 'components as components_count', 'licenses as licenses_count') - ->orderByDesc('created_at')->take(10)->get()->shuffle()->first(); - $I->seeResponseContainsJson($I->removeTimestamps((new CategoriesTransformer)->transformCategory($category))); - } - - /** @test */ - public function createCategory(ApiTester $I, $scenario) - { - $I->wantTo('Create a new category'); - - $temp_category = \App\Models\Category::factory()->assetLaptopCategory()->make([ - 'name' => 'Test Category Tag', - ]); - - // setup - $data = [ - 'category_type' => $temp_category->category_type, - 'checkin_email' => $temp_category->checkin_email, - 'eula_text' => $temp_category->eula_text, - 'name' => $temp_category->name, - 'require_acceptance' => $temp_category->require_acceptance, - 'use_default_eula' => $temp_category->use_default_eula, - ]; - - // create - $I->sendPOST('/categories', $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - } - - // Put is routed to the same method in the controller - // DO we actually need to test both? - - /** @test */ - public function updateCategoryWithPatch(ApiTester $I, $scenario) - { - $I->wantTo('Update an category with PATCH'); - - // create - $category = \App\Models\Category::factory()->assetLaptopCategory() - ->create([ - 'name' => 'Original Category Name', - ]); - $I->assertInstanceOf(\App\Models\Category::class, $category); - - $temp_category = \App\Models\Category::factory()->accessoryMouseCategory()->make([ - 'name' => 'updated category name', - ]); - - $data = [ - 'category_type' => $temp_category->category_type, - 'checkin_email' => $temp_category->checkin_email, - 'eula_text' => $temp_category->eula_text, - 'name' => $temp_category->name, - 'require_acceptance' => $temp_category->require_acceptance, - 'use_default_eula' => $temp_category->use_default_eula, - ]; - - $I->assertNotEquals($category->name, $data['name']); - - // update - $I->sendPATCH('/categories/'.$category->id, $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/categories/message.update.success'), $response->messages); - $I->assertEquals($category->id, $response->payload->id); // category id does not change - $I->assertEquals($temp_category->name, $response->payload->name); // category name updated - // Some manual copying to compare against - $temp_category->created_at = Carbon::parse($response->payload->created_at); - $temp_category->updated_at = Carbon::parse($response->payload->updated_at); - $temp_category->id = $category->id; - - // verify - $I->sendGET('/categories/'.$category->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - $I->seeResponseContainsJson((new CategoriesTransformer)->transformCategory($temp_category)); - } - - /** @test */ - public function deleteCategoryTest(ApiTester $I, $scenario) - { - $I->wantTo('Delete an category'); - - // create - $category = \App\Models\Category::factory()->assetLaptopCategory()->create([ - 'name' => 'Soon to be deleted', - ]); - $I->assertInstanceOf(\App\Models\Category::class, $category); - - // delete - $I->sendDELETE('/categories/'.$category->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/categories/message.delete.success'), $response->messages); - - // verify, expect a 200 - $I->sendGET('/categories/'.$category->id); - $I->seeResponseCodeIs(200); - $I->seeResponseIsJson(); - } -} diff --git a/tests/api/ApiCheckoutAssetsCest.php b/tests/api/ApiCheckoutAssetsCest.php deleted file mode 100644 index 48b4bd2335..0000000000 --- a/tests/api/ApiCheckoutAssetsCest.php +++ /dev/null @@ -1,147 +0,0 @@ -user = \App\Models\User::find(1); - $I->amBearerAuthenticated($I->getToken($this->user)); - } - - /** @test */ - public function checkoutAssetToUser(ApiTester $I) - { - $I->wantTo('Check out an asset to a user'); - //Grab an asset from the database that isn't checked out. - $asset = Asset::whereNull('assigned_to')->first(); - $targetUser = \App\Models\User::factory()->create(); - $data = [ - 'assigned_user' => $targetUser->id, - 'note' => 'This is a test checkout note', - 'expected_checkin' => '2018-05-24', - 'name' => 'Updated Asset Name', - 'checkout_to_type' => 'user', - ]; - $I->sendPOST("/hardware/{$asset->id}/checkout", $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/hardware/message.checkout.success'), $response->messages); - - // Confirm results. - $I->sendGET("/hardware/{$asset->id}"); - $I->seeResponseContainsJson([ - 'assigned_to' => [ - 'id' => $targetUser->id, - 'type' => 'user', - ], - 'name' => 'Updated Asset Name', - 'expected_checkin' => Helper::getFormattedDateObject('2018-05-24', 'date'), - ]); - } - - /** @test */ - public function checkoutAssetToAsset(ApiTester $I) - { - $I->wantTo('Check out an asset to an asset'); - //Grab an asset from the database that isn't checked out. - $asset = Asset::whereNull('assigned_to') - ->where('model_id', 8) - ->where('status_id', Statuslabel::deployable()->first()->id) - ->first(); // We need to make sure that this is an asset/model that doesn't require acceptance - $targetAsset = \App\Models\Asset::factory()->desktopMacpro()->create([ - 'name' => 'Test Asset For Checkout to', - ]); - $data = [ - 'assigned_asset' => $targetAsset->id, - 'checkout_to_type' => 'asset', - ]; - $I->sendPOST("/hardware/{$asset->id}/checkout", $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/hardware/message.checkout.success'), $response->messages); - - // Confirm results. - $I->sendGET("/hardware/{$asset->id}"); - $I->seeResponseContainsJson([ - 'assigned_to' => [ - 'id' => $targetAsset->id, - 'type' => 'asset', - ], - ]); - } - - /** @test */ - public function checkoutAssetToLocation(ApiTester $I) - { - $I->wantTo('Check out an asset to an asset'); - //Grab an asset from the database that isn't checked out. - $asset = Asset::whereNull('assigned_to') - ->where('model_id', 8) - ->where('status_id', Statuslabel::deployable()->first()->id) - ->first(); // We need to make sure that this is an asset/model that doesn't require acceptance - $targetLocation = \App\Models\Location::factory()->create([ - 'name' => 'Test Location for Checkout', - ]); - $data = [ - 'assigned_location' => $targetLocation->id, - 'checkout_to_type' => 'location', - ]; - $I->sendPOST("/hardware/{$asset->id}/checkout", $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/hardware/message.checkout.success'), $response->messages); - - // Confirm results. - $I->sendGET("/hardware/{$asset->id}"); - $I->seeResponseContainsJson([ - 'assigned_to' => [ - 'id' => $targetLocation->id, - 'type' => 'location', - ], - ]); - } - - /** @test */ - public function checkinAsset(ApiTester $I) - { - $I->wantTo('Checkin an asset that is currently checked out'); - - $asset = Asset::whereNotNull('assigned_to')->first(); - - $I->sendPOST("/hardware/{$asset->id}/checkin", [ - 'note' => 'Checkin Note', - ]); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/hardware/message.checkin.success'), $response->messages); - - // Verify - $I->sendGET("/hardware/{$asset->id}"); - $I->seeResponseContainsJson([ - 'assigned_to' => null, - ]); - } -} diff --git a/tests/api/ApiCompaniesCest.php b/tests/api/ApiCompaniesCest.php deleted file mode 100644 index 55fa5bc218..0000000000 --- a/tests/api/ApiCompaniesCest.php +++ /dev/null @@ -1,132 +0,0 @@ -user = \App\Models\User::find(1); - $I->haveHttpHeader('Accept', 'application/json'); - $I->amBearerAuthenticated($I->getToken($this->user)); - } - - /** @test */ - public function indexCompanys(ApiTester $I) - { - $I->wantTo('Get a list of companies'); - - // call - $I->sendGET('/companies?order_by=id&limit=10'); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse(), true); - // dd($response); - // sample verify - $company = App\Models\Company::withCount('assets as assets_count', 'licenses as licenses_count', 'accessories as accessories_count', 'consumables as consumables_count', 'components as components_count', 'users as users_count') - ->orderByDesc('created_at')->take(10)->get()->shuffle()->first(); - - $I->seeResponseContainsJson($I->removeTimestamps((new CompaniesTransformer)->transformCompany($company))); - } - - /** @test */ - public function createCompany(ApiTester $I, $scenario) - { - $I->wantTo('Create a new company'); - - $temp_company = \App\Models\Company::factory()->make([ - 'name' => 'Test Company Tag', - ]); - - // setup - $data = [ - 'name' => $temp_company->name, - ]; - - // create - $I->sendPOST('/companies', $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - } - - // Put is routed to the same method in the controller - // DO we actually need to test both? - - /** @test */ - public function updateCompanyWithPatch(ApiTester $I, $scenario) - { - $I->wantTo('Update an company with PATCH'); - - // create - $company = \App\Models\Company::factory()->create([ - 'name' => 'Original Company Name', - ]); - $I->assertInstanceOf(\App\Models\Company::class, $company); - - $temp_company = \App\Models\Company::factory()->make([ - 'name' => 'updated company name', - ]); - - $data = [ - 'name' => $temp_company->name, - ]; - - $I->assertNotEquals($company->name, $data['name']); - - // update - $I->sendPATCH('/companies/'.$company->id, $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/companies/message.update.success'), $response->messages); - $I->assertEquals($company->id, $response->payload->id); // company id does not change - $I->assertEquals($temp_company->name, $response->payload->name); // company name updated - // Some manual copying to compare against - $temp_company->created_at = Carbon::parse($response->payload->created_at->datetime); - $temp_company->updated_at = Carbon::parse($response->payload->updated_at->datetime); - $temp_company->id = $company->id; - - // verify - $I->sendGET('/companies/'.$company->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - $I->seeResponseContainsJson((new CompaniesTransformer)->transformCompany($temp_company)); - } - - /** @test */ - public function deleteCompanyTest(ApiTester $I, $scenario) - { - $I->wantTo('Delete an company'); - - // create - $company = \App\Models\Company::factory()->create([ - 'name' => 'Soon to be deleted', - ]); - $I->assertInstanceOf(\App\Models\Company::class, $company); - - // delete - $I->sendDELETE('/companies/'.$company->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/companies/message.delete.success'), $response->messages); - - // verify, expect a 200 - $I->sendGET('/companies/'.$company->id); - $I->seeResponseCodeIs(200); - $I->seeResponseIsJson(); - } -} diff --git a/tests/api/ApiComponentsAssetsCest.php b/tests/api/ApiComponentsAssetsCest.php deleted file mode 100644 index c7e2e043b9..0000000000 --- a/tests/api/ApiComponentsAssetsCest.php +++ /dev/null @@ -1,80 +0,0 @@ -faker = \Faker\Factory::create(); - // $this->user = \App\Models\User::find(1); - - // $I->amBearerAuthenticated($I->getToken($this->user)); - // } - - // // /** @test */ - // // public function indexComponentsAssets(ApiTester $I) - // // { - // // $I->wantTo('Get a list of assets related to a component'); - - // // // generate component - // // $component = factory(\App\Models\Component::class) - // // ->create(['user_id' => $this->user->id, 'qty' => 20]); - - // // // generate assets and associate component - // // $assets = factory(\App\Models\Asset::class, 2) - // // ->create(['user_id' => $this->user->id]) - // // ->each(function ($asset) use ($component) { - // // $component->assets()->attach($component->id, [ - // // 'component_id' => $component->id, - // // 'user_id' => $this->user->id, - // // 'created_at' => date('Y-m-d H:i:s'), - // // 'assigned_qty' => 2, - // // 'asset_id' => $asset->id - // // ]); - // // }); - - // // // verify - // // $I->sendGET('/components/' . $component->id . '/assets/'); - // // $I->seeResponseIsJson(); - // // $I->seeResponseCodeIs(200); - - // // $response = json_decode($I->grabResponse()); - // // $I->assertEquals(2, $response->total); - - // // $I->assertInstanceOf(\Illuminate\Database\Eloquent\Collection::class, $assets); - - // // $I->seeResponseContainsJson(['rows' => [ - // // 0 => [ - // // 'name' => $assets[0]->name, - // // 'id' => $assets[0]->id, - // // 'created_at' => $assets[0]->created_at->format('Y-m-d'), - // // ], - // // 1 => [ - // // 'name' => $assets[1]->name, - // // 'id' => $assets[1]->id, - // // 'created_at' => $assets[1]->created_at->format('Y-m-d'), - // // ], - // // ] - // // ]); - // // } - - // // /** @test */ - // // public function expectEmptyResponseWithoutAssociatedAssets(ApiTester $I, $scenario) - // // { - // // $I->wantTo('See an empty response when there are no associated assets to a component'); - - // // $component = factory(\App\Models\Component::class) - // // ->create(['user_id' => $this->user->id, 'qty' => 20]); - - // // $I->sendGET('/components/' . $component->id . '/assets'); - // // $I->seeResponseCodeIs(200); - // // $I->seeResponseIsJson(); - - // // $response = json_decode($I->grabResponse()); - // // $I->assertEquals(0, $response->total); - // // $I->assertEquals([], $response->rows); - // // $I->seeResponseContainsJson(['total' => 0, 'rows' => []]); - // // } -} diff --git a/tests/api/ApiComponentsCest.php b/tests/api/ApiComponentsCest.php deleted file mode 100644 index dea9ece186..0000000000 --- a/tests/api/ApiComponentsCest.php +++ /dev/null @@ -1,156 +0,0 @@ -user = \App\Models\User::find(1); - $I->haveHttpHeader('Accept', 'application/json'); - $I->amBearerAuthenticated($I->getToken($this->user)); - } - - /** @test */ - public function indexComponents(ApiTester $I) - { - $I->wantTo('Get a list of components'); - - // call - $I->sendGET('/components?limit=10'); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse(), true); - // sample verify - $component = App\Models\Component::orderByDesc('created_at')->take(10)->get()->shuffle()->first(); - - $I->seeResponseContainsJson($I->removeTimestamps((new ComponentsTransformer)->transformComponent($component))); - } - - /** @test */ - public function createComponent(ApiTester $I, $scenario) - { - $I->wantTo('Create a new component'); - - $temp_component = \App\Models\Component::factory()->ramCrucial4()->make([ - 'name' => 'Test Component Name', - 'company_id' => 2, - ]); - - // setup - $data = [ - 'category_id' => $temp_component->category_id, - 'company_id' => $temp_component->company->id, - 'location_id' => $temp_component->location_id, - 'manufacturer_id' => $temp_component->manufacturer_id, - 'model_number' => $temp_component->model_number, - 'name' => $temp_component->name, - 'order_number' => $temp_component->order_number, - 'purchase_cost' => $temp_component->purchase_cost, - 'purchase_date' => $temp_component->purchase_date, - 'qty' => $temp_component->qty, - 'serial' => $temp_component->serial, - ]; - - // create - $I->sendPOST('/components', $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - } - - // Put is routed to the same method in the controller - // DO we actually need to test both? - - /** @test */ - public function updateComponentWithPatch(ApiTester $I, $scenario) - { - $I->wantTo('Update an component with PATCH'); - - // create - $component = \App\Models\Component::factory()->ramCrucial4()->create([ - 'name' => 'Original Component Name', - 'company_id' => 2, - 'location_id' => 3, - ]); - $I->assertInstanceOf(\App\Models\Component::class, $component); - - $temp_component = \App\Models\Component::factory()->ssdCrucial240()->make([ - 'company_id' => 3, - 'name' => 'updated component name', - 'location_id' => 1, - ]); - - $data = [ - 'category_id' => $temp_component->category_id, - 'company_id' => $temp_component->company->id, - 'location_id' => $temp_component->location_id, - 'min_amt' => $temp_component->min_amt, - 'name' => $temp_component->name, - 'order_number' => $temp_component->order_number, - 'purchase_cost' => $temp_component->purchase_cost, - 'purchase_date' => $temp_component->purchase_date, - 'qty' => $temp_component->qty, - 'serial' => $temp_component->serial, - ]; - - $I->assertNotEquals($component->name, $data['name']); - - // update - $I->sendPATCH('/components/'.$component->id, $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/components/message.update.success'), $response->messages); - $I->assertEquals($component->id, $response->payload->id); // component id does not change - $I->assertEquals($temp_component->company_id, $response->payload->company_id); // company_id updated - $I->assertEquals($temp_component->name, $response->payload->name); // component name updated - $I->assertEquals($temp_component->location_id, $response->payload->location_id); // component location_id updated - $temp_component->created_at = Carbon::parse($response->payload->created_at); - $temp_component->updated_at = Carbon::parse($response->payload->updated_at); - $temp_component->id = $component->id; - // verify - $I->sendGET('/components/'.$component->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - $I->seeResponseContainsJson((new ComponentsTransformer)->transformComponent($temp_component)); - } - - /** @test */ - public function deleteComponentTest(ApiTester $I, $scenario) - { - $I->wantTo('Delete an component'); - - // create - $component = \App\Models\Component::factory()->ramCrucial4()->create([ - 'name' => 'Soon to be deleted', - ]); - $I->assertInstanceOf(\App\Models\Component::class, $component); - - // delete - $I->sendDELETE('/components/'.$component->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - // dd($response); - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/components/message.delete.success'), $response->messages); - - // verify, expect a 200 - $I->sendGET('/components/'.$component->id); - - $I->seeResponseCodeIs(200); - $I->seeResponseIsJson(); - } -} diff --git a/tests/api/ApiConsumablesCest.php b/tests/api/ApiConsumablesCest.php deleted file mode 100644 index 8490c3a56e..0000000000 --- a/tests/api/ApiConsumablesCest.php +++ /dev/null @@ -1,155 +0,0 @@ -user = \App\Models\User::find(1); - $I->haveHttpHeader('Accept', 'application/json'); - $I->amBearerAuthenticated($I->getToken($this->user)); - } - - /** @test */ - public function indexConsumables(ApiTester $I) - { - $I->wantTo('Get a list of consumables'); - - // call - $I->sendGET('/consumables?limit=10'); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse(), true); - // sample verify - $consumable = App\Models\Consumable::orderByDesc('created_at')->take(10)->get()->shuffle()->first(); - - $I->seeResponseContainsJson($I->removeTimestamps((new ConsumablesTransformer)->transformConsumable($consumable))); - } - - /** @test */ - public function createConsumable(ApiTester $I, $scenario) - { - $I->wantTo('Create a new consumable'); - - $temp_consumable = \App\Models\Consumable::factory()->ink()->make([ - 'name' => 'Test Consumable Name', - 'company_id' => 2, - ]); - - // setup - $data = [ - 'category_id' => $temp_consumable->category_id, - 'company_id' => $temp_consumable->company->id, - 'location_id' => $temp_consumable->location_id, - 'manufacturer_id' => $temp_consumable->manufacturer_id, - 'name' => $temp_consumable->name, - 'order_number' => $temp_consumable->order_number, - 'purchase_cost' => $temp_consumable->purchase_cost, - 'purchase_date' => $temp_consumable->purchase_date, - 'qty' => $temp_consumable->qty, - 'model_number' => $temp_consumable->model_number, - ]; - - // create - $I->sendPOST('/consumables', $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - } - - // Put is routed to the same method in the controller - // DO we actually need to test both? - - /** @test */ - public function updateConsumableWithPatch(ApiTester $I, $scenario) - { - $I->wantTo('Update an consumable with PATCH'); - - // create - $consumable = \App\Models\Consumable::factory()->ink()->create([ - 'name' => 'Original Consumable Name', - 'company_id' => 2, - 'location_id' => 3, - ]); - $I->assertInstanceOf(\App\Models\Consumable::class, $consumable); - - $temp_consumable = \App\Models\Consumable::factory()->cardstock()->make([ - 'company_id' => 3, - 'name' => 'updated consumable name', - 'location_id' => 1, - ]); - - $data = [ - 'category_id' => $temp_consumable->category_id, - 'company_id' => $temp_consumable->company->id, - 'item_no' => $temp_consumable->item_no, - 'location_id' => $temp_consumable->location_id, - 'name' => $temp_consumable->name, - 'order_number' => $temp_consumable->order_number, - 'purchase_cost' => $temp_consumable->purchase_cost, - 'purchase_date' => $temp_consumable->purchase_date, - 'model_number' => $temp_consumable->model_number, - 'manufacturer_id' => $temp_consumable->manufacturer_id, - 'supplier_id' => $temp_consumable->supplier_id, - 'qty' => $temp_consumable->qty, - ]; - - $I->assertNotEquals($consumable->name, $data['name']); - - // update - $I->sendPATCH('/consumables/'.$consumable->id, $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/consumables/message.update.success'), $response->messages); - $I->assertEquals($consumable->id, $response->payload->id); // consumable id does not change - $I->assertEquals($temp_consumable->company_id, $response->payload->company_id); // company_id updated - $I->assertEquals($temp_consumable->name, $response->payload->name); // consumable name updated - $I->assertEquals($temp_consumable->location_id, $response->payload->location_id); // consumable location_id updated - $temp_consumable->created_at = Carbon::parse($response->payload->created_at); - $temp_consumable->updated_at = Carbon::parse($response->payload->updated_at); - $temp_consumable->id = $consumable->id; - // verify - $I->sendGET('/consumables/'.$consumable->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - $I->seeResponseContainsJson((new ConsumablesTransformer)->transformConsumable($temp_consumable)); - } - - /** @test */ - public function deleteConsumableTest(ApiTester $I, $scenario) - { - $I->wantTo('Delete an consumable'); - - // create - $consumable = \App\Models\Consumable::factory()->ink()->create([ - 'name' => 'Soon to be deleted', - ]); - $I->assertInstanceOf(\App\Models\Consumable::class, $consumable); - - // delete - $I->sendDELETE('/consumables/'.$consumable->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/consumables/message.delete.success'), $response->messages); - - // verify, expect a 200 - $I->sendGET('/consumables/'.$consumable->id); - $I->seeResponseCodeIs(200); - $I->seeResponseIsJson(); - } -} diff --git a/tests/api/ApiLicenseSeatsCest.php b/tests/api/ApiLicenseSeatsCest.php deleted file mode 100644 index 664915bb4c..0000000000 --- a/tests/api/ApiLicenseSeatsCest.php +++ /dev/null @@ -1,185 +0,0 @@ -user = \App\Models\User::find(1); - $I->haveHttpHeader('Accept', 'application/json'); - $I->amBearerAuthenticated($I->getToken($this->user)); - } - - /** @test */ - public function indexLicenseSeats(ApiTester $I) - { - $I->wantTo('Get a list of license seats for a specific license'); - - // call - $I->sendGET('/licenses/1/seats?limit=10&order=desc'); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - // sample verify - $licenseSeats = App\Models\LicenseSeat::where('license_id', 1) - ->orderBy('id', 'desc')->take(10)->get(); - // pick a random seat - $licenseSeat = $licenseSeats->random(); - // need the index in the original list so that the "name" field is determined correctly - $licenseSeatNumber = 0; - foreach ($licenseSeats as $index=>$seat) { - if ($licenseSeat === $seat) { - $licenseSeatNumber = $index + 1; - } - } - $I->seeResponseContainsJson($I->removeTimestamps((new LicenseSeatsTransformer)->transformLicenseSeat($licenseSeat, $licenseSeatNumber))); - } - - /** @test */ - public function showLicenseSeat(ApiTester $I) - { - $I->wantTo('Get a license seat'); - - // call - $I->sendGET('/licenses/1/seats/10'); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - // sample verify - $licenseSeat = App\Models\LicenseSeat::findOrFail(10); - $I->seeResponseContainsJson($I->removeTimestamps((new LicenseSeatsTransformer)->transformLicenseSeat($licenseSeat))); - } - - /** @test */ - public function checkoutLicenseSeatToUser(ApiTester $I) - { - $I->wantTo('Checkout a license seat to a user'); - - $user = App\Models\User::all()->random(); - $licenseSeat = App\Models\LicenseSeat::all()->random(); - $endpoint = '/licenses/'.$licenseSeat->license_id.'/seats/'.$licenseSeat->id; - - $data = [ - 'assigned_to' => $user->id, - 'note' => 'Test Checkout to User via API', - ]; - - // update - $I->sendPATCH($endpoint, $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/licenses/message.update.success'), $response->messages); - $I->assertEquals($licenseSeat->license_id, $response->payload->license_id); // license id does not change - $I->assertEquals($licenseSeat->id, $response->payload->id); // license seat id does not change - - // verify - $licenseSeat = $licenseSeat->fresh(); - $I->sendGET($endpoint); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - $I->seeResponseContainsJson($I->removeTimestamps((new LicenseSeatsTransformer)->transformLicenseSeat($licenseSeat))); - - // verify that the last logged action is a checkout - $I->sendGET('/reports/activity?item_type=license&limit=1&item_id='.$licenseSeat->license_id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - $I->seeResponseContainsJson([ - 'action_type' => 'checkout', - ]); - } - - /** @test */ - public function checkoutLicenseSeatToAsset(ApiTester $I) - { - $I->wantTo('Checkout a license seat to an asset'); - - $asset = App\Models\Asset::all()->random(); - $licenseSeat = App\Models\LicenseSeat::all()->random(); - $endpoint = '/licenses/'.$licenseSeat->license_id.'/seats/'.$licenseSeat->id; - - $data = [ - 'asset_id' => $asset->id, - 'note' => 'Test Checkout to Asset via API', - ]; - - // update - $I->sendPATCH($endpoint, $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/licenses/message.update.success'), $response->messages); - $I->assertEquals($licenseSeat->license_id, $response->payload->license_id); // license id does not change - $I->assertEquals($licenseSeat->id, $response->payload->id); // license seat id does not change - - // verify - $licenseSeat = $licenseSeat->fresh(); - $I->sendGET($endpoint); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - $I->seeResponseContainsJson($I->removeTimestamps((new LicenseSeatsTransformer)->transformLicenseSeat($licenseSeat))); - - // verify that the last logged action is a checkout - $I->sendGET('/reports/activity?item_type=license&limit=1&item_id='.$licenseSeat->license_id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - $I->seeResponseContainsJson([ - 'action_type' => 'checkout', - ]); - } - - /** @test */ - public function checkoutLicenseSeatToUserAndAsset(ApiTester $I) - { - $I->wantTo('Checkout a license seat to a user AND an asset'); - - $asset = App\Models\Asset::all()->random(); - $user = App\Models\User::all()->random(); - $licenseSeat = App\Models\LicenseSeat::all()->random(); - $endpoint = '/licenses/'.$licenseSeat->license_id.'/seats/'.$licenseSeat->id; - - $data = [ - 'asset_id' => $asset->id, - 'assigned_to' => $user->id, - 'note' => 'Test Checkout to User and Asset via API', - ]; - - // update - $I->sendPATCH($endpoint, $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/licenses/message.update.success'), $response->messages); - $I->assertEquals($licenseSeat->license_id, $response->payload->license_id); // license id does not change - $I->assertEquals($licenseSeat->id, $response->payload->id); // license seat id does not change - - // verify - $licenseSeat = $licenseSeat->fresh(); - $I->sendGET($endpoint); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - $I->seeResponseContainsJson($I->removeTimestamps((new LicenseSeatsTransformer)->transformLicenseSeat($licenseSeat))); - - // verify that the last logged action is a checkout - $I->sendGET('/reports/activity?item_type=license&limit=1&item_id='.$licenseSeat->license_id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - $I->seeResponseContainsJson([ - 'action_type' => 'checkout', - ]); - } -} diff --git a/tests/api/ApiLicensesCest.php b/tests/api/ApiLicensesCest.php deleted file mode 100644 index 0668e87628..0000000000 --- a/tests/api/ApiLicensesCest.php +++ /dev/null @@ -1,194 +0,0 @@ -user = \App\Models\User::find(1); - $I->haveHttpHeader('Accept', 'application/json'); - $I->amBearerAuthenticated($I->getToken($this->user)); - } - - /** @test */ - public function indexLicenses(ApiTester $I) - { - $I->wantTo('Get a list of licenses'); - - // call - $I->sendGET('/licenses?limit=10&sort=created_at'); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse(), true); - // sample verify - $license = App\Models\License::orderByDesc('created_at') - ->withCount('freeSeats as free_seats_count') - ->take(10)->get()->shuffle()->first(); - $I->seeResponseContainsJson($I->removeTimestamps((new LicensesTransformer)->transformLicense($license))); - } - - /** @test */ - public function createLicense(ApiTester $I, $scenario) - { - $I->wantTo('Create a new license'); - - $temp_license = \App\Models\License::factory()->acrobat()->make([ - 'name' => 'Test License Name', - 'depreciation_id' => 3, - 'company_id' => 2, - ]); - - // setup - $data = [ - 'company_id' => $temp_license->company_id, - 'depreciation_id' => $temp_license->depreciation_id, - 'expiration_date' => $temp_license->expiration_date, - 'license_email' => $temp_license->license_email, - 'license_name' => $temp_license->license_name, - 'maintained' => $temp_license->maintained, - 'manufacturer_id' => $temp_license->manufacturer_id, - 'name' => $temp_license->name, - 'notes' => $temp_license->notes, - 'order_number' => $temp_license->order_number, - 'purchase_cost' => $temp_license->purchase_cost, - 'purchase_date' => $temp_license->purchase_date, - 'purchase_order' => $temp_license->purchase_order, - 'reassignable' => $temp_license->reassignable, - 'seats' => $temp_license->seats, - 'serial' => $temp_license->serial, - 'supplier_id' => $temp_license->supplier_id, - 'termination_date' => $temp_license->termination_date, - ]; - - // create - $I->sendPOST('/licenses', $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - } - - // Put is routed to the same method in the controller - // DO we actually need to test both? - - /** @test */ - public function updateLicenseWithPatch(ApiTester $I, $scenario) - { - $I->wantTo('Update a license with PATCH'); - - // create - $license = \App\Models\License::factory()->acrobat()->create([ - 'name' => 'Original License Name', - 'depreciation_id' => 3, - 'company_id' => 2, - ]); - $I->assertInstanceOf(\App\Models\License::class, $license); - - $temp_license = \App\Models\License::factory()->office()->make([ - 'company_id' => 3, - 'depreciation_id' => 2, - ]); - - $data = [ - 'company_id' => $temp_license->company_id, - 'depreciation_id' => $temp_license->depreciation_id, - 'expiration_date' => $temp_license->expiration_date, - 'license_email' => $temp_license->license_email, - 'license_name' => $temp_license->license_name, - 'maintained' => $temp_license->maintained, - 'manufacturer_id' => $temp_license->manufacturer_id, - 'name' => $temp_license->name, - 'notes' => $temp_license->notes, - 'order_number' => $temp_license->order_number, - 'purchase_cost' => $temp_license->purchase_cost, - 'purchase_date' => $temp_license->purchase_date, - 'purchase_order' => $temp_license->purchase_order, - 'reassignable' => $temp_license->reassignable, - 'seats' => $temp_license->seats, - 'serial' => $temp_license->serial, - 'supplier_id' => $temp_license->supplier_id, - 'category_id' => $temp_license->category_id, - 'termination_date' => $temp_license->termination_date, - ]; - // We aren't checking anyhting out in this test, so this fakes the withCount() that happens on a normal db fetch. - $temp_license->free_seats_count = $temp_license->seats; - $I->assertNotEquals($license->name, $data['name']); - - // update - $I->sendPATCH('/licenses/'.$license->id, $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/licenses/message.update.success'), $response->messages); - $I->assertEquals($license->id, $response->payload->id); // license id does not change - $I->assertEquals($temp_license->name, $response->payload->name); // license name - $temp_license->created_at = Carbon::parse($response->payload->created_at); - $temp_license->updated_at = Carbon::parse($response->payload->updated_at); - $temp_license->id = $license->id; - // verify - $I->sendGET('/licenses/'.$license->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - $I->seeResponseContainsJson((new LicensesTransformer)->transformLicense($temp_license)); - } - - /** @test */ - public function deleteLicenseWithUsersTest(ApiTester $I, $scenario) - { - $I->wantTo('Ensure a license with seats checked out cannot be deleted'); - - // create - $license = \App\Models\License::factory()->acrobat()->create([ - 'name' => 'Soon to be deleted', - ]); - $licenseSeat = $license->freeSeat(); - $licenseSeat->assigned_to = $this->user->id; - $licenseSeat->save(); - $I->assertInstanceOf(\App\Models\License::class, $license); - - // delete - $I->sendDELETE('/licenses/'.$license->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - $I->assertEquals('error', $response->status); - $I->assertEquals(trans('admin/licenses/message.assoc_users'), $response->messages); - } - - /** @test */ - public function deleteLicenseTest(ApiTester $I, $scenario) - { - $I->wantTo('Delete an license'); - - // create - $license = \App\Models\License::factory()->acrobat()->create([ - 'name' => 'Soon to be deleted', - ]); - $I->assertInstanceOf(\App\Models\License::class, $license); - - // delete - $I->sendDELETE('/licenses/'.$license->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/licenses/message.delete.success'), $response->messages); - - // verify, expect a 200 - $I->sendGET('/licenses/'.$license->id); - - $I->seeResponseCodeIs(200); - $I->seeResponseIsJson(); - } -} diff --git a/tests/api/ApiLocationsCest.php b/tests/api/ApiLocationsCest.php deleted file mode 100644 index 536830f00d..0000000000 --- a/tests/api/ApiLocationsCest.php +++ /dev/null @@ -1,154 +0,0 @@ -user = \App\Models\User::find(1); - $I->haveHttpHeader('Accept', 'application/json'); - $I->amBearerAuthenticated($I->getToken($this->user)); - } - - /** @test */ - public function indexLocations(ApiTester $I) - { - $I->wantTo('Get a list of locations'); - - // call - $I->sendGET('/locations?limit=10'); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse(), true); - // sample verify - $location = App\Models\Location::orderByDesc('created_at') - ->withCount('assignedAssets as assigned_assets_count', 'assets as assets_count', 'users as users_count') - ->take(10)->get()->shuffle()->first(); - $I->seeResponseContainsJson($I->removeTimestamps((new LocationsTransformer)->transformLocation($location))); - } - - /** @test */ - public function createLocation(ApiTester $I, $scenario) - { - $I->wantTo('Create a new location'); - - $temp_location = \App\Models\Location::factory()->make([ - 'name' => 'Test Location Tag', - ]); - - // setup - $data = [ - 'name' => $temp_location->name, - 'image' => $temp_location->image, - 'address' => $temp_location->address, - 'address2' => $temp_location->address2, - 'city' => $temp_location->city, - 'state' => $temp_location->state, - 'country' => $temp_location->country, - 'zip' => $temp_location->zip, - 'parent_id' => $temp_location->parent_id, - 'parent_id' => $temp_location->parent_id, - 'manager_id' => $temp_location->manager_id, - 'currency' => $temp_location->currency, - ]; - - // create - $I->sendPOST('/locations', $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - } - - // Put is routed to the same method in the controller - // DO we actually need to test both? - - /** @test */ - public function updateLocationWithPatch(ApiTester $I, $scenario) - { - $I->wantTo('Update an location with PATCH'); - - // create - $location = \App\Models\Location::factory()->create([ - 'name' => 'Original Location Name', - ]); - $I->assertInstanceOf(\App\Models\Location::class, $location); - - $temp_location = \App\Models\Location::factory()->make([ - 'name' => 'updated location name', - ]); - - $data = [ - 'name' => $temp_location->name, - 'image' => $temp_location->image, - 'address' => $temp_location->address, - 'address2' => $temp_location->address2, - 'city' => $temp_location->city, - 'state' => $temp_location->state, - 'country' => $temp_location->country, - 'zip' => $temp_location->zip, - 'parent_id' => $temp_location->parent_id, - 'parent_id' => $temp_location->parent_id, - 'manager_id' => $temp_location->manager_id, - 'currency' => $temp_location->currency, - ]; - - $I->assertNotEquals($location->name, $data['name']); - - // update - $I->sendPATCH('/locations/'.$location->id, $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/locations/message.update.success'), $response->messages); - $I->assertEquals($location->id, $response->payload->id); // location id does not change - $I->assertEquals($temp_location->name, $response->payload->name); // location name updated - - // Some necessary manual copying - $temp_location->created_at = Carbon::parse($response->payload->created_at->datetime); - $temp_location->updated_at = Carbon::parse($response->payload->updated_at->datetime); - $temp_location->id = $location->id; - - // verify - $I->sendGET('/locations/'.$location->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - $I->seeResponseContainsJson((new LocationsTransformer)->transformLocation($temp_location)); - } - - /** @test */ - public function deleteLocationTest(ApiTester $I, $scenario) - { - $I->wantTo('Delete an location'); - - // create - $location = \App\Models\Location::factory()->create([ - 'name' => 'Soon to be deleted', - ]); - $I->assertInstanceOf(\App\Models\Location::class, $location); - - // delete - $I->sendDELETE('/locations/'.$location->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/locations/message.delete.success'), $response->messages); - - // verify, expect a 200 - $I->sendGET('/locations/'.$location->id); - $I->seeResponseCodeIs(200); - $I->seeResponseIsJson(); - } -} diff --git a/tests/api/ApiManufacturersCest.php b/tests/api/ApiManufacturersCest.php deleted file mode 100644 index be2f4cc483..0000000000 --- a/tests/api/ApiManufacturersCest.php +++ /dev/null @@ -1,142 +0,0 @@ -user = \App\Models\User::find(1); - $I->haveHttpHeader('Accept', 'application/json'); - $I->amBearerAuthenticated($I->getToken($this->user)); - } - - /** @test */ - public function indexManufacturers(ApiTester $I) - { - $I->wantTo('Get a list of manufacturers'); - - // call - $I->sendGET('/manufacturers?order_by=id&limit=10'); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse(), true); - // sample verify - $manufacturer = App\Models\Manufacturer::withCount('assets as assets_count', 'accessories as accessories_count', 'consumables as consumables_count', 'licenses as licenses_count') - ->orderByDesc('created_at')->take(10)->get()->shuffle()->first(); - - $I->seeResponseContainsJson($I->removeTimestamps((new ManufacturersTransformer)->transformManufacturer($manufacturer))); - } - - /** @test */ - public function createManufacturer(ApiTester $I, $scenario) - { - $I->wantTo('Create a new manufacturer'); - - $temp_manufacturer = \App\Models\Manufacturer::factory()->apple()->make([ - 'name' => 'Test Manufacturer Tag', - ]); - - // setup - $data = [ - 'image' => $temp_manufacturer->image, - 'name' => $temp_manufacturer->name, - 'support_email' => $temp_manufacturer->support_email, - 'support_phone' => $temp_manufacturer->support_phone, - 'support_url' => $temp_manufacturer->support_url, - 'url' => $temp_manufacturer->url, - ]; - - // create - $I->sendPOST('/manufacturers', $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - } - - // Put is routed to the same method in the controller - // DO we actually need to test both? - - /** @test */ - public function updateManufacturerWithPatch(ApiTester $I, $scenario) - { - $I->wantTo('Update an manufacturer with PATCH'); - - // create - $manufacturer = \App\Models\Manufacturer::factory()->apple() - ->create([ - 'name' => 'Original Manufacturer Name', - ]); - $I->assertInstanceOf(\App\Models\Manufacturer::class, $manufacturer); - - $temp_manufacturer = \App\Models\Manufacturer::factory()->dell()->make([ - 'name' => 'updated manufacturer name', - ]); - - $data = [ - 'image' => $temp_manufacturer->image, - 'name' => $temp_manufacturer->name, - 'support_email' => $temp_manufacturer->support_email, - 'support_phone' => $temp_manufacturer->support_phone, - 'support_url' => $temp_manufacturer->support_url, - 'url' => $temp_manufacturer->url, - ]; - - $I->assertNotEquals($manufacturer->name, $data['name']); - - // update - $I->sendPATCH('/manufacturers/'.$manufacturer->id, $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/manufacturers/message.update.success'), $response->messages); - $I->assertEquals($manufacturer->id, $response->payload->id); // manufacturer id does not change - $I->assertEquals($temp_manufacturer->name, $response->payload->name); // manufacturer name updated - // Some manual copying to compare against - $temp_manufacturer->created_at = Carbon::parse($response->payload->created_at); - $temp_manufacturer->updated_at = Carbon::parse($response->payload->updated_at); - $temp_manufacturer->id = $manufacturer->id; - - // verify - $I->sendGET('/manufacturers/'.$manufacturer->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - $I->seeResponseContainsJson((new ManufacturersTransformer)->transformManufacturer($temp_manufacturer)); - } - - /** @test */ - public function deleteManufacturerTest(ApiTester $I, $scenario) - { - $I->wantTo('Delete an manufacturer'); - - // create - $manufacturer = \App\Models\Manufacturer::factory()->apple()->create([ - 'name' => 'Soon to be deleted', - ]); - $I->assertInstanceOf(\App\Models\Manufacturer::class, $manufacturer); - - // delete - $I->sendDELETE('/manufacturers/'.$manufacturer->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/manufacturers/message.delete.success'), $response->messages); - - // verify, expect a 200 - $I->sendGET('/manufacturers/'.$manufacturer->id); - $I->seeResponseCodeIs(200); - $I->seeResponseIsJson(); - } -} diff --git a/tests/api/ApiModelsCest.php b/tests/api/ApiModelsCest.php deleted file mode 100644 index 1d3d6fc788..0000000000 --- a/tests/api/ApiModelsCest.php +++ /dev/null @@ -1,145 +0,0 @@ -user = \App\Models\User::find(1); - $I->haveHttpHeader('Accept', 'application/json'); - $I->amBearerAuthenticated($I->getToken($this->user)); - } - - /** @test */ - public function indexAssetModels(ApiTester $I) - { - $I->wantTo('Get a list of assetmodels'); - - // call - $I->sendGET('/models?limit=10'); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse(), true); - $assetmodel = App\Models\AssetModel::orderByDesc('created_at') - ->withCount('assets as assets_count')->take(10)->get()->shuffle()->first(); - $I->seeResponseContainsJson($I->removeTimestamps((new AssetModelsTransformer)->transformAssetModel($assetmodel))); - } - - /** @test */ - public function createAssetModel(ApiTester $I, $scenario) - { - $I->wantTo('Create a new assetmodel'); - - $temp_assetmodel = \App\Models\AssetModel::factory()->mbp13Model()->make([ - 'name' => 'Test AssetModel Tag', - ]); - - // setup - $data = [ - 'category_id' => $temp_assetmodel->category_id, - 'depreciation_id' => $temp_assetmodel->depreciation_id, - 'eol' => $temp_assetmodel->eol, - 'image' => $temp_assetmodel->image, - 'manufacturer_id' => $temp_assetmodel->manufacturer_id, - 'model_number' => $temp_assetmodel->model_number, - 'name' => $temp_assetmodel->name, - 'notes' => $temp_assetmodel->notes, - ]; - - // create - $I->sendPOST('/models', $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - } - - // Put is routed to the same method in the controller - // DO we actually need to test both? - - /** @test */ - public function updateAssetModelWithPatch(ApiTester $I, $scenario) - { - $I->wantTo('Update an assetmodel with PATCH'); - - // create - $assetmodel = \App\Models\AssetModel::factory()->mbp13Model()->create([ - 'name' => 'Original AssetModel Name', - ]); - $I->assertInstanceOf(\App\Models\AssetModel::class, $assetmodel); - - $temp_assetmodel = \App\Models\AssetModel::factory()->polycomcxModel()->make([ - 'name' => 'updated AssetModel name', - 'fieldset_id' => 2, - ]); - - $data = [ - 'category_id' => $temp_assetmodel->category_id, - 'depreciation_id' => $temp_assetmodel->depreciation_id, - 'eol' => $temp_assetmodel->eol, - 'image' => $temp_assetmodel->image, - 'manufacturer_id' => $temp_assetmodel->manufacturer_id, - 'model_number' => $temp_assetmodel->model_number, - 'name' => $temp_assetmodel->name, - 'notes' => $temp_assetmodel->notes, - 'fieldset' => $temp_assetmodel->fieldset->id, - ]; - - $I->assertNotEquals($assetmodel->name, $data['name']); - - // update - $I->sendPATCH('/models/'.$assetmodel->id, $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/models/message.update.success'), $response->messages); - $I->assertEquals($assetmodel->id, $response->payload->id); // assetmodel id does not change - $I->assertEquals($temp_assetmodel->name, $response->payload->name); // assetmodel name updated - - // Some necessary manual copying - $temp_assetmodel->created_at = Carbon::parse($response->payload->created_at); - $temp_assetmodel->updated_at = Carbon::parse($response->payload->updated_at); - $temp_assetmodel->id = $assetmodel->id; - // verify - $I->sendGET('/models/'.$assetmodel->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - $I->seeResponseContainsJson((new AssetModelsTransformer)->transformAssetModel($temp_assetmodel)); - } - - /** @test */ - public function deleteAssetModelTest(ApiTester $I, $scenario) - { - $I->wantTo('Delete an assetmodel'); - - // create - $assetmodel = \App\Models\AssetModel::factory()->mbp13Model()->create([ - 'name' => 'Soon to be deleted', - ]); - $I->assertInstanceOf(\App\Models\AssetModel::class, $assetmodel); - - // delete - $I->sendDELETE('/models/'.$assetmodel->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/models/message.delete.success'), $response->messages); - - // verify, expect a 200 - $I->sendGET('/models/'.$assetmodel->id); - $I->seeResponseCodeIs(200); - $I->seeResponseIsJson(); - } -} diff --git a/tests/api/ApiStatusLabelsCest.php b/tests/api/ApiStatusLabelsCest.php deleted file mode 100644 index fabb71d51f..0000000000 --- a/tests/api/ApiStatusLabelsCest.php +++ /dev/null @@ -1,142 +0,0 @@ -user = \App\Models\User::find(1); - $I->haveHttpHeader('Accept', 'application/json'); - $I->amBearerAuthenticated($I->getToken($this->user)); - } - - /** @test */ - public function indexStatuslabels(ApiTester $I) - { - $I->wantTo('Get a list of statuslabels'); - - // call - $I->sendGET('/statuslabels?limit=10'); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse(), true); - // sample verify - $statuslabel = App\Models\Statuslabel::orderByDesc('created_at') - ->withCount('assets as assets_count') - ->take(10)->get()->shuffle()->first(); - $I->seeResponseContainsJson($I->removeTimestamps((new StatuslabelsTransformer)->transformStatuslabel($statuslabel))); - } - - /** @test */ - public function createStatuslabel(ApiTester $I, $scenario) - { - $I->wantTo('Create a new statuslabel'); - - $temp_statuslabel = \App\Models\Statuslabel::factory()->make([ - 'name' => 'Test Statuslabel Tag', - ]); - - // setup - $data = [ - 'name' => $temp_statuslabel->name, - 'archived' => $temp_statuslabel->archived, - 'deployable' => $temp_statuslabel->deployable, - 'notes' => $temp_statuslabel->notes, - 'pending' => $temp_statuslabel->pending, - 'type' => 'deployable', - ]; - - // create - $I->sendPOST('/statuslabels', $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - } - - // Put is routed to the same method in the controller - // DO we actually need to test both? - - /** @test */ - public function updateStatuslabelWithPatch(ApiTester $I, $scenario) - { - $I->wantTo('Update an statuslabel with PATCH'); - - // create - $statuslabel = \App\Models\Statuslabel::factory()->rtd()->create([ - 'name' => 'Original Statuslabel Name', - ]); - $I->assertInstanceOf(\App\Models\Statuslabel::class, $statuslabel); - - $temp_statuslabel = \App\Models\Statuslabel::factory()->pending()->make([ - 'name' => 'updated statuslabel name', - 'type' => 'pending', - ]); - - $data = [ - 'name' => $temp_statuslabel->name, - 'archived' => $temp_statuslabel->archived, - 'deployable' => $temp_statuslabel->deployable, - 'notes' => $temp_statuslabel->notes, - 'pending' => $temp_statuslabel->pending, - 'type' => $temp_statuslabel->type, - ]; - - $I->assertNotEquals($statuslabel->name, $data['name']); - - // update - $I->sendPATCH('/statuslabels/'.$statuslabel->id, $data); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - // dd($response); - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/statuslabels/message.update.success'), $response->messages); - $I->assertEquals($statuslabel->id, $response->payload->id); // statuslabel id does not change - $I->assertEquals($temp_statuslabel->name, $response->payload->name); // statuslabel name updated - // Some manual copying to compare against - $temp_statuslabel->created_at = Carbon::parse($response->payload->created_at); - $temp_statuslabel->updated_at = Carbon::parse($response->payload->updated_at); - $temp_statuslabel->id = $statuslabel->id; - - // verify - $I->sendGET('/statuslabels/'.$statuslabel->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - $I->seeResponseContainsJson((new StatuslabelsTransformer)->transformStatuslabel($temp_statuslabel)); - } - - /** @test */ - public function deleteStatuslabelTest(ApiTester $I, $scenario) - { - $I->wantTo('Delete an statuslabel'); - - // create - $statuslabel = \App\Models\Statuslabel::factory()->create([ - 'name' => 'Soon to be deleted', - ]); - $I->assertInstanceOf(\App\Models\Statuslabel::class, $statuslabel); - - // delete - $I->sendDELETE('/statuslabels/'.$statuslabel->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/statuslabels/message.delete.success'), $response->messages); - - // verify, expect a 200 - $I->sendGET('/statuslabels/'.$statuslabel->id); - $I->seeResponseCodeIs(200); - $I->seeResponseIsJson(); - } -} diff --git a/tests/api/ApiUsersCest.php b/tests/api/ApiUsersCest.php deleted file mode 100644 index 912653be2d..0000000000 --- a/tests/api/ApiUsersCest.php +++ /dev/null @@ -1,205 +0,0 @@ -user = \App\Models\User::find(1); - $I->haveHttpHeader('Accept', 'application/json'); - $I->amBearerAuthenticated($I->getToken($this->user)); - } - - /** @test */ - public function indexUsers(ApiTester $I) - { - $I->wantTo('Get a list of users'); - - // call - $I->sendGET('/users?limit=10&sort=created_at'); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse(), true); - // sample verify - $user = App\Models\User::orderByDesc('created_at') - ->withCount('assets as assets_count', 'licenses as licenses_count', 'accessories as accessories_count', 'consumables as consumables_count') - ->take(10)->get()->shuffle()->first(); - $I->seeResponseContainsJson($I->removeTimestamps((new UsersTransformer)->transformUser($user))); - } - - /** @test */ - public function createUser(ApiTester $I, $scenario) - { - $I->wantTo('Create a new user'); - - $temp_user = \App\Models\User::factory()->make([ - 'name' => 'Test User Name', - ]); - Group::factory()->count(2)->create(); - $groups = Group::pluck('id'); - // setup - $data = [ - 'activated' => $temp_user->activated, - 'address' => $temp_user->address, - 'city' => $temp_user->city, - 'company_id' => $temp_user->company_id, - 'country' => $temp_user->country, - 'department_id' => $temp_user->department_id, - 'email' => $temp_user->email, - 'employee_num' => $temp_user->employee_num, - 'first_name' => $temp_user->first_name, - 'jobtitle' => $temp_user->jobtitle, - 'last_name' => $temp_user->last_name, - 'locale' => $temp_user->locale, - 'location_id' => $temp_user->location_id, - 'notes' => $temp_user->notes, - 'manager_id' => $temp_user->manager_id, - 'password' => $temp_user->password, - 'password_confirmation' => $temp_user->password, - 'phone' => $temp_user->phone, - 'state' => $temp_user->state, - 'username' => $temp_user->username, - 'zip' => $temp_user->zip, - 'groups' => $groups, - ]; - - // create - $I->sendPOST('/users', $data); - $I->seeResponseIsJson(); - $user = User::where('username', $temp_user->username)->first(); - $I->assertEquals($groups, $user->groups()->pluck('id')); - $I->seeResponseCodeIs(200); - } - - // Put is routed to the same method in the controller - // DO we actually need to test both? - - /** @test */ - public function updateUserWithPatch(ApiTester $I, $scenario) - { - $I->wantTo('Update an user with PATCH'); - - // create - $user = \App\Models\User::factory()->create([ - 'first_name' => 'Original User Name', - 'company_id' => 2, - 'location_id' => 3, - ]); - $I->assertInstanceOf(\App\Models\User::class, $user); - - $temp_user = \App\Models\User::factory()->make([ - 'company_id' => 3, - 'first_name' => 'updated user name', - 'location_id' => 1, - ]); - - Group::factory()->count(2)->create(); - $groups = Group::pluck('id'); - - $data = [ - 'activated' => $temp_user->activated, - 'address' => $temp_user->address, - 'city' => $temp_user->city, - 'company_id' => $temp_user->company_id, - 'country' => $temp_user->country, - 'department_id' => $temp_user->department_id, - 'email' => $temp_user->email, - 'employee_num' => $temp_user->employee_num, - 'first_name' => $temp_user->first_name, - 'groups' => $groups, - 'jobtitle' => $temp_user->jobtitle, - 'last_name' => $temp_user->last_name, - 'locale' => $temp_user->locale, - 'location_id' => $temp_user->location_id, - 'notes' => $temp_user->notes, - 'manager_id' => $temp_user->manager_id, - 'password' => $temp_user->password, - 'phone' => $temp_user->phone, - 'state' => $temp_user->state, - 'username' => $temp_user->username, - 'zip' => $temp_user->zip, - ]; - - $I->assertNotEquals($user->first_name, $data['first_name']); - - // update - $I->sendPATCH('/users/'.$user->id, $data); - $I->seeResponseIsJson(); - - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/users/message.success.update'), $response->messages); - $I->assertEquals($user->id, $response->payload->id); // user id does not change - $I->assertEquals($temp_user->company_id, $response->payload->company->id); // company_id updated - $I->assertEquals($temp_user->first_name, $response->payload->first_name); // user name updated - $I->assertEquals($temp_user->location_id, $response->payload->location->id); // user location_id updated - $newUser = User::where('username', $temp_user->username)->first(); - $I->assertEquals($groups, $newUser->groups()->pluck('id')); - $temp_user->created_at = Carbon::parse($response->payload->created_at->datetime); - $temp_user->updated_at = Carbon::parse($response->payload->updated_at->datetime); - $temp_user->id = $user->id; - // verify - $I->sendGET('/users/'.$user->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - $I->seeResponseContainsJson((new UsersTransformer)->transformUser($temp_user)); - } - - /** @test */ - public function deleteUserTest(ApiTester $I, $scenario) - { - $I->wantTo('Delete an user'); - - // create - $user = \App\Models\User::factory()->create([ - 'first_name' => 'Soon to be deleted', - ]); - $I->assertInstanceOf(\App\Models\User::class, $user); - - // delete - $I->sendDELETE('/users/'.$user->id); - $I->seeResponseIsJson(); - $I->seeResponseCodeIs(200); - - $response = json_decode($I->grabResponse()); - // dd($response); - $I->assertEquals('success', $response->status); - $I->assertEquals(trans('admin/users/message.success.delete'), $response->messages); - - // verify, expect a 200 - $I->sendGET('/users/'.$user->id); - - $I->seeResponseCodeIs(200); - $I->seeResponseIsJson(); - } - - /** @test */ - public function fetchUserAssetsTest(ApiTester $I, $scenario) - { - $I->wantTo('Fetch assets for a user'); - - $user = User::has('assets')->first(); - $asset = $user->assets->shuffle()->first(); - $I->sendGET("/users/{$user->id}/assets"); - $response = json_decode($I->grabResponse()); - $I->seeResponseCodeIs(200); - $I->seeResponseIsJson(); - - // Just test a random one. - $I->seeResponseContainsJson([ - 'asset_tag' => $asset->asset_tag, - ]); - } -} diff --git a/tests/api/_bootstrap.php b/tests/api/_bootstrap.php deleted file mode 100644 index 62817a53c4..0000000000 --- a/tests/api/_bootstrap.php +++ /dev/null @@ -1,3 +0,0 @@ -amOnPage('/login'); - $I->fillField('username', 'admin'); - $I->fillField('password', 'password'); - $I->click('Login'); - $I->seeAuthentication(); - } - - // tests - public function loadsFormWithoutErrors(FunctionalTester $I) - { - $I->wantTo('ensure that the create accessories form loads without errors'); - $I->lookForwardTo('seeing it load without errors'); - $I->amOnPage('/accessories/create'); - $I->seeResponseCodeIs(200); - $I->dontSee('Create Accessory', '.page-header'); - $I->see('Create Accessory', 'h1.pull-left'); - } - - public function failsEmptyValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with blank elements'); - $I->amOnPage('/accessories/create'); - $I->seeResponseCodeIs(200); - $I->click('Save'); - $I->seeElement('.alert-danger'); - $I->see('The name field is required.', '.alert-msg'); - $I->see('The category id field is required.', '.alert-msg'); - $I->see('The qty field is required.', '.alert-msg'); - } - - public function failsShortValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with short name'); - $I->amOnPage('/accessories/create'); - $I->seeResponseCodeIs(200); - $I->fillField('name', 't2'); - $I->fillField('qty', '-15'); - $I->fillField('min_amt', '-15'); - $I->click('Save'); - $I->seeElement('.alert-danger'); - $I->see('The name must be at least 3 characters', '.alert-msg'); - $I->see('The category id field is required', '.alert-msg'); - $I->see('The qty must be at least 1', '.alert-msg'); - $I->see('The min amt must be at least 0', '.alert-msg'); - } - - public function passesCorrectValidation(FunctionalTester $I) - { - $accessory = \App\Models\Accessory::factory()->appleBtKeyboard()->make(); - $values = [ - 'category_id' => $accessory->category_id, - 'location_id' => $accessory->location_id, - 'manufacturer_id' => $accessory->manufacturer_id, - 'min_amt' => $accessory->min_amt, - 'name' => 'Test Accessory', - 'order_number' => $accessory->order_number, - 'purchase_date' => '2016-01-01', - 'qty' => $accessory->qty, - ]; - - $I->wantTo('Test Validation Succeeds'); - $I->amOnPage('/accessories/create'); - $I->seeResponseCodeIs(200); - - $I->submitForm('form#create-form', $values); - $I->seeRecord('accessories', $values); - - $I->dontSee('<span class="'); - $I->seeElement('.alert-success'); - } - - public function allowsDelete(FunctionalTester $I) - { - $I->wantTo('Ensure I can delete an accessory'); - $I->sendDelete(route('accessories.destroy', $I->getAccessoryId()), ['_token' => csrf_token()]); - $I->seeResponseCodeIs(200); - } -} diff --git a/tests/functional/AssetModelsCest.php b/tests/functional/AssetModelsCest.php deleted file mode 100644 index fbf43a5c57..0000000000 --- a/tests/functional/AssetModelsCest.php +++ /dev/null @@ -1,63 +0,0 @@ -amOnPage('/login'); - $I->fillField('username', 'admin'); - $I->fillField('password', 'password'); - $I->click('Login'); - } - - // tests - public function tryToTest(FunctionalTester $I) - { - $I->wantTo('Test Asset Model Creation'); - $I->lookForwardTo('seeing it load without errors'); - $I->amOnPage(route('models.create')); - $I->seeInTitle('Create Asset Model'); - $I->see('Create Asset Model', 'h1.pull-left'); - } - - public function failsEmptyValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with blank elements'); - $I->amOnPage(route('models.create')); - $I->click('Save'); - $I->seeElement('.alert-danger'); - $I->see('The name field is required.', '.alert-msg'); - $I->see('The manufacturer id field is required.', '.alert-msg'); - $I->see('The category id field is required.', '.alert-msg'); - } - - public function passesCorrectValidation(FunctionalTester $I) - { - $model = \App\Models\AssetModel::factory()->mbp13Model()->make(['name'=>'Test Model']); - $values = [ - 'category_id' => $model->category_id, - 'depreciation_id' => $model->depreciation_id, - 'eol' => $model->eol, - 'manufacturer_id' => $model->manufacturer_id, - 'model_number' => $model->model_number, - 'name' => $model->name, - 'notes' => $model->notes, - ]; - - $I->wantTo('Test Validation Succeeds'); - $I->amOnPage(route('models.create')); - - $I->submitForm('form#create-form', $values); - $I->seeRecord('models', $values); - $I->dontSee('<span class="'); - $I->seeElement('.alert-success'); - } - - public function allowsDelete(FunctionalTester $I) - { - $I->wantTo('Ensure I can delete an asset model'); - $model = \App\Models\AssetModel::factory()->mbp13Model()->create(['name' => 'Test Model']); - $I->sendDelete(route('models.destroy', $model->id), ['_token' => csrf_token()]); - $I->seeResponseCodeIs(200); - } -} diff --git a/tests/functional/AssetsCest.php b/tests/functional/AssetsCest.php deleted file mode 100644 index 3c7ffc1282..0000000000 --- a/tests/functional/AssetsCest.php +++ /dev/null @@ -1,94 +0,0 @@ -amOnPage('/login'); - $I->fillField('username', 'admin'); - $I->fillField('password', 'password'); - $I->click('Login'); - } - - // tests - public function tryToTest(FunctionalTester $I) - { - $I->wantTo('ensure that the create assets form loads without errors'); - $I->lookForwardTo('seeing it load without errors'); - $I->amOnPage(route('hardware.create')); - $I->dontSee('Create Asset', '.page-header'); - $I->see('Create Asset', 'h1.pull-left'); - } - - public function failsEmptyValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with blank elements'); - $I->amOnPage(route('hardware.create')); - // Settings factory can enable auto prefixes, which generate a random asset id. Lets clear it out for the sake of this test. - $I->fillField('#asset_tag', ''); - $I->click('Save'); - $I->see('The asset tag field is required.', '.alert-msg'); - $I->see('The model id field is required.', '.alert-msg'); - $I->see('The status id field is required.', '.alert-msg'); - } - - public function passesCreateAndCheckout(FunctionalTester $I) - { - $asset = \App\Models\Asset::factory()->laptopMbp()->make([ - 'asset_tag'=>'test tag', - 'name'=> 'test asset', - 'company_id'=>1, - 'warranty_months'=>15, - ]); - $userId = $I->getUserId(); - $values = [ - 'asset_tags[1]' => $asset->asset_tag, - 'assigned_user' => $userId, - 'company_id' => $asset->company_id, - 'model_id' => $asset->model_id, - 'name' => $asset->name, - 'notes' => $asset->notes, - 'order_number' => $asset->order_number, - 'purchase_cost' => $asset->purchase_cost, - 'purchase_date' => '2016-01-01', - 'requestable' => $asset->requestable, - 'rtd_location_id' => $asset->rtd_location_id, - 'serials[1]' => $asset->serial, - 'status_id' => $asset->status_id, - 'supplier_id' => $asset->supplier_id, - 'warranty_months' => $asset->warranty_months, - ]; - - $seenValues = [ - 'asset_tag' => $asset->asset_tag, - 'assigned_to' => $userId, - 'assigned_type' => \App\Models\User::class, - 'company_id' => $asset->company_id, - 'model_id' => $asset->model_id, - 'name' => $asset->name, - 'notes' => $asset->notes, - 'order_number' => $asset->order_number, - 'purchase_cost' => $asset->purchase_cost, - 'purchase_date' => '2016-01-01', - 'requestable' => $asset->requestable, - 'rtd_location_id' => $asset->rtd_location_id, - 'serial' => $asset->serial, - 'status_id' => $asset->status_id, - 'supplier_id' => $asset->supplier_id, - 'warranty_months' => $asset->warranty_months, - ]; - - $I->wantTo('Test Validation Succeeds'); - $I->amOnPage(route('hardware.create')); - $I->submitForm('form#create-form', $values); - $I->seeRecord('assets', $seenValues); - $I->seeResponseCodeIs(200); - } - - public function allowsDelete(FunctionalTester $I) - { - $I->wantTo('Ensure I can delete an asset'); - $I->sendDelete(route('hardware.destroy', $I->getAssetId()), ['_token' => csrf_token()]); - $I->seeResponseCodeIs(200); - } -} diff --git a/tests/functional/CategoriesCest.php b/tests/functional/CategoriesCest.php deleted file mode 100644 index ff89fcc152..0000000000 --- a/tests/functional/CategoriesCest.php +++ /dev/null @@ -1,66 +0,0 @@ -amOnPage('/login'); - $I->fillField('username', 'admin'); - $I->fillField('password', 'password'); - $I->click('Login'); - } - - public function _after(FunctionalTester $I) - { - } - - // tests - public function tryToTest(FunctionalTester $I) - { - $I->wantTo('Test Category Creation'); - $I->lookForwardTo('seeing it load without errors'); - $I->amOnPage(route('categories.create')); - $I->seeInTitle('Create Category'); - $I->see('Create Category', 'h1.pull-left'); - } - - public function failsEmptyValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with blank elements'); - $I->amOnPage(route('categories.create')); - $I->click('Save'); - $I->seeElement('.alert-danger'); - $I->see('The name field is required.', '.alert-msg'); - $I->see('The category type field is required.', '.alert-msg'); - } - - public function passesCorrectValidation(FunctionalTester $I) - { - $category = \App\Models\Category::factory()->assetLaptopCategory()->make([ - 'name' => 'Test Category', - ]); - $values = [ - 'category_type' => $category->category_type, - 'checkin_email' => $category->checkin_email, - 'eula_text' => $category->eula_text, - 'name' => $category->name, - 'require_acceptance' => $category->require_acceptance, - ]; - $I->wantTo('Test Validation Succeeds'); - $I->amOnPage(route('categories.create')); - $I->submitForm('form#create-form', $values); - $I->seeRecord('categories', $values); - $I->dontSee('<span class="'); - $I->seeElement('.alert-success'); - } - - public function allowsDelete(FunctionalTester $I) - { - $I->wantTo('Ensure I can delete a category'); - $category = \App\Models\Category::factory()->assetLaptopCategory()->create([ - 'name'=>'Deletable Test Category', - ]); - $I->sendDelete(route('categories.destroy', $category->id), ['_token' => csrf_token()]); - $I->seeResponseCodeIs(200); - } -} diff --git a/tests/functional/CompaniesCest.php b/tests/functional/CompaniesCest.php deleted file mode 100644 index 75724aa206..0000000000 --- a/tests/functional/CompaniesCest.php +++ /dev/null @@ -1,46 +0,0 @@ -amOnPage('/login'); - $I->fillField('username', 'admin'); - $I->fillField('password', 'password'); - $I->click('Login'); - } - - // tests - public function tryToTest(FunctionalTester $I) - { - $I->wantTo('Test Company Creation'); - $I->lookForwardTo('seeing it load without errors'); - $I->amOnPage(route('companies.create')); - $I->seeInTitle('Create Company'); - $I->see('Create Company', 'h1.pull-left'); - } - - public function failsEmptyValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with blank elements'); - $I->amOnPage(route('companies.create')); - $I->click('Save'); - $I->seeElement('.alert-danger'); - $I->see('The name field is required.', '.alert-msg'); - } - - public function passesCorrectValidation(FunctionalTester $I) - { - $company = \App\Models\Company::factory()->make(); - $values = [ - 'name' => $company->name, - ]; - $I->wantTo('Test Validation Succeeds'); - $I->amOnPage(route('companies.create')); - $I->fillField('name', 'TestCompany'); - $I->submitForm('form#create-form', $values); - $I->seeRecord('companies', $values); - $I->dontSee('<span class="'); - $I->seeElement('.alert-success'); - } -} diff --git a/tests/functional/ComponentsCest.php b/tests/functional/ComponentsCest.php deleted file mode 100644 index 6e2a7f136b..0000000000 --- a/tests/functional/ComponentsCest.php +++ /dev/null @@ -1,79 +0,0 @@ -amOnPage('/login'); - $I->fillField('username', 'admin'); - $I->fillField('password', 'password'); - $I->click('Login'); - } - - // tests - public function tryToTest(FunctionalTester $I) - { - $I->wantTo('ensure that the create components form loads without errors'); - $I->lookForwardTo('seeing it load without errors'); - $I->amOnPage(route('components.create')); - $I->dontSee('Create Component', '.page-header'); - $I->see('Create Component', 'h1.pull-left'); - } - - public function failsEmptyValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with blank elements'); - $I->amOnPage(route('components.create')); - $I->click('Save'); - $I->seeElement('.alert-danger'); - $I->see('The name field is required.', '.alert-msg'); - $I->see('The category id field is required.', '.alert-msg'); - $I->see('The qty field is required.', '.alert-msg'); - } - - public function failsShortValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with short name'); - $I->amOnPage(route('components.create')); - $I->fillField('name', 't2'); - $I->fillField('qty', '-15'); - $I->fillField('min_amt', '-15'); - $I->click('Save'); - $I->seeElement('.alert-danger'); - $I->see('The name must be at least 3 characters', '.alert-msg'); - $I->see('The qty must be at least 1', '.alert-msg'); - } - - public function passesCorrectValidation(FunctionalTester $I) - { - $component = \App\Models\Component::factory()->ramCrucial4()->make([ - 'name' => 'Test Component', - 'serial' => '3523-235325-1350235', - ]); - $values = [ - 'category_id' => $component->category_id, - 'company_id' => $component->company_id, - 'location_id' => $component->location_id, - 'min_amt' => $component->min_amt, - 'name' => $component->name, - 'order_number' => $component->order_number, - 'purchase_cost' => $component->purchase_cost, - 'purchase_date' => '2016-01-01', - 'qty' => $component->qty, - 'serial' => $component->serial, - ]; - $I->wantTo('Test Validation Succeeds'); - $I->amOnPage(route('components.create')); - $I->submitForm('form#create-form', $values); - $I->seeRecord('components', $values); - $I->dontSee('<span class="'); - $I->seeElement('.alert-success'); - } - - public function allowsDelete(FunctionalTester $I) - { - $I->wantTo('Ensure I can delete a component'); - $I->sendDelete(route('components.destroy', $I->getComponentId()), ['_token' => csrf_token()]); - $I->seeResponseCodeIs(200); - } -} diff --git a/tests/functional/ConsumablesCest.php b/tests/functional/ConsumablesCest.php deleted file mode 100644 index c47eb23c0f..0000000000 --- a/tests/functional/ConsumablesCest.php +++ /dev/null @@ -1,81 +0,0 @@ -amOnPage('/login'); - $I->fillField('username', 'admin'); - $I->fillField('password', 'password'); - $I->click('Login'); - } - - // tests - public function tryToTest(FunctionalTester $I) - { - $I->wantTo('ensure that the create consumables form loads without errors'); - $I->lookForwardTo('seeing it load without errors'); - $I->amOnPage(route('consumables.create')); - $I->dontSee('Create Consumable', '.page-header'); - $I->see('Create Consumable', 'h1.pull-left'); - } - - public function failsEmptyValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with blank elements'); - $I->amOnPage(route('consumables.create')); - $I->click('Save'); - $I->seeElement('.alert-danger'); - $I->see('The name field is required.', '.alert-msg'); - $I->see('The category id field is required.', '.alert-msg'); - $I->see('The qty field is required.', '.alert-msg'); - } - - public function failsShortValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with short name'); - $I->amOnPage(route('consumables.create')); - $I->fillField('name', 't2'); - $I->fillField('qty', '-15'); - $I->fillField('min_amt', '-15'); - $I->click('Save'); - $I->seeElement('.alert-danger'); - $I->see('The name must be at least 3 characters', '.alert-msg'); - $I->see('The qty must be at least 0', '.alert-msg'); - $I->see('The min amt must be at least 0', '.alert-msg'); - } - - public function passesCorrectValidation(FunctionalTester $I) - { - $consumable = \App\Models\Consumable::factory()->cardstock()->make([ - 'name' => 'Test Consumable', - 'model_number' => 23520, - ]); - // dd($consumable); - $values = [ - 'category_id' => $consumable->category_id, - 'company_id' => $consumable->company_id, - 'item_no' => $consumable->item_no, - 'manufacturer_id' => $consumable->manufacturer_id, - 'min_amt' => $consumable->min_amt, - 'model_number' => $consumable->model_number, - 'name' => $consumable->name, - 'order_number' => $consumable->order_number, - 'purchase_cost' => $consumable->purchase_cost, - 'purchase_date' => '2016-01-01', - 'qty' => $consumable->qty, - ]; - $I->wantTo('Test Validation Succeeds'); - $I->amOnPage(route('consumables.create')); - $I->submitForm('form#create-form', $values); - $I->seeRecord('consumables', $values); - $I->seeElement('.alert-success'); - } - - public function allowsDelete(FunctionalTester $I) - { - $I->wantTo('Ensure I can delete a consumable'); - $I->sendDelete(route('consumables.destroy', $I->getConsumableId()), ['_token' => csrf_token()]); - $I->seeResponseCodeIs(200); - } -} diff --git a/tests/functional/DepreciationsCest.php b/tests/functional/DepreciationsCest.php deleted file mode 100644 index 25dcfaef1f..0000000000 --- a/tests/functional/DepreciationsCest.php +++ /dev/null @@ -1,66 +0,0 @@ -amOnPage('/login'); - $I->fillField('username', 'admin'); - $I->fillField('password', 'password'); - $I->click('Login'); - } - - // tests - public function tryToTest(FunctionalTester $I) - { - $I->wantTo('Test Depreciation Creation'); - $I->lookForwardTo('seeing it load without errors'); - $I->amOnPage(route('depreciations.create')); - $I->seeInTitle('Create Depreciation'); - $I->dontSee('Create Depreciation', '.page-header'); - $I->see('Create Depreciation', 'h1.pull-left'); - } - - public function failsEmptyValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with blank elements'); - $I->amOnPage(route('depreciations.create')); - $I->click('Save'); - $I->seeElement('.alert-danger'); - $I->see('The name field is required.', '.alert-msg'); - $I->see('The months field is required.', '.alert-msg'); - } - - public function failsShortValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with short name'); - $I->amOnPage(route('depreciations.create')); - $I->fillField('name', 't2'); - $I->click('Save'); - $I->seeElement('.alert-danger'); - $I->see('The name must be at least 3 characters', '.alert-msg'); - } - - public function passesCorrectValidation(FunctionalTester $I) - { - $depreciation = \App\Models\Depreciation::factory()->computer()->make([ - 'name'=>'Test Depreciation', - ]); - $values = [ - 'name' => $depreciation->name, - 'months' => $depreciation->months, - ]; - $I->wantTo('Test Validation Succeeds'); - $I->amOnPage(route('depreciations.create')); - $I->submitForm('form#create-form', $values); - $I->seeRecord('depreciations', $values); - $I->seeElement('.alert-success'); - } - - public function allowsDelete(FunctionalTester $I) - { - $I->wantTo('Ensure I can delete a depreciation'); - $I->sendDelete(route('depreciations.destroy', $I->getDepreciationId()), ['_token' => csrf_token()]); - $I->seeResponseCodeIs(200); - } -} diff --git a/tests/functional/GroupsCest.php b/tests/functional/GroupsCest.php deleted file mode 100644 index aa9ba9872a..0000000000 --- a/tests/functional/GroupsCest.php +++ /dev/null @@ -1,74 +0,0 @@ -amOnPage('/login'); - $I->fillField('username', 'admin'); - $I->fillField('password', 'password'); - $I->click('Login'); - } - - // tests - public function loadsFormWithoutErrors(FunctionalTester $I) - { - $I->wantTo('ensure that the create groups form loads without errors'); - $I->lookForwardTo('seeing it load without errors'); - $I->amOnPage(route('groups.create')); - $I->seeResponseCodeIs(200); - $I->dontSee('Create New Group', '.page-header'); - $I->see('Create New Group', 'h1.pull-left'); - } - - public function failsEmptyValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with blank elements'); - $I->amOnPage(route('groups.create')); - $I->seeResponseCodeIs(200); - $I->click('Save'); - $I->seeElement('.alert-danger'); - $I->see('The name field is required.', '.alert-msg'); - } - - public function failsShortValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with short name'); - $I->amOnPage(route('groups.create')); - $I->seeResponseCodeIs(200); - $I->fillField('name', 't'); - $I->click('Save'); - $I->seeElement('.alert-danger'); - $I->see('The name must be at least 2 characters', '.alert-msg'); - } - - public function passesCorrectValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Succeeds'); - $I->amOnPage(route('groups.create')); - $I->seeResponseCodeIs(200); - $I->fillField('name', 'TestGroup'); - $I->click('Save'); - $I->dontSee('<span class="'); - $I->seeElement('.alert-success'); - } - - public function allowsDelete(FunctionalTester $I, $scenario) - { - $I->wantTo('Ensure I can delete a group'); - // create a group - $I->amOnPage(route('groups.create')); - $I->seeResponseCodeIs(200); - $I->fillField('name', 'TestGroup'); - $I->click('Save'); - $I->dontSee('<span class="'); - $I->seeElement('.alert-success'); - - $I->sendDelete(route('groups.destroy', Group::whereName('TestGroup')->doesntHave('users')->first()->id)); - $I->seeResponseCodeIs(200); - $I->seeElement('.alert-success'); - $I->seeResponseCodeIs(200); - } -} diff --git a/tests/functional/LicensesCest.php b/tests/functional/LicensesCest.php deleted file mode 100644 index 5add67f51d..0000000000 --- a/tests/functional/LicensesCest.php +++ /dev/null @@ -1,88 +0,0 @@ -amOnPage('/login'); - $I->fillField('username', 'admin'); - $I->fillField('password', 'password'); - $I->click('Login'); - } - - // tests - public function tryToTest(FunctionalTester $I) - { - $I->wantTo('ensure that the create licenses form loads without errors'); - $I->lookForwardTo('seeing it load without errors'); - $I->amOnPage(route('licenses.create')); - $I->dontSee('Create License', '.page-header'); - $I->see('Create License', 'h1.pull-left'); - } - - public function failsEmptyValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with blank elements'); - $I->amOnPage(route('licenses.create')); - $I->click('Save'); - $I->seeElement('.alert-danger'); - $I->see('The name field is required.', '.alert-msg'); - $I->see('The seats field is required.', '.alert-msg'); - $I->see('The category id field is required.', '.alert-msg'); - } - - public function failsShortValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with short name'); - $I->amOnPage(route('licenses.create')); - $I->fillField('name', 't2'); - $I->fillField('seats', '-15'); - $I->click('Save'); - $I->seeElement('.alert-danger'); - $I->see('The name must be at least 3 characters', '.alert-msg'); - $I->see('The seats must be at least 1', '.alert-msg'); - } - - public function passesCorrectValidation(FunctionalTester $I) - { - $license = \App\Models\License::factory()->photoshop()->make([ - 'name' => 'Test License', - 'company_id' => 3, - ]); - $values = [ - 'company_id' => $license->company_id, - 'expiration_date' => '2018-01-01', - 'license_email' => $license->license_email, - 'license_name' => $license->license_name, - 'maintained' => true, - 'manufacturer_id' => $license->manufacturer_id, - 'category_id' => $license->category_id, - 'name' => $license->name, - 'notes' => $license->notes, - 'order_number' => $license->order_number, - 'purchase_cost' => $license->purchase_cost, - 'purchase_date' => '2016-01-01', - 'purchase_order' => $license->purchase_order, - 'reassignable' => true, - 'seats' => $license->seats, - 'serial' => $license->serial, - 'termination_date' => '2020-01-01', - ]; - - $I->wantTo('Test Validation Succeeds'); - $I->amOnPage(route('licenses.create')); - $I->submitForm('form#create-form', $values); - $I->seeRecord('licenses', $values); - $I->dontSee('<span class="'); - $I->seeElement('.alert-success'); - } - - public function allowsDelete(FunctionalTester $I) - { - $I->wantTo('Ensure I can delete a license'); - $I->sendDelete(route('licenses.destroy', License::doesntHave('assignedUsers')->first()->id), ['_token' => csrf_token()]); - $I->seeResponseCodeIs(200); - } -} diff --git a/tests/functional/LocationsCest.php b/tests/functional/LocationsCest.php deleted file mode 100644 index 9177c6ae4b..0000000000 --- a/tests/functional/LocationsCest.php +++ /dev/null @@ -1,74 +0,0 @@ -amOnPage('/login'); - $I->fillField('username', 'admin'); - $I->fillField('password', 'password'); - $I->click('Login'); - } - - // tests - public function tryToTest(FunctionalTester $I) - { - /* Create Form */ - $I->wantTo('Test Location Creation'); - $I->lookForwardTo('Finding no Failures'); - $I->amOnPage(route('locations.create')); - $I->dontSee('Create Location', '.page-header'); - $I->see('Create Location', 'h1.pull-left'); - } - - public function failsEmptyValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with blank elements'); - $I->amOnPage(route('locations.create')); - $I->click('Save'); - $I->seeElement('.alert-danger'); - $I->see('The name field is required.', '.alert-msg'); - } - - public function failsShortValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with short values'); - $I->amOnPage(route('locations.create')); - $I->fillField('name', 't'); - $I->click('Save'); - $I->seeElement('.alert-danger'); - $I->see('The name must be at least 2 characters', '.alert-msg'); - } - - public function passesCorrectValidation(FunctionalTester $I) - { - $location = \App\Models\Location::factory()->make(); - $values = [ - 'name' => $location->name, - 'parent_id' => $I->getLocationId(), - 'currency' => $location->currency, - 'address' => $location->address, - 'address2' => $location->address2, - 'city' => $location->city, - 'state' => $location->state, - 'country' => $location->country, - 'zip' => $location->zip, - ]; - $I->wantTo('Test Validation Succeeds'); - $I->amOnPage(route('locations.create')); - $I->submitForm('form#create-form', $values); - $I->seeRecord('locations', $values); - $I->seeElement('.alert-success'); - } - - public function allowsDelete(FunctionalTester $I) - { - $I->wantTo('Ensure I can delete a location'); - $location = \App\Models\Location::factory()->create(); - $I->sendDelete(route('locations.destroy', $location->id), ['_token' => csrf_token()]); - $I->seeResponseCodeIs(200); - } -} diff --git a/tests/functional/ManufacturersCest.php b/tests/functional/ManufacturersCest.php deleted file mode 100644 index 65c8b1d190..0000000000 --- a/tests/functional/ManufacturersCest.php +++ /dev/null @@ -1,66 +0,0 @@ -amOnPage('/login'); - $I->fillField('username', 'admin'); - $I->fillField('password', 'password'); - $I->click('Login'); - } - - // tests - public function tryToTest(FunctionalTester $I) - { - $I->wantTo('Test Manufacturer Creation'); - $I->lookForwardTo('seeing it load without errors'); - $I->amOnPage(route('manufacturers.create')); - $I->seeInTitle('Create Manufacturer'); - $I->see('Create Manufacturer', 'h1.pull-left'); - } - - public function failsEmptyValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with blank elements'); - $I->amOnPage(route('manufacturers.create')); - $I->click('Save'); - $I->seeElement('.alert-danger'); - $I->see('The name field is required.', '.alert-msg'); - } - - public function failsShortValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with short name'); - $I->amOnPage(route('manufacturers.create')); - $I->fillField('name', 't'); - $I->click('Save'); - $I->seeElement('.alert-danger'); - $I->see('The name must be at least 2 characters', '.alert-msg'); - } - - public function passesCorrectValidation(FunctionalTester $I) - { - $manufacturer = \App\Models\Manufacturer::factory()->microsoft()->make([ - 'name' => 'Test Manufacturer', - ]); - $values = [ - 'name' => $manufacturer->name, - ]; - $I->wantTo('Test Validation Succeeds'); - $I->amOnPage(route('manufacturers.create')); - $I->submitForm('form#create-form', $values); - $I->seeRecord('manufacturers', $values); - $I->seeElement('.alert-success'); - } - - public function allowsDelete(FunctionalTester $I) - { - $I->wantTo('Ensure I can delete a manufacturer'); - $manufacturerId = \App\Models\Manufacturer::factory()->microsoft()->create(['name' => 'Deletable Test Manufacturer'])->id; - $I->sendDelete(route('manufacturers.destroy', $manufacturerId), ['_token' => csrf_token()]); - $I->seeResponseCodeIs(200); - } -} diff --git a/tests/functional/StatusLabelsCest.php b/tests/functional/StatusLabelsCest.php deleted file mode 100644 index ff1ec90961..0000000000 --- a/tests/functional/StatusLabelsCest.php +++ /dev/null @@ -1,67 +0,0 @@ -amOnPage('/login'); - $I->fillField('username', 'admin'); - $I->fillField('password', 'password'); - $I->click('Login'); - } - - // tests - public function tryToTest(FunctionalTester $I) - { - $I->wantTo('ensure that the create statuslabels form loads without errors'); - $I->lookForwardTo('seeing it load without errors'); - $I->amOnPage(route('statuslabels.create')); - $I->dontSee('Create Status Label', '.page-header'); - $I->see('Create Status Label', 'h1.pull-left'); - } - - public function failsEmptyValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with blank elements'); - $I->amOnPage(route('statuslabels.create')); - $I->click('Save'); - $I->seeElement('.alert-danger'); - $I->see('The name field is required.', '.alert-msg'); - } - - public function passesCorrectValidation(FunctionalTester $I) - { - $status = \App\Models\Statuslabel::factory()->pending()->make(); - $submitValues = [ - 'name' => 'Testing Status', - 'statuslabel_types' => 'pending', - 'color' => '#b46262', - 'notes' => $status->notes, - 'show_in_nav' => true, - ]; - - $recordValues = [ - 'name' => 'Testing Status', - 'pending' => $status->pending, - 'deployable' => $status->archived, - 'archived' => $status->deployable, - 'color' => '#b46262', - 'notes' => $status->notes, - 'show_in_nav' => true, - ]; - $I->wantTo('Test Validation Succeeds'); - $I->amOnPage(route('statuslabels.create')); - $I->submitForm('form#create-form', $submitValues); - $I->seeRecord('status_labels', $recordValues); - $I->seeElement('.alert-success'); - } - - public function allowsDelete(FunctionalTester $I) - { - $I->wantTo('Ensure I can delete a Status Label'); - $I->sendDelete(route('statuslabels.destroy', Statuslabel::doesntHave('assets')->first()->id), ['_token' => csrf_token()]); - $I->seeResponseCodeIs(200); - } -} diff --git a/tests/functional/SuppliersCest.php b/tests/functional/SuppliersCest.php deleted file mode 100644 index 69746f86a5..0000000000 --- a/tests/functional/SuppliersCest.php +++ /dev/null @@ -1,65 +0,0 @@ -amOnPage('/login'); - $I->fillField('username', 'admin'); - $I->fillField('password', 'password'); - $I->click('Login'); - } - - // tests - public function tryToTest(FunctionalTester $I) - { - $I->wantTo('ensure that the create settings/suppliers form loads without errors'); - $I->lookForwardTo('seeing it load without errors'); - $I->amOnPage(route('suppliers.create')); - $I->dontSee('Create Supplier', '.page-header'); - $I->see('Create Supplier', 'h1.pull-left'); - } - - public function failsEmptyValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with blank elements'); - $I->amOnPage(route('suppliers.create')); - $I->click('Save'); - $I->seeElement('.alert-danger'); - $I->see('The name field is required.', '.alert-msg'); - } - - public function passesCorrectValidation(FunctionalTester $I) - { - $supplier = \App\Models\Supplier::factory()->make(); - - $values = [ - 'name' => $supplier->name, - 'address' => $supplier->address, - 'address2' => $supplier->address2, - 'city' => $supplier->city, - 'state' => $supplier->state, - 'zip' => $supplier->zip, - 'country' => $supplier->country, - 'contact' => $supplier->contact, - 'phone' => $supplier->phone, - 'fax' => $supplier->fax, - 'email' => $supplier->email, - 'url' => $supplier->url, - 'notes' => $supplier->notes, - ]; - $I->wantTo('Test Validation Succeeds'); - $I->amOnPage(route('suppliers.create')); - $I->submitForm('form#create-form', $values); - $I->seeRecord('suppliers', $values); - $I->seeElement('.alert-success'); - } - - public function allowsDelete(FunctionalTester $I) - { - $I->wantTo('Ensure I can delete a supplier'); - $supplier = \App\Models\Supplier::factory()->create(); - $I->sendDelete(route('suppliers.destroy', $supplier->id), ['_token' => csrf_token()]); - $I->seeResponseCodeIs(200); - } -} diff --git a/tests/functional/UsersCest.php b/tests/functional/UsersCest.php deleted file mode 100644 index e861694918..0000000000 --- a/tests/functional/UsersCest.php +++ /dev/null @@ -1,98 +0,0 @@ -amOnPage('/login'); - $I->fillField('username', 'admin'); - $I->fillField('password', 'password'); - $I->click('Login'); - } - - // tests - public function tryToTest(FunctionalTester $I) - { - $I->wantTo('ensure that the create users form loads without errors'); - $I->lookForwardTo('seeing it load without errors'); - $I->amOnPage(route('users.create')); - $I->dontSee('Create User', '.page-header'); - $I->see('Create User', 'h1.pull-left'); - } - - public function failsEmptyValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with blank elements'); - $I->amOnPage(route('users.create')); - $I->click('Save'); - $I->seeElement('.alert-danger'); - $I->see('The first name field is required.', '.alert-msg'); - $I->see('The username field is required unless ldap import is in 1.', '.alert-msg'); - $I->see('The password field is required.', '.alert-msg'); - } - - public function failsShortValidation(FunctionalTester $I) - { - $I->wantTo('Test Validation Fails with short name'); - $I->amOnPage(route('users.create')); - $I->fillField('first_name', 't2'); - $I->fillField('last_name', 't2'); - $I->fillField('username', 'a'); - $I->fillField('password', '12345'); - $I->click('Save'); - $I->seeElement('.alert-danger'); - $I->see('The password must be at least 8 characters', '.alert-msg'); - } - - public function passesCorrectValidation(FunctionalTester $I) - { - $user = \App\Models\User::factory()->make(); - $submitValues = [ - 'first_name' => $user->first_name, - 'last_name' => $user->last_name, - 'username' => $user->username, - 'password' => $user->password, - 'password_confirmation' => $user->password, - 'email' => $user->email, - 'company_id' => $user->company_id, - 'locale' => $user->locale, - 'employee_num' => $user->employee_num, - 'jobtitle' => $user->jobtitle, - 'manager_id' => $user->manager_id, - 'location_id' => $user->location_id, - 'phone' => $user->phone, - 'activated' => true, - 'notes' => $user->notes, - ]; - $storedValues = [ - 'first_name' => $user->first_name, - 'last_name' => $user->last_name, - 'username' => $user->username, - 'email' => $user->email, - 'company_id' => $user->company_id, - 'locale' => $user->locale, - 'employee_num' => $user->employee_num, - 'jobtitle' => $user->jobtitle, - 'manager_id' => $user->manager_id, - 'location_id' => $user->location_id, - 'phone' => $user->phone, - 'activated' => true, - 'notes' => $user->notes, - ]; - $I->amOnPage(route('users.create')); - $I->wantTo('Test Validation Succeeds'); - $I->submitForm('form#userForm', $submitValues); - $I->seeRecord('users', $storedValues); - $I->seeElement('.alert-success'); - } - - public function allowsDelete(FunctionalTester $I) - { - $user = \App\Models\User::factory()->create(); - $I->wantTo('Ensure I can delete a user'); - $I->sendDelete(route('users.destroy', $user->id), ['_token' => csrf_token()]); - $I->seeResponseCodeIs(200); - } -} diff --git a/tests/functional/_bootstrap.php b/tests/functional/_bootstrap.php deleted file mode 100644 index 62817a53c4..0000000000 --- a/tests/functional/_bootstrap.php +++ /dev/null @@ -1,3 +0,0 @@ -