HEX
Server: Apache
System: Linux br80.hostgator.com.br 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User: bloga741 (1102)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: /home1/bloga741/public_html/likedreams/test/js/gallery.panel.js
$(document).ready(function (e) {
	
	// DELETE ITEM
	$('.delete-panel-item').click(function (event) {
		var ok = confirm("Deseja mesmo excluir este item?\nEsta ação é irreversível.");
		if (ok) {
			
			$.isLoading({ text: "Excluindo" });
			
			$.ajax({
				url: base_url('ajax/deleteItem'),
				method: 'post',
				data: {
					className: 'Image',
					objectId: this.getAttribute('data-id'),
				},
				success: function (response) {
					console.log(response);
					switch (response) {
					case '0':
						$.isLoading( "hide" );
						alert('Ops! Ocorreu um erro, tente novamente.');
						break;
					
					case '1':
						location.reload();
						break;
						
					case '2':
						$.isLoading( "hide" );
						alert('Ops! Você não tem permissão para esta ação.');
						break;
						
					default:
						$.isLoading( "hide" );
						alert(response);
						break;
					}
				},
				error: function (response) {
					console.log(error, response);
				}
			});
		}
	});
	
	// HANDLE FORM SUBMIT
	$('#gallery-form').submit(function (event) {
		
		$.isLoading({ text: 'Salvando' });
		
		var images = $('#images').val();
		
		if (images == null || images == '' || images.length == 0) {
			$.isLoading('hide');
			alert('Ops! Selecione alguma imagem antes de continuar.');
			event.preventDefault();
			return false;
		}
		else {
			return true;
		}
	});
});