added a way to add an image from a smartphone camera

This commit is contained in:
abdurahman 2023-12-24 10:42:21 +05:00
parent 0de0459ce1
commit 9250b863f7
6 changed files with 1318 additions and 596 deletions

View File

@ -115,6 +115,7 @@ return [
'file_size_limit_help' => 'Enter file size limit in MB',
'allowed_file' => 'Allowed File Type',
'specify_file_type' => 'Specify allowed types',
'image_file_type' => 'Camera + file',
'all_types' => 'All types',
'add_file_type' => 'Add file types',
'add_file_type_help_text' => 'Comma separated string of file types.Ex: .jpg, .png, .jpeg',

View File

@ -115,6 +115,7 @@ return [
'file_size_limit_help' => 'Sisestage faili suuruse piirang megabaitides',
'allowed_file' => 'Lubatud failitüüp',
'specify_file_type' => 'Määrake lubatud tüübid',
'image_file_type' => 'Camera + file',
'all_types' => 'Kõik tüübid',
'add_file_type' => 'Lisa failitüüpe',
'add_file_type_help_text' => 'Failitüüpide komaga eraldatud string. Näiteks: .jpg, .png, .jpeg',

View File

@ -115,6 +115,7 @@ return [
'file_size_limit_help' => 'Введите ограничение размера файла в МБ',
'allowed_file' => 'Допустимый тип файла',
'specify_file_type' => 'Укажите разрешенные типы',
'image_file_type' => 'Camera + file',
'all_types' => 'Все типы',
'add_file_type' => 'Добавить типы файлов',
'add_file_type_help_text' => 'Строка с разделенными запятыми типами файлов. Например, .jpg, .png, .jpeg',

2
package-lock.json generated
View File

@ -1,5 +1,5 @@
{
"name": "uniquesoft.es",
"name": "Aknaproff1",
"lockfileVersion": 3,
"requires": true,
"packages": {

File diff suppressed because it is too large Load Diff

View File

@ -3,52 +3,56 @@
$form = !empty($form) ? $form : '';
@endphp
<!-- reCaptcha -->
<script src="//www.google.com/recaptcha/api.js?v={{$asset_version}}" async defer></script>
<!-- reCaptcha -->
<script src="//www.google.com/recaptcha/api.js?v={{ $asset_version }}" async defer></script>
<script type="text/javascript">
if (typeof jQuery == 'undefined') {
document.write('<script src="//code.jquery.com/jquery-3.4.1.min.js?v={{$asset_version}}"></' + 'script>');
document.write('<script src="//code.jquery.com/jquery-3.4.1.min.js?v={{ $asset_version }}"></' + 'script>');
}
</script>
<!-- Bootstrap Js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js?v={{$asset_version}}"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js?v={{ $asset_version }}"></script>
<script src="//stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js?v={{$asset_version}}"></script>
<script src="//stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js?v={{ $asset_version }}"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/npm/moment@2.24.0/moment.min.js?v={{$asset_version}}"></script>
<script src="//cdn.jsdelivr.net/npm/toastr@2.1.4/build/toastr.min.js?v={{$asset_version}}"></script>
<script src="//cdn.jsdelivr.net/npm/jquery-validation@1.17.0/dist/jquery.validate.min.js?v={{$asset_version}}"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/npm/moment@2.24.0/moment.min.js?v={{ $asset_version }}"></script>
<script src="//cdn.jsdelivr.net/npm/toastr@2.1.4/build/toastr.min.js?v={{ $asset_version }}"></script>
<script src="//cdn.jsdelivr.net/npm/jquery-validation@1.17.0/dist/jquery.validate.min.js?v={{ $asset_version }}">
</script>
<script type="text/javascript"
src="//cdnjs.cloudflare.com/ajax/libs/rangeslider.js/2.3.2/rangeslider.min.js?v={{$asset_version}}"></script>
src="//cdnjs.cloudflare.com/ajax/libs/rangeslider.js/2.3.2/rangeslider.min.js?v={{ $asset_version }}"></script>
<script type="text/javascript"
src="//cdnjs.cloudflare.com/ajax/libs/tempusdominus-bootstrap-4/5.1.2/js/tempusdominus-bootstrap-4.min.js?v={{$asset_version}}"></script>
src="//cdnjs.cloudflare.com/ajax/libs/tempusdominus-bootstrap-4/5.1.2/js/tempusdominus-bootstrap-4.min.js?v={{ $asset_version }}">
</script>
<script type="text/javascript"
src="//cdnjs.cloudflare.com/ajax/libs/dropzone/5.5.1/min/dropzone.min.js?v={{$asset_version}}"></script>
src="//cdnjs.cloudflare.com/ajax/libs/dropzone/5.5.1/min/dropzone.min.js?v={{ $asset_version }}"></script>
<script type="text/javascript"
src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.10/js/bootstrap-select.min.js?v={{$asset_version}}"></script>
src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.10/js/bootstrap-select.min.js?v={{ $asset_version }}">
</script>
<script type="text/javascript"
src="//cdnjs.cloudflare.com/ajax/libs/summernote/0.8.12/summernote-bs4.min.js?v={{$asset_version}}"></script>
src="//cdnjs.cloudflare.com/ajax/libs/summernote/0.8.12/summernote-bs4.min.js?v={{ $asset_version }}"></script>
<!-- Boostrap star rating -->
<script
src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-star-rating/4.0.6/js/star-rating.min.js?v={{$asset_version}}"
src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-star-rating/4.0.6/js/star-rating.min.js?v={{ $asset_version }}"
type="text/javascript"></script>
<!-- if you need to use a theme, then include the theme Js file -->
<script
src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-star-rating/4.0.6/themes/krajee-svg/theme.js?v={{$asset_version}}"></script>
src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-star-rating/4.0.6/themes/krajee-svg/theme.js?v={{ $asset_version }}">
</script>
<!-- optionally if you need translation for your language then include locale file as mentioned below -->
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-star-rating/4.0.6/js/locales/<lang>.js"></script> -->
<!-- signature pad (https://github.com/szimek/signature_pad)-->
<script src="https://cdn.jsdelivr.net/npm/signature_pad@2.3.2/dist/signature_pad.min.js?v={{$asset_version}}"></script>
<script src="https://cdn.jsdelivr.net/npm/signature_pad@2.3.2/dist/signature_pad.min.js?v={{ $asset_version }}">
</script>
<script src="{{asset('/plugins/countdowntimer/countdowntimer.min.js').'?v='.$asset_version}}"></script>
@if(!$is_download)
<script src="{{ asset('/plugins/countdowntimer/countdowntimer.min.js') . '?v=' . $asset_version }}"></script>
@if (!$is_download)
<!-- app js values -->
<script type="application/javascript">
var APP = {};
@ -91,33 +95,35 @@
</script>
<script
src="//cdn.jsdelivr.net/npm/jquery-validation-unobtrusive@3.2.10/dist/jquery.validate.unobtrusive.min.js?v={{$asset_version}}"></script>
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11?v={{$asset_version}}"></script>
src="//cdn.jsdelivr.net/npm/jquery-validation-unobtrusive@3.2.10/dist/jquery.validate.unobtrusive.min.js?v={{ $asset_version }}">
</script>
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11?v={{ $asset_version }}"></script>
{{-- <script src="/js/sweetalert2.all.js"></script> --}}
<script type="text/javascript"
src="//cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js?v={{$asset_version}}"></script>
src="//cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js?v={{ $asset_version }}"></script>
<script type="text/javascript"
src="//cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js?v={{$asset_version}}"></script>
src="//cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js?v={{ $asset_version }}"></script>
<script type="text/javascript"
src="//cdn.datatables.net/v/bs4/jszip-2.5.0/dt-1.10.18/b-1.5.6/b-colvis-1.5.6/b-flash-1.5.6/b-html5-1.5.6/b-print-1.5.6/fc-3.3.1/fh-3.1.4/datatables.min.js?v={{$asset_version}}"></script>
src="//cdn.datatables.net/v/bs4/jszip-2.5.0/dt-1.10.18/b-1.5.6/b-colvis-1.5.6/b-flash-1.5.6/b-html5-1.5.6/b-print-1.5.6/fc-3.3.1/fh-3.1.4/datatables.min.js?v={{ $asset_version }}">
</script>
<!-- ladda.js -->
<script type="text/javascript"
src="//cdnjs.cloudflare.com/ajax/libs/Ladda/1.0.6/spin.min.js?v={{$asset_version}}"></script>
<script type="text/javascript"
src="//cdnjs.cloudflare.com/ajax/libs/Ladda/1.0.6/ladda.min.js?v={{$asset_version}}"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/Ladda/1.0.6/spin.min.js?v={{ $asset_version }}">
</script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/Ladda/1.0.6/ladda.min.js?v={{ $asset_version }}">
</script>
<!-- localization -->
<script src="{{ url('/js/lang.js') . '?v=' . $asset_version }}"></script>
<script src="{{ asset(mix('js/app.js')) }}" defer></script>
<!-- intro.js -->
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/intro.js/2.9.3/intro.min.js?v={{$asset_version}}"></script>
src="https://cdnjs.cloudflare.com/ajax/libs/intro.js/2.9.3/intro.min.js?v={{ $asset_version }}"></script>
<script src="{{ asset('js/iframeResizercontentWindow.js') }}"></script>
@endif
<script type="text/javascript">
jQuery.validator.setDefaults({
errorPlacement: function (error, element) {
errorPlacement: function(error, element) {
if (element.hasClass('select2') && element.parent().hasClass('input-group')) {
error.insertAfter(element.parent());
} else if (element.hasClass('select2')) {
@ -140,57 +146,61 @@
error.insertAfter(element);
}
},
invalidHandler: function () {
invalidHandler: function() {
toastr.error("{{ __('messages.some_error_in_input_field') }}");
}
});
$(document).ready(function () {
@if(!$is_download)
jQuery.extend($.fn.dataTable.defaults, {
fixedHeader: false,
aLengthMenu: [
[25, 50, 100, 200, 500, 1000, -1], [25, 50, 100, 200, 500, 1000, "{{__('messages.all')}}"]
],
iDisplayLength: 25,
dom: 'lfrtip',
"language": {
"emptyTable": "{{__('messages.emptyTable')}}",
"info": "{{__('messages.dt_info')}}",
"infoEmpty": "{{__('messages.infoEmpty')}}",
"infoFiltered": "{{__('messages.infoFiltered')}}",
"lengthMenu": "{{__('messages.lengthMenu')}}",
"loadingRecords": "{{__('messages.loadingRecords')}}",
"processing": "{{__('messages.processing')}}",
"search": "{{__('messages.search')}}",
"zeroRecords": "{{__('messages.zeroRecords')}}",
"paginate": {
"first": "{{__('messages.first')}}",
"last": "{{__('messages.last')}}",
"next": "{{__('messages.next')}}",
"previous": "{{__('messages.previous')}}"
},
buttons: {
copyTitle: "{{__('messages.copy_to_clipboard')}}",
copySuccess: {
_: "{{__('messages.copied_n_rows_to_clipboard')}}"
$(document).ready(function() {
@if (!$is_download)
jQuery.extend($.fn.dataTable.defaults, {
fixedHeader: false,
aLengthMenu: [
[25, 50, 100, 200, 500, 1000, -1],
[25, 50, 100, 200, 500, 1000, "{{ __('messages.all') }}"]
],
iDisplayLength: 25,
dom: 'lfrtip',
"language": {
"emptyTable": "{{ __('messages.emptyTable') }}",
"info": "{{ __('messages.dt_info') }}",
"infoEmpty": "{{ __('messages.infoEmpty') }}",
"infoFiltered": "{{ __('messages.infoFiltered') }}",
"lengthMenu": "{{ __('messages.lengthMenu') }}",
"loadingRecords": "{{ __('messages.loadingRecords') }}",
"processing": "{{ __('messages.processing') }}",
"search": "{{ __('messages.search') }}",
"zeroRecords": "{{ __('messages.zeroRecords') }}",
"paginate": {
"first": "{{ __('messages.first') }}",
"last": "{{ __('messages.last') }}",
"next": "{{ __('messages.next') }}",
"previous": "{{ __('messages.previous') }}"
},
buttons: {
copyTitle: "{{ __('messages.copy_to_clipboard') }}",
copySuccess: {
_: "{{ __('messages.copied_n_rows_to_clipboard') }}"
}
}
}
}
});
});
$.ajaxSetup({
headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')}
});
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
@endif
$('button[type=reset]').on('click', function () {
$('button[type=reset]').on('click', function() {
$(this).parents('form').find('input').val('');
window.location.href = $(this).parents('form').attr('action');
});
});
function initialize_datetimepicker(element_name, element_date, start_date, end_date, date_format, time_format, disabled_days, enable_time_picker, time_picker_inline) {
function initialize_datetimepicker(element_name, element_date, start_date, end_date, date_format, time_format,
disabled_days, enable_time_picker, time_picker_inline) {
var start = null;
var end = null;
var format = '';
@ -254,10 +264,9 @@
$('#' + element_name).rangeslider({
polyfill: false,
//Callback function
onInit: function () {
},
onInit: function() {},
// Callback function
onSlide: function (position, value) {
onSlide: function(position, value) {
$('.' + element_name).text(value);
},
});
@ -265,12 +274,13 @@
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) {
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')}}";
file_remove_url = "{{ url('/file-delete')}}";
url = "{{ url('/file-upload') }}";
file_remove_url = "{{ url('/file-delete') }}";
}
var file_names = [];
@ -286,27 +296,37 @@
maxFilesize: max_file_size,
dictDefaultMessage: file_upload_msg,
maxFiles: no_of_files_can_be_uploaded,
capture: allowed_file_type == 'image/*' ? 'image/*' : null,
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
acceptedFiles: allowed_file_type,
init: function () {
init: function() {
//function to be use on editing a form, to display existing files
if ($('input#' + element_name).val().length > 0) {
window[`${element_name}_myDropzone`] = this;
var file_obj = {files: $('input#' + element_name).val()};
var file_obj = {
files: $('input#' + element_name).val()
};
$.ajax({
method: "GET",
url: '/existing-file-display',
dataType: "json",
data: file_obj,
success: function (result) {
success: function(result) {
if (result.success) {
$.each(result.files, function (key, file) {
var mockFile = {name: file.name, uploaded_as: file.uploaded_as, size: file.size};
window[`${element_name}_myDropzone`].emit("addedfile", mockFile);
window[`${element_name}_myDropzone`].emit("thumbnail", mockFile, file.path);
window[`${element_name}_myDropzone`].emit("complete", mockFile);
$.each(result.files, function(key, file) {
var mockFile = {
name: file.name,
uploaded_as: file.uploaded_as,
size: file.size
};
window[`${element_name}_myDropzone`].emit(
"addedfile", mockFile);
window[`${element_name}_myDropzone`].emit(
"thumbnail", mockFile, file.path);
window[`${element_name}_myDropzone`].emit(
"complete", mockFile);
});
}
}
@ -314,13 +334,15 @@
}
//function to be use on removeing a file
this.on("removedfile", function (file) {
this.on("removedfile", function(file) {
$.ajax({
url: file_remove_url,
data: {"file_name": file.uploaded_as},
data: {
"file_name": file.uploaded_as
},
type: "POST",
success: function (result) {
if (typeof (result) == 'string') {
success: function(result) {
if (typeof(result) == 'string') {
var result = JSON.parse(result);
}
@ -350,8 +372,8 @@
});
});
},
success: function (file, response) {
if (typeof (response) == 'string') {
success: function(file, response) {
if (typeof(response) == 'string') {
var response = JSON.parse(response);
}
if (response.success == true) {
@ -409,7 +431,7 @@
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);
@ -421,12 +443,12 @@
signaturePad.fromDataURL($('#output_' + element).val());
}
$(document).on('click', '#clear_' + element, function () {
$(document).on('click', '#clear_' + element, function() {
signaturePad.clear();
$('#output_' + $(this).data('name')).val('');
});
$(document).on('click', '#undo_' + element, function () {
$(document).on('click', '#undo_' + element, function() {
var data = signaturePad.toData();
if (data) {
data.pop(); // remove the last dot or line
@ -467,8 +489,8 @@
}
</script>
<!-- Application additional js -->
@if(!$is_download && !isset($nav))
@if(!empty($__additional_js))
{!!$__additional_js!!}
@if (!$is_download && !isset($nav))
@if (!empty($__additional_js))
{!! $__additional_js !!}
@endif
@endif