mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
initial commit: adds migration, input area and transformer modifications for depreciation minimum value [ch15358]
This commit is contained in:
parent
cdc4940338
commit
01037cf9cb
|
@ -20,9 +20,9 @@ class DepreciationsController extends Controller
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
$this->authorize('view', Depreciation::class);
|
$this->authorize('view', Depreciation::class);
|
||||||
$allowed_columns = ['id','name','months','created_at'];
|
$allowed_columns = ['id','name','months','depreciation_min','created_at'];
|
||||||
|
|
||||||
$depreciations = Depreciation::select('id','name','months','user_id','created_at','updated_at');
|
$depreciations = Depreciation::select('id','name','months','depreciation_min','user_id','created_at','updated_at');
|
||||||
|
|
||||||
if ($request->filled('search')) {
|
if ($request->filled('search')) {
|
||||||
$depreciations = $depreciations->TextSearch($request->input('search'));
|
$depreciations = $depreciations->TextSearch($request->input('search'));
|
||||||
|
|
|
@ -69,6 +69,7 @@ class DepreciationsController extends Controller
|
||||||
// Depreciation data
|
// Depreciation data
|
||||||
$depreciation->name = $request->input('name');
|
$depreciation->name = $request->input('name');
|
||||||
$depreciation->months = $request->input('months');
|
$depreciation->months = $request->input('months');
|
||||||
|
$depreciation->depreciations_min= $request->input('depreciation_min');
|
||||||
$depreciation->user_id = Auth::id();
|
$depreciation->user_id = Auth::id();
|
||||||
|
|
||||||
// Was the asset created?
|
// Was the asset created?
|
||||||
|
@ -125,8 +126,9 @@ class DepreciationsController extends Controller
|
||||||
$this->authorize('update', $depreciation);
|
$this->authorize('update', $depreciation);
|
||||||
|
|
||||||
// Depreciation data
|
// Depreciation data
|
||||||
$depreciation->name = $request->input('name');
|
$depreciation->name = $request->input('name');
|
||||||
$depreciation->months = $request->input('months');
|
$depreciation->months = $request->input('months');
|
||||||
|
$depreciation->depreciation_min = $request->input('depreciation_min');
|
||||||
|
|
||||||
// Was the asset created?
|
// Was the asset created?
|
||||||
if ($depreciation->save()) {
|
if ($depreciation->save()) {
|
||||||
|
|
|
@ -24,6 +24,7 @@ class DepreciationsTransformer
|
||||||
'id' => (int) $depreciation->id,
|
'id' => (int) $depreciation->id,
|
||||||
'name' => e($depreciation->name),
|
'name' => e($depreciation->name),
|
||||||
'months' => $depreciation->months . ' '. trans('general.months'),
|
'months' => $depreciation->months . ' '. trans('general.months'),
|
||||||
|
'depreciation_min' => $depreciation->depreciation_min,
|
||||||
'created_at' => Helper::getFormattedDateObject($depreciation->created_at, 'datetime'),
|
'created_at' => Helper::getFormattedDateObject($depreciation->created_at, 'datetime'),
|
||||||
'updated_at' => Helper::getFormattedDateObject($depreciation->updated_at, 'datetime'),
|
'updated_at' => Helper::getFormattedDateObject($depreciation->updated_at, 'datetime'),
|
||||||
];
|
];
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddDepreciationMinimumValue extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('depreciations', function (Blueprint $table) {
|
||||||
|
$table->decimal('depreciation_min', 8,2)->after('months')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('depreciations', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('depreciation_min');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
10
package-lock.json
generated
10
package-lock.json
generated
|
@ -11629,7 +11629,8 @@
|
||||||
"picomatch": {
|
"picomatch": {
|
||||||
"version": "2.2.2",
|
"version": "2.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz",
|
||||||
"integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg=="
|
"integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==",
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"pify": {
|
"pify": {
|
||||||
"version": "2.3.0",
|
"version": "2.3.0",
|
||||||
|
@ -14235,6 +14236,7 @@
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
|
||||||
"integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==",
|
"integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==",
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"is-extglob": "^2.1.1"
|
"is-extglob": "^2.1.1"
|
||||||
}
|
}
|
||||||
|
@ -14248,7 +14250,8 @@
|
||||||
"normalize-path": {
|
"normalize-path": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
|
||||||
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="
|
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"readdirp": {
|
"readdirp": {
|
||||||
"version": "3.4.0",
|
"version": "3.4.0",
|
||||||
|
@ -18323,7 +18326,8 @@
|
||||||
"version": "2.2.2",
|
"version": "2.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz",
|
||||||
"integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==",
|
"integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==",
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"pify": {
|
"pify": {
|
||||||
"version": "2.3.0",
|
"version": "2.3.0",
|
||||||
|
|
|
@ -8,5 +8,6 @@ return array(
|
||||||
'depreciation_name' => 'Depreciation Name',
|
'depreciation_name' => 'Depreciation Name',
|
||||||
'number_of_months' => 'Number of Months',
|
'number_of_months' => 'Number of Months',
|
||||||
'update' => 'Update Depreciation',
|
'update' => 'Update Depreciation',
|
||||||
|
'depreciation_min' => 'Minimum Value after Depreciation'
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
|
@ -22,5 +22,14 @@
|
||||||
</div>
|
</div>
|
||||||
{!! $errors->first('months', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
|
{!! $errors->first('months', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||||
</div>
|
</div>
|
||||||
|
<!-- Depreciation Minimum -->
|
||||||
|
<div class="form-group {{ $errors->has('depreciation_min') ? ' has-error' : '' }}">
|
||||||
|
<label for="depreciation_min" class="col-md-3 control-label">
|
||||||
|
{{ trans('admin/depreciations/general.depreciation_min') }}
|
||||||
|
</label>
|
||||||
|
<div class="col-md-2" style="padding-left:0px">
|
||||||
|
<input class="form-control" name="depreciation_min" id="depreciation_min" value="{{ Request::old('depreciation_min', $item->depreciation_min) }}" style="width: 80px; margin-left:15px" />
|
||||||
|
</div>
|
||||||
|
{!! $errors->first('depreciation_min', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||||
|
</div>
|
||||||
@stop
|
@stop
|
||||||
|
|
Loading…
Reference in a new issue