mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 13:57:41 -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',
|
'image',
|
||||||
'name',
|
'name',
|
||||||
'model_number',
|
'model_number',
|
||||||
|
'min_amt',
|
||||||
'eol',
|
'eol',
|
||||||
'notes',
|
'notes',
|
||||||
'created_at',
|
'created_at',
|
||||||
|
@ -52,6 +53,7 @@ class AssetModelsController extends Controller
|
||||||
'models.image',
|
'models.image',
|
||||||
'models.name',
|
'models.name',
|
||||||
'model_number',
|
'model_number',
|
||||||
|
'min_amt',
|
||||||
'eol',
|
'eol',
|
||||||
'requestable',
|
'requestable',
|
||||||
'models.notes',
|
'models.notes',
|
||||||
|
|
|
@ -76,6 +76,7 @@ class AssetModelsController extends Controller
|
||||||
$model->depreciation_id = $request->input('depreciation_id');
|
$model->depreciation_id = $request->input('depreciation_id');
|
||||||
$model->name = $request->input('name');
|
$model->name = $request->input('name');
|
||||||
$model->model_number = $request->input('model_number');
|
$model->model_number = $request->input('model_number');
|
||||||
|
$model->min_amt = $request->input('min_amt');
|
||||||
$model->manufacturer_id = $request->input('manufacturer_id');
|
$model->manufacturer_id = $request->input('manufacturer_id');
|
||||||
$model->category_id = $request->input('category_id');
|
$model->category_id = $request->input('category_id');
|
||||||
$model->notes = $request->input('notes');
|
$model->notes = $request->input('notes');
|
||||||
|
@ -153,6 +154,7 @@ class AssetModelsController extends Controller
|
||||||
$model->eol = $request->input('eol');
|
$model->eol = $request->input('eol');
|
||||||
$model->name = $request->input('name');
|
$model->name = $request->input('name');
|
||||||
$model->model_number = $request->input('model_number');
|
$model->model_number = $request->input('model_number');
|
||||||
|
$model->min_amt = $request->input('min_amt');
|
||||||
$model->manufacturer_id = $request->input('manufacturer_id');
|
$model->manufacturer_id = $request->input('manufacturer_id');
|
||||||
$model->category_id = $request->input('category_id');
|
$model->category_id = $request->input('category_id');
|
||||||
$model->notes = $request->input('notes');
|
$model->notes = $request->input('notes');
|
||||||
|
|
|
@ -47,6 +47,7 @@ class AssetModelsTransformer
|
||||||
] : null,
|
] : null,
|
||||||
'image' => ($assetmodel->image != '') ? Storage::disk('public')->url('models/'.e($assetmodel->image)) : null,
|
'image' => ($assetmodel->image != '') ? Storage::disk('public')->url('models/'.e($assetmodel->image)) : null,
|
||||||
'model_number' => e($assetmodel->model_number),
|
'model_number' => e($assetmodel->model_number),
|
||||||
|
'min_amt' => ($assetmodel->min_amt) ? (int) $assetmodel->min_amt : null,
|
||||||
'depreciation' => ($assetmodel->depreciation) ? [
|
'depreciation' => ($assetmodel->depreciation) ? [
|
||||||
'id' => (int) $assetmodel->depreciation->id,
|
'id' => (int) $assetmodel->depreciation->id,
|
||||||
'name'=> e($assetmodel->depreciation->name),
|
'name'=> e($assetmodel->depreciation->name),
|
||||||
|
|
|
@ -29,6 +29,7 @@ class AssetModel extends SnipeModel
|
||||||
protected $rules = [
|
protected $rules = [
|
||||||
'name' => 'required|min:1|max:255',
|
'name' => 'required|min:1|max:255',
|
||||||
'model_number' => 'max:255|nullable',
|
'model_number' => 'max:255|nullable',
|
||||||
|
'min_amt' => 'integer|min:0|nullable',
|
||||||
'category_id' => 'required|integer|exists:categories,id',
|
'category_id' => 'required|integer|exists:categories,id',
|
||||||
'manufacturer_id' => 'integer|exists:manufacturers,id|nullable',
|
'manufacturer_id' => 'integer|exists:manufacturers,id|nullable',
|
||||||
'eol' => 'integer:min:0|max:240|nullable',
|
'eol' => 'integer:min:0|max:240|nullable',
|
||||||
|
@ -65,6 +66,7 @@ class AssetModel extends SnipeModel
|
||||||
'fieldset_id',
|
'fieldset_id',
|
||||||
'image',
|
'image',
|
||||||
'manufacturer_id',
|
'manufacturer_id',
|
||||||
|
'min_amt',
|
||||||
'model_number',
|
'model_number',
|
||||||
'name',
|
'name',
|
||||||
'notes',
|
'notes',
|
||||||
|
|
|
@ -65,6 +65,14 @@ class AssetModelPresenter extends Presenter
|
||||||
'title' => trans('admin/models/table.modelnumber'),
|
'title' => trans('admin/models/table.modelnumber'),
|
||||||
'visible' => true,
|
'visible' => true,
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'field' => 'min_amt',
|
||||||
|
'searchable' => false,
|
||||||
|
'sortable' => true,
|
||||||
|
'switchable' => true,
|
||||||
|
'title' => trans('mail.min_QTY'),
|
||||||
|
'visible' => true,
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'field' => 'assets_count',
|
'field' => 'assets_count',
|
||||||
'searchable' => false,
|
'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.manufacturer-select', ['translated_name' => trans('general.manufacturer'), 'fieldname' => 'manufacturer_id'])
|
||||||
@include ('partials.forms.edit.model_number')
|
@include ('partials.forms.edit.model_number')
|
||||||
@include ('partials.forms.edit.depreciation')
|
@include ('partials.forms.edit.depreciation')
|
||||||
|
@include ('partials.forms.edit.minimum_quantity')
|
||||||
|
|
||||||
<!-- EOL -->
|
<!-- EOL -->
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue