Browse Source

Initial commit

pull/1/head
Franck J 2 years ago
commit
18733cb91d
  1. 34
      .env
  2. 5
      .env.test
  3. 5
      .gitattributes
  4. 84
      .gitignore
  5. 18
      .vscode/sftp.json
  6. 24
      assets/css/app.css
  7. 5
      assets/css/global.scss
  8. 39
      assets/css/pdf.css
  9. BIN
      assets/images/logo.png
  10. 23
      assets/js/app.js
  11. 1
      assets/js/pdf.js
  12. 42
      bin/console
  13. 87
      composer.json
  14. 7930
      composer.lock
  15. 23
      config/bootstrap.php
  16. 16
      config/bundles.php
  17. 3
      config/packages/assets.yaml
  18. 19
      config/packages/cache.yaml
  19. 4
      config/packages/dev/debug.yaml
  20. 16
      config/packages/dev/easy_log_handler.yaml
  21. 19
      config/packages/dev/monolog.yaml
  22. 6
      config/packages/dev/web_profiler.yaml
  23. 18
      config/packages/doctrine.yaml
  24. 5
      config/packages/doctrine_migrations.yaml
  25. 16
      config/packages/framework.yaml
  26. 3
      config/packages/mailer.yaml
  27. 16
      config/packages/notifier.yaml
  28. 20
      config/packages/prod/doctrine.yaml
  29. 24
      config/packages/prod/monolog.yaml
  30. 3
      config/packages/prod/routing.yaml
  31. 4
      config/packages/prod/webpack_encore.yaml
  32. 3
      config/packages/routing.yaml
  33. 23
      config/packages/security.yaml
  34. 3
      config/packages/sensio_framework_extra.yaml
  35. 4
      config/packages/test/framework.yaml
  36. 12
      config/packages/test/monolog.yaml
  37. 2
      config/packages/test/twig.yaml
  38. 3
      config/packages/test/validator.yaml
  39. 6
      config/packages/test/web_profiler.yaml
  40. 2
      config/packages/test/webpack_encore.yaml
  41. 6
      config/packages/translation.yaml
  42. 2
      config/packages/twig.yaml
  43. 8
      config/packages/validator.yaml
  44. 25
      config/packages/webpack_encore.yaml
  45. 3
      config/routes.yaml
  46. 7
      config/routes/annotations.yaml
  47. 3
      config/routes/dev/framework.yaml
  48. 7
      config/routes/dev/web_profiler.yaml
  49. 29
      config/services.yaml
  50. 10059
      package-lock.json
  51. 22
      package.json
  52. 33
      phpunit.xml.dist
  53. 9656
      public/build/app.css
  54. 63
      public/build/app.js
  55. 23
      public/build/entrypoints.json
  56. BIN
      public/build/images/logo.png
  57. 9
      public/build/manifest.json
  58. 42
      public/build/pdf.css
  59. 30
      public/build/pdf.js
  60. 155
      public/build/runtime.js
  61. 17806
      public/build/vendors~app.js
  62. 27
      public/index.php
  63. 125
      src/Controller/FactureController.php
  64. 108
      src/Entity/Facture.php
  65. 41
      src/Form/FactureType.php
  66. 54
      src/Kernel.php
  67. 35
      src/Migrations/Version20200404184835.php
  68. 50
      src/Repository/FactureRepository.php
  69. 551
      symfony.lock
  70. 50
      templates/base.html.twig
  71. 58
      templates/facture/_form.html.twig
  72. 22
      templates/facture/create.html.twig
  73. 62
      templates/facture/index.html.twig
  74. 229
      templates/facture/pdf.html.twig
  75. 19
      templates/include/footer.html.twig
  76. 12
      templates/include/header.html.twig
  77. 11
      tests/bootstrap.php
  78. 0
      translations/.gitignore
  79. 89
      webpack.config.js
  80. 7200
      yarn.lock

34
.env

@ -0,0 +1,34 @@
# In all environments, the following files are loaded if they exist,
# the latter taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
# * .env.$APP_ENV committed environment-specific defaults
# * .env.$APP_ENV.local uncommitted environment-specific overrides
#
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=634024f1ef72439e5adbdca9872f901a
#TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
#TRUSTED_HOSTS='^(localhost|example\.com)$'
###< symfony/framework-bundle ###
###> symfony/mailer ###
# MAILER_DSN=smtp://localhost
###< symfony/mailer ###
###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# For a PostgreSQL database, use: "postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=11&charset=utf8"
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
# DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7
DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7
###< doctrine/doctrine-bundle ###

5
.env.test

@ -0,0 +1,5 @@
# define your env variables for the test env here
KERNEL_CLASS='App\Kernel'
APP_SECRET='$ecretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=999999
PANTHER_APP_ENV=panther

5
.gitattributes

@ -0,0 +1,5 @@
# Auto detect text files and perform LF normalization
* text=auto
# Ignore language files
* linguist-vendored
*.js linguist-vendored=false

84
.gitignore

@ -0,0 +1,84 @@
# Cache and logs (Symfony2)
/app/cache/*
/app/logs/*
!app/cache/.gitkeep
!app/logs/.gitkeep
# Email spool folder
/app/spool/*
# Cache, session files and logs (Symfony3)
/var/cache/*
/var/logs/*
/var/sessions/*
!var/cache/.gitkeep
!var/logs/.gitkeep
!var/sessions/.gitkeep
# Logs (Symfony4)
/var/log/*
!var/log/.gitkeep
# Parameters
/app/config/parameters.yml
/app/config/parameters.ini
# Managed by Composer
/app/bootstrap.php.cache
/var/bootstrap.php.cache
/bin/*
!bin/console
!bin/symfony_requirements
/vendor/
# Assets and user uploads
/web/bundles/
/web/uploads/
# PHPUnit
/app/phpunit.xml
/phpunit.xml
# Build data
/build/
# Composer PHAR
/composer.phar
# Backup entities generated with doctrine:generate:entities command
**/Entity/*~
# Embedded web-server pid file
/.web-server-pid
/public/build/fonts/glyphicons-*
/public/build/images/glyphicons-*
###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###
###> symfony/phpunit-bridge ###
.phpunit
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###
###> friendsofphp/php-cs-fixer ###
/.php_cs
/.php_cs.cache
###< friendsofphp/php-cs-fixer ###
###> symfony/webpack-encore-bundle ###
/node_modules/
npm-debug.log
yarn-error.log
###< symfony/webpack-encore-bundle ###
# Cache (Current project)
/var/data/*

18
.vscode/sftp.json

@ -0,0 +1,18 @@
{
"name": "DomPDF_project",
"host": "1r21m.ftp.infomaniak.com",
"protocol": "sftp",
"port": 22,
"username": "1r21m_m4ld0ror",
"remotePath": "/home/clients/328fc4e9e4c475e3fe8290cf6aa65537/web/dompdfdemo/",
"uploadOnSave": false,
"ignore": [
".vscode",
".git",
".env",
".DS_Store",
"/var/cache /*",
"/var/logs/*",
"/var/data/*"
]
}

24
assets/css/app.css

@ -0,0 +1,24 @@
body {
background-color: floralwhite !important;
color: #312f31 !important;
/*-- pour demarrer sous la navbar fixe --*/
padding-top: 7em;
}
#page-container {
position: relative;
min-height: 100vh;
}
#content-wrap {
/* Footer height */
padding-bottom: 2.5rem;
}
#footer {
position: absolute;
bottom: 0;
width: 100%;
/* Footer height */
height: 2.5rem;
}

5
assets/css/global.scss

@ -0,0 +1,5 @@
// customize some Bootstrap variables
$primary: darken(#428bca, 20%);
// the ~ allows you to reference things in node_modules
@import "~bootstrap/scss/bootstrap";

39
assets/css/pdf.css

@ -0,0 +1,39 @@
/*
Created on : 05 avril 2020
Author : Franck J.
*/
/*---------------------------------------------
CSS for the DomPDF layout
----------------------------------------------*/
/*----------- main components --------*/
html,
body {
height: 100%;
width: 100%;
padding-top: 0%;
}
p {
font-size: x-small !important;
}
/*----------- table components --------*/
table {
width: 100%;
}
th,
td {
margin: 0;
padding: 0;
}
.td-vertical-align {
vertical-align: top;
}
.tfoot-border-bottom {
border-bottom: 1px solid #fff
}

BIN
assets/images/logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

23
assets/js/app.js

@ -0,0 +1,23 @@
/*
* Welcome to your app's main JavaScript file!
*
* We recommend including the built version of this JavaScript file
* (and its CSS file) in your base layout (base.html.twig).
*/
// any CSS you import will output into a single css file (app.css in this case)
import '../css/app.css';
require('../css/global.scss');
// Need jQuery? Install it with "yarn add jquery", then uncomment to import it.
import $ from 'jquery';
// this "modifies" the jquery module: adding behavior to it
// the bootstrap module doesn't export/return anything
require('bootstrap');
// or you can include specific pieces
// require('bootstrap/js/dist/tooltip');
// require('bootstrap/js/dist/popover');
console.log('Hello Webpack Encore! Edit me in assets/js/app.js');

1
assets/js/pdf.js

@ -0,0 +1 @@
import '../css/pdf.css';

42
bin/console

@ -0,0 +1,42 @@
#!/usr/bin/env php
<?php
use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\ErrorHandler\Debug;
if (!in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
}
set_time_limit(0);
require dirname(__DIR__).'/vendor/autoload.php';
if (!class_exists(Application::class)) {
throw new LogicException('You need to add "symfony/framework-bundle" as a Composer dependency.');
}
$input = new ArgvInput();
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
}
if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}
require dirname(__DIR__).'/config/bootstrap.php';
if ($_SERVER['APP_DEBUG']) {
umask(0000);
if (class_exists(Debug::class)) {
Debug::enable();
}
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$application = new Application($kernel);
$application->run($input);

87
composer.json

@ -0,0 +1,87 @@
{
"type": "project",
"license": "proprietary",
"require": {
"php": "^7.2.5",
"ext-ctype": "*",
"ext-iconv": "*",
"dompdf/dompdf": "^0.8.5",
"sensio/framework-extra-bundle": "^5.1",
"symfony/asset": "5.0.*",
"symfony/console": "5.0.*",
"symfony/dotenv": "5.0.*",
"symfony/expression-language": "5.0.*",
"symfony/flex": "^1.3.1",
"symfony/form": "5.0.*",
"symfony/framework-bundle": "5.0.*",
"symfony/http-client": "5.0.*",
"symfony/intl": "5.0.*",
"symfony/mailer": "5.0.*",
"symfony/monolog-bundle": "^3.1",
"symfony/notifier": "5.0.*",
"symfony/orm-pack": "*",
"symfony/process": "5.0.*",
"symfony/security-bundle": "5.0.*",
"symfony/serializer-pack": "*",
"symfony/string": "5.0.*",
"symfony/translation": "5.0.*",
"symfony/twig-pack": "*",
"symfony/validator": "5.0.*",
"symfony/var-dumper": "5.0.*",
"symfony/web-link": "5.0.*",
"symfony/webpack-encore-bundle": "^1.7",
"symfony/yaml": "5.0.*"
},
"require-dev": {
"symfony/debug-pack": "*",
"symfony/maker-bundle": "^1.0",
"symfony/profiler-pack": "*",
"symfony/test-pack": "*"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php72": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "5.0.*"
}
}
}

7930
composer.lock

File diff suppressed because it is too large

23
config/bootstrap.php

@ -0,0 +1,23 @@
<?php
use Symfony\Component\Dotenv\Dotenv;
require dirname(__DIR__).'/vendor/autoload.php';
// Load cached env vars if the .env.local.php file exists
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && (!isset($env['APP_ENV']) || ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV'])) {
foreach ($env as $k => $v) {
$_ENV[$k] = $_ENV[$k] ?? (isset($_SERVER[$k]) && 0 !== strpos($k, 'HTTP_') ? $_SERVER[$k] : $v);
}
} elseif (!class_exists(Dotenv::class)) {
throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
} else {
// load all the .env files
(new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env');
}
$_SERVER += $_ENV;
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';

16
config/bundles.php

@ -0,0 +1,16 @@
<?php
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::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],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
];

3
config/packages/assets.yaml

@ -0,0 +1,3 @@
framework:
assets:
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'

19
config/packages/cache.yaml

@ -0,0 +1,19 @@
framework:
cache:
# Unique name of your app: used to compute stable namespaces for cache keys.
#prefix_seed: your_vendor_name/app_name
# The "app" cache stores to the filesystem by default.
# The data in this cache should persist between deploys.
# Other options include:
# Redis
#app: cache.adapter.redis
#default_redis_provider: redis://localhost
# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
#app: cache.adapter.apcu
# Namespaced pools use the above "app" backend by default
#pools:
#my.dedicated.cache: null

4
config/packages/dev/debug.yaml

@ -0,0 +1,4 @@
debug:
# Forwards VarDumper Data clones to a centralized server allowing to inspect dumps on CLI or in your browser.
# See the "server:dump" command to start a new server.
dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%"

16
config/packages/dev/easy_log_handler.yaml

@ -0,0 +1,16 @@
services:
EasyCorp\EasyLog\EasyLogHandler:
public: false
arguments: ['%kernel.logs_dir%/%kernel.environment%.log']
#// FIXME: How to add this configuration automatically without messing up with the monolog configuration?
#monolog:
# handlers:
# buffered:
# type: buffer
# handler: easylog
# channels: ['!event']
# level: debug
# easylog:
# type: service
# id: EasyCorp\EasyLog\EasyLogHandler

19
config/packages/dev/monolog.yaml

@ -0,0 +1,19 @@
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
channels: ["!event"]
# uncomment to get logging in your browser
# you may have to allow bigger header sizes in your Web server configuration
#firephp:
# type: firephp
# level: info
#chromephp:
# type: chromephp
# level: info
console:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine", "!console"]

6
config/packages/dev/web_profiler.yaml

@ -0,0 +1,6 @@
web_profiler:
toolbar: true
intercept_redirects: false
framework:
profiler: { only_exceptions: false }

18
config/packages/doctrine.yaml

@ -0,0 +1,18 @@
doctrine:
dbal:
url: '%env(resolve:DATABASE_URL)%'
# IMPORTANT: You MUST configure your server version,
# either here or in the DATABASE_URL env var (see .env file)
#server_version: '5.7'
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App

5
config/packages/doctrine_migrations.yaml

@ -0,0 +1,5 @@
doctrine_migrations:
dir_name: '%kernel.project_dir%/src/Migrations'
# namespace is arbitrary but should be different from App\Migrations
# as migrations classes should NOT be autoloaded
namespace: DoctrineMigrations

16
config/packages/framework.yaml

@ -0,0 +1,16 @@
framework:
secret: '%env(APP_SECRET)%'
#csrf_protection: true
#http_method_override: true
# Enables session support. Note that the session will ONLY be started if you read or write from it.
# Remove or comment this section to explicitly disable session support.
session:
handler_id: null
cookie_secure: auto
cookie_samesite: lax
#esi: true
#fragments: true
php_errors:
log: true

3
config/packages/mailer.yaml

@ -0,0 +1,3 @@
framework:
mailer:
dsn: '%env(MAILER_DSN)%'

16
config/packages/notifier.yaml

@ -0,0 +1,16 @@
framework:
notifier:
#chatter_transports:
# slack: '%env(SLACK_DSN)%'
# telegram: '%env(TELEGRAM_DSN)%'
#texter_transports:
# twilio: '%env(TWILIO_DSN)%'
# nexmo: '%env(NEXMO_DSN)%'
channel_policy:
# use chat/slack, chat/telegram, sms/twilio or sms/nexmo
urgent: ['email']
high: ['email']
medium: ['email']
low: ['email']
admin_recipients:
- { email: admin@example.com }

20
config/packages/prod/doctrine.yaml

@ -0,0 +1,20 @@
doctrine:
orm:
auto_generate_proxy_classes: false
metadata_cache_driver:
type: pool
pool: doctrine.system_cache_pool
query_cache_driver:
type: pool
pool: doctrine.system_cache_pool
result_cache_driver:
type: pool
pool: doctrine.result_cache_pool
framework:
cache:
pools:
doctrine.result_cache_pool:
adapter: cache.app
doctrine.system_cache_pool:
adapter: cache.system

24
config/packages/prod/monolog.yaml

@ -0,0 +1,24 @@
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
excluded_http_codes: [404, 405]
buffer_size: 50 # How many messages should be saved? Prevent memory leaks
nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
console:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine"]
deprecation:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.deprecations.log"
deprecation_filter:
type: filter
handler: deprecation
max_level: info
channels: ["php"]

3
config/packages/prod/routing.yaml

@ -0,0 +1,3 @@
framework:
router:
strict_requirements: null

4
config/packages/prod/webpack_encore.yaml

@ -0,0 +1,4 @@
#webpack_encore:
# Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
# Available in version 1.2
#cache: true

3
config/packages/routing.yaml

@ -0,0 +1,3 @@
framework:
router:
utf8: true

23
config/packages/security.yaml

@ -0,0 +1,23 @@
security:
# https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
providers:
users_in_memory: { memory: null }
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
anonymous: lazy
provider: users_in_memory
# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#firewalls-authentication
# https://symfony.com/doc/current/security/impersonating_user.html
# switch_user: true
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
# - { path: ^/admin, roles: ROLE_ADMIN }
# - { path: ^/profile, roles: ROLE_USER }

3
config/packages/sensio_framework_extra.yaml

@ -0,0 +1,3 @@
sensio_framework_extra:
router:
annotations: false

4
config/packages/test/framework.yaml

@ -0,0 +1,4 @@
framework:
test: true
session:
storage_id: session.storage.mock_file

12
config/packages/test/monolog.yaml

@ -0,0 +1,12 @@
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
excluded_http_codes: [404, 405]
channels: ["!event"]
nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug

2
config/packages/test/twig.yaml

@ -0,0 +1,2 @@
twig:
strict_variables: true

3
config/packages/test/validator.yaml

@ -0,0 +1,3 @@
framework:
validation:
not_compromised_password: false

6
config/packages/test/web_profiler.yaml

@ -0,0 +1,6 @@
web_profiler:
toolbar: false
intercept_redirects: false
framework:
profiler: { collect: false }

2
config/packages/test/webpack_encore.yaml

@ -0,0 +1,2 @@
#webpack_encore:
# strict_mode: false

6
config/packages/translation.yaml

@ -0,0 +1,6 @@
framework:
default_locale: en
translator:
default_path: '%kernel.project_dir%/translations'
fallbacks:
- en

2
config/packages/twig.yaml

@ -0,0 +1,2 @@
twig:
default_path: '%kernel.project_dir%/templates'

8
config/packages/validator.yaml

@ -0,0 +1,8 @@
framework:
validation:
email_validation_mode: html5
# Enables validator auto-mapping support.
# For instance, basic validation constraints will be inferred from Doctrine's metadata.
#auto_mapping:
# App\Entity\: []

25
config/packages/webpack_encore.yaml

@ -0,0 +1,25 @@
webpack_encore:
# The path where Encore is building the assets - i.e. Encore.setOutputPath()
output_path: '%kernel.project_dir%/public/build'
# If multiple builds are defined (as shown below), you can disable the default build:
# output_path: false
# if using Encore.enableIntegrityHashes() and need the crossorigin attribute (default: false, or use 'anonymous' or 'use-credentials')
# crossorigin: 'anonymous'
# preload all rendered script and link tags automatically via the http2 Link header
# preload: true
# Throw an exception if the entrypoints.json file is missing or an entry is missing from the data
# strict_mode: false
# if you have multiple builds:
# builds:
# pass "frontend" as the 3rg arg to the Twig functions
# {{ encore_entry_script_tags('entry1', null, 'frontend') }}
# frontend: '%kernel.project_dir%/public/frontend/build'
# Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
# Put in config/packages/prod/webpack_encore.yaml
# cache: true

3
config/routes.yaml

@ -0,0 +1,3 @@
#index:
# path: /
# controller: App\Controller\DefaultController::index

7
config/routes/annotations.yaml

@ -0,0 +1,7 @@
controllers:
resource: ../../src/Controller/
type: annotation
kernel:
resource: ../../src/Kernel.php
type: annotation

3
config/routes/dev/framework.yaml

@ -0,0 +1,3 @@
_errors:
resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
prefix: /_error

7
config/routes/dev/web_profiler.yaml

@ -0,0 +1,7 @@
web_profiler_wdt:
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
prefix: /_wdt
web_profiler_profiler:
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
prefix: /_profiler

29
config/services.yaml

@ -0,0 +1,29 @@
# This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies.
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
#directory in which the PDF should be stored
factures_directory: '%kernel.project_dir%/public/uploads/factures'
services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
resource: '../src/*'
exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}'
# controllers are imported separately to make sure services can be injected
# as action arguments even if you don't extend any base controller class
App\Controller\:
resource: '../src/Controller'
tags: ['controller.service_arguments']
# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones

10059
package-lock.json

File diff suppressed because it is too large

22
package.json

@ -0,0 +1,22 @@
{
"devDependencies": {
"@symfony/webpack-encore": "^0.28.2",
"bootstrap": "^4.4.1",
"copy-webpack-plugin": "^5.1.1",
"core-js": "^3.0.0",
"jquery": "^3.4.1",
"node-sass": "^4.13.1",
"popper.js": "^1.16.1",
"regenerator-runtime": "^0.13.2",
"sass-loader": "7.0.1",
"webpack-notifier": "^1.6.0"
},
"license": "UNLICENSED",
"private": true,
"scripts": {
"dev-server": "encore dev-server",
"dev": "encore dev",
"watch": "encore dev --watch",
"build": "encore production --progress"
}
}

33
phpunit.xml.dist

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="bin/.phpunit/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="tests/bootstrap.php"
>
<php>
<ini name="error_reporting" value="-1" />
<server name="APP_ENV" value="test" force="true" />
<server name="SHELL_VERBOSITY" value="-1" />
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
<server name="SYMFONY_PHPUNIT_VERSION" value="7.5" />
</php>
<testsuites>
<testsuite name="Project Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>
</phpunit>

9656
public/build/app.css

File diff suppressed because one or more lines are too long

