-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
209 additions
and
24 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
assets/javascripts/controllers/ticket_editor_controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// This file is part of Bileto. | ||
// Copyright 2022 Probesys | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
import { Controller } from '@hotwired/stimulus'; | ||
|
||
export default class extends Controller { | ||
static get targets () { | ||
return ['solutionCheckbox', 'statusSelect']; | ||
} | ||
|
||
connect () { | ||
this.updateStatus(); | ||
} | ||
|
||
updateStatus () { | ||
const isSolution = this.solutionCheckboxTarget.checked; | ||
|
||
if (isSolution) { | ||
this.statusSelectTarget.value = 'resolved'; | ||
for (const option of this.statusSelectTarget.options) { | ||
option.disabled = option.value !== 'resolved'; | ||
} | ||
} else { | ||
for (const option of this.statusSelectTarget.options) { | ||
option.disabled = false; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
// This file is part of Bileto. | ||
// Copyright 2022 Probesys | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DoctrineMigrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
final class Version20221123133721MoveSolutionToTicket extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return 'Drop message.is_solution and replace by ticket.solution'; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
$dbPlatform = $this->connection->getDatabasePlatform()->getName(); | ||
if ($dbPlatform === 'postgresql') { | ||
$this->addSql('ALTER TABLE message DROP is_solution'); | ||
$this->addSql('ALTER TABLE ticket ADD solution_id INT DEFAULT NULL'); | ||
$this->addSql(<<<SQL | ||
ALTER TABLE ticket | ||
ADD CONSTRAINT FK_97A0ADA31C0BE183 | ||
FOREIGN KEY (solution_id) | ||
REFERENCES message (id) NOT DEFERRABLE INITIALLY IMMEDIATE | ||
SQL); | ||
$this->addSql('CREATE UNIQUE INDEX UNIQ_97A0ADA31C0BE183 ON ticket (solution_id)'); | ||
} elseif ($dbPlatform === 'mysql') { | ||
$this->addSql('ALTER TABLE message DROP is_solution'); | ||
$this->addSql('ALTER TABLE ticket ADD solution_id INT DEFAULT NULL'); | ||
$this->addSql(<<<SQL | ||
ALTER TABLE ticket | ||
ADD CONSTRAINT FK_97A0ADA31C0BE183 | ||
FOREIGN KEY (solution_id) | ||
REFERENCES message (id) | ||
SQL); | ||
$this->addSql('CREATE UNIQUE INDEX UNIQ_97A0ADA31C0BE183 ON ticket (solution_id)'); | ||
} | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
$dbPlatform = $this->connection->getDatabasePlatform()->getName(); | ||
if ($dbPlatform === 'postgresql') { | ||
$this->addSql('ALTER TABLE message ADD is_solution BOOLEAN NOT NULL'); | ||
$this->addSql('ALTER TABLE ticket DROP CONSTRAINT FK_97A0ADA31C0BE183'); | ||
$this->addSql('DROP INDEX UNIQ_97A0ADA31C0BE183'); | ||
$this->addSql('ALTER TABLE ticket DROP solution_id'); | ||
} elseif ($dbPlatform === 'mysql') { | ||
$this->addSql('ALTER TABLE ticket DROP FOREIGN KEY FK_97A0ADA31C0BE183'); | ||
$this->addSql('DROP INDEX UNIQ_97A0ADA31C0BE183 ON ticket'); | ||
$this->addSql('ALTER TABLE ticket DROP solution_id'); | ||
$this->addSql('ALTER TABLE message ADD is_solution TINYINT(1) NOT NULL'); | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.