Ajustes Toast
This commit is contained in:
@@ -1,12 +1,7 @@
|
||||
<div class="max-w-3xl mx-auto bg-white rounded-xl shadow-sm border border-gray-100 p-6">
|
||||
<h3 class="text-lg font-semibold text-gray-800 mb-6">Nova Ordem Judicial</h3>
|
||||
|
||||
<?php if (isset($_SESSION['flash_error'])): ?>
|
||||
<div class="bg-red-50 border-l-4 border-red-500 p-4 mb-6">
|
||||
<p class="text-sm text-red-700"><?= $_SESSION['flash_error'] ?></p>
|
||||
</div>
|
||||
<?php unset($_SESSION['flash_error']); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<!-- Quill Styles -->
|
||||
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
|
||||
|
||||
@@ -10,12 +10,7 @@
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<?php if (isset($_SESSION['flash_success'])): ?>
|
||||
<div class="bg-green-50 border-l-4 border-green-500 p-4 m-6">
|
||||
<p class="text-sm text-green-700"><?= $_SESSION['flash_success'] ?></p>
|
||||
</div>
|
||||
<?php unset($_SESSION['flash_success']); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full">
|
||||
|
||||
@@ -2,12 +2,7 @@
|
||||
<h3 class="text-lg font-semibold text-gray-800 mb-6"><?= isset($server) ? 'Editar Servidor' : 'Novo Servidor' ?>
|
||||
</h3>
|
||||
|
||||
<?php if (isset($_SESSION['flash_error'])): ?>
|
||||
<div class="bg-red-50 text-red-700 p-4 rounded-lg mb-6">
|
||||
<?= $_SESSION['flash_error'];
|
||||
unset($_SESSION['flash_error']); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<form action="<?= isset($server) ? '/admin/servers/update/' . $server['id'] : '/admin/servers/store' ?>"
|
||||
method="POST">
|
||||
@@ -67,7 +62,7 @@
|
||||
<input type="text" value="<?= $server['serial_key'] ?>" readonly
|
||||
class="w-full px-4 py-2 bg-gray-50 border border-gray-300 rounded-l-lg text-gray-500 font-mono text-sm">
|
||||
<button type="button"
|
||||
onclick="navigator.clipboard.writeText('<?= $server['serial_key'] ?>')"
|
||||
onclick="navigator.clipboard.writeText('<?= $server['serial_key'] ?>'); window.notify('success', 'Sucesso', 'Key copiada!');"
|
||||
class="px-3 py-2 bg-gray-100 border border-l-0 border-gray-300 rounded-r-lg hover:bg-gray-200 text-gray-600">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<div class="flex items-center space-x-2">
|
||||
<span><?= substr($server['serial_key'], 0, 8) ?>...</span>
|
||||
<button
|
||||
onclick="navigator.clipboard.writeText('<?= $server['serial_key'] ?>'); alert('Key copiada!');"
|
||||
onclick="navigator.clipboard.writeText('<?= $server['serial_key'] ?>'); window.notify('success', 'Sucesso', 'Key copiada!');"
|
||||
class="text-primary-600 hover:text-primary-800" title="Copiar Serial Completo">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
|
||||
@@ -84,46 +84,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Notification Toast -->
|
||||
<div x-show="notification.show" x-transition:enter="transition ease-out duration-300"
|
||||
x-transition:enter-start="opacity-0 transform translate-y-2"
|
||||
x-transition:enter-end="opacity-100 transform translate-y-0"
|
||||
x-transition:leave="transition ease-in duration-200"
|
||||
x-transition:leave-start="opacity-100 transform translate-y-0"
|
||||
x-transition:leave-end="opacity-0 transform translate-y-2"
|
||||
class="fixed bottom-4 right-4 z-50 max-w-sm w-full bg-white shadow-lg rounded-lg pointer-events-auto ring-1 ring-black ring-opacity-5 overflow-hidden">
|
||||
<div class="p-4">
|
||||
<div class="flex items-start">
|
||||
<div class="flex-shrink-0">
|
||||
<svg x-show="notification.type === 'success'" class="h-6 w-6 text-green-400" fill="none"
|
||||
viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
||||
<svg x-show="notification.type === 'error'" class="h-6 w-6 text-red-400" fill="none"
|
||||
viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="ml-3 w-0 flex-1 pt-0.5">
|
||||
<p class="text-sm font-medium text-gray-900" x-text="notification.title"></p>
|
||||
<p class="mt-1 text-sm text-gray-500" x-text="notification.message"></p>
|
||||
</div>
|
||||
<div class="ml-4 flex-shrink-0 flex">
|
||||
<button @click="notification.show = false"
|
||||
class="bg-white rounded-md inline-flex text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
|
||||
<span class="sr-only">Fechar</span>
|
||||
<svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path fill-rule="evenodd"
|
||||
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
|
||||
clip-rule="evenodd" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@@ -131,12 +92,6 @@
|
||||
Alpine.data('settings', () => ({
|
||||
activeTab: 'interactions',
|
||||
testing: false,
|
||||
notification: {
|
||||
show: false,
|
||||
type: 'success',
|
||||
title: '',
|
||||
message: ''
|
||||
},
|
||||
|
||||
testIntegration() {
|
||||
this.testing = true;
|
||||
@@ -165,28 +120,22 @@
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
this.showNotification(
|
||||
data.success ? 'success' : 'error',
|
||||
data.success ? 'Sucesso' : 'Erro',
|
||||
data.message
|
||||
);
|
||||
this.$dispatch('notify', {
|
||||
type: data.success ? 'success' : 'error',
|
||||
title: data.success ? 'Sucesso' : 'Erro',
|
||||
message: data.message
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
this.showNotification('error', 'Erro', 'Falha na requisição.');
|
||||
this.$dispatch('notify', {
|
||||
type: 'error',
|
||||
title: 'Erro',
|
||||
message: 'Falha na requisição.'
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
this.testing = false;
|
||||
});
|
||||
},
|
||||
|
||||
showNotification(type, title, message) {
|
||||
this.notification.type = type;
|
||||
this.notification.title = title;
|
||||
this.notification.message = message;
|
||||
this.notification.show = true;
|
||||
setTimeout(() => {
|
||||
this.notification.show = false;
|
||||
}, 5000);
|
||||
}
|
||||
}))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user