up
This commit is contained in:
@@ -80,3 +80,135 @@
|
||||
{{ end }}
|
||||
|
||||
</div>
|
||||
|
||||
{{ if .isPartner }}
|
||||
<!-- ─── Sección Partner: Recursos y Comunicados ─────────────────────────────── -->
|
||||
<div x-data="partnerHub()" x-init="init()" class="mt-10">
|
||||
|
||||
<div class="flex items-center gap-3 mb-5">
|
||||
<span class="w-8 h-8 rounded-lg bg-[#8eb02f] text-white flex items-center justify-center text-sm font-bold">P</span>
|
||||
<div>
|
||||
<h2 class="text-base font-bold text-slate-800">Zona Partner</h2>
|
||||
<p class="text-xs text-slate-400">Recursos y comunicados exclusivos para ti</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tabs -->
|
||||
<div class="flex border-b border-slate-200 mb-5 gap-0">
|
||||
<button @click="tab='comunicados'" class="px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors"
|
||||
:class="tab==='comunicados' ? 'border-[#8eb02f] text-[#8eb02f]' : 'border-transparent text-slate-500 hover:text-slate-700'">
|
||||
📢 Comunicados
|
||||
<span x-show="comunicados.length > 0" class="ml-1 bg-slate-100 text-slate-500 text-xs px-1.5 py-0.5 rounded-full" x-text="comunicados.length"></span>
|
||||
</button>
|
||||
<button @click="tab='recursos'" class="px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors"
|
||||
:class="tab==='recursos' ? 'border-[#8eb02f] text-[#8eb02f]' : 'border-transparent text-slate-500 hover:text-slate-700'">
|
||||
📁 Recursos
|
||||
<span x-show="recursos.length > 0" class="ml-1 bg-slate-100 text-slate-500 text-xs px-1.5 py-0.5 rounded-full" x-text="recursos.length"></span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Comunicados -->
|
||||
<div x-show="tab==='comunicados'" x-cloak>
|
||||
<div class="space-y-4">
|
||||
<template x-for="com in comunicados" :key="com.ID">
|
||||
<div class="bg-white border border-slate-200 rounded-xl p-5">
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div class="flex-1">
|
||||
<h3 class="font-semibold text-slate-800 text-sm mb-1" x-text="com.titulo"></h3>
|
||||
<p class="text-sm text-slate-600 whitespace-pre-line leading-relaxed" x-text="com.contenido"></p>
|
||||
<p class="text-xs text-slate-400 mt-2" x-text="formatDate(com.CreatedAt)"></p>
|
||||
</div>
|
||||
<template x-if="com.archivo">
|
||||
<a :href="`/portal/partner-comunicados/${com.ID}/download`" target="_blank"
|
||||
class="flex-shrink-0 inline-flex items-center gap-1.5 text-xs text-[#8eb02f] hover:text-[#6d8c24] border border-[#8eb02f] px-2.5 py-1.5 rounded-lg hover:bg-[#f6ffe0] transition-colors">
|
||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/></svg>
|
||||
Adjunto
|
||||
</a>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<p x-show="comunicados.length === 0 && !loading" class="text-slate-400 text-sm text-center py-10">Sin comunicados por ahora.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Recursos -->
|
||||
<div x-show="tab==='recursos'" x-cloak>
|
||||
<!-- Filtro por categoría -->
|
||||
<div class="flex flex-wrap gap-2 mb-4">
|
||||
<template x-for="cat in ['todos','general','tecnico','comercial','marketing']" :key="cat">
|
||||
<button @click="filtro=cat" class="text-xs px-3 py-1 rounded-full border font-medium transition-colors capitalize"
|
||||
:class="filtro===cat ? 'bg-[#8eb02f] text-white border-[#8eb02f]' : 'border-slate-200 text-slate-500 hover:border-slate-400'" x-text="cat">
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3">
|
||||
<template x-for="r in recursosFiltrados" :key="r.ID">
|
||||
<div class="bg-white border border-slate-200 rounded-xl p-4 flex flex-col gap-2">
|
||||
<div class="flex items-start justify-between gap-2">
|
||||
<div class="flex-1">
|
||||
<div class="flex items-center gap-2 mb-1">
|
||||
<span class="text-xs px-2 py-0.5 rounded-full font-medium capitalize" :class="catClass(r.categoria)" x-text="r.categoria"></span>
|
||||
</div>
|
||||
<h4 class="font-semibold text-slate-800 text-sm" x-text="r.nombre"></h4>
|
||||
<p class="text-xs text-slate-500 mt-0.5 line-clamp-2" x-text="r.descripcion"></p>
|
||||
</div>
|
||||
</div>
|
||||
<template x-if="r.archivo">
|
||||
<a :href="`/portal/partner-recursos/${r.ID}/download`" target="_blank"
|
||||
class="mt-auto inline-flex items-center gap-2 text-xs font-medium text-white bg-[#8eb02f] hover:bg-[#6d8c24] px-3 py-1.5 rounded-lg transition-colors">
|
||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/></svg>
|
||||
Descargar
|
||||
</a>
|
||||
</template>
|
||||
<template x-if="!r.archivo">
|
||||
<span class="text-xs text-slate-400 italic">Sin archivo adjunto</span>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
<p x-show="recursosFiltrados.length === 0 && !loading" class="sm:col-span-2 lg:col-span-3 text-slate-400 text-sm text-center py-10">Sin recursos disponibles.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<script>
|
||||
function partnerHub() {
|
||||
return {
|
||||
tab: 'comunicados',
|
||||
filtro: 'todos',
|
||||
recursos: [],
|
||||
comunicados: [],
|
||||
loading: false,
|
||||
|
||||
async init() {
|
||||
this.loading = true;
|
||||
try {
|
||||
const r = await axios.get('/portal/partner-recursos');
|
||||
this.recursos = r.data.recursos || [];
|
||||
this.comunicados = r.data.comunicados || [];
|
||||
} catch(e) {} finally { this.loading = false; }
|
||||
},
|
||||
|
||||
get recursosFiltrados() {
|
||||
if (this.filtro === 'todos') return this.recursos;
|
||||
return this.recursos.filter(r => r.categoria === this.filtro);
|
||||
},
|
||||
|
||||
catClass(cat) {
|
||||
return {
|
||||
general: 'bg-slate-100 text-slate-600',
|
||||
tecnico: 'bg-blue-100 text-blue-700',
|
||||
comercial: 'bg-yellow-100 text-yellow-700',
|
||||
marketing: 'bg-pink-100 text-pink-700',
|
||||
}[cat] || 'bg-slate-100 text-slate-600';
|
||||
},
|
||||
|
||||
formatDate(d) {
|
||||
if (!d) return '';
|
||||
return new Date(d).toLocaleDateString('es-CO', { day:'2-digit', month:'short', year:'numeric' });
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user