Skip to content

Commit

Permalink
Fix error in partializing with creating an asset maintenance. (#2987)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmeltzer authored and snipe committed Nov 29, 2016
1 parent 4fc88f6 commit 263f19b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions app/Http/Controllers/AssetMaintenancesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public function getCreate($assetId = null)
->with('selectedAsset', $selectedAsset)
->with('supplier_list', $supplier_list)
->with('assetMaintenanceType', $assetMaintenanceType)
->with('assetMaintenance', new AssetMaintenance);
->with('item', new AssetMaintenance);
}

/**
Expand Down Expand Up @@ -317,7 +317,7 @@ public function getEdit($assetMaintenanceId = null)
->with('selectedAsset', null)
->with('supplier_list', $supplier_list)
->with('assetMaintenanceType', $assetMaintenanceType)
->with('assetMaintenance', $assetMaintenance);
->with('item', $assetMaintenance);

}

Expand Down
26 changes: 13 additions & 13 deletions resources/views/asset_maintenances/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{{-- Page title --}}
@section('title')
@if ($assetMaintenance->id)
@if ($item->id)
{{ trans('admin/asset_maintenances/form.update') }}
@else
{{ trans('admin/asset_maintenances/form.create') }}
Expand Down Expand Up @@ -32,8 +32,8 @@
<div class="box-header with-border">

<h3 class="box-title">
@if ($assetMaintenance)
{{ $assetMaintenance->name }}
@if ($item)
{{ $item->name }}
@endif
</h3>
</div><!-- /.box-header -->
Expand All @@ -43,9 +43,9 @@
<div class="form-group {{ $errors->has('asset_id') ? ' has-error' : '' }}">
<label for="asset_id" class="col-md-3 control-label">{{ trans('admin/asset_maintenances/table.asset_name') }}
</label>
<div class="col-md-7{{ (\App\Helpers\Helper::checkIfRequired($assetMaintenance, 'asset_id')) ? ' required' : '' }}">
<div class="col-md-7{{ (\App\Helpers\Helper::checkIfRequired($item, 'asset_id')) ? ' required' : '' }}">
@if ($selectedAsset == null)
{{ Form::select('asset_id', $asset_list , Input::old('asset_id', $assetMaintenance->asset_id), ['class'=>'select2', 'style'=>'min-width:350px']) }}
{{ Form::select('asset_id', $asset_list , Input::old('asset_id', $item->asset_id), ['class'=>'select2', 'style'=>'min-width:350px']) }}
@else
{{ Form::select('asset_id', $asset_list , Input::old('asset_id', $selectedAsset), ['class'=>'select2', 'style'=>'min-width:350px', 'enabled' => 'false']) }}
@endif
Expand All @@ -63,8 +63,8 @@
<label for="title" class="col-md-3 control-label">{{ trans('admin/asset_maintenances/form.title') }}
</label>
</label>
<div class="col-md-7{{ (\App\Helpers\Helper::checkIfRequired($assetMaintenance, 'title')) ? ' required' : '' }}">
<input class="form-control" type="text" name="title" id="title" value="{{ Input::old('title', $assetMaintenance->title) }}" />
<div class="col-md-7{{ (\App\Helpers\Helper::checkIfRequired($item, 'title')) ? ' required' : '' }}">
<input class="form-control" type="text" name="title" id="title" value="{{ Input::old('title', $item->title) }}" />
{!! $errors->first('title', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
Expand All @@ -73,8 +73,8 @@
<div class="form-group {{ $errors->has('start_date') ? ' has-error' : '' }}">
<label for="start_date" class="col-md-3 control-label">{{ trans('admin/asset_maintenances/form.start_date') }}
</label>
<div class="input-group col-md-2{{ (\App\Helpers\Helper::checkIfRequired($assetMaintenance, 'start_date')) ? ' required' : '' }}">
<input type="date" class="datepicker form-control" data-date-format="yyyy-mm-dd" placeholder="Select Date" name="start_date" id="start_date" value="{{ Input::old('start_date', $assetMaintenance->start_date) }}">
<div class="input-group col-md-2{{ (\App\Helpers\Helper::checkIfRequired($item, 'start_date')) ? ' required' : '' }}">
<input type="date" class="datepicker form-control" data-date-format="yyyy-mm-dd" placeholder="Select Date" name="start_date" id="start_date" value="{{ Input::old('start_date', $item->start_date) }}">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
{!! $errors->first('start_date', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
Expand All @@ -84,7 +84,7 @@
<div class="form-group {{ $errors->has('completion_date') ? ' has-error' : '' }}">
<label for="start_date" class="col-md-3 control-label">{{ trans('admin/asset_maintenances/form.completion_date') }}</label>
<div class="input-group col-md-2">
<input type="date" class="datepicker form-control" data-date-format="yyyy-mm-dd" placeholder="Select Date" name="completion_date" id="completion_date" value="{{ Input::old('completion_date', $assetMaintenance->completion_date) }}">
<input type="date" class="datepicker form-control" data-date-format="yyyy-mm-dd" placeholder="Select Date" name="completion_date" id="completion_date" value="{{ Input::old('completion_date', $item->completion_date) }}">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
{!! $errors->first('completion_date', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
Expand All @@ -95,7 +95,7 @@
<div class="col-sm-offset-3 col-sm-9">
<div class="checkbox">
<label>
<input type="checkbox" value="1" name="is_warranty" id="is_warranty" {{ Input::old('is_warranty', $assetMaintenance->is_warranty) == '1' ? ' checked="checked"' : '' }}> {{ trans('admin/asset_maintenances/form.is_warranty') }}
<input type="checkbox" value="1" name="is_warranty" id="is_warranty" {{ Input::old('is_warranty', $item->is_warranty) == '1' ? ' checked="checked"' : '' }}> {{ trans('admin/asset_maintenances/form.is_warranty') }}
</label>
</div>
</div>
Expand All @@ -107,7 +107,7 @@
<div class="col-md-2">
<div class="input-group">
<span class="input-group-addon">{{ $snipeSettings->default_currency }}</span>
<input class="col-md-2 form-control" type="text" name="cost" id="cost" value="{{ Input::old('cost', \App\Helpers\Helper::formatCurrencyOutput($assetMaintenance->cost)) }}" />
<input class="col-md-2 form-control" type="text" name="cost" id="cost" value="{{ Input::old('cost', \App\Helpers\Helper::formatCurrencyOutput($item->cost)) }}" />
{!! $errors->first('cost', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
Expand All @@ -117,7 +117,7 @@
<div class="form-group {{ $errors->has('notes') ? ' has-error' : '' }}">
<label for="notes" class="col-md-3 control-label">{{ trans('admin/asset_maintenances/form.notes') }}</label>
<div class="col-md-7">
<textarea class="col-md-6 form-control" id="notes" name="notes">{{ Input::old('notes', $assetMaintenance->notes) }}</textarea>
<textarea class="col-md-6 form-control" id="notes" name="notes">{{ Input::old('notes', $item->notes) }}</textarea>
{!! $errors->first('notes', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/asset_maintenances/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class="table table-striped snipe-table"
<th data-field="companyName" data-sortable="false" data-visible="false">{{ trans('admin/companies/table.title') }}</th>
<th data-sortable="true" data-field="id" data-visible="false">{{ trans('general.id') }}</th>
<th data-sortable="false" data-field="asset_name">{{ trans('admin/asset_maintenances/table.asset_name') }}</th>
<th data-sortable="false" data-field="supplier">{{ trans('admin/asset_maintenances/table.supplier_name') }}</th>
<th data-sortable="false" data-field="supplier">{{ trans('general.supplier') }}</th>
<th data-searchable="true" data-sortable="true" data-field="asset_maintenance_type">{{ trans('admin/asset_maintenances/form.asset_maintenance_type') }}</th>
<th data-searchable="true" data-sortable="true" data-field="title">{{ trans('admin/asset_maintenances/form.title') }}</th>
<th data-searchable="true" data-sortable="false" data-field="start_date">{{ trans('admin/asset_maintenances/form.start_date') }}</th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<div class="form-group {{ $errors->has('asset_maintenance_type') ? ' has-error' : '' }}">
<label for="asset_maintenance_type" class="col-md-3 control-label">{{ trans('admin/asset_maintenances/form.asset_maintenance_type') }}
</label>
<div class="col-md-7{{ (\App\Helpers\Helper::checkIfRequired($assetMaintenance, 'asset_maintenance_type')) ? ' required' : '' }}">
{{ Form::select('asset_maintenance_type', $assetMaintenanceType , Input::old('asset_maintenance_type', $assetMaintenance->asset_maintenance_type), ['class'=>'select2', 'style'=>'min-width:350px']) }}
<div class="col-md-7{{ (\App\Helpers\Helper::checkIfRequired($item, 'asset_maintenance_type')) ? ' required' : '' }}">
{{ Form::select('asset_maintenance_type', $assetMaintenanceType , Input::old('asset_maintenance_type', $item->asset_maintenance_type), ['class'=>'select2', 'style'=>'min-width:350px']) }}
{!! $errors->first('asset_maintenance_type', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>

0 comments on commit 263f19b

Please sign in to comment.