diff options
| author | Karan Jayachandra <mail@karanjayachandra.com> | 2025-11-09 11:53:05 +0100 |
|---|---|---|
| committer | Karan Jayachandra <mail@karanjayachandra.com> | 2025-11-09 11:53:05 +0100 |
| commit | 6456fae865aae8b2ba398b5f78f2589c93d0643d (patch) | |
| tree | 1ab854ae7d554b83321532363ef3480d0988b988 /court.mjs | |
| parent | 34d77cd777bd44d7bfe0e3ab3379f9be256ca88b (diff) | |
Working regulars and courts
Diffstat (limited to 'court.mjs')
| -rw-r--r-- | court.mjs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/court.mjs b/court.mjs new file mode 100644 index 0000000..31f277f --- /dev/null +++ b/court.mjs @@ -0,0 +1,28 @@ +export class Court { + constructor(id) { + this.id = id; + this.name = "Court " + (id + 1); + this.status = true; + } + toggle() { + this.status = !this.status; + this.print(); + } + print() { + let status = this.status ? "active" : "inactive"; + console.log(this.name + " is currently " + status); + } + render() { + let type = this.status ? "" : 'class="outline secondary"'; + return `<button id=${"court_" + this.id} ${type}>${this.name}</button>`; + } +} + +export function generateCourts() { + let courts = []; + const totalCourts = 12; + for (let i = 0; i < totalCourts; i++) { + courts.push(new Court(i)); + } + return courts; +}
\ No newline at end of file |
