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) public function displayAnyFieldsInForm($form_type = null)
{ {
switch ($form_type) { if ($this->fields) {
case 'audit': // \Log::error(print_r($this->fields, true));
return $this->displayFieldInAuditForm(); \Log::error($this->fields->where('display_audit', '1')->count());
case 'checkin': \Log::error($this->fields->where('display_checkin', '1')->count());
return $this->displayFieldInCheckinForm(); \Log::error($this->fields->where('display_checkout', '1')->count());
case 'checkout': switch ($form_type) {
return $this->displayFieldInCheckoutForm(); case 'audit':
default: return $this->fields->where('display_audit', '1')->count() > 0;
return true; 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>
</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 --> <!-- Custom fields -->
@include("models/custom_fields_form", [ @include("models/custom_fields_form", [
'model' => $asset->model, '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-->
</div> <!--/.box-body--> </div> <!--/.box-body-->

View file

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