Move notes above custom fields

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2025-04-29 18:53:31 +01:00
parent 89a52b7551
commit d1085a0f46
3 changed files with 39 additions and 32 deletions

View file

@ -73,16 +73,24 @@ class CustomFieldset extends Model
public function displayAnyFieldsInForm($form_type = null)
{
switch ($form_type) {
case 'audit':
return $this->displayFieldInAuditForm();
case 'checkin':
return $this->displayFieldInCheckinForm();
case 'checkout':
return $this->displayFieldInCheckoutForm();
default:
return true;
if ($this->fields) {
// \Log::error(print_r($this->fields, true));
\Log::error($this->fields->where('display_audit', '1')->count());
\Log::error($this->fields->where('display_checkin', '1')->count());
\Log::error($this->fields->where('display_checkout', '1')->count());
switch ($form_type) {
case 'audit':
return $this->fields->where('display_audit', '1')->count() > 0;
case 'checkin':
return $this->fields->where('display_checkin', '1')->count() > 0;
case 'checkout':
return $this->fields->where('display_checkout', '1')->count() > 0;
default:
return true;
}
}
return false;
}
/**

View file

@ -139,6 +139,19 @@
</div>
</div>
<!-- Note -->
<div class="form-group {{ $errors->has('note') ? 'error' : '' }}">
<label for="note" class="col-md-3 control-label">
{{ trans('general.notes') }}
</label>
<div class="col-md-8">
<textarea class="col-md-6 form-control" id="note" @required($snipeSettings->require_checkinout_notes)
name="note">{{ old('note', $asset->note) }}</textarea>
{!! $errors->first('note', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
<!-- Custom fields -->
@include("models/custom_fields_form", [
'model' => $asset->model,
@ -146,22 +159,6 @@
])
<!-- Note -->
<div class="form-group {{ $errors->has('note') ? 'error' : '' }}">
<label for="note" class="col-md-3 control-label">
{{ trans('general.notes') }}
</label>
<div class="col-md-8">
<textarea class="col-md-6 form-control" id="note" @required($snipeSettings->require_checkinout_notes)
name="note">{{ old('note', $asset->note) }}</textarea>
{!! $errors->first('note', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
</div> <!--/.box-body-->
</div> <!--/.box-body-->

View file

@ -142,12 +142,6 @@
</div>
</div>
<!-- Custom fields -->
@include("models/custom_fields_form", [
'model' => $asset->model,
'show_custom_fields_type' => 'checkout'
])
<!-- Note -->
<div class="form-group {{ $errors->has('note') ? 'error' : '' }}">
<label for="note" class="col-md-3 control-label">
@ -156,10 +150,18 @@
<div class="col-md-8">
<textarea class="col-md-6 form-control" id="note" @required($snipeSettings->require_checkinout_notes)
name="note">{{ old('note', $asset->note) }}</textarea>
name="note">{{ old('note', $asset->note) }}</textarea>
{!! $errors->first('note', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
<!-- Custom fields -->
@include("models/custom_fields_form", [
'model' => $asset->model,
'show_custom_fields_type' => 'checkout'
])
@if ($asset->requireAcceptance() || $asset->getEula() || ($snipeSettings->webhook_endpoint!=''))
<div class="form-group notification-callout">