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>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||||
|
|
@ -12,11 +13,7 @@
|
||||||
</div>
|
</div>
|
||||||
@php
|
@php
|
||||||
|
|
||||||
$history = Formhelper::getMultiformData(
|
$history = Formhelper::getMultiformData($form->partition,$form_id,$form->user_id);
|
||||||
$form->partition,
|
|
||||||
$form_id,
|
|
||||||
$form->user_id
|
|
||||||
);
|
|
||||||
|
|
||||||
$historyData = [];
|
$historyData = [];
|
||||||
|
|
||||||
|
|
@ -52,20 +49,18 @@ if(isset($history->data->submissions) && is_iterable($history->data->submissions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$historyData[] = [
|
$historyData[] = [
|
||||||
'submission_id' => $sub->id,
|
'submission_id' => $sub->id,
|
||||||
'date' => $recordDate,
|
'date' => $recordDate,
|
||||||
'doctor' => $doctorName,
|
'doctor' => $doctorName,
|
||||||
'status' => ucfirst($sub->workflow_status ?? ''),
|
'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">
|
<body class="loading">
|
||||||
<div class="account-pages">
|
<div class="account-pages">
|
||||||
<div class="container">
|
<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">
|
<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_id" value="{{$form_id}}">
|
||||||
<input type="hidden" name="form_info" id="form_info" value="">
|
<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
|
@csrf
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-7">
|
<div class="col-7">
|
||||||
|
|
@ -238,6 +236,14 @@ if(isset($history->data->submissions) && is_iterable($history->data->submissions
|
||||||
Download
|
Download
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
@elseif(strtolower($row['status']) == 'rejected')
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="btn btn-warning btn-sm edit-btn"
|
||||||
|
data-submission='@json($row["submission"])'>
|
||||||
|
Edit
|
||||||
|
</button>
|
||||||
|
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -267,6 +273,7 @@ if(isset($history->data->submissions) && is_iterable($history->data->submissions
|
||||||
<!-- end container -->
|
<!-- end container -->
|
||||||
</div>
|
</div>
|
||||||
<!-- end page -->
|
<!-- end page -->
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
#pageloader {
|
#pageloader {
|
||||||
background: rgba( 255, 255, 255, 0.8 );
|
background: rgba( 255, 255, 255, 0.8 );
|
||||||
|
|
@ -285,10 +292,15 @@ if(isset($history->data->submissions) && is_iterable($history->data->submissions
|
||||||
top: 50%;
|
top: 50%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@include('layouts.shared/footer-script')
|
@include('layouts.shared/footer-script')
|
||||||
|
|
||||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||||
|
|
||||||
<script src="{{asset('assets/libs/cropper/cropper.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 src="{{ URL::asset('assets/libs/dropify/dropify.min.js') }}"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
jQuery(document).ready(function($){
|
jQuery(document).ready(function($){
|
||||||
$('#history-wrapper').show();
|
$('#history-wrapper').show();
|
||||||
|
|
@ -297,6 +309,7 @@ if(isset($history->data->submissions) && is_iterable($history->data->submissions
|
||||||
$('#template-wrapper').hide();
|
$('#template-wrapper').hide();
|
||||||
|
|
||||||
$('#btnNewInvite').click(function(){
|
$('#btnNewInvite').click(function(){
|
||||||
|
$('#field-id').remove();
|
||||||
|
|
||||||
$(this).hide();
|
$(this).hide();
|
||||||
$('#history-wrapper').hide();
|
$('#history-wrapper').hide();
|
||||||
|
|
@ -361,6 +374,17 @@ if(isset($history->data->submissions) && is_iterable($history->data->submissions
|
||||||
|
|
||||||
$('#report-form').on('submit', function(event){
|
$('#report-form').on('submit', function(event){
|
||||||
event.preventDefault();
|
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();
|
$("#pageloader").fadeIn();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
|
|
@ -375,6 +399,8 @@ if(isset($history->data->submissions) && is_iterable($history->data->submissions
|
||||||
console.log(data)
|
console.log(data)
|
||||||
if(data.hasOwnProperty('images_fields') && data.images_fields.length > 0 ) {
|
if(data.hasOwnProperty('images_fields') && data.images_fields.length > 0 ) {
|
||||||
for(let im of data.images_fields) {
|
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))
|
let pos = data.form_info.positions.map(p => JSON.parse(p))
|
||||||
console.log(pos)
|
console.log(pos)
|
||||||
pos = pos.map(p => p.find(pi => pi.field_name == im ) )
|
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){
|
$('#image-form').on('submit', function(event){
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -450,6 +547,7 @@ if(isset($history->data->submissions) && is_iterable($history->data->submissions
|
||||||
contentType: false,
|
contentType: false,
|
||||||
|
|
||||||
success: function(data){
|
success: function(data){
|
||||||
|
console.log("Complete Response:", data);
|
||||||
|
|
||||||
$("#pageloader").fadeOut();
|
$("#pageloader").fadeOut();
|
||||||
|
|
||||||
|
|
@ -491,6 +589,7 @@ if(isset($history->data->submissions) && is_iterable($history->data->submissions
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
Loading…
Reference in New Issue