added personal trainner card

This commit is contained in:
Ghassan Yusuf 2026-02-03 02:26:54 +03:00
parent 22e8d5ed77
commit c08d9bf888
5 changed files with 533 additions and 16 deletions

View File

@ -110,7 +110,7 @@
<div class="modal-content"> <div class="modal-content">
<div class="modal-header border-0"> <div class="modal-header border-0">
<h5 class="modal-title" id="mapModalLabel"> <h5 class="modal-title" id="mapModalLabel">
<i class="bi bi-geo-alt-fill me-2 text-danger"></i>Set Your Location <i class="bi bi-geo-alt-fill me-2 text-primary"></i>Set Your Location
</h5> </h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button> <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div> </div>
@ -133,6 +133,9 @@
</div> </div>
@push('styles') @push('styles')
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<!-- Leaflet CSS --> <!-- Leaflet CSS -->
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
@ -159,6 +162,7 @@
.club-card { .club-card {
transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out;
min-height: 450px;
} }
.club-card:hover { .club-card:hover {
@ -171,7 +175,7 @@
} }
.club-card:hover .club-title { .club-card:hover .club-title {
color: #dc3545 !important; color: #667eea !important;
} }
/* Pulsing animation for location marker */ /* Pulsing animation for location marker */
@ -215,6 +219,148 @@
border-color: #ced4da !important; border-color: #ced4da !important;
box-shadow: none !important; box-shadow: none !important;
} }
/* Trainer Card Styles */
.trainer-card {
border: none;
border-radius: 0;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
overflow: hidden;
background: white;
min-height: 400px;
}
.trainer-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}
.trainer-card .row {
height: 192px;
}
.image-container {
position: relative;
height: 100%;
overflow: hidden;
}
.pt-badge {
position: absolute;
top: 10px;
left: 10px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 5px 15px;
border-radius: 20px;
font-size: 0.8rem;
font-weight: bold;
z-index: 2;
}
.trainer-img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.3s ease;
}
.trainer-card:hover .trainer-img {
transform: scale(1.05);
}
.info-section {
padding: 15px;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
}
.trainer-name {
font-size: 1.2rem;
font-weight: bold;
color: #333;
margin-bottom: 5px;
}
.trainer-title {
font-size: 0.9rem;
color: #666;
margin-bottom: 10px;
}
.feature-list {
list-style: none;
padding: 0;
margin-bottom: 10px;
flex-grow: 1;
}
.feature-list li {
margin-bottom: 5px;
font-size: 0.8rem;
color: #555;
}
.feature-list i {
color: #28a745;
margin-right: 8px;
}
.rating-box {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
font-size: 0.8rem;
}
.stars {
color: #ffc107;
}
.stars i {
margin-right: 2px;
}
.trainer-buttons {
margin-top: auto;
}
.btn-book {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border: none;
color: white;
padding: 8px 15px;
border-radius: 20px;
font-weight: bold;
font-size: 0.8rem;
transition: all 0.3s ease;
}
.btn-book:hover {
background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
transform: translateY(-2px);
}
.btn-view {
background: transparent;
border: 2px solid #667eea;
color: #667eea;
padding: 8px 15px;
border-radius: 20px;
font-weight: bold;
font-size: 0.8rem;
transition: all 0.3s ease;
}
.btn-view:hover {
background: #667eea;
color: white;
transform: translateY(-2px);
}
</style> </style>
@endpush @endpush
@ -392,7 +538,7 @@ function initMap(lat, lng) {
draggable: true, draggable: true,
icon: L.divIcon({ icon: L.divIcon({
className: 'user-location-marker', className: 'user-location-marker',
html: '<i class="bi bi-geo-alt-fill pulse-marker" style="font-size: 36px; color: #dc3545; filter: drop-shadow(0 3px 6px rgba(0,0,0,0.4));"></i>', html: '<i class="bi bi-geo-alt-fill pulse-marker" style="font-size: 36px; color: #667eea; filter: drop-shadow(0 3px 6px rgba(0,0,0,0.4));"></i>',
iconSize: [36, 36], iconSize: [36, 36],
iconAnchor: [18, 36] iconAnchor: [18, 36]
}) })
@ -487,7 +633,91 @@ function displayClubs(clubs) {
container.innerHTML = ''; container.innerHTML = '';
if (clubs.length === 0) { let trainerAdded = false;
// Add dummy trainer card if category is 'all' or 'personal-trainers'
if (currentCategory === 'all' || currentCategory === 'personal-trainers') {
const trainerCard = document.createElement('div');
trainerCard.className = 'col';
trainerCard.innerHTML = `
<div class="card border shadow-sm overflow-hidden club-card" style="border-radius: 0; cursor: pointer; transition: all 0.3s ease;">
<!-- Cover Image -->
<div class="position-relative overflow-hidden" style="height: 192px;">
<img src="https://images.unsplash.com/photo-1583454110551-21f2fa2afe61?q=80&w=2070&auto=format&fit=crop"
alt="Personal Trainer"
loading="lazy"
class="w-100 h-100"
style="object-fit: cover; transition: transform 0.3s ease;">
<!-- Personal Trainer Badge -->
<div class="position-absolute" style="top: 8px; left: 8px;">
<span class="badge text-white px-3 py-1" style="background-color: #dc3545; border-radius: 9999px; font-size: 0.75rem; font-weight: 600;"><i class="fa-solid fa-user me-1"></i>Personal Trainer</span>
</div>
</div>
<!-- Card Body -->
<div class="p-4" style="background-color: white;">
<div class="mb-3">
<!-- Trainer Name -->
<h3 class="fw-semibold mb-2 club-title" style="font-size: 1.125rem; color: #1f2937; transition: color 0.3s ease;">Alex Thompson</h3>
<!-- Distance -->
<div class="d-flex align-items-center mb-1" style="font-size: 0.875rem; color: #667eea;">
<i class="fa fa-certificate me-1"></i>
<span class="fw-semibold">Certified Strength & Conditioning Coach</span>
</div>
<!-- Location -->
<div class="d-flex align-items-center text-muted" style="font-size: 0.875rem;">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="me-1 flex-shrink-0">
<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"></path>
<circle cx="12" cy="10" r="3"></circle>
</svg>
<span class="text-truncate">Ghassan Yusuf</span>
</div>
</div>
<div class="row g-2 text-center mb-3" style="font-size: 0.75rem;">
<div class="col-4">
<div class="p-2 rounded" style="background-color: rgba(102, 126, 234, 0.05);">
<i class="fa-solid fa-calendar mb-1" style="color: #6b7280; font-size: 1rem;"></i>
<p class="fw-semibold mb-0" style="color: #1f2937;">13</p>
<p class="text-muted mb-0">Years Exp.</p>
</div>
</div>
<div class="col-4">
<div class="p-2 rounded" style="background-color: rgba(102, 126, 234, 0.05);">
<i class="fa-solid fa-certificate mb-1" style="color: #6b7280; font-size: 1rem;"></i>
<p class="fw-semibold mb-0" style="color: #1f2937;">NASM</p>
<p class="text-muted mb-0">Packages</p>
</div>
</div>
<div class="col-4">
<div class="p-2 rounded" style="background-color: rgba(102, 126, 234, 0.05);">
<i class="fa-solid fa-star"></i>
<p class="fw-semibold mb-0" style="color: #1f2937;">5.0</p>
<p class="text-muted mb-0">Rating</p>
</div>
</div>
</div>
<!-- Action Buttons -->
<div class="d-flex gap-2">
<button class="btn btn-primary flex-fill fw-semibold" style="font-size: 0.875rem;">
<i class="fa-solid fa-calendar-plus me-1"></i>Book Session
</button>
<button class="btn btn-outline-primary flex-fill fw-semibold" style="font-size: 0.875rem;">
View Details
</button>
</div>
</div>
</div>
`;
container.appendChild(trainerCard);
trainerAdded = true;
}
if (clubs.length === 0 && !trainerAdded) {
noResultsContainer.style.display = 'flex'; noResultsContainer.style.display = 'flex';
return; return;
} }
@ -533,7 +763,7 @@ function displayClubs(clubs) {
<!-- Sports Club Badge - Top Left --> <!-- Sports Club Badge - Top Left -->
<div class="position-absolute" style="top: 8px; left: 8px;"> <div class="position-absolute" style="top: 8px; left: 8px;">
<span class="badge text-white px-3 py-1" style="background-color: #dc3545; border-radius: 9999px; font-size: 0.75rem; font-weight: 600;">Sports Club</span> <span class="badge text-white px-3 py-1" style="background-color: #dc3545; border-radius: 9999px; font-size: 0.75rem; font-weight: 600;"><i class="fa-solid fa-building me-1"></i>Sports Club</span>
</div> </div>
</div> </div>
@ -544,7 +774,7 @@ function displayClubs(clubs) {
<h3 class="fw-semibold mb-2 club-title" style="font-size: 1.125rem; color: #1f2937; transition: color 0.3s ease;">${club.club_name}</h3> <h3 class="fw-semibold mb-2 club-title" style="font-size: 1.125rem; color: #1f2937; transition: color 0.3s ease;">${club.club_name}</h3>
<!-- Distance --> <!-- Distance -->
<div class="d-flex align-items-center mb-1" style="font-size: 0.875rem; color: #dc3545;"> <div class="d-flex align-items-center mb-1" style="font-size: 0.875rem; color: #667eea;">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="me-1 flex-shrink-0"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="me-1 flex-shrink-0">
<polygon points="3 11 22 2 13 21 11 13 3 11"></polygon> <polygon points="3 11 22 2 13 21 11 13 3 11"></polygon>
</svg> </svg>
@ -564,8 +794,8 @@ function displayClubs(clubs) {
<!-- Stats Grid --> <!-- Stats Grid -->
<div class="row g-2 text-center mb-3" style="font-size: 0.75rem;"> <div class="row g-2 text-center mb-3" style="font-size: 0.75rem;">
<div class="col-4"> <div class="col-4">
<div class="p-2 rounded" style="background-color: rgba(220, 53, 69, 0.05);"> <div class="p-2 rounded" style="background-color: rgba(102, 126, 234, 0.05);">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mx-auto mb-1" style="color: #dc3545;"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mx-auto mb-1" style="color: #667eea;">
<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"></path> <path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"></path>
<circle cx="9" cy="7" r="4"></circle> <circle cx="9" cy="7" r="4"></circle>
<path d="M22 21v-2a4 4 0 0 0-3-3.87"></path> <path d="M22 21v-2a4 4 0 0 0-3-3.87"></path>
@ -576,8 +806,8 @@ function displayClubs(clubs) {
</div> </div>
</div> </div>
<div class="col-4"> <div class="col-4">
<div class="p-2 rounded" style="background-color: rgba(220, 53, 69, 0.05);"> <div class="p-2 rounded" style="background-color: rgba(102, 126, 234, 0.05);">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mx-auto mb-1" style="color: #dc3545;"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mx-auto mb-1" style="color: #667eea;">
<path d="M14.4 14.4 9.6 9.6"></path> <path d="M14.4 14.4 9.6 9.6"></path>
<path d="M18.657 21.485a2 2 0 1 1-2.829-2.828l-1.767 1.768a2 2 0 1 1-2.829-2.829l6.364-6.364a2 2 0 1 1 2.829 2.829l-1.768 1.767a2 2 0 1 1 2.828 2.829z"></path> <path d="M18.657 21.485a2 2 0 1 1-2.829-2.828l-1.767 1.768a2 2 0 1 1-2.829-2.829l6.364-6.364a2 2 0 1 1 2.829 2.829l-1.768 1.767a2 2 0 1 1 2.828 2.829z"></path>
<path d="m21.5 21.5-1.4-1.4"></path> <path d="m21.5 21.5-1.4-1.4"></path>
@ -589,8 +819,8 @@ function displayClubs(clubs) {
</div> </div>
</div> </div>
<div class="col-4"> <div class="col-4">
<div class="p-2 rounded" style="background-color: rgba(220, 53, 69, 0.05);"> <div class="p-2 rounded" style="background-color: rgba(102, 126, 234, 0.05);">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mx-auto mb-1" style="color: #dc3545;"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mx-auto mb-1" style="color: #667eea;">
<path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"></path> <path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"></path>
</svg> </svg>
<p class="fw-semibold mb-0" style="color: #1f2937;">0</p> <p class="fw-semibold mb-0" style="color: #1f2937;">0</p>
@ -601,7 +831,7 @@ function displayClubs(clubs) {
<!-- Action Buttons --> <!-- Action Buttons -->
<div class="d-flex gap-2"> <div class="d-flex gap-2">
<button class="btn btn-danger flex-fill fw-semibold" style="font-size: 0.875rem;"> <button class="btn btn-primary flex-fill fw-semibold" style="font-size: 0.875rem;">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="me-1"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="me-1">
<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"></path> <path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"></path>
<circle cx="9" cy="7" r="4"></circle> <circle cx="9" cy="7" r="4"></circle>
@ -610,7 +840,7 @@ function displayClubs(clubs) {
</svg> </svg>
Join Club Join Club
</button> </button>
<button class="btn btn-outline-danger flex-fill fw-semibold" style="font-size: 0.875rem;">View Details</button> <button class="btn btn-outline-primary flex-fill fw-semibold" style="font-size: 0.875rem;">View Details</button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -291,7 +291,7 @@
} }
/* ISSUE 4 FIX: Map container styles */ /* ISSUE 4 FIX: Map container styles */
#clubMap { #modalClubMap {
height: 400px; height: 400px;
width: 100%; width: 100%;
border-radius: 0.5rem; border-radius: 0.5rem;

View File

@ -266,7 +266,7 @@
const lng = parseFloat(document.getElementById('gps_long')?.value) || 50.5577; const lng = parseFloat(document.getElementById('gps_long')?.value) || 50.5577;
// ISSUE 4 FIX: Initialize map without attribution control // ISSUE 4 FIX: Initialize map without attribution control
clubMap = L.map('clubMap', { clubMap = L.map('modalClubMap', {
attributionControl: false // Disable attribution attributionControl: false // Disable attribution
}).setView([lat, lng], 13); }).setView([lat, lng], 13);

View File

@ -0,0 +1,286 @@
<!-- Member Create Modal -->
<div class="modal fade" id="memberCreateModal" tabindex="-1" aria-labelledby="memberCreateModalLabel" aria-hidden="true" data-bs-backdrop="static">
<div class="modal-dialog modal-dialog-centered modal-lg">
<div class="modal-content" style="border-radius: 1rem; border: none;">
<!-- Modal Header -->
<div class="modal-header border-0">
<div>
<h5 class="modal-title fw-bold" id="memberCreateModalLabel">Add Family Member</h5>
<p class="text-muted small mb-0">Fill in the details to add a new family member</p>
</div>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<!-- Modal Body -->
<div class="modal-body">
<form method="POST" action="{{ route('family.store') }}" id="memberCreateForm">
@csrf
<div class="mb-3">
<label for="full_name" class="form-label">Full Name <span class="text-danger">*</span></label>
<input type="text" class="form-control @error('full_name') is-invalid @enderror" id="full_name" name="full_name" value="{{ old('full_name') }}" required>
@error('full_name')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
<div class="mb-3">
<label for="email" class="form-label">Email Address <span class="text-muted">(Optional for children)</span></label>
<input type="email" class="form-control @error('email') is-invalid @enderror" id="email" name="email" value="{{ old('email') }}">
@error('email')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
<div class="mb-3">
<label for="mobile" class="form-label">Mobile Number</label>
<x-country-code-dropdown
name="mobile_code"
id="country_code"
:value="old('mobile_code', '+973')"
:required="false"
:error="$errors->first('mobile_code')">
<input id="mobile_number" type="tel"
class="form-control @error('mobile') is-invalid @enderror"
name="mobile"
value="{{ old('mobile') }}"
autocomplete="tel"
placeholder="Phone number">
</x-country-code-dropdown>
@error('mobile')
<div class="invalid-feedback d-block">{{ $message }}</div>
@enderror
</div>
<div class="row mb-3">
<div class="col-md-6">
<x-gender-dropdown
name="gender"
id="gender"
:value="old('gender')"
:required="true"
:error="$errors->first('gender')" />
</div>
<div class="col-md-6">
<x-birthdate-dropdown
name="birthdate"
id="birthdate"
label="Birthdate"
:value="old('birthdate')"
:required="true"
:min-age="0"
:max-age="120"
:error="$errors->first('birthdate')" />
</div>
</div>
<div class="row mb-3">
<div class="col-md-6">
<label for="blood_type" class="form-label">Blood Type</label>
<select class="form-select @error('blood_type') is-invalid @enderror" id="blood_type" name="blood_type">
<option value="">Select Blood Type</option>
<option value="A+" {{ old('blood_type') == 'A+' ? 'selected' : '' }}>A+</option>
<option value="A-" {{ old('blood_type') == 'A-' ? 'selected' : '' }}>A-</option>
<option value="B+" {{ old('blood_type') == 'B+' ? 'selected' : '' }}>B+</option>
<option value="B-" {{ old('blood_type') == 'B-' ? 'selected' : '' }}>B-</option>
<option value="AB+" {{ old('blood_type') == 'AB+' ? 'selected' : '' }}>AB+</option>
<option value="AB-" {{ old('blood_type') == 'AB-' ? 'selected' : '' }}>AB-</option>
<option value="O+" {{ old('blood_type') == 'O+' ? 'selected' : '' }}>O+</option>
<option value="O-" {{ old('blood_type') == 'O-' ? 'selected' : '' }}>O-</option>
<option value="Unknown" {{ old('blood_type') == 'Unknown' ? 'selected' : '' }}>Unknown</option>
</select>
@error('blood_type')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
<div class="col-md-6">
<x-nationality-dropdown
name="nationality"
id="nationality"
:value="old('nationality')"
:required="true"
:error="$errors->first('nationality')" />
</div>
</div>
<div class="mb-3">
<h5 class="form-label d-flex justify-content-between align-items-center">
Social Media Links
<button type="button" class="btn btn-outline-primary btn-sm" id="addSocialLink">
<i class="bi bi-plus"></i> Add Link
</button>
</h5>
<div id="socialLinksContainer">
@php
$existingLinks = old('social_links', []);
if (!is_array($existingLinks)) {
$existingLinks = [];
}
// Convert associative array to array of arrays for form display
$formLinks = [];
foreach ($existingLinks as $platform => $url) {
$formLinks[] = ['platform' => $platform, 'url' => $url];
}
@endphp
@foreach($formLinks as $index => $link)
<div class="social-link-row mb-3 d-flex align-items-end">
<div class="me-2 flex-grow-1">
<label class="form-label">Platform</label>
<select class="form-select platform-select" name="social_links[{{ $index }}][platform]" required>
<option value="">Select Platform</option>
<option value="facebook" {{ ($link['platform'] ?? '') == 'facebook' ? 'selected' : '' }}>Facebook</option>
<option value="twitter" {{ ($link['platform'] ?? '') == 'twitter' ? 'selected' : '' }}>Twitter/X</option>
<option value="instagram" {{ ($link['platform'] ?? '') == 'instagram' ? 'selected' : '' }}>Instagram</option>
<option value="linkedin" {{ ($link['platform'] ?? '') == 'linkedin' ? 'selected' : '' }}>LinkedIn</option>
<option value="youtube" {{ ($link['platform'] ?? '') == 'youtube' ? 'selected' : '' }}>YouTube</option>
<option value="tiktok" {{ ($link['platform'] ?? '') == 'tiktok' ? 'selected' : '' }}>TikTok</option>
<option value="snapchat" {{ ($link['platform'] ?? '') == 'snapchat' ? 'selected' : '' }}>Snapchat</option>
<option value="whatsapp" {{ ($link['platform'] ?? '') == 'whatsapp' ? 'selected' : '' }}>WhatsApp</option>
<option value="telegram" {{ ($link['platform'] ?? '') == 'telegram' ? 'selected' : '' }}>Telegram</option>
<option value="discord" {{ ($link['platform'] ?? '') == 'discord' ? 'selected' : '' }}>Discord</option>
<option value="reddit" {{ ($link['platform'] ?? '') == 'reddit' ? 'selected' : '' }}>Reddit</option>
<option value="pinterest" {{ ($link['platform'] ?? '') == 'pinterest' ? 'selected' : '' }}>Pinterest</option>
<option value="twitch" {{ ($link['platform'] ?? '') == 'twitch' ? 'selected' : '' }}>Twitch</option>
<option value="github" {{ ($link['platform'] ?? '') == 'github' ? 'selected' : '' }}>GitHub</option>
<option value="spotify" {{ ($link['platform'] ?? '') == 'spotify' ? 'selected' : '' }}>Spotify</option>
<option value="skype" {{ ($link['platform'] ?? '') == 'skype' ? 'selected' : '' }}>Skype</option>
<option value="slack" {{ ($link['platform'] ?? '') == 'slack' ? 'selected' : '' }}>Slack</option>
<option value="medium" {{ ($link['platform'] ?? '') == 'medium' ? 'selected' : '' }}>Medium</option>
<option value="vimeo" {{ ($link['platform'] ?? '') == 'vimeo' ? 'selected' : '' }}>Vimeo</option>
<option value="messenger" {{ ($link['platform'] ?? '') == 'messenger' ? 'selected' : '' }}>Messenger</option>
<option value="wechat" {{ ($link['platform'] ?? '') == 'wechat' ? 'selected' : '' }}>WeChat</option>
<option value="line" {{ ($link['platform'] ?? '') == 'line' ? 'selected' : '' }}>Line</option>
</select>
</div>
<div class="me-2 flex-grow-1">
<label class="form-label">URL</label>
<input type="url" class="form-control" name="social_links[{{ $index }}][url]" value="{{ $link['url'] ?? '' }}" placeholder="https://example.com/username" required>
</div>
<div class="mb-0">
<button type="button" class="btn btn-outline-danger btn-sm remove-social-link">
<i class="bi bi-trash"></i>
</button>
</div>
</div>
@endforeach
</div>
</div>
<div class="mb-3">
<label for="motto" class="form-label">Personal Motto</label>
<textarea class="form-control @error('motto') is-invalid @enderror" id="motto" name="motto" rows="3" placeholder="Enter personal motto or quote...">{{ old('motto') }}</textarea>
<div class="form-text">Share a personal motto or quote that inspires them.</div>
@error('motto')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
<div class="row mb-3">
<div class="col-md-6">
<label for="relationship_type" class="form-label">Relationship <span class="text-danger">*</span></label>
<select class="form-select @error('relationship_type') is-invalid @enderror" id="relationship_type" name="relationship_type" required>
<option value="">Select Relationship</option>
<option value="son" {{ old('relationship_type') == 'son' ? 'selected' : '' }}>Son</option>
<option value="daughter" {{ old('relationship_type') == 'daughter' ? 'selected' : '' }}>Daughter</option>
<option value="spouse" {{ old('relationship_type') == 'spouse' ? 'selected' : '' }}>Wife</option>
<option value="sponsor" {{ old('relationship_type') == 'sponsor' ? 'selected' : '' }}>Sponsor</option>
<option value="other" {{ old('relationship_type') == 'other' ? 'selected' : '' }}>Other</option>
</select>
@error('relationship_type')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
</div>
<div class="mb-3 form-check">
<input type="checkbox" class="form-check-input" id="is_billing_contact" name="is_billing_contact" value="1" {{ old('is_billing_contact') ? 'checked' : '' }}>
<label class="form-check-label" for="is_billing_contact">Is Billing Contact</label>
</div>
</form>
</div>
<!-- Modal Footer -->
<div class="modal-footer border-0">
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">Cancel</button>
<button type="submit" form="memberCreateForm" class="btn btn-primary">Add Family Member</button>
</div>
</div>
</div>
</div>
@push('scripts')
<script>
document.addEventListener('DOMContentLoaded', function() {
let socialLinkIndex = {{ count($formLinks ?? []) }};
// Add new social link row
document.getElementById('addSocialLink')?.addEventListener('click', function() {
addSocialLinkRow();
});
// Remove social link row
document.addEventListener('click', function(e) {
if (e.target.classList.contains('remove-social-link') || e.target.closest('.remove-social-link')) {
e.target.closest('.social-link-row').remove();
}
});
function addSocialLinkRow(platform = '', url = '') {
const container = document.getElementById('socialLinksContainer');
if (!container) return;
const row = document.createElement('div');
row.className = 'social-link-row mb-3 d-flex align-items-end';
row.innerHTML = `
<div class="me-2 flex-grow-1">
<label class="form-label">Platform</label>
<select class="form-select platform-select" name="social_links[${socialLinkIndex}][platform]" required>
<option value="">Select Platform</option>
<option value="facebook" ${platform === 'facebook' ? 'selected' : ''}>Facebook</option>
<option value="twitter" ${platform === 'twitter' ? 'selected' : ''}>Twitter/X</option>
<option value="instagram" ${platform === 'instagram' ? 'selected' : ''}>Instagram</option>
<option value="linkedin" ${platform === 'linkedin' ? 'selected' : ''}>LinkedIn</option>
<option value="youtube" ${platform === 'youtube' ? 'selected' : ''}>YouTube</option>
<option value="tiktok" ${platform === 'tiktok' ? 'selected' : ''}>TikTok</option>
<option value="snapchat" ${platform === 'snapchat' ? 'selected' : ''}>Snapchat</option>
<option value="whatsapp" ${platform === 'whatsapp' ? 'selected' : ''}>WhatsApp</option>
<option value="telegram" ${platform === 'telegram' ? 'selected' : ''}>Telegram</option>
<option value="discord" ${platform === 'discord' ? 'selected' : ''}>Discord</option>
<option value="reddit" ${platform === 'reddit' ? 'selected' : ''}>Reddit</option>
<option value="pinterest" ${platform === 'pinterest' ? 'selected' : ''}>Pinterest</option>
<option value="twitch" ${platform === 'twitch' ? 'selected' : ''}>Twitch</option>
<option value="github" ${platform === 'github' ? 'selected' : ''}>GitHub</option>
<option value="spotify" ${platform === 'spotify' ? 'selected' : ''}>Spotify</option>
<option value="skype" ${platform === 'skype' ? 'selected' : ''}>Skype</option>
<option value="slack" ${platform === 'slack' ? 'selected' : ''}>Slack</option>
<option value="medium" ${platform === 'medium' ? 'selected' : ''}>Medium</option>
<option value="vimeo" ${platform === 'vimeo' ? 'selected' : ''}>Vimeo</option>
<option value="messenger" ${platform === 'messenger' ? 'selected' : ''}>Messenger</option>
<option value="wechat" ${platform === 'wechat' ? 'selected' : ''}>WeChat</option>
<option value="line" ${platform === 'line' ? 'selected' : ''}>Line</option>
</select>
</div>
<div class="me-2 flex-grow-1">
<label class="form-label">URL</label>
<input type="url" class="form-control" name="social_links[${socialLinkIndex}][url]" value="${url}" placeholder="https://example.com/username" required>
</div>
<div class="mb-0">
<button type="button" class="btn btn-outline-danger btn-sm remove-social-link">
<i class="bi bi-trash"></i>
</button>
</div>
`;
container.appendChild(row);
socialLinkIndex++;
}
// Auto-open modal if there are validation errors
@if ($errors->any())
const modal = new bootstrap.Modal(document.getElementById('memberCreateModal'));
modal.show();
@endif
});
</script>
@endpush

View File

@ -182,6 +182,7 @@ Route::middleware(['auth', 'verified'])->group(function () {
Route::get('/family/create', function () { Route::get('/family/create', function () {
return redirect()->route('members.create'); return redirect()->route('members.create');
})->name('family.create'); })->name('family.create');
Route::post('/family', [FamilyController::class, 'store'])->name('family.store');
Route::get('/family/{id}', function ($id) { Route::get('/family/{id}', function ($id) {
return redirect()->route('member.show', $id); return redirect()->route('member.show', $id);
})->name('family.show'); })->name('family.show');