Created the migration, copied view stuff from asset edit to acc. and consumable.

This commit is contained in:
Daniel Dreier
2015-09-30 22:44:55 -05:00
parent d15ef5c79d
commit 3ecfff94ef
3 changed files with 108 additions and 0 deletions
@@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddAccessoryConsumablePriceInfo extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('accessories', function ($table) {
$table->date('purchase_date')->nullable();
$table->decimal('purchase_cost', 13, 4)->nullable();
$table->string('order_number');
});
Schema::table('consumables', function ($table) {
$table->date('purchase_date')->nullable();
$table->decimal('purchase_cost', 13, 4)->nullable();
$table->string('order_number');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('accessories', function ($table) {
$table->dropColumn('purchase_date');
$table->dropColumn('purchase_cost');
$table->dropColumn('order_number');
});
Schema::table('consumables', function ($table) {
$table->dropColumn('purchase_date');
$table->dropColumn('purchase_cost');
$table->dropColumn('order_number');
});
}
}
@@ -58,6 +58,27 @@
{{ $errors->first('category_id', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') }}
</div>
</div>
<!-- Order Number -->
<div class="form-group {{ $errors->has('order_number') ? ' has-error' : '' }}">
<label for="order_number" class="col-md-2 control-label">@lang('admin/hardware/form.order')</label>
<div class="col-md-7 col-sm-12">
<input class="form-control" type="text" name="order_number" id="order_number" value="{{{ Input::old('order_number', $accessory->order_number) }}}" />
{{ $errors->first('order_number', '<br><span class="alert-msg"><i class="fa fa-times"></i> :message</span>') }}
</div>
</div>
<!-- Purchase Date -->
<div class="form-group {{ $errors->has('purchase_date') ? ' has-error' : '' }}">
<label for="purchase_date" class="col-md-2 control-label">@lang('admin/hardware/form.date')</label>
<div class="input-group col-md-3">
<input type="date" class="datepicker form-control" data-date-format="yyyy-mm-dd" placeholder="@lang('general.select_date')" name="purchase_date" id="purchase_date" value="{{{ Input::old('purchase_date', $accessory->purchase_date) }}}">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
{{ $errors->first('purchase_date', '<br><span class="alert-msg"><i class="fa fa-times"></i> :message</span>') }}
</div>
</div>
<!-- QTY -->
<div class="form-group {{ $errors->has('qty') ? ' has-error' : '' }}">
@@ -58,6 +58,45 @@
{{ $errors->first('category_id', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') }}
</div>
</div>
<!-- Order Number -->
<div class="form-group {{ $errors->has('order_number') ? ' has-error' : '' }}">
<label for="order_number" class="col-md-2 control-label">@lang('admin/hardware/form.order')</label>
<div class="col-md-7 col-sm-12">
<input class="form-control" type="text" name="order_number" id="order_number" value="{{{ Input::old('order_number', $asset->order_number) }}}" />
{{ $errors->first('order_number', '<br><span class="alert-msg"><i class="fa fa-times"></i> :message</span>') }}
</div>
</div>
<!-- Purchase Date -->
<div class="form-group {{ $errors->has('purchase_date') ? ' has-error' : '' }}">
<label for="purchase_date" class="col-md-2 control-label">@lang('admin/hardware/form.date')</label>
<div class="input-group col-md-3">
<input type="date" class="datepicker form-control" data-date-format="yyyy-mm-dd" placeholder="@lang('general.select_date')" name="purchase_date" id="purchase_date" value="{{{ Input::old('purchase_date', $asset->purchase_date) }}}">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
{{ $errors->first('purchase_date', '<br><span class="alert-msg"><i class="fa fa-times"></i> :message</span>') }}
</div>
</div>
<!-- Purchase Cost -->
<div class="form-group {{ $errors->has('purchase_cost') ? ' has-error' : '' }}">
<label for="purchase_cost" class="col-md-2 control-label">@lang('admin/hardware/form.cost') </label>
<div class="col-md-2">
<div class="input-group">
<span class="input-group-addon">
@if (($asset->id) && ($asset->assetloc))
{{{ $asset->assetloc->currency }}}
@else
{{{ Setting::first()->default_currency }}}
@endif
</span>
<input class="col-md-2 form-control" type="text" name="purchase_cost" id="purchase_cost" value="{{ Input::old('purchase_cost', number_format($asset->purchase_cost,2)) }}" />
{{ $errors->first('purchase_cost', '<br><span class="alert-msg"><i class="fa fa-times"></i> :message</span>') }}
</div>
</div>
</div>
<!-- QTY -->
<div class="form-group {{ $errors->has('qty') ? ' has-error' : '' }}">