update_10.09.23

This commit is contained in:
NW
2023-09-21 15:01:58 +01:00
parent 4a9c23c4ea
commit 98a7d01134
24 changed files with 3084 additions and 14153 deletions

View File

@@ -1,75 +1,79 @@
@extends('layouts.app')
@section('css')
<style type="text/css">
.no-print {
display: block;
}
@media screen {
#printSection {
display: none;
}
}
@media print {
body * {
visibility:hidden;
}
#printSection, #printSection * {
visibility:visible;
}
#printSection {
position:absolute;
left:0;
top:0;
}
<style type="text/css">
.no-print {
display: none;
display: block;
}
}
</style>
@media screen {
#printSection {
display: none;
}
}
@media print {
body * {
visibility: hidden;
}
#printSection, #printSection * {
visibility: visible;
}
#printSection {
position: absolute;
left: 0;
top: 0;
}
.no-print {
display: none;
}
}
</style>
@endsection
@section('content')
<div class="container-fluid">
<div class="row justify-content-center no-print">
<div class="col-md-12">
@php
$date_format = config('constants.APP_DATE_FORMAT');
if (config('constants.APP_TIME_FORMAT') == '12') {
$date_format .= ' h:i A';
} else if (config('constants.APP_TIME_FORMAT') == '24') {
$date_format .= ' H:i';
} else {
$date_format = 'm/d/Y h:i A';
}
@endphp
<div class="card">
<div class="card-header">
{{$form->name}}
</div>
<div class="container-fluid">
<div class="row justify-content-center no-print">
<div class="col-md-12">
@php
$is_enabled_sub_ref_no = false;
if(isset($form->schema['settings']['form_submision_ref']['is_enabled']) && $form->schema['settings']['form_submision_ref']['is_enabled']) {
$is_enabled_sub_ref_no = true;
$date_format = config('constants.APP_DATE_FORMAT');
if (config('constants.APP_TIME_FORMAT') == '12') {
$date_format .= ' h:i A';
} else if (config('constants.APP_TIME_FORMAT') == '24') {
$date_format .= ' H:i';
} else {
$date_format = 'm/d/Y h:i A';
}
@endphp
<div class="tab-content card-body table-responsive" role="tabpanel">
@if(!empty($form->schema))
@php
$schema = $form->schema['form'];
$col_visible = $form['schema']['settings']['form_data']['col_visible'];
$btn_enabled = $form['schema']['settings']['form_data']['btn_enabled'];
@endphp
<table class="table" id="submitted_data_table" style="width: 100%;">
<thead>
<div class="card">
<div class="card-header">
{{$form->name}}
</div>
@php
$is_enabled_sub_ref_no = false;
if(isset($form->schema['settings']['form_submision_ref']['is_enabled']) && $form->schema['settings']['form_submision_ref']['is_enabled']) {
$is_enabled_sub_ref_no = true;
}
@endphp
<div class="tab-content card-body table-responsive" role="tabpanel">
@if(!empty($form->schema))
@php
$schema = $form->schema['form'];
$col_visible = $form['schema']['settings']['form_data']['col_visible'];
$btn_enabled = $form['schema']['settings']['form_data']['btn_enabled'];
@endphp
<table class="table" id="submitted_data_table" style="width: 100%;">
<thead>
<tr>
<th>@lang('messages.action')</th>
@if($is_enabled_sub_ref_no)
<th>@lang('messages.submission_numbering')</th>
@endif
@if(auth()->user()->show_form_response_user)
<th>@lang('messages.username')</th>
@endif
@foreach($schema as $element)
@if(in_array($element['name'], $col_visible))
<th>
@@ -79,32 +83,32 @@
@endforeach
<th>@lang('messages.submitted_on')</th>
</tr>
</thead>
</thead>
<tbody>
<tbody>
@foreach($data as $k => $row)
<tr>
<td>
@if(in_array('view', $btn_enabled))
<button type="button" class="btn btn-info btn-sm view_form_data m-1" data-href="{{action([\App\Http\Controllers\FormDataController::class, 'viewData'], [$row->id])}}" data-toggle="modal">
<button type="button" class="btn btn-info btn-sm view_form_data m-1"
data-href="{{action([\App\Http\Controllers\FormDataController::class, 'viewData'], [$row->id])}}"
data-toggle="modal">
<i class="fa fa-eye" aria-hidden="true"></i>
@lang('messages.view')
</button>
@endif
@if(in_array('delete', $btn_enabled))
<button type="button" class="btn btn-danger btn-sm delete_form_data m-1" data-href="{{action([\App\Http\Controllers\FormDataController::class, 'destroy'], [$row->id])}}">
<button type="button" class="btn btn-danger btn-sm delete_form_data m-1"
data-href="{{action([\App\Http\Controllers\FormDataController::class, 'destroy'], [$row->id])}}">
<i class="fa fa-trash" aria-hidden="true"></i>
@lang('messages.delete')
</button>
@endif
<a class="btn btn-primary btn-sm m-1" target="_blank" href="{{action([\App\Http\Controllers\FormDataController::class, 'downloadPdf'], [$row->id])}}">
<i class="far fa-file-pdf" aria-hidden="true"></i>
@lang('messages.download_pdf')
</a>
@php
$form_id = !empty($form->slug) ? $form->slug : $form->id;
@endphp
<a class="btn btn-dark btn-sm m-1" target="_blank" href="{{action([\App\Http\Controllers\FormDataController::class, 'getEditformData'], ['slug' => $form_id,'id' => $row->id])}}">
<a class="btn btn-dark btn-sm m-1" target="_blank"
href="{{action([\App\Http\Controllers\FormDataController::class, 'getEditformData'], ['slug' => $form_id,'id' => $row->id])}}">
<i class="far fa-edit" aria-hidden="true"></i>
@lang('messages.edit')
</a>
@@ -114,18 +118,25 @@
{{$row['submission_ref']}}
</td>
@endif
@if(auth()->user()->show_form_response_user)
<td>{{ $row->submittedBy?->name }}</td>
@endif
@foreach($schema as $row_element)
@if(in_array($row_element['name'], $col_visible))
<td>
@isset($row->data[$row_element['name']])
@if($row_element['type'] == 'file_upload')
@include('form_data.file_view', ['form_upload' => $row->data[$row_element['name']]])
@include('form_data.file_view', ['form_upload' => $row->data[$row_element['name']]])
@elseif($row_element['type'] == 'signature')
@if(!empty($row->data[$row_element['name']]))
<a target="_blank" href="{{$row->data[$row_element['name']]}}"
download="Signature">
<img src="{{$row->data[$row_element['name']]}}" class="signature">
<a target="_blank"
href="{{$row->data[$row_element['name']]}}"
download="Signature">
<img src="{{$row->data[$row_element['name']]}}"
class="signature">
</a>
@endif
@elseif(is_array($row->data[$row_element['name']]) && $row_element['type'] != 'file_upload')
@@ -133,7 +144,7 @@
@else
{!! nl2br($row->data[$row_element['name']]) !!}
@endif
@endisset
</td>
@endif
@@ -147,121 +158,121 @@
</td>
</tr>
@endforeach
</tbody>
</table>
@else
<p>Form Not found</p>
@endif
</div>
</div>
</tbody>
</table>
@else
<p>Form Not found</p>
@endif
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@section('footer')
<script type="text/javascript">
$(document).ready(function(){
$('#submitted_data_table').DataTable({
scrollY: "600px",
scrollX: true,
scrollCollapse: true,
paging: true,
fixedColumns: {
leftColumns: 2
}
});
// view form data
$(document).on('click', '.view_form_data', function(){
var url = $(this).data("href");
$.ajax({
method: "GET",
dataType: "html",
url: url,
success: function(result){
$("#modal_div").html(result).modal("show");
<script type="text/javascript">
$(document).ready(function () {
$('#submitted_data_table').DataTable({
scrollY: "600px",
scrollX: true,
scrollCollapse: true,
paging: true,
fixedColumns: {
leftColumns: 2
}
});
});
//delete form data
$(document).on('click', '.delete_form_data', function(){
var url = $(this).data("href");
var result = confirm('Are You Sure?');
if (result == true) {
// view form data
$(document).on('click', '.view_form_data', function () {
var url = $(this).data("href");
$.ajax({
method: "DELETE",
method: "GET",
dataType: "html",
url: url,
dataType: "json",
success: function(result){
if(result.success == true){
toastr.success(result.msg);
setTimeout(function(){
location.reload();
}, 1000);
} else {
toastr.error(result.msg);
}
success: function (result) {
$("#modal_div").html(result).modal("show");
}
});
}
});
});
//print form data on btn click
$(document).on('click', '.formDataPrintBtn', function() {
printElement(document.getElementById("print_form_data"));
});
$("#modal_div").on('shown.bs.modal', function () {
if ($("form#add_comment_form").length) {
$("form#add_comment_form").validate();
}
});
$(document).on('submit', 'form#add_comment_form', function (e) {
e.preventDefault();
var data = $("form#add_comment_form").serialize();
var url = $("form#add_comment_form").attr('action');
var ladda = Ladda.create(document.querySelector('.add_comment_btn'));
ladda.start();
$.ajax({
method: "POST",
url: url,
dataType: "json",
data: data,
success: function (response) {
ladda.stop();
if (response.success) {
$("#comment").val('');
$('.direct-chat-messages').prepend(response.comment);
toastr.success(response.msg);
} else {
toastr.error(response.msg);
}
//delete form data
$(document).on('click', '.delete_form_data', function () {
var url = $(this).data("href");
var result = confirm('Are You Sure?');
if (result == true) {
$.ajax({
method: "DELETE",
url: url,
dataType: "json",
success: function (result) {
if (result.success == true) {
toastr.success(result.msg);
setTimeout(function () {
location.reload();
}, 1000);
} else {
toastr.error(result.msg);
}
}
});
}
});
});
$(document).on('click', '.delete-comment', function(e) {
e.preventDefault();
var element = $(this);
var comment_id = $(this).data('comment_id');
var form_data_id = $(this).data('form_data_id');
if (confirm('Are you sure.?')) {
//print form data on btn click
$(document).on('click', '.formDataPrintBtn', function () {
printElement(document.getElementById("print_form_data"));
});
$("#modal_div").on('shown.bs.modal', function () {
if ($("form#add_comment_form").length) {
$("form#add_comment_form").validate();
}
});
$(document).on('submit', 'form#add_comment_form', function (e) {
e.preventDefault();
var data = $("form#add_comment_form").serialize();
var url = $("form#add_comment_form").attr('action');
var ladda = Ladda.create(document.querySelector('.add_comment_btn'));
ladda.start();
$.ajax({
method:'DELETE',
dataType: 'json',
url: '/form-data-comment/'+comment_id+'?form_data_id='+form_data_id,
success: function(response){
method: "POST",
url: url,
dataType: "json",
data: data,
success: function (response) {
ladda.stop();
if (response.success) {
$("#comment").val('');
$('.direct-chat-messages').prepend(response.comment);
toastr.success(response.msg);
element.closest('.direct-chat-msg').remove();
} else {
toastr.error(response.msg);
}
}
});
}
});
$(document).on('click', '.delete-comment', function (e) {
e.preventDefault();
var element = $(this);
var comment_id = $(this).data('comment_id');
var form_data_id = $(this).data('form_data_id');
if (confirm('Are you sure.?')) {
$.ajax({
method: 'DELETE',
dataType: 'json',
url: '/form-data-comment/' + comment_id + '?form_data_id=' + form_data_id,
success: function (response) {
if (response.success) {
toastr.success(response.msg);
element.closest('.direct-chat-msg').remove();
} else {
toastr.error(response.msg);
}
}
});
}
});
});
});
</script>
@endsection
</script>
@endsection

View File

@@ -71,7 +71,7 @@
</li>
@endif
<li class="nav-item">
<a class="nav-link
<a class="nav-link
@if(!auth()->user()->can('superadmin') && !Auth::user()->can_create_form)
active
@endif
@@ -137,7 +137,6 @@
<tr>
<th>@lang('messages.name')</th>
<th>@lang('messages.description')</th>
<th>@lang('messages.created_by')</th>
<th>@lang('messages.action')</th>
</tr>
</thead>
@@ -215,7 +214,7 @@
if(result.success == true){
toastr.success(result.msg);
form_table.ajax.reload();
} else {
} else {
toastr.error(result.msg);
}
}
@@ -236,7 +235,7 @@
if(result.success == true){
toastr.success(result.msg);
template_table.ajax.reload();
} else {
} else {
toastr.error(result.msg);
}
}
@@ -295,13 +294,11 @@
"columnDefs": [
{ "width": "25%", "targets": 0 },
{ "width": "40%", "targets": 1 },
{ "width": "15%", "targets": 2 },
{ "width": "20%", "targets": 3 }
{ "width": "20%", "targets": 2 }
],
columns: [
{ data: 'name' , name: 'forms.name'},
{ data: 'description' , name: 'forms.description'},
{ data: 'created_by' , name: 'users.name', sortable:false},
{ data: 'action', name: 'action', sortable:false }
]
});
@@ -393,4 +390,4 @@
@endif
});
</script>
@endsection
@endsection

View File

@@ -40,7 +40,7 @@
<script src="{{asset('/plugins/countdowntimer/countdowntimer.min.js').'?v='.$asset_version}}"></script>
@if(!$is_download)
<!-- app js values -->
<script type="application/javascript">
var APP = {};
@@ -69,7 +69,7 @@
function printElement(elem) {
var domClone = elem.cloneNode(true);
var printSection = document.getElementById("printSection");
if (!printSection) {
var printSection = document.createElement("div");
printSection.id = "printSection";
@@ -129,7 +129,7 @@
toastr.error("{{ __('messages.some_error_in_input_field') }}");
}
});
$(document).ready(function(){
@if(!$is_download)
jQuery.extend($.fn.dataTable.defaults, {
@@ -138,34 +138,7 @@
[25, 50, 100, 200, 500, 1000, -1], [25, 50, 100, 200, 500, 1000, "{{__('messages.all')}}"]
],
iDisplayLength: 25,
dom: 'lBfrtip',
buttons: [
{
extend: 'copy',
text: "{{__('messages.copy')}}",
exportOptions: {
columns: ':visible',
}
},
{
extend: 'excel',
text: "{{__('messages.excel')}}",
exportOptions: {
columns: ':visible',
}
},
{
extend: 'csv',
text: "{{__('messages.csv')}}",
exportOptions: {
columns: ':visible',
}
},
{
extend: 'colvis',
text: "{{__('messages.column_visibility')}}",
},
],
dom: 'lfrtip',
"language": {
"emptyTable": "{{__('messages.emptyTable')}}",
"info": "{{__('messages.dt_info')}}",
@@ -269,10 +242,10 @@
},
});
}
Dropzone.autoDiscover = false;
function initialize_dropzone(element_name, file_upload_msg, no_of_files_can_be_uploaded, max_file_size, allowed_file_type, url = null) {
var file_remove_url = "library/delete_file.php";
if (url == null) {
url = "{{ url('/file-upload')}}";
@@ -333,11 +306,11 @@
if(result.success == 1){
toastr.success(result.msg);
var index = file_names.indexOf(file.uploaded_as);
if(index!=-1){
file_names.splice(index, 1);
}
var elementVal = $('input#'+element_name).val();
var oldVal = elementVal.split(",");
@@ -373,12 +346,12 @@
}
function initialize_text_editor(element_name, placeholder, height) {
$('#'+element_name).summernote({
placeholder: placeholder,
height: height
});
}
}
function initialize_star_rating(element_name) {
$("#"+element_name).rating({
@@ -415,18 +388,18 @@
var signaturePad = element;
var canvas = document.getElementById(element);
signaturePad = new SignaturePad(canvas, {
onEnd: function(event) {
onEnd: function(event) {
var element = $(this)[0]._canvas.id
var signature = $(this)[0].toDataURL();
$('#output_'+element).val(signature);
}
});
if ($('#output_'+element).val().length > 0) {
signaturePad.fromDataURL($('#output_'+element).val());
}
$(document).on('click', '#clear_'+element, function() {
signaturePad.clear();
$('#output_'+$(this).data('name')).val('');
@@ -476,5 +449,5 @@
@if(!$is_download && !isset($nav))
@if(!empty($__additional_js))
{!!$__additional_js!!}
@endif
@endif
@endif
@endif

View File

@@ -21,7 +21,7 @@
<input type="text" class="form-control"
name="name" id="name" required>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
@@ -32,7 +32,7 @@
<input type="email" class="form-control"
name="email" id="email" required>
</div>
</div>
</div>
</div>
<div class="row">
@@ -45,7 +45,7 @@
<input type="password" class="form-control"
name="password" id="password" required>
</div>
</div>
</div>
</div>
<div class="row">
@@ -76,6 +76,25 @@
</label>
</div>
</div>
<div class="col-md-4">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" name="show_form_response_user" id="show_form_response_user" value="1">
<label class="form-check-label" for="show_form_response_user">
@lang('messages.show_form_response_user')
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.show_form_response_user_tooltip')"></i>
</label>
</div>
</div>
<div class="col-md-4">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" name="show_edit_buttons_form" id="show_edit_buttons_form" value="1">
<label class="form-check-label" for="show_edit_buttons_form">
@lang('messages.show_edit_buttons_form')
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.show_edit_buttons_form_tooltip')"></i>
</label>
</div>
</div>
</div>
<div class="card assign-form p-3">
<div class="row">
@@ -95,7 +114,7 @@
</div>
</div>
<h5>@lang('messages.permission_for_forms'):</h5>
<div class="row">
<div class="row">
<div class="col-md-4">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" name="permissions[]" id="form_design" value="can_design_form">
@@ -136,4 +155,4 @@
</div>
</div>
</form>
</div>
</div>

View File

@@ -22,7 +22,7 @@
<input type="text" class="form-control"
name="name" id="name" value="{{$user->name}}" required>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
@@ -33,7 +33,7 @@
<input type="email" class="form-control"
name="email" id="email" value="{{$user->email}}" required>
</div>
</div>
</div>
</div>
<div class="row">
@@ -47,7 +47,7 @@
<small id="passwordHelp" class="form-text text-muted">
@lang('messages.dont_want_to_change_keep_it_blank')
</small>
</div>
</div>
</div>
</div>
<div class="row">
@@ -78,6 +78,25 @@
</label>
</div>
</div>
<div class="col-md-4">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" name="show_form_response_user" id="show_form_response_user" value="1" @if($user->show_form_response_user) checked @endif>
<label class="form-check-label" for="show_form_response_user">
@lang('messages.show_form_response_user')
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.show_form_response_user_tooltip')"></i>
</label>
</div>
</div>
<div class="col-md-4">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" name="show_edit_buttons_form" id="show_edit_buttons_form" value="1" @if($user->show_edit_buttons_form) checked @endif>
<label class="form-check-label" for="show_edit_buttons_form">
@lang('messages.show_edit_buttons_form')
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.show_edit_buttons_form_tooltip')"></i>
</label>
</div>
</div>
</div>
@if(auth()->user()->id != $user->id)
@php
@@ -91,7 +110,7 @@
<i class="fab fa-wpforms"></i>
{{$assigned_form->form->name}}
</label>
<div class="row">
<div class="row">
<input type="hidden" name="edit_assigned_form_id[]" value="{{$assigned_form->id}}">
<div class="col-md-4">
<div class="form-group form-check">
@@ -194,4 +213,4 @@
</div>
</div>
</form>
</div>
</div>