92 lines
4.9 KiB
PHP
92 lines
4.9 KiB
PHP
{{--
|
|
文件功能:求婚记录页(含取消操作)
|
|
|
|
@author ChatRoom Laravel
|
|
@version 1.0.0
|
|
--}}
|
|
|
|
@extends('admin.layouts.app')
|
|
|
|
@section('title', '求婚记录')
|
|
|
|
@section('content')
|
|
|
|
<div class="flex items-center justify-between mb-5">
|
|
<h2 class="text-xl font-bold text-gray-800">💌 求婚记录</h2>
|
|
<a href="{{ route('admin.marriages.index') }}" class="text-sm text-indigo-600 hover:underline">← 返回总览</a>
|
|
</div>
|
|
|
|
<div class="bg-white rounded-xl shadow-sm border overflow-hidden">
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full text-sm">
|
|
<thead class="bg-gray-50 text-xs uppercase text-gray-600">
|
|
<tr>
|
|
<th class="px-4 py-3 text-left">ID</th>
|
|
<th class="px-4 py-3 text-left">发起方</th>
|
|
<th class="px-4 py-3 text-left">目标</th>
|
|
<th class="px-4 py-3 text-left">戒指</th>
|
|
<th class="px-4 py-3 text-center">状态</th>
|
|
<th class="px-4 py-3 text-left">求婚时间</th>
|
|
<th class="px-4 py-3 text-left">过期时间</th>
|
|
<th class="px-4 py-3 text-center">操作</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y">
|
|
@forelse ($proposals as $p)
|
|
<tr class="hover:bg-gray-50">
|
|
<td class="px-4 py-3 text-gray-400 font-mono text-xs">{{ $p->id }}</td>
|
|
<td class="px-4 py-3 font-bold">{{ $p->user?->username }}</td>
|
|
<td class="px-4 py-3 font-bold">{{ $p->partner?->username }}</td>
|
|
<td class="px-4 py-3">{{ $p->ringItem?->icon }} {{ $p->ringItem?->name ?? '—' }}</td>
|
|
<td class="px-4 py-3 text-center">
|
|
<span
|
|
class="px-2 py-0.5 rounded-full text-xs font-bold
|
|
{{ match ($p->status) {
|
|
'pending' => 'bg-amber-100 text-amber-700',
|
|
'rejected' => 'bg-red-100 text-red-600',
|
|
'expired' => 'bg-gray-100 text-gray-500',
|
|
'married' => 'bg-emerald-100 text-emerald-700',
|
|
'divorced' => 'bg-purple-100 text-purple-700',
|
|
default => 'bg-gray-100 text-gray-600',
|
|
} }}">
|
|
{{ ['pending' => '⏳ 等待中', 'rejected' => '❌ 已拒绝', 'expired' => '⏰ 已过期', 'married' => '✅ 已结婚', 'divorced' => '💔 已离婚'][$p->status] ?? $p->status }}
|
|
</span>
|
|
</td>
|
|
<td class="px-4 py-3 text-xs text-gray-500">{{ $p->proposed_at?->format('Y-m-d H:i') }}</td>
|
|
<td
|
|
class="px-4 py-3 text-xs {{ $p->expires_at?->isPast() ? 'text-red-400' : 'text-gray-500' }}">
|
|
{{ $p->expires_at?->format('Y-m-d H:i') }}
|
|
@if ($p->status === 'pending' && $p->expires_at?->isPast())
|
|
<span class="text-red-500">(已超时)</span>
|
|
@endif
|
|
</td>
|
|
<td class="px-4 py-3 text-center">
|
|
@if ($p->status === 'pending')
|
|
<form action="{{ route('admin.marriages.cancel-proposal', $p->id) }}" method="POST"
|
|
onsubmit="return confirm('确定取消该求婚吗?')">
|
|
@csrf
|
|
<button type="submit"
|
|
class="text-xs bg-amber-50 text-amber-600 font-bold px-3 py-1.5 rounded hover:bg-amber-600 hover:text-white transition">
|
|
取消求婚
|
|
</button>
|
|
</form>
|
|
@else
|
|
<span class="text-gray-300 text-xs">—</span>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="8" class="px-4 py-12 text-center text-gray-400">暂无求婚记录</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@if ($proposals->hasPages())
|
|
<div class="px-4 py-4 border-t">{{ $proposals->links() }}</div>
|
|
@endif
|
|
</div>
|
|
|
|
@endsection
|