Fixes #1686 - added notes to model

This commit is contained in:
snipe
2016-01-27 20:39:19 -08:00
parent f121766037
commit e70dab64a2
9 changed files with 167 additions and 103 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
<?php
return array (
'app_version' => 'v2.1.0-4',
'hash_version' => 'v2.1.0-4-g2d56240',
'app_version' => 'v2.1.0-5',
'hash_version' => 'v2.1.0-5-g9563cf4',
);
@@ -115,6 +115,7 @@ class ModelsController extends AdminController
$model->modelno = e(Input::get('modelno'));
$model->manufacturer_id = e(Input::get('manufacturer_id'));
$model->category_id = e(Input::get('category_id'));
$model->note = e(Input::get('note'));
$model->user_id = Sentry::getId();
if (Input::get('custom_fieldset')!='') {
$model->fieldset_id = e(Input::get('custom_fieldset'));
@@ -166,6 +167,7 @@ class ModelsController extends AdminController
$model->category_id = e(Input::get('category_id'));
$model->modelno = e(Input::get('modelno'));
$model->user_id = Sentry::getUser()->id;
$model->note = e(Input::get('note'));
$model->eol=0;
if($model->save()) {
@@ -243,6 +245,7 @@ class ModelsController extends AdminController
$model->modelno = e(Input::get('modelno'));
$model->manufacturer_id = e(Input::get('manufacturer_id'));
$model->category_id = e(Input::get('category_id'));
$model->note = e(Input::get('note'));
if (Input::get('custom_fieldset')=='') {
$model->fieldset_id = null;
} else {
@@ -454,6 +457,7 @@ class ModelsController extends AdminController
'depreciation' => (($model->depreciation)&&($model->depreciation->id > 0)) ? $model->depreciation->name.' ('.$model->depreciation->months.')' : Lang::get('general.no_depreciation'),
'category' => ($model->category) ? $model->category->name : '',
'eol' => ($model->eol) ? $model->eol.' '.Lang::get('general.months') : '',
'note' => $model->getNote(),
'actions' => $actions
);
}
@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddNotesToModels extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('models', function ($table) {
$table->text('note')->nullable()->default(NULL);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('models', function ($table) {
$table->dropColumn('note');
});
}
}
+1
View File
@@ -85,6 +85,7 @@
'logout' => 'Logout',
'manufacturer' => 'Manufacturer',
'manufacturers' => 'Manufacturers',
'markdown' => '<a href="https://help.github.com/articles/github-flavored-markdown/">Github flavored markdown</a> is allowed',
'model_no' => 'Model No.',
'months' => 'months',
'moreinfo' => 'More Info',
+10
View File
@@ -48,6 +48,16 @@ class Model extends Elegant
return $this->belongsTo('CustomFieldset','fieldset_id');
}
public function getNote() {
$Parsedown = new Parsedown();
if ($this->note) {
return $Parsedown->text(e($this->note));
}
}
/**
* -----------------------------------------------
* BEGIN QUERY SCOPES
+11
View File
@@ -117,6 +117,17 @@
</div>
</div>
<!-- Notes -->
<div class="form-group {{ $errors->has('note') ? ' has-error' : '' }}">
<label for="note" class="col-md-2 control-label">@lang('admin/hardware/form.notes')</label>
<div class="col-md-7 col-sm-12">
<textarea class="col-md-6 form-control" id="note" name="note">{{{ Input::old('note', $model->note) }}}</textarea>
<p class="help-block">@lang('general.markdown') </p>
{{ $errors->first('note', '<br><span class="alert-msg"><i class="fa fa-times"></i> :message</span>') }}
</div>
</div>
<!-- Image -->
@if ($model->image)
<div class="form-group {{ $errors->has('image_delete') ? 'has-error' : '' }}">
+1
View File
@@ -41,6 +41,7 @@
<th data-sortable="false" data-field="depreciation">@lang('general.depreciation')</th>
<th data-sortable="false" data-field="category">@lang('general.category')</th>
<th data-sortable="true" data-field="eol">@lang('general.eol')</th>
<th data-sortable="false" data-field="note">@lang('general.notes')</th>
<th data-switchable="false" data-searchable="false" data-sortable="false" data-field="actions">@lang('table.actions')</th>
</tr>
</thead>
+106 -100
View File
@@ -50,122 +50,128 @@
@endif
<!-- checked out models table -->
@if (count($model->assets) > 0)
<table
name="modelassets"
id="table"
data-url="{{route('api.models.view', $model->id)}}"
data-cookie="true"
data-click-to-select="true"
data-cookie-id-table="modeldetailsViewTable">
<thead>
<tr>
<!-- checked out models table -->
@if (count($model->assets) > 0)
<table
name="modelassets"
id="table"
data-url="{{route('api.models.view', $model->id)}}"
data-cookie="true"
data-click-to-select="true"
data-cookie-id-table="modeldetailsViewTable">
<thead>
<tr>
<th data-sortable="false" data-field="companyName" data-searchable="false" data-visible="false">{{{ Lang::get('admin/companies/table.title') }}}</th>
<th data-sortable="true" data-field="id" data-searchable="false" data-visible="false">{{Lang::get('general.id')}}</th>
<th data-sortable="true" data-field="name" data-searchable="true">{{Lang::get('general.name')}}</th>
<th data-sortable="true" data-field="asset_tag">{{Lang::get('general.asset_tag')}}</th>
<th data-sortable="true" data-field="serial">{{Lang::get('admin/hardware/table.serial')}}</th>
<th data-sortable="false" data-field="assigned_to">{{Lang::get('general.user')}}</th>
<th data-switchable="false" data-searchable="false" data-sortable="false" data-field="actions">{{ Lang::get('table.actions') }}</th>
</tr>
</thead>
</table>
@else
<div class="col-md-9">
<div class="alert alert-info alert-block">
<i class="fa fa-info-circle"></i>
@lang('general.no_results')
</div>
</div>
@endif
<th data-sortable="false" data-field="companyName" data-searchable="false" data-visible="false">{{{ Lang::get('admin/companies/table.title') }}}</th>
<th data-sortable="true" data-field="id" data-searchable="false" data-visible="false">{{Lang::get('general.id')}}</th>
<th data-sortable="true" data-field="name" data-searchable="true">{{Lang::get('general.name')}}</th>
<th data-sortable="true" data-field="asset_tag">{{Lang::get('general.asset_tag')}}</th>
<th data-sortable="true" data-field="serial">{{Lang::get('admin/hardware/table.serial')}}</th>
<th data-sortable="false" data-field="assigned_to">{{Lang::get('general.user')}}</th>
<th data-switchable="false" data-searchable="false" data-sortable="false" data-field="actions">{{ Lang::get('table.actions') }}</th>
</tr>
</thead>
</table>
@else
<div class="col-md-9">
<div class="alert alert-info alert-block">
<i class="fa fa-info-circle"></i>
@lang('general.no_results')
</div>
</div>
@endif
</div>
</div>
<!-- side address column -->
<div class="col-md-3 col-xs-12 address pull-right">
<h6>More Info:</h6>
<ul>
<!-- side address column -->
<div class="col-md-3 col-xs-12 address pull-right">
<h6>More Info:</h6>
<ul>
@if ($model->manufacturer)
<li>@lang('general.manufacturer'):
{{ $model->manufacturer->name }}</li>
@endif
@if ($model->manufacturer)
<li>@lang('general.manufacturer'):
{{ $model->manufacturer->name }}</li>
@endif
@if ($model->modelno)
<li>@lang('general.model_no'):
{{ $model->modelno }}</li>
@endif
@if ($model->modelno)
<li>@lang('general.model_no'):
{{ $model->modelno }}</li>
@endif
@if ($model->depreciation)
<li>@lang('general.depreciation'):
{{ $model->depreciation->name }} ({{ $model->depreciation->months }}
@lang('general.months')
)</li>
@endif
@if ($model->depreciation)
<li>@lang('general.depreciation'):
{{ $model->depreciation->name }} ({{ $model->depreciation->months }}
@lang('general.months')
)</li>
@endif
@if ($model->eol)
<li>@lang('general.eol'):
{{ $model->eol }}
@lang('general.months')</li>
@endif
@if ($model->eol)
<li>@lang('general.eol'):
{{ $model->eol }}
@lang('general.months')</li>
@endif
@if ($model->image)
<li><br /><img src="{{ Config::get('app.url') }}/uploads/models/{{{ $model->image }}}" /></li>
@endif
@if ($model->image)
<li><br /><img src="{{ Config::get('app.url') }}/uploads/models/{{{ $model->image }}}" /></li>
@endif
@if ($model->deleted_at!='')
<li><br /><a href="{{ route('restore/model', $model->id) }}" class="btn-flat large info ">@lang('admin/models/general.restore')</a></li>
@if ($model->deleted_at!='')
<li><br /><a href="{{ route('restore/model', $model->id) }}" class="btn-flat large info ">@lang('admin/models/general.restore')</a></li>
@endif
@endif
</ul>
</ul>
</div>
@if ($model->note)
Notes:
<p>{{ $model->getNote() }}
</p>
@endif
@section('moar_scripts')
<script src="{{ asset('assets/js/bootstrap-table.js') }}"></script>
<script src="{{ asset('assets/js/extensions/cookie/bootstrap-table-cookie.js') }}"></script>
<script src="{{ asset('assets/js/extensions/mobile/bootstrap-table-mobile.js') }}"></script>
<script src="{{ asset('assets/js/extensions/export/bootstrap-table-export.js') }}"></script>
<script src="{{ asset('assets/js/extensions/export/tableExport.js') }}"></script>
<script src="{{ asset('assets/js/extensions/export/jquery.base64.js') }}"></script>
<script type="text/javascript">
$('#table').bootstrapTable({
classes: 'table table-responsive table-no-bordered',
undefinedText: '',
iconsPrefix: 'fa',
showRefresh: true,
search: true,
pageSize: {{{ Setting::getSettings()->per_page }}},
pagination: true,
sidePagination: 'server',
sortable: true,
cookie: true,
mobileResponsive: true,
showExport: true,
showColumns: true,
exportDataType: 'all',
exportTypes: ['csv', 'txt','json', 'xml'],
maintainSelected: true,
paginationFirstText: "@lang('general.first')",
paginationLastText: "@lang('general.last')",
paginationPreText: "@lang('general.previous')",
paginationNextText: "@lang('general.next')",
pageList: ['10','25','50','100','150','200'],
icons: {
paginationSwitchDown: 'fa-caret-square-o-down',
paginationSwitchUp: 'fa-caret-square-o-up',
columns: 'fa-columns',
refresh: 'fa-refresh'
},
</div>
});
</script>
@stop
@section('moar_scripts')
<script src="{{ asset('assets/js/bootstrap-table.js') }}"></script>
<script src="{{ asset('assets/js/extensions/cookie/bootstrap-table-cookie.js') }}"></script>
<script src="{{ asset('assets/js/extensions/mobile/bootstrap-table-mobile.js') }}"></script>
<script src="{{ asset('assets/js/extensions/export/bootstrap-table-export.js') }}"></script>
<script src="{{ asset('assets/js/extensions/export/tableExport.js') }}"></script>
<script src="{{ asset('assets/js/extensions/export/jquery.base64.js') }}"></script>
<script type="text/javascript">
$('#table').bootstrapTable({
classes: 'table table-responsive table-no-bordered',
undefinedText: '',
iconsPrefix: 'fa',
showRefresh: true,
search: true,
pageSize: {{{ Setting::getSettings()->per_page }}},
pagination: true,
sidePagination: 'server',
sortable: true,
cookie: true,
mobileResponsive: true,
showExport: true,
showColumns: true,
exportDataType: 'all',
exportTypes: ['csv', 'txt','json', 'xml'],
maintainSelected: true,
paginationFirstText: "@lang('general.first')",
paginationLastText: "@lang('general.last')",
paginationPreText: "@lang('general.previous')",
paginationNextText: "@lang('general.next')",
pageList: ['10','25','50','100','150','200'],
icons: {
paginationSwitchDown: 'fa-caret-square-o-down',
paginationSwitchUp: 'fa-caret-square-o-up',
columns: 'fa-columns',
refresh: 'fa-refresh'
},
});
</script>
@stop
@stop
-1
View File
@@ -313,7 +313,6 @@ textarea::-webkit-input-placeholder {
.table td{
color: #526273;
border-top-color: #edf2f7 !important;
vertical-align: middle !important;
}
.table th.align-right,
.table td.align-right {