Merge pull request #1225 from ddreier/1088-acc-prices
Accessory and Consumable Price info #1088
This commit is contained in:
@@ -68,6 +68,20 @@ class AccessoriesController extends AdminController
|
||||
// Update the accessory data
|
||||
$accessory->name = e(Input::get('name'));
|
||||
$accessory->category_id = e(Input::get('category_id'));
|
||||
$accessory->order_number = e(Input::get('order_number'));
|
||||
|
||||
if (e(Input::get('purchase_date')) == '') {
|
||||
$accessory->purchase_date = NULL;
|
||||
} else {
|
||||
$accessory->purchase_date = e(Input::get('purchase_date'));
|
||||
}
|
||||
|
||||
if (e(Input::get('purchase_cost')) == '0.00') {
|
||||
$accessory->purchase_cost = NULL;
|
||||
} else {
|
||||
$accessory->purchase_cost = ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
$accessory->qty = e(Input::get('qty'));
|
||||
$accessory->user_id = Sentry::getId();
|
||||
|
||||
@@ -136,6 +150,20 @@ class AccessoriesController extends AdminController
|
||||
// Update the accessory data
|
||||
$accessory->name = e(Input::get('name'));
|
||||
$accessory->category_id = e(Input::get('category_id'));
|
||||
$accessory->order_number = e(Input::get('order_number'));
|
||||
|
||||
if (e(Input::get('purchase_date')) == '') {
|
||||
$accessory->purchase_date = NULL;
|
||||
} else {
|
||||
$accessory->purchase_date = e(Input::get('purchase_date'));
|
||||
}
|
||||
|
||||
if (e(Input::get('purchase_cost')) == '0.00') {
|
||||
$accessory->purchase_cost = NULL;
|
||||
} else {
|
||||
$accessory->purchase_cost = ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
$accessory->qty = e(Input::get('qty'));
|
||||
|
||||
// Was the accessory created?
|
||||
|
||||
@@ -66,10 +66,24 @@ class ConsumablesController extends AdminController
|
||||
else{
|
||||
|
||||
// Update the consumable data
|
||||
$consumable->name = e(Input::get('name'));
|
||||
$consumable->category_id = e(Input::get('category_id'));
|
||||
$consumable->qty = e(Input::get('qty'));
|
||||
$consumable->user_id = Sentry::getId();
|
||||
$consumable->name = e(Input::get('name'));
|
||||
$consumable->category_id = e(Input::get('category_id'));
|
||||
$consumable->order_number = e(Input::get('order_number'));
|
||||
|
||||
if (e(Input::get('purchase_date')) == '') {
|
||||
$consumable->purchase_date = NULL;
|
||||
} else {
|
||||
$consumable->purchase_date = e(Input::get('purchase_date'));
|
||||
}
|
||||
|
||||
if (e(Input::get('purchase_cost')) == '0.00') {
|
||||
$consumable->purchase_cost = NULL;
|
||||
} else {
|
||||
$consumable->purchase_cost = ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
$consumable->qty = e(Input::get('qty'));
|
||||
$consumable->user_id = Sentry::getId();
|
||||
|
||||
// Was the consumable created?
|
||||
if($consumable->save()) {
|
||||
@@ -134,9 +148,23 @@ class ConsumablesController extends AdminController
|
||||
else {
|
||||
|
||||
// Update the consumable data
|
||||
$consumable->name = e(Input::get('name'));
|
||||
$consumable->category_id = e(Input::get('category_id'));
|
||||
$consumable->qty = e(Input::get('qty'));
|
||||
$consumable->name = e(Input::get('name'));
|
||||
$consumable->category_id = e(Input::get('category_id'));
|
||||
$consumable->order_number = e(Input::get('order_number'));
|
||||
|
||||
if (e(Input::get('purchase_date')) == '') {
|
||||
$consumable->purchase_date = NULL;
|
||||
} else {
|
||||
$consumable->purchase_date = e(Input::get('purchase_date'));
|
||||
}
|
||||
|
||||
if (e(Input::get('purchase_cost')) == '0.00') {
|
||||
$consumable->purchase_cost = NULL;
|
||||
} else {
|
||||
$consumable->purchase_cost = ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
$consumable->qty = e(Input::get('qty'));
|
||||
|
||||
// Was the consumable created?
|
||||
if($consumable->save()) {
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,11 +5,14 @@ return array(
|
||||
'about_accessories_text' => 'Accessories are anything you issue to users but that do not have a serial number (or you do not care about tracking them uniquely). For example, computer mice or keyboards.',
|
||||
'accessory_category' => 'Accessory Category',
|
||||
'accessory_name' => 'Accessory Name',
|
||||
'cost' => 'Purchase Cost',
|
||||
'create' => 'Create Accessory',
|
||||
'date' => 'Purchase Date',
|
||||
'eula_text' => 'Category EULA',
|
||||
'eula_text_help' => 'This field allows you to customize your EULAs for specific types of assets. If you only have one EULA for all of your assets, you can check the box below to use the primary default.',
|
||||
'require_acceptance' => 'Require users to confirm acceptance of assets in this category.',
|
||||
'no_default_eula' => 'No primary default EULA found. Add one in Settings.',
|
||||
'order' => 'Order Number',
|
||||
'qty' => 'QTY',
|
||||
'total' => 'Total',
|
||||
'remaining' => 'Avail',
|
||||
|
||||
@@ -4,7 +4,10 @@ return array(
|
||||
'about_consumables_title' => 'About Consumables',
|
||||
'about_consumables_text' => 'Consumables are anything purchased that will be used up over time. For example, printer ink or copier paper.',
|
||||
'consumable_name' => 'Consumable Name',
|
||||
'cost' => 'Purchase Cost',
|
||||
'create' => 'Create Consumable',
|
||||
'date' => 'Purchase Date',
|
||||
'order' => 'Order Number',
|
||||
'remaining' => 'Remaining',
|
||||
'total' => 'Total',
|
||||
'update' => 'Update Consumable',
|
||||
|
||||
@@ -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' : '' }}">
|
||||
<div class="col-md-3">
|
||||
{{ Form::label('order_number', Lang::get('admin/accessories/general.order')) }}
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<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' : '' }}">
|
||||
<div class="col-md-3">
|
||||
{{ Form::label('purchase_date', Lang::get('admin/accessories/general.date')) }}
|
||||
</div>
|
||||
<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>
|
||||
|
||||
<!-- Purchase Cost -->
|
||||
<div class="form-group {{ $errors->has('purchase_cost') ? ' has-error' : '' }}">
|
||||
<div class="col-md-3">
|
||||
{{ Form::label('purchase_cost', Lang::get('admin/accessories/general.cost')) }}
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">
|
||||
{{{ Setting::first()->default_currency }}}
|
||||
</span>
|
||||
<input class="col-md-2 form-control" type="text" name="purchase_cost" id="purchase_cost" value="{{ Input::old('purchase_cost', number_format($accessory->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' : '' }}">
|
||||
@@ -66,8 +105,8 @@
|
||||
<i class='fa fa-asterisk'></i>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-2">
|
||||
<input class="form-control" type="text" name="qty" id="qty" value="{{{ Input::old('qty', $accessory->qty) }}}" />
|
||||
<div class="col-md-2">
|
||||
<input class="form-control" type="text" name="qty" id="qty" value="{{{ Input::old('qty', $accessory->qty) }}}" />
|
||||
</div>
|
||||
{{ $errors->first('qty', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') }}
|
||||
</div>
|
||||
|
||||
@@ -27,6 +27,24 @@
|
||||
<div class="user-profile">
|
||||
<div class="row profile">
|
||||
<div class="col-md-9 bio">
|
||||
|
||||
@if ($accessory->purchase_date)
|
||||
<div class="col-md-12" style="padding-bottom: 5px;"><strong>@lang('admin/accessories/general.date'): </strong>
|
||||
{{{ $accessory->purchase_date }}} </div>
|
||||
@endif
|
||||
|
||||
@if ($accessory->purchase_cost)
|
||||
<div class="col-md-12" style="padding-bottom: 5px;"><strong>@lang('admin/accessories/general.cost'):</strong>
|
||||
{{{ Setting::first()->default_currency }}}
|
||||
|
||||
{{{ number_format($accessory->purchase_cost,2) }}} </div>
|
||||
@endif
|
||||
|
||||
@if ($accessory->order_number)
|
||||
<div class="col-md-12" style="padding-bottom: 5px;"><strong>@lang('admin/accessories/general.order'):</strong>
|
||||
{{{ $accessory->order_number }}} </div>
|
||||
@endif
|
||||
<br />
|
||||
|
||||
|
||||
<!-- checked out accessories table -->
|
||||
|
||||
@@ -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' : '' }}">
|
||||
<div class="col-md-3">
|
||||
{{ Form::label('order_number', Lang::get('admin/consumables/general.order')) }}
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<input class="form-control" type="text" name="order_number" id="order_number" value="{{{ Input::old('order_number', $consumable->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' : '' }}">
|
||||
<div class="col-md-3">
|
||||
{{ Form::label('purchase_date', Lang::get('admin/consumables/general.date')) }}
|
||||
</div>
|
||||
<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', $consumable->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' : '' }}">
|
||||
<div class="col-md-3">
|
||||
{{ Form::label('purchase_cost', Lang::get('admin/consumables/general.cost')) }}
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">
|
||||
{{{ Setting::first()->default_currency }}}
|
||||
</span>
|
||||
<input class="col-md-2 form-control" type="text" name="purchase_cost" id="purchase_cost" value="{{ Input::old('purchase_cost', number_format($consumable->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' : '' }}">
|
||||
@@ -66,8 +105,8 @@
|
||||
<i class='fa fa-asterisk'></i>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-2">
|
||||
<input class="form-control" type="text" name="qty" id="qty" value="{{{ Input::old('qty', $consumable->qty) }}}" />
|
||||
<div class="col-md-2">
|
||||
<input class="form-control" type="text" name="qty" id="qty" value="{{{ Input::old('qty', $consumable->qty) }}}" />
|
||||
</div>
|
||||
{{ $errors->first('qty', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') }}
|
||||
</div>
|
||||
|
||||
@@ -27,7 +27,24 @@
|
||||
<div class="user-profile">
|
||||
<div class="row profile">
|
||||
<div class="col-md-9 bio">
|
||||
|
||||
@if ($consumable->purchase_date)
|
||||
<div class="col-md-12" style="padding-bottom: 5px;"><strong>@lang('admin/consumables/general.date'): </strong>
|
||||
{{{ $consumable->purchase_date }}} </div>
|
||||
@endif
|
||||
|
||||
@if ($consumable->purchase_cost)
|
||||
<div class="col-md-12" style="padding-bottom: 5px;"><strong>@lang('admin/consumables/general.cost'):</strong>
|
||||
{{{ Setting::first()->default_currency }}}
|
||||
|
||||
{{{ number_format($consumable->purchase_cost,2) }}} </div>
|
||||
@endif
|
||||
|
||||
@if ($consumable->order_number)
|
||||
<div class="col-md-12" style="padding-bottom: 5px;"><strong>@lang('admin/consumables/general.order'):</strong>
|
||||
{{{ $consumable->order_number }}} </div>
|
||||
@endif
|
||||
<br />
|
||||
|
||||
<!-- checked out consumables table -->
|
||||
@if ($consumable->users->count() > 0)
|
||||
|
||||
Reference in New Issue
Block a user