Team4 (Mother Forum Final Change)
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m42s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m42s
Details
This commit is contained in:
parent
284c2034f7
commit
46d2d566b8
|
|
@ -73,7 +73,7 @@
|
|||
}
|
||||
@endphp
|
||||
|
||||
@if(count($submissions) < 1)
|
||||
@if(count($submissions) < 2)
|
||||
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
|
|
@ -211,122 +211,122 @@
|
|||
</script>
|
||||
@endif
|
||||
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
<input type="hidden" name="user_id" value="{{$form->user_id}}">
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
@endif
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
<input type="hidden" name="user_id" value="{{$form->user_id}}">
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
@endif
|
||||
|
||||
{{-- TM Contact: common field, outside doctor wrappers --}}
|
||||
<div class="col-md-12 mb-2">
|
||||
<label class="form-label">TM Contact Number <span class="text-danger">*</span></label>
|
||||
<input type="tel" id="field-tm_contact" name="tm_contact" class="form-control"
|
||||
value="{{ $submissions[0]->formdata->tm_contact ?? '' }}">
|
||||
</div>
|
||||
{{-- TM Contact: common field, outside doctor wrappers --}}
|
||||
<div class="col-md-12 mb-2">
|
||||
<label class="form-label">TM Contact Number <span class="text-danger">*</span></label>
|
||||
<input type="tel" id="field-tm_contact" name="tm_contact" class="form-control"
|
||||
value="{{ $submissions[0]->formdata->tm_contact ?? '' }}">
|
||||
</div>
|
||||
|
||||
{{-- Manager select if applicable --}}
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
|
||||
<select class="form-control" id="field-user_id" name="user_id" required>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($form->users as $option)
|
||||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}"
|
||||
{{isset($question->value) && $question->value == $option->value ? 'selected':''}}>
|
||||
{{$option->display}}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
{{-- Manager select if applicable --}}
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
|
||||
<select class="form-control" id="field-user_id" name="user_id" required>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($form->users as $option)
|
||||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}"
|
||||
{{isset($question->value) && $question->value == $option->value ? 'selected':''}}>
|
||||
{{$option->display}}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- Doctor Wrappers --}}
|
||||
@for($i = 1; $i <= 3; $i++)
|
||||
<div class="doctor-wrapper mb-4 p-2 border" data-index="{{$i}}">
|
||||
<h5>Doctor {{$i}}</h5>
|
||||
{{-- Doctor Wrappers --}}
|
||||
@for($i = 1; $i <= 3; $i++)
|
||||
<div class="doctor-wrapper mb-4 p-2 border" data-index="{{$i}}">
|
||||
<h5>Doctor {{$i}}</h5>
|
||||
|
||||
@foreach($questions as $question)
|
||||
@foreach($questions as $question)
|
||||
|
||||
@php
|
||||
$fieldName = $question->code;
|
||||
if($i > 1){
|
||||
$fieldName = $question->code . '_' . $i;
|
||||
}
|
||||
@php
|
||||
$fieldName = $question->code;
|
||||
if($i > 1){
|
||||
$fieldName = $question->code . '_' . $i;
|
||||
}
|
||||
|
||||
// Special case: first wrapper contact_id is stored as cont_id in formdata
|
||||
$lookupName = $fieldName;
|
||||
if($i == 1 && $question->code == 'contact_id'){
|
||||
$lookupName = 'cont_id';
|
||||
}
|
||||
// Special case: first wrapper contact_id is stored as cont_id in formdata
|
||||
$lookupName = $fieldName;
|
||||
if($i == 1 && $question->code == 'contact_id'){
|
||||
$lookupName = 'cont_id';
|
||||
}
|
||||
|
||||
// Skip tm_contact because it's outside
|
||||
if($question->code == 'tm_contact') continue;
|
||||
// Skip tm_contact because it's outside
|
||||
if($question->code == 'tm_contact') continue;
|
||||
|
||||
$value = isset($submissions[0]->formdata->{$lookupName})
|
||||
? $submissions[0]->formdata->{$lookupName}
|
||||
: '';
|
||||
@endphp
|
||||
$value = isset($submissions[0]->formdata->{$lookupName})
|
||||
? $submissions[0]->formdata->{$lookupName}
|
||||
: '';
|
||||
@endphp
|
||||
|
||||
<div class="col-md-12 mb-2">
|
||||
<label class="form-label">{{$question->question}}</label>
|
||||
<div class="col-md-12 mb-2">
|
||||
<label class="form-label">{{$question->question}}</label>
|
||||
|
||||
@switch($question->type)
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
@case('time')
|
||||
@case('number')
|
||||
<input type="{{$question->type}}"
|
||||
id="field-{{$fieldName}}"
|
||||
name="{{$fieldName}}"
|
||||
class="form-control"
|
||||
value="{{$value}}">
|
||||
@break
|
||||
@switch($question->type)
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
@case('time')
|
||||
@case('number')
|
||||
<input type="{{$question->type}}"
|
||||
id="field-{{$fieldName}}"
|
||||
name="{{$fieldName}}"
|
||||
class="form-control"
|
||||
value="{{$value}}">
|
||||
@break
|
||||
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$fieldName}}"
|
||||
name="{{$fieldName}}"
|
||||
class="form-control">{{$value}}</textarea>
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$fieldName}}"
|
||||
name="{{$fieldName}}"
|
||||
class="form-control">{{$value}}</textarea>
|
||||
@break
|
||||
|
||||
@case('dropdown')
|
||||
<select id="field-{{$fieldName}}" name="{{$fieldName}}" class="form-control">
|
||||
<option value="">-- Select --</option>
|
||||
@foreach ($question->options as $option)
|
||||
@php
|
||||
$optionValue = $option->value; // default ID
|
||||
if($i > 1 && $question->code == 'contact_id') {
|
||||
$optionValue = $option->display; // use name for wrapper 2 & 3
|
||||
}
|
||||
@endphp
|
||||
@case('dropdown')
|
||||
<select id="field-{{$fieldName}}" name="{{$fieldName}}" class="form-control">
|
||||
<option value="">-- Select --</option>
|
||||
@foreach ($question->options as $option)
|
||||
@php
|
||||
$optionValue = $option->value; // default ID
|
||||
if($i > 1 && $question->code == 'contact_id') {
|
||||
$optionValue = $option->display; // use name for wrapper 2 & 3
|
||||
}
|
||||
@endphp
|
||||
|
||||
<option value="{{ $optionValue }}"
|
||||
{{ $value == $optionValue ? 'selected' : '' }}
|
||||
legacy_code="{{ $option->contact->legacy_code ?? '' }}"
|
||||
speciality="{{ $option->contact->speciality ?? '' }}">
|
||||
{{$option->display}}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
<option value="{{ $optionValue }}"
|
||||
{{ $value == $optionValue ? 'selected' : '' }}
|
||||
legacy_code="{{ $option->contact->legacy_code ?? '' }}"
|
||||
speciality="{{ $option->contact->speciality ?? '' }}">
|
||||
{{$option->display}}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
|
||||
@endforeach
|
||||
</div>
|
||||
@endfor
|
||||
@endforeach
|
||||
</div>
|
||||
@endfor
|
||||
|
||||
{{-- Submit button --}}
|
||||
{{-- @if(!$alreadySubmitted && (!isset($form->is_approval) || $form->is_approval != 'yes')) --}}
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
{{-- @endif --}}
|
||||
</form>
|
||||
{{-- Submit button --}}
|
||||
{{-- @if(!$alreadySubmitted && (!isset($form->is_approval) || $form->is_approval != 'yes')) --}}
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
{{-- @endif --}}
|
||||
</form>
|
||||
|
||||
@else
|
||||
<div class="alert alert-warning text-center mt-3">
|
||||
|
|
@ -431,6 +431,10 @@
|
|||
|
||||
}
|
||||
})
|
||||
$('#field-month').val('August');
|
||||
|
||||
|
||||
$('#field-month').css({'pointer-events': 'none','background-color': '#e9ecef'}).attr('tabindex', '-1');
|
||||
|
||||
// $('#field-contact_id').append('<option value="others">Others</option>');
|
||||
|
||||
|
|
@ -483,19 +487,19 @@
|
|||
return;
|
||||
}
|
||||
|
||||
let totalWrappers = $('.doctor-wrapper').length;
|
||||
let totalWrappers = $('.doctor-wrapper').length;
|
||||
|
||||
if (totalWrappers < 3) {
|
||||
event.preventDefault();
|
||||
if (totalWrappers < 3) {
|
||||
event.preventDefault();
|
||||
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Incomplete Form',
|
||||
text: 'Please add all 3 doctors before submitting.'
|
||||
});
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Incomplete Form',
|
||||
text: 'Please add all 3 doctors before submitting.'
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const formData = new FormData($('#report-form')[0]);
|
||||
// Log form data to console
|
||||
|
|
@ -539,7 +543,7 @@
|
|||
|
||||
var plandateField = document.getElementById('field-record_date');
|
||||
|
||||
plandateField.setAttribute('max', today);
|
||||
//plandateField.setAttribute('max', today);
|
||||
});
|
||||
</script>
|
||||
@if(!$id)
|
||||
|
|
@ -629,6 +633,11 @@ for (let i = 2; i <= 3; i++) { // numbering starts at 2
|
|||
|
||||
// 👉 Append clone
|
||||
$clone.insertAfter($('.doctor-wrapper').last());
|
||||
|
||||
$('#field-month_2').val('August');
|
||||
$('#field-month_3').val('August');
|
||||
|
||||
$('#field-month_2, #field-month_3').css({'pointer-events': 'none','background-color': '#e9ecef'}).attr('tabindex', '-1');
|
||||
}
|
||||
|
||||
// 👉 Remove add button completely
|
||||
|
|
@ -885,6 +894,10 @@ $(document).on('change', '[id^=field-contact_id]', function () {
|
|||
$wrapper.find('[id^=field-legacy_code]').val('');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@endif
|
||||
</body>
|
||||
|
|
|
|||
Loading…
Reference in New Issue