-
+
{!! $errors->first('min_amt', '
:message') !!}
diff --git a/resources/views/partials/forms/edit/quantity.blade.php b/resources/views/partials/forms/edit/quantity.blade.php
index f8a421adcdaa..b41d13f6505f 100644
--- a/resources/views/partials/forms/edit/quantity.blade.php
+++ b/resources/views/partials/forms/edit/quantity.blade.php
@@ -4,8 +4,10 @@
diff --git a/resources/views/users/print.blade.php b/resources/views/users/print.blade.php
index bdea19ab7c40..acadf16a0374 100644
--- a/resources/views/users/print.blade.php
+++ b/resources/views/users/print.blade.php
@@ -151,20 +151,25 @@ class="snipe-table table table-striped inventory"
{{ $counter }}.{{ $assignedCounter }} |
-
+ |
@if ($asset->getImageUrl())
@endif
|
{{ $asset->asset_tag }} |
{{ $asset->name }} |
- {{ $asset->model->category->name }} |
+ {{ (($asset->model) && ($asset->model->category)) ? $asset->model->category->name : trans('general.invalid_category') }} |
+ {{ ($asset->model) ? $asset->model->name : trans('general.invalid_model') }} |
{{ ($asset->defaultLoc) ? $asset->defaultLoc->name : '' }} |
{{ ($asset->location) ? $asset->location->name : '' }} |
- {{ $asset->model->name }} |
{{ $asset->serial }} |
- {{ $asset->last_checkout }} |
- |
+
+ {{ Helper::getFormattedDateObject($asset->last_checkout, 'datetime', false) }} |
+
+ @if (($asset->assetlog->first()) && ($asset->assetlog->first()->accept_signature!=''))
+
+ @endif
+ |
@php
$assignedCounter++
diff --git a/tests/Feature/Categories/Api/IndexCategoriesTest.php b/tests/Feature/Categories/Api/IndexCategoriesTest.php
index fc48fdc547bc..d27bfbb06807 100644
--- a/tests/Feature/Categories/Api/IndexCategoriesTest.php
+++ b/tests/Feature/Categories/Api/IndexCategoriesTest.php
@@ -32,7 +32,6 @@ public function testCategoryIndexReturnsExpectedSearchResults()
'limit' => '20',
]))
->assertOk()
- ->assertOk()
->assertJsonStructure([
'total',
'rows',
diff --git a/tests/Feature/Consumables/Api/ConsumableIndexTest.php b/tests/Feature/Consumables/Api/ConsumableIndexTest.php
index b16dfdfa53ca..f1d3ad7f0b0e 100644
--- a/tests/Feature/Consumables/Api/ConsumableIndexTest.php
+++ b/tests/Feature/Consumables/Api/ConsumableIndexTest.php
@@ -54,4 +54,29 @@ public function testConsumableIndexAdheresToCompanyScoping()
->assertResponseDoesNotContainInRows($consumableA)
->assertResponseContainsInRows($consumableB);
}
+
+ public function testConsumableIndexReturnsExpectedSearchResults()
+ {
+ Consumable::factory()->count(10)->create();
+ Consumable::factory()->count(1)->create(['name' => 'My Test Consumable']);
+
+ $this->actingAsForApi(User::factory()->superuser()->create())
+ ->getJson(
+ route('api.consumables.index', [
+ 'search' => 'My Test Consumable',
+ 'sort' => 'name',
+ 'order' => 'asc',
+ 'offset' => '0',
+ 'limit' => '20',
+ ]))
+ ->assertOk()
+ ->assertJsonStructure([
+ 'total',
+ 'rows',
+ ])
+ ->assertJson([
+ 'total' => 1,
+ ]);
+
+ }
}
diff --git a/tests/Feature/Consumables/Api/ConsumableUpdateTest.php b/tests/Feature/Consumables/Api/ConsumableUpdateTest.php
new file mode 100644
index 000000000000..1c1e05d4d43b
--- /dev/null
+++ b/tests/Feature/Consumables/Api/ConsumableUpdateTest.php
@@ -0,0 +1,52 @@
+create();
+
+ $this->actingAsForApi(User::factory()->superuser()->create())
+ ->patchJson(route('api.consumables.update', $consumable), [
+ 'name' => 'Test Consumable',
+ ])
+ ->assertOk()
+ ->assertStatusMessageIs('success')
+ ->assertStatus(200)
+ ->json();
+
+ $consumable->refresh();
+ $this->assertEquals('Test Consumable', $consumable->name, 'Name was not updated');
+
+ }
+
+ public function testCannotUpdateConsumableViaPatchWithInvalidCategoryType()
+ {
+ $category = Category::factory()->create(['category_type' => 'asset']);
+ $consumable = Consumable::factory()->create();
+
+ $this->actingAsForApi(User::factory()->superuser()->create())
+ ->patchJson(route('api.consumables.update', $consumable), [
+ 'name' => 'Test Consumable',
+ 'category_id' => $category->id,
+ ])
+ ->assertOk()
+ ->assertStatusMessageIs('error')
+ ->assertStatus(200)
+ ->json();
+
+ $category->refresh();
+ $this->assertNotEquals('Test Consumable', $consumable->name, 'Name was not updated');
+ $this->assertNotEquals('consumable', $consumable->category_id, 'Category was not updated');
+
+ }
+
+}
diff --git a/tests/Feature/Consumables/Api/ConsumableViewTest.php b/tests/Feature/Consumables/Api/ConsumableViewTest.php
new file mode 100644
index 000000000000..c6410216e136
--- /dev/null
+++ b/tests/Feature/Consumables/Api/ConsumableViewTest.php
@@ -0,0 +1,51 @@
+count(2)->create();
+
+ $consumableA = Consumable::factory()->for($companyA)->create();
+ $consumableB = Consumable::factory()->for($companyB)->create();
+
+ $superUser = $companyA->users()->save(User::factory()->superuser()->make());
+ $userInCompanyA = $companyA->users()->save(User::factory()->viewConsumables()->make());
+ $userInCompanyB = $companyB->users()->save(User::factory()->viewConsumables()->make());
+
+ $this->settings->disableMultipleFullCompanySupport();
+
+ $this->actingAsForApi($superUser)
+ ->getJson(route('api.consumables.show', $consumableA))
+ ->assertOk();
+
+ $this->actingAsForApi($userInCompanyA)
+ ->getJson(route('api.consumables.show', $consumableA))
+ ->assertOk();
+
+ $this->actingAsForApi($userInCompanyB)
+ ->getJson(route('api.consumables.show', $consumableB))
+ ->assertOk();
+
+ $this->settings->enableMultipleFullCompanySupport();
+
+ $this->actingAsForApi($superUser)
+ ->getJson(route('api.consumables.show', $consumableA))
+ ->assertOk();
+
+ $this->actingAsForApi($userInCompanyA)
+ ->getJson(route('api.consumables.index'))
+ ->assertOk();
+
+ $this->actingAsForApi($userInCompanyB)
+ ->getJson(route('api.consumables.index'))
+ ->assertOk();
+ }
+}
diff --git a/tests/Feature/Consumables/Ui/ConsumableViewTest.php b/tests/Feature/Consumables/Ui/ConsumableViewTest.php
new file mode 100644
index 000000000000..9633896c2d68
--- /dev/null
+++ b/tests/Feature/Consumables/Ui/ConsumableViewTest.php
@@ -0,0 +1,26 @@
+create();
+ $this->actingAs(User::factory()->create())
+ ->get(route('consumables.show', $consumable))
+ ->assertForbidden();
+ }
+
+ public function testUserCanListConsumables()
+ {
+ $consumable = Consumable::factory()->create();
+ $this->actingAs(User::factory()->superuser()->create())
+ ->get(route('consumables.show', $consumable))
+ ->assertOk();
+ }
+}