<!-- Mainly scripts -->
<script src="<?php echo PUBLICURL . 'assets/vendor/jquery/jquery.min.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/cms/js/common/util.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/cms/js/common/popper.min.js?v=' . $versionDate; ?>"></script>

<!-- Bootsrap -->
<script src="<?php echo PUBLICURL . 'assets/vendor/bootstrap-5.2.0/js/bootstrap.bundle.min.js?v=' . $versionDate; ?>"></script>

<script src="<?php echo PUBLICURL . 'assets/vendor/metisMenu/jquery.metisMenu.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/slimscroll/jquery.slimscroll.min.js?v=' . $versionDate; ?>"></script>

<script src="<?php echo PUBLICURL . 'assets/vendor/dataTables/datatables.min.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/dataTables/DataTables-1.12.1/js/dataTables.bootstrap4.min.js?v=' . $versionDate; ?>"></script>

<!-- Custom and plugin javascript -->
<script src="<?php echo PUBLICURL . 'assets/cms/js/common/inspinia.js?v=' . $versionDate; ?>"></script>

<script src="<?php echo PUBLICURL . 'assets/vendor/pace/pace.min.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/sweet-alert-2/dist/sweetalert2.all.min.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/iCheck/icheck.min.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/mask/jquery.mask.min.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/uploader/plupload.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/uploader/plupload.html5.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/uploader/plupload.html4.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/uploader/jquery.plupload.queue.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/bootstrap-colorpicker-3.2.0/dist/js/bootstrap-colorpicker.min.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/jquery.validation/jquery.validate.min.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/tinymce/tinymce.min.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/datapicker/bootstrap-datepicker.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/select2/dist/js/select2.full.min.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/chosen/chosen.jquery.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/jsKnob/jquery.knob.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/ionRangeSlider/ion.rangeSlider.min.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/nouslider/jquery.nouislider.min.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/dropzone/dropzone-min.js?v=' . $versionDate; ?>"></script>

<!-- Switchery -->
<script src="<?php echo PUBLICURL . 'assets/vendor/switchery/switchery.js?v=' . $versionDate; ?>"></script>

<!-- Password meter -->
<script src="<?php echo PUBLICURL . 'assets/vendor/pwstrength/pwstrength-bootstrap.min.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/pwstrength/zxcvbn.js?v=' . $versionDate; ?>"></script>

<!-- PNG -->
<script src="<?php echo PUBLICURL . 'assets/vendor/html2canvas/html2canvas.min.js?v=' . $versionDate; ?>"></script>

<!-- Idle Timer plugin -->
<script src="<?php echo PUBLICURL . 'assets/vendor/idle-timer/idle-timer.min.js?v=' . $versionDate; ?>"></script>

<!-- blueimp gallery -->
<script src="<?php echo PUBLICURL . 'assets/vendor/blueimp/jquery.blueimp-gallery.min.js?v=' . $versionDate; ?>"></script>

<!-- Dual Listbox -->
<script src="<?php echo PUBLICURL . 'assets/vendor/dualListbox/jquery.bootstrap-duallistbox.js?v=' . $versionDate; ?>"></script>

<!-- chartJs -->
<script src="<?php echo PUBLICURL . 'assets/vendor/chartJs/chart.js-3.6.0/dist/chart.min.js?v=' . $versionDate; ?>"></script>

<!-- Flot -->
<script src="<?php echo PUBLICURL . 'assets/vendor/flot/jquery.flot.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/flot/jquery.flot.tooltip.min.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/flot/jquery.flot.spline.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/flot/jquery.flot.resize.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/flot/jquery.flot.pie.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/flot/jquery.flot.symbol.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/flot/jquery.flot.time.js?v=' . $versionDate; ?>"></script>

<!-- slick carousel-->
<script src="<?php echo PUBLICURL . 'assets/vendor/slick/slick.min.js?v=' . $versionDate; ?>"></script>

<!-- OWL carousel-->
<script src="<?php echo PUBLICURL . 'assets/vendor/owlcarousel2-2.3.4/dist/owl.carousel.min.js?v=' . $versionDate; ?>"></script>

<!-- Áudios -->
<script src="<?php echo PUBLICURL . 'assets/vendor/audio-play-jquery/js/jquery.simpleaudioplayer.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/jplayer/jplayer/jquery.jplayer.min.js?v=' . $versionDate; ?>"></script>

<!-- Full Calendar -->
<script src="<?php echo PUBLICURL . 'assets/vendor/fullcalendar572/main.min.js?v=' . $versionDate; ?>"></script>

<!-- charCounter -->
<script src="<?php echo PUBLICURL . 'assets/vendor/charCounter/charCounter.min.js?v=' . $versionDate; ?>"></script>

<!-- bootstrapMaxLength -->
<script src="<?php echo PUBLICURL . 'assets/vendor/bootstrapMaxLength/bootstrap-maxlength.js?v=' . $versionDate; ?>"></script>

<!-- charactersCaculator -->
<script src="<?php echo PUBLICURL . 'assets/vendor/charactersCaculator/jquery-characters-caculator.js?v=' . $versionDate; ?>"></script>

<!-- jquerySimpleTxtCounter -->
<script src="<?php echo PUBLICURL . 'assets/vendor/jquerySimpleTxtCounter/jquery-simple-txt-counter.min.js?v=' . $versionDate; ?>"></script>

<!-- jquerySimpleTxtCounter -->
<script src="<?php echo PUBLICURL . 'assets/vendor/codemirror-5.65.1/lib/codemirror.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/codemirror-5.65.1/mode/javascript/javascript.js?v=' . $versionDate; ?>"></script>

