Add model number to accessories

This commit is contained in:
snipe 2016-11-17 19:57:53 -08:00
parent 54848b5edf
commit d0d9d82579
6 changed files with 54 additions and 2 deletions

View file

@ -82,6 +82,7 @@ class AccessoriesController extends Controller
$accessory->company_id = Company::getIdForCurrentUser(Input::get('company_id')); $accessory->company_id = Company::getIdForCurrentUser(Input::get('company_id'));
$accessory->order_number = e(Input::get('order_number')); $accessory->order_number = e(Input::get('order_number'));
$accessory->manufacturer_id = e(Input::get('manufacturer_id')); $accessory->manufacturer_id = e(Input::get('manufacturer_id'));
$accessory->model_number = e(Input::get('model_number'));
if (e(Input::get('purchase_date')) == '') { if (e(Input::get('purchase_date')) == '') {
$accessory->purchase_date = null; $accessory->purchase_date = null;
@ -164,6 +165,7 @@ class AccessoriesController extends Controller
$accessory->company_id = Company::getIdForCurrentUser(Input::get('company_id')); $accessory->company_id = Company::getIdForCurrentUser(Input::get('company_id'));
$accessory->manufacturer_id = e(Input::get('manufacturer_id')); $accessory->manufacturer_id = e(Input::get('manufacturer_id'));
$accessory->order_number = e(Input::get('order_number')); $accessory->order_number = e(Input::get('order_number'));
$accessory->model_number = e(Input::get('model_number'));
if (e(Input::get('purchase_date')) == '') { if (e(Input::get('purchase_date')) == '') {
$accessory->purchase_date = null; $accessory->purchase_date = null;
@ -552,7 +554,7 @@ class AccessoriesController extends Controller
} }
$allowed_columns = ['name','min_amt','order_number','purchase_date','purchase_cost','companyName','category']; $allowed_columns = ['name','min_amt','order_number','purchase_date','purchase_cost','companyName','category','model_number'];
$order = Input::get('order') === 'asc' ? 'asc' : 'desc'; $order = Input::get('order') === 'asc' ? 'asc' : 'desc';
$sort = in_array(Input::get('sort'), $allowed_columns) ? e(Input::get('sort')) : 'created_at'; $sort = in_array(Input::get('sort'), $allowed_columns) ? e(Input::get('sort')) : 'created_at';
@ -594,6 +596,7 @@ class AccessoriesController extends Controller
$rows[] = array( $rows[] = array(
'name' => '<a href="'.url('admin/accessories/'.$accessory->id).'/view">'. $accessory->name.'</a>', 'name' => '<a href="'.url('admin/accessories/'.$accessory->id).'/view">'. $accessory->name.'</a>',
'category' => ($accessory->category) ? (string)link_to('admin/settings/categories/'.$accessory->category->id.'/view', $accessory->category->name) : '', 'category' => ($accessory->category) ? (string)link_to('admin/settings/categories/'.$accessory->category->id.'/view', $accessory->category->name) : '',
'model_number' => e($accessory->model_number),
'qty' => e($accessory->qty), 'qty' => e($accessory->qty),
'order_number' => e($accessory->order_number), 'order_number' => e($accessory->order_number),
'min_amt' => e($accessory->min_amt), 'min_amt' => e($accessory->min_amt),

View file

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddModelNumberToAccessories extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('accessories', function ($table) {
$table->string('model_number')->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('accessories', function ($table) {
$table->dropColumn('model_number');
});
}
}

View file

@ -98,6 +98,19 @@
</div> </div>
</div> </div>
<!-- Model NUmber -->
<div class="form-group{{ $errors->has('model_number') ? ' has-error' : '' }}">
<div class="col-md-3">
{{ Form::label('name', trans('admin/models/table.modelnumber')) }}
</div>
<div class="col-md-8">
<input class="form-control" type="text" name="model_number" id="model_number" value="{{ Input::old('model_number', $accessory->model_number) }}" />
{!! $errors->first('model_number', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
<!-- Location --> <!-- Location -->
<div class="form-group{{ $errors->has('location_id') ? ' has-error' : '' }}"> <div class="form-group{{ $errors->has('location_id') ? ' has-error' : '' }}">
<div class="col-md-3"> <div class="col-md-3">

View file

@ -35,6 +35,7 @@
<th data-switchable="true" data-searchable="true" data-sortable="true" data-field="companyName" data-visible="false">{{ trans('admin/companies/table.title') }}</th> <th data-switchable="true" data-searchable="true" data-sortable="true" data-field="companyName" data-visible="false">{{ trans('admin/companies/table.title') }}</th>
<th data-sortable="true" data-searchable="true" data-field="name">{{ trans('admin/accessories/table.title') }}</th> <th data-sortable="true" data-searchable="true" data-field="name">{{ trans('admin/accessories/table.title') }}</th>
<th data-searchable="true" data-sortable="true" data-field="category">{{ trans('admin/accessories/general.accessory_category') }}</th> <th data-searchable="true" data-sortable="true" data-field="category">{{ trans('admin/accessories/general.accessory_category') }}</th>
<th data-searchable="true" data-sortable="true" data-field="model_number">{{ trans('admin/models/table.modelnumber') }}</th>
<th data-field="manufacturer" data-searchable="true" data-sortable="true">{{ trans('general.manufacturer') }}</th> <th data-field="manufacturer" data-searchable="true" data-sortable="true">{{ trans('general.manufacturer') }}</th>
<th data-searchable="true" data-sortable="true" data-field="location">{{ trans('general.location') }}</th> <th data-searchable="true" data-sortable="true" data-field="location">{{ trans('general.location') }}</th>
<th data-searchable="false" data-sortable="false" data-field="qty">{{ trans('admin/accessories/general.total') }}</th> <th data-searchable="false" data-sortable="false" data-field="qty">{{ trans('admin/accessories/general.total') }}</th>

View file

@ -5,6 +5,10 @@
{{ $accessory->name }} {{ $accessory->name }}
{{ trans('general.accessory') }} {{ trans('general.accessory') }}
@if ($accessory->model_number!='')
({{ $accessory->model_number }})
@endif
@parent @parent
@stop @stop