Skip to content

A free open source IT asset/license management system

Switch to blade component for callout on checkout

snipe3d6e415efc31
diff --git a/resources/views/accessories/checkout.blade.php b/resources/views/accessories/checkout.blade.php
index 150e067f13..ffe75a6604 100755
--- a/resources/views/accessories/checkout.blade.php
+++ b/resources/views/accessories/checkout.blade.php
@@ -58,40 +58,7 @@
<div class="col-md-8 col-md-offset-3"><x-form.error name="checkout_qty" /></div>
</div>
- @if ($accessory->requireAcceptance() || $accessory->getEula() || ($snipeSettings->webhook_endpoint != ''))
- <div class="form-group notification-callout">
- <div class="col-md-8 col-md-offset-3">
- <x-callout type="info" role="status">
- @if ($accessory->requireAcceptance())
- <i class="far fa-envelope fa-fw" aria-hidden="true"></i>
- {{ trans('admin/categories/general.required_acceptance') }}<br>
- @endif
- @if ($accessory->requireAcceptance() && (string) $snipeSettings->require_accept_signature === '1')
- <x-icon type="signature" class="fa-fw"/>
- {{ trans('admin/categories/general.required_signature') }}<br>
- @endif
- @if ($accessory->getEula())
- <i class="far fa-envelope fa-fw" aria-hidden="true"></i>
- {{ trans('admin/categories/general.required_eula') }}<br>
- @endif
- @if ($snipeSettings->webhook_endpoint != '')
- <i class="fab fa-slack fa-fw" aria-hidden="true"></i>
- {{ trans('general.webhook_msg_note') }}
- @endif
- </x-callout>
- </div>
-
- @if ($accessory->requireAcceptance())
- <div id="sign_in_place_div" class="col-md-7 col-md-offset-3">
- <label class="form-control">
- <input type="checkbox" value="1" name="sign_in_place" @checked(old('sign_in_place', session('sign_in_place', false))) aria-label="{{ trans('general.sign_in_place') }}">
- {{ trans('general.sign_in_place') }}
- </label>
- <p class="help-block">{{ trans('general.sign_in_place_help') }}</p>
- </div>
- @endif
- </div>
- @endif
+ <x-checkout.checkout-notification-callout :item="$accessory" :category="$accessory->category" />
<x-form.row
:label="trans('admin/hardware/form.notes')"
diff --git a/resources/views/blade/checkout/checkout-notification-callout.blade.php b/resources/views/blade/checkout/checkout-notification-callout.blade.php
new file mode 100644
index 0000000000..3ef45db179
--- /dev/null
+++ b/resources/views/blade/checkout/checkout-notification-callout.blade.php
@@ -0,0 +1,45 @@
+@props(['item', 'category' => null])
+
+{{-- Singleton-checkout notification callout: preview of what will fire when the admin
+ submits the checkout. Used from hardware, accessories, licenses, and consumables
+ checkout screens. --}}
+
+@if ($item->requireAcceptance() || $item->getEula() || $snipeSettings->webhook_endpoint != '')
+ <div class="form-group notification-callout">
+ <div class="col-md-8 col-md-offset-3">
+ <x-callout type="info" role="status">
+ @if ($item->requireAcceptance())
+ <x-icon type="email" class="fa-fw"/>
+ {{ trans('admin/categories/general.required_acceptance') }}<br>
+ @endif
+ @if ($item->requireAcceptance() && (string) $snipeSettings->require_accept_signature === '1')
+ <x-icon type="signature" class="fa-fw"/>
+ {{ trans('admin/categories/general.required_signature') }}<br>
+ @endif
+ @if ($item->getEula())
+ <x-icon type="email" class="fa-fw"/>
+ {{ trans('admin/categories/general.required_eula') }}<br>
+ @endif
+ @if ($category?->checkin_email)
+ <x-icon type="email" class="fa-fw"/>
+ {{ trans('admin/categories/general.checkin_email_notification') }}<br>
+ @endif
+ @if ($snipeSettings->webhook_endpoint != '')
+ <i class="fab fa-slack fa-fw" aria-hidden="true"></i>
+ {{ trans('general.webhook_msg_note') }}
+ @endif
+ </x-callout>
+ </div>
+ </div>
+@endif
+
+@if ($item->requireAcceptance() || (string) $snipeSettings->require_accept_signature === '1')
+ <div class="notification-callout">
+ <x-form.checkbox-row
+ name="sign_in_place"
+ :label="trans('general.sign_in_place')"
+ :help_text="trans('general.sign_in_place_help')"
+ :checked="old('sign_in_place', session('sign_in_place', false))"
+ />
+ </div>
+@endif
diff --git a/resources/views/consumables/checkout.blade.php b/resources/views/consumables/checkout.blade.php
index d26772462c..eadc717eed 100644
--- a/resources/views/consumables/checkout.blade.php
+++ b/resources/views/consumables/checkout.blade.php
@@ -40,44 +40,7 @@
required
/>
- @if ($consumable->requireAcceptance() || $consumable->getEula() || ($snipeSettings->webhook_endpoint != ''))
- <div class="form-group notification-callout">
- <div class="col-md-8 col-md-offset-3">
- <x-callout type="info" role="status">
- @if ($consumable->category->require_acceptance == '1')
- <i class="far fa-envelope fa-fw" aria-hidden="true"></i>
- {{ trans('admin/categories/general.required_acceptance') }}<br>
- @endif
- @if ($consumable->requireAcceptance() && (string) $snipeSettings->require_accept_signature === '1')
- <x-icon type="signature" class="fa-fw"/>
- {{ trans('admin/categories/general.required_signature') }}<br>
- @endif
- @if ($consumable->getEula())
- <i class="far fa-envelope fa-fw" aria-hidden="true"></i>
- {{ trans('admin/categories/general.required_eula') }}<br>
- @endif
- @if ($consumable->category && $consumable->category->checkin_email)
- <i class="far fa-envelope fa-fw" aria-hidden="true"></i>
- {{ trans('admin/categories/general.checkin_email_notification') }}<br>
- @endif
- @if ($snipeSettings->webhook_endpoint != '')
- <i class="fab fa-slack fa-fw" aria-hidden="true"></i>
- {{ trans('general.webhook_msg_note') }}
- @endif
- </x-callout>
- </div>
-
- @if ($consumable->requireAcceptance())
- <div id="sign_in_place_div" class="col-md-7 col-md-offset-3">
- <label class="form-control">
- <input type="checkbox" value="1" name="sign_in_place" @checked(old('sign_in_place', session('sign_in_place', false))) aria-label="{{ trans('general.sign_in_place') }}">
- {{ trans('general.sign_in_place') }}
- </label>
- <p class="help-block">{{ trans('general.sign_in_place_help') }}</p>
- </div>
- @endif
- </div>
- @endif
+ <x-checkout.checkout-notification-callout :item="$consumable" :category="$consumable->category" />
<!-- Checkout quantity -->
<div class="form-group {{ $errors->has('qty') ? 'has-error' : '' }}">
diff --git a/resources/views/hardware/checkout.blade.php b/resources/views/hardware/checkout.blade.php
index 92e57661bb..7e7073726b 100755
--- a/resources/views/hardware/checkout.blade.php
+++ b/resources/views/hardware/checkout.blade.php
@@ -121,56 +121,7 @@
'show_custom_fields_type' => 'checkout',
])
- @if ($asset->requireAcceptance() || $asset->getEula() || ($snipeSettings->webhook_endpoint != ''))
- <div class="form-group notification-callout" style="display:none;">
- <div class="col-md-8 col-md-offset-3">
- <x-callout type="info" role="status">
-
- @if ($asset->requireAcceptance())
- <x-icon type="email" class="fa-fw"/>
- {{ trans('admin/categories/general.required_acceptance') }}
- <br>
- @endif
-
- @if ($asset->requireAcceptance() && (string) $snipeSettings->require_accept_signature === '1')
- <x-icon type="signature" class="fa-fw"/>
- {{ trans('admin/categories/general.required_signature') }}
- <br>
- @endif
-
- @if ($asset->getEula())
- <x-icon type="email" class="fa-fw"/>
- {{ trans('admin/categories/general.required_eula') }}
- <br>
- @endif
-
- @if (($asset->model?->category) && ($asset->model->category->checkin_email))
- <x-icon type="email" class="fa-fw"/>
- {{ trans('admin/categories/general.checkin_email_notification') }}
- <br>
- @endif
-
- @if ($snipeSettings->webhook_endpoint != '')
- <i class="fab fa-slack fa-fw" aria-hidden="true"></i>
- {{ trans('general.webhook_msg_note') }}
- @endif
- </x-callout>
- </div>
-
- <!-- Sign in place checkbox -->
- @if ($asset->requireAcceptance())
- <div id="sign_in_place_div" class="col-md-7 col-md-offset-3">
- <label class="form-control">
- <input type="checkbox" value="1" name="sign_in_place" @checked(old('sign_in_place', session('sign_in_place', false))) aria-label="sign_in_place">
- {{ trans('general.sign_in_place') }}
- </label>
- <p class="help-block">
- {{ trans('general.sign_in_place_help') }}
- </p>
- </div>
- @endif
- </div>
- @endif
+ <x-checkout.checkout-notification-callout :item="$asset" :category="$asset->model?->category" />
<x-slot:customfooter>
<x-redirect_submit_options
diff --git a/resources/views/licenses/checkout.blade.php b/resources/views/licenses/checkout.blade.php
index a8a5d8005b..6d1163837f 100755
--- a/resources/views/licenses/checkout.blade.php
+++ b/resources/views/licenses/checkout.blade.php
@@ -61,56 +61,7 @@
</x-slot:input>
</x-form.row>
- @if ($license->requireAcceptance() || $license->getEula() || ($snipeSettings->webhook_endpoint != ''))
- <div class="form-group notification-callout">
- <div class="col-md-8 col-md-offset-3">
- <x-callout type="info" role="status">
-
- @if ($license->requireAcceptance())
- <i class="far fa-envelope fa-fw" aria-hidden="true"></i>
- {{ trans('admin/categories/general.required_acceptance') }}
- <br>
- @endif
-
- @if ($license->requireAcceptance() && (string) $snipeSettings->require_accept_signature === '1')
- <x-icon type="signature" class="fa-fw"/>
- {{ trans('admin/categories/general.required_signature') }}
- <br>
- @endif
-
- @if ($license->getEula())
- <i class="far fa-envelope fa-fw" aria-hidden="true"></i>
- {{ trans('admin/categories/general.required_eula') }}
- <br>
- @endif
-
- @if (($license->category) && ($license->category->checkin_email))
- <i class="far fa-envelope fa-fw" aria-hidden="true"></i>
- {{ trans('admin/categories/general.checkin_email_notification') }}
- <br>
- @endif
-
- @if ($snipeSettings->webhook_endpoint != '')
- <i class="fab fa-slack fa-fw" aria-hidden="true"></i>
- {{ trans('general.webhook_msg_note') }}
- @endif
- </x-callout>
- </div>
-
- <!-- Sign in place checkbox -->
- @if ($license->requireAcceptance())
- <div id="sign_in_place_div" class="col-md-7 col-md-offset-3">
- <label class="form-control">
- <input type="checkbox" value="1" name="sign_in_place" @checked(old('sign_in_place', session('sign_in_place', false))) aria-label="sign_in_place">
- {{ trans('general.sign_in_place') }}
- </label>
- <p class="help-block">
- {{ trans('general.sign_in_place_help') }}
- </p>
- </div>
- @endif
- </div>
- @endif
+ <x-checkout.checkout-notification-callout :item="$license" :category="$license->category" />
<x-slot:customfooter>
<x-redirect_submit_options