Titans : Edit option to TM if invite rejected
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m39s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m39s
Details
This commit is contained in:
parent
9ff1642022
commit
a2d3f88dd7
|
|
@ -1,4 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
|
|
@ -12,11 +13,7 @@
|
|||
</div>
|
||||
@php
|
||||
|
||||
$history = Formhelper::getMultiformData(
|
||||
$form->partition,
|
||||
$form_id,
|
||||
$form->user_id
|
||||
);
|
||||
$history = Formhelper::getMultiformData($form->partition,$form_id,$form->user_id);
|
||||
|
||||
$historyData = [];
|
||||
|
||||
|
|
@ -52,20 +49,18 @@ if(isset($history->data->submissions) && is_iterable($history->data->submissions
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
$historyData[] = [
|
||||
'submission_id' => $sub->id,
|
||||
'date' => $recordDate,
|
||||
'doctor' => $doctorName,
|
||||
'status' => ucfirst($sub->workflow_status ?? ''),
|
||||
];
|
||||
}
|
||||
}
|
||||
'submission' => $sub,
|
||||
|
||||
];}}
|
||||
|
||||
@endphp{{-- <pre>{{ print_r($history->data->submissions[0], true) }}</pre> --}}
|
||||
|
||||
@endphp
|
||||
{{-- <pre>
|
||||
{{ print_r($history->data->submissions[0], true) }}
|
||||
</pre> --}}
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
|
|
@ -108,6 +103,9 @@ if(isset($history->data->submissions) && is_iterable($history->data->submissions
|
|||
<form method="POST" action="/form/submitpersonalized" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
<input type="hidden" name="form_info" id="form_info" value="">
|
||||
@if(isset($id) && $id)
|
||||
<input type="hidden" name="id" id="field-id" value="{{ $id }}">
|
||||
@endif
|
||||
@csrf
|
||||
<div class="row">
|
||||
<div class="col-7">
|
||||
|
|
@ -238,6 +236,14 @@ if(isset($history->data->submissions) && is_iterable($history->data->submissions
|
|||
Download
|
||||
</a>
|
||||
|
||||
@elseif(strtolower($row['status']) == 'rejected')
|
||||
|
||||
<button
|
||||
class="btn btn-warning btn-sm edit-btn"
|
||||
data-submission='@json($row["submission"])'>
|
||||
Edit
|
||||
</button>
|
||||
|
||||
@endif
|
||||
|
||||
</td>
|
||||
|
|
@ -267,6 +273,7 @@ if(isset($history->data->submissions) && is_iterable($history->data->submissions
|
|||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
|
||||
<style type="text/css">
|
||||
#pageloader {
|
||||
background: rgba( 255, 255, 255, 0.8 );
|
||||
|
|
@ -285,10 +292,15 @@ if(isset($history->data->submissions) && is_iterable($history->data->submissions
|
|||
top: 50%;
|
||||
}
|
||||
</style>
|
||||
|
||||
@include('layouts.shared/footer-script')
|
||||
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
|
||||
<script src="{{asset('assets/libs/cropper/cropper.min.js')}}"></script>
|
||||
|
||||
<script src="{{ URL::asset('assets/libs/dropify/dropify.min.js') }}"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#history-wrapper').show();
|
||||
|
|
@ -297,6 +309,7 @@ if(isset($history->data->submissions) && is_iterable($history->data->submissions
|
|||
$('#template-wrapper').hide();
|
||||
|
||||
$('#btnNewInvite').click(function(){
|
||||
$('#field-id').remove();
|
||||
|
||||
$(this).hide();
|
||||
$('#history-wrapper').hide();
|
||||
|
|
@ -361,6 +374,17 @@ if(isset($history->data->submissions) && is_iterable($history->data->submissions
|
|||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
let formData = new FormData($('#report-form')[0]);
|
||||
|
||||
if ($('#field-id').val() == '') {
|
||||
formData.delete('id'); // New submission
|
||||
}
|
||||
console.log("===== Submitted Data =====");
|
||||
|
||||
for (let pair of formData.entries()) {
|
||||
console.log(pair[0] + " : ", pair[1]);
|
||||
}
|
||||
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
|
|
@ -375,6 +399,8 @@ if(isset($history->data->submissions) && is_iterable($history->data->submissions
|
|||
console.log(data)
|
||||
if(data.hasOwnProperty('images_fields') && data.images_fields.length > 0 ) {
|
||||
for(let im of data.images_fields) {
|
||||
console.log("Image Field:", im);
|
||||
console.log("Image URL:", data[im]);
|
||||
let pos = data.form_info.positions.map(p => JSON.parse(p))
|
||||
console.log(pos)
|
||||
pos = pos.map(p => p.find(pi => pi.field_name == im ) )
|
||||
|
|
@ -430,6 +456,77 @@ if(isset($history->data->submissions) && is_iterable($history->data->submissions
|
|||
// },
|
||||
// });
|
||||
// });
|
||||
$(document).on('click', '.edit-btn', function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
let submission = JSON.parse($(this).attr('data-submission'));
|
||||
let data = submission.formdata;
|
||||
let personalize = data.form_info;
|
||||
if ($('#field-id').length == 0) {
|
||||
$('#report-form').append('<input type="hidden" name="id" id="field-id">');
|
||||
}
|
||||
// Save id
|
||||
$('#field-id').val(submission.id);
|
||||
|
||||
// Save form info
|
||||
$('#form_info').val(JSON.stringify(personalize));
|
||||
|
||||
// Hide/Show sections
|
||||
$('#btnNewInvite').hide();
|
||||
$('#history-wrapper').hide();
|
||||
$('#template-wrapper').hide();
|
||||
$('#form-wrapper').show();
|
||||
|
||||
// Show template
|
||||
$('#wrapper-template_id img').attr('src', personalize.icon);
|
||||
|
||||
// Hide all questions
|
||||
$('.question-wrapper').hide();
|
||||
|
||||
$('#report-form .question-wrapper').each(function () {
|
||||
$(this).find('.req-star').hide();
|
||||
$(this).find(':input').removeAttr('required');
|
||||
});
|
||||
|
||||
// Show only template questions
|
||||
for (let que of personalize.questions) {
|
||||
|
||||
let $w = $('#wrapper-' + que);
|
||||
|
||||
$w.show();
|
||||
|
||||
$w.find('.req-star').show();
|
||||
|
||||
$w.find('input:not([type="hidden"]):not([type="checkbox"]), textarea, select')
|
||||
.attr('required', 'required');
|
||||
}
|
||||
|
||||
// Fill values
|
||||
$.each(data, function (key, value) {
|
||||
|
||||
let $field = $('#field-' + key);
|
||||
|
||||
if ($field.length) {
|
||||
|
||||
if ($field.is(':checkbox')) {
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach(function (v) {
|
||||
$('#field-' + key + '-' + v).prop('checked', true);
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$field.val(value);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
$('#image-form').on('submit', function(event){
|
||||
|
||||
event.preventDefault();
|
||||
|
|
@ -450,6 +547,7 @@ if(isset($history->data->submissions) && is_iterable($history->data->submissions
|
|||
contentType: false,
|
||||
|
||||
success: function(data){
|
||||
console.log("Complete Response:", data);
|
||||
|
||||
$("#pageloader").fadeOut();
|
||||
|
||||
|
|
@ -491,6 +589,7 @@ if(isset($history->data->submissions) && is_iterable($history->data->submissions
|
|||
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Loading…
Reference in New Issue