Titans (Core HCP Network )- Final Code
Specific Folder FTP Upload / ftp-deploy (push) Successful in 39s Details

This commit is contained in:
zeeshan 2026-09-30 16:20:55 +05:30
parent be7991eab8
commit 7e27feb8f4
1 changed files with 237 additions and 107 deletions

View File

@ -89,9 +89,19 @@
@endphp
<tr>
<td>
@if(isset($sub->formdata->execution_done) && $sub->formdata->execution_done == 'yes' ) Execution Done
@else
<button type="button" class="btn btn-xs btn-info edit-btn"
plan_details="{{ json_encode($sub->formdata) }}"><i
class="mdi mdi-pencil"></i> Edit</button>
plan_details="{{ json_encode($sub->formdata) }}"><i
class="mdi mdi-pencil"></i> Edit</button>
<button type="button" class="btn btn-xs btn-info edit_plan-btn"
plan_details="{{ json_encode($sub->formdata) }}"><i
class="mdi mdi-pencil"></i> Edit Plan</button>
@endif
</td>
<td>{{ $sub->formdata->plan_date }}</td>
<td>{{ isset($sub->formdata->execution_done) && $sub->formdata->execution_done == 'yes' ? 'Yes' : 'No' }}
@ -196,54 +206,34 @@
{{ $question->required == 'yes' ? 'required' : '' }}>{{ isset($question->value) ? $question->value : '' }}</textarea>
@break
@case('dropdown')
{{-- <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>
@if($question->code == 'contact_id' && isset($option->contact->type) && $option->contact->type == 'doctor')
@foreach ($question->options as $option)
@if( isset($option->contact->core_hcp_connect_drive_doctors) && $option->contact->core_hcp_connect_drive_doctors == 'Yes' )
<option value="{{ $option->value }}" msl_code="{{isset($option->contact->msl_code)?$option->contact->msl_code:''}}" speciality="{{isset($option->contact->speciality)?$option->contact->speciality:''}}" core_value="{{isset($option->contact->core_hcp_connect_drive_doctors_core_value)?$option->contact->core_hcp_connect_drive_doctors_core_value:''}}"
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
{{ $option->display }}
</option>
@foreach ($question->options as $option)
@if ($question->code == 'contact_id')
{{-- Only show doctors with connect drive enabled --}}
@if(($option->contact->type ?? null) == 'doctor' && ($option->contact->core_hcp_connect_drive_doctors ?? null) == 'Yes')
<option value="{{ $option->value }}"
msl_code="{{ $option->contact->msl_code ?? '' }}"
speciality="{{ $option->contact->speciality ?? '' }}"
core_value="{{ $option->contact->core_hcp_connect_drive_doctors_core_value ?? '' }}"
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
{{ $option->display }}
</option>
@endif
@else
{{-- Default options for other dropdowns --}}
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
{{ $option->display }}
</option>
@endif
@endforeach
@else
@foreach ($question->options as $option)
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
{{ $option->display }}
</option>
@endforeach
@endif
</select> --}}
@case('dropdown')
<select class="form-control" id="field-{{ $question->code }}" name="{{ $question->code }}" {{ ($question->required ?? '') == 'yes' ? 'required' : '' }}>
<option value=""> -- Select -- </option>
@foreach ($question->options as $option)
@if ($question->code == 'contact_id')
{{-- Only show doctors with connect drive enabled --}}
@if (($option->contact->type ?? null) == 'doctor' && ($option->contact->core_hcp_connect_drive_doctors ?? null) == 'Yes')
<option value="{{ $option->value }}"
msl-code="{{ $option->contact->msl_code ?? '' }}"
speciality="{{ $option->contact->speciality ?? '' }}"
core-value="{{ $option->contact->core_hcp_connect_drive_doctors_core_value ?? '' }}"
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
{{ $option->display }}
</option>
@endif
@else
{{-- Default options for other dropdowns --}}
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
{{ $option->display }}
</option>
@endif
@endforeach
</select>
@break
@endforeach
</select>
@break
@case('checkbox')
@foreach ($question->options as $option)
@ -281,7 +271,7 @@
<input type="hidden" name="form_id" value="{{ $form_id }}">
@csrf
<input type="hidden" name="id" value="" id="execution-id">
<input type="hidden" name="execution_done" value="yes">
{{-- <input type="hidden" name="execution_done" value="yes"> --}}
@foreach ($questions as $question)
<div class="col-md-12 mb-2">
<label for="execution-{{ $question->code }}"
@ -319,25 +309,26 @@
@break
@case('dropdown')
<select class="form-control" id="execution-{{ $question->code }}"
name="{{ $question->code }}"
{{ $question->required == 'yes' ? 'required' : '' }}>
<select class="form-control" id="execution-{{ $question->code }}" name="{{ $question->code }}" {{ ($question->required ?? '') == 'yes' ? 'required' : '' }}>
<option value=""> -- Select -- </option>
@foreach ($question->options as $option)
@if($question->code == 'contact_id' && isset($option->contact->type) && $option->contact->type != 'Chemist' )
@if ($question->code == 'contact_id')
{{-- Only show doctors with connect drive enabled --}}
@if(($option->contact->type ?? null) == 'doctor' && ($option->contact->core_hcp_connect_drive_doctors ?? null) == 'Yes')
<option value="{{ $option->value }}"
@if(isset($question->value) && $question->value == $option->value) selected @endif
@if($question->code == 'contact_id')
msl_code="{{ (isset($option->contact->msl_code) ? $option->contact->msl_code : '') }}"
speciality="{{ (isset($option->contact->speciality) ? $option->contact->speciality : '') }}"
@endif
>
msl_code="{{ $option->contact->msl_code ?? '' }}"
speciality="{{ $option->contact->speciality ?? '' }}"
core_value="{{ $option->contact->core_hcp_connect_drive_doctors_core_value ?? '' }}"
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
{{ $option->display }}
</option>
@elseif($question->code != 'contact_id')
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }} {{ $question->code == 'contact_id' ? 'pcode= ' . (isset($option->contact->pcode)?$option->contact->pcode:'') . ' ' : '' }} {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }} {{ $question->code == 'contact_id' ? 'speciality= ' . (isset($option->contact->speciality) ? $option->contact->speciality :'') . ' ' : '' }} >
{{ $option->display }}
</option>
@endif
@else
{{-- Default options for other dropdowns --}}
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
{{ $option->display }}
</option>
@endif
@endforeach
</select>
@ -411,10 +402,7 @@
$('#form-wrapper').hide()
$('#execution-form-wrapper').hide()
// $('#add-camp-btn').click(function() {
// $('#form-wrapper').show()
// $('#table-wrapper').hide()
// })
$('#add-camp-btn').click(function() {
$('#table-wrapper').hide(0)
@ -429,15 +417,27 @@
$('#execution-form-wrapper').show(100, () => {
$('#add-camp-btn').hide(0);
})
$('#execution-form').append('<input type="hidden" name="execution_done" value="yes" />');
$('#table-wrapper').hide()
let contacts = document.getElementById('execution-contact_id');
contacts.addEventListener('mousedown', function(e) {
e.preventDefault();
})
let months = document.getElementById('execution-month_of_engagement');
months.addEventListener('mousedown', function(e) {
e.preventDefault();
})
let activity = document.getElementById('execution-activity');
activity.addEventListener('mousedown', function(e) {
e.preventDefault();
})
$('#execution-speciality').prop('readonly', true)
$('#execution-plan_date').prop('readonly', true)
$('#execution-uid').prop('readonly', true);
$('#execution-msl_code').prop('readonly', true);
$('#execution-total').prop('readonly',true);
//$('#execution-time').prop('disabled', true)
let selected = JSON.parse($(this).attr('plan_details'));
@ -447,19 +447,7 @@
}
console.log("Selected Doctor:", selected['contact_id']);
if(selected['contact_id']==='others'){
$('#execution-other_doctor_name,#execution-other_speciality,#execution-other_msl_code').parent().show();
$('#execution-other_doctor_name,#execution-other_speciality,#execution-other_msl_code').prop({"required":true});
$('#execution-speciality,#execution-msl_code').parent().hide();
$('#execution-speciality,#execution-msl_code').prop({"required":false});
}
if(selected['contact_id']!='others'){
$('#execution-other_doctor_name,#execution-other_speciality,#execution-other_msl_code').parent().hide();
$('#execution-other_doctor_name,#execution-other_speciality,#execution-other_msl_code').prop({"required":false});
$('#execution-speciality,#execution-msl_code').parent().show();
$('#execution-speciality,#execution-msl_code').prop({"required":true});
}
for (let k of Object.keys(selected)) {
//console.log("k",k);
@ -486,10 +474,152 @@
$('#execution-contact_id').val(docid)
$('#execution-id').val(selected['id'])
$('#execution-no_of_flutter_utilized').closest('.col-md-12').after('<h4>Prescription Generated</h4>');
$('#execution-dpi,#execution-mdi,#execution-sync,#execution-cip').on('input', function() {
var total=(
(parseInt($('#execution-dpi').val()) ||0)+
(parseInt($('#execution-mdi').val()) ||0)+
(parseInt($('#execution-sync').val()) ||0)+
(parseInt($('#execution-cip').val()) ||0)
);
$('#execution-total').val(total);
$('#execution-no_of_flutter_utilized').on('keyup', function () {
let val = parseFloat($(this).val());
if ($(this).val() === '') {
return;
}
if (val < 0 || isNaN(val)) {
$(this).val(0);
}
});
})
})
$('.edit_plan-btn').click(function() {
$('#execution-form-wrapper').show(100, () => {
$('#add-camp-btn').hide(0);
})
$('#table-wrapper').hide()
$('#execution-execution_as_per_plan,#execution-execution_date,#execution-no_of_flutter_utilized,#execution-dpi,#execution-mdi,#execution-sync,#execution-cip,#execution-total').parent().hide();
$('#execution-execution_as_per_plan,#execution-execution_date,#execution-no_of_flutter_utilized,#execution-dpi,#execution-mdi,#execution-sync,#execution-cip,#execution-total').attr('required',false);
let selected = JSON.parse($(this).attr('plan_details'));
console.log("Plan Detail : ", selected);
if (selected['contact_id']) {
selected['contact_id'] = selected['contact_id'].trim();
}
console.log("Selected Doctor:", selected['contact_id']);
for (let k of Object.keys(selected)) {
//console.log("k",k);
if (selected[k] != '') {
if (k == 'contact_id') {
//$("#execution-contact_id option:contains(" + selected[k] + ")").prop('selected', true)
// console.log($("#execution-contact_id option:contains(" + selected[k] + ")").attr('value'))
$('#execution-contact_id').val($("#execution-contact_id option:contains(" +
selected[k] + ")").attr('value'));
} else if (k == 'upload_photo_1' || k == 'upload_photo_2') {
continue;
} else {
$('#execution-' + k).val(selected[k]);
}
}
// if(selected[k] != '')
// $('#execution-'+k).val(selected[k]);
}
let docid = $('#execution-contact_id option').map(function() {
if ($(this).text().trim() == selected['contact_id'] || $(this).val().trim() == selected['cont_id']) return this;
}).attr('value')
$('#execution-contact_id').val(docid)
$('#execution-id').val(selected['id'])
$('#execution-dpi,#execution-mdi,#execution-sync,#execution-cip').on('input', function() {
var total=(
(parseInt($('#execution-dpi').val()) ||0)+
(parseInt($('#execution-mdi').val()) ||0)+
(parseInt($('#execution-sync').val()) ||0)+
(parseInt($('#execution-cip').val()) ||0)
);
$('#execution-total').val(total);
$('#execution-no_of_flutter_utilized').on('keyup', function () {
let val = parseFloat($(this).val());
if ($(this).val() === '') {
return;
}
if (val < 0 || isNaN(val)) {
$(this).val(0);
}
});
})
$('#execution-contact_id').change(function() {
$('#execution-speciality').val($('option:selected', this).attr('speciality'))
})
$('#execution-contact_id').change(function() {
$('#execution-msl_code').val($('option:selected', this).attr('msl_code'))
})
$('#execution-contact_id').change(function() {
$('#execution-core_value').val($('option:selected', this).attr('core_value'))
})
$('#execution-msl_code').prop('readonly', true);
$('#execution-speciality').prop('readonly', true);
$('#execution-core_value').prop('readonly', true);
const monthNames = [
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
];
$('#execution-plan_date').on('change', function () {
const selectedDateVal = $(this).val(); // e.g. "2026-10-15"
if (selectedDateVal) {
// 'YYYY-MM-DD' split karun month extract karane (timezone issue yet nahi)
const parts = selectedDateVal.split('-');
const monthIndex = parseInt(parts[1], 10) - 1; // 0-based index (0 = January)
const monthName = monthNames[monthIndex];
// Dropdown madhe toh month select karne
$('#execution-month_of_engagement').val(monthName).trigger('change');
} else {
// Jar user ne date clear keli tar dropdown reset karne
$('#execution-month_of_engagement').val('').trigger('change');
}
});
})
$('#report-form').on('submit', function(event) {
@ -532,43 +662,43 @@
})
$('#field-contact_id').change(function() {
$('#field-core_value').val($('option:selected', this).attr('core_value'))
})
$('#field-msl_code').prop('readonly', true);
$('#field-speciality').prop('readonly', true);
$('#field-core_value').prop('readonly', true);
$('#field-other_doctor_name,#field-other_speciality,#field-other_msl_code').prop({"required":false});
$('#field-other_doctor_name,#field-other_speciality,#field-other_msl_code').parent().hide();
$('#field-contact_id').on('change',function(){
let dropDown=$('#field-contact_id').val();
if(dropDown==='others'){
$('#field-other_doctor_name,#field-other_speciality,#field-other_msl_code').parent().show();
$('#field-other_doctor_name,#field-other_speciality,#field-other_msl_code').prop({"required":true});
$('#field-speciality,#field-msl_code').parent().hide();
$('#field-speciality,#field-msl_code').prop({"required":false});
}
else{
$('#field-other_doctor_name,#field-other_speciality,#field-other_msl_code').parent().hide();
$('#field-other_doctor_name,#field-other_speciality,#field-other_msl_code').prop({"required":false});
$('#field-speciality,#field-msl_code').parent().show();
$('#field-speciality,#field-msl_code').prop({"required":true});
}
})
$(document).ready(function () {
const monthNames = [
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
];
//$('#field-contact_id').append('<option value="others">Others</option>');
$('#execution-sitazit_d_rx,#execution-sitazit_dm_rx,#execution-ziten_m_rx').on('input', function() {
var total=(
(parseInt($('#execution-sitazit_d_rx').val()) ||0)+
(parseInt($('#execution-sitazit_dm_rx').val()) ||0)+
(parseInt($('#execution-ziten_m_rx').val()) ||0)
);
$('#field-plan_date').on('change', function () {
const selectedDateVal = $(this).val(); // e.g. "2026-10-15"
$('#execution-total_camp_rx').val(total)
})
if (selectedDateVal) {
// 'YYYY-MM-DD' split karun month extract karane (timezone issue yet nahi)
const parts = selectedDateVal.split('-');
const monthIndex = parseInt(parts[1], 10) - 1; // 0-based index (0 = January)
const monthName = monthNames[monthIndex];
// Dropdown madhe toh month select karne
$('#field-month_of_engagement').val(monthName).trigger('change');
} else {
// Jar user ne date clear keli tar dropdown reset karne
$('#field-month_of_engagement').val('').trigger('change');
}
});
});
$(document).ready(function () {