Demo (Plan vs exe)

This commit is contained in:
zeeshan 2026-07-03 13:03:35 +05:30
parent 6a27d82eb3
commit 22614cb3c0
1 changed files with 124 additions and 12 deletions

View File

@ -48,6 +48,12 @@
$form->form_id,
$form->user_id,
);
/* echo "<pre>";
print_r($history);
echo "</pre>"; */
@endphp
@ -83,14 +89,31 @@
@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> Execute</button>
@endif
</td>
@if(isset($sub->formdata->execution_done) && $sub->formdata->execution_done == 'yes') Execution Done @endif
@if(isset($sub->workflow_status) && $sub->workflow_status == 'approved')
<button type="button" class="btn btn-xs btn-info edit-btn"
plan_details="{{ json_encode($sub->formdata) }}">
<i class="mdi mdi-pencil"></i> Execute
</button>
@elseif(isset($sub->workflow_status) && $sub->workflow_status == 'rejected')
<button type="button" class="btn btn-xs btn-info edit-plan"
plan_details="{{ json_encode($sub->formdata) }}">
<i class="mdi mdi-pencil"></i> Edit Plan
</button>
@else
@endif
</td>
<td>{{$sub->formdata->record_date}} </td>
<td>{{ $sub->formdata->plan_date }}</td>
<td>{{ isset($sub->formdata->execution_done) && $sub->formdata->execution_done == 'yes' ? 'Yes' : 'No' }}
@ -242,7 +265,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 }}"
@ -285,10 +308,24 @@
{{ $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' : '' }}>
{{ $option->display }}
</option>
@if($question->code=='contact_id')
@php $spec = $option->contact->speciality ?? ''; @endphp
@if (in_array($spec, ['CONSULTING PHYSICIAN', 'CARDIOLOGIST', 'GENERAL PHYSICIAN', 'ORTHOPEDIC', 'CHEST PHYSICIAN', 'DERMATOLOGIST','COSMETOLOGIST','ENT','ANESTHESIOLOGIST','SURGEON','CARDIOLOGIST','GP NON MBBS']))
<option value="{{ $option->value }}"
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}
msl_code="{{ $option->contact->msl_code ?? '' }}"
speciality="{{ $spec }}">
{{ $option->display }}
</option>
@endif
@else
<option value="{{ $option->value }}"
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}
msl_code="{{ $option->contact->msl_code ?? '' }}"
speciality="{{ $spec }}">
{{ $option->display }}
</option>
@endif
@endforeach
</select>
@break
@ -442,9 +479,84 @@
$('#execution-contact_id').val(docid)
$('#execution-id').val(selected['id'])
$('#execution-form').append('<input type="hidden" name="execution_done" value="yes" />');
})
$('.edit-plan').click(function() {
$('#execution-form-wrapper').show(100, () => {
$('#add-camp-btn').hide(0);
})
$('#table-wrapper').hide()
//$('#execution-contact_id').prop('disabled', true)
/* let contact = document.getElementById('execution-contact_id');
contact.addEventListener('mousedown', function(e) {
e.preventDefault();
})
let brand = document.getElementById('execution-select_brand');
brand.addEventListener('mousedown', function(e) {
e.preventDefault();
})
let activation = document.getElementById('execution-select_activation_type');
activation.addEventListener('mousedown', function(e) {
e.preventDefault();
}) */
// $('#execution-activity_type').prop('readonly', true)
$('#execution-speciality').prop('readonly', true)
//$('#execution-record_date').prop('readonly', true)
$('#execution-msl_code').prop('readonly', true);
//$('#execution-time').prop('disabled', true)
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']) return this;
}).attr('value')
console.log("docid : ",docid);
$('#execution-contact_id').val(docid)
$('#execution-id').val(selected['id'])
$('#execution-execution_date,#execution-no_of_participants').parent().hide();
$('#execution-execution_date,#execution-no_of_participants').attr('required',false);
$('#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'))
})
})