initial commit
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
storage
|
||||||
|
services/www/Dockerfile
|
||||||
|
project/vendor
|
||||||
|
project/var
|
||||||
|
project/bin/*
|
||||||
|
!project/bin/console
|
||||||
|
project/.env.*.local
|
||||||
|
project/.env.local
|
||||||
|
project/.env
|
||||||
|
project/tokens/*
|
||||||
|
**/.git/
|
||||||
|
**/.idea
|
||||||
+2
-10
@@ -1,10 +1,2 @@
|
|||||||
|
.idea
|
||||||
###> symfony/framework-bundle ###
|
storage
|
||||||
/.env.local
|
|
||||||
/.env.local.php
|
|
||||||
/.env.*.local
|
|
||||||
/config/secrets/prod/prod.decrypt.private.php
|
|
||||||
/public/bundles/
|
|
||||||
/var/
|
|
||||||
/vendor/
|
|
||||||
###< symfony/framework-bundle ###
|
|
||||||
Generated
-2434
File diff suppressed because it is too large
Load Diff
@@ -1,5 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return [
|
|
||||||
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
|
|
||||||
];
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
###> symfony/mailer ###
|
||||||
|
mailer:
|
||||||
|
image: schickling/mailcatcher
|
||||||
|
ports: [1025, 1080]
|
||||||
|
###< symfony/mailer ###
|
||||||
|
###< doctrine/doctrine-bundle ###
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
mysql:
|
||||||
|
image: mysql:8.0
|
||||||
|
restart: unless-stopped
|
||||||
|
command: --default-authentication-plugin=mysql_native_password --sql_mode="NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
|
||||||
|
environment:
|
||||||
|
- MYSQL_ROOT_PASSWORD=IPnWH5LpE977A7cmD6j2dM
|
||||||
|
- TZ=Europe/Warsaw
|
||||||
|
volumes:
|
||||||
|
- ./storage/mysql:/var/lib/mysql
|
||||||
|
networks:
|
||||||
|
- internal
|
||||||
|
- myadmin
|
||||||
|
www:
|
||||||
|
image: registry.docker.rhost.ovh/sprawozdania:0.1.4
|
||||||
|
restart: on-failure
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: services/www/Dockerfile
|
||||||
|
networks:
|
||||||
|
- frontend
|
||||||
|
- internal
|
||||||
|
volumes:
|
||||||
|
- ./project:/var/www/html
|
||||||
|
labels:
|
||||||
|
traefik.enable: 'true'
|
||||||
|
traefik.http.routers.sprawozdania.entrypoints: web
|
||||||
|
traefik.http.routers.sprawozdania.rule: Host(`sprawozdania.docker`)
|
||||||
|
traefik.http.services.sprawozdania.loadbalancer.server.port: 80
|
||||||
|
traefik.http.routers.sprawozdania.service: sprawozdania
|
||||||
|
redis:
|
||||||
|
image: redis:6-alpine
|
||||||
|
restart: on-failure
|
||||||
|
networks:
|
||||||
|
- internal
|
||||||
|
volumes:
|
||||||
|
- ./storage/redis:/data
|
||||||
|
|
||||||
|
# wait_for_it:
|
||||||
|
# build:
|
||||||
|
# context: .
|
||||||
|
# dockerfile: services/wait_for_it/Dockerfile
|
||||||
|
# networks:
|
||||||
|
# - internal
|
||||||
|
# depends_on:
|
||||||
|
# - database
|
||||||
|
# command: sh -c "/wait -t 30 database:5432 -- echo 123;"
|
||||||
|
networks:
|
||||||
|
internal:
|
||||||
|
internal: true
|
||||||
|
frontend:
|
||||||
|
external: true
|
||||||
|
myadmin:
|
||||||
|
external: true
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
|
||||||
|
###> symfony/framework-bundle ###
|
||||||
|
.env
|
||||||
|
.env.prod
|
||||||
|
/.env.local
|
||||||
|
/.env.local.php
|
||||||
|
/.env.*.local
|
||||||
|
/config/secrets/prod/prod.decrypt.private.php
|
||||||
|
/public/bundles/
|
||||||
|
/var/
|
||||||
|
/vendor/
|
||||||
|
###< symfony/framework-bundle ###
|
||||||
|
|
||||||
|
###> symfony/webpack-encore-bundle ###
|
||||||
|
/node_modules/
|
||||||
|
/public/build/
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
###< symfony/webpack-encore-bundle ###
|
||||||
Executable
+17
@@ -0,0 +1,17 @@
|
|||||||
|
import './bootstrap.js';
|
||||||
|
/*
|
||||||
|
* 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 './styles/app.css';
|
||||||
|
import './styles/global.scss';
|
||||||
|
import './styles/main.less';
|
||||||
|
|
||||||
|
global.jQuery = global.$ = require('jquery');
|
||||||
|
require('@fortawesome/fontawesome-free/css/all.min.css');
|
||||||
|
require('bootstrap');
|
||||||
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
import { startStimulusApp } from '@symfony/stimulus-bridge';
|
||||||
|
|
||||||
|
// Registers Stimulus controllers from controllers.json and in the controllers/ directory
|
||||||
|
export const app = startStimulusApp(require.context(
|
||||||
|
'@symfony/stimulus-bridge/lazy-controller-loader!./controllers',
|
||||||
|
true,
|
||||||
|
/\.[jt]sx?$/
|
||||||
|
));
|
||||||
|
// register any custom, 3rd party controllers here
|
||||||
|
// app.register('some_controller_name', SomeImportedController);
|
||||||
Executable
+15
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"controllers": {
|
||||||
|
"@symfony/ux-turbo": {
|
||||||
|
"turbo-core": {
|
||||||
|
"enabled": true,
|
||||||
|
"fetch": "eager"
|
||||||
|
},
|
||||||
|
"mercure-turbo-stream": {
|
||||||
|
"enabled": false,
|
||||||
|
"fetch": "eager"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"entrypoints": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import { Controller } from '@hotwired/stimulus';
|
||||||
|
import $ from 'jquery';
|
||||||
|
/*
|
||||||
|
* This is an example Stimulus controller!
|
||||||
|
*
|
||||||
|
* Any element with a data-controller="hello" attribute will cause
|
||||||
|
* this controller to be executed. The name "hello" comes from the filename:
|
||||||
|
* hello_controller.js -> "hello"
|
||||||
|
*
|
||||||
|
* Delete this file or adapt it for your use!
|
||||||
|
*/
|
||||||
|
const _NEED_LENGTH_TO_SEARCH_CLIENT = 3;
|
||||||
|
export default class extends Controller {
|
||||||
|
searchInput;
|
||||||
|
tableAll;
|
||||||
|
connect() {
|
||||||
|
this.searchInput = $('#customerListSearch');
|
||||||
|
this.tableAll = $('#customerListTable');
|
||||||
|
this.initSearch();
|
||||||
|
}
|
||||||
|
initSearch() {
|
||||||
|
const masterThs = this;
|
||||||
|
this.searchInput.on('keyup', e => {
|
||||||
|
const value = masterThs.searchInput.val().toLowerCase();
|
||||||
|
if (value.length < _NEED_LENGTH_TO_SEARCH_CLIENT) {
|
||||||
|
masterThs.searchInput.addClass("is-invalid");
|
||||||
|
masterThs.tableAll.find('tr').show();
|
||||||
|
if (value.length === 0) {
|
||||||
|
masterThs.searchInput.removeClass("is-invalid");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
masterThs.searchInput.removeClass("is-invalid");
|
||||||
|
masterThs.tableAll.find('tr').filter((e,tmp) => {
|
||||||
|
const t = $(tmp)
|
||||||
|
t.toggle(t.html().toLowerCase().indexOf(value) > -1);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
import { Controller } from '@hotwired/stimulus';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is an example Stimulus controller!
|
||||||
|
*
|
||||||
|
* Any element with a data-controller="hello" attribute will cause
|
||||||
|
* this controller to be executed. The name "hello" comes from the filename:
|
||||||
|
* hello_controller.js -> "hello"
|
||||||
|
*
|
||||||
|
* Delete this file or adapt it for your use!
|
||||||
|
*/
|
||||||
|
export default class extends Controller {
|
||||||
|
connect() {
|
||||||
|
this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';
|
||||||
|
}
|
||||||
|
}
|
||||||
Executable
+20
@@ -0,0 +1,20 @@
|
|||||||
|
body {
|
||||||
|
background-color: lightgray;
|
||||||
|
}
|
||||||
|
.reports-all .col {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
.reports-months-all {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
/*.status-row {*/
|
||||||
|
/* background-color: lightgray;*/
|
||||||
|
/*}*/
|
||||||
|
a {
|
||||||
|
text-decoration: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reports-all .report-one .fa{
|
||||||
|
padding: 5px 20px;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
@import "~bootstrap/scss/bootstrap";
|
||||||
|
@import "app.css";
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
body {
|
||||||
|
background-color: #e6e6e6;
|
||||||
|
}
|
||||||
|
.reports-all {
|
||||||
|
.col {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
.report-one {
|
||||||
|
.fa{
|
||||||
|
margin: auto;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
.btn-group {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.report-number {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
.badge {
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.reports-months-all {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
/*.status-row {*/
|
||||||
|
/* background-color: lightgray;*/
|
||||||
|
/*}*/
|
||||||
|
a {
|
||||||
|
text-decoration: none !important;
|
||||||
|
}
|
||||||
@@ -7,14 +7,30 @@
|
|||||||
"php": ">=8.1",
|
"php": ">=8.1",
|
||||||
"ext-ctype": "*",
|
"ext-ctype": "*",
|
||||||
"ext-iconv": "*",
|
"ext-iconv": "*",
|
||||||
|
"doctrine/dbal": "^3",
|
||||||
|
"doctrine/doctrine-bundle": "^2.12",
|
||||||
|
"doctrine/doctrine-migrations-bundle": "^3.3",
|
||||||
|
"doctrine/orm": "^3.2",
|
||||||
|
"league/commonmark": "^2.4",
|
||||||
|
"predis/predis": "^2.2",
|
||||||
"symfony/console": "6.4.*",
|
"symfony/console": "6.4.*",
|
||||||
"symfony/dotenv": "6.4.*",
|
"symfony/dotenv": "6.4.*",
|
||||||
"symfony/flex": "^2",
|
"symfony/form": "6.4.*",
|
||||||
"symfony/framework-bundle": "6.4.*",
|
"symfony/framework-bundle": "6.4.*",
|
||||||
"symfony/runtime": "6.4.*",
|
"symfony/runtime": "6.4.*",
|
||||||
"symfony/yaml": "6.4.*"
|
"symfony/security-bundle": "6.4.*",
|
||||||
|
"symfony/stimulus-bundle": "^2.18",
|
||||||
|
"symfony/twig-bundle": "6.4.*",
|
||||||
|
"symfony/ux-turbo": "^2.18",
|
||||||
|
"symfony/validator": "6.4.*",
|
||||||
|
"symfony/web-profiler-bundle": "6.4.*",
|
||||||
|
"symfony/webpack-encore-bundle": "^2.1",
|
||||||
|
"symfony/yaml": "6.4.*",
|
||||||
|
"twig/extra-bundle": "^3.10",
|
||||||
|
"twig/markdown-extra": "^3.10"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
"symfony/maker-bundle": "^1.60"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"allow-plugins": {
|
"allow-plugins": {
|
||||||
@@ -44,16 +60,9 @@
|
|||||||
"symfony/polyfill-php81": "*"
|
"symfony/polyfill-php81": "*"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"auto-scripts": {
|
"auto-scripts": {},
|
||||||
"cache:clear": "symfony-cmd",
|
"post-install-cmd": [],
|
||||||
"assets:install %PUBLIC_DIR%": "symfony-cmd"
|
"post-update-cmd": []
|
||||||
},
|
|
||||||
"post-install-cmd": [
|
|
||||||
"@auto-scripts"
|
|
||||||
],
|
|
||||||
"post-update-cmd": [
|
|
||||||
"@auto-scripts"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
"symfony/symfony": "*"
|
"symfony/symfony": "*"
|
||||||
Generated
+6381
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
|
||||||
|
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
|
||||||
|
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
|
||||||
|
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
|
||||||
|
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
|
||||||
|
Symfony\UX\StimulusBundle\StimulusBundle::class => ['all' => true],
|
||||||
|
Symfony\UX\Turbo\TurboBundle::class => ['all' => true],
|
||||||
|
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
|
||||||
|
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
|
||||||
|
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
|
||||||
|
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
|
||||||
|
];
|
||||||
@@ -8,8 +8,8 @@ framework:
|
|||||||
# Other options include:
|
# Other options include:
|
||||||
|
|
||||||
# Redis
|
# Redis
|
||||||
#app: cache.adapter.redis
|
app: cache.adapter.redis
|
||||||
#default_redis_provider: redis://localhost
|
system: cache.adapter.redis
|
||||||
|
|
||||||
# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
|
# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
|
||||||
#app: cache.adapter.apcu
|
#app: cache.adapter.apcu
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
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: '16'
|
||||||
|
|
||||||
|
profiling_collect_backtrace: '%kernel.debug%'
|
||||||
|
use_savepoints: true
|
||||||
|
orm:
|
||||||
|
auto_generate_proxy_classes: true
|
||||||
|
enable_lazy_ghost_objects: true
|
||||||
|
report_fields_where_declared: true
|
||||||
|
validate_xml_mapping: true
|
||||||
|
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
|
||||||
|
auto_mapping: true
|
||||||
|
mappings:
|
||||||
|
App:
|
||||||
|
type: attribute
|
||||||
|
is_bundle: false
|
||||||
|
dir: '%kernel.project_dir%/src/Entity'
|
||||||
|
prefix: 'App\Entity'
|
||||||
|
alias: App
|
||||||
|
|
||||||
|
when@test:
|
||||||
|
doctrine:
|
||||||
|
dbal:
|
||||||
|
# "TEST_TOKEN" is typically set by ParaTest
|
||||||
|
dbname_suffix: '_test%env(default::TEST_TOKEN)%'
|
||||||
|
|
||||||
|
when@prod:
|
||||||
|
doctrine:
|
||||||
|
orm:
|
||||||
|
auto_generate_proxy_classes: false
|
||||||
|
proxy_dir: '%kernel.build_dir%/doctrine/orm/Proxies'
|
||||||
|
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
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
doctrine_migrations:
|
||||||
|
migrations_paths:
|
||||||
|
# namespace is arbitrary but should be different from App\Migrations
|
||||||
|
# as migrations classes should NOT be autoloaded
|
||||||
|
'DoctrineMigrations': '%kernel.project_dir%/migrations'
|
||||||
|
enable_profiler: false
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
security:
|
||||||
|
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
|
||||||
|
password_hashers:
|
||||||
|
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
|
||||||
|
# https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
|
||||||
|
providers:
|
||||||
|
# used to reload user from session & other features (e.g. switch_user)
|
||||||
|
app_user_provider:
|
||||||
|
entity:
|
||||||
|
class: App\Entity\User
|
||||||
|
property: username
|
||||||
|
firewalls:
|
||||||
|
dev:
|
||||||
|
pattern: ^/(_(profiler|wdt)|css|images|js)/
|
||||||
|
security: false
|
||||||
|
main:
|
||||||
|
lazy: true
|
||||||
|
provider: app_user_provider
|
||||||
|
form_login:
|
||||||
|
login_path: app_login
|
||||||
|
check_path: app_login
|
||||||
|
enable_csrf: true
|
||||||
|
default_target_path: index
|
||||||
|
always_use_default_target_path: true
|
||||||
|
logout:
|
||||||
|
path: app_logout
|
||||||
|
# where to redirect after logout
|
||||||
|
# target: app_any_route
|
||||||
|
|
||||||
|
# activate different ways to authenticate
|
||||||
|
# https://symfony.com/doc/current/security.html#the-firewall
|
||||||
|
|
||||||
|
# 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: ^/login, roles: PUBLIC_ACCESS }
|
||||||
|
- { path: ^/, roles: ROLE_USER }
|
||||||
|
# - { path: ^/admin, roles: ROLE_ADMIN }
|
||||||
|
|
||||||
|
when@test:
|
||||||
|
security:
|
||||||
|
password_hashers:
|
||||||
|
# By default, password hashers are resource intensive and take time. This is
|
||||||
|
# important to generate secure password hashes. In tests however, secure hashes
|
||||||
|
# are not important, waste resources and increase test times. The following
|
||||||
|
# reduces the work factor to the lowest possible values.
|
||||||
|
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
|
||||||
|
algorithm: auto
|
||||||
|
cost: 4 # Lowest possible value for bcrypt
|
||||||
|
time_cost: 3 # Lowest possible value for argon
|
||||||
|
memory_cost: 10 # Lowest possible value for argon
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
twig:
|
||||||
|
file_name_pattern: '*.twig'
|
||||||
|
form_themes: ['bootstrap_5_layout.html.twig']
|
||||||
|
|
||||||
|
when@test:
|
||||||
|
twig:
|
||||||
|
strict_variables: true
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
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\: []
|
||||||
|
|
||||||
|
when@test:
|
||||||
|
framework:
|
||||||
|
validation:
|
||||||
|
not_compromised_password: false
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
when@dev:
|
||||||
|
web_profiler:
|
||||||
|
toolbar: true
|
||||||
|
intercept_redirects: false
|
||||||
|
|
||||||
|
framework:
|
||||||
|
profiler:
|
||||||
|
only_exceptions: false
|
||||||
|
collect_serializer_data: true
|
||||||
|
|
||||||
|
when@test:
|
||||||
|
web_profiler:
|
||||||
|
toolbar: false
|
||||||
|
intercept_redirects: false
|
||||||
|
|
||||||
|
framework:
|
||||||
|
profiler: { collect: false }
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
# Set attributes that will be rendered on all script and link tags
|
||||||
|
script_attributes:
|
||||||
|
defer: true
|
||||||
|
# Uncomment (also under link_attributes) if using Turbo Drive
|
||||||
|
# https://turbo.hotwired.dev/handbook/drive#reloading-when-assets-change
|
||||||
|
# 'data-turbo-track': reload
|
||||||
|
# link_attributes:
|
||||||
|
# Uncomment if using Turbo Drive
|
||||||
|
# 'data-turbo-track': reload
|
||||||
|
|
||||||
|
# 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 HTTP/2 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:
|
||||||
|
# frontend: '%kernel.project_dir%/public/frontend/build'
|
||||||
|
|
||||||
|
# pass the build name as the 3rd argument to the Twig functions
|
||||||
|
# {{ encore_entry_script_tags('entry1', null, 'frontend') }}
|
||||||
|
|
||||||
|
framework:
|
||||||
|
assets:
|
||||||
|
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'
|
||||||
|
|
||||||
|
#when@prod:
|
||||||
|
# webpack_encore:
|
||||||
|
# # Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
|
||||||
|
# # Available in version 1.2
|
||||||
|
# cache: true
|
||||||
|
|
||||||
|
#when@test:
|
||||||
|
# webpack_encore:
|
||||||
|
# strict_mode: false
|
||||||
@@ -2,4 +2,4 @@ controllers:
|
|||||||
resource:
|
resource:
|
||||||
path: ../src/Controller/
|
path: ../src/Controller/
|
||||||
namespace: App\Controller
|
namespace: App\Controller
|
||||||
type: attribute
|
type: attribute
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
_security_logout:
|
||||||
|
resource: security.route_loader.logout
|
||||||
|
type: service
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
when@dev:
|
||||||
|
web_profiler_wdt:
|
||||||
|
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
|
||||||
|
prefix: /_wdt
|
||||||
|
|
||||||
|
web_profiler_profiler:
|
||||||
|
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
|
||||||
|
prefix: /_profiler
|
||||||
@@ -20,5 +20,9 @@ services:
|
|||||||
- '../src/Entity/'
|
- '../src/Entity/'
|
||||||
- '../src/Kernel.php'
|
- '../src/Kernel.php'
|
||||||
|
|
||||||
|
App\Services\:
|
||||||
|
resource: '../src/Services/'
|
||||||
|
arguments:
|
||||||
|
- '@doctrine.orm.entity_manager'
|
||||||
# add more service definitions when explicit configuration is needed
|
# add more service definitions when explicit configuration is needed
|
||||||
# please note that last definitions always *replace* previous ones
|
# please note that last definitions always *replace* previous ones
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?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 Version20240613202026 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->addSql('CREATE TABLE clients (id INT AUTO_INCREMENT NOT NULL, str_company_name VARCHAR(255) NOT NULL, int_nip INT NOT NULL, str_address VARCHAR(255) NOT NULL, str_email VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('DROP TABLE clients');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?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 Version20240613202913 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->addSql('ALTER TABLE clients ADD date_legitimacy DATE NOT NULL, ADD date_proclamation DATE NOT NULL, CHANGE str_company_name str_name VARCHAR(255) NOT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE clients DROP date_legitimacy, DROP date_proclamation, CHANGE str_name str_company_name VARCHAR(255) NOT NULL');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?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 Version20240618122259 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->addSql('CREATE TABLE reports (id INT AUTO_INCREMENT NOT NULL, client_id INT NOT NULL, date_start DATE NOT NULL, int_status INT NOT NULL, INDEX IDX_F11FA74519EB6921 (client_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||||
|
$this->addSql('ALTER TABLE reports ADD CONSTRAINT FK_F11FA74519EB6921 FOREIGN KEY (client_id) REFERENCES clients (id)');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE reports DROP FOREIGN KEY FK_F11FA74519EB6921');
|
||||||
|
$this->addSql('DROP TABLE reports');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?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 Version20240618205923 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->addSql('ALTER TABLE reports CHANGE int_status status INT NOT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE reports CHANGE status int_status INT NOT NULL');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?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 Version20240618214143 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->addSql('CREATE TABLE reports_todo (id INT AUTO_INCREMENT NOT NULL, report_id INT NOT NULL, name SMALLINT NOT NULL, INDEX IDX_5D59048F4BD2A4C0 (report_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||||
|
$this->addSql('ALTER TABLE reports_todo ADD CONSTRAINT FK_5D59048F4BD2A4C0 FOREIGN KEY (report_id) REFERENCES reports (id)');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE reports_todo DROP FOREIGN KEY FK_5D59048F4BD2A4C0');
|
||||||
|
$this->addSql('DROP TABLE reports_todo');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?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 Version20240619164853 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->addSql('ALTER TABLE reports_todo ADD deleted TINYINT(1) DEFAULT 0 NOT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE reports_todo DROP deleted');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?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 Version20240620164921 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->addSql('ALTER TABLE reports DROP status');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE reports ADD status INT NOT NULL');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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 Version20240621092709 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->addSql('CREATE TABLE notes (id INT AUTO_INCREMENT NOT NULL, client_id INT NOT NULL, description LONGTEXT NOT NULL, UNIQUE INDEX UNIQ_11BA68C19EB6921 (client_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||||
|
$this->addSql('ALTER TABLE notes ADD CONSTRAINT FK_11BA68C19EB6921 FOREIGN KEY (client_id) REFERENCES clients (id)');
|
||||||
|
$this->addSql('ALTER TABLE clients CHANGE int_nip int_nip BIGINT NOT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE notes DROP FOREIGN KEY FK_11BA68C19EB6921');
|
||||||
|
$this->addSql('DROP TABLE notes');
|
||||||
|
$this->addSql('ALTER TABLE clients CHANGE int_nip int_nip INT NOT NULL');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<?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 Version20240627092633 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->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, username VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_IDENTIFIER_USERNAME (username), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||||
|
$this->addSql('INSERT INTO `user` (`id`, `username`, `roles`, `password`) VALUES
|
||||||
|
(1, "ryjek", \'[\"ROLE_USER\", \"ROLE_REPORT_EDIT\"]\', "$2y$13$ZFKnR0VtUUEvFaO1YHTaHuPqUrF.7ZCGK78VfiPTa93mEy3uEQJTi"),
|
||||||
|
(2, "ania", \'[\"ROLE_USER\", \"ROLE_REPORT_EDIT\"]\', "$2y$13$PbCaD1M40qV10my4WoZa3ulS0EmBcx2TvacNqiy7qYnQa91/zUGyS")');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('DROP TABLE user');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?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 Version20240627132924 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->addSql('CREATE TABLE schedule (id INT AUTO_INCREMENT NOT NULL, client_id INT NOT NULL, INDEX IDX_5A3811FB19EB6921 (client_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||||
|
$this->addSql('ALTER TABLE schedule ADD CONSTRAINT FK_5A3811FB19EB6921 FOREIGN KEY (client_id) REFERENCES clients (id)');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE schedule DROP FOREIGN KEY FK_5A3811FB19EB6921');
|
||||||
|
$this->addSql('DROP TABLE schedule');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?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 Version20240628094637 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->addSql('ALTER TABLE clients ADD is_deleted TINYINT(1) DEFAULT 0 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE reports ADD is_delete TINYINT(1) DEFAULT 0 NOT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE clients DROP is_deleted');
|
||||||
|
$this->addSql('ALTER TABLE reports DROP is_delete');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?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 Version20240701112850 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->addSql('ALTER TABLE schedule ADD date_end DATE NOT NULL, ADD is_done TINYINT(1) DEFAULT 0 NOT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE schedule DROP date_end, DROP is_done');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?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 Version20240703101352 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->addSql('ALTER TABLE schedule ADD date_done DATETIME DEFAULT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE schedule DROP date_done');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?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 Version20240704202138 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->addSql('ALTER TABLE reports ADD is_done TINYINT(1) DEFAULT 0 NOT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE reports DROP is_done');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?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 Version20240705090751 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->addSql('ALTER TABLE notes DROP FOREIGN KEY FK_11BA68C19EB6921');
|
||||||
|
$this->addSql('DROP INDEX UNIQ_11BA68C19EB6921 ON notes');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE notes ADD CONSTRAINT FK_11BA68C19EB6921 FOREIGN KEY (client_id) REFERENCES clients (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
|
||||||
|
$this->addSql('CREATE UNIQUE INDEX UNIQ_11BA68C19EB6921 ON notes (client_id)');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?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 Version20240715094123 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->addSql('ALTER TABLE clients ADD is_complete TINYINT(1) DEFAULT 0 NOT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE clients DROP is_complete');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?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 Version20240715220738 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->addSql('ALTER TABLE clients ADD int_phone INT DEFAULT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE clients DROP int_phone');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?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 Version20240718213752 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->addSql('ALTER TABLE reports ADD number INT NOT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE reports DROP number');
|
||||||
|
}
|
||||||
|
}
|
||||||
Generated
+8630
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"devDependencies": {
|
||||||
|
"@babel/core": "^7.17.0",
|
||||||
|
"@babel/preset-env": "^7.16.0",
|
||||||
|
"@fortawesome/fontawesome-free": "^6.5.2",
|
||||||
|
"@hotwired/stimulus": "^3.0.0",
|
||||||
|
"@hotwired/turbo": "^7.1.1 || ^8.0",
|
||||||
|
"@popperjs/core": "^2.11.8",
|
||||||
|
"@symfony/stimulus-bridge": "^3.2.0",
|
||||||
|
"@symfony/ux-turbo": "file:vendor/symfony/ux-turbo/assets",
|
||||||
|
"@symfony/webpack-encore": "^4.0.0",
|
||||||
|
"bootstrap": "^5.3.3",
|
||||||
|
"core-js": "^3.23.0",
|
||||||
|
"jquery": "^3.7.1",
|
||||||
|
"less-loader": "^11.1.4",
|
||||||
|
"regenerator-runtime": "^0.13.9",
|
||||||
|
"sass": "^1.77.5",
|
||||||
|
"sass-loader": "^14.2.1",
|
||||||
|
"webpack": "^5.74.0",
|
||||||
|
"webpack-cli": "^4.10.0",
|
||||||
|
"webpack-notifier": "^1.15.0"
|
||||||
|
},
|
||||||
|
"license": "UNLICENSED",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"dev-server": "encore dev-server",
|
||||||
|
"dev": "encore dev",
|
||||||
|
"watch": "encore dev --watch",
|
||||||
|
"build": "encore production --progress"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"jquery-ui": "^1.13.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Command;
|
||||||
|
|
||||||
|
use App\Entity\Clients;
|
||||||
|
use App\Entity\Reports;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
|
|
||||||
|
#[AsCommand(
|
||||||
|
name: 'recount-reports-number',
|
||||||
|
description: 'Add a short description for your command',
|
||||||
|
)]
|
||||||
|
class RecountReports extends Command
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private EntityManagerInterface $entityManager
|
||||||
|
)
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configure(): void
|
||||||
|
{
|
||||||
|
$this
|
||||||
|
->addArgument('arg1', InputArgument::OPTIONAL, 'Argument description')
|
||||||
|
->addOption('option1', null, InputOption::VALUE_NONE, 'Option description')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||||
|
{
|
||||||
|
$reports = $this->entityManager->getRepository(Reports::class)->findBy([],["dateStart"=>"ASC"]);
|
||||||
|
$io = new SymfonyStyle($input, $output);
|
||||||
|
$clientToReport=[];
|
||||||
|
$clients=[];
|
||||||
|
|
||||||
|
foreach ($reports as $report) {
|
||||||
|
if (!isset($clients[$report->getClient()->getId()])) {
|
||||||
|
$clients[$report->getClient()->getId()]=$report->getClient();
|
||||||
|
}
|
||||||
|
$clientToReport[$report->getClient()->getId()][] = $report;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($clientToReport as $clientId => $reports) {
|
||||||
|
$client = $clients[$clientId];
|
||||||
|
$io->writeln($client->getStrName());
|
||||||
|
$i=1;
|
||||||
|
foreach ($reports as $report) {
|
||||||
|
$io->writeln($report->getDateStart()->format("Y-m-d") . ": " . $i);
|
||||||
|
$report->setNumber($i);
|
||||||
|
$this->entityManager->persist($report);
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$io->writeln("");
|
||||||
|
}
|
||||||
|
$this->entityManager->flush();
|
||||||
|
$io->success('All reports have been recorded');
|
||||||
|
//
|
||||||
|
// $a = '0123456789abcdef';
|
||||||
|
// $secret = '';
|
||||||
|
// for ($i = 0; $i < 32; $i++) {
|
||||||
|
// $secret .= $a[rand(0, 15)];
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// $r = shell_exec('sed -i -E "s/^APP_SECRET=.{32}$/APP_SECRET=' . $secret . '/" .env');
|
||||||
|
//
|
||||||
|
// $io->success('New APP_SECRET was generated: ' . $secret);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Command;
|
||||||
|
|
||||||
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
|
|
||||||
|
#[AsCommand(
|
||||||
|
name: 'regenerate-app-secret',
|
||||||
|
description: 'Add a short description for your command',
|
||||||
|
)]
|
||||||
|
class RegenerateAppSecretCommand extends Command
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configure(): void
|
||||||
|
{
|
||||||
|
$this
|
||||||
|
->addArgument('arg1', InputArgument::OPTIONAL, 'Argument description')
|
||||||
|
->addOption('option1', null, InputOption::VALUE_NONE, 'Option description')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||||
|
{
|
||||||
|
$io = new SymfonyStyle($input, $output);
|
||||||
|
|
||||||
|
$a = '0123456789abcdef';
|
||||||
|
$secret = '';
|
||||||
|
for ($i = 0; $i < 32; $i++) {
|
||||||
|
$secret .= $a[rand(0, 15)];
|
||||||
|
}
|
||||||
|
|
||||||
|
$r = shell_exec('sed -i -E "s/^APP_SECRET=.{32}$/APP_SECRET=' . $secret . '/" .env');
|
||||||
|
|
||||||
|
$io->success('New APP_SECRET was generated: ' . $secret);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Entity\Clients;
|
||||||
|
use App\Entity\Reports;
|
||||||
|
use App\Entity\ReportsTodo;
|
||||||
|
use App\Enum\Months;
|
||||||
|
use App\Enum\ReportStatus;
|
||||||
|
use App\Enum\ReportTodoEnum;
|
||||||
|
use App\Helper\MonthHelper;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||||
|
|
||||||
|
class BaseController extends AbstractController
|
||||||
|
{
|
||||||
|
private MonthHelper $monthHelper;
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
$this->monthHelper = new MonthHelper();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/', name: 'index')]
|
||||||
|
public function index(): Response
|
||||||
|
{
|
||||||
|
if (!$this->isGranted('reportView')) {
|
||||||
|
return $this->redirectToRoute('app_schedule');
|
||||||
|
}
|
||||||
|
return $this->redirectToRoute('app_base');
|
||||||
|
}
|
||||||
|
#[Route('/reports/{monthId}', name: 'app_base')]
|
||||||
|
#[IsGranted('reportView')]
|
||||||
|
public function reportsIndex(EntityManagerInterface $entityManager, int $monthId = 0) : Response
|
||||||
|
{
|
||||||
|
if ($this->getUser())
|
||||||
|
if ($monthId > -1) {
|
||||||
|
$monthCurrent = $this->monthHelper->getCurrentMonth($monthId);
|
||||||
|
$reportsAll = $entityManager->getRepository(Reports::class)->findAllInMonth($monthCurrent);
|
||||||
|
} else {
|
||||||
|
$reportsAll = $entityManager->getRepository(Reports::class)->findAllOverdue();
|
||||||
|
}
|
||||||
|
|
||||||
|
$reports = [];
|
||||||
|
foreach (ReportStatus::cases() as $case) {
|
||||||
|
$reports[$case->value] = [
|
||||||
|
'status' => $case,
|
||||||
|
'reports' => []
|
||||||
|
];
|
||||||
|
}
|
||||||
|
/** @var Reports $report */
|
||||||
|
foreach ($reportsAll as $report) {
|
||||||
|
$reports[$report->takeStatusTodo()->value]['reports'][] = $report;
|
||||||
|
}
|
||||||
|
ksort($reports);
|
||||||
|
return $this->render('reports/list.html.twig', [
|
||||||
|
'reportsGroup' => $reports,
|
||||||
|
'months' => $this->monthHelper->takeMonths(),
|
||||||
|
'currentMonth' => $monthCurrent ?? null,
|
||||||
|
'reportToDoList' => ReportTodoEnum::cases()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,164 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
|
||||||
|
use App\Entity\Clients;
|
||||||
|
use App\Entity\Notes;
|
||||||
|
use App\Entity\Reports;
|
||||||
|
use App\Entity\Schedule;
|
||||||
|
use App\Services\AddReports;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
|
use Symfony\Component\Form\FormInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||||
|
|
||||||
|
class ClientController extends AbstractController
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
#[Route('/klienci', name: 'app_customers_list')]
|
||||||
|
#[IsGranted('clientView')]
|
||||||
|
public function customersList(EntityManagerInterface $entityManager) : Response
|
||||||
|
{
|
||||||
|
$customers = $entityManager->getRepository(Clients::class)->findBy(["isDeleted" => false]);
|
||||||
|
|
||||||
|
return $this->render("customers/list.html.twig",['customers' => $customers]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/klient/{id}', name: 'app_client')]
|
||||||
|
#[IsGranted('clientView')]
|
||||||
|
public function takeClient(Clients $clients, Request $request, EntityManagerInterface $entityManager) : Response
|
||||||
|
{
|
||||||
|
if ($clients->isDeleted()) {
|
||||||
|
return new Response("Konto usunięte!", Response::HTTP_BAD_REQUEST);
|
||||||
|
}
|
||||||
|
if ($request->getPayload()->get("toDelete") &&
|
||||||
|
$this->isCsrfTokenValid('delete-item',$request->getPayload()->get("token"))) {
|
||||||
|
$this->denyAccessUnlessGranted('clientDelete');
|
||||||
|
$entityManager->getRepository(Clients::class)->deleteUser($clients);
|
||||||
|
return $this->redirect($request->getPayload()->get("backUrl"));
|
||||||
|
}
|
||||||
|
$schedules = $entityManager->getRepository(Schedule::class)->findOneBy(["client" => $clients->getId()]);
|
||||||
|
$reports = $entityManager->getRepository(Reports::class)->findBy(["client" => $clients->getId()],["number"=>"DESC"]);
|
||||||
|
$notes = $entityManager->getRepository(Notes::class)->findOneBy(["clientId" => $clients->getId()]);
|
||||||
|
|
||||||
|
return $this->render('customers/show.html.twig', [
|
||||||
|
'client' => $clients,
|
||||||
|
'schedules' => $schedules,
|
||||||
|
'reports' => $reports,
|
||||||
|
'notes' => $notes,
|
||||||
|
'backUrl' => $request->headers->get('referer')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
#[Route('/dodaj_klienta/{id}', name: 'app_add_client', defaults: ['id'=>0])]
|
||||||
|
#[IsGranted('clientAdd')]
|
||||||
|
public function addClient(Request $request, EntityManagerInterface $entityManager, AddReports $addReports, Clients $clients = null): Response
|
||||||
|
{
|
||||||
|
$isEdit = true;
|
||||||
|
if (!$clients) {
|
||||||
|
$clients = new Clients();
|
||||||
|
$isEdit = false;
|
||||||
|
}
|
||||||
|
$form = $this->takeForm($clients);
|
||||||
|
$form->handleRequest($request);
|
||||||
|
|
||||||
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
|
/** @var Clients $newClient */
|
||||||
|
$newClient = $form->getData();
|
||||||
|
$entityManager->persist($newClient);
|
||||||
|
$entityManager->flush();
|
||||||
|
if (!$isEdit) {
|
||||||
|
$addReports->setClient($newClient);
|
||||||
|
$addReports->init();
|
||||||
|
}
|
||||||
|
if ($isEdit || $form->getClickedButton() === $form->get('submitAndRedirect')) {
|
||||||
|
return $this->redirectToRoute('app_client', ['id'=>$newClient->getId()]);
|
||||||
|
}
|
||||||
|
return $this->redirectToRoute('app_add_client');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render("customers/add.html.twig",[
|
||||||
|
'form' => $form->createView(),
|
||||||
|
'client' => $clients,
|
||||||
|
'isEdit' => $isEdit,
|
||||||
|
'state' => []
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/klient/{clientId}/edit-note', name: 'app_edit_client_note')]
|
||||||
|
#[IsGranted('clientEdit')]
|
||||||
|
public function addNotes(Request $request, int $clientId, EntityManagerInterface $entityManager) : Response
|
||||||
|
{
|
||||||
|
$notes = $entityManager->getRepository(Notes::class)->findOneBy(["clientId" => $clientId]);
|
||||||
|
if (!$notes) {
|
||||||
|
$notes = new Notes();
|
||||||
|
}
|
||||||
|
$form = $this->createFormBuilder($notes)
|
||||||
|
->add('description', TextareaType::class)
|
||||||
|
->add('save', SubmitType::class)
|
||||||
|
->getForm();
|
||||||
|
$form->handleRequest($request);
|
||||||
|
|
||||||
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
|
/** @var Notes $newNote */
|
||||||
|
$newNote = $form->getData();
|
||||||
|
$newNote->setClientId($clientId);
|
||||||
|
$entityManager->persist($newNote);
|
||||||
|
$entityManager->flush();
|
||||||
|
|
||||||
|
return $this->redirectToRoute("app_client", ['id'=>$clientId]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render('customers/add_note.html.twig', [
|
||||||
|
'form' => $form->createView()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/klient/{id}/is-complete', name: 'app_set_complete')]
|
||||||
|
#[IsGranted('clientEdit')]
|
||||||
|
public function setComplete(Clients $clients, Request $request, EntityManagerInterface $entityManager): Response
|
||||||
|
{
|
||||||
|
if ($request->getPayload()->get("toComplete") ||
|
||||||
|
$this->isCsrfTokenValid('set-complete-item',$request->getPayload()->get("token"))) {
|
||||||
|
$isComplete = true;
|
||||||
|
if ($clients->isComplete()) {
|
||||||
|
$isComplete = false;
|
||||||
|
}
|
||||||
|
$clients->setComplete($isComplete);
|
||||||
|
$entityManager->persist($clients);
|
||||||
|
$entityManager->flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirectToRoute('app_client', ['id'=>$clients->getId()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function takeForm(Clients $clients): FormInterface
|
||||||
|
{
|
||||||
|
return $this->createFormBuilder($clients)
|
||||||
|
->add('strName',TextType::class, ['label' => 'Imię i nazwisko'])
|
||||||
|
->add('intNIP', IntegerType::class, ['label' => 'NIP'])
|
||||||
|
->add('strAddress', TextType::class, ['label' => 'Adres'])
|
||||||
|
->add('strEmail',EmailType::class, ['label' => 'E-mail'])
|
||||||
|
->add('intPhone',IntegerType::class, ['label' => 'Numer telefonu','required'=>false])
|
||||||
|
->add('dateLegitimacy', DateType::class, [
|
||||||
|
'label' => 'Data prawomocności',
|
||||||
|
'widget' => 'single_text',
|
||||||
|
])
|
||||||
|
->add('dateProclamation', DateType::class, [
|
||||||
|
'label' => 'Data obwieszczenia',
|
||||||
|
'widget' => 'single_text'
|
||||||
|
])
|
||||||
|
->add('submit', SubmitType::class)
|
||||||
|
->add('submitAndRedirect', SubmitType::class, )
|
||||||
|
->getForm();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Entity\Clients;
|
||||||
|
use App\Entity\Reports;
|
||||||
|
use App\Entity\ReportsTodo;
|
||||||
|
use App\Enum\ReportTodoEnum;
|
||||||
|
use App\Services\AddReports;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||||
|
|
||||||
|
class ReportsController extends AbstractController
|
||||||
|
{
|
||||||
|
#[Route('/set-status-todo', name: 'app_set_status_todo')]
|
||||||
|
#[IsGranted('reportEdit')]
|
||||||
|
public function setStatusTodo(EntityManagerInterface $entityManager, AddReports $reportsService, Request $request): Response
|
||||||
|
{
|
||||||
|
$reportId = $request->getPayload()->get('reportId');
|
||||||
|
$token = $request->getPayload()->get("token");
|
||||||
|
if ($reportId && $this->isCsrfTokenValid('report-status', $token)) {
|
||||||
|
$report = $entityManager->getRepository(Reports::class)->find($reportId);
|
||||||
|
$reportsService->setClient($report->getClient());
|
||||||
|
$isDone = false;
|
||||||
|
foreach (ReportTodoEnum::cases() as $case) {
|
||||||
|
$todo = $entityManager->getRepository(ReportsTodo::class)->findOneBy([
|
||||||
|
"report" => $report->getId(),
|
||||||
|
"name" => $case->value
|
||||||
|
]);
|
||||||
|
if (!$todo) {
|
||||||
|
$todo = new ReportsTodo();
|
||||||
|
$todo->setReport($report);
|
||||||
|
$todo->setName($case);
|
||||||
|
}
|
||||||
|
if (isset($_POST[$case->value])){
|
||||||
|
$todo->setDeleted(false);
|
||||||
|
} else {
|
||||||
|
$todo->setDeleted(true);
|
||||||
|
}
|
||||||
|
if ($todo->getName() === ReportTodoEnum::COMPLETE && !$todo->isDeleted()) {
|
||||||
|
$isDone = true;
|
||||||
|
}
|
||||||
|
$entityManager->persist($todo);
|
||||||
|
}
|
||||||
|
$report->setDone($isDone);
|
||||||
|
$entityManager->persist($report);
|
||||||
|
$entityManager->flush();
|
||||||
|
$reportsService->tryAddNextReport();
|
||||||
|
}
|
||||||
|
return $this->redirect($request->headers->get('referer'));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/add-next-report', name: 'app_add_next_report')]
|
||||||
|
#[IsGranted('reportEdit')]
|
||||||
|
public function addNextReport(Request $request, EntityManagerInterface $entityManager, AddReports $addReports): Response
|
||||||
|
{
|
||||||
|
$clientId = $request->getPayload()->get('clientId');
|
||||||
|
$token = $request->getPayload()->get("token");
|
||||||
|
if ($clientId && $this->isCsrfTokenValid('add-next-report', $token)) {
|
||||||
|
$client = $entityManager->getRepository(Clients::class)->find($clientId);
|
||||||
|
$addReports->setClient($client);
|
||||||
|
$addReports->addNextReport();
|
||||||
|
}
|
||||||
|
return $this->redirect($request->headers->get('referer'));
|
||||||
|
}
|
||||||
|
#[Route('/edit-first-report', name: 'app_edit_first_report')]
|
||||||
|
#[IsGranted('reportEdit')]
|
||||||
|
public function editFirstReport(Request $request, EntityManagerInterface $entityManager): Response
|
||||||
|
{
|
||||||
|
$clientId = $request->getPayload()->get('clientId');
|
||||||
|
$date = $request->getPayload()->get('newDate');
|
||||||
|
$token = $request->getPayload()->get("token");
|
||||||
|
if ($clientId && $this->isCsrfTokenValid('edit-first-report', $token)) {
|
||||||
|
$report = $entityManager->getRepository(Reports::class)->findBy(["client" => $clientId], ["dateStart"=>"ASC"]);
|
||||||
|
$newDateStart = new \DateTime($date);
|
||||||
|
$i=0;
|
||||||
|
foreach ($report as $item) {
|
||||||
|
$tmp = clone $newDateStart;
|
||||||
|
$tmp->modify('+'.AddReports::NEXT_REPORT_MONTH * $i.' month');
|
||||||
|
$item->setDateStart($tmp);
|
||||||
|
$entityManager->persist($item);
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$entityManager->flush();
|
||||||
|
}
|
||||||
|
return $this->redirectToRoute('app_client', ['id'=>$clientId]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Entity\Clients;
|
||||||
|
use App\Entity\Schedule;
|
||||||
|
use App\Helper\MonthHelper;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
|
||||||
|
class ScheduleController extends AbstractController
|
||||||
|
{
|
||||||
|
#[Route('/schedule/{typeId}', name: 'app_schedule', defaults: ['typeId' => 1])]
|
||||||
|
public function index(EntityManagerInterface $entityManager, int $typeId = 1): Response
|
||||||
|
{
|
||||||
|
if ($typeId == 1) {
|
||||||
|
$schedulesTmp = $entityManager->getRepository(Schedule::class)->findAllCurrent();
|
||||||
|
} else {
|
||||||
|
$schedulesTmp = $entityManager->getRepository(Schedule::class)->findAllOverdue();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render('schedule/index.html.twig', [
|
||||||
|
'typeId' => $typeId,
|
||||||
|
'schedules' => $schedulesTmp,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/schedule_status', name: 'app_schedule_status')]
|
||||||
|
public function setDone(EntityManagerInterface $entityManager, Request $request): Response
|
||||||
|
{
|
||||||
|
$scheduleId = $request->getPayload()->get('scheduleId');
|
||||||
|
$token = $request->getPayload()->get("token");
|
||||||
|
if ($scheduleId && $this->isCsrfTokenValid('schedule-status', $token)) {
|
||||||
|
$schedule = $entityManager->getRepository(Schedule::class)->find($scheduleId);
|
||||||
|
$isDone = true;
|
||||||
|
if ($schedule->isDone()) {
|
||||||
|
$isDone = false;
|
||||||
|
}
|
||||||
|
if ($isDone) {
|
||||||
|
$schedule->setDateDone(new \DateTime());
|
||||||
|
}
|
||||||
|
$schedule->setDone($isDone);
|
||||||
|
$entityManager->persist($schedule);
|
||||||
|
$entityManager->flush();
|
||||||
|
|
||||||
|
}
|
||||||
|
return $this->redirect($request->headers->get('referer') ?? $this->generateUrl('app_schedule'));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller\User;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
|
||||||
|
class LoginController extends AbstractController
|
||||||
|
{
|
||||||
|
#[Route('/login', name: 'app_login')]
|
||||||
|
public function index(): Response
|
||||||
|
{
|
||||||
|
return $this->render('login/index.html.twig', [
|
||||||
|
'controller_name' => 'LoginController',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller\User;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
use Symfony\Component\Routing\Generator\UrlGenerator;
|
||||||
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
|
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
|
||||||
|
|
||||||
|
class SecurityController extends AbstractController
|
||||||
|
{
|
||||||
|
#[Route(path: '/login', name: 'app_login')]
|
||||||
|
public function login(AuthenticationUtils $authenticationUtils): Response
|
||||||
|
{
|
||||||
|
if ($this->getUser() && $this->getParameter('kernel.environment') === 'prod') {
|
||||||
|
$url=$this->generateUrl('app_base', [], UrlGeneratorInterface::ABSOLUTE_URL);
|
||||||
|
return $this->redirect(str_replace("http","https",$url));
|
||||||
|
}
|
||||||
|
// get the login error if there is one
|
||||||
|
$error = $authenticationUtils->getLastAuthenticationError();
|
||||||
|
|
||||||
|
// last username entered by the user
|
||||||
|
$lastUsername = $authenticationUtils->getLastUsername();
|
||||||
|
|
||||||
|
return $this->render('security/login.html.twig', [
|
||||||
|
'last_username' => $lastUsername,
|
||||||
|
'error' => $error,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route(path: '/logout', name: 'app_logout')]
|
||||||
|
public function logout(): void
|
||||||
|
{
|
||||||
|
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,200 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Repository\ClientsRepository;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use Doctrine\DBAL\Types\Types;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
#[ORM\Entity(repositoryClass: ClientsRepository::class)]
|
||||||
|
class Clients
|
||||||
|
{
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\GeneratedValue]
|
||||||
|
#[ORM\Column]
|
||||||
|
private ?int $id = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255)]
|
||||||
|
private ?string $strName = null;
|
||||||
|
|
||||||
|
#[ORM\Column(type: Types::BIGINT)]
|
||||||
|
private ?int $intNIP = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255)]
|
||||||
|
private ?string $strAddress = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255)]
|
||||||
|
private ?string $strEmail = null;
|
||||||
|
|
||||||
|
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
||||||
|
private ?\DateTimeInterface $dateLegitimacy = null;
|
||||||
|
|
||||||
|
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
||||||
|
private ?\DateTimeInterface $dateProclamation = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Collection<int, Schedule>
|
||||||
|
*/
|
||||||
|
#[ORM\OneToMany(targetEntity: Schedule::class, mappedBy: 'client')]
|
||||||
|
private Collection $schedules;
|
||||||
|
|
||||||
|
#[ORM\Column(options: ["default" => "0"])]
|
||||||
|
private bool $isDeleted = false;
|
||||||
|
|
||||||
|
#[ORM\Column(options: ["default" => "0"])]
|
||||||
|
private bool $isComplete = false;
|
||||||
|
|
||||||
|
#[ORM\Column(nullable: true)]
|
||||||
|
private ?int $intPhone = null;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->schedules = new ArrayCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStrName(): ?string
|
||||||
|
{
|
||||||
|
return $this->strName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setStrName(string $strName): static
|
||||||
|
{
|
||||||
|
$this->strName = $strName;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIntNIP(): ?int
|
||||||
|
{
|
||||||
|
return $this->intNIP;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setIntNIP(int $intNIP): static
|
||||||
|
{
|
||||||
|
$this->intNIP = $intNIP;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStrAddress(): ?string
|
||||||
|
{
|
||||||
|
return $this->strAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setStrAddress(string $strAddress): static
|
||||||
|
{
|
||||||
|
$this->strAddress = $strAddress;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStrEmail(): ?string
|
||||||
|
{
|
||||||
|
return $this->strEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setStrEmail(string $strEmail): static
|
||||||
|
{
|
||||||
|
$this->strEmail = $strEmail;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/** Data prawomocności */
|
||||||
|
public function getDateLegitimacy(): ?\DateTimeInterface
|
||||||
|
{
|
||||||
|
return $this->dateLegitimacy;
|
||||||
|
}
|
||||||
|
/** Data prawomocności */
|
||||||
|
|
||||||
|
public function setDateLegitimacy(\DateTimeInterface $dateLegitimacy): static
|
||||||
|
{
|
||||||
|
$this->dateLegitimacy = $dateLegitimacy;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Data obwieszczenia */
|
||||||
|
public function getDateProclamation(): ?\DateTimeInterface
|
||||||
|
{
|
||||||
|
return $this->dateProclamation;
|
||||||
|
}
|
||||||
|
/** Data obwieszczenia */
|
||||||
|
public function setDateProclamation(\DateTimeInterface $dateProclamation): static
|
||||||
|
{
|
||||||
|
$this->dateProclamation = $dateProclamation;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return Collection<int, Schedule>
|
||||||
|
*/
|
||||||
|
public function getSchedules(): Collection
|
||||||
|
{
|
||||||
|
return $this->schedules;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addSchedule(Schedule $schedule): static
|
||||||
|
{
|
||||||
|
if (!$this->schedules->contains($schedule)) {
|
||||||
|
$this->schedules->add($schedule);
|
||||||
|
$schedule->setClient($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeSchedule(Schedule $schedule): static
|
||||||
|
{
|
||||||
|
if ($this->schedules->removeElement($schedule)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($schedule->getClient() === $this) {
|
||||||
|
$schedule->setClient(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isDeleted(): bool
|
||||||
|
{
|
||||||
|
return $this->isDeleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDeleted(bool $isDeleted): static
|
||||||
|
{
|
||||||
|
$this->isDeleted = $isDeleted;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isComplete(): ?bool
|
||||||
|
{
|
||||||
|
return $this->isComplete;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setComplete(bool $isComplete): static
|
||||||
|
{
|
||||||
|
$this->isComplete = $isComplete;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIntPhone(): ?int
|
||||||
|
{
|
||||||
|
return $this->intPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setIntPhone(?int $intPhone): static
|
||||||
|
{
|
||||||
|
$this->intPhone = $intPhone;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Repository\NotesRepository;
|
||||||
|
use Doctrine\DBAL\Types\Types;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
#[ORM\Entity(repositoryClass: NotesRepository::class)]
|
||||||
|
class Notes
|
||||||
|
{
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\GeneratedValue]
|
||||||
|
#[ORM\Column]
|
||||||
|
private ?int $id = null;
|
||||||
|
|
||||||
|
#[ORM\Column]
|
||||||
|
private ?int $clientId = null;
|
||||||
|
|
||||||
|
#[ORM\Column(type: Types::TEXT)]
|
||||||
|
private ?string $description = null;
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClientId(): ?int
|
||||||
|
{
|
||||||
|
return $this->clientId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setClientId(?int $clientId): void
|
||||||
|
{
|
||||||
|
$this->clientId = $clientId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getDescription(): ?string
|
||||||
|
{
|
||||||
|
return $this->description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDescription(string $description): static
|
||||||
|
{
|
||||||
|
$this->description = $description;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,197 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Enum\ReportStatus;
|
||||||
|
use App\Enum\ReportTodoEnum;
|
||||||
|
use App\Repository\ReportsRepository;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use Doctrine\DBAL\Types\Types;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
#[ORM\Entity(repositoryClass: ReportsRepository::class)]
|
||||||
|
class Reports
|
||||||
|
{
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\GeneratedValue]
|
||||||
|
#[ORM\Column]
|
||||||
|
private ?int $id = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne]
|
||||||
|
#[ORM\JoinColumn(referencedColumnName: "id", nullable: false)]
|
||||||
|
private ?Clients $client = null;
|
||||||
|
|
||||||
|
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
||||||
|
private ?\DateTimeInterface $dateStart = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Collection<int, ReportsTodo>
|
||||||
|
*/
|
||||||
|
#[ORM\OneToMany(targetEntity: ReportsTodo::class, mappedBy: 'report', orphanRemoval: true)]
|
||||||
|
|
||||||
|
private Collection $reportsTodos;
|
||||||
|
|
||||||
|
#[ORM\Column(options: ["default" => "0"])]
|
||||||
|
private bool $isDelete = false;
|
||||||
|
|
||||||
|
private int $numberOfReport = 0;
|
||||||
|
|
||||||
|
#[ORM\Column(options: ["default" => "0"])]
|
||||||
|
private bool $isDone = false;
|
||||||
|
|
||||||
|
#[ORM\Column]
|
||||||
|
private ?int $number = null;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->reportsTodos = new ArrayCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDateStart(): ?\DateTimeInterface
|
||||||
|
{
|
||||||
|
return $this->dateStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDateStart(\DateTimeInterface $dateStart): static
|
||||||
|
{
|
||||||
|
$this->dateStart = $dateStart;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClient(): ?Clients
|
||||||
|
{
|
||||||
|
return $this->client;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setClient(?Clients $client): static
|
||||||
|
{
|
||||||
|
$this->client = $client;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, ReportsTodo>
|
||||||
|
*/
|
||||||
|
public function getReportsTodos(): Collection
|
||||||
|
{
|
||||||
|
return $this->reportsTodos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addReportsTodo(ReportsTodo $reportsTodo): static
|
||||||
|
{
|
||||||
|
if (!$this->reportsTodos->contains($reportsTodo)) {
|
||||||
|
$this->reportsTodos->add($reportsTodo);
|
||||||
|
$reportsTodo->setReport($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeReportsTodo(ReportsTodo $reportsTodo): static
|
||||||
|
{
|
||||||
|
if ($this->reportsTodos->removeElement($reportsTodo)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($reportsTodo->getReport() === $this) {
|
||||||
|
$reportsTodo->setReport(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isReportsTodo(ReportTodoEnum $enum): bool
|
||||||
|
{
|
||||||
|
$return = false;
|
||||||
|
foreach ($this->getReportsTodos() as $reportsTodo) {
|
||||||
|
if ($reportsTodo->getName() === $enum) {
|
||||||
|
$return = !$reportsTodo->isDeleted();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function countTodoReports(): int
|
||||||
|
{
|
||||||
|
$count = 0;
|
||||||
|
foreach ($this->getReportsTodos() as $reportsTodo) {
|
||||||
|
if (!$reportsTodo->isDeleted()) {
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function takeStatusTodo(): ReportStatus
|
||||||
|
{
|
||||||
|
if ($this->countTodoReports() === 0) {
|
||||||
|
return ReportStatus::INSERT;
|
||||||
|
}
|
||||||
|
$status = ReportStatus::WORKING;
|
||||||
|
foreach ($this->getReportsTodos() as $reportsTodo) {
|
||||||
|
if ($reportsTodo->isDeleted()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($reportsTodo->getName() === ReportTodoEnum::COMPLETE) {
|
||||||
|
$status = ReportStatus::COMPLETE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isDelete(): ?bool
|
||||||
|
{
|
||||||
|
return $this->isDelete;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDelete(bool $isDelete): static
|
||||||
|
{
|
||||||
|
$this->isDelete = $isDelete;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNumberOfReport(): int
|
||||||
|
{
|
||||||
|
return $this->numberOfReport;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNumberOfReport(int $numberOfReport): void
|
||||||
|
{
|
||||||
|
$this->numberOfReport = $numberOfReport;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isDone(): bool
|
||||||
|
{
|
||||||
|
return $this->isDone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDone(bool $isDone): static
|
||||||
|
{
|
||||||
|
$this->isDone = $isDone;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNumber(): ?int
|
||||||
|
{
|
||||||
|
return $this->number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNumber(int $number): static
|
||||||
|
{
|
||||||
|
$this->number = $number;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Enum\ReportStatus;
|
||||||
|
use App\Enum\ReportTodoEnum;
|
||||||
|
use App\Repository\ReportsTodoRepository;
|
||||||
|
use Doctrine\DBAL\Types\Types;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
#[ORM\Entity(repositoryClass: ReportsTodoRepository::class)]
|
||||||
|
class ReportsTodo
|
||||||
|
{
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\GeneratedValue]
|
||||||
|
#[ORM\Column]
|
||||||
|
private ?int $id = null;
|
||||||
|
|
||||||
|
#[ORM\Column(type: Types::SMALLINT, enumType: ReportTodoEnum::class)]
|
||||||
|
private ?ReportTodoEnum $name = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne]
|
||||||
|
#[ORM\JoinColumn(referencedColumnName: 'id', nullable: false)]
|
||||||
|
private ?Reports $report = null;
|
||||||
|
|
||||||
|
#[ORM\Column(options: ["default" => false])]
|
||||||
|
private ?bool $deleted = false;
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName(): ReportTodoEnum
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setName(ReportTodoEnum $name): static
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getReport(): ?Reports
|
||||||
|
{
|
||||||
|
return $this->report;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setReport(?Reports $report): static
|
||||||
|
{
|
||||||
|
$this->report = $report;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isDeleted(): ?bool
|
||||||
|
{
|
||||||
|
return $this->deleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDeleted(bool $deleted): static
|
||||||
|
{
|
||||||
|
$this->deleted = $deleted;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Enum\ScheduleStatus;
|
||||||
|
use App\Repository\ScheduleRepository;
|
||||||
|
use Doctrine\DBAL\Types\Types;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
#[ORM\Entity(repositoryClass: ScheduleRepository::class)]
|
||||||
|
class Schedule
|
||||||
|
{
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\GeneratedValue]
|
||||||
|
#[ORM\Column]
|
||||||
|
private ?int $id = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'schedules')]
|
||||||
|
#[ORM\JoinColumn(nullable: false)]
|
||||||
|
private ?Clients $client = null;
|
||||||
|
|
||||||
|
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
||||||
|
private ?\DateTimeInterface $dateEnd = null;
|
||||||
|
|
||||||
|
#[ORM\Column(options: ["default" => "0"])]
|
||||||
|
private bool $isDone = false;
|
||||||
|
|
||||||
|
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
||||||
|
private ?\DateTimeInterface $dateDone = null;
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClient(): ?Clients
|
||||||
|
{
|
||||||
|
return $this->client;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setClient(?Clients $client): static
|
||||||
|
{
|
||||||
|
$this->client = $client;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDateEnd(): ?\DateTimeInterface
|
||||||
|
{
|
||||||
|
return $this->dateEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDateEnd(\DateTimeInterface $dateEnd): static
|
||||||
|
{
|
||||||
|
$this->dateEnd = $dateEnd;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isDone(): bool
|
||||||
|
{
|
||||||
|
return $this->isDone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDone(bool $isDone): static
|
||||||
|
{
|
||||||
|
$this->isDone = $isDone;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTimeLeft(): int
|
||||||
|
{
|
||||||
|
$today = new \DateTime();
|
||||||
|
$diff = $today->diff($this->getDateEnd());
|
||||||
|
// $diff = $this->getDateEnd()->diff($today);
|
||||||
|
return $diff->format("%r%a");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDateDone(): ?\DateTimeInterface
|
||||||
|
{
|
||||||
|
return $this->dateDone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDateDone(?\DateTimeInterface $dateDone): static
|
||||||
|
{
|
||||||
|
$this->dateDone = $dateDone;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStatus(): ScheduleStatus
|
||||||
|
{
|
||||||
|
$enum = ScheduleStatus::TODO;
|
||||||
|
if ($this->getTimeLeft() < 7){
|
||||||
|
$enum = ScheduleStatus::INCOMING;
|
||||||
|
}
|
||||||
|
if ($this->getTimeLeft() < 2){
|
||||||
|
$enum = ScheduleStatus::OVERDUE;
|
||||||
|
}
|
||||||
|
if ($this->isDone()){
|
||||||
|
$enum = ScheduleStatus::COMPLETED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $enum;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Repository\UserRepository;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||||
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
|
|
||||||
|
#[ORM\Entity(repositoryClass: UserRepository::class)]
|
||||||
|
#[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_USERNAME', fields: ['username'])]
|
||||||
|
class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||||
|
{
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\GeneratedValue]
|
||||||
|
#[ORM\Column]
|
||||||
|
private ?int $id = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 180)]
|
||||||
|
private ?string $username = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var list<string> The user roles
|
||||||
|
*/
|
||||||
|
#[ORM\Column]
|
||||||
|
private array $roles = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string The hashed password
|
||||||
|
*/
|
||||||
|
#[ORM\Column]
|
||||||
|
private ?string $password = null;
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUsername(): ?string
|
||||||
|
{
|
||||||
|
return $this->username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUsername(string $username): static
|
||||||
|
{
|
||||||
|
$this->username = $username;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A visual identifier that represents this user.
|
||||||
|
*
|
||||||
|
* @see UserInterface
|
||||||
|
*/
|
||||||
|
public function getUserIdentifier(): string
|
||||||
|
{
|
||||||
|
return (string) $this->username;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see UserInterface
|
||||||
|
*
|
||||||
|
* @return list<string>
|
||||||
|
*/
|
||||||
|
public function getRoles(): array
|
||||||
|
{
|
||||||
|
$roles = $this->roles;
|
||||||
|
// guarantee every user at least has ROLE_USER
|
||||||
|
$roles[] = 'ROLE_USER';
|
||||||
|
|
||||||
|
return array_unique($roles);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param list<string> $roles
|
||||||
|
*/
|
||||||
|
public function setRoles(array $roles): static
|
||||||
|
{
|
||||||
|
$this->roles = $roles;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see PasswordAuthenticatedUserInterface
|
||||||
|
*/
|
||||||
|
public function getPassword(): string
|
||||||
|
{
|
||||||
|
return $this->password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPassword(string $password): static
|
||||||
|
{
|
||||||
|
$this->password = $password;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see UserInterface
|
||||||
|
*/
|
||||||
|
public function eraseCredentials(): void
|
||||||
|
{
|
||||||
|
// If you store any temporary, sensitive data on the user, clear it here
|
||||||
|
// $this->plainPassword = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Enum;
|
||||||
|
|
||||||
|
enum Months: int {
|
||||||
|
case JANUARY = 1;
|
||||||
|
case FEBRUARY = 2;
|
||||||
|
case MARCH = 3;
|
||||||
|
case APRIL = 4;
|
||||||
|
case MAY = 5;
|
||||||
|
case JUNE = 6;
|
||||||
|
case JULY = 7;
|
||||||
|
case AUGUST = 8;
|
||||||
|
case SEPTEMBER = 9;
|
||||||
|
case OCTOBER = 10;
|
||||||
|
case NOVEMBER = 11;
|
||||||
|
case DECEMBER = 12;
|
||||||
|
|
||||||
|
public static function tryFromName(string $name) : ?Months
|
||||||
|
{
|
||||||
|
$name = strtoupper($name);
|
||||||
|
foreach (self::cases() as $v) {
|
||||||
|
if ($name === $v->name) {
|
||||||
|
return $v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Enum;
|
||||||
|
|
||||||
|
enum ReportStatus: int {
|
||||||
|
case INSERT = 1;
|
||||||
|
case WORKING = 2;
|
||||||
|
case COMPLETE = 3;
|
||||||
|
|
||||||
|
public function checkboxColor() : string
|
||||||
|
{
|
||||||
|
return match ($this)
|
||||||
|
{
|
||||||
|
ReportStatus::INSERT => 'primary',
|
||||||
|
ReportStatus::WORKING => 'success',
|
||||||
|
ReportStatus::COMPLETE => 'dark',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public function backgroundColor() : string
|
||||||
|
{
|
||||||
|
return match ($this)
|
||||||
|
{
|
||||||
|
ReportStatus::INSERT => 'light',
|
||||||
|
ReportStatus::WORKING => 'warning',
|
||||||
|
ReportStatus::COMPLETE => 'success',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public function textColor() : string
|
||||||
|
{
|
||||||
|
return match ($this)
|
||||||
|
{
|
||||||
|
ReportStatus::WORKING, ReportStatus::INSERT => 'dark',
|
||||||
|
ReportStatus::COMPLETE => 'white',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public function linkColor() : string
|
||||||
|
{
|
||||||
|
return match ($this)
|
||||||
|
{
|
||||||
|
ReportStatus::WORKING, ReportStatus::INSERT => 'dark',
|
||||||
|
ReportStatus::COMPLETE => 'light',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public function takeLang() : string
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
ReportStatus::INSERT => 'Oczekujące',
|
||||||
|
ReportStatus::WORKING => 'W trakcie',
|
||||||
|
ReportStatus::COMPLETE => 'Zakończony',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public function next() : ?ReportStatus
|
||||||
|
{
|
||||||
|
return ReportStatus::tryFrom($this->value+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Enum;
|
||||||
|
|
||||||
|
enum ReportTodoEnum: int {
|
||||||
|
case SENT_EMAIL = 1;
|
||||||
|
case MAKE_PHONE_CALL = 2;
|
||||||
|
case INVOICE_SEND = 4;
|
||||||
|
case COMPLETE = 3;
|
||||||
|
|
||||||
|
public function takeLang() : string
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
self::SENT_EMAIL => "Wysłano E-Mail",
|
||||||
|
self::MAKE_PHONE_CALL => "Wykonano połączenie",
|
||||||
|
self::COMPLETE => "Zakończono",
|
||||||
|
self::INVOICE_SEND => "Wysłano fakturę"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public function backgroundColor(): string
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
self::SENT_EMAIL,self::MAKE_PHONE_CALL,self::INVOICE_SEND => "info",
|
||||||
|
self::COMPLETE => "success",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public function takeIcon(): string
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
self::SENT_EMAIL => "envelope",
|
||||||
|
self::MAKE_PHONE_CALL => "phone",
|
||||||
|
self::COMPLETE => "check",
|
||||||
|
self::INVOICE_SEND => "file-invoice",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Enum;
|
||||||
|
|
||||||
|
enum ScheduleStatus: int
|
||||||
|
{
|
||||||
|
case TODO = 1;
|
||||||
|
case INCOMING = 2;
|
||||||
|
case OVERDUE = 3;
|
||||||
|
case COMPLETED = 4;
|
||||||
|
|
||||||
|
public function backgroundColor(): string
|
||||||
|
{
|
||||||
|
return match ($this)
|
||||||
|
{
|
||||||
|
ScheduleStatus::TODO => 'white',
|
||||||
|
ScheduleStatus::INCOMING => 'warning',
|
||||||
|
ScheduleStatus::OVERDUE => 'danger',
|
||||||
|
ScheduleStatus::COMPLETED => 'success',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form;
|
||||||
|
|
||||||
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
|
class ClientsType extends AbstractType
|
||||||
|
{
|
||||||
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
|
{
|
||||||
|
$builder
|
||||||
|
->add('strCompanyName', "text", ['required' => true])
|
||||||
|
->add('intNIP',"integer", ['required' => true])
|
||||||
|
->add('strAddress',"text", ['required' => true])
|
||||||
|
->add('strEmail',"text", ['required' => true,'email' => true]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
|
{
|
||||||
|
$resolver->setDefaults([
|
||||||
|
// Configure your form options here
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Helper;
|
||||||
|
|
||||||
|
class MonthHelper
|
||||||
|
{
|
||||||
|
public function takeMonths() : array
|
||||||
|
{
|
||||||
|
$startDate = new \DateTime("-6 months");
|
||||||
|
|
||||||
|
$return = [];
|
||||||
|
for ($i=1; $i<=12; $i++) {
|
||||||
|
$tmp = clone $startDate;
|
||||||
|
$tmp->modify("+$i month");
|
||||||
|
$return[$i] = $tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getCurrentMonth(int $monthId) : \DateTime
|
||||||
|
{
|
||||||
|
$months = $this->takeMonths();
|
||||||
|
if ($monthId==0) {
|
||||||
|
$currentMonth = intval(date("n"));
|
||||||
|
|
||||||
|
foreach ($months as $mId => $monthObj) {
|
||||||
|
if ($monthObj->format("m") == $currentMonth) {
|
||||||
|
$monthCurrent = $monthObj;
|
||||||
|
$monthId = $mId;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$monthCurrent = $months[$monthId];
|
||||||
|
}
|
||||||
|
return $monthCurrent;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repository;
|
||||||
|
|
||||||
|
use App\Entity\Clients;
|
||||||
|
use App\Entity\Reports;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends ServiceEntityRepository<Clients>
|
||||||
|
*/
|
||||||
|
class ClientsRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, Clients::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteUser(Clients $client): void
|
||||||
|
{
|
||||||
|
$client->setDeleted(true);
|
||||||
|
$this->getEntityManager()->persist($client);
|
||||||
|
$this->getEntityManager()->flush();
|
||||||
|
|
||||||
|
$this->getEntityManager()->getRepository(Reports::class)->deleteAllByClient($client);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return Clients[] Returns an array of Clients objects
|
||||||
|
*/
|
||||||
|
// public function findAllInMonth(\DateTime $date): array
|
||||||
|
// {
|
||||||
|
// $dateStart = clone $date;
|
||||||
|
// $dateStart->modify("first day of this month");
|
||||||
|
// $dateEnd = clone $date;
|
||||||
|
// $dateEnd->modify("last day of this month");
|
||||||
|
// return $this->createQueryBuilder('r')
|
||||||
|
// ->where('r.dateStart >= :dateStart')
|
||||||
|
// ->andWhere('r.dateStart <= :dateEnd')
|
||||||
|
// ->andWhere('r.isDelete = :deleted')
|
||||||
|
// ->setParameter('dateStart', $dateStart->format('Y-m-d'))
|
||||||
|
// ->setParameter('dateEnd', $dateEnd->format('Y-m-d'))
|
||||||
|
// ->setParameter('deleted', 0)
|
||||||
|
//// ->setMaxResults(10)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
// /**
|
||||||
|
// * @return Clients[] Returns an array of Clients objects
|
||||||
|
// */
|
||||||
|
// public function findByExampleField($value): array
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('c')
|
||||||
|
// ->andWhere('c.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->orderBy('c.id', 'ASC')
|
||||||
|
// ->setMaxResults(10)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public function findOneBySomeField($value): ?Clients
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('c')
|
||||||
|
// ->andWhere('c.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getOneOrNullResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repository;
|
||||||
|
|
||||||
|
use App\Entity\Notes;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends ServiceEntityRepository<Notes>
|
||||||
|
*/
|
||||||
|
class NotesRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, Notes::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * @return Notes[] Returns an array of Notes objects
|
||||||
|
// */
|
||||||
|
// public function findByExampleField($value): array
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('n')
|
||||||
|
// ->andWhere('n.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->orderBy('n.id', 'ASC')
|
||||||
|
// ->setMaxResults(10)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public function findOneBySomeField($value): ?Notes
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('n')
|
||||||
|
// ->andWhere('n.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getOneOrNullResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -0,0 +1,143 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repository;
|
||||||
|
|
||||||
|
use App\Entity\Clients;
|
||||||
|
use App\Entity\Reports;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\DBAL\Exception;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends ServiceEntityRepository<Reports>
|
||||||
|
*/
|
||||||
|
class ReportsRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, Reports::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
|
||||||
|
{
|
||||||
|
if (!isset($criteria['isDelete'])) {
|
||||||
|
$criteria['isDelete'] = 0;
|
||||||
|
}
|
||||||
|
return parent::findBy($criteria, $orderBy, $limit, $offset); // TODO: Change the autogenerated stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findAllOverdue()
|
||||||
|
{
|
||||||
|
$dateEnd = new \DateTime();
|
||||||
|
$dateEnd->modify("last day of previous month");
|
||||||
|
$reports = $this->createQueryBuilder('r')
|
||||||
|
->where('r.isDelete = :isDelete')
|
||||||
|
->andWhere('r.dateStart < :dateEnd')
|
||||||
|
->andWhere('r.isDone = :isDone')
|
||||||
|
->setParameter('isDone', 0)
|
||||||
|
->setParameter('isDelete', 0)
|
||||||
|
->setParameter('dateEnd', $dateEnd)
|
||||||
|
->orderBy("r.number","ASC")
|
||||||
|
->getQuery()
|
||||||
|
->getResult();
|
||||||
|
|
||||||
|
// $this->countReport($reports);
|
||||||
|
|
||||||
|
return $reports;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Reports[] Returns an array of Reports objects
|
||||||
|
*/
|
||||||
|
public function findAllInMonth(\DateTime $date): array
|
||||||
|
{
|
||||||
|
$dateStart = clone $date;
|
||||||
|
$dateStart->modify("first day of this month");
|
||||||
|
$dateEnd = clone $date;
|
||||||
|
$dateEnd->modify("last day of this month");
|
||||||
|
$reports = $this->createQueryBuilder('r')
|
||||||
|
->where('r.dateStart >= :dateStart')
|
||||||
|
->andWhere('r.dateStart <= :dateEnd')
|
||||||
|
->andWhere('r.isDelete = :deleted')
|
||||||
|
->setParameter('dateStart', $dateStart->format('Y-m-d'))
|
||||||
|
->setParameter('dateEnd', $dateEnd->format('Y-m-d'))
|
||||||
|
->setParameter('deleted', 0)
|
||||||
|
->orderBy("r.number","ASC")
|
||||||
|
// ->setMaxResults(10)
|
||||||
|
->getQuery()
|
||||||
|
->getResult()
|
||||||
|
;
|
||||||
|
|
||||||
|
// $this->countReport($reports);
|
||||||
|
|
||||||
|
return $reports;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function deleteAllByClient(Clients $client): void
|
||||||
|
{
|
||||||
|
$clientId = $client->getId();
|
||||||
|
if ($clientId) {
|
||||||
|
$db = $this->getEntityManager()->getConnection();
|
||||||
|
$statement = $db->prepare("UPDATE reports SET is_delete = 1 WHERE client_id = :clientId");
|
||||||
|
$statement->bindValue('clientId', $clientId);
|
||||||
|
$statement->executeQuery();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function countReport(array $reports) : bool
|
||||||
|
{
|
||||||
|
$clientIds=[];
|
||||||
|
foreach ($reports as $report) {
|
||||||
|
$clientIds[] = $report->getClient()->getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!count($clientIds)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$findAllForClients = $this->createQueryBuilder('r')
|
||||||
|
->where('r.isDelete = :deleted')
|
||||||
|
->andWhere('r.client IN (:clients)')
|
||||||
|
->setParameter('deleted', 0)
|
||||||
|
->setParameter('clients', $clientIds)
|
||||||
|
->orderBy('r.id', 'ASC')
|
||||||
|
->getQuery()
|
||||||
|
->getResult();
|
||||||
|
|
||||||
|
$clientToReportId = [];
|
||||||
|
if (!count($findAllForClients)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($findAllForClients as $item) {
|
||||||
|
$clientToReportId[$item->getClient()->getId()][] = $item->getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($reports as $report) {
|
||||||
|
$id = $report->getId();
|
||||||
|
$clientReports = $clientToReportId[$report->getClient()->getId()];
|
||||||
|
for ($i = 0; $i < count($clientReports); $i++) {
|
||||||
|
$tmp = $clientReports[$i];
|
||||||
|
if ($tmp == $id) {
|
||||||
|
$report->setNumberOfReport($i + 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public function findOneBySomeField($value): ?Reports
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('r')
|
||||||
|
// ->andWhere('r.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getOneOrNullResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repository;
|
||||||
|
|
||||||
|
use App\Entity\ReportsTodo;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends ServiceEntityRepository<ReportsTodo>
|
||||||
|
*/
|
||||||
|
class ReportsTodoRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, ReportsTodo::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * @return ReportsTodo[] Returns an array of ReportsTodo objects
|
||||||
|
// */
|
||||||
|
// public function findByExampleField($value): array
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('r')
|
||||||
|
// ->andWhere('r.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->orderBy('r.id', 'ASC')
|
||||||
|
// ->setMaxResults(10)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public function findOneBySomeField($value): ?ReportsTodo
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('r')
|
||||||
|
// ->andWhere('r.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getOneOrNullResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repository;
|
||||||
|
|
||||||
|
use App\Entity\Schedule;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends ServiceEntityRepository<Schedule>
|
||||||
|
*/
|
||||||
|
class ScheduleRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, Schedule::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findAllOverdue()
|
||||||
|
{
|
||||||
|
$dateEnd = new \DateTime("now");
|
||||||
|
$reports = $this->createQueryBuilder('s')
|
||||||
|
->where('s.isDone = :isDone')
|
||||||
|
->andWhere('s.dateEnd < :dateEnd')
|
||||||
|
// ->andWhere('s.isDelete = :isDelete')
|
||||||
|
->setParameter('isDone', 0)
|
||||||
|
// ->setParameter('isDelete', 0)
|
||||||
|
->setParameter('dateEnd', $dateEnd)
|
||||||
|
->getQuery()
|
||||||
|
->getResult();
|
||||||
|
|
||||||
|
return $reports;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Schedule[] Returns an array of Schedule objects
|
||||||
|
*/
|
||||||
|
public function findAllCurrent(): array
|
||||||
|
{
|
||||||
|
$date = new \DateTime();
|
||||||
|
$dateStart = clone $date;
|
||||||
|
$dateStart->modify("-15 days");
|
||||||
|
$dateEnd = clone $date;
|
||||||
|
$dateEnd->modify("+30 days");
|
||||||
|
return $this->createQueryBuilder('r')
|
||||||
|
->where('r.dateEnd >= :dateStart')
|
||||||
|
->andWhere('r.dateEnd <= :dateEnd')
|
||||||
|
->andWhere('r.isDone = :isDone')
|
||||||
|
// ->andWhere('r.isDelete = :deleted')
|
||||||
|
->setParameter('dateStart', $dateStart->format('Y-m-d'))
|
||||||
|
->setParameter('dateEnd', $dateEnd->format('Y-m-d'))
|
||||||
|
->setParameter('isDone', 0)
|
||||||
|
// ->setParameter('deleted', 0)
|
||||||
|
// ->setMaxResults(10)
|
||||||
|
->orderBy('r.dateEnd', 'ASC')
|
||||||
|
->getQuery()
|
||||||
|
->getResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
// /**
|
||||||
|
// * @return Schedule[] Returns an array of Schedule objects
|
||||||
|
// */
|
||||||
|
// public function findByExampleField($value): array
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('s')
|
||||||
|
// ->andWhere('s.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->orderBy('s.id', 'ASC')
|
||||||
|
// ->setMaxResults(10)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public function findOneBySomeField($value): ?Schedule
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('s')
|
||||||
|
// ->andWhere('s.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getOneOrNullResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repository;
|
||||||
|
|
||||||
|
use App\Entity\TestEntity;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends ServiceEntityRepository<TestEntity>
|
||||||
|
*/
|
||||||
|
class TestEntityRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, TestEntity::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * @return TestEntity[] Returns an array of TestEntity objects
|
||||||
|
// */
|
||||||
|
// public function findByExampleField($value): array
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('t')
|
||||||
|
// ->andWhere('t.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->orderBy('t.id', 'ASC')
|
||||||
|
// ->setMaxResults(10)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public function findOneBySomeField($value): ?TestEntity
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('t')
|
||||||
|
// ->andWhere('t.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getOneOrNullResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repository;
|
||||||
|
|
||||||
|
use App\Entity\User;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
|
||||||
|
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||||
|
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends ServiceEntityRepository<User>
|
||||||
|
*/
|
||||||
|
class UserRepository extends ServiceEntityRepository implements PasswordUpgraderInterface
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, User::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to upgrade (rehash) the user's password automatically over time.
|
||||||
|
*/
|
||||||
|
public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void
|
||||||
|
{
|
||||||
|
if (!$user instanceof User) {
|
||||||
|
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', $user::class));
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->setPassword($newHashedPassword);
|
||||||
|
$this->getEntityManager()->persist($user);
|
||||||
|
$this->getEntityManager()->flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * @return User[] Returns an array of User objects
|
||||||
|
// */
|
||||||
|
// public function findByExampleField($value): array
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('u')
|
||||||
|
// ->andWhere('u.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->orderBy('u.id', 'ASC')
|
||||||
|
// ->setMaxResults(10)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public function findOneBySomeField($value): ?User
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('u')
|
||||||
|
// ->andWhere('u.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getOneOrNullResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Security;
|
||||||
|
|
||||||
|
use App\Entity\User;
|
||||||
|
use Symfony\Bundle\SecurityBundle\Security;
|
||||||
|
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||||
|
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
|
||||||
|
|
||||||
|
class ClientsVoter extends Voter
|
||||||
|
{
|
||||||
|
const VIEW = "clientView";
|
||||||
|
const ADD = "clientAdd";
|
||||||
|
const EDIT = "clientEdit";
|
||||||
|
const DELETE = "clientDelete";
|
||||||
|
|
||||||
|
public function __construct(readonly private Security $security)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function supports(string $attribute, mixed $subject): bool
|
||||||
|
{
|
||||||
|
if (!in_array($attribute, [self::VIEW, self::EDIT, self::ADD, self::DELETE])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token): bool
|
||||||
|
{
|
||||||
|
$user = $token->getUser();
|
||||||
|
if (!$user instanceof User) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return match ($attribute) {
|
||||||
|
self::VIEW => $this->canView(),
|
||||||
|
self::ADD => $this->canAdd(),
|
||||||
|
self::EDIT => $this->canEdit(),
|
||||||
|
self::DELETE => $this->canDelete(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private function canView() : bool
|
||||||
|
{
|
||||||
|
if ($this->canAdd()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return $this->security->isGranted('ROLE_CLIENT_VIEW');
|
||||||
|
}
|
||||||
|
private function canAdd() : bool
|
||||||
|
{
|
||||||
|
if ($this->canAll()){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return $this->security->isGranted('ROLE_CLIENT_ADD');
|
||||||
|
}
|
||||||
|
// TODO: implement
|
||||||
|
private function canEdit() : bool
|
||||||
|
{
|
||||||
|
return $this->canAdd();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function canDelete() : bool
|
||||||
|
{
|
||||||
|
if ($this->canAll()){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return $this->security->isGranted('ROLE_CLIENT_DELETE');
|
||||||
|
}
|
||||||
|
|
||||||
|
private function canAll() : bool
|
||||||
|
{
|
||||||
|
return $this->security->isGranted('ROLE_ACCESS_ALL');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//HqmN6Egol5o_K5nY
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Security;
|
||||||
|
|
||||||
|
use App\Entity\User;
|
||||||
|
use Symfony\Bundle\SecurityBundle\Security;
|
||||||
|
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||||
|
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
|
||||||
|
|
||||||
|
class ReportsVoter extends Voter
|
||||||
|
{
|
||||||
|
const VIEW = 'reportView';
|
||||||
|
const EDIT = 'reportEdit';
|
||||||
|
|
||||||
|
public function __construct(private readonly Security $security)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
protected function supports(string $attribute, mixed $subject): bool
|
||||||
|
{
|
||||||
|
if (!in_array($attribute, [self::VIEW, self::EDIT])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token): bool
|
||||||
|
{
|
||||||
|
$user = $token->getUser();
|
||||||
|
if (!$user instanceof User) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return match ($attribute) {
|
||||||
|
self::EDIT => $this->canEdit(),
|
||||||
|
self::VIEW => $this->canView(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private function canEdit(): bool
|
||||||
|
{
|
||||||
|
if ($this->canAll()){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return $this->security->isGranted("ROLE_REPORT_EDIT");
|
||||||
|
}
|
||||||
|
private function canView(): bool
|
||||||
|
{
|
||||||
|
if ($this->canEdit()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return $this->security->isGranted("ROLE_REPORT_VIEW");
|
||||||
|
}
|
||||||
|
|
||||||
|
private function canAll() : bool
|
||||||
|
{
|
||||||
|
return $this->security->isGranted('ROLE_ACCESS_ALL');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Services;
|
||||||
|
|
||||||
|
use App\Entity\Clients;
|
||||||
|
use App\Entity\Reports;
|
||||||
|
use App\Entity\Schedule;
|
||||||
|
use App\Enum\ReportTodoEnum;
|
||||||
|
use Doctrine\ORM\EntityManager;
|
||||||
|
|
||||||
|
class AddReports
|
||||||
|
{
|
||||||
|
const REPORT_COUNT_ON_INIT = 1;
|
||||||
|
const NEXT_REPORT_MONTH = 3;
|
||||||
|
const SCHEDULE_END_DAYS = 30;
|
||||||
|
|
||||||
|
protected EntityManager $manager;
|
||||||
|
protected Clients $client;
|
||||||
|
|
||||||
|
public function __construct(EntityManager $entity)
|
||||||
|
{
|
||||||
|
$this->manager = $entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Clients $client
|
||||||
|
*/
|
||||||
|
public function setClient(Clients $client): void
|
||||||
|
{
|
||||||
|
$this->client = $client;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function init(): void
|
||||||
|
{
|
||||||
|
$newClient = $this->client;
|
||||||
|
$month = intval($newClient->getDateLegitimacy()->format('n'));
|
||||||
|
$year = $newClient->getDateLegitimacy()->format('Y');
|
||||||
|
$reportDateStart = new \DateTime("15-$month-$year");
|
||||||
|
|
||||||
|
// Add reports to do
|
||||||
|
for ($i = 1; $i <= self::REPORT_COUNT_ON_INIT; $i++) {
|
||||||
|
$monthAdd = $i * self::NEXT_REPORT_MONTH;
|
||||||
|
$reportDate = clone $reportDateStart;
|
||||||
|
$reportDate->modify("+$monthAdd months");
|
||||||
|
|
||||||
|
$report = new Reports();
|
||||||
|
$report->setClient($newClient);
|
||||||
|
$report->setDateStart($reportDate);
|
||||||
|
$report->setNumber($i);
|
||||||
|
$this->manager->persist($report);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add schedule to do
|
||||||
|
$scheduleDate = clone $newClient->getDateProclamation();
|
||||||
|
$scheduleDate->modify("+" . self::SCHEDULE_END_DAYS . " days");
|
||||||
|
$schedule = new Schedule();
|
||||||
|
$schedule->setClient($newClient);
|
||||||
|
$schedule->setDateEnd($scheduleDate);
|
||||||
|
$this->manager->persist($schedule);
|
||||||
|
|
||||||
|
// Flush
|
||||||
|
$this->manager->flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function tryAddNextReport(): bool
|
||||||
|
{
|
||||||
|
if ($this->client->isComplete()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$reports = $this->manager->getRepository(Reports::class)->findBy(["client" => $this->client]);
|
||||||
|
$countUnDone = 0;
|
||||||
|
foreach ($reports as $report) {
|
||||||
|
if (!$report->isReportsTodo(ReportTodoEnum::COMPLETE)) {
|
||||||
|
$countUnDone++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$numberOfReports = count($reports);
|
||||||
|
$lastReport = $reports[$numberOfReports - 1];
|
||||||
|
if ($countUnDone<self::REPORT_COUNT_ON_INIT) {
|
||||||
|
$dateNext = $lastReport->getDateStart()->modify("+".self::NEXT_REPORT_MONTH." months");
|
||||||
|
$report = new Reports();
|
||||||
|
$report->setClient($this->client);
|
||||||
|
$report->setDateStart($dateNext);
|
||||||
|
$report->setNumber($numberOfReports + 1);
|
||||||
|
$this->manager->persist($report);
|
||||||
|
$this->manager->flush();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addNextReport(): bool
|
||||||
|
{
|
||||||
|
$reports = $this->manager->getRepository(Reports::class)->findOneBy(["client" => $this->client], ["dateStart" => "DESC"]);
|
||||||
|
$report = new Reports();
|
||||||
|
$report->setClient($this->client);
|
||||||
|
|
||||||
|
if ($reports) {
|
||||||
|
$dateToReport = $reports->getDateStart();
|
||||||
|
$report->setNumber($reports->getNumber() + 1);
|
||||||
|
} else {
|
||||||
|
$newClient = $this->client;
|
||||||
|
$month = intval($newClient->getDateLegitimacy()->format('n'));
|
||||||
|
$year = $newClient->getDateLegitimacy()->format('Y');
|
||||||
|
$dateToReport = new \DateTime("15-$month-$year");
|
||||||
|
$report->setNumber(1);
|
||||||
|
}
|
||||||
|
$report->setDateStart($dateToReport->modify("+".self::NEXT_REPORT_MONTH." months"));
|
||||||
|
$this->manager->persist($report);
|
||||||
|
$this->manager->flush();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
// src/Twig/AppExtension.php
|
||||||
|
namespace App\Twig;
|
||||||
|
|
||||||
|
use Twig\Extension\AbstractExtension;
|
||||||
|
use Twig\TwigFilter;
|
||||||
|
|
||||||
|
class AppExtension extends AbstractExtension
|
||||||
|
{
|
||||||
|
public function getFilters(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
new TwigFilter('phone', [$this, 'formatPhone']),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function formatPhone(?int $phoneNumber): string
|
||||||
|
{
|
||||||
|
if (!$phoneNumber) {
|
||||||
|
return "Brak";
|
||||||
|
}
|
||||||
|
|
||||||
|
return number_format($phoneNumber, 0,"."," ");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="pl">
|
||||||
|
<head>
|
||||||
|
{% if app.environment == "prod" %}
|
||||||
|
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" />
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
|
<title>{% block title %}Sprawozdania{% endblock %}</title>
|
||||||
|
|
||||||
|
{% block stylesheets %}
|
||||||
|
{# 'app' must match the first argument to addEntry() in webpack.config.js #}
|
||||||
|
{{ encore_entry_link_tags('app') }}
|
||||||
|
|
||||||
|
<!-- Renders a link tag (if your module requires any CSS)
|
||||||
|
<link rel="stylesheet" href="/build/app.css"> -->
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block javascripts %}
|
||||||
|
{{ encore_entry_script_tags('app') }}
|
||||||
|
|
||||||
|
<!-- Renders app.js & a webpack runtime.js file
|
||||||
|
<script src="/build/runtime.js" defer></script>
|
||||||
|
<script src="/build/app.js" defer></script>
|
||||||
|
See note below about the "defer" attribute -->
|
||||||
|
{% endblock %}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{% block navigation %}
|
||||||
|
{% include "navigation/top.html.twig" %}
|
||||||
|
{% endblock %}
|
||||||
|
<div class="container-fluid" style="margin: 10px 0;">
|
||||||
|
{% block body %}{% endblock %}
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
{% form_theme form 'bootstrap_5_layout.html.twig' %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
{% if state %}
|
||||||
|
{% if state.success %}
|
||||||
|
<div class="alert alert-success">
|
||||||
|
Poprawnie dodano nowego klienta!
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div class="row row-cols-3 align-items-center">
|
||||||
|
<div class="card text-center bg-light-subtle">
|
||||||
|
{{ form(form) }}
|
||||||
|
</div>
|
||||||
|
{% if isEdit %}
|
||||||
|
<div class="card text-center bg-light-subtle">
|
||||||
|
<div class="card-header">
|
||||||
|
Termin pierwszego sprawozdania
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
<form action="{{ path('app_edit_first_report') }}" method="post">
|
||||||
|
<input type="hidden" name="clientId" value="{{ client.id }}">
|
||||||
|
<input type="hidden" name="token" value="{{ csrf_token('edit-first-report') }}">
|
||||||
|
<input type="date" name="newDate" class="form-control">
|
||||||
|
<button type="submit" class="btn btn-primary">Ustaw termin pierwszego sprawozdania</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
{% form_theme form 'bootstrap_5_layout.html.twig' %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
{{ form(form) }}
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
{% block body %}
|
||||||
|
<div class="row place customers_list justify-content-md-center row" data-controller="customers">
|
||||||
|
{% if customers %}
|
||||||
|
<div class="col-xl-8 col-lg-10 card">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="form-floating">
|
||||||
|
<input type="text" class="form-control" placeholder="Szukaj..." id="customerListSearch">
|
||||||
|
<label for="customerListSearch">Szukaj...</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="table-responsive card-body">
|
||||||
|
<table class="table table-hover table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">#</th>
|
||||||
|
<th scope="col">Imię i nazwisko</th>
|
||||||
|
<th scope="col">Adres</th>
|
||||||
|
{# <th scope="col">NIP</th>#}
|
||||||
|
{# <th scope="col">E-mail</th>#}
|
||||||
|
<th scope="col">Data prawomocnosci</th>
|
||||||
|
<th scope="col">Data obwieszczenia</th>
|
||||||
|
{# <th scope="col">Akcja</th>#}
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="customerListTable" class="">
|
||||||
|
{% for customer in customers %}
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{{ loop.index }}</th>
|
||||||
|
<td><a href="{{ path('app_client',{id: customer.id}) }}">{{ customer.strName }}</a></td>
|
||||||
|
<td>{{ customer.strAddress }}</td>
|
||||||
|
{# <td>{{ customer.intNIP }}</td>#}
|
||||||
|
{# <td>{{ customer.strEmail }}</td>#}
|
||||||
|
<td>{{ customer.dateLegitimacy | date("d-m-Y") }}</td>
|
||||||
|
<td>{{ customer.dateProclamation | date("d-m-Y") }}</td>
|
||||||
|
{# <td></td>#}
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
{% block body %}
|
||||||
|
{% if client.isComplete %}
|
||||||
|
<div class="alert alert-warning"><i class="fa-solid fa-circle-info"></i> Zakończono generowanie sprawozdań!</div>
|
||||||
|
{% endif %}
|
||||||
|
<div class="row row-cols-1 row-cols-md-2 g-2">
|
||||||
|
<div class="col">
|
||||||
|
<div class="card text-center">
|
||||||
|
<div class="card-header">
|
||||||
|
<h2>{{ client.strName }}</h2>
|
||||||
|
</div>
|
||||||
|
<ul class="list-group list-group-flush">
|
||||||
|
<li class="list-group-item"><span style="font-weight: bold">Adres: </span>{{ client.strAddress }}</li>
|
||||||
|
<li class="list-group-item"><span style="font-weight: bold">NIP: </span>{{ client.intNIP }}</li>
|
||||||
|
<li class="list-group-item"><span style="font-weight: bold">E-mail: </span>{{ client.strEmail }}</li>
|
||||||
|
<li class="list-group-item"><span style="font-weight: bold">Telefon: </span>{{ client.intPhone | phone }}</li>
|
||||||
|
<li class="list-group-item"><span style="font-weight: bold">Data prawomocności: </span>{{ client.dateLegitimacy | date("d-m-Y") }}</li>
|
||||||
|
<li class="list-group-item"><span style="font-weight: bold">Data obwieszczenia: </span>{{ client.dateProclamation | date("d-m-Y") }}</li>
|
||||||
|
{% if schedules %}
|
||||||
|
<li class="list-group-item list-group-item-{{ schedules.getStatus.backgroundColor }}">
|
||||||
|
<span style="font-weight: bold">Harmonogram: </span>
|
||||||
|
{% if schedules.isDone %}
|
||||||
|
wysłano: {{ schedules.getDateDone | date("d-m-Y H:i") }}
|
||||||
|
{% else %}
|
||||||
|
Pozostały czas: <span style="font-size: 1.2em">{{ schedules.getTimeLeft }}</span> dni
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
<div class="card-footer" style="display: inline-flex;margin: auto;">
|
||||||
|
{% if is_granted('reportEdit') %}
|
||||||
|
<form action="{{ path('app_set_complete',{id: client.id}) }}" method="post" style="padding: 0 5px;">
|
||||||
|
<input type="hidden" name="isComplete" value="1">
|
||||||
|
<input type="hidden" name="token" value="{{ csrf_token("set-complete-item") }}">
|
||||||
|
<button class="btn btn-warning" type="submit">
|
||||||
|
{% if client.isComplete %}
|
||||||
|
Wznów
|
||||||
|
{% else %}
|
||||||
|
Zakończ
|
||||||
|
{% endif %}
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if not client.isComplete and is_granted('clientEdit') %}
|
||||||
|
<a href="{{ path('app_add_client',{id: client.id}) }}" class="btn btn-success">Edytuj</a>
|
||||||
|
{% endif %}
|
||||||
|
{% if is_granted('clientDelete') %}
|
||||||
|
<button class="btn btn-danger" type="button" data-bs-toggle="modal" data-bs-target="#removeConfirmModal">Usuń</button>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% if is_granted('reportView') %}
|
||||||
|
<div class="card text-center bg-light-subtle">
|
||||||
|
<div class="card-header">
|
||||||
|
<h2>Sprawozdania</h2>
|
||||||
|
{% if not client.isComplete and is_granted('reportEdit') %}
|
||||||
|
<form action="{{ path('app_add_next_report') }}" method="post">
|
||||||
|
<input type="hidden" name="clientId" value="{{ client.id }}">
|
||||||
|
<input type="hidden" name="token" value="{{ csrf_token('add-next-report') }}">
|
||||||
|
<button type="submit" class="btn btn-primary">Dodaj następne sprawozdanie</button>
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<ul class="list-group list-group-flush">
|
||||||
|
{% for report in reports %}
|
||||||
|
<li class="list-group-item d-flex align-items-center">
|
||||||
|
<span class="badge rounded-pill text-bg-primary">{{ report.number }}</span>
|
||||||
|
<span class="badge rounded-pill text-bg-light">{{ report.getDateStart | date("Y-m-d") }}</span>
|
||||||
|
|
||||||
|
{% for todo in report.getReportsTodos %}
|
||||||
|
{% if report.isReportsTodo(todo.getName) %}
|
||||||
|
<span class="badge rounded-pill text-bg-{{ todo.getName.backgroundColor }}">
|
||||||
|
<i class="fa fa-solid fa-{{ todo.getName.takeIcon }}"> </i> {{ todo.getName.takeLang }}
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header text-center"><h2>Notatka</h2></div>
|
||||||
|
{% if notes %}
|
||||||
|
<div class="card-body">
|
||||||
|
<p>
|
||||||
|
{% apply markdown_to_html %}
|
||||||
|
{{ notes.description }}
|
||||||
|
{% endapply %}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% if not client.isComplete and is_granted('clientEdit') %}
|
||||||
|
<div class="card-footer text-center">
|
||||||
|
<a href="{{ path('app_edit_client_note',{clientId: client.id}) }}" class="btn btn-success">Edytuj</a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="modal fade" id="removeConfirmModal" tabindex="-1" aria-labelledby="removeConfirmModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h1 class="modal-title fs-5" id="removeConfirmModalLabel">Czy na pewno chcesz usunąć tego klienta?</h1>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
Usunięcie klienta spowoduje wyczyszczenie wszystkich informacji z nim związanych (w tym sprawozdania, harmonogramy).<br>
|
||||||
|
<h3>Tej operacji nie można cofnąć!</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||||
|
<form action="{{ path('app_client',{id:client.id}) }}" method="post">
|
||||||
|
<input type="hidden" name="token" value="{{ csrf_token('delete-item') }}">
|
||||||
|
<input type="hidden" name="toDelete" value="1">
|
||||||
|
<input type="hidden" name="backUrl" value="{{ backUrl }}">
|
||||||
|
<button type="submit" class="btn btn-danger">Usuń</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}Hello LoginController!{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<style>
|
||||||
|
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
|
||||||
|
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="example-wrapper">
|
||||||
|
<h1>Hello {{ controller_name }}! ✅</h1>
|
||||||
|
|
||||||
|
This friendly message is coming from:
|
||||||
|
<ul>
|
||||||
|
<li>Your controller at <code>/home/ryjek/www/sprawozdania/project/src/Controller/LoginController.php</code></li>
|
||||||
|
<li>Your template at <code>/home/ryjek/www/sprawozdania/project/templates/login/index.html.twig</code></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{% macro month_menu(routeName, months, currentMonth) %}
|
||||||
|
<div class="row row-cols-12 reports-months-all">
|
||||||
|
<div class="col">
|
||||||
|
<a href="{{ path(routeName, {monthId:-1}) }}" class="btn {% if currentMonth is null %}btn-success{% else %}btn-secondary{% endif %}">Zaległe</a>
|
||||||
|
</div>
|
||||||
|
{% for id,month in months %}
|
||||||
|
{% set isCurrent = currentMonth is not null and month | date("Y-m") == currentMonth | date("Y-m") %}
|
||||||
|
<div class="col">
|
||||||
|
<a href="{{ path(routeName,{monthId: id}) }}" class="btn {% if isCurrent %}btn-success{% else %}btn-secondary{% endif %}">
|
||||||
|
{% if routeName=='app_schedule' %}
|
||||||
|
{{ id }}
|
||||||
|
{% else %}
|
||||||
|
{{ month | date("Y-m") }}
|
||||||
|
{% endif %}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endmacro %}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
{#<nav class="navbar navbar-inverse">#}
|
||||||
|
{# <div class="container-fluid">#}
|
||||||
|
{# <div class="navbar-header">#}
|
||||||
|
{# <a class="navbar-brand" href="{{ path('app_base') }}">WebSiteName</a>#}
|
||||||
|
{# </div>#}
|
||||||
|
{# <ul class="nav navbar-nav">#}
|
||||||
|
{# <li class="active"><a href="{{ path('app_base') }}">Home</a></li>#}
|
||||||
|
{# <li class="dropdown">#}
|
||||||
|
{# <a class="dropdown-toggle" data-toggle="dropdown" href="#">Klienci#}
|
||||||
|
{# <span class="caret"></span></a>#}
|
||||||
|
{# <ul class="dropdown-menu">#}
|
||||||
|
{# <li><a href="{{ path('app_customers_list') }}">Lista</a></li>#}
|
||||||
|
{# <li><a href="{{ path('app_base') }}">Dodaj klienta</a></li>#}
|
||||||
|
{# <li><a href="#">Page 1-3</a></li>#}
|
||||||
|
{# </ul>#}
|
||||||
|
{# </li>#}
|
||||||
|
{# <li><a href="#">Page 2</a></li>#}
|
||||||
|
{# <li><a href="#">Page 3</a></li>#}
|
||||||
|
{# </ul>#}
|
||||||
|
{# </div>#}
|
||||||
|
{#</nav>#}
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<a class="navbar-brand" href="{{ path('index') }}">CRM</a>
|
||||||
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||||
|
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||||
|
{% if is_granted('reportView') %}
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" aria-current="page" href="{{ path('app_base') }}">Sprawozdania</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" aria-current="page" href="{{ path('app_schedule') }}">Harmonogramy</a>
|
||||||
|
</li>
|
||||||
|
{% if is_granted('clientView') %}
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" aria-current="page" href="{{ path('app_customers_list') }}">Klienci</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{# <li class="nav-item dropdown">#}
|
||||||
|
{# <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">#}
|
||||||
|
{# Klienci#}
|
||||||
|
{# </a>#}
|
||||||
|
{# <ul class="dropdown-menu" aria-labelledby="navbarDropdown">#}
|
||||||
|
{# <li><a class="dropdown-item" href="{{ path('app_customers_list') }}">Lista</a></li>#}
|
||||||
|
{# <li><a class="dropdown-item" href="{{ path('app_add_client') }}">Dodaj klienta</a></li>#}
|
||||||
|
{# <li><hr class="dropdown-divider"></li>#}
|
||||||
|
{# <li><a class="dropdown-item" href="#">Something else here</a></li>#}
|
||||||
|
{# </ul>#}
|
||||||
|
{# </li>#}
|
||||||
|
{# <li class="nav-item">#}
|
||||||
|
{# <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a>#}
|
||||||
|
{# </li>#}
|
||||||
|
</ul>
|
||||||
|
{% if is_granted('clientAdd') %}
|
||||||
|
<div class="d-flex">
|
||||||
|
<a href="{{ path('app_add_client') }}" class="btn btn-success btn-outline-dark" type="submit">Dodaj klienta</a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div class="d-flex">
|
||||||
|
<a href="{{ path('app_logout') }}" class="btn btn-primary btn-outline-dark" type="submit">Wyloguj</a>
|
||||||
|
</div>
|
||||||
|
{# <form class="d-flex">#}
|
||||||
|
{# <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">#}
|
||||||
|
{# <button class="btn btn-outline-success" type="submit">Search</button>#}
|
||||||
|
{# </form>#}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user