-
Notifications
You must be signed in to change notification settings - Fork 0
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
18 changed files
with
609 additions
and
119 deletions.
There are no files selected for viewing
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,3 @@ | ||
easyadmin: | ||
resource: . | ||
type: easyadmin.routes |
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,49 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DoctrineMigrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
/** | ||
* Auto-generated Migration: Please modify to your needs! | ||
*/ | ||
final class Version20241109231434 extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return 'Add new datastructures to store details about the checks done by the StuRa finance members'; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
// this up() migration is auto-generated, please modify it to your needs | ||
$this->addSql('ALTER TABLE bank_accounts_audit CHANGE diffs diffs JSON DEFAULT NULL'); | ||
$this->addSql('ALTER TABLE confirmation_token_audit CHANGE diffs diffs JSON DEFAULT NULL'); | ||
$this->addSql('ALTER TABLE confirmer_audit CHANGE diffs diffs JSON DEFAULT NULL'); | ||
$this->addSql('ALTER TABLE departments_audit CHANGE diffs diffs JSON DEFAULT NULL'); | ||
$this->addSql('ALTER TABLE payment_orders ADD mathematically_correct_checked TINYINT(1) NOT NULL, ADD mathematically_correct_timestamp DATETIME DEFAULT NULL, ADD mathematically_correct_confirmer_name VARCHAR(255) DEFAULT NULL, ADD mathematically_correct_confirmer_id INT DEFAULT NULL, ADD mathematically_correct_remark LONGTEXT DEFAULT NULL, ADD factually_correct_checked TINYINT(1) NOT NULL, ADD factually_correct_timestamp DATETIME DEFAULT NULL, ADD factually_correct_confirmer_name VARCHAR(255) DEFAULT NULL, ADD factually_correct_confirmer_id INT DEFAULT NULL, ADD factually_correct_remark LONGTEXT DEFAULT NULL'); | ||
|
||
//Move the old data from mathematically_correct and factually_correct to the new fields | ||
$this->addSql('UPDATE payment_orders SET mathematically_correct_checked = mathematically_correct, factually_correct_checked = factually_correct'); | ||
|
||
//Drop the old columns | ||
$this->addSql('ALTER TABLE payment_orders DROP mathematically_correct, DROP factually_correct'); | ||
$this->addSql('ALTER TABLE payment_orders_audit CHANGE diffs diffs JSON DEFAULT NULL'); | ||
$this->addSql('ALTER TABLE user_audit CHANGE diffs diffs JSON DEFAULT NULL'); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
// this down() migration is auto-generated, please modify it to your needs | ||
$this->addSql('ALTER TABLE bank_accounts_audit CHANGE diffs diffs LONGTEXT DEFAULT NULL'); | ||
$this->addSql('ALTER TABLE confirmation_token_audit CHANGE diffs diffs LONGTEXT DEFAULT NULL'); | ||
$this->addSql('ALTER TABLE confirmer_audit CHANGE diffs diffs LONGTEXT DEFAULT NULL'); | ||
$this->addSql('ALTER TABLE departments_audit CHANGE diffs diffs LONGTEXT DEFAULT NULL'); | ||
$this->addSql('ALTER TABLE payment_orders ADD mathematically_correct TINYINT(1) NOT NULL, ADD factually_correct TINYINT(1) NOT NULL, DROP mathematically_correct_checked, DROP mathematically_correct_timestamp, DROP mathematically_correct_confirmer_name, DROP mathematically_correct_confirmer_id, DROP mathematically_correct_remark, DROP factually_correct_checked, DROP factually_correct_timestamp, DROP factually_correct_confirmer_name, DROP factually_correct_confirmer_id, DROP factually_correct_remark'); | ||
$this->addSql('ALTER TABLE payment_orders_audit CHANGE diffs diffs LONGTEXT DEFAULT NULL'); | ||
$this->addSql('ALTER TABLE user_audit CHANGE diffs diffs LONGTEXT DEFAULT NULL'); | ||
} | ||
} |
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,23 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
|
||
namespace App\Admin\Field; | ||
|
||
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldInterface; | ||
use EasyCorp\Bundle\EasyAdminBundle\Field\FieldTrait; | ||
|
||
class CheckField implements FieldInterface | ||
{ | ||
use FieldTrait; | ||
|
||
public static function new(string $propertyName, ?string $label = null): self | ||
{ | ||
return (new self()) | ||
->setProperty($propertyName) | ||
->setLabel($label) | ||
->setTemplatePath('admin/field/check.html.twig') | ||
->setTextAlign('center'); | ||
} | ||
} |
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,38 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
|
||
namespace App\Admin\Filter; | ||
|
||
use Doctrine\ORM\QueryBuilder; | ||
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Filter\FilterInterface; | ||
use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto; | ||
use EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto; | ||
use EasyCorp\Bundle\EasyAdminBundle\Dto\FilterDataDto; | ||
use EasyCorp\Bundle\EasyAdminBundle\Filter\FilterTrait; | ||
use EasyCorp\Bundle\EasyAdminBundle\Form\Filter\Type\BooleanFilterType; | ||
|
||
class CheckFilter implements FilterInterface | ||
{ | ||
use FilterTrait; | ||
|
||
public static function new(string $propertyName, $label = null): self | ||
{ | ||
return (new self()) | ||
->setFilterFqcn(__CLASS__) | ||
->setProperty($propertyName) | ||
->setLabel($label) | ||
->setFormType(BooleanFilterType::class) | ||
->setFormTypeOption('translation_domain', 'EasyAdminBundle'); | ||
} | ||
|
||
public function apply(QueryBuilder $queryBuilder, FilterDataDto $filterDataDto, ?FieldDto $fieldDto, EntityDto $entityDto): void | ||
{ | ||
$property = $filterDataDto->getProperty() . '.checked'; | ||
|
||
$queryBuilder | ||
->andWhere(sprintf('%s.%s %s :%s', $filterDataDto->getEntityAlias(), $property, $filterDataDto->getComparison(), $filterDataDto->getParameterName())) | ||
->setParameter($filterDataDto->getParameterName(), $filterDataDto->getValue()); | ||
} | ||
} |
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.