<!-- prettyTextDiff -->
<script src="<?php echo PUBLICURL . 'assets/vendor/prettyTextDiff/diff_match_patch.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/vendor/prettyTextDiff/jquery.pretty-text-diff.min.js?v=' . $versionDate; ?>"></script>

<!-- Velocity -->
<script src="<?php echo PUBLICURL . 'assets/vendor/velocity/velocity.min.js?v=' . $versionDate; ?>"></script>

<!-- Leaflet -->
<script src="<?php echo PUBLICURL . 'assets/vendor/leaflet/leaflet.js?v=' . $versionDate; ?>"></script>

<!-- Google reCaptcha -->
<script id="google-recaptcha-v3" src="https://www.google.com/recaptcha/api.js?render=<?php echo $MyPlataforma->recaptcha_site; ?>"></script>	

<script src="<?php echo PUBLICURL . 'assets/cms/js/custom/custom.js?v=' . $versionDate; ?>"></script>
<script src="<?php echo PUBLICURL . 'assets/cms/js/custom/upload.js?v=' . $versionDate; ?>"></script>


<?php if (!empty(service('session')->get('msg'))) {  ?>

	<?php  
	if(service('session')->get('msg')['tipo'] == "success") {
		$icon = '<i class="fal fa-check text-navy text-12 mb-3"></i>';
	}
	else {
		$icon = '<i class="fal fa-times text-danger text-12 mb-3"></i>';
	}
	?>

	<script type="text/javascript"> 
		var swalHtml = "";
		swalHtml += '<?php echo $icon; ?><br/>';
		swalHtml += '<h1><?php echo service('session')->get('msg')['titulo']; ?></h1>';
		swalHtml += '<p class="mb-0 text-lowercase"><?php echo service('session')->get('msg')['descricao']; ?></p>';

		var swalConfirmButtonText = 'Obrigado <i class="fa-light fa-arrow-right ml-1"></i>';
		var swalIsConfirmed 			= 0;
		var swalResult 						= '';

		sweetAlert2(swalHtml, swalConfirmButtonText, swalIsConfirmed, swalResult);
	</script>

	<?php
	service('session')->remove('msg');
} ?>

<!-- 
---- Mapa - Estados/Cidades
--->

<script src="https://maps.googleapis.com/maps/api/js?sensor=false&key=AIzaSyAEBa_DViqilhUJpuPdrtm6NgSc76MZsmY"></script>

<script type="text/javascript">
	if($('#mapa').length > 0) {
		console.log("LOG: MAPA encontrado.");

		let map;

		function mapsInit() {
			map = new google.maps.Map(document.getElementById("mapa"), {
				center: new google.maps.LatLng(-10.3333333, -53.2),
				zoom: 4,
			});
		}

		function mapsSetLocation(lat, lon, zoom) {
			map.setCenter(new google.maps.LatLng(lat, lon));
			map.setZoom(zoom);

			var icon = "";

			var id  	= ANCHOR_MAPS_ID;
			var img  	= ANCHOR_MAPS_IMG;
			var icon 	= ANCHOR_MAPS_ICON;

			const marker = new google.maps.Marker({
				position: new google.maps.LatLng(lat, lon),
				icon: icon,
				map: map,
				draggable: false,
				animation: google.maps.Animation.DROP,
			});
		}

		mapsInit();

		if(MAP_LATITUDE.length > 0 && MAP_LONGITUDE.length > 0) {

			mapsSetLocation(MAP_LATITUDE, MAP_LONGITUDE, 15);
		}
		else {
			console.log("LOG: Latitude e/ou longitude não definidas.");
		}
	}
	else {
		console.log("LOG: MAPA não encontrado.");
	}

	<?php if(isset($cad_estados->latitude) AND !empty($cad_estados->latitude)) { ?>
		if($('.mapa-estado').length > 0) {
			console.log("LOG: MAPA em estados, encontrado.");
			mapsSetLocation(<?php echo $cad_estados->latitude; ?>, <?php echo $cad_estados->longitude; ?>, 6);
		}
	<?php } ?>

	<?php if(isset($cad_cidades->latitude) AND !empty($cad_cidades->latitude)) { ?>
		if($('.mapa-cidade').length > 0) {
			console.log("LOG: MAPA em cidades, encontrado.");
			mapsSetLocation(<?php echo $cad_cidades->latitude; ?>, <?php echo $cad_cidades->longitude; ?>, 6);
		}
	<?php } ?>
</script>

<!-- 
---- Templates
--->

<template id="gallery-item-template">
	<div class="col-3 mt-4">
		<div class="img-background border w-100">
			<a class="link-galeria" data-gallery="gallery-imgs">
				<img class="img-galeria">
			</a>

			<div class="input-group mt-2 mb-2">
				<label class="d-block w-100 text-start">Ordem: </label>
				<input type="text" class="form-control input-order">
				<span class="input-group-append">
					<button type="button" class="btn btn-primary saveNewOrder">
						<i class="fa-light fa-save"></i>
					</button>
				</span>
			</div>

			<div class="input-group mb-2">
				<label class="d-block w-100 text-start">Título: </label>
				<input type="text" class="form-control input-name">
				<span class="input-group-append">
					<button type="button" class="btn btn-primary saveImagemName">
						<i class="fa-light fa-save"></i>
					</button>
				</span>
			</div>

			<div class="input-group">
				<label class="d-block w-100 text-start">Descrição: </label>
				<textarea type="text" class="form-control input-description" rows="5"></textarea>
				<span class="input-group-append">
					<button type="button" class="btn btn-primary saveImagemDescripiton">
						<i class="fa-light fa-save"></i>
					</button>
				</span>
			</div>

			<div class="actions">
				<a title="" href="#" class="deleteImagemGallery">
					<i class="fa-light fa-trash text-danger"></i>
				</a>
			</div>
		</div>
	</div>
</template>