63
public/build/app.js

@ -0,0 +1,63 @@
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["app"],{
/***/ "./assets/css/app.css":
/*!****************************!*\
!*** ./assets/css/app.css ***!
\****************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "./assets/css/global.scss":
/*!********************************!*\
!*** ./assets/css/global.scss ***!
\********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "./assets/js/app.js":
/*!**************************!*\
!*** ./assets/js/app.js ***!
\**************************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _css_app_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../css/app.css */ "./assets/css/app.css");
/* harmony import */ var _css_app_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_css_app_css__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_1__);
/*
* Welcome to your app's main JavaScript file!
*
* We recommend including the built version of this JavaScript file
* (and its CSS file) in your base layout (base.html.twig).
*/
// any CSS you import will output into a single css file (app.css in this case)
__webpack_require__(/*! ../css/global.scss */ "./assets/css/global.scss"); // Need jQuery? Install it with "yarn add jquery", then uncomment to import it.
// this "modifies" the jquery module: adding behavior to it
// the bootstrap module doesn't export/return anything
__webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js"); // or you can include specific pieces
// require('bootstrap/js/dist/tooltip');
// require('bootstrap/js/dist/popover');
console.log('Hello Webpack Encore! Edit me in assets/js/app.js');
/***/ })
},[["./assets/js/app.js","runtime","vendors~app"]]]);
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9hc3NldHMvY3NzL2FwcC5jc3MiLCJ3ZWJwYWNrOi8vLy4vYXNzZXRzL2Nzcy9nbG9iYWwuc2NzcyIsIndlYnBhY2s6Ly8vLi9hc3NldHMvanMvYXBwLmpzIl0sIm5hbWVzIjpbInJlcXVpcmUiLCJjb25zb2xlIiwibG9nIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBQSx1Qzs7Ozs7Ozs7Ozs7QUNBQSx1Qzs7Ozs7Ozs7Ozs7O0FDQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBOzs7Ozs7QUFPQTtBQUNBOztBQUNBQSxtQkFBTyxDQUFDLG9EQUFELENBQVAsQyxDQUVBOzs7Q0FHQTtBQUNBOztBQUNBQSxtQkFBTyxDQUFDLGdFQUFELENBQVAsQyxDQUVBO0FBQ0E7QUFDQTs7O0FBRUFDLE9BQU8sQ0FBQ0MsR0FBUixDQUFZLG1EQUFaLEUiLCJmaWxlIjoiYXBwLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8gZXh0cmFjdGVkIGJ5IG1pbmktY3NzLWV4dHJhY3QtcGx1Z2luIiwiLy8gZXh0cmFjdGVkIGJ5IG1pbmktY3NzLWV4dHJhY3QtcGx1Z2luIiwiLypcclxuICogV2VsY29tZSB0byB5b3VyIGFwcCdzIG1haW4gSmF2YVNjcmlwdCBmaWxlIVxyXG4gKlxyXG4gKiBXZSByZWNvbW1lbmQgaW5jbHVkaW5nIHRoZSBidWlsdCB2ZXJzaW9uIG9mIHRoaXMgSmF2YVNjcmlwdCBmaWxlXHJcbiAqIChhbmQgaXRzIENTUyBmaWxlKSBpbiB5b3VyIGJhc2UgbGF5b3V0IChiYXNlLmh0bWwudHdpZykuXHJcbiAqL1xyXG5cclxuLy8gYW55IENTUyB5b3UgaW1wb3J0IHdpbGwgb3V0cHV0IGludG8gYSBzaW5nbGUgY3NzIGZpbGUgKGFwcC5jc3MgaW4gdGhpcyBjYXNlKVxyXG5pbXBvcnQgJy4uL2Nzcy9hcHAuY3NzJztcclxucmVxdWlyZSgnLi4vY3NzL2dsb2JhbC5zY3NzJyk7XHJcblxyXG4vLyBOZWVkIGpRdWVyeT8gSW5zdGFsbCBpdCB3aXRoIFwieWFybiBhZGQganF1ZXJ5XCIsIHRoZW4gdW5jb21tZW50IHRvIGltcG9ydCBpdC5cclxuaW1wb3J0ICQgZnJvbSAnanF1ZXJ5JztcclxuXHJcbi8vIHRoaXMgXCJtb2RpZmllc1wiIHRoZSBqcXVlcnkgbW9kdWxlOiBhZGRpbmcgYmVoYXZpb3IgdG8gaXRcclxuLy8gdGhlIGJvb3RzdHJhcCBtb2R1bGUgZG9lc24ndCBleHBvcnQvcmV0dXJuIGFueXRoaW5nXHJcbnJlcXVpcmUoJ2Jvb3RzdHJhcCcpO1xyXG5cclxuLy8gb3IgeW91IGNhbiBpbmNsdWRlIHNwZWNpZmljIHBpZWNlc1xyXG4vLyByZXF1aXJlKCdib290c3RyYXAvanMvZGlzdC90b29sdGlwJyk7XHJcbi8vIHJlcXVpcmUoJ2Jvb3RzdHJhcC9qcy9kaXN0L3BvcG92ZXInKTtcclxuXHJcbmNvbnNvbGUubG9nKCdIZWxsbyBXZWJwYWNrIEVuY29yZSEgRWRpdCBtZSBpbiBhc3NldHMvanMvYXBwLmpzJyk7XHJcbiJdLCJzb3VyY2VSb290IjoiIn0=

23
public/build/entrypoints.json

@ -0,0 +1,23 @@
{
"entrypoints": {
"app": {
"js": [
"/build/runtime.js",
"/build/vendors~app.js",
"/build/app.js"
],
"css": [
"/build/app.css"
]
},
"pdf": {
"js": [
"/build/runtime.js",
"/build/pdf.js"
],
"css": [
"/build/pdf.css"
]
}
}
}

BIN
public/build/images/logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

9
public/build/manifest.json

@ -0,0 +1,9 @@
{
"build/app.css": "/build/app.css",
"build/app.js": "/build/app.js",
"build/pdf.css": "/build/pdf.css",
"build/pdf.js": "/build/pdf.js",
"build/runtime.js": "/build/runtime.js",
"build/vendors~app.js": "/build/vendors~app.js",
"build/images/logo.png": "/build/images/logo.png"
}

42
public/build/pdf.css

@ -0,0 +1,42 @@
/*
Created on : 05 avril 2020
Author : Franck J.
*/
/*---------------------------------------------
CSS for the DomPDF layout
----------------------------------------------*/
/*----------- main components --------*/
html,
body {
height: 100%;
width: 100%;
padding-top: 0%;
}
p {
font-size: x-small !important;
}
/*----------- table components --------*/
table {
width: 100%;
}
th,
td {
margin: 0;
padding: 0;
}
.td-vertical-align {
vertical-align: top;
}
.tfoot-border-bottom {
border-bottom: 1px solid #fff
}
/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vcGRmLmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7O0NBR0M7QUFDRDs7K0NBRStDOztBQUUvQyx1Q0FBdUM7QUFDdkM7O0lBRUksWUFBWTtJQUNaLFdBQVc7SUFDWCxlQUFlO0FBQ25COztBQUVBO0lBQ0ksNkJBQTZCO0FBQ2pDOztBQUVBLHdDQUF3Qzs7QUFFeEM7SUFDSSxXQUFXO0FBQ2Y7O0FBRUE7O0lBRUksU0FBUztJQUNULFVBQVU7QUFDZDs7QUFFQTtJQUNJLG1CQUFtQjtBQUN2Qjs7QUFFQTtJQUNJO0FBQ0oiLCJmaWxlIjoicGRmLmNzcyIsInNvdXJjZXNDb250ZW50IjpbIi8qIFxyXG4gICAgQ3JlYXRlZCBvbiA6IDA1IGF2cmlsIDIwMjBcclxuICAgIEF1dGhvciAgICAgOiBGcmFuY2sgSi5cclxuKi9cclxuLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS1cclxuICAgICAgICAgICAgQ1NTIGZvciB0aGUgRG9tUERGIGxheW91dFxyXG4tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi9cclxuXHJcbi8qLS0tLS0tLS0tLS0gbWFpbiBjb21wb25lbnRzIC0tLS0tLS0tKi9cclxuaHRtbCxcclxuYm9keSB7XHJcbiAgICBoZWlnaHQ6IDEwMCU7XHJcbiAgICB3aWR0aDogMTAwJTtcclxuICAgIHBhZGRpbmctdG9wOiAwJTtcclxufVxyXG5cclxucCB7XHJcbiAgICBmb250LXNpemU6IHgtc21hbGwgIWltcG9ydGFudDtcclxufVxyXG5cclxuLyotLS0tLS0tLS0tLSB0YWJsZSBjb21wb25lbnRzIC0tLS0tLS0tKi9cclxuXHJcbnRhYmxlIHtcclxuICAgIHdpZHRoOiAxMDAlO1xyXG59XHJcblxyXG50aCxcclxudGQge1xyXG4gICAgbWFyZ2luOiAwO1xyXG4gICAgcGFkZGluZzogMDtcclxufVxyXG5cclxuLnRkLXZlcnRpY2FsLWFsaWduIHtcclxuICAgIHZlcnRpY2FsLWFsaWduOiB0b3A7XHJcbn1cclxuXHJcbi50Zm9vdC1ib3JkZXItYm90dG9tIHtcclxuICAgIGJvcmRlci1ib3R0b206IDFweCBzb2xpZCAjZmZmXHJcbn1cclxuIl0sInNvdXJjZVJvb3QiOiIifQ==*/

30
public/build/pdf.js

@ -0,0 +1,30 @@
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["pdf"],{
/***/ "./assets/css/pdf.css":
/*!****************************!*\
!*** ./assets/css/pdf.css ***!
\****************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "./assets/js/pdf.js":
/*!**************************!*\
!*** ./assets/js/pdf.js ***!
\**************************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _css_pdf_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../css/pdf.css */ "./assets/css/pdf.css");
/* harmony import */ var _css_pdf_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_css_pdf_css__WEBPACK_IMPORTED_MODULE_0__);
/***/ })
},[["./assets/js/pdf.js","runtime"]]]);
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9hc3NldHMvY3NzL3BkZi5jc3MiLCJ3ZWJwYWNrOi8vLy4vYXNzZXRzL2pzL3BkZi5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBQSx1Qzs7Ozs7Ozs7Ozs7O0FDQUE7QUFBQTtBQUFBIiwiZmlsZSI6InBkZi5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vIGV4dHJhY3RlZCBieSBtaW5pLWNzcy1leHRyYWN0LXBsdWdpbiIsImltcG9ydCAnLi4vY3NzL3BkZi5jc3MnO1xyXG4iXSwic291cmNlUm9vdCI6IiJ9

155
public/build/runtime.js

File diff suppressed because one or more lines are too long

17806
public/build/vendors~app.js

File diff suppressed because one or more lines are too long

27
public/index.php

@ -0,0 +1,27 @@
<?php
use App\Kernel;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;
require dirname(__DIR__).'/config/bootstrap.php';
if ($_SERVER['APP_DEBUG']) {
umask(0000);
Debug::enable();
}
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts([$trustedHosts]);
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

125
src/Controller/FactureController.php

@ -0,0 +1,125 @@
<?php
namespace App\Controller;
// Include Dompdf required namespaces
use Dompdf\Dompdf;
use Dompdf\Options;
use App\Entity\Facture;
use App\Form\FactureType;
use App\Repository\FactureRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Response;
class FactureController extends AbstractController
{
private $entityManager;
private $factureRepository;
public function __construct(EntityManagerInterface $entityManager, FactureRepository $factureRepository)
{
// initialisation de l entityManager
$this->entityManager = $entityManager;
// initialisation du Repository Facture
$this->factureRepository = $factureRepository;
}
/**
* @Route("/", name="app_facture", methods={"GET"})
*/
public function index(): Response
{
// appelle de la methode du Repository qui retourne toutes les Factures
$factureList = $this->factureRepository->findAll();
return $this->render('facture/index.html.twig', [
'title' => 'Liste des factures',
'factureList' => $factureList,
]);
}
/**
* appelle de la page de creation d une facture
*
* @Route("/facture/create", name="app_create_facture", methods={"GET", "POST"})
* @param Request $request
* @return Response
*/
public function createFacture(Request $request)
{
// instanciation d un nouvel objet Facture
$facture = new Facture;
// recuperation du builder du formulaire associe a l entity Facture
$factureForm = $this->createForm(FactureType::class, $facture);
$factureForm->handleRequest($request);
// formulaire soumis et valide
if ($factureForm->isSubmitted() && $factureForm->isValid()) {
// persistence des donnees
$this->entityManager->persist($facture);
$this->entityManager->flush();
// redirige vers la page des factures
return $this->redirectToRoute('app_facture');
}
// sinon on affiche le formulaire
return $this->render('facture/create.html.twig', [
'title' => 'Création de la facture',
'form' => $factureForm->createView()
]);
}
/**
* @Route("/facture_pdf/{id}", name="app_facture_pdf", methods={"GET"})
*/
public function generatePdf(Facture $facture): Response
{
//
//dd($facture);
//
// configure Dompdf according to the needs
$pdfOptions = new Options();
$pdfOptions->set('defaultFont', 'Arial');
$pdfOptions->setIsHtml5ParserEnabled(true);
$pdfOptions->setDpi(150);
// instantiate Dompdf with the options
$dompdf = new Dompdf($pdfOptions);
// retrieve the HTML generated in the twig file
$html = '<link rel="stylesheet" href="{{ asset(\'build/app.css\') }}">' . $this->renderView('facture/pdf.html.twig', [
'title' => "Facture au format PDF",
'facture' => $facture
]);
// load HTML to Dompdf
$dompdf->loadHtml($html);
//
//dd($dompdf);
//
// (Optional) setup the paper size and orientation 'portrait' or 'portrait'
$dompdf->setPaper('A4', 'portrait');
// render the HTML as PDF
$dompdf->render();
// store PDF Binary Data
$output = $dompdf->output();
// write the file in the public directory set in config/services.yaml
$publicDirectory = $this->getParameter('factures_directory');
// concatenate the name with the facture id
$pdfFilepath = $publicDirectory . '/facture_' . $facture->getId() . '.pdf';
// write file to the desired path
file_put_contents($pdfFilepath, $output);
// output the generated PDF to Browser (force download)
$dompdf->stream("mypdf.pdf", [
"Attachment" => false
]);
exit;
}
}

108
src/Entity/Facture.php

@ -0,0 +1,108 @@
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\FactureRepository")
*/
class Facture
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="integer")
*/
private $client_id;
/**
* @ORM\Column(type="string", length=255)
*/
private $client_adresse_ip;
/**
* @ORM\Column(type="float")
*/
private $montant_ht;
/**
* @ORM\Column(type="float")
*/
private $montant_tva;
/**
* @ORM\Column(type="date")
*/
private $facture_createAt;
public function getId(): ?int
{
return $this->id;
}
public function getClientId(): ?int
{
return $this->client_id;
}
public function setClientId(int $client_id): self
{
$this->client_id = $client_id;
return $this;
}
public function getClientAdresseIp(): ?string
{
return $this->client_adresse_ip;
}
public function setClientAdresseIp(string $client_adresse_ip): self
{
$this->client_adresse_ip = $client_adresse_ip;
return $this;
}
public function getMontantHt(): ?float
{
return $this->montant_ht;
}
public function setMontantHt(float $montant_ht): self
{
$this->montant_ht = $montant_ht;
return $this;
}
public function getMontantTva(): ?float
{
return $this->montant_tva;
}
public function setMontantTva(float $montant_tva): self
{
$this->montant_tva = $montant_tva;
return $this;
}
public function getFactureCreateAt(): ?\DateTimeInterface
{
return $this->facture_createAt;
}
public function setFactureCreateAt(\DateTimeInterface $facture_createAt): self
{
$this->facture_createAt = $facture_createAt;
return $this;
}
}

41
src/Form/FactureType.php

@ -0,0 +1,41 @@
<?php
namespace App\Form;
use App\Entity\Facture;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\PercentType;
class FactureType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('client_id', IntegerType::class)
->add('client_adresse_ip', TextType::class)
->add('montant_ht', MoneyType::class, [
'currency' => false
])
->add('montant_tva', PercentType::class, [
'scale' => 2,
'symbol' => false
])
->add('facture_createAt', DateType::class, [
'widget' => 'single_text',
'html5' => true
]);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => Facture::class,
]);
}
}

54
src/Kernel.php

