Skip to content

Commit

Permalink
Merge pull request #23 from Godmartinz/Modal_fix_p3
Browse files Browse the repository at this point in the history
replace duplicate code with partials
  • Loading branch information
Godmartinz authored Sep 25, 2024
2 parents e609b39 + b797c37 commit 96953aa
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 29 deletions.
13 changes: 3 additions & 10 deletions resources/views/modals/manufacturer.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,13 @@
</div>
<div class="modal-body">
<form action="{{ route('api.manufacturers.store') }}" onsubmit="return false">
<div class="alert alert-danger" id="modal_error_msg" style="display:none">
</div>
<div class="dynamic-form-row">
<div class="col-md-4 col-xs-12"><label for="modal-name">{{ trans('general.name') }}:
</label></div>
<div class="col-md-8 col-xs-12 required">
<input type='text' name="name" id='modal-name' class="form-control">
</div>
@include('partials.forms.edit.name', ['item' => new \App\Models\Manufacturer(), 'translated_name' => trans('admin/manufacturers/table.name')])
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('button.cancel') }}</button>
<button type="button" class="btn btn-primary" id="modal-save">{{ trans('general.save') }}</button>
<div class="dynamic-form-row">
@include('modals.partials.footer')
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
2 changes: 1 addition & 1 deletion resources/views/modals/partials/fieldset-select.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- partials/modals/partials/fieldset-select.blade.php -->
<div class="dynamic-form-row">
<div class="col-md-4 col-xs-12"><label for="modal-fieldset_id">{{ trans('admin/models/general.fieldset') }}:</label></div>
<div class="col-md-8 col-xs-12">{{ Form::select('fieldset_id', Helper::customFieldsetList(),old('fieldset_id'), array('class'=>'select2', 'id'=>'modal-fieldset_id', 'style'=>'width:350px')) }}</div>
<div class="col-md-8 col-xs-12">{{ Form::select('fieldset_id', Helper::customFieldsetList(),old('fieldset_id'), array('class'=>'select2', 'id'=>'modal-fieldset_id', 'style'=>'width:100%;')) }}</div>
</div>
<!-- partials/modals/partials/fieldset-select.blade.php -->
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<!-- partials/modals/partials/model-number.blade.php -->
<div class="dynamic-form-row">
<div class="col-md-4 col-xs-12"><label for="modal-manufacturer_id">{{ trans('general.manufacturer') }}:
</label></div>
<div class="col-md-4 col-xs-12"><label for="modal-manufacturer_id">{{ trans('general.manufacturer') }}:</label></div>
<div class="col-md-8 col-xs-12">
<select class="js-data-ajax" data-endpoint="manufacturers" name="manufacturer_id" style="width: 100%" id="modal-manufacturer_id"></select>
</div>
Expand Down
13 changes: 5 additions & 8 deletions resources/views/modals/statuslabel.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,18 @@
<div class="alert alert-danger" id="modal_error_msg" style="display:none">
</div>
<div class="dynamic-form-row">
<div class="col-md-4 col-xs-12"><label for="modal-name">{{ trans('general.name') }}:
</label></div>
<div class="col-md-8 col-xs-12 required"><input type='text' name="name" id='modal-name' class="form-control"></div>
@include('partials.forms.edit.name', ['item' => new \App\Models\Statuslabel(),'translated_name' => trans('admin/statuslabels/table.name') ])
</div>

<div class="dynamic-form-row">
<div class="col-md-4 col-xs-12"><label for="modal-type">{{ trans('admin/statuslabels/table.status_type') }}:
<div class="col-md-3 col-xs-12"><label for="modal-type">{{ trans('admin/statuslabels/table.status_type') }}:
</label></div>
<div class="col-md-8 col-xs-12 required">{{ Form::select('type', $statuslabel_types, '', array('class'=>'select2', 'style'=>'width:90%','id' =>'modal-type')) }}</div>
<div class="col-md-8 col-xs-12 required">{{ Form::select('type', $statuslabel_types, '', array('class'=>'select2', 'style'=>'width:100%','id' =>'modal-type')) }}</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('button.cancel') }}</button>
<button type="button" class="btn btn-primary" id="modal-save">{{ trans('general.save') }}</button>
<div class="dynamic-form-row">
@include('modals.partials.footer')
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
9 changes: 3 additions & 6 deletions resources/views/modals/supplier.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@
<div class="alert alert-danger" id="modal_error_msg" style="display:none">
</div>
<div class="dynamic-form-row">
<div class="col-md-4 col-xs-12"><label for="modal-name">{{ trans('general.name') }}:
</label></div>
<div class="col-md-8 col-xs-12 required"><input type='text' name="name" id='modal-name' class="form-control"></div>
@include('partials.forms.edit.name', [ 'item' => new \App\Models\Supplier(), 'translated_name' => trans('admin/suppliers/table.name')])
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('button.cancel') }}</button>
<button type="button" class="btn btn-primary" id="modal-save">{{ trans('general.save') }}</button>
<div class="dynamic-form-row">
@include('modals.partials.footer')
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
4 changes: 2 additions & 2 deletions resources/views/partials/forms/edit/name.blade.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!-- Name -->
<div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}">
<label for="name" class="col-md-3 control-label">{{ $translated_name }}</label>
<div class="col-md-7 col-sm-12{{ (Helper::checkIfRequired($item, 'name')) ? ' required' : '' }}">
<input class="form-control" type="text" name="name" aria-label="name" id="name" value="{{ old('name', $item->name) }}"{!! (Helper::checkIfRequired($item, 'name')) ? ' required' : '' !!} />
<div class="col-md-8 col-sm-12{{ (Helper::checkIfRequired($item, 'name')) ? ' required' : '' }}">
<input class="form-control" style="width:100%;" type="text" name="name" aria-label="name" id="name" value="{{ old('name', $item->name) }}"{!! (Helper::checkIfRequired($item, 'name')) ? ' required' : '' !!} />
{!! $errors->first('name', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>

0 comments on commit 96953aa

Please sign in to comment.