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