Team 4 Form changes
This commit is contained in:
parent
9813100164
commit
be16a09e58
|
|
@ -115,10 +115,13 @@ $brandData = [
|
|||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}"
|
||||
name="{{$question->code}}" class="form-control"
|
||||
{{$question->required == 'no'?'required':'' }}
|
||||
value="{{isset($question->value)?$question->value:''}}">
|
||||
<input type="{{$question->type}}"
|
||||
id="field-{{$question->code}}"
|
||||
name="{{$question->code}}"
|
||||
class="form-control"
|
||||
{{$question->required == 'yes'?'required':'' }}
|
||||
value="{{isset($question->value)?$question->value:''}}"
|
||||
{{$question->code == 'legacy_code' ? 'readonly' : ''}}>
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1"
|
||||
|
|
@ -135,7 +138,13 @@ $brandData = [
|
|||
<select class="form-control" id="field-{{ $question->code }}" name="{{ $question->code }}" {{ $question->required == 'yes' ? 'required' : '' }}>
|
||||
<option value=""> -- Select -- </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 }}"
|
||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}
|
||||
@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>
|
||||
|
||||
|
|
@ -270,13 +279,15 @@ $brandData = [
|
|||
for (let itm of data) {
|
||||
if(itm.contact.c2c == 'Yes') {
|
||||
$('#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-speciality').val($('option:selected', this).attr(
|
||||
'speciality'))
|
||||
let speciality = $('option:selected', this).attr('speciality') || '';
|
||||
$('#field-speciality').val(speciality.trim());
|
||||
})
|
||||
|
||||
},
|
||||
|
|
@ -286,13 +297,19 @@ $brandData = [
|
|||
})
|
||||
|
||||
$('#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-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").prop({"required":false});
|
||||
// $("#field-speciality").parent().hide();
|
||||
|
|
|
|||
Loading…
Reference in New Issue