Files
sirpremiumv2/resources/views/livewire/share-code-component.blade.php
T

108 lines
5.7 KiB
PHP

<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 my-12">
<div>
<div class="bg-white shadow overflow-hidden sm:rounded-lg">
<div class="px-4 py-5 sm:px-6">
<h3 class="text-lg leading-6 font-medium text-gray-900">Compartir Código</h3>
<p class="mt-1 max-w-2xl text-sm text-gray-500">
Comparte tu código de referido.
</p>
<div class="mt-4 p-4 bg-gray-100 rounded">
<span class="text-sm text-gray-700">Tu código:</span>
<div class="flex items-center mt-2">
<input type="text" id="referralLink" value="{{ route('register', ['ref' => Auth::user()->referral_code]) }}" class="flex-1 px-3 py-2 border border-gray-300 rounded-l-md text-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500" readonly >
<button onclick="copyToClipboard()" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-r-md text-sm font-medium focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" >
Copiar
</button>
</div>
<p id="copyFeedback" class="hidden text-green-600 text-xs mt-1"></p>
</div>
</div>
</div>
</div>
</div>
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mb-12">
<div class="bg-white">
<div class="flex items-center justify-between mb-4">
<div class="px-4 py-5 sm:px-6">
<h3 class="text-lg leading-6 font-medium text-gray-900">Mis Referidos</h3>
<p class="mt-1 text-sm text-gray-500">
Aquí puedes ver la lista de tus referidos.
</p>
</div>
<div class="flex items-center space-x-2 bg-purple-50 px-4 py-2 rounded-lg shadow-sm">
<svg class="w-6 h-6 text-purple-600" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M18 18.72a9.094 9.094 0 0 0 3.741-.479 3 3 0 0 0-4.682-2.72m.94 3.198.001.031c0 .225-.012.447-.037.666A11.944 11.944 0 0 1 12 21c-2.17 0-4.207-.576-5.963-1.584A6.062 6.062 0 0 1 6 18.719m12 0a5.971 5.971 0 0 0-.941-3.197m0 0A5.995 5.995 0 0 0 12 12.75a5.995 5.995 0 0 0-5.058 2.772m0 0a3 3 0 0 0-4.681 2.72 8.986 8.986 0 0 0 3.74.477m.94-3.197a5.971 5.971 0 0 0-.94 3.197M15 6.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm6 3a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Zm-13.5 0a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Z" />
</svg>
<span class="text-purple-700 font-semibold text-lg">
{{ $referrals->count() }}
</span>
<span class="text-gray-600 text-sm">Total de referidos</span>
</div>
</div>
<div class="shadow overflow-hidden sm:rounded-lg">
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
Fecha
</th>
<th class="px-6 py-3 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
Usuario
</th>
<th class="px-6 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider">
Referidos del usuario
</th>
<th class="px-6 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider">
Estado
</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-100">
@forelse ($referrals as $item)
<tr class="hover:bg-gray-50 transition duration-150">
<td class="px-6 py-4 text-sm text-gray-700">{{ $item->created_at->format('Y-m-d') }}</td>
<td class="px-6 py-4 text-sm font-medium text-gray-900">{{ $item->email }}</td>
<td class="px-6 py-4 text-center text-sm text-gray-700">{{ $item->children_count }}</td>
<td class="px-6 py-4 text-center select-none">
<span class="px-3 py-1 text-xs font-semibold rounded-full bg-red-100 text-red-700">
Inactivo
</span>
</td>
</tr>
@empty
<tr>
<td colspan="4" class="px-6 py-4 text-center text-sm text-gray-500">
No tienes referidos aún.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
</div>
<script>
function copyToClipboard() {
const copyText = document.getElementById("referralLink");
copyText.select();
copyText.setSelectionRange(0, 99999);
document.execCommand("copy");
const feedback = document.getElementById("copyFeedback");
feedback.classList.remove("hidden");
setTimeout(() => {
feedback.classList.add("hidden");
}, 2000);
}
</script>