mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
adds min_amt to asset model edit, index, and table
This commit is contained in:
parent
26dd992d3c
commit
8ebb9afedd
|
@ -38,6 +38,7 @@ class AssetModelsController extends Controller
|
|||
'image',
|
||||
'name',
|
||||
'model_number',
|
||||
'min_amt',
|
||||
'eol',
|
||||
'notes',
|
||||
'created_at',
|
||||
|
@ -52,6 +53,7 @@ class AssetModelsController extends Controller
|
|||
'models.image',
|
||||
'models.name',
|
||||
'model_number',
|
||||
'min_amt',
|
||||
'eol',
|
||||
'requestable',
|
||||
'models.notes',
|
||||
|
|
|
@ -76,6 +76,7 @@ class AssetModelsController extends Controller
|
|||
$model->depreciation_id = $request->input('depreciation_id');
|
||||
$model->name = $request->input('name');
|
||||
$model->model_number = $request->input('model_number');
|
||||
$model->min_amt = $request->input('min_amt');
|
||||
$model->manufacturer_id = $request->input('manufacturer_id');
|
||||
$model->category_id = $request->input('category_id');
|
||||
$model->notes = $request->input('notes');
|
||||
|
@ -153,6 +154,7 @@ class AssetModelsController extends Controller
|
|||
$model->eol = $request->input('eol');
|
||||
$model->name = $request->input('name');
|
||||
$model->model_number = $request->input('model_number');
|
||||
$model->min_amt = $request->input('min_amt');
|
||||
$model->manufacturer_id = $request->input('manufacturer_id');
|
||||
$model->category_id = $request->input('category_id');
|
||||
$model->notes = $request->input('notes');
|
||||
|
|
|
@ -47,6 +47,7 @@ class AssetModelsTransformer
|
|||
] : null,
|
||||
'image' => ($assetmodel->image != '') ? Storage::disk('public')->url('models/'.e($assetmodel->image)) : null,
|
||||
'model_number' => e($assetmodel->model_number),
|
||||
'min_amt' => ($assetmodel->min_amt) ? (int) $assetmodel->min_amt : null,
|
||||
'depreciation' => ($assetmodel->depreciation) ? [
|
||||
'id' => (int) $assetmodel->depreciation->id,
|
||||
'name'=> e($assetmodel->depreciation->name),
|
||||
|
|
|
@ -29,6 +29,7 @@ class AssetModel extends SnipeModel
|
|||
protected $rules = [
|
||||
'name' => 'required|min:1|max:255',
|
||||
'model_number' => 'max:255|nullable',
|
||||
'min_amt' => 'integer|min:0|nullable',
|
||||
'category_id' => 'required|integer|exists:categories,id',
|
||||
'manufacturer_id' => 'integer|exists:manufacturers,id|nullable',
|
||||
'eol' => 'integer:min:0|max:240|nullable',
|
||||
|
@ -65,6 +66,7 @@ class AssetModel extends SnipeModel
|
|||
'fieldset_id',
|
||||
'image',
|
||||
'manufacturer_id',
|
||||
'min_amt',
|
||||
'model_number',
|
||||
'name',
|
||||
'notes',
|
||||
|
|
|
@ -65,6 +65,14 @@ class AssetModelPresenter extends Presenter
|
|||
'title' => trans('admin/models/table.modelnumber'),
|
||||
'visible' => true,
|
||||
],
|
||||
[
|
||||
'field' => 'min_amt',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'switchable' => true,
|
||||
'title' => trans('mail.min_QTY'),
|
||||
'visible' => true,
|
||||
],
|
||||
[
|
||||
'field' => 'assets_count',
|
||||
'searchable' => false,
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddMinAmtToModelsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('models', function (Blueprint $table) {
|
||||
$table->integer('min_amt')->after('model_number')->default(null);;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('models', function (Blueprint $table) {
|
||||
$table->dropColumn('min_amt');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -15,6 +15,7 @@
|
|||
@include ('partials.forms.edit.manufacturer-select', ['translated_name' => trans('general.manufacturer'), 'fieldname' => 'manufacturer_id'])
|
||||
@include ('partials.forms.edit.model_number')
|
||||
@include ('partials.forms.edit.depreciation')
|
||||
@include ('partials.forms.edit.minimum_quantity')
|
||||
|
||||
<!-- EOL -->
|
||||
|
||||
|
|
Loading…
Reference in a new issue