Skip to content

Commit 683b3bc

Browse files
committed
Merge remote-tracking branch 'origin/develop'
2 parents d729646 + a929b63 commit 683b3bc

File tree

6 files changed

+56
-1
lines changed

6 files changed

+56
-1
lines changed

app/Http/Controllers/ComponentsController.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ public function postCreate()
8989
$component->company_id = Company::getIdForCurrentUser(Input::get('company_id'));
9090
$component->order_number = e(Input::get('order_number'));
9191
$component->min_amt = e(Input::get('min_amt'));
92+
$component->serial_number = e(Input::get('serial_number'));
9293

9394
if (e(Input::get('purchase_date')) == '') {
9495
$component->purchase_date = null;
@@ -174,6 +175,7 @@ public function postEdit($componentId = null)
174175
$component->company_id = Company::getIdForCurrentUser(Input::get('company_id'));
175176
$component->order_number = e(Input::get('order_number'));
176177
$component->min_amt = e(Input::get('min_amt'));
178+
$component->serial_number = e(Input::get('serial_number'));
177179

178180
if (e(Input::get('purchase_date')) == '') {
179181
$component->purchase_date = null;
@@ -422,7 +424,7 @@ public function getDatatable()
422424
$limit = 50;
423425
}
424426

425-
$allowed_columns = ['id','name','min_amt','order_number','purchase_date','purchase_cost','companyName','category','total_qty'];
427+
$allowed_columns = ['id','name','min_amt','order_number','serial_number','purchase_date','purchase_cost','companyName','category','total_qty'];
426428
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
427429
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at';
428430

@@ -470,6 +472,7 @@ public function getDatatable()
470472
'checkbox' =>'<div class="text-center"><input type="checkbox" name="component['.$component->id.']" class="one_required"></div>',
471473
'id' => $component->id,
472474
'name' => (string)link_to('admin/components/'.$component->id.'/view', e($component->name)),
475+
'serial_number' => $component->serial_number,
473476
'location' => ($component->location) ? e($component->location->name) : '',
474477
'total_qty' => e($component->total_qty),
475478
'min_amt' => e($component->min_amt),

app/Models/Component.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ public function scopeTextSearch($query, $search)
141141
});
142142
})->orWhere('components.name', 'LIKE', '%'.$search.'%')
143143
->orWhere('components.order_number', 'LIKE', '%'.$search.'%')
144+
->orWhere('components.serial_number', 'LIKE', '%'.$search.'%')
144145
->orWhere('components.purchase_cost', 'LIKE', '%'.$search.'%')
145146
->orWhere('components.purchase_date', 'LIKE', '%'.$search.'%');
146147
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
use Illuminate\Database\Schema\Blueprint;
4+
use Illuminate\Database\Migrations\Migration;
5+
6+
class AddSerialToComponents extends Migration
7+
{
8+
/**
9+
* Run the migrations.
10+
*
11+
* @return void
12+
*/
13+
public function up()
14+
{
15+
Schema::table('components', function ($table) {
16+
$table->string('serial_number')->nullable()->default(null);
17+
});
18+
19+
}
20+
21+
/**
22+
* Reverse the migrations.
23+
*
24+
* @return void
25+
*/
26+
public function down()
27+
{
28+
Schema::table('components', function ($table) {
29+
$table->dropColumn('serial_number');
30+
});
31+
32+
}
33+
}

resources/views/components/edit.blade.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,17 @@
9696

9797
</div>
9898

99+
<!-- Serial -->
100+
<div class="form-group {{ $errors->has('serial_number') ? ' has-error' : '' }}">
101+
102+
{{ Form::label('name', trans('admin/hardware/form.serial'), array('class' => 'col-md-3 control-label')) }}
103+
104+
<div class="col-md-8">
105+
<input class="form-control" type="text" name="serial_number" id="serial_number" value="{{ Input::old('serial_number', $component->serial_number) }}" />
106+
{!! $errors->first('serial_number', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
107+
</div>
108+
</div>
109+
99110

100111
<!-- Company -->
101112
@if (\App\Models\Company::isCurrentUserAuthorized())

resources/views/components/index.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class="table table-striped"
5252
<th data-sortable="true" data-field="id" data-visible="false">{{ trans('general.id') }}</th>
5353
<th data-switchable="true" data-visible="false" data-searchable="true" data-sortable="true" data-field="companyName">{{ trans('admin/companies/table.title') }}</th>
5454
<th data-sortable="true" data-searchable="true" data-field="name">{{ trans('admin/components/table.title') }}</th>
55+
<th data-sortable="true" data-searchable="true" data-field="serial_number" data-visible="false">{{ trans('admin/hardware/form.serial') }}</th>
5556
<th data-searchable="true" data-sortable="true" data-field="location">{{ trans('general.location') }}</th>
5657
<th data-searchable="true" data-sortable="true" data-field="category">{{ trans('general.category') }}</th>
5758
<th data-switchable="false" data-searchable="false" data-sortable="false" data-field="total_qty"> {{ trans('admin/components/general.total') }}</th>

resources/views/components/view.blade.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ class="table table-striped"
7474

7575
<!-- side address column -->
7676
<div class="col-md-3">
77+
78+
@if ($component->serial_number!='')
79+
<div class="col-md-12" style="padding-bottom: 5px;"><strong>{{ trans('admin/hardware/form.serial') }}: </strong>
80+
{{ $component->serial_number }} </div>
81+
@endif
82+
7783
@if ($component->purchase_date)
7884
<div class="col-md-12" style="padding-bottom: 5px;"><strong>{{ trans('admin/components/general.date') }}: </strong>
7985
{{ $component->purchase_date }} </div>

0 commit comments

Comments
 (0)