Skip to content

A free open source IT asset/license management system

Fix missing company creation modal

Matheus Garvão99f689f7e4c5
diff --git a/app/Http/Controllers/ModalController.php b/app/Http/Controllers/ModalController.php
index c7decd7b21..1d76adf976 100644
--- a/app/Http/Controllers/ModalController.php
+++ b/app/Http/Controllers/ModalController.php
@@ -25,6 +25,7 @@ class ModalController extends Controller
// These values should correspond to a file in resources/views/modals/
$allowed_types = [
'category',
+ 'company',
'kit-model',
'kit-license',
'kit-consumable',
diff --git a/resources/views/modals/company.blade.php b/resources/views/modals/company.blade.php
new file mode 100644
index 0000000000..44b3a837a6
--- /dev/null
+++ b/resources/views/modals/company.blade.php
@@ -0,0 +1,19 @@
+{{-- See snipeit_modals.js for what powers this --}}
+<div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+ <span aria-hidden="true">&times;</span>
+ </button>
+ <h2 class="modal-title">{{ trans('admin/companies/table.create') }}</h2>
+ </div>
+ <div class="modal-body">
+ <form action="{{ route('api.companies.store') }}" onsubmit="return false">
+ <x-alert type="danger" id="modal_error_msg" style="display:none">
+ </x-alert>
+ @include('modals.partials.name', ['required' => 'true'])
+ </form>
+ </div>
+ @include('modals.partials.footer')
+ </div>
+</div>
diff --git a/tests/Feature/Modals/Ui/ShowModalsTest.php b/tests/Feature/Modals/Ui/ShowModalsTest.php
index 9951459eeb..4ca3ad8c8a 100644
--- a/tests/Feature/Modals/Ui/ShowModalsTest.php
+++ b/tests/Feature/Modals/Ui/ShowModalsTest.php
@@ -59,6 +59,15 @@ class ShowModalsTest extends TestCase
->assertOk();
}
+ public function test_company_modal_renders()
+ {
+ $this->actingAs(User::factory()->superuser()->create())
+ ->get('modals/company')
+ ->assertOk()
+ ->assertSee(route('api.companies.store'))
+ ->assertSee(trans('admin/companies/table.create'));
+ }
+
public function test_manufacturer_modal_renders()
{
$this->actingAs(User::factory()->superuser()->create())