added leagues
This commit is contained in:
@@ -50,22 +50,27 @@ templ NewForm() {
|
||||
},
|
||||
// Check if form can be submitted
|
||||
updateCanSubmit() {
|
||||
this.canSubmit = !this.nameIsEmpty && this.nameIsUnique && !this.nameIsChecking &&
|
||||
!this.shortNameIsEmpty && this.shortNameIsUnique && !this.shortNameIsChecking &&
|
||||
this.canSubmit =
|
||||
!this.nameIsEmpty &&
|
||||
this.nameIsUnique &&
|
||||
!this.nameIsChecking &&
|
||||
!this.shortNameIsEmpty &&
|
||||
this.shortNameIsUnique &&
|
||||
!this.shortNameIsChecking &&
|
||||
!this.dateIsEmpty;
|
||||
},
|
||||
// Handle form submission
|
||||
handleSubmit() {
|
||||
this.isSubmitting = true;
|
||||
this.buttonText = 'Creating...';
|
||||
this.generalError = '';
|
||||
this.buttonText = "Creating...";
|
||||
this.generalError = "";
|
||||
// Set timeout for 10 seconds
|
||||
this.submitTimeout = setTimeout(() => {
|
||||
this.isSubmitting = false;
|
||||
this.buttonText = 'Create Season';
|
||||
this.generalError = 'Request timed out. Please try again.';
|
||||
this.buttonText = "Create Season";
|
||||
this.generalError = "Request timed out. Please try again.";
|
||||
}, 10000);
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
</script>
|
||||
@@ -147,6 +152,20 @@ templ NewForm() {
|
||||
x-text="shortNameError"
|
||||
></p>
|
||||
</div>
|
||||
<!-- Slap Version Field -->
|
||||
<div>
|
||||
<label for="slap_version" class="block text-sm font-medium mb-2">Slap Version</label>
|
||||
<select
|
||||
id="slap_version"
|
||||
name="slap_version"
|
||||
class="py-3 px-4 block w-full rounded-lg text-sm bg-base border-2 border-overlay0 focus:border-blue outline-none"
|
||||
required
|
||||
>
|
||||
<option value="rebound" selected>Rebound</option>
|
||||
<option value="slapshot1">Slapshot 1</option>
|
||||
</select>
|
||||
<p class="text-xs text-subtext1 mt-1">Select the game version for this season</p>
|
||||
</div>
|
||||
<!-- Start Date Field -->
|
||||
@datepicker.DatePicker("start_date", "start_date", "Start Date", "DD/MM/YYYY", true, "dateIsEmpty = $el.value === ''; resetDateErr(); if(dateIsEmpty) { dateError='Start date is required'; } updateCanSubmit();")
|
||||
<p
|
||||
@@ -168,7 +187,7 @@ templ NewForm() {
|
||||
x-text="buttonText"
|
||||
type="submit"
|
||||
class="w-full py-3 px-4 inline-flex justify-center items-center
|
||||
gap-x-2 rounded-lg border border-transparent transition text-base font-semibold
|
||||
gap-x-2 rounded-lg border border-transparent transition font-semibold
|
||||
bg-blue hover:bg-blue/75 text-mantle hover:cursor-pointer
|
||||
disabled:bg-blue/40 disabled:cursor-not-allowed"
|
||||
></button>
|
||||
|
||||
Reference in New Issue
Block a user