Team 4 Form changes
This commit is contained in:
parent
9813100164
commit
be16a09e58
|
|
@ -115,11 +115,14 @@ $brandData = [
|
||||||
@case('email')
|
@case('email')
|
||||||
@case('tel')
|
@case('tel')
|
||||||
@case('date')
|
@case('date')
|
||||||
<input type="{{$question->type}}" id="field-{{$question->code}}"
|
<input type="{{$question->type}}"
|
||||||
name="{{$question->code}}" class="form-control"
|
id="field-{{$question->code}}"
|
||||||
{{$question->required == 'no'?'required':'' }}
|
name="{{$question->code}}"
|
||||||
value="{{isset($question->value)?$question->value:''}}">
|
class="form-control"
|
||||||
@break
|
{{$question->required == 'yes'?'required':'' }}
|
||||||
|
value="{{isset($question->value)?$question->value:''}}"
|
||||||
|
{{$question->code == 'legacy_code' ? 'readonly' : ''}}>
|
||||||
|
@break
|
||||||
@case('number')
|
@case('number')
|
||||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1"
|
<input type="{{$question->type}}" min="0" max="9999999999" step="1"
|
||||||
id="field-{{$question->code}}" name="{{$question->code}}" class="form-control"
|
id="field-{{$question->code}}" name="{{$question->code}}" class="form-control"
|
||||||
|
|
@ -135,9 +138,15 @@ $brandData = [
|
||||||
<select class="form-control" id="field-{{ $question->code }}" name="{{ $question->code }}" {{ $question->required == 'yes' ? 'required' : '' }}>
|
<select class="form-control" id="field-{{ $question->code }}" name="{{ $question->code }}" {{ $question->required == 'yes' ? 'required' : '' }}>
|
||||||
<option value=""> -- Select -- </option>
|
<option value=""> -- Select -- </option>
|
||||||
@foreach ($question->options as $option)
|
@foreach ($question->options as $option)
|
||||||
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }} {{ $question->code == 'contact_id' ? 'msl_code= ' . $option->contact->msl_code . ' ' : '' }} {{ $question->code == 'contact_id' ? 'speciality= ' . (isset($option->contact->speciality) ? $option->contact->speciality :'') . ' ' : '' }} >
|
<option value="{{ $option->value }}"
|
||||||
{{ $option->display }}
|
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}
|
||||||
</option>
|
@if($question->code == 'contact_id')
|
||||||
|
legacy_code="{{ isset($option->contact->legacy_code) ? e($option->contact->legacy_code) : '' }}"
|
||||||
|
speciality="{{ isset($option->contact->speciality) ? e($option->contact->speciality) : '' }}"
|
||||||
|
@endif
|
||||||
|
>
|
||||||
|
{{ $option->display }}
|
||||||
|
</option>
|
||||||
|
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -270,13 +279,15 @@ $brandData = [
|
||||||
for (let itm of data) {
|
for (let itm of data) {
|
||||||
if(itm.contact.c2c == 'Yes') {
|
if(itm.contact.c2c == 'Yes') {
|
||||||
$('#field-contact_id').append($("<option></option>").attr("value",
|
$('#field-contact_id').append($("<option></option>").attr("value",
|
||||||
itm.value).text(itm.display).attr("speciality", itm.contact.speciality));
|
itm.value).text(itm.display)
|
||||||
|
.attr("speciality", itm.contact.speciality || "")
|
||||||
|
.attr("legacy_code", itm.contact.legacy_code || ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#field-contact_id').change(function() {
|
$('#field-contact_id').change(function() {
|
||||||
$('#field-speciality').val($('option:selected', this).attr(
|
let speciality = $('option:selected', this).attr('speciality') || '';
|
||||||
'speciality'))
|
$('#field-speciality').val(speciality.trim());
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
@ -286,13 +297,19 @@ $brandData = [
|
||||||
})
|
})
|
||||||
|
|
||||||
$('#field-contact_id').change(function() {
|
$('#field-contact_id').change(function() {
|
||||||
$('#field-speciality').val($('option:selected', this).attr('speciality'))
|
let speciality = $('option:selected', this).attr('speciality') || '';
|
||||||
|
$('#field-speciality').val(speciality.trim());
|
||||||
})
|
})
|
||||||
|
|
||||||
$('#field-contact_id').change(function() {
|
$('#field-contact_id').change(function() {
|
||||||
$('#field-legacy_code').val($('option:selected', this).attr('msl_code'))
|
$('#field-legacy_code').val($('option:selected', this).attr('legacy_code') || '')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Read-only fields: keep them enabled so their values are submitted normally.
|
||||||
|
$('#field-msl_code').prop('readonly', true);
|
||||||
|
$('#field-speciality').prop('readonly', true);
|
||||||
|
$('#field-total_units').prop('readonly', true);
|
||||||
|
|
||||||
$('#field-chemist_name').parent().hide();
|
$('#field-chemist_name').parent().hide();
|
||||||
$("#field-chemist_name").prop({"required":false});
|
$("#field-chemist_name").prop({"required":false});
|
||||||
// $("#field-speciality").parent().hide();
|
// $("#field-speciality").parent().hide();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue