Compare commits

...

2 Commits

Author SHA1 Message Date
Ravi Gulhane 6f185a8835 List Changes
Specific Folder FTP Upload / ftp-deploy (push) Successful in 38s Details
2026-08-14 13:51:33 +05:30
Ravi Gulhane 44a531ffaf List Changes 2026-08-14 13:50:17 +05:30
3 changed files with 331 additions and 313 deletions

View File

@ -70,12 +70,9 @@
@if(isset($formdata) && isset($formdata->workflow) && $formdata->workflow == 'yes' )
<th data-priority="1">Workflow Status</th>
@endif
@if(isset($form) && isset($form->show_position) && $form->show_position == 'yes' )
<th data-priority="1">Territory</th>
<th data-priority="1">Area</th>
<th data-priority="1">Region</th>
<th data-priority="1">Zone</th>
@endif
@foreach(($positionColumns ?? []) as $positionField)
<th data-priority="1">{{ ucfirst($positionField) }}</th>
@endforeach
@if(isset($form) && isset($form->show_manager_details) && $form->show_manager_details == 'yes' )
<th data-priority="1">L1 Manager</th>
<th data-priority="1">L1 Employee Code</th>
@ -232,12 +229,9 @@
@if(isset($formdata) && isset($formdata->workflow) && $formdata->workflow == 'yes' )
{ "data": "workflow_status" },
@endif
@if(isset($form) && isset($form->show_position) && $form->show_position == 'yes')
{ "data": "territory" },
{ "data": "area" },
{ "data": "region" },
{ "data": "zone" },
@endif
@foreach(($positionColumns ?? []) as $positionField)
{ "data": "{{ $positionField }}" },
@endforeach
@if(isset($form) && isset($form->show_manager_details) && $form->show_manager_details == 'yes')
{ "data": "manager1_name" },
{ "data": "manager1_code" },
@ -460,10 +454,10 @@
partition: '{{ $formdata->partition ?? '' }}',
limit: 50
};
params['user_id'] = '{{ $formdata->user_id ?? '' }}';
@if(isset($formdata->all_data_access) && $formdata->all_data_access == 1)
params['alldata'] = 1;
@else
params['user_id'] = '{{ $formdata->user_id ?? '' }}';
params['team_report'] = 1;
@endif

View File

