From 4713eab5955ce51ec83433da0455e5e63ded58a8 Mon Sep 17 00:00:00 2001 From: Raphael LACOTE Date: Thu, 5 Jun 2025 08:39:47 +0200 Subject: [PATCH] Modif de home.js pour ajouter le combat --- migrations/Version20250604225046.php | 53 ---------------------------- public/js/home.js | 19 ++++++++++ 2 files changed, 19 insertions(+), 53 deletions(-) delete mode 100644 migrations/Version20250604225046.php diff --git a/migrations/Version20250604225046.php b/migrations/Version20250604225046.php deleted file mode 100644 index c73ee1a..0000000 --- a/migrations/Version20250604225046.php +++ /dev/null @@ -1,53 +0,0 @@ -addSql(<<<'SQL' - CREATE TABLE emoji (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, rarity_id INTEGER NOT NULL, parent1_id INTEGER DEFAULT NULL, parent2_id INTEGER DEFAULT NULL, name VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL, strength DOUBLE PRECISION NOT NULL, toughness DOUBLE PRECISION NOT NULL, intelligence DOUBLE PRECISION NOT NULL, speed DOUBLE PRECISION NOT NULL, fights_won INTEGER NOT NULL, CONSTRAINT FK_B64BF632F3747573 FOREIGN KEY (rarity_id) REFERENCES rarity (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_B64BF632861B2665 FOREIGN KEY (parent1_id) REFERENCES emoji (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_B64BF63294AE898B FOREIGN KEY (parent2_id) REFERENCES emoji (id) NOT DEFERRABLE INITIALLY IMMEDIATE) - SQL); - $this->addSql(<<<'SQL' - CREATE INDEX IDX_B64BF632F3747573 ON emoji (rarity_id) - SQL); - $this->addSql(<<<'SQL' - CREATE INDEX IDX_B64BF632861B2665 ON emoji (parent1_id) - SQL); - $this->addSql(<<<'SQL' - CREATE INDEX IDX_B64BF63294AE898B ON emoji (parent2_id) - SQL); - $this->addSql(<<<'SQL' - CREATE TABLE rarity (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name VARCHAR(50) NOT NULL, drop_rate DOUBLE PRECISION NOT NULL) - SQL); - $this->addSql(<<<'SQL' - CREATE UNIQUE INDEX UNIQ_B7C0BE465E237E06 ON rarity (name) - SQL); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql(<<<'SQL' - DROP TABLE emoji - SQL); - $this->addSql(<<<'SQL' - DROP TABLE rarity - SQL); - } -} diff --git a/public/js/home.js b/public/js/home.js index fa7b9d6..7b1d028 100644 --- a/public/js/home.js +++ b/public/js/home.js @@ -50,7 +50,26 @@ document.addEventListener('DOMContentLoaded', () => { const name2 = selectedCards[1].dataset.name; if (type === 'combat') { + const id1 = selectedCards[0].dataset.id; + const id2 = selectedCards[1].dataset.id; + const t1 = 2; + const t2 = 3 console.log(`Combat : ${name1} contre ${name2}`); + window.location.href = `/emoji/fight/${t2}/${t1}`; + //window.location.href = `/emoji/fight/${id1}/${id2}`; + /*fetch(`/pim/popim/${id}`, { + method: 'GET', + headers: { + 'Accept': 'application/json' // ou 'text/html' selon ta route + } + }) + .then(response => { + if (!response.ok) { + throw new Error(`Erreur HTTP ${response.status}`); + } + return response.json(); // ou response.text() selon le retour attendu + })*/ + } else if (type === 'reproduction') { console.log(`Accouplement : ${name1} et ${name2}`); }