auditionadmin/resources/views/admin/scoring/edit.blade.php

87 lines
4.7 KiB
PHP

@php use App\Settings; @endphp
<x-layout.app x-data="{ rename: false }">
<x-slot:page_title>Scoring Rules</x-slot:page_title>
{{-- MAIN CARD--}}
<x-card.card x-show="! rename">
<x-card.heading>
<x-slot:subheading @click="rename = ! rename">Click here to rename</x-slot:subheading>
Scoring Guide: {{ $guide->name }}
</x-card.heading>
<div class="ml-6 -mt-2 mr-6">
<x-table.table with_title_area >
<x-slot:title>Subscores</x-slot:title>
<thead>
<tr>
<x-table.th>Name</x-table.th>
<x-table.th>Max Score</x-table.th>
<x-table.th>Weight</x-table.th>
<x-table.th>Display Order</x-table.th>
<x-table.th>Tiebreak Order</x-table.th>
<x-table.th>For Seating</x-table.th>
@if(Settings::advanceTo())
<x-table.th>For {{ Settings::advanceTo() }}</x-table.th>
@endif
<x-table.th spacer_only></x-table.th>
</tr>
</thead>
<x-table.body>
@foreach ($subscores as $subscore)
<tr>
<x-table.td>{{ $subscore->name }}</x-table.td>
<x-table.td>{{ $subscore->max_score }}</x-table.td>
<x-table.td>{{ $subscore->weight }}</x-table.td>
<x-table.td>{{ $subscore->display_order }}</x-table.td>
<x-table.td>{{ $subscore->tiebreak_order }}</x-table.td>
<x-table.td>{{ $subscore->for_seating ? 'Yes' : 'No' }}</x-table.td>
@if(Settings::advanceTo())
<x-table.td>{{ $subscore->for_advance ? 'Yes' : 'No' }}</x-table.td>
@endif
<x-table.td>
{{-- This came from AI, consider--}}
{{-- <x-form.form method="PATCH" action="/admin/scoring/guides/{{ $guide->id }}/subscore/{{ $subscore->id }}">--}}
{{-- <x-table.button>Save</x-table.button>--}}
{{-- <x-table.button @click="if(confirm('Are you sure?')) { $dispatch('delete', {id: {{ $subscore->id }} }) }">Delete</x-table.button>--}}
{{-- <x-table.button @click="rename = ! rename">Rename</x-table.button>--}}
{{-- </x-form.form>--}}
&nbsp;
</x-table.td>
</tr>
<template x-on:delete.window="document.querySelector('form[action=\'/admin/scoring/guides/{{ $guide->id }}/subscore/\'+event.detail.id+\'\']').submit()"></template>
@endforeach
</x-table.body>
<tfoot>
<tr><x-table.th class="!pb-0">Add Subscore</x-table.th></tr><tr>
<x-form.form method="POST" action="/admin/scoring/guides/{{ $guide->id }}/subscore">
<x-table.td><x-form.field name="name"></x-form.field></x-table.td>
<x-table.td><x-form.field name="max_score" type="number"></x-form.field></x-table.td>
<x-table.td><x-form.field name="weight" type="number"></x-form.field></x-table.td>
<x-table.td><x-form.field name="display_order"></x-form.field></x-table.td>
<x-table.td><x-form.field name="tiebreak_order"></x-form.field></x-table.td>
<x-table.td><x-form.toggle-checkbox name="for_seating" checked></x-form.toggle-checkbox></x-table.td>
@if(Settings::advanceTo())
<x-table.td><x-form.toggle-checkbox name="for_advance"></x-form.toggle-checkbox></x-table.td>
@endif
<td><x-table.button>Save</x-table.button></td>
</x-form.form>
</tr>
</tfoot>
</x-table.table>
</div>
</x-card.card>
{{-- RENAME CARD--}}
<x-card.card x-show="rename" @click.outside="rename = ! rename" x-cloak>
<x-card.heading>Rename</x-card.heading>
<x-form.form method="PATCH" action="/admin/scoring/guides/{{ $guide->id }}/edit" class="!pt-2">
<x-form.field name="name" label_text="New Name" value="" />
<x-form.footer submit-button-text="Rename"></x-form.footer>
</x-form.form>
</x-card.card>
<div class="mt-20">
@php(dump($guide))
</div>
</x-layout.app>