added finals forfeits
This commit is contained in:
@@ -312,30 +312,164 @@ templ seriesUploadPrompt(series *db.PlayoffSeries) {
|
||||
}
|
||||
}
|
||||
}}
|
||||
<div class="bg-mantle border border-surface1 rounded-lg p-6 text-center">
|
||||
<div
|
||||
x-data="{ open: false }"
|
||||
class="bg-mantle border border-surface1 rounded-lg p-6 text-center"
|
||||
>
|
||||
if hasPendingMatches {
|
||||
<div class="text-4xl mb-3">📋</div>
|
||||
<p class="text-lg text-text font-medium mb-2">Results Pending Review</p>
|
||||
<p class="text-sm text-subtext1 mb-4">Uploaded results are waiting to be reviewed and finalized.</p>
|
||||
<a
|
||||
href={ templ.SafeURL(fmt.Sprintf("/series/%d/results/review", series.ID)) }
|
||||
class="inline-block px-4 py-2 bg-green hover:bg-green/75 text-mantle rounded-lg
|
||||
font-medium transition hover:cursor-pointer"
|
||||
>
|
||||
Review Results
|
||||
</a>
|
||||
<div class="flex items-center justify-center gap-3">
|
||||
<a
|
||||
href={ templ.SafeURL(fmt.Sprintf("/series/%d/results/review", series.ID)) }
|
||||
class="inline-block px-4 py-2 bg-green hover:bg-green/75 text-mantle rounded-lg
|
||||
font-medium transition hover:cursor-pointer"
|
||||
>
|
||||
Review Results
|
||||
</a>
|
||||
<button
|
||||
type="button"
|
||||
@click="open = true"
|
||||
class="inline-block px-4 py-2 bg-red hover:bg-red/80 text-mantle rounded-lg
|
||||
font-medium transition hover:cursor-pointer"
|
||||
>
|
||||
Forfeit Series
|
||||
</button>
|
||||
</div>
|
||||
} else {
|
||||
<div class="text-4xl mb-3">📋</div>
|
||||
<p class="text-lg text-text font-medium mb-2">No Results Uploaded</p>
|
||||
<p class="text-sm text-subtext1 mb-4">Upload match log files to record the series results.</p>
|
||||
<a
|
||||
href={ templ.SafeURL(fmt.Sprintf("/series/%d/results/upload", series.ID)) }
|
||||
class="inline-block px-4 py-2 bg-blue hover:bg-blue/80 text-mantle rounded-lg
|
||||
font-medium transition hover:cursor-pointer"
|
||||
>
|
||||
Upload Match Logs
|
||||
</a>
|
||||
<div class="flex items-center justify-center gap-3">
|
||||
<a
|
||||
href={ templ.SafeURL(fmt.Sprintf("/series/%d/results/upload", series.ID)) }
|
||||
class="inline-block px-4 py-2 bg-blue hover:bg-blue/80 text-mantle rounded-lg
|
||||
font-medium transition hover:cursor-pointer"
|
||||
>
|
||||
Upload Match Logs
|
||||
</a>
|
||||
<button
|
||||
type="button"
|
||||
@click="open = true"
|
||||
class="inline-block px-4 py-2 bg-red hover:bg-red/80 text-mantle rounded-lg
|
||||
font-medium transition hover:cursor-pointer"
|
||||
>
|
||||
Forfeit Series
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
@seriesForfeitModal(series)
|
||||
</div>
|
||||
}
|
||||
|
||||
templ seriesForfeitModal(series *db.PlayoffSeries) {
|
||||
{{
|
||||
team1Name := seriesTeamName(series.Team1)
|
||||
team2Name := seriesTeamName(series.Team2)
|
||||
}}
|
||||
<div
|
||||
x-show="open"
|
||||
x-cloak
|
||||
class="fixed inset-0 z-50 overflow-y-auto"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
>
|
||||
<!-- Background overlay -->
|
||||
<div
|
||||
x-show="open"
|
||||
x-transition:enter="ease-out duration-300"
|
||||
x-transition:enter-start="opacity-0"
|
||||
x-transition:enter-end="opacity-100"
|
||||
x-transition:leave="ease-in duration-200"
|
||||
x-transition:leave-start="opacity-100"
|
||||
x-transition:leave-end="opacity-0"
|
||||
class="fixed inset-0 bg-base/75 transition-opacity"
|
||||
@click="open = false"
|
||||
></div>
|
||||
<!-- Modal panel -->
|
||||
<div class="flex min-h-full items-center justify-center p-4">
|
||||
<div
|
||||
x-show="open"
|
||||
x-transition:enter="ease-out duration-300"
|
||||
x-transition:enter-start="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
||||
x-transition:enter-end="opacity-100 translate-y-0 sm:scale-100"
|
||||
x-transition:leave="ease-in duration-200"
|
||||
x-transition:leave-start="opacity-100 translate-y-0 sm:scale-100"
|
||||
x-transition:leave-end="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
||||
class="relative transform overflow-hidden rounded-lg bg-mantle border-2 border-surface1 shadow-xl transition-all sm:w-full sm:max-w-lg"
|
||||
@click.stop
|
||||
x-data="{ forfeitTeam: '', forfeitReason: '' }"
|
||||
>
|
||||
<form
|
||||
hx-post={ fmt.Sprintf("/series/%d/forfeit", series.ID) }
|
||||
hx-swap="none"
|
||||
>
|
||||
<div class="bg-mantle px-4 pb-4 pt-5 sm:p-6">
|
||||
<div class="sm:flex sm:items-start">
|
||||
<div class="mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-red/10 sm:mx-0 sm:h-10 sm:w-10">
|
||||
<svg class="h-6 w-6 text-red" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="mt-3 text-center sm:ml-4 sm:mt-0 sm:text-left w-full">
|
||||
<h3 class="text-lg font-semibold leading-6 text-text">Forfeit Series</h3>
|
||||
<div class="mt-2">
|
||||
<p class="text-sm text-subtext0 mb-4">
|
||||
This will forfeit the entire series. The selected team will lose and the opponent
|
||||
will be declared the winner and advance. Any existing match results will be discarded.
|
||||
This action is immediate and cannot be undone.
|
||||
</p>
|
||||
<!-- Team Selection -->
|
||||
<div class="space-y-2">
|
||||
<label class="text-sm font-medium text-text">Which team is forfeiting?</label>
|
||||
<select
|
||||
name="forfeit_team"
|
||||
x-model="forfeitTeam"
|
||||
class="w-full px-3 py-2 bg-surface0 border border-surface1 rounded-lg text-text
|
||||
focus:border-red focus:outline-none hover:cursor-pointer"
|
||||
>
|
||||
<option value="">Select a team...</option>
|
||||
<option value="team1">{ team1Name }</option>
|
||||
<option value="team2">{ team2Name }</option>
|
||||
</select>
|
||||
</div>
|
||||
<!-- Reason -->
|
||||
<div class="mt-4 space-y-2">
|
||||
<label class="text-sm font-medium text-text">Reason (optional)</label>
|
||||
<textarea
|
||||
name="forfeit_reason"
|
||||
x-model="forfeitReason"
|
||||
placeholder="Provide a reason for the forfeit..."
|
||||
class="w-full px-3 py-2 bg-surface0 border border-surface1 rounded-lg text-text
|
||||
focus:border-blue focus:outline-none resize-none"
|
||||
rows="3"
|
||||
></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bg-surface0 px-4 py-3 sm:flex sm:flex-row-reverse sm:px-6 gap-2">
|
||||
<button
|
||||
type="submit"
|
||||
class="inline-flex w-full justify-center rounded-lg bg-red px-4 py-2 text-sm font-semibold text-mantle shadow-sm hover:bg-red/75 hover:cursor-pointer transition sm:w-auto"
|
||||
:disabled="forfeitTeam === ''"
|
||||
:class="forfeitTeam === '' && 'opacity-50 cursor-not-allowed'"
|
||||
>
|
||||
Confirm Forfeit
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
@click="open = false"
|
||||
class="mt-3 inline-flex w-full justify-center rounded-lg bg-surface1 px-4 py-2 text-sm font-semibold text-text shadow-sm hover:bg-surface2 hover:cursor-pointer transition sm:mt-0 sm:w-auto"
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -345,11 +479,21 @@ templ seriesScoreDisplay(series *db.PlayoffSeries) {
|
||||
team1Won := series.WinnerTeamID != nil && series.Team1ID != nil && *series.WinnerTeamID == *series.Team1ID
|
||||
team2Won := series.WinnerTeamID != nil && series.Team2ID != nil && *series.WinnerTeamID == *series.Team2ID
|
||||
isBye := series.Status == db.SeriesStatusBye
|
||||
isForfeit := series.IsForfeit
|
||||
forfeitTeamName := ""
|
||||
if isForfeit && series.ForfeitTeam != nil {
|
||||
forfeitTeamName = series.ForfeitTeam.Name
|
||||
}
|
||||
}}
|
||||
<div class="bg-mantle border border-surface1 rounded-lg overflow-hidden">
|
||||
<div class="bg-surface0 border-b border-surface1 px-4 py-3 flex items-center justify-between">
|
||||
<h2 class="text-lg font-bold text-text">Series Score</h2>
|
||||
<div class="flex items-center gap-2">
|
||||
if isForfeit {
|
||||
<span class="px-2 py-0.5 bg-red/20 text-red rounded text-xs font-medium">
|
||||
Forfeited
|
||||
</span>
|
||||
}
|
||||
@seriesStatusBadge(series.Status)
|
||||
@seriesFormatBadge(series.MatchesToWin)
|
||||
</div>
|
||||
@@ -386,7 +530,11 @@ templ seriesScoreDisplay(series *db.PlayoffSeries) {
|
||||
</div>
|
||||
<div class="flex flex-col items-center">
|
||||
<span class="text-4xl text-subtext0 font-light leading-none">–</span>
|
||||
if isCompleted {
|
||||
if isCompleted && isForfeit {
|
||||
<span class="px-1.5 py-0.5 bg-red/20 text-red rounded text-xs font-semibold mt-1">
|
||||
FORFEIT
|
||||
</span>
|
||||
} else if isCompleted {
|
||||
<span class="px-1.5 py-0.5 bg-green/20 text-green rounded text-xs font-semibold mt-1">
|
||||
FINAL
|
||||
</span>
|
||||
@@ -412,6 +560,18 @@ templ seriesScoreDisplay(series *db.PlayoffSeries) {
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
if isForfeit && forfeitTeamName != "" {
|
||||
<div class="text-center mt-2">
|
||||
<p class="text-sm text-red/80">
|
||||
{ forfeitTeamName } forfeited the series
|
||||
</p>
|
||||
if series.ForfeitReason != nil && *series.ForfeitReason != "" {
|
||||
<p class="text-xs text-subtext0 mt-1">
|
||||
{ *series.ForfeitReason }
|
||||
</p>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user