@ -1,296 +1,308 @@
<!DOCTYPE html>
<html lang="en">
<head>
@include('layouts.shared/title-meta', ['title' => "Form"])
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
<link href="{{ URL::asset('assets/libs/cropper/cropper.min.css')}}" rel="stylesheet" type="text/css" />
<link href="{{ URL::asset('assets/libs/dropify/dropify.min.css') }}" rel="stylesheet" type="text/css" />
</head>
<div id="pageloader">
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
</div>
<body class="loading">
<div class="account-pages">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
<div class="card bg-pattern">
<div class="card-body p-3 row">
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
<br>@endif
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
</div>
<br>@endif
<div class="col-8">
<h4 class="page-title">{{$form->title}}</h4>
</div>
<div id="template-wrapper" class="row">
<h5>Select any one of the templates</h5>
@foreach($personalizations as $pers)
<div class="col-6 col-md-4 mt-3">
<img src="{{$pers->icon}}" class="img-fluid" persdata='{!! json_encode($pers) !!}'><br />
<span>{{$pers->title}}</span>
</div>
@endforeach
</div>
<div id="form-wrapper">
<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="">
@csrf
<div class="row">
<div class="col-7">
<label for="field-template_id" class="form-label"> Selected Template </label>
</div>
<div class="col-4 mb-2" id="wrapper-template_id">
<img src="" class="img-thumbnail" style="max-height:150px">
</div>
<br class="clearfix" />
@foreach($questions as $question)
<div class="col-md-12 mb-2 question-wrapper" id="wrapper-{{$question->id}}">
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} <span class="req-star text-danger" style="display:none" aria-hidden="true">*</span> </label>
@switch($question->type)
@case('hidden')
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
@break
@case('text')
@case('email')
@case('tel')
@case('date')
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="{{isset($question->value)?$question->value:''}}" maxlength={{ isset($question->code) ? ($question->code == 'message_body' ? '220' : '') : '' }}>
@break
@case('number')
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="{{isset($question->value)?$question->value:0}}">
@break
@case('textarea')
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" >{{isset($question->value)?$question->value:''}}</textarea>
@break
@case('dropdown')
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" >
<option value=""> -- Select -- </option>
@foreach($question->options as $option)
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
@endforeach
</select>
@break
@case('checkbox')
@foreach($question->options as $option)
<div class="form-check mb-2 form-check-primary">
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
</div>
@endforeach
@break
@case('file')
<input type="file" name="{{$question->code}}" class="dropify"
data-allowed-file-extensions="png jpg jpeg" />
<p class="text-muted text-center mt-2 mb-0">500MB Max File size</p>
@break
@case('multitextbox')
<div class="row">
@foreach($question->options as $option)
<div class="col-6">{{$option->display}}</div>
<div class="col-6 mb-1">
<input type="text" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" value="{{isset($option->val)?$option->val:''}}">
</div>
@endforeach
</div>
@break
@endswitch
</div>
@endforeach
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
<div class="text-center d-grid mt-3">
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
</div>
@endif
</div>
</form>
</div>
<div id="cropper-wrapper">
<form method="POST" action="/form/submitpersonalizedimages" id="image-form" enctype="multipart/form-data">
<input type="hidden" name="form_id" value="{{$form_id}}">
@csrf
<div class="row">
<div class="col-12 img-container">
</div>
<div class="col-12 mt-1">
<button class="btn btn-primary" id="cropandgo">Use Image and download</button>
</div>
</div>
</form>
</div>
</div> <!-- end card-body -->
</div>
<!-- end card -->
<!-- end row -->
</div> <!-- end col -->
</div>
<!-- end row -->
</div>
<!-- end container -->
</div>
<!-- end page -->
<style type="text/css">
#pageloader {
background: rgba( 255, 255, 255, 0.8 );
display: none;
height: 100%;
position: fixed;
width: 100%;
z-index: 9999;
}
#pageloader img {
left: 50%;
margin-left: -32px;
margin-top: -32px;
position: absolute;
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($){
$('#form-wrapper').hide()
$('#cropper-wrapper').hide()
$('#template-wrapper .img-fluid').click(function(){
$('#form_info').val( $(this).attr('persdata') )
console.log($(this).attr('persdata'))
let personalize = JSON.parse( $(this).attr('persdata') )
$('.question-wrapper').hide()
$('#report-form .question-wrapper').each(function () {
$(this).find('.req-star').hide()
$(this).find(':input').removeAttr('required')
})
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')
}
$('#report-form :input').removeAttr('readonly')
$('#wrapper-template_id img').attr('src', personalize.icon)
$('#template-wrapper').hide()
$('#form-wrapper').show()
// $('.dropify').unbind()
// $('.dropify').dropify({
// messages: {
// 'default': 'Drag and drop a file here or click',
// 'replace': 'Drag and drop or click to replace',
// 'remove': 'Remove',
// 'error': 'Ooops, something wrong appended.'
// },
// error: {
// 'fileSize': 'The file size is too big (500MB max).'
// }
// });
})
$('.dropify').dropify({
messages: {
'default': 'Drag and drop a file here or click',
'replace': 'Drag and drop or click to replace',
'remove': 'Remove',
'error': 'Ooops, something wrong appended.'
},
error: {
'fileSize': 'The file size is too big (500MB max).'
}
});
$('#wrapper-template_id img').click(function(){
$('#form-wrapper').hide()
$('#cropper-wrapper').hide()
$('#template-wrapper').show()
})
$('#report-form').on('submit', function(event){
event.preventDefault();
$("#pageloader").fadeIn();
$.ajax({
type: "POST",
url: '/form/submitpersonalized',
data: new FormData($('#report-form')[0]),
processData: false,
contentType: false,
success: function( data ) {
$('#cropper-wrapper').show()
$('#form-wrapper').hide()
$("#pageloader").fadeOut();
console.log(data)
if(data.hasOwnProperty('images_fields') && data.images_fields.length > 0 ) {
for(let im of data.images_fields) {
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 ) )
console.log(pos)
pos = pos[0]
//im = JSON.parse(im)
console.log(pos)
//if(im.type == 'image') {
$('.img-container').append(`<div class="mt-5">
<img id="image-${im}" src="${data[im]}" alt="Picture" class="img-fluid">
<input type="hidden" id="field-image-${im}" name="${im}" value="">
</div>`)
$('#cropper-wrapper #image-'+im).attr('src', data[im])
var tmpImg = new Image() ;
tmpImg.src = data[im];
tmpImg.onload = function() {
let $image = $('#image-'+im);
let options = {
aspectRatio: pos.width/pos.height,
crop: function (e) {
console.log(e);
},
cropend: function (e) {
$('#field-image-'+im).val($image.cropper("getCroppedCanvas", { maxWidth: pos.width*2, maxHeight: pos.height*2 }).toDataURL());
},
ready: function (e) {
$('#field-image-'+im).val($image.cropper("getCroppedCanvas", { maxWidth: pos.width*2, maxHeight: pos.height*2 }).toDataURL());
},
};
$image.cropper(options);
}
//}
}
} else {
document.location.href = '/form/generatepersonalization'
}
},
});
});
// $('#image-form').on('submit', function(event){
// event.preventDefault();
// $("#pageloader").fadeIn();
// $.ajax({
// type: "POST",
// url: '/form/submitpersonalizedimages',
// data: new FormData($('#image-form')[0]),
// processData: false,
// contentType: false,
// success: function( data ) {
// console.log(data)
// },
// });
// });
});
</script>
</body>
<!DOCTYPE html>
<html lang="en">
<head>
@include('layouts.shared/title-meta', ['title' => "Form"])
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
<link href="{{ URL::asset('assets/libs/cropper/cropper.min.css')}}" rel="stylesheet" type="text/css" />
<link href="{{ URL::asset('assets/libs/dropify/dropify.min.css') }}" rel="stylesheet" type="text/css" />
</head>
<div id="pageloader">
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
</div>
<body class="loading">
<div class="account-pages">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
<div class="card bg-pattern">
<div class="card-body p-3 row">
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
<br>@endif
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
</div>
<br>@endif
<div class="col-8">
<h4 class="page-title">{{$form->title}}</h4>
</div>
<div id="template-wrapper" class="row">
<h5>Select any one of the templates</h5>
@foreach($personalizations as $pers)
<div class="col-6 col-md-4 mt-3">
<img src="{{$pers->icon}}" class="img-fluid" persdata='{!! json_encode($pers) !!}'><br />
<span>{{$pers->title}}</span>
</div>
@endforeach
</div>
<div id="form-wrapper">
<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="">
@csrf
<div class="row">
<div class="col-7">
<label for="field-template_id" class="form-label"> Selected Template </label>
</div>
<div class="col-4 mb-2" id="wrapper-template_id">
<img src="" class="img-thumbnail" style="max-height:150px">
</div>
<br class="clearfix" />
@foreach($questions as $question)
<div class="col-md-12 mb-2 question-wrapper" id="wrapper-{{$question->id}}">
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} <span class="req-star text-danger" style="display:none" aria-hidden="true">*</span> </label>
@switch($question->type)
@case('hidden')
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
@break
@case('text')
@case('email')
@case('tel')
@case('date')
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="{{isset($question->value)?$question->value:''}}" maxlength={{ isset($question->code) ? ($question->code == 'message_body' ? '220' : '') : '' }}>
@break
@case('number')
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="{{isset($question->value)?$question->value:0}}">
@break
@case('textarea')
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" >{{isset($question->value)?$question->value:''}}</textarea>
@break
@case('dropdown')
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" >
<option value=""> -- Select -- </option>
@foreach($question->options as $option)
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
@endforeach
</select>
@break
@case('checkbox')
@foreach($question->options as $option)
<div class="form-check mb-2 form-check-primary">
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
</div>
@endforeach
@break
@case('file')
<input type="file" name="{{$question->code}}" class="dropify"
data-allowed-file-extensions="png jpg jpeg" />
<p class="text-muted text-center mt-2 mb-0">500MB Max File size</p>
@break
@case('multitextbox')
<div class="row">
@foreach($question->options as $option)
<div class="col-6">{{$option->display}}</div>
<div class="col-6 mb-1">
<input type="text" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" value="{{isset($option->val)?$option->val:''}}">
</div>
@endforeach
</div>
@break
@endswitch
</div>
@endforeach
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
<div class="text-center d-grid mt-3">
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
</div>
@endif
</div>
</form>
</div>
<div id="cropper-wrapper">
<form method="POST" action="/form/submitpersonalizedimages" id="image-form" enctype="multipart/form-data">
<input type="hidden" name="form_id" value="{{$form_id}}">
@csrf
<div class="row">
<div class="col-12 img-container">
</div>
<div class="col-12 mt-1">
<button class="btn btn-primary" id="cropandgo">Use Image and download</button>
</div>
</div>
</form>
</div>
</div> <!-- end card-body -->
</div>
<!-- end card -->
<!-- end row -->
</div> <!-- end col -->
</div>
<!-- end row -->
</div>
<!-- end container -->
</div>
<!-- end page -->
<style type="text/css">
#pageloader {
background: rgba( 255, 255, 255, 0.8 );
display: none;
height: 100%;
position: fixed;
width: 100%;
z-index: 9999;
}
#pageloader img {
left: 50%;
margin-left: -32px;
margin-top: -32px;
position: absolute;
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($){
$('#form-wrapper').hide()
$('#cropper-wrapper').hide()
$('#template-wrapper .img-fluid').click(function(){
$('#form_info').val( $(this).attr('persdata') )
console.log($(this).attr('persdata'))
let personalize = JSON.parse( $(this).attr('persdata') )
$('.question-wrapper').hide()
$('#report-form .question-wrapper').each(function () {
$(this).find('.req-star').hide()
$(this).find(':input').removeAttr('required')
})
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')
}
$('#report-form :input').removeAttr('readonly')
$('#wrapper-template_id img').attr('src', personalize.icon)
$('#template-wrapper').hide()
$('#form-wrapper').show()
// $('.dropify').unbind()
// $('.dropify').dropify({
// messages: {
// 'default': 'Drag and drop a file here or click',
// 'replace': 'Drag and drop or click to replace',
// 'remove': 'Remove',
// 'error': 'Ooops, something wrong appended.'
// },
// error: {
// 'fileSize': 'The file size is too big (500MB max).'
// }
// });
})
$('.dropify').dropify({
messages: {
'default': 'Drag and drop a file here or click',
'replace': 'Drag and drop or click to replace',
'remove': 'Remove',
'error': 'Ooops, something wrong appended.'
},
error: {
'fileSize': 'The file size is too big (500MB max).'
}
});
$('#wrapper-template_id img').click(function(){
$('#form-wrapper').hide()
$('#cropper-wrapper').hide()
$('#template-wrapper').show()
})
$('#report-form').on('submit', function(event){
event.preventDefault();
$("#pageloader").fadeIn();
$.ajax({
type: "POST",
url: '/form/submitpersonalized',
data: new FormData($('#report-form')[0]),
processData: false,
contentType: false,
success: function( data ) {
console.log(data)
// Skip cropper when this template has no image overlay or no image was uploaded
var hasImageOverlay = false
if (data.form_info && data.form_info.positions) {
try {
hasImageOverlay = data.form_info.positions.some(function (p) {
var positions = typeof p === 'string' ? JSON.parse(p) : p
return Array.isArray(positions) && positions.some(function (pi) { return pi && pi.type === 'image' })
})
} catch (e) {}
}
if (data.skip_cropper || data.redirect || !hasImageOverlay || !(data.images_fields && data.images_fields.length > 0)) {
document.location.href = data.redirect || '/form/generatepersonalization'
return
}
$('#form-wrapper').hide()
$('#cropper-wrapper').show()
$("#pageloader").fadeOut();
if(data.hasOwnProperty('images_fields') && data.images_fields.length > 0 ) {
for(let im of data.images_fields) {
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 ) )
console.log(pos)
pos = pos[0]
//im = JSON.parse(im)
console.log(pos)
//if(im.type == 'image') {
$('.img-container').append(`<div class="mt-5">
<img id="image-${im}" src="${data[im]}" alt="Picture" class="img-fluid">
<input type="hidden" id="field-image-${im}" name="${im}" value="">
</div>`)
$('#cropper-wrapper #image-'+im).attr('src', data[im])
var tmpImg = new Image() ;
tmpImg.src = data[im];
tmpImg.onload = function() {
let $image = $('#image-'+im);
let options = {
aspectRatio: pos.width/pos.height,
crop: function (e) {
console.log(e);
},
cropend: function (e) {
$('#field-image-'+im).val($image.cropper("getCroppedCanvas", { maxWidth: pos.width*2, maxHeight: pos.height*2 }).toDataURL());
},
ready: function (e) {
$('#field-image-'+im).val($image.cropper("getCroppedCanvas", { maxWidth: pos.width*2, maxHeight: pos.height*2 }).toDataURL());
},
};
$image.cropper(options);
}
//}
}
}
},
});
});
// $('#image-form').on('submit', function(event){
// event.preventDefault();
// $("#pageloader").fadeIn();
// $.ajax({
// type: "POST",
// url: '/form/submitpersonalizedimages',
// data: new FormData($('#image-form')[0]),
// processData: false,
// contentType: false,
// success: function( data ) {
// console.log(data)
// },
// });
// });
});
</script>
</body>
</html>

View File

@ -227,10 +227,24 @@
processData: false,
contentType: false,
success: function( data ) {
$('#cropper-wrapper').show()
$('#form-wrapper').hide()
$("#pageloader").fadeOut();
console.log(data)
// Skip cropper when this template has no image overlay or no image was uploaded
var hasImageOverlay = false
if (data.form_info && data.form_info.positions) {
try {
hasImageOverlay = data.form_info.positions.some(function (p) {
var positions = typeof p === 'string' ? JSON.parse(p) : p
return Array.isArray(positions) && positions.some(function (pi) { return pi && pi.type === 'image' })
})
} catch (e) {}
}
if (data.skip_cropper || data.redirect || !hasImageOverlay || !(data.images_fields && data.images_fields.length > 0)) {
document.location.href = data.redirect || '/form/generatepersonalization'
return
}
$('#form-wrapper').hide()
$('#cropper-wrapper').show()
$("#pageloader").fadeOut();
if(data.hasOwnProperty('images_fields') && data.images_fields.length > 0 ) {
for(let im of data.images_fields) {
let pos = data.form_info.positions.map(p => JSON.parse(p))
@ -266,8 +280,6 @@
}
//}
}
} else {
document.location.href = '/form/generatepersonalization'
}
},