Merge pull request #23 from Godmartinz/Modal_fix_p3

replace duplicate code with partials
This commit is contained in:
Godfrey Martinez 2024-09-25 12:50:01 -07:00 committed by GitHub
commit 96953aa2ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 15 additions and 29 deletions

View file

@ -8,20 +8,13 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form action="{{ route('api.manufacturers.store') }}" onsubmit="return false"> <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="dynamic-form-row">
<div class="col-md-4 col-xs-12"><label for="modal-name">{{ trans('general.name') }}: @include('partials.forms.edit.name', ['item' => new \App\Models\Manufacturer(), 'translated_name' => trans('admin/manufacturers/table.name')])
</label></div>
<div class="col-md-8 col-xs-12 required">
<input type='text' name="name" id='modal-name' class="form-control">
</div>
</div> </div>
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="dynamic-form-row">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('button.cancel') }}</button> @include('modals.partials.footer')
<button type="button" class="btn btn-primary" id="modal-save">{{ trans('general.save') }}</button>
</div> </div>
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->

View file

@ -1,6 +1,6 @@
<!-- partials/modals/partials/fieldset-select.blade.php --> <!-- partials/modals/partials/fieldset-select.blade.php -->
<div class="dynamic-form-row"> <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-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> </div>
<!-- partials/modals/partials/fieldset-select.blade.php --> <!-- partials/modals/partials/fieldset-select.blade.php -->

View file

@ -1,7 +1,6 @@
<!-- partials/modals/partials/model-number.blade.php --> <!-- partials/modals/partials/model-number.blade.php -->
<div class="dynamic-form-row"> <div class="dynamic-form-row">
<div class="col-md-4 col-xs-12"><label for="modal-manufacturer_id">{{ trans('general.manufacturer') }}: <div class="col-md-4 col-xs-12"><label for="modal-manufacturer_id">{{ trans('general.manufacturer') }}:</label></div>
</label></div>
<div class="col-md-8 col-xs-12"> <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> <select class="js-data-ajax" data-endpoint="manufacturers" name="manufacturer_id" style="width: 100%" id="modal-manufacturer_id"></select>
</div> </div>

View file

@ -10,21 +10,18 @@
<div class="alert alert-danger" id="modal_error_msg" style="display:none"> <div class="alert alert-danger" id="modal_error_msg" style="display:none">
</div> </div>
<div class="dynamic-form-row"> <div class="dynamic-form-row">
<div class="col-md-4 col-xs-12"><label for="modal-name">{{ trans('general.name') }}: @include('partials.forms.edit.name', ['item' => new \App\Models\Statuslabel(),'translated_name' => trans('admin/statuslabels/table.name') ])
</label></div>
<div class="col-md-8 col-xs-12 required"><input type='text' name="name" id='modal-name' class="form-control"></div>
</div> </div>
<div class="dynamic-form-row"> <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> </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> </div>
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="dynamic-form-row">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('button.cancel') }}</button> @include('modals.partials.footer')
<button type="button" class="btn btn-primary" id="modal-save">{{ trans('general.save') }}</button>
</div> </div>
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->

View file

@ -10,15 +10,12 @@
<div class="alert alert-danger" id="modal_error_msg" style="display:none"> <div class="alert alert-danger" id="modal_error_msg" style="display:none">
</div> </div>
<div class="dynamic-form-row"> <div class="dynamic-form-row">
<div class="col-md-4 col-xs-12"><label for="modal-name">{{ trans('general.name') }}: @include('partials.forms.edit.name', [ 'item' => new \App\Models\Supplier(), 'translated_name' => trans('admin/suppliers/table.name')])
</label></div>
<div class="col-md-8 col-xs-12 required"><input type='text' name="name" id='modal-name' class="form-control"></div>
</div> </div>
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="dynamic-form-row">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('button.cancel') }}</button> @include('modals.partials.footer')
<button type="button" class="btn btn-primary" id="modal-save">{{ trans('general.save') }}</button>
</div> </div>
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->

View file

@ -1,8 +1,8 @@
<!-- Name --> <!-- Name -->
<div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}"> <div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}">
<label for="name" class="col-md-3 control-label">{{ $translated_name }}</label> <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' : '' }}"> <div class="col-md-8 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' : '' !!} /> <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>') !!} {!! $errors->first('name', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div> </div>
</div> </div>