diff --git a/composer.json b/composer.json
index 02b3ff2..c3a088c 100644
--- a/composer.json
+++ b/composer.json
@@ -3,14 +3,16 @@
"license": "proprietary",
"require": {
"php": "^7.2.0",
+ "sensio/framework-extra-bundle": "^5.2",
"symfony/debug-pack": "^1.0",
"symfony/form": "^4.0",
"symfony/maker-bundle": "^1.0",
"symfony/orm-pack": "^1.0"
},
"require-dev": {
- "symfony/flex": "^1.0",
- "symfony/dotenv": "^4.0"
+ "roave/security-advisories": "dev-master",
+ "symfony/dotenv": "^4.0",
+ "symfony/flex": "^1.0"
},
"config": {
"preferred-install": {
diff --git a/composer.lock b/composer.lock
index 89b7cb7..aa93c6c 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "88c714a6bc903ca05f5c8e9220b78a27",
+ "content-hash": "2babc300973f97bc97e2ba8e4f35f47c",
"packages": [
{
"name": "doctrine/annotations",
@@ -1707,6 +1707,77 @@
],
"time": "2017-10-23T01:57:42+00:00"
},
+ {
+ "name": "sensio/framework-extra-bundle",
+ "version": "v5.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sensiolabs/SensioFrameworkExtraBundle.git",
+ "reference": "50e8b7292425957b8fd66887504430c89bcbd83c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/50e8b7292425957b8fd66887504430c89bcbd83c",
+ "reference": "50e8b7292425957b8fd66887504430c89bcbd83c",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/common": "^2.2",
+ "symfony/config": "^3.3|^4.0",
+ "symfony/dependency-injection": "^3.3|^4.0",
+ "symfony/framework-bundle": "^3.4|^4.0",
+ "symfony/http-kernel": "^3.3|^4.0"
+ },
+ "require-dev": {
+ "doctrine/doctrine-bundle": "^1.6",
+ "doctrine/orm": "^2.5",
+ "symfony/browser-kit": "^3.3|^4.0",
+ "symfony/dom-crawler": "^3.3|^4.0",
+ "symfony/expression-language": "^3.3|^4.0",
+ "symfony/finder": "^3.3|^4.0",
+ "symfony/monolog-bridge": "^3.0|^4.0",
+ "symfony/monolog-bundle": "^3.2",
+ "symfony/phpunit-bridge": "^3.3|^4.0",
+ "symfony/psr-http-message-bridge": "^0.3",
+ "symfony/security-bundle": "^3.3|^4.0",
+ "symfony/twig-bundle": "^3.3|^4.0",
+ "symfony/yaml": "^3.3|^4.0",
+ "twig/twig": "~1.12|~2.0",
+ "zendframework/zend-diactoros": "^1.3"
+ },
+ "suggest": {
+ "symfony/expression-language": "",
+ "symfony/psr-http-message-bridge": "To use the PSR-7 converters",
+ "symfony/security-bundle": ""
+ },
+ "type": "symfony-bundle",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "5.2.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Sensio\\Bundle\\FrameworkExtraBundle\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ }
+ ],
+ "description": "This bundle provides a way to configure your controllers with annotations",
+ "keywords": [
+ "annotations",
+ "controllers"
+ ],
+ "time": "2018-05-12T09:37:42+00:00"
+ },
{
"name": "symfony/cache",
"version": "v4.1.1",
@@ -4105,6 +4176,176 @@
}
],
"packages-dev": [
+ {
+ "name": "roave/security-advisories",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Roave/SecurityAdvisories.git",
+ "reference": "053766d789f6393e5bc0896635d35abf8d2d362e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/053766d789f6393e5bc0896635d35abf8d2d362e",
+ "reference": "053766d789f6393e5bc0896635d35abf8d2d362e",
+ "shasum": ""
+ },
+ "conflict": {
+ "3f/pygmentize": "<1.2",
+ "adodb/adodb-php": "<5.20.12",
+ "amphp/artax": "<1.0.6|>=2,<2.0.6",
+ "amphp/http": "<1.0.1",
+ "asymmetricrypt/asymmetricrypt": ">=0,<9.9.99",
+ "aws/aws-sdk-php": ">=3,<3.2.1",
+ "bugsnag/bugsnag-laravel": ">=2,<2.0.2",
+ "cakephp/cakephp": ">=1.3,<1.3.18|>=2,<2.4.99|>=2.5,<2.5.99|>=2.6,<2.6.12|>=2.7,<2.7.6|>=3,<3.0.15|>=3.1,<3.1.4|>=3.4,<3.4.14|>=3.5,<3.5.17|>=3.6,<3.6.4",
+ "cart2quote/module-quotation": ">=4.1.6,<=4.4.5|>=5,<5.4.4",
+ "cartalyst/sentry": "<=2.1.6",
+ "codeigniter/framework": "<=3.0.6",
+ "composer/composer": "<=1.0.0-alpha11",
+ "contao-components/mediaelement": ">=2.14.2,<2.21.1",
+ "contao/core": ">=2,<3.5.35",
+ "contao/core-bundle": ">=4,<4.4.18|>=4.5,<4.5.8",
+ "contao/listing-bundle": ">=4,<4.4.8",
+ "contao/newsletter-bundle": ">=4,<4.1",
+ "doctrine/annotations": ">=1,<1.2.7",
+ "doctrine/cache": ">=1,<1.3.2|>=1.4,<1.4.2",
+ "doctrine/common": ">=2,<2.4.3|>=2.5,<2.5.1",
+ "doctrine/dbal": ">=2,<2.0.8|>=2.1,<2.1.2",
+ "doctrine/doctrine-bundle": "<1.5.2",
+ "doctrine/doctrine-module": "<=0.7.1",
+ "doctrine/mongodb-odm": ">=1,<1.0.2",
+ "doctrine/mongodb-odm-bundle": ">=2,<3.0.1",
+ "doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1",
+ "dompdf/dompdf": ">=0.6,<0.6.2",
+ "drupal/core": ">=7,<7.59|>=8,<8.4.8|>=8.5,<8.5.3",
+ "drupal/drupal": ">=7,<7.59|>=8,<8.4.8|>=8.5,<8.5.3",
+ "erusev/parsedown": "<1.7",
+ "ezsystems/ezpublish-legacy": ">=5.3,<5.3.12.3|>=5.4,<5.4.11.3|>=2017.8,<2017.8.1.1|>=2017.12,<2017.12.2.1",
+ "firebase/php-jwt": "<2",
+ "friendsofsymfony/rest-bundle": ">=1.2,<1.2.2",
+ "friendsofsymfony/user-bundle": ">=1.2,<1.3.5",
+ "fuel/core": "<1.8.1",
+ "gree/jose": "<=2.2",
+ "gregwar/rst": "<1.0.3",
+ "guzzlehttp/guzzle": ">=6,<6.2.1|>=4.0.0-rc2,<4.2.4|>=5,<5.3.1",
+ "illuminate/auth": ">=4,<4.0.99|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.10",
+ "illuminate/database": ">=4,<4.0.99|>=4.1,<4.1.29",
+ "illuminate/encryption": ">=4,<=4.0.11|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.40|>=5.6,<5.6.15",
+ "joomla/session": "<1.3.1",
+ "kreait/firebase-php": ">=3.2,<3.8.1",
+ "laravel/framework": ">=4,<4.0.99|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.40|>=5.6,<5.6.15",
+ "laravel/socialite": ">=1,<1.0.99|>=2,<2.0.10",
+ "magento/magento1ce": "<1.9.3.9",
+ "magento/magento1ee": ">=1.9,<1.14.3.2",
+ "magento/product-community-edition": ">=2,<2.2.5",
+ "monolog/monolog": ">=1.8,<1.12",
+ "namshi/jose": "<2.2",
+ "onelogin/php-saml": "<2.10.4",
+ "oro/crm": ">=1.7,<1.7.4",
+ "oro/platform": ">=1.7,<1.7.4",
+ "padraic/humbug_get_contents": "<1.1.2",
+ "pagarme/pagarme-php": ">=0,<3",
+ "paragonie/random_compat": "<2",
+ "paypal/merchant-sdk-php": "<3.12",
+ "phpmailer/phpmailer": ">=5,<5.2.24",
+ "phpunit/phpunit": ">=4.8.19,<4.8.28|>=5.0.10,<5.6.3",
+ "phpxmlrpc/extras": "<0.6.1",
+ "propel/propel": ">=2.0.0-alpha1,<=2.0.0-alpha7",
+ "propel/propel1": ">=1,<=1.7.1",
+ "pusher/pusher-php-server": "<2.2.1",
+ "sabre/dav": ">=1.6,<1.6.99|>=1.7,<1.7.11|>=1.8,<1.8.9",
+ "sensiolabs/connect": "<4.2.3",
+ "shopware/shopware": "<5.3.7",
+ "silverstripe/cms": ">=3,<=3.0.11|>=3.1,<3.1.11",
+ "silverstripe/forum": "<=0.6.1|>=0.7,<=0.7.3",
+ "silverstripe/framework": ">=3,<3.3",
+ "silverstripe/userforms": "<3",
+ "simplesamlphp/saml2": "<1.10.6|>=2,<2.3.8|>=3,<3.1.4",
+ "simplesamlphp/simplesamlphp": "<1.15.2",
+ "simplesamlphp/simplesamlphp-module-infocard": "<1.0.1",
+ "slim/slim": "<2.6",
+ "socalnick/scn-social-auth": "<1.15.2",
+ "squizlabs/php_codesniffer": ">=1,<2.8.1|>=3,<3.0.1",
+ "stormpath/sdk": ">=0,<9.9.99",
+ "swiftmailer/swiftmailer": ">=4,<5.4.5",
+ "sylius/admin-bundle": ">=1,<1.0.17|>=1.1,<1.1.9|>=1.2,<1.2.2",
+ "sylius/sylius": ">=1,<1.0.17|>=1.1,<1.1.9|>=1.2,<1.2.2",
+ "symfony/dependency-injection": ">=2,<2.0.17",
+ "symfony/form": ">=2.3,<2.3.35|>=2.4,<2.6.12|>=2.7,<2.7.38|>=2.8,<2.8.31|>=3,<3.2.14|>=3.3,<3.3.13",
+ "symfony/framework-bundle": ">=2,<2.3.18|>=2.4,<2.4.8|>=2.5,<2.5.2",
+ "symfony/http-foundation": ">=2,<2.7.48|>=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11",
+ "symfony/http-kernel": ">=2,<2.3.29|>=2.4,<2.5.12|>=2.6,<2.6.8",
+ "symfony/intl": ">=2.7,<2.7.38|>=2.8,<2.8.31|>=3,<3.2.14|>=3.3,<3.3.13",
+ "symfony/routing": ">=2,<2.0.19",
+ "symfony/security": ">=2,<2.7.48|>=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11",
+ "symfony/security-bundle": ">=2,<2.7.48|>=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11",
+ "symfony/security-core": ">=2.4,<2.6.13|>=2.7,<2.7.9|>=2.7.30,<2.7.32|>=2.8,<2.8.37|>=3,<3.3.17|>=3.4,<3.4.7|>=4,<4.0.7",
+ "symfony/security-csrf": ">=2.4,<2.7.48|>=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11",
+ "symfony/security-guard": ">=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11",
+ "symfony/security-http": ">=2.3,<2.3.41|>=2.4,<2.7.48|>=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11",
+ "symfony/serializer": ">=2,<2.0.11",
+ "symfony/symfony": ">=2,<2.7.48|>=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11",
+ "symfony/translation": ">=2,<2.0.17",
+ "symfony/validator": ">=2,<2.0.24|>=2.1,<2.1.12|>=2.2,<2.2.5|>=2.3,<2.3.3",
+ "symfony/web-profiler-bundle": ">=2,<2.3.19|>=2.4,<2.4.9|>=2.5,<2.5.4",
+ "symfony/yaml": ">=2,<2.0.22|>=2.1,<2.1.7",
+ "thelia/backoffice-default-template": ">=2.1,<2.1.2",
+ "thelia/thelia": ">=2.1,<2.1.2|>=2.1.0-beta1,<2.1.3",
+ "titon/framework": ">=0,<9.9.99",
+ "twig/twig": "<1.20",
+ "typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.30|>=8,<8.7.17|>=9,<9.3.2",
+ "typo3/cms-core": ">=8,<8.7.17|>=9,<9.3.2",
+ "typo3/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.10|>=3.1,<3.1.7|>=3.2,<3.2.7|>=3.3,<3.3.5",
+ "typo3/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4",
+ "willdurand/js-translation-bundle": "<2.1.1",
+ "yiisoft/yii": ">=1.1.14,<1.1.15",
+ "yiisoft/yii2": "<2.0.15",
+ "yiisoft/yii2-bootstrap": "<2.0.4",
+ "yiisoft/yii2-dev": "<2.0.15",
+ "yiisoft/yii2-elasticsearch": "<2.0.5",
+ "yiisoft/yii2-gii": "<2.0.4",
+ "yiisoft/yii2-jui": "<2.0.4",
+ "yiisoft/yii2-redis": "<2.0.8",
+ "zendframework/zend-cache": ">=2.4,<2.4.8|>=2.5,<2.5.3",
+ "zendframework/zend-captcha": ">=2,<2.4.9|>=2.5,<2.5.2",
+ "zendframework/zend-crypt": ">=2,<2.4.9|>=2.5,<2.5.2",
+ "zendframework/zend-db": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.10|>=2.3,<2.3.5",
+ "zendframework/zend-diactoros": ">=1,<1.0.4",
+ "zendframework/zend-form": ">=2,<2.2.7|>=2.3,<2.3.1",
+ "zendframework/zend-http": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.3,<2.3.8|>=2.4,<2.4.1",
+ "zendframework/zend-json": ">=2.1,<2.1.6|>=2.2,<2.2.6",
+ "zendframework/zend-ldap": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.8|>=2.3,<2.3.3",
+ "zendframework/zend-mail": ">=2,<2.4.11|>=2.5,<2.7.2",
+ "zendframework/zend-navigation": ">=2,<2.2.7|>=2.3,<2.3.1",
+ "zendframework/zend-session": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.9|>=2.3,<2.3.4",
+ "zendframework/zend-validator": ">=2.3,<2.3.6",
+ "zendframework/zend-view": ">=2,<2.2.7|>=2.3,<2.3.1",
+ "zendframework/zend-xmlrpc": ">=2.1,<2.1.6|>=2.2,<2.2.6",
+ "zendframework/zendframework": ">=2,<2.4.11|>=2.5,<2.5.1",
+ "zendframework/zendframework1": "<1.12.20",
+ "zendframework/zendopenid": ">=2,<2.0.2",
+ "zendframework/zendxml": ">=1,<1.0.1",
+ "zetacomponents/mail": "<1.8.2",
+ "zf-commons/zfc-user": "<1.2.2",
+ "zfcampus/zf-apigility-doctrine": ">=1,<1.0.3",
+ "zfr/zfr-oauth2-server-module": "<0.1.2"
+ },
+ "type": "metapackage",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Marco Pivetta",
+ "email": "ocramius@gmail.com",
+ "role": "maintainer"
+ }
+ ],
+ "description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it",
+ "time": "2018-07-18T13:51:34+00:00"
+ },
{
"name": "symfony/dotenv",
"version": "v4.1.1",
@@ -4164,16 +4405,16 @@
},
{
"name": "symfony/flex",
- "version": "v1.0.83",
+ "version": "v1.0.84",
"source": {
"type": "git",
"url": "https://github.com/symfony/flex.git",
- "reference": "ec42e791e12ca37d73ac37dd8744ef763d39dbbe"
+ "reference": "7ede6446afac01e6e381db8c8c6fddb7c05a2aa7"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/flex/zipball/ec42e791e12ca37d73ac37dd8744ef763d39dbbe",
- "reference": "ec42e791e12ca37d73ac37dd8744ef763d39dbbe",
+ "url": "https://api.github.com/repos/symfony/flex/zipball/7ede6446afac01e6e381db8c8c6fddb7c05a2aa7",
+ "reference": "7ede6446afac01e6e381db8c8c6fddb7c05a2aa7",
"shasum": ""
},
"require": {
@@ -4207,12 +4448,14 @@
}
],
"description": "Composer plugin for Symfony",
- "time": "2018-07-13T07:56:08+00:00"
+ "time": "2018-07-19T06:01:11+00:00"
}
],
"aliases": [],
"minimum-stability": "stable",
- "stability-flags": [],
+ "stability-flags": {
+ "roave/security-advisories": 20
+ },
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
diff --git a/config/bundles.php b/config/bundles.php
index b4245b2..4500c28 100644
--- a/config/bundles.php
+++ b/config/bundles.php
@@ -5,10 +5,11 @@ return [
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
+ Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
+ Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
+ Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
- Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
- Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
- Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
+ Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
];
diff --git a/config/packages/doctrine.yaml b/config/packages/doctrine.yaml
index 8bb3410..81adbaf 100644
--- a/config/packages/doctrine.yaml
+++ b/config/packages/doctrine.yaml
@@ -9,7 +9,6 @@ doctrine:
dbal:
# configure these for your database server
driver: 'pdo_pgsql'
-
types:
money: App\Types\MoneyType
mapping_types:
diff --git a/config/packages/sensio_framework_extra.yaml b/config/packages/sensio_framework_extra.yaml
new file mode 100644
index 0000000..1821ccc
--- /dev/null
+++ b/config/packages/sensio_framework_extra.yaml
@@ -0,0 +1,3 @@
+sensio_framework_extra:
+ router:
+ annotations: false
diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml
index 3b315dc..a826401 100644
--- a/config/packages/twig.yaml
+++ b/config/packages/twig.yaml
@@ -1,4 +1,5 @@
twig:
+ form_themes: ['form_custom_layout.html.twig']
paths: ['%kernel.project_dir%/templates']
debug: '%kernel.debug%'
strict_variables: '%kernel.debug%'
diff --git a/public/css/app.css b/public/css/app.css
index 37678d3..a5cf2f4 100644
--- a/public/css/app.css
+++ b/public/css/app.css
@@ -25,7 +25,7 @@ table {
}
table.scroll {
- display: table;
+ /* display: table; */
}
/* ----------------------------------------------------------------------------
@@ -38,8 +38,24 @@ textarea {
/* ----------------------------------------------------------------------------
Miscellaneous
---------------------------------------------------------------------------- */
-
.edit-icon {
display: inline-block;
transform: rotateZ(90deg);
}
+
+.tabs {
+ border-width: 0;
+ border-bottom-width: 1px;
+}
+
+.tabs-title {
+ border-top-left-radius: 5px;
+ border-top-right-radius: 5px;
+ border: 1px solid #e6e6e6;
+ border-bottom: 0;
+ margin: 0 0.5rem;
+}
+
+.tabs-title > a {
+ font-size: 1rem;
+}
diff --git a/src/Controller/CameraController.php b/src/Controller/CameraController.php
index 02b588d..3171b4b 100644
--- a/src/Controller/CameraController.php
+++ b/src/Controller/CameraController.php
@@ -35,6 +35,7 @@ class CameraController extends Controller
$receivedItems = $em->getRepository(self::ENTITY)->findBy([
'received' => true
], [
+ 'isWorking' => 'ASC',
'brand' => 'ASC',
'mount' => 'ASC',
'model' => 'ASC',
@@ -47,9 +48,13 @@ class CameraController extends Controller
'model' => 'ASC',
]);
+ $working = array_filter($receivedItems, [$this, 'isWorking']);
+ $notWorking = array_filter($receivedItems, [$this, 'isNotWorking']);
+
return $this->render('camera/index.html.twig', [
'not_received' => $newItems,
- 'cameras' => $receivedItems,
+ 'not_working' => $notWorking,
+ 'working' => $working,
]);
}
@@ -133,4 +138,14 @@ class CameraController extends Controller
{
return $this->buildForm($camera, 'camera_deacquire');
}
+
+ private function isWorking(Camera $camera): bool
+ {
+ return $camera->getIsWorking();
+ }
+
+ private function isNotWorking(Camera $camera): bool
+ {
+ return !$this->isWorking($camera);
+ }
}
diff --git a/src/Controller/FormControllerTrait.php b/src/Controller/FormControllerTrait.php
index f54ece2..13d604c 100644
--- a/src/Controller/FormControllerTrait.php
+++ b/src/Controller/FormControllerTrait.php
@@ -2,13 +2,10 @@
namespace App\Controller;
-use Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\{Request, Response, RedirectResponse};
trait FormControllerTrait {
- use ControllerTrait;
-
/**
* Create a form generator
*/
diff --git a/src/Entity/FilmFormat.php b/src/Entity/FilmFormat.php
index 5f349dc..5c504ae 100644
--- a/src/Entity/FilmFormat.php
+++ b/src/Entity/FilmFormat.php
@@ -1,4 +1,4 @@
-add('isDigital')
->add('mount')
->add('model')
- ->add('filmFormat')
+ ->add('filmFormat', ChoiceType::class, [
+ 'choices' => [
+ 'Small Format' => [
+ '35mm' => '135',
+ '110' => '110',
+ ],
+ 'Medium Format' => [
+ '120' => '120',
+ '127' => '127',
+ '620' => '620',
+ ],
+ ]
+ ])
->add('cropFactor')
->add('serial')
- ->add('purchasePrice')
+ ->add('purchasePrice', MoneyType::class, [
+ 'currency' => 'USD',
+ ])
->add('batteryType')
->add('received')
->add('isWorking')
diff --git a/src/Form/CameraTypeType.php b/src/Form/CameraTypeType.php
index b5afcc3..c59ab4f 100644
--- a/src/Form/CameraTypeType.php
+++ b/src/Form/CameraTypeType.php
@@ -2,7 +2,9 @@
namespace App\Form;
-use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
+use Symfony\Component\Form\{
+ AbstractType, FormBuilderInterface
+};
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\Exception\AccessException;
@@ -10,31 +12,31 @@ use App\Entity\CameraType;
class CameraTypeType extends AbstractType
{
- /**
- * {@inheritdoc}
- */
- public function buildForm(FormBuilderInterface $builder, array $options): void
- {
- $builder->add('type')
+ /**
+ * {@inheritdoc}
+ */
+ public function buildForm(FormBuilderInterface $builder, array $options): void
+ {
+ $builder->add('type')
->add('description');
- }
+ }
- /**
- * {@inheritdoc}
+ /**
+ * {@inheritdoc}
* @throws AccessException
- */
- public function configureOptions(OptionsResolver $resolver): void
- {
- $resolver->setDefaults(array(
- 'data_class' => CameraType::class
- ));
- }
+ */
+ public function configureOptions(OptionsResolver $resolver): void
+ {
+ $resolver->setDefaults(array(
+ 'data_class' => CameraType::class
+ ));
+ }
- /**
- * {@inheritdoc}
- */
- public function getBlockPrefix(): string
- {
- return 'camerabundle_cameratype';
- }
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix(): string
+ {
+ return 'camerabundle_cameratype';
+ }
}
diff --git a/src/Form/FilmType.php b/src/Form/FilmType.php
index 7361b7a..d6f2697 100644
--- a/src/Form/FilmType.php
+++ b/src/Form/FilmType.php
@@ -4,6 +4,7 @@ namespace App\Form;
use App\Entity\Film;
use Symfony\Component\Form\AbstractType;
+use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -20,12 +21,37 @@ class FilmType extends AbstractType
->add('filmAlias')
->add('filmSpeedAsa')
->add('filmSpeedDin')
- ->add('filmFormat')
- ->add('filmBase')
+ ->add('filmFormat', ChoiceType::class, [
+ 'choices' => [
+ 'Small Format' => [
+ '35mm' => '135',
+ '110' => '110',
+ ],
+ 'Medium Format' => [
+ '120' => '120',
+ '127' => '127',
+ '620' => '620',
+ ],
+ ]
+ ])
+ ->add('filmBase',ChoiceType::class, [
+ 'choices' => [
+ 'Cellulose Triacetate' => 'Cellulose Triacetate',
+ 'Polyester' => 'Polyester',
+ 'Polyethylene Naphtalate' => 'Polyethylene Naphtalate',
+ ]
+ ])
->add('unusedRolls')
->add('rollsInCamera')
->add('developedRolls')
- ->add('chemistry')
+ ->add('chemistry', ChoiceType::class, [
+ 'choices' => [
+ 'B & W' => 'B & W',
+ 'C-41' => 'C-41',
+ 'E-6' => 'E-6',
+ 'Other' => 'Other',
+ ]
+ ])
->add('notes');
}
diff --git a/src/Form/FlashType.php b/src/Form/FlashType.php
index 02f6c35..679d4bb 100644
--- a/src/Form/FlashType.php
+++ b/src/Form/FlashType.php
@@ -2,7 +2,9 @@
namespace App\Form;
-use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
+use Symfony\Component\Form\{
+ AbstractType, FormBuilderInterface
+};
use Symfony\Component\OptionsResolver\Exception\AccessException;
use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -10,43 +12,43 @@ use App\Entity\Flash;
class FlashType extends AbstractType
{
- /**
- * {@inheritdoc}
- */
- public function buildForm(FormBuilderInterface $builder, array $options): void
- {
- $builder->add('brand')
- ->add('model')
- ->add('isAutoFlash')
- ->add('isTtl')
- ->add('ttlType')
- ->add('isPTtl')
- ->add('pTtlType')
- ->add('guideNumber')
- ->add('purchasePrice')
- ->add('batteries')
- ->add('notes')
- ->add('serial')
- ->add('received')
- ->add('formerlyOwned');
- }
+ /**
+ * {@inheritdoc}
+ */
+ public function buildForm(FormBuilderInterface $builder, array $options): void
+ {
+ $builder->add('brand')
+ ->add('model')
+ ->add('isAutoFlash')
+ ->add('isTtl')
+ ->add('ttlType')
+ ->add('isPTtl')
+ ->add('pTtlType')
+ ->add('guideNumber')
+ ->add('purchasePrice')
+ ->add('batteries')
+ ->add('notes')
+ ->add('serial')
+ ->add('received')
+ ->add('formerlyOwned');
+ }
- /**
- * {@inheritdoc}
+ /**
+ * {@inheritdoc}
* @throws AccessException
- */
- public function configureOptions(OptionsResolver $resolver): void
- {
- $resolver->setDefaults(array(
- 'data_class' => Flash::class
- ));
- }
+ */
+ public function configureOptions(OptionsResolver $resolver): void
+ {
+ $resolver->setDefaults(array(
+ 'data_class' => Flash::class
+ ));
+ }
- /**
- * {@inheritdoc}
- */
- public function getBlockPrefix(): string
- {
- return 'camerabundle_flash';
- }
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix(): string
+ {
+ return 'camerabundle_flash';
+ }
}
diff --git a/src/Form/LensesType.php b/src/Form/LensesType.php
index d40fb86..03f2389 100644
--- a/src/Form/LensesType.php
+++ b/src/Form/LensesType.php
@@ -2,7 +2,9 @@
namespace App\Form;
-use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
+use Symfony\Component\Form\{
+ AbstractType, Extension\Core\Type\ChoiceType, FormBuilderInterface
+};
use Symfony\Component\OptionsResolver\Exception\AccessException;
use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -10,17 +12,30 @@ use App\Entity\Lenses;
class LensesType extends AbstractType
{
- /**
- * {@inheritdoc}
- */
- public function buildForm(FormBuilderInterface $builder, array $options): void
- {
- $builder->add('brand')
+ /**
+ * {@inheritdoc}
+ */
+ public function buildForm(FormBuilderInterface $builder, array $options): void
+ {
+ $builder->add('brand')
->add('coatings')
->add('productLine')
->add('model')
->add('mount')
- ->add('imageSize')
+ ->add('imageSize', ChoiceType::class, [
+ 'choices' => [
+ 'Small Format' => [
+ '35mm' => '35mm',
+ 'APS-C' => 'APS-C',
+ 'Micro 4/3' => 'Micro 4/3',
+ ],
+ 'Medium Format' => [
+ '6x6' => '6x6cm',
+ '6x4.5' => '6x4.5cm',
+ '4x4' => '4x4cm',
+ ]
+ ]
+ ])
->add('minFStop')
->add('maxFStop')
->add('minFocalLength')
@@ -36,24 +51,24 @@ class LensesType extends AbstractType
->add('designElements')
->add('designGroups')
->add('apertureBlades');
- }
+ }
- /**
- * {@inheritdoc}
+ /**
+ * {@inheritdoc}
* @throws AccessException
- */
- public function configureOptions(OptionsResolver $resolver): void
- {
- $resolver->setDefaults(array(
- 'data_class' => Lenses::class
- ));
- }
+ */
+ public function configureOptions(OptionsResolver $resolver): void
+ {
+ $resolver->setDefaults(array(
+ 'data_class' => Lenses::class
+ ));
+ }
- /**
- * {@inheritdoc}
- */
- public function getBlockPrefix(): string
- {
- return 'camerabundle_lenses';
- }
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix(): string
+ {
+ return 'camerabundle_lenses';
+ }
}
diff --git a/src/Types/MoneyType.php b/src/Types/MoneyType.php
index c50cb30..0f554d6 100644
--- a/src/Types/MoneyType.php
+++ b/src/Types/MoneyType.php
@@ -16,7 +16,7 @@ class MoneyType extends Type {
public function convertToPHPValue($value, AbstractPlatform $platform)
{
- return new Money($value);
+ return (float)(new Money($value))->__toString();
}
public function getName(): string
diff --git a/src/ValueObject/Money.php b/src/ValueObject/Money.php
index 9076cc4..5964a45 100644
--- a/src/ValueObject/Money.php
+++ b/src/ValueObject/Money.php
@@ -7,12 +7,12 @@ class Money {
public function __construct($value)
{
- $this->value = str_replace(['$',','], '', $value);
+ $this->value = (float)str_replace(['$',','], '', $value);
}
public function getValue()
{
- return str_replace(['$',','], '', $this->value);
+ return (float)str_replace(['$',','], '', $this->value);
}
public function __toString()
diff --git a/symfony.lock b/symfony.lock
index 7d196ea..1db1689 100644
--- a/symfony.lock
+++ b/symfony.lock
@@ -101,6 +101,18 @@
"psr/simple-cache": {
"version": "1.0.0"
},
+ "roave/security-advisories": {
+ "version": "dev-master"
+ },
+ "sensio/framework-extra-bundle": {
+ "version": "5.2",
+ "recipe": {
+ "repo": "github.com/symfony/recipes",
+ "branch": "master",
+ "version": "5.2",
+ "ref": "fb7e19da7f013d0d422fa9bce16f5c510e27609b"
+ }
+ },
"symfony/cache": {
"version": "v3.3.13"
},
diff --git a/templates/camera/edit.html.twig b/templates/camera/edit.html.twig
index 3e0b612..755cbf8 100644
--- a/templates/camera/edit.html.twig
+++ b/templates/camera/edit.html.twig
@@ -17,7 +17,8 @@
{{ form_start(edit_form) }}
- {{ form_widget(edit_form) }}
+ {{ form_errors(edit_form) }}
+ {{ form_widget(edit_form) }}
Update
{{ form_end(edit_form) }}
diff --git a/templates/camera/index.html.twig b/templates/camera/index.html.twig
index a1316a5..8add0eb 100644
--- a/templates/camera/index.html.twig
+++ b/templates/camera/index.html.twig
@@ -1,8 +1,6 @@
{% extends 'base.html.twig' %}
-{% block title %}
- Camera 📷 CRUD - Cameras
-{% endblock %}
+{% block title %}Camera 📷 CRUD - Cameras{% endblock %}
{% block body %}
Cameras
@@ -15,10 +13,30 @@
-
{% endblock %}
diff --git a/templates/cameratype/index.html.twig b/templates/cameratype/index.html.twig
index eb8fcb8..81539e9 100644
--- a/templates/cameratype/index.html.twig
+++ b/templates/cameratype/index.html.twig
@@ -15,36 +15,34 @@
-
+
{% endblock %}
diff --git a/templates/film/index.html.twig b/templates/film/index.html.twig
index fec32cf..97a001e 100644
--- a/templates/film/index.html.twig
+++ b/templates/film/index.html.twig
@@ -1,8 +1,6 @@
{% extends 'base.html.twig' %}
-{% block title %}
- Camera 📷 CRUD - Film
-{% endblock %}
+{% block title %}Camera 📷 CRUD - Film{% endblock %}
{% block body %}
Film
@@ -15,64 +13,27 @@
-
+
-
{% endblock %}
diff --git a/templates/form.html.twig b/templates/form.html.twig
index fd69925..b101166 100644
--- a/templates/form.html.twig
+++ b/templates/form.html.twig
@@ -2,16 +2,13 @@
{% block stylesheets %}
{% endblock %}
{% block body %}
-
+
{% block form %}{% endblock %}
diff --git a/templates/form_custom_layout.html.twig b/templates/form_custom_layout.html.twig
new file mode 100644
index 0000000..753a1c3
--- /dev/null
+++ b/templates/form_custom_layout.html.twig
@@ -0,0 +1,334 @@
+{% extends "form_div_layout.html.twig" %}
+
+{# Based on Foundation 5 Doc #}
+{# Widgets #}
+
+{% block form_widget_simple -%}
+ {% if errors|length > 0 -%}
+ {% set attr = attr|merge({class: (attr.class|default('') ~ ' error')|trim}) %}
+ {% endif %}
+ {{- parent() -}}
+{%- endblock form_widget_simple %}
+
+{% block textarea_widget -%}
+ {% if errors|length > 0 -%}
+ {% set attr = attr|merge({class: (attr.class|default('') ~ ' error')|trim}) %}
+ {% endif %}
+ {{- parent() -}}
+{%- endblock textarea_widget %}
+
+{% block button_widget -%}
+ {% set attr = attr|merge({class: (attr.class|default('') ~ ' button')|trim}) %}
+ {{- parent() -}}
+{%- endblock button_widget %}
+
+{% block money_widget -%}
+
+ {% set prepend = '{{' == money_pattern[0:2] %}
+ {% if not prepend %}
+
+ {{ money_pattern|form_encode_currency }}
+
+ {% endif %}
+
+ {{- block('form_widget_simple') -}}
+
+ {% if prepend %}
+
+ {{ money_pattern|form_encode_currency }}
+
+ {% endif %}
+
+{%- endblock money_widget %}
+
+{% block percent_widget -%}
+
+
+ {{- block('form_widget_simple') -}}
+
+
+ %
+
+
+{%- endblock percent_widget %}
+
+{% block datetime_widget -%}
+ {% if widget == 'single_text' %}
+ {{- block('form_widget_simple') -}}
+ {% else %}
+ {% set attr = attr|merge({class: (attr.class|default('') ~ ' row')|trim}) %}
+
+
{{ form_errors(form.date) }}
+
{{ form_errors(form.time) }}
+
+
+
{{ form_widget(form.date, { datetime: true } ) }}
+
{{ form_widget(form.time, { datetime: true } ) }}
+
+ {% endif %}
+{%- endblock datetime_widget %}
+
+{% block date_widget -%}
+ {% if widget == 'single_text' %}
+ {{- block('form_widget_simple') -}}
+ {% else %}
+ {% set attr = attr|merge({class: (attr.class|default('') ~ ' row')|trim}) %}
+ {% if datetime is not defined or not datetime %}
+
+ {% endif %}
+ {{- date_pattern|replace({
+ '{{ year }}': '
' ~ form_widget(form.year) ~ '
',
+ '{{ month }}': '
' ~ form_widget(form.month) ~ '
',
+ '{{ day }}': '
' ~ form_widget(form.day) ~ '
',
+ })|raw -}}
+ {% if datetime is not defined or not datetime %}
+
+ {% endif %}
+ {% endif %}
+{%- endblock date_widget %}
+
+{% block time_widget -%}
+ {% if widget == 'single_text' %}
+ {{- block('form_widget_simple') -}}
+ {% else %}
+ {% set attr = attr|merge({class: (attr.class|default('') ~ ' row')|trim}) %}
+ {% if datetime is not defined or false == datetime %}
+
+ {% endif %}
+ {% if with_seconds %}
+
{{ form_widget(form.hour) }}
+
+
+
+ :
+
+
+ {{ form_widget(form.minute) }}
+
+
+
+
+
+
+ :
+
+
+ {{ form_widget(form.second) }}
+
+
+
+ {% else %}
+
{{ form_widget(form.hour) }}
+
+
+
+ :
+
+
+ {{ form_widget(form.minute) }}
+
+
+
+ {% endif %}
+ {% if datetime is not defined or false == datetime %}
+
+ {% endif %}
+ {% endif %}
+{%- endblock time_widget %}
+
+{% block choice_widget_collapsed -%}
+ {% if errors|length > 0 -%}
+ {% set attr = attr|merge({class: (attr.class|default('') ~ ' error')|trim}) %}
+ {% endif %}
+
+ {% if multiple -%}
+ {% set attr = attr|merge({style: (attr.style|default('') ~ ' height: auto; background-image: none;')|trim}) %}
+ {% endif %}
+
+ {% if required and placeholder is none and not placeholder_in_choices and not multiple -%}
+ {% set required = false %}
+ {%- endif -%}
+
+ {% if placeholder is not none -%}
+ {{ translation_domain is same as(false) ? placeholder : placeholder|trans({}, translation_domain) }}
+ {%- endif %}
+ {%- if preferred_choices|length > 0 -%}
+ {% set options = preferred_choices %}
+ {{- block('choice_widget_options') -}}
+ {% if choices|length > 0 and separator is not none -%}
+ {{ separator }}
+ {%- endif %}
+ {%- endif -%}
+ {% set options = choices -%}
+ {{- block('choice_widget_options') -}}
+
+{%- endblock choice_widget_collapsed %}
+
+{% block choice_widget_expanded -%}
+ {% if '-inline' in label_attr.class|default('') %}
+
+ {% for child in form %}
+ {{ form_widget(child, {
+ parent_label_class: label_attr.class|default(''),
+ }) }}
+ {% endfor %}
+
+ {% else %}
+
+ {% for child in form %}
+ {{ form_widget(child, {
+ parent_label_class: label_attr.class|default(''),
+ }) }}
+ {% endfor %}
+
+ {% endif %}
+{%- endblock choice_widget_expanded %}
+
+{% block checkbox_widget -%}
+ {% set parent_label_class = parent_label_class|default('') %}
+ {% if errors|length > 0 -%}
+ {% set attr = attr|merge({class: (attr.class|default('') ~ ' error')|trim}) %}
+ {% endif %}
+ {% if 'checkbox-inline' in parent_label_class %}
+ {{ form_label(form, null, { widget: parent() }) }}
+ {% else %}
+
+ {{ form_label(form, null, { widget: parent() }) }}
+
+ {% endif %}
+{%- endblock checkbox_widget %}
+
+{% block radio_widget -%}
+ {% set parent_label_class = parent_label_class|default('') %}
+ {% if 'radio-inline' in parent_label_class %}
+ {{ form_label(form, null, { widget: parent() }) }}
+ {% else %}
+ {% if errors|length > 0 -%}
+ {% set attr = attr|merge({class: (attr.class|default('') ~ ' error')|trim}) %}
+ {% endif %}
+
+ {{ form_label(form, null, { widget: parent() }) }}
+
+ {% endif %}
+{%- endblock radio_widget %}
+
+{# Labels #}
+
+{% block form_label -%}
+ {% if errors|length > 0 -%}
+ {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' error')|trim}) %}
+ {% endif %}
+ {{- parent() -}}
+{%- endblock form_label %}
+
+{% block choice_label -%}
+ {% if errors|length > 0 -%}
+ {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' error')|trim}) %}
+ {% endif %}
+ {# remove the checkbox-inline and radio-inline class, it's only useful for embed labels #}
+ {% set label_attr = label_attr|merge({class: label_attr.class|default('')|replace({'checkbox-inline': '', 'radio-inline': ''})|trim}) %}
+ {{- block('form_label') -}}
+{%- endblock choice_label %}
+
+{% block checkbox_label -%}
+ {{- block('checkbox_radio_label') -}}
+{%- endblock checkbox_label %}
+
+{% block radio_label -%}
+ {{- block('checkbox_radio_label') -}}
+{%- endblock radio_label %}
+
+{% block checkbox_radio_label -%}
+ {% if required %}
+ {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) %}
+ {% endif %}
+ {% if errors|length > 0 -%}
+ {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' error')|trim}) %}
+ {% endif %}
+ {% if parent_label_class is defined %}
+ {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ parent_label_class)|trim}) %}
+ {% endif %}
+ {% if label is empty %}
+ {%- if label_format is not empty -%}
+ {% set label = label_format|replace({
+ '%name%': name,
+ '%id%': id,
+ }) %}
+ {%- else -%}
+ {% set label = name|humanize %}
+ {%- endif -%}
+ {% endif %}
+
+ {{ widget|raw }}
+ {{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }}
+
+{%- endblock checkbox_radio_label %}
+
+{# Rows #}
+
+{% block form_row -%}
+ {%- set widget_attr = {} -%}
+ {%- if help is not empty -%}
+ {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
+ {%- endif -%}
+
+
+ {{- form_label(form) -}}
+ {{- form_widget(form, widget_attr) -}}
+ {{- form_help(form) -}}
+ {{- form_errors(form) -}}
+
+
+{%- endblock form_row %}
+
+{% block choice_row -%}
+ {% set force_error = true %}
+ {{ block('form_row') }}
+{%- endblock choice_row %}
+
+{% block date_row -%}
+ {% set force_error = true %}
+ {{ block('form_row') }}
+{%- endblock date_row %}
+
+{% block time_row -%}
+ {% set force_error = true %}
+ {{ block('form_row') }}
+{%- endblock time_row %}
+
+{% block datetime_row -%}
+ {% set force_error = true %}
+ {{ block('form_row') }}
+{%- endblock datetime_row %}
+
+{% block checkbox_row -%}
+
+
+ {{ form_widget(form) }}
+ {{ form_errors(form) }}
+
+
+{%- endblock checkbox_row %}
+
+{% block radio_row -%}
+
+
+ {{ form_widget(form) }}
+ {{ form_errors(form) }}
+
+
+{%- endblock radio_row %}
+
+{# Errors #}
+
+{% block form_errors -%}
+ {% if errors|length > 0 -%}
+ {% if form is not rootform %}
{% else %} {% endif %}
+ {%- for error in errors -%}
+ {{ error.message }}
+ {% if not loop.last %}, {% endif %}
+ {%- endfor -%}
+ {% if form is not rootform %}{% else %}
{% endif %}
+ {%- endif %}
+{%- endblock form_errors %}
diff --git a/templates/lenses/index.html.twig b/templates/lenses/index.html.twig
index 4a56d57..10dc9e5 100644
--- a/templates/lenses/index.html.twig
+++ b/templates/lenses/index.html.twig
@@ -1,8 +1,6 @@
{% extends 'base.html.twig' %}
-{% block title %}
- Camera 📷 CRUD - Lenses
-{% endblock %}
+{% block title %}Camera 📷 CRUD - Lenses{% endblock %}
{% block body %}
Lenses
@@ -15,10 +13,27 @@
-
-
-
{% endblock %}