@ -0,0 +1,54 @@
<?php
namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\RouteCollectionBuilder;
class Kernel extends BaseKernel
{
use MicroKernelTrait;
private const CONFIG_EXTS = '.{php,xml,yaml,yml}';
public function registerBundles(): iterable
{
$contents = require $this->getProjectDir().'/config/bundles.php';
foreach ($contents as $class => $envs) {
if ($envs[$this->environment] ?? $envs['all'] ?? false) {
yield new $class();
}
}
}
public function getProjectDir(): string
{
return \dirname(__DIR__);
}
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
{
$container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php'));
$container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID < 70400 || $this->debug);
$container->setParameter('container.dumper.inline_factories', true);
$confDir = $this->getProjectDir().'/config';
$loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{packages}/'.$this->environment.'/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
}
protected function configureRoutes(RouteCollectionBuilder $routes): void
{
$confDir = $this->getProjectDir().'/config';
$routes->import($confDir.'/{routes}/'.$this->environment.'/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob');
}
}

35
src/Migrations/Version20200404184835.php

@ -0,0 +1,35 @@
<?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 Version20200404184835 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'sqlite', 'Migration can only be executed safely on \'sqlite\'.');
$this->addSql('CREATE TABLE facture (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, client_id INTEGER NOT NULL, client_adresse_ip VARCHAR(255) NOT NULL, montant_ht DOUBLE PRECISION NOT NULL, montant_tva DOUBLE PRECISION NOT NULL, facture_create_at DATE NOT NULL)');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'sqlite', 'Migration can only be executed safely on \'sqlite\'.');
$this->addSql('DROP TABLE facture');
}
}

50
src/Repository/FactureRepository.php

@ -0,0 +1,50 @@
<?php
namespace App\Repository;
use App\Entity\Facture;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Common\Persistence\ManagerRegistry;
/**
* @method Facture|null find($id, $lockMode = null, $lockVersion = null)
* @method Facture|null findOneBy(array $criteria, array $orderBy = null)
* @method Facture[] findAll()
* @method Facture[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class FactureRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Facture::class);
}
// /**
// * @return Facture[] Returns an array of Facture objects
// */
/*
public function findByExampleField($value)
{
return $this->createQueryBuilder('f')
->andWhere('f.exampleField = :val')
->setParameter('val', $value)
->orderBy('f.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/
/*
public function findOneBySomeField($value): ?Facture
{
return $this->createQueryBuilder('f')
->andWhere('f.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}

551
symfony.lock

@ -0,0 +1,551 @@
{
"doctrine/annotations": {
"version": "1.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.0",
"ref": "a2759dd6123694c8d901d0ec80006e044c2e6457"
},
"files": [
"./config/routes/annotations.yaml"
]
},
"doctrine/cache": {
"version": "1.10.0"
},
"doctrine/collections": {
"version": "1.6.4"
},
"doctrine/common": {
"version": "2.12.0"
},
"doctrine/dbal": {
"version": "v2.10.1"
},
"doctrine/doctrine-bundle": {
"version": "2.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "2.0",
"ref": "a9f2463b9f73efe74482f831f03a204a41328555"
},
"files": [
"./config/packages/doctrine.yaml",
"./config/packages/prod/doctrine.yaml",
"./src/Entity/.gitignore",
"./src/Repository/.gitignore"
]
},
"doctrine/doctrine-migrations-bundle": {
"version": "1.2",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.2",
"ref": "c1431086fec31f17fbcfe6d6d7e92059458facc1"
},
"files": [
"./config/packages/doctrine_migrations.yaml",
"./src/Migrations/.gitignore"
]
},
"doctrine/event-manager": {
"version": "1.1.0"
},
"doctrine/inflector": {
"version": "1.3.1"
},
"doctrine/instantiator": {
"version": "1.3.0"
},
"doctrine/lexer": {
"version": "1.2.0"
},
"doctrine/migrations": {
"version": "2.2.1"
},
"doctrine/orm": {
"version": "v2.7.2"
},
"doctrine/persistence": {
"version": "1.3.7"
},
"doctrine/reflection": {
"version": "1.2.1"
},
"dompdf/dompdf": {
"version": "v0.8.5"
},
"egulias/email-validator": {
"version": "2.1.17"
},
"jdorn/sql-formatter": {
"version": "v1.2.17"
},
"laminas/laminas-code": {
"version": "3.4.1"
},
"laminas/laminas-eventmanager": {
"version": "3.2.1"
},
"laminas/laminas-zendframework-bridge": {
"version": "1.0.2"
},
"monolog/monolog": {
"version": "2.0.2"
},
"nikic/php-parser": {
"version": "v4.3.0"
},
"ocramius/package-versions": {
"version": "1.7.0"
},
"ocramius/proxy-manager": {
"version": "2.7.0"
},
"phenx/php-font-lib": {
"version": "0.5.1"
},
"phenx/php-svg-lib": {
"version": "v0.3.3"
},
"php": {
"version": "7.4"
},
"phpdocumentor/reflection-common": {
"version": "2.0.0"
},
"phpdocumentor/reflection-docblock": {
"version": "5.1.0"
},
"phpdocumentor/type-resolver": {
"version": "1.1.0"
},
"psr/cache": {
"version": "1.0.1"
},
"psr/container": {
"version": "1.0.0"
},
"psr/event-dispatcher": {
"version": "1.0.0"
},
"psr/link": {
"version": "1.0.0"
},
"psr/log": {
"version": "1.1.3"
},
"sabberworm/php-css-parser": {
"version": "8.3.0"
},
"sensio/framework-extra-bundle": {
"version": "5.2",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "5.2",
"ref": "fb7e19da7f013d0d422fa9bce16f5c510e27609b"
},
"files": [
"./config/packages/sensio_framework_extra.yaml"
]
},
"symfony/asset": {
"version": "v5.0.7"
},
"symfony/browser-kit": {
"version": "v5.0.7"
},