ok
This commit is contained in:
@ -0,0 +1,74 @@
|
||||
@extends('layouts/default')
|
||||
|
||||
{{-- Page title --}}
|
||||
@section('title')
|
||||
{{ trans('admin/models/general.bulk_delete') }}
|
||||
@parent
|
||||
@stop
|
||||
|
||||
@section('header_right')
|
||||
<a href="{{ URL::previous() }}" class="btn btn-primary pull-right">
|
||||
{{ trans('general.back') }}</a>
|
||||
@stop
|
||||
|
||||
{{-- Page content --}}
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<!-- left column -->
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
<p>{{ trans('admin/models/general.bulk_delete_help') }}</p>
|
||||
<form class="form-horizontal" method="post" action="{{ route('models.bulkdelete.store') }}" autocomplete="off" role="form">
|
||||
{{csrf_field()}}
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<h2 class="box-title" style="color: red">{{ trans_choice('admin/models/general.bulk_delete_warn', $valid_count, ['model_count' => $valid_count]) }}</h2>
|
||||
</div>
|
||||
|
||||
<div class="box-body">
|
||||
<table class="table table-striped table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="col-md-1">
|
||||
<label>
|
||||
<input type="checkbox" id="checkAll" checked="checked">
|
||||
</label>
|
||||
|
||||
</td>
|
||||
<td class="col-md-1"><i class="fas fa-barcode" aria-hidden="true"></i></td>
|
||||
<td class="col-md-10">Name</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($models as $model)
|
||||
<tr{!! (($model->assets_count > 0 ) ? ' class="danger"' : '') !!}>
|
||||
<td>
|
||||
<input type="checkbox" name="ids[]" class="{ (($model->assets_count == 0) ? '' : ' disabled') }}" value="{{ $model->id }}" {!! (($model->assets_count == 0) ? ' checked="checked"' : ' disabled') !!}>
|
||||
</td>
|
||||
<td>{{ $model->assets_count }}</td>
|
||||
<td>{{ $model->name }}</td>
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div><!-- /.box-body -->
|
||||
|
||||
<div class="box-footer text-right">
|
||||
<a class="btn btn-link pull-left" href="{{ URL::previous() }}" method="post" enctype="multipart/form-data">{{ trans('button.cancel') }}</a>
|
||||
<button type="submit" class="btn btn-success" id="submit-button"><i class="fas fa-check icon-white" aria-hidden="true"></i> {{ trans('general.delete') }}</button>
|
||||
</div><!-- /.box-footer -->
|
||||
</div><!-- /.box -->
|
||||
</form>
|
||||
</div> <!-- .col-md-12-->
|
||||
</div><!--.row-->
|
||||
@stop
|
||||
@section('moar_scripts')
|
||||
<script>
|
||||
|
||||
|
||||
$("#checkAll").change(function () {
|
||||
$("input:checkbox").prop('checked', $(this).prop("checked"));
|
||||
});
|
||||
|
||||
</script>
|
||||
@stop
|
117
Production/SNIPE-IT/resources/views/models/bulk-edit.blade.php
Normal file
117
Production/SNIPE-IT/resources/views/models/bulk-edit.blade.php
Normal file
@ -0,0 +1,117 @@
|
||||
@extends('layouts/default')
|
||||
|
||||
{{-- Page title --}}
|
||||
@section('title')
|
||||
Bulk Edit
|
||||
@parent
|
||||
@stop
|
||||
|
||||
|
||||
@section('header_right')
|
||||
<a href="{{ URL::previous() }}" class="btn btn-sm btn-primary pull-right">
|
||||
{{ trans('general.back') }}</a>
|
||||
@stop
|
||||
|
||||
{{-- Page content --}}
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
|
||||
<form class="form-horizontal" method="post" action="{{ route('models.bulkedit.store') }}" autocomplete="off" role="form">
|
||||
{{ csrf_field() }}
|
||||
|
||||
<div class="box box-default">
|
||||
<div class="box-body">
|
||||
|
||||
<div class="callout callout-warning">
|
||||
<i class="fas fa-exclamation-triangle"></i>
|
||||
{{ trans_choice('admin/models/message.bulkedit.warn', count($models), ['model_count' => count($models)]) }}
|
||||
</div>
|
||||
|
||||
|
||||
<table class="table">
|
||||
<tbody>
|
||||
@foreach ($models as $model)
|
||||
|
||||
<tr{!! (($model->assets_count > 0 ) ? ' class="warning"' : ' class="success"') !!}>
|
||||
<td>
|
||||
<i class="fa {!! (($model->assets_count > 0 ) ? 'fa-warning info' : 'fa-check success') !!}"></i>
|
||||
{{ $model->display_name }}
|
||||
|
||||
@if ($model->model_number)
|
||||
({{ $model->model_number }})
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $model->assets_count }} assets
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@endforeach
|
||||
</table>
|
||||
|
||||
<div class="col-md-12" style="padding-top: 20px;">
|
||||
<!-- manufacturer -->
|
||||
@include ('partials.forms.edit.manufacturer-select', ['translated_name' => trans('general.manufacturer'), 'fieldname' => 'manufacturer_id'])
|
||||
|
||||
<!-- category -->
|
||||
@include ('partials.forms.edit.category-select', ['translated_name' => trans('admin/categories/general.category_name'), 'fieldname' => 'category_id', 'required' => 'true', 'category_type' => 'asset'])
|
||||
|
||||
<!-- custom fields -->
|
||||
<div class="form-group {{ $errors->has('fieldset_id') ? ' has-error' : '' }}">
|
||||
<label for="category_id" class="col-md-3 control-label">
|
||||
{{ trans('admin/models/general.fieldset') }}
|
||||
</label>
|
||||
<div class="col-md-7">
|
||||
{{ Form::select('fieldset_id', $fieldset_list , old('fieldset_id', 'NC'), array('class'=>'select2 js-fieldset-field', 'style'=>'width:350px')) }}
|
||||
{!! $errors->first('fieldset_id', '<span class="alert-msg" aria-hidden="true"><br><i class="fas fa-times"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- depreciation -->
|
||||
|
||||
<div class="form-group {{ $errors->has('depreciation_id') ? ' has-error' : '' }}">
|
||||
<label for="category_id" class="col-md-3 control-label">
|
||||
{{ trans('general.depreciation') }}
|
||||
</label>
|
||||
<div class="col-md-7">
|
||||
{{ Form::select('depreciation_id', $depreciation_list , old('depreciation_id', 'NC'), array('class'=>'select2', 'style'=>'width:350px')) }}
|
||||
{!! $errors->first('depreciation_id', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- requestable -->
|
||||
<div class="form-group{{ $errors->has('requestable') ? ' has-error' : '' }}">
|
||||
<div class="col-md-7 col-md-offset-3">
|
||||
|
||||
<label for="requestable_nochange" class="form-control">
|
||||
{{ Form::radio('requestable', '', true, ['id' => 'requestable_nochange', 'aria-label'=>'requestable_nochange']) }}
|
||||
{{ trans('admin/hardware/general.requestable_status_warning')}}
|
||||
</label>
|
||||
<label for="requestable" class="form-control">
|
||||
{{ Form::radio('requestable', '1', old('requestable'), ['id' => 'requestable', 'aria-label'=>'requestable']) }}
|
||||
{{ trans('admin/hardware/general.requestable')}}
|
||||
</label>
|
||||
<label for="not_requestable" class="form-control">
|
||||
{{ Form::radio('requestable', '0', old('requestable'), ['id' => 'not_requestable','aria-label'=>'not_requestable']) }}
|
||||
{{ trans('admin/hardware/general.not_requestable')}}
|
||||
</label>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@foreach ($models as $model)
|
||||
<input type="hidden" name="ids[{{ $model->id }}]" value="{{ $model->id }}">
|
||||
@endforeach
|
||||
</div>
|
||||
</div> <!--/.box-body-->
|
||||
|
||||
<div class="box-footer text-right">
|
||||
<a class="btn btn-link pull-left" href="{{ URL::previous() }}" method="post" enctype="multipart/form-data">{{ trans('button.cancel') }}</a>
|
||||
<button type="submit" class="btn btn-success" id="submit-button"><i class="fas fa-check icon-white" aria-hidden="true"></i> {{ trans('general.update') }}</button>
|
||||
</div><!-- /.box-footer -->
|
||||
</div> <!--/.box.box-default-->
|
||||
</form>
|
||||
</div> <!--/.col-md-8-->
|
||||
</div>
|
||||
@stop
|
@ -0,0 +1,96 @@
|
||||
@if (($model) && ($model->fieldset))
|
||||
@foreach($model->fieldset->fields AS $field)
|
||||
<div class="form-group{{ $errors->has($field->db_column_name()) ? ' has-error' : '' }}">
|
||||
<label for="{{ $field->db_column_name() }}" class="col-md-3 control-label">{{ $field->name }} </label>
|
||||
<div class="col-md-7 col-sm-12{{ ($field->pivot->required=='1') ? ' required' : '' }}">
|
||||
|
||||
|
||||
@if ($field->element!='text')
|
||||
<!-- Listbox -->
|
||||
@if ($field->element=='listbox')
|
||||
{{ Form::select($field->db_column_name(), $field->formatFieldValuesAsArray(),
|
||||
Request::old($field->db_column_name(),(isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : $field->defaultValue($model->id))), ['class'=>'format select2 form-control']) }}
|
||||
|
||||
@elseif ($field->element=='textarea')
|
||||
<textarea class="col-md-6 form-control" id="{{ $field->db_column_name() }}" name="{{ $field->db_column_name() }}">{{ Request::old($field->db_column_name(),(isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : $field->defaultValue($model->id))) }}</textarea>
|
||||
|
||||
@elseif ($field->element=='checkbox')
|
||||
<!-- Checkboxes -->
|
||||
@foreach ($field->formatFieldValuesAsArray() as $key => $value)
|
||||
<div>
|
||||
<label class="form-control">
|
||||
<input type="checkbox" value="{{ $value }}" name="{{ $field->db_column_name() }}[]" {{ isset($item) ? (in_array($value, array_map('trim', explode(',', $item->{$field->db_column_name()}))) ? ' checked="checked"' : '') : (Request::old($field->db_column_name()) != '' ? ' checked="checked"' : (in_array($key, array_map('trim', explode(',', $field->defaultValue($model->id)))) ? ' checked="checked"' : '')) }}>
|
||||
{{ $value }}
|
||||
</label>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
@elseif ($field->element=='radio')
|
||||
@foreach ($field->formatFieldValuesAsArray() as $value)
|
||||
|
||||
<div>
|
||||
<label class="form-control">
|
||||
<input type="radio" value="{{ $value }}" name="{{ $field->db_column_name() }}" {{ isset($item) ? ($item->{$field->db_column_name()} == $value ? ' checked="checked"' : '') : (Request::old($field->db_column_name()) != '' ? ' checked="checked"' : (in_array($value, explode(', ', $field->defaultValue($model->id))) ? ' checked="checked"' : '')) }}>
|
||||
{{ $value }}
|
||||
</label>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
@endif
|
||||
|
||||
|
||||
@else
|
||||
<!-- Date field -->
|
||||
|
||||
@if ($field->format=='DATE')
|
||||
|
||||
<div class="input-group col-md-5" style="padding-left: 0px;">
|
||||
<div class="input-group date" data-provide="datepicker" data-date-format="yyyy-mm-dd" data-autoclose="true" data-date-clear-btn="true">
|
||||
<input type="text" class="form-control" placeholder="{{ trans('general.select_date') }}" name="{{ $field->db_column_name() }}" id="{{ $field->db_column_name() }}" readonly value="{{ old($field->db_column_name(),(isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : $field->defaultValue($model->id))) }}" style="background-color:inherit">
|
||||
<span class="input-group-addon"><i class="fas fa-calendar" aria-hidden="true"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@else
|
||||
@if (($field->field_encrypted=='0') || (Gate::allows('assets.view.encrypted_custom_fields')))
|
||||
<input type="text" value="{{ Request::old($field->db_column_name(),(isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : $field->defaultValue($model->id))) }}" id="{{ $field->db_column_name() }}" class="form-control" name="{{ $field->db_column_name() }}" placeholder="Enter {{ strtolower($field->format) }} text">
|
||||
@else
|
||||
<input type="text" value="{{ strtoupper(trans('admin/custom_fields/general.encrypted')) }}" class="form-control disabled" disabled>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
@endif
|
||||
|
||||
@if ($field->help_text!='')
|
||||
<p class="help-block">{{ $field->help_text }}</p>
|
||||
@endif
|
||||
|
||||
<?php
|
||||
$errormessage=$errors->first($field->db_column_name());
|
||||
if ($errormessage) {
|
||||
$errormessage=preg_replace('/ snipeit /', '', $errormessage);
|
||||
print('<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> '.$errormessage.'</span>');
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
@if ($field->field_encrypted)
|
||||
<div class="col-md-1 col-sm-1 text-left">
|
||||
<i class="fas fa-lock" data-tooltip="true" data-placement="top" title="{{ trans('admin/custom_fields/general.value_encrypted') }}"></i>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
|
||||
<script nonce="{{ csrf_token() }}">
|
||||
// We have to re-call the tooltip since this is pulled in after the DOM has loaded
|
||||
$('[data-tooltip="true"]').tooltip({
|
||||
container: 'body',
|
||||
animation: true,
|
||||
});
|
||||
</script>
|
@ -0,0 +1,118 @@
|
||||
@php
|
||||
//set array up before loop so it doesn't get wiped at every iteration
|
||||
$fields = [];
|
||||
@endphp
|
||||
@foreach($models as $model)
|
||||
@if (($model) && ($model->fieldset))
|
||||
@foreach($model->fieldset->fields AS $field)
|
||||
@php
|
||||
//prevents some duplicate queries - open to a better way of skipping dupes in output
|
||||
//its ugly, but if we'd rather deal with duplicate queries we can get rid of this.
|
||||
if (in_array($field->db_column_name(), $fields)) {
|
||||
$duplicate = true;
|
||||
continue;
|
||||
} else {
|
||||
$duplicate = false;
|
||||
}
|
||||
$fields[] = $field->db_column_name();
|
||||
@endphp
|
||||
|
||||
<div class="form-group{{ $errors->has($field->db_column_name()) ? ' has-error' : '' }}">
|
||||
<label for="{{ $field->db_column_name() }}" class="col-md-3 control-label">{{ $field->name }} </label>
|
||||
<div class="col-md-7 col-sm-12{{ ($field->pivot->required=='1') ? ' required' : '' }}">
|
||||
|
||||
@if ($field->element!='text')
|
||||
<!-- Listbox -->
|
||||
@if ($field->element=='listbox')
|
||||
{{ Form::select($field->db_column_name(), $field->formatFieldValuesAsArray(),
|
||||
Request::old($field->db_column_name(),(isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : $field->defaultValue($model->id))), ['class'=>'format select2 form-control']) }}
|
||||
|
||||
@elseif ($field->element=='textarea')
|
||||
@if($field->is_unique)
|
||||
<input type="text" class="form-control" disabled value="{{ trans('/admin/hardware/form.bulk_update_custom_field_unique') }}">
|
||||
@endif
|
||||
@if(!$field->is_unique)
|
||||
<textarea class="col-md-6 form-control" id="{{ $field->db_column_name() }}" name="{{ $field->db_column_name() }}">{{ Request::old($field->db_column_name(),(isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : $field->defaultValue($model->id))) }}</textarea>
|
||||
@endif
|
||||
@elseif ($field->element=='checkbox')
|
||||
<!-- Checkboxes -->
|
||||
@foreach ($field->formatFieldValuesAsArray() as $key => $value)
|
||||
<label class="form-control">
|
||||
<input type="checkbox" value="{{ $value }}" name="{{ $field->db_column_name() }}[]" {{ isset($item) ? (in_array($value, array_map('trim', explode(',', $item->{$field->db_column_name()}))) ? ' checked="checked"' : '') : (Request::old($field->db_column_name()) != '' ? ' checked="checked"' : (in_array($key, array_map('trim', explode(',', $field->defaultValue($model->id)))) ? ' checked="checked"' : '')) }}>
|
||||
{{ $value }}
|
||||
</label>
|
||||
|
||||
@endforeach
|
||||
@elseif ($field->element=='radio')
|
||||
@foreach ($field->formatFieldValuesAsArray() as $value)
|
||||
|
||||
<label class="form-control">
|
||||
<input type="radio" value="{{ $value }}" name="{{ $field->db_column_name() }}" {{ isset($item) ? ($item->{$field->db_column_name()} == $value ? ' checked="checked"' : '') : (Request::old($field->db_column_name()) != '' ? ' checked="checked"' : (in_array($value, explode(', ', $field->defaultValue($model->id))) ? ' checked="checked"' : '')) }}>
|
||||
{{ $value }}
|
||||
</label>
|
||||
|
||||
@endforeach
|
||||
|
||||
@endif
|
||||
|
||||
@else
|
||||
<!-- Date field -->
|
||||
|
||||
@if ($field->format=='DATE')
|
||||
|
||||
<div class="input-group col-md-5" style="padding-left: 0px;">
|
||||
<div class="input-group date" data-provide="datepicker" data-date-format="yyyy-mm-dd" data-autoclose="true" data-date-clear-btn="true">
|
||||
<input type="text" class="form-control" placeholder="{{ trans('general.select_date') }}" name="{{ $field->db_column_name() }}" id="{{ $field->db_column_name() }}" readonly value="{{ old($field->db_column_name(),(isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : $field->defaultValue($model->id))) }}" style="background-color:inherit">
|
||||
<span class="input-group-addon"><i class="fas fa-calendar" aria-hidden="true"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@else
|
||||
|
||||
@if (($field->field_encrypted=='0') || (Gate::allows('admin')))
|
||||
@if ($field->is_unique)
|
||||
<input type="text" class="form-control" disabled value="{{trans('/admin/hardware/form.bulk_update_custom_field_unique')}}">
|
||||
@endif
|
||||
@if(!$field->is_unique)
|
||||
<input type="text" value="{{ Request::old($field->db_column_name(),(isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : $field->defaultValue($model->id))) }}" id="{{ $field->db_column_name() }}" class="form-control" name="{{ $field->db_column_name() }}" placeholder="Enter {{ strtolower($field->format) }} text">
|
||||
@endif
|
||||
@else
|
||||
<input type="text" value="{{ strtoupper(trans('admin/custom_fields/general.encrypted')) }}" class="form-control disabled" disabled>
|
||||
@endif
|
||||
|
||||
@endif
|
||||
|
||||
@endif
|
||||
|
||||
@if ($field->help_text!='')
|
||||
<p class="help-block">{{ $field->help_text }}</p>
|
||||
@endif
|
||||
|
||||
<p>{{ trans('admin/hardware/form.bulk_update_model_prefix') }}:
|
||||
{{$field->assetModels()->pluck('name')->intersect($modelNames)->implode(', ')}}
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
$errormessage=$errors->first($field->db_column_name());
|
||||
if ($errormessage) {
|
||||
$errormessage=preg_replace('/ snipeit /', '', $errormessage);
|
||||
print('<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> '.$errormessage.'</span>');
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
@if ($field->field_encrypted)
|
||||
<div class="col-md-1 col-sm-1 text-left">
|
||||
<i class="fas fa-lock" data-toggle="tooltip" data-placement="top" title="{{ trans('admin/custom_fields/general.value_encrypted') }}"></i>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
@endforeach
|
46
Production/SNIPE-IT/resources/views/models/edit.blade.php
Normal file
46
Production/SNIPE-IT/resources/views/models/edit.blade.php
Normal file
@ -0,0 +1,46 @@
|
||||
@extends('layouts/edit-form', [
|
||||
'createText' => trans('admin/models/table.create') ,
|
||||
'updateText' => trans('admin/models/table.update'),
|
||||
'topSubmit' => true,
|
||||
'helpPosition' => 'right',
|
||||
'helpText' => trans('admin/models/general.about_models_text'),
|
||||
'formAction' => (isset($item->id)) ? route('models.update', ['model' => $item->id]) : route('models.store'),
|
||||
])
|
||||
|
||||
{{-- Page content --}}
|
||||
@section('inputFields')
|
||||
|
||||
@include ('partials.forms.edit.name', ['translated_name' => trans('admin/models/table.name'), 'required' => 'true'])
|
||||
@include ('partials.forms.edit.category-select', ['translated_name' => trans('admin/categories/general.category_name'), 'fieldname' => 'category_id', 'required' => 'true', 'category_type' => 'asset'])
|
||||
@include ('partials.forms.edit.manufacturer-select', ['translated_name' => trans('general.manufacturer'), 'fieldname' => 'manufacturer_id'])
|
||||
@include ('partials.forms.edit.model_number')
|
||||
@include ('partials.forms.edit.depreciation')
|
||||
@include ('partials.forms.edit.minimum_quantity')
|
||||
|
||||
<!-- EOL -->
|
||||
|
||||
<div class="form-group {{ $errors->has('eol') ? ' has-error' : '' }}">
|
||||
<label for="eol" class="col-md-3 control-label">{{ trans('general.eol') }}</label>
|
||||
<div class="col-md-3 col-sm-4 col-xs-7">
|
||||
<div class="input-group">
|
||||
<input class="form-control" type="text" name="eol" id="eol" value="{{ Request::old('eol', isset($item->eol)) ? $item->eol : '' }}" />
|
||||
<span class="input-group-addon">
|
||||
{{ trans('general.months') }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-9 col-md-offset-3">
|
||||
{!! $errors->first('eol', '<span class="alert-msg" aria-hidden="true"><br><i class="fas fa-times"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Custom Fieldset -->
|
||||
<!-- If $item->id is null we are cloning the model and we need the $model_id variable -->
|
||||
@livewire('custom-field-set-default-values-for-model',["model_id" => $item->id ?? $model_id ?? null ])
|
||||
|
||||
@include ('partials.forms.edit.notes')
|
||||
@include ('partials.forms.edit.requestable', ['requestable_text' => trans('admin/models/general.requestable')])
|
||||
@include ('partials.forms.edit.image-upload', ['image_path' => app('models_upload_path')])
|
||||
|
||||
|
||||
@stop
|
79
Production/SNIPE-IT/resources/views/models/index.blade.php
Normal file
79
Production/SNIPE-IT/resources/views/models/index.blade.php
Normal file
@ -0,0 +1,79 @@
|
||||
@extends('layouts/default')
|
||||
|
||||
{{-- Page title --}}
|
||||
@section('title')
|
||||
|
||||
@if (Request::get('status')=='deleted')
|
||||
{{ trans('admin/models/general.view_deleted') }}
|
||||
{{ trans('admin/models/table.title') }}
|
||||
@else
|
||||
{{ trans('admin/models/general.view_models') }}
|
||||
@endif
|
||||
@parent
|
||||
@stop
|
||||
|
||||
{{-- Page title --}}
|
||||
@section('header_right')
|
||||
@can('create', \App\Models\AssetModel::class)
|
||||
<a href="{{ route('models.create') }}" class="btn btn-primary pull-right"> {{ trans('general.create') }}</a>
|
||||
@endcan
|
||||
|
||||
@if (Request::get('status')=='deleted')
|
||||
<a class="btn btn-default pull-right" href="{{ route('models.index') }}" style="margin-right: 5px;">{{ trans('admin/models/general.view_models') }}</a>
|
||||
@else
|
||||
<a class="btn btn-default pull-right" href="{{ route('models.index', ['status' => 'deleted']) }}" style="margin-right: 5px;">{{ trans('admin/models/general.view_deleted') }}</a>
|
||||
@endif
|
||||
|
||||
@stop
|
||||
|
||||
|
||||
{{-- Page content --}}
|
||||
@section('content')
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box box-default">
|
||||
<div class="box-body">
|
||||
|
||||
@include('partials.models-bulk-actions')
|
||||
<div class="table-responsive">
|
||||
<table
|
||||
data-columns="{{ \App\Presenters\AssetModelPresenter::dataTableLayout() }}"
|
||||
data-cookie-id-table="asssetModelsTable"
|
||||
data-pagination="true"
|
||||
data-id-table="asssetModelsTable"
|
||||
data-search="true"
|
||||
data-show-footer="true"
|
||||
data-side-pagination="server"
|
||||
data-show-columns="true"
|
||||
data-toolbar="#modelsBulkEditToolbar"
|
||||
data-bulk-button-id="#bulkModelsEditButton"
|
||||
data-bulk-form-id="#modelsBulkForm"
|
||||
data-show-export="true"
|
||||
data-show-refresh="true"
|
||||
data-sort-order="asc"
|
||||
id="asssetModelsTable"
|
||||
class="table table-striped snipe-table"
|
||||
data-url="{{ route('api.models.index', ['status' => request('status')]) }}"
|
||||
data-export-options='{
|
||||
"fileName": "export-models-{{ date('Y-m-d') }}",
|
||||
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
|
||||
}'>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</div><!-- /.box-body -->
|
||||
</div><!-- /.box -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@stop
|
||||
|
||||
@section('moar_scripts')
|
||||
@include ('partials.bootstrap-table', ['exportFile' => 'models-export', 'search' => true])
|
||||
|
||||
@stop
|
389
Production/SNIPE-IT/resources/views/models/view.blade.php
Normal file
389
Production/SNIPE-IT/resources/views/models/view.blade.php
Normal file
@ -0,0 +1,389 @@
|
||||
@extends('layouts/default')
|
||||
|
||||
{{-- Page title --}}
|
||||
@section('title')
|
||||
{{ $model->name }}
|
||||
{{ ($model->model_number) ? '(#'.$model->model_number.')' : '' }}
|
||||
@parent
|
||||
@stop
|
||||
|
||||
@section('header_right')
|
||||
@can('update', \App\Models\AssetModel::class)
|
||||
<div class="btn-group pull-right">
|
||||
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">{{ trans('button.actions') }}
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
@if ($model->deleted_at=='')
|
||||
<li><a href="{{ route('models.edit', $model->id) }}">{{ trans('admin/models/table.edit') }}</a></li>
|
||||
<li><a href="{{ route('models.clone.create', $model->id) }}">{{ trans('admin/models/table.clone') }}</a></li>
|
||||
<li><a href="{{ route('hardware.create', ['model_id' => $model->id]) }}">{{ trans('admin/hardware/form.create') }}</a></li>
|
||||
@else
|
||||
<li><a href="{{ route('models.restore.store', $model->id) }}">{{ trans('admin/models/general.restore') }}</a></li>
|
||||
@endif
|
||||
</ul>
|
||||
</div>
|
||||
@endcan
|
||||
@stop
|
||||
|
||||
{{-- Page content --}}
|
||||
@section('content')
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
<div class="nav-tabs-custom">
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active">
|
||||
<a href="#assets" data-toggle="tab">
|
||||
|
||||
<span class="hidden-lg hidden-md">
|
||||
<i class="fas fa-barcode fa-2x"></i>
|
||||
</span>
|
||||
<span class="hidden-xs hidden-sm">
|
||||
{{ trans('general.assets') }}
|
||||
{!! ($model->assets_count > 0 ) ? '<badge class="badge badge-secondary">'.number_format($model->assets_count).'</badge>' : '' !!}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#uploads" data-toggle="tab">
|
||||
|
||||
<span class="hidden-lg hidden-md">
|
||||
<i class="fas fa-barcode fa-2x"></i>
|
||||
</span>
|
||||
<span class="hidden-xs hidden-sm">
|
||||
{{ trans('general.files') }}
|
||||
{!! ($model->uploads->count() > 0 ) ? '<badge class="badge badge-secondary">'.number_format($model->uploads->count()).'</badge>' : '' !!}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="pull-right">
|
||||
<a href="#" data-toggle="modal" data-target="#uploadFileModal">
|
||||
<i class="fas fa-paperclip" aria-hidden="true"></i>
|
||||
{{ trans('button.upload') }}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade in active" id="assets">
|
||||
|
||||
@include('partials.asset-bulk-actions')
|
||||
|
||||
<table
|
||||
data-columns="{{ \App\Presenters\AssetPresenter::dataTableLayout() }}"
|
||||
data-cookie-id-table="assetListingTable"
|
||||
data-pagination="true"
|
||||
data-id-table="assetListingTable"
|
||||
data-search="true"
|
||||
data-side-pagination="server"
|
||||
data-show-columns="true"
|
||||
data-show-fullscreen="true"
|
||||
data-toolbar="#assetsBulkEditToolbar"
|
||||
data-bulk-button-id="#bulkAssetEditButton"
|
||||
data-bulk-form-id="#assetsBulkForm"
|
||||
data-click-to-select="true"
|
||||
data-show-export="true"
|
||||
data-show-refresh="true"
|
||||
data-sort-order="asc"
|
||||
id="assetListingTable"
|
||||
data-url="{{ route('api.assets.index',['model_id'=> $model->id]) }}"
|
||||
class="table table-striped snipe-table"
|
||||
data-export-options='{
|
||||
"fileName": "export-models-{{ str_slug($model->name) }}-assets-{{ date('Y-m-d') }}",
|
||||
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
|
||||
}'>
|
||||
</table>
|
||||
{{ Form::close() }}
|
||||
</div> <!-- /.tab-pane assets -->
|
||||
|
||||
|
||||
<div class="tab-pane fade" id="uploads">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
@if ($model->uploads->count() > 0)
|
||||
<table
|
||||
class="table table-striped snipe-table"
|
||||
id="modelFileHistory"
|
||||
data-pagination="true"
|
||||
data-id-table="modelFileHistory"
|
||||
data-search="true"
|
||||
data-side-pagination="client"
|
||||
data-sortable="true"
|
||||
data-show-columns="true"
|
||||
data-show-fullscreen="true"
|
||||
data-show-refresh="true"
|
||||
data-sort-order="desc"
|
||||
data-sort-name="created_at"
|
||||
data-show-export="true"
|
||||
data-export-options='{
|
||||
"fileName": "export-asset-{{ $model->id }}-files",
|
||||
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
|
||||
}'
|
||||
data-cookie-id-table="assetFileHistory">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-visible="true" data-field="icon" data-sortable="true">{{trans('general.file_type')}}</th>
|
||||
<th class="col-md-2" data-searchable="true" data-visible="true" data-field="image">{{ trans('general.image') }}</th>
|
||||
<th class="col-md-2" data-searchable="true" data-visible="true" data-field="filename" data-sortable="true">{{ trans('general.file_name') }}</th>
|
||||
<th class="col-md-1" data-searchable="true" data-visible="true" data-field="filesize">{{ trans('general.filesize') }}</th>
|
||||
<th class="col-md-2" data-searchable="true" data-visible="true" data-field="notes" data-sortable="true">{{ trans('general.notes') }}</th>
|
||||
<th class="col-md-1" data-searchable="true" data-visible="true" data-field="download">{{ trans('general.download') }}</th>
|
||||
<th class="col-md-2" data-searchable="true" data-visible="true" data-field="created_at" data-sortable="true">{{ trans('general.created_at') }}</th>
|
||||
<th class="col-md-1" data-searchable="true" data-visible="true" data-field="actions">{{ trans('table.actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@foreach ($model->uploads as $file)
|
||||
<tr>
|
||||
<td><i class="{{ Helper::filetype_icon($file->filename) }} icon-med" aria-hidden="true"></i></td>
|
||||
<td>
|
||||
@if ((Storage::exists('private_uploads/assetmodels/'.$file->filename)) && ( Helper::checkUploadIsImage($file->get_src('assetmodels'))))
|
||||
<a href="{{ route('show/modelfile', ['modelID' => $model->id, 'fileId' => $file->id]) }}" data-toggle="lightbox" data-type="image" data-title="{{ $file->filename }}">
|
||||
<img src="{{ route('show/modelfile', ['modelID' => $model->id, 'fileId' =>$file->id]) }}" style="max-width: 50px;">
|
||||
</a>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if (Storage::exists('private_uploads/assetmodels/'.$file->filename))
|
||||
{{ $file->filename }}
|
||||
@else
|
||||
<del>{{ $file->filename }}</del>
|
||||
@endif
|
||||
</td>
|
||||
<td data-value="{{ (Storage::exists('private_uploads/assetmodels/'.$file->filename)) ? Storage::size('private_uploads/assetmodels/'.$file->filename) : '' }}">
|
||||
{{ (Storage::exists('private_uploads/assetmodels/'.$file->filename)) ? Helper::formatFilesizeUnits(Storage::size('private_uploads/assetmodels/'.$file->filename)) : '' }}
|
||||
</td>
|
||||
<td>
|
||||
@if ($file->note)
|
||||
{{ $file->note }}
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if (($file->filename) && (Storage::exists('private_uploads/assetmodels/'.$file->filename)))
|
||||
<a href="{{ route('show/modelfile', [$model->id, $file->id]) }}" class="btn btn-sm btn-default">
|
||||
<i class="fas fa-download" aria-hidden="true"></i>
|
||||
</a>
|
||||
|
||||
<a href="{{ route('show/modelfile', [$model->id, $file->id, 'inline'=>'true']) }}" class="btn btn-sm btn-default" target="_blank">
|
||||
<i class="fa fa-external-link" aria-hidden="true"></i>
|
||||
</a>
|
||||
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if ($file->created_at)
|
||||
{{ Helper::getFormattedDateObject($file->created_at, 'datetime', false) }}
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@can('update', \App\Models\AssetModel::class)
|
||||
<a class="btn delete-asset btn-sm btn-danger btn-sm" href="{{ route('delete/assetfile', [$model->id, $file->id]) }}" data-tooltip="true" data-title="Delete" data-content="{{ trans('general.delete_confirm', ['item' => $file->filename]) }}"><i class="fas fa-trash icon-white" aria-hidden="true"></i></a>
|
||||
@endcan
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@else
|
||||
|
||||
<div class="alert alert-info alert-block">
|
||||
<i class="fas fa-info-circle"></i>
|
||||
{{ trans('general.no_results') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</div> <!-- /.col-md-12 -->
|
||||
</div> <!-- /.row -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div> <!-- /.tab-content -->
|
||||
</div> <!-- /.nav-tabs-custom -->
|
||||
</div><!-- /. col-md-12 -->
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<div class="box-heading">
|
||||
<h2 class="box-title"> {{ trans('general.moreinfo') }}:</h2>
|
||||
</div>
|
||||
</div><!-- /.box-header -->
|
||||
<div class="box-body">
|
||||
|
||||
|
||||
|
||||
@if ($model->image)
|
||||
<img src="{{ Storage::disk('public')->url(app('models_upload_path').e($model->image)) }}" class="img-responsive"></li>
|
||||
@endif
|
||||
|
||||
|
||||
<ul class="list-unstyled" style="line-height: 25px;">
|
||||
@if ($model->category)
|
||||
<li>{{ trans('general.category') }}:
|
||||
<a href="{{ route('categories.show', $model->category->id) }}">{{ $model->category->name }}</a>
|
||||
</li>
|
||||
@endif
|
||||
|
||||
@if ($model->created_at)
|
||||
<li>{{ trans('general.created_at') }}:
|
||||
{{ Helper::getFormattedDateObject($model->created_at, 'datetime', false) }}
|
||||
</li>
|
||||
@endif
|
||||
|
||||
@if ($model->min_amt)
|
||||
<li>{{ trans('general.min_amt') }}:
|
||||
{{$model->min_amt }}
|
||||
</li>
|
||||
@endif
|
||||
|
||||
@if ($model->manufacturer)
|
||||
<li>
|
||||
{{ trans('general.manufacturer') }}:
|
||||
@can('view', \App\Models\Manufacturer::class)
|
||||
<a href="{{ route('manufacturers.show', $model->manufacturer->id) }}">
|
||||
{{ $model->manufacturer->name }}
|
||||
</a>
|
||||
@else
|
||||
{{ $model->manufacturer->name }}
|
||||
@endcan
|
||||
</li>
|
||||
|
||||
@if ($model->manufacturer->url)
|
||||
<li>
|
||||
<i class="fas fa-globe-americas"></i> <a href="{{ $model->manufacturer->url }}">{{ $model->manufacturer->url }}</a>
|
||||
</li>
|
||||
@endif
|
||||
|
||||
@if ($model->manufacturer->support_url)
|
||||
<li>
|
||||
<i class="far fa-life-ring"></i> <a href="{{ $model->manufacturer->support_url }}">{{ $model->manufacturer->support_url }}</a>
|
||||
</li>
|
||||
@endif
|
||||
|
||||
@if ($model->manufacturer->support_phone)
|
||||
<li>
|
||||
<i class="fas fa-phone"></i>
|
||||
<a href="tel:{{ $model->manufacturer->support_phone }}">{{ $model->manufacturer->support_phone }}</a>
|
||||
|
||||
</li>
|
||||
@endif
|
||||
|
||||
@if ($model->manufacturer->support_email)
|
||||
<li>
|
||||
<i class="far fa-envelope"></i> <a href="mailto:{{ $model->manufacturer->support_email }}">{{ $model->manufacturer->support_email }}</a>
|
||||
</li>
|
||||
@endif
|
||||
@endif
|
||||
@if ($model->model_number)
|
||||
<li>
|
||||
{{ trans('general.model_no') }}:
|
||||
{{ $model->model_number }}
|
||||
</li>
|
||||
@endif
|
||||
|
||||
@if ($model->depreciation)
|
||||
<li>
|
||||
{{ trans('general.depreciation') }}:
|
||||
{{ $model->depreciation->name }} ({{ $model->depreciation->months.' '.trans('general.months')}})
|
||||
</li>
|
||||
@endif
|
||||
|
||||
@if ($model->eol)
|
||||
<li>{{ trans('general.eol') }}:
|
||||
{{ $model->eol .' '. trans('general.months') }}
|
||||
</li>
|
||||
@endif
|
||||
|
||||
@if ($model->fieldset)
|
||||
<li>{{ trans('admin/models/general.fieldset') }}:
|
||||
<a href="{{ route('fieldsets.show', $model->fieldset->id) }}">{{ $model->fieldset->name }}</a>
|
||||
</li>
|
||||
@endif
|
||||
|
||||
@if ($model->notes)
|
||||
<li>
|
||||
{{ trans('general.notes') }}:
|
||||
{!! nl2br(Helper::parseEscapedMarkedownInline($model->notes)) !!}
|
||||
</li>
|
||||
@endif
|
||||
|
||||
</ul>
|
||||
|
||||
@if ($model->note)
|
||||
Notes:
|
||||
<p>
|
||||
{!! $model->present()->note() !!}
|
||||
</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@can('update', \App\Models\AssetModel::class)
|
||||
<div class="col-md-12" style="padding-bottom: 5px;">
|
||||
<a href="{{ route('models.edit', $model->id) }}" style="width: 100%;" class="btn btn-sm btn-primary hidden-print">{{ trans('admin/models/table.edit') }}</a>
|
||||
</div>
|
||||
@endcan
|
||||
|
||||
@can('create', \App\Models\AssetModel::class)
|
||||
<div class="col-md-12" style="padding-bottom: 5px;">
|
||||
<a href="{{ route('models.clone.create', $model->id) }}" style="width: 100%;" class="btn btn-sm btn-primary hidden-print">{{ trans('admin/models/table.clone') }}</a>
|
||||
</div>
|
||||
@endcan
|
||||
|
||||
@can('delete', \App\Models\AssetModel::class)
|
||||
@if ($model->assets_count > 0)
|
||||
<div class="col-md-12" style="padding-bottom: 5px;">
|
||||
<button class="btn btn-block btn-sm btn-primary hidden-print disabled" data-tooltip="true" data-placement="top" data-title="{{ trans('general.cannot_be_deleted') }}">{{ trans('general.delete') }}</button>
|
||||
</div>
|
||||
@else
|
||||
|
||||
@endif
|
||||
|
||||
|
||||
<div class="text-center col-md-12" style="padding-top: 30px; padding-bottom: 30px;">
|
||||
@if ($model->deleted_at!='')
|
||||
<form method="POST" action="{{ route('models.restore.store', $model->id) }}">
|
||||
@csrf
|
||||
<button style="width: 100%;" class="btn btn-sm btn-warning hidden-print">{{ trans('button.restore') }}</button>
|
||||
</form>
|
||||
@else
|
||||
<button class="btn btn-block btn-sm btn-danger delete-asset" data-toggle="modal" title="{{ trans('general.delete_what', ['item'=> trans('general.asset_model')]) }}" data-content="{{ trans('general.sure_to_delete_var', ['item' => $model->name]) }}" data-target="#dataConfirmModal" data-tooltip="true" data-placement="top" data-title="{{ trans('general.delete_what', ['item'=> trans('general.asset_model')]) }}">{{ trans('general.delete') }} </button>
|
||||
<span class="sr-only">{{ trans('general.delete') }}</span>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@endcan
|
||||
</div>
|
||||
</div> <!-- /.row -->
|
||||
|
||||
@can('update', \App\Models\AssetModel::class)
|
||||
@include ('modals.upload-file', ['item_type' => 'models', 'item_id' => $model->id])
|
||||
@endcan
|
||||
@stop
|
||||
|
||||
@section('moar_scripts')
|
||||
|
||||
<script>
|
||||
$('#dataConfirmModal').on('show.bs.modal', function (event) {
|
||||
var content = $(event.relatedTarget).data('content');
|
||||
var title = $(event.relatedTarget).data('title');
|
||||
$(this).find(".modal-body").text(content);
|
||||
$(this).find(".modal-header").text(title);
|
||||
});
|
||||
</script>
|
||||
|
||||
@include ('partials.bootstrap-table', ['exportFile' => 'manufacturer' . $model->name . '-export', 'search' => false])
|
||||
|
||||
@stop
|
Reference in New Issue
Block a user