Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe6a0e8fc9 | ||
| c10c774ac8 | |||
| 4b847eb1a2 | |||
|
|
fd48c9937e | ||
| 2a8c874985 | |||
|
|
4cf00e6ef3 | ||
| 5be33abb03 | |||
|
|
92d5fa55d0 | ||
| 65f6d8a530 |
3
.idea/SIRH.iml
generated
3
.idea/SIRH.iml
generated
@@ -142,6 +142,9 @@
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/masterminds/html5" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sabberworm/php-css-parser" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/thecodingmachine/safe" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/monolog/monolog" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/monolog-bridge" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/monolog-bundle" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
|
||||
12
.idea/dataSources.xml
generated
12
.idea/dataSources.xml
generated
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="postgres@localhost" uuid="9cad43df-2147-4989-b7a4-443067034884">
|
||||
<driver-ref>postgresql</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:postgresql://localhost:5433/postgres</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/data_source_mapping.xml
generated
6
.idea/data_source_mapping.xml
generated
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourcePerFileMappings">
|
||||
<file url="file://$APPLICATION_CONFIG_DIR$/consoles/db/9cad43df-2147-4989-b7a4-443067034884/console.sql" value="9cad43df-2147-4989-b7a4-443067034884" />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/db-forest-config.xml
generated
Normal file
6
.idea/db-forest-config.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="db-tree-configuration">
|
||||
<option name="data" value="---------------------------------------- 1:0:9cad43df-2147-4989-b7a4-443067034884 2:0:ae622167-c834-4e7b-87a5-c1721036f5dc 3:0:f407a514-c6b4-4b26-9555-445a85892502 " />
|
||||
</component>
|
||||
</project>
|
||||
3
.idea/php.xml
generated
3
.idea/php.xml
generated
@@ -150,6 +150,9 @@
|
||||
<path value="$PROJECT_DIR$/vendor/dompdf/dompdf" />
|
||||
<path value="$PROJECT_DIR$/vendor/thecodingmachine/safe" />
|
||||
<path value="$PROJECT_DIR$/vendor/masterminds/html5" />
|
||||
<path value="$PROJECT_DIR$/vendor/monolog/monolog" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/monolog-bridge" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/monolog-bundle" />
|
||||
</include_path>
|
||||
</component>
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="8.4" />
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
"symfony/flex": "^2",
|
||||
"symfony/framework-bundle": "8.0.*",
|
||||
"symfony/http-client": "8.0.*",
|
||||
"symfony/monolog-bundle": "^4.0",
|
||||
"symfony/property-access": "8.0.*",
|
||||
"symfony/property-info": "8.0.*",
|
||||
"symfony/runtime": "8.0.*",
|
||||
|
||||
261
composer.lock
generated
261
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "f181b165d122aecdae0a7df1d1e33aec",
|
||||
"content-hash": "71d28cc0a29fa3f385b067186aa43678",
|
||||
"packages": [
|
||||
{
|
||||
"name": "api-platform/doctrine-common",
|
||||
@@ -2771,6 +2771,109 @@
|
||||
},
|
||||
"time": "2025-07-25T09:04:22+00:00"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
"version": "3.10.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Seldaek/monolog.git",
|
||||
"reference": "b321dd6749f0bf7189444158a3ce785cc16d69b0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/b321dd6749f0bf7189444158a3ce785cc16d69b0",
|
||||
"reference": "b321dd6749f0bf7189444158a3ce785cc16d69b0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.1",
|
||||
"psr/log": "^2.0 || ^3.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/log-implementation": "3.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"aws/aws-sdk-php": "^3.0",
|
||||
"doctrine/couchdb": "~1.0@dev",
|
||||
"elasticsearch/elasticsearch": "^7 || ^8",
|
||||
"ext-json": "*",
|
||||
"graylog2/gelf-php": "^1.4.2 || ^2.0",
|
||||
"guzzlehttp/guzzle": "^7.4.5",
|
||||
"guzzlehttp/psr7": "^2.2",
|
||||
"mongodb/mongodb": "^1.8 || ^2.0",
|
||||
"php-amqplib/php-amqplib": "~2.4 || ^3",
|
||||
"php-console/php-console": "^3.1.8",
|
||||
"phpstan/phpstan": "^2",
|
||||
"phpstan/phpstan-deprecation-rules": "^2",
|
||||
"phpstan/phpstan-strict-rules": "^2",
|
||||
"phpunit/phpunit": "^10.5.17 || ^11.0.7",
|
||||
"predis/predis": "^1.1 || ^2",
|
||||
"rollbar/rollbar": "^4.0",
|
||||
"ruflin/elastica": "^7 || ^8",
|
||||
"symfony/mailer": "^5.4 || ^6",
|
||||
"symfony/mime": "^5.4 || ^6"
|
||||
},
|
||||
"suggest": {
|
||||
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
|
||||
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
|
||||
"elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client",
|
||||
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
|
||||
"ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler",
|
||||
"ext-mbstring": "Allow to work properly with unicode symbols",
|
||||
"ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)",
|
||||
"ext-openssl": "Required to send log messages using SSL",
|
||||
"ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)",
|
||||
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
|
||||
"mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)",
|
||||
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
|
||||
"rollbar/rollbar": "Allow sending log messages to Rollbar",
|
||||
"ruflin/elastica": "Allow sending log messages to an Elastic Search server"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "3.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Monolog\\": "src/Monolog"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jordi Boggiano",
|
||||
"email": "j.boggiano@seld.be",
|
||||
"homepage": "https://seld.be"
|
||||
}
|
||||
],
|
||||
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
|
||||
"homepage": "https://github.com/Seldaek/monolog",
|
||||
"keywords": [
|
||||
"log",
|
||||
"logging",
|
||||
"psr-3"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/Seldaek/monolog/issues",
|
||||
"source": "https://github.com/Seldaek/monolog/tree/3.10.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/Seldaek",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/monolog/monolog",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-01-02T08:56:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nelmio/cors-bundle",
|
||||
"version": "2.6.1",
|
||||
@@ -5271,6 +5374,162 @@
|
||||
],
|
||||
"time": "2026-01-28T10:46:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/monolog-bridge",
|
||||
"version": "v8.0.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/monolog-bridge.git",
|
||||
"reference": "7c3da570ec252d5ca1212945ddbbf1dac4a0d779"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/monolog-bridge/zipball/7c3da570ec252d5ca1212945ddbbf1dac4a0d779",
|
||||
"reference": "7c3da570ec252d5ca1212945ddbbf1dac4a0d779",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"monolog/monolog": "^3",
|
||||
"php": ">=8.4",
|
||||
"symfony/http-kernel": "^7.4|^8.0",
|
||||
"symfony/service-contracts": "^2.5|^3"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/console": "^7.4|^8.0",
|
||||
"symfony/http-client": "^7.4|^8.0",
|
||||
"symfony/mailer": "^7.4|^8.0",
|
||||
"symfony/messenger": "^7.4|^8.0",
|
||||
"symfony/mime": "^7.4|^8.0",
|
||||
"symfony/security-core": "^7.4|^8.0",
|
||||
"symfony/var-dumper": "^7.4|^8.0"
|
||||
},
|
||||
"type": "symfony-bridge",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Bridge\\Monolog\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Provides integration for Monolog with various Symfony components",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/monolog-bridge/tree/v8.0.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/nicolas-grekas",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-01-07T12:23:22+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/monolog-bundle",
|
||||
"version": "v4.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/monolog-bundle.git",
|
||||
"reference": "3b4ee2717ee56c5e1edb516140a175eb2a72bc66"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/3b4ee2717ee56c5e1edb516140a175eb2a72bc66",
|
||||
"reference": "3b4ee2717ee56c5e1edb516140a175eb2a72bc66",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer-runtime-api": "^2.0",
|
||||
"monolog/monolog": "^3.5",
|
||||
"php": ">=8.2",
|
||||
"symfony/config": "^7.3 || ^8.0",
|
||||
"symfony/dependency-injection": "^7.3 || ^8.0",
|
||||
"symfony/http-kernel": "^7.3 || ^8.0",
|
||||
"symfony/monolog-bridge": "^7.3 || ^8.0",
|
||||
"symfony/polyfill-php84": "^1.30"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^11.5.41 || ^12.3",
|
||||
"symfony/console": "^7.3 || ^8.0",
|
||||
"symfony/yaml": "^7.3 || ^8.0"
|
||||
},
|
||||
"type": "symfony-bundle",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Bundle\\MonologBundle\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony MonologBundle",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"log",
|
||||
"logging"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/symfony/monolog-bundle/issues",
|
||||
"source": "https://github.com/symfony/monolog-bundle/tree/v4.0.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/nicolas-grekas",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2025-12-08T08:00:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/password-hasher",
|
||||
"version": "v8.0.4",
|
||||
|
||||
@@ -8,6 +8,7 @@ use Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle;
|
||||
use Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle;
|
||||
use Nelmio\CorsBundle\NelmioCorsBundle;
|
||||
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
|
||||
use Symfony\Bundle\MonologBundle\MonologBundle;
|
||||
use Symfony\Bundle\SecurityBundle\SecurityBundle;
|
||||
use Symfony\Bundle\TwigBundle\TwigBundle;
|
||||
|
||||
@@ -20,4 +21,5 @@ return [
|
||||
NelmioCorsBundle::class => ['all' => true],
|
||||
ApiPlatformBundle::class => ['all' => true],
|
||||
LexikJWTAuthenticationBundle::class => ['all' => true],
|
||||
MonologBundle::class => ['all' => true],
|
||||
];
|
||||
|
||||
28
config/packages/monolog.yaml
Normal file
28
config/packages/monolog.yaml
Normal file
@@ -0,0 +1,28 @@
|
||||
monolog:
|
||||
channels: [deprecation]
|
||||
|
||||
when@dev:
|
||||
monolog:
|
||||
handlers:
|
||||
main:
|
||||
type: stream
|
||||
path: "%kernel.logs_dir%/%kernel.environment%.log"
|
||||
level: debug
|
||||
channels: ["!event"]
|
||||
console:
|
||||
type: console
|
||||
process_psr_3_messages: false
|
||||
channels: ["!event", "!doctrine", "!console"]
|
||||
|
||||
when@prod:
|
||||
monolog:
|
||||
handlers:
|
||||
main:
|
||||
type: stream
|
||||
path: "%kernel.logs_dir%/%kernel.environment%.log"
|
||||
level: debug
|
||||
channels: ["!deprecation"]
|
||||
deprecation:
|
||||
type: stream
|
||||
channels: [deprecation]
|
||||
path: "%kernel.logs_dir%/deprecations.log"
|
||||
@@ -5,7 +5,7 @@ nelmio_cors:
|
||||
allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']
|
||||
allow_headers: ['Content-Type', 'Authorization']
|
||||
allow_credentials: true
|
||||
expose_headers: ['Link']
|
||||
expose_headers: ['Link', 'Content-Disposition']
|
||||
max_age: 3600
|
||||
paths:
|
||||
'^/': null
|
||||
|
||||
@@ -1608,6 +1608,149 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param;
|
||||
* cache?: scalar|Param|null, // Storage to track blocked tokens // Default: "cache.app"
|
||||
* },
|
||||
* }
|
||||
* @psalm-type MonologConfig = array{
|
||||
* use_microseconds?: scalar|Param|null, // Default: true
|
||||
* channels?: list<scalar|Param|null>,
|
||||
* handlers?: array<string, array{ // Default: []
|
||||
* type: scalar|Param|null,
|
||||
* id?: scalar|Param|null,
|
||||
* enabled?: bool|Param, // Default: true
|
||||
* priority?: scalar|Param|null, // Default: 0
|
||||
* level?: scalar|Param|null, // Default: "DEBUG"
|
||||
* bubble?: bool|Param, // Default: true
|
||||
* interactive_only?: bool|Param, // Default: false
|
||||
* app_name?: scalar|Param|null, // Default: null
|
||||
* include_stacktraces?: bool|Param, // Default: false
|
||||
* process_psr_3_messages?: array{
|
||||
* enabled?: bool|Param|null, // Default: null
|
||||
* date_format?: scalar|Param|null,
|
||||
* remove_used_context_fields?: bool|Param,
|
||||
* },
|
||||
* path?: scalar|Param|null, // Default: "%kernel.logs_dir%/%kernel.environment%.log"
|
||||
* file_permission?: scalar|Param|null, // Default: null
|
||||
* use_locking?: bool|Param, // Default: false
|
||||
* filename_format?: scalar|Param|null, // Default: "{filename}-{date}"
|
||||
* date_format?: scalar|Param|null, // Default: "Y-m-d"
|
||||
* ident?: scalar|Param|null, // Default: false
|
||||
* logopts?: scalar|Param|null, // Default: 1
|
||||
* facility?: scalar|Param|null, // Default: "user"
|
||||
* max_files?: scalar|Param|null, // Default: 0
|
||||
* action_level?: scalar|Param|null, // Default: "WARNING"
|
||||
* activation_strategy?: scalar|Param|null, // Default: null
|
||||
* stop_buffering?: bool|Param, // Default: true
|
||||
* passthru_level?: scalar|Param|null, // Default: null
|
||||
* excluded_http_codes?: list<array{ // Default: []
|
||||
* code?: scalar|Param|null,
|
||||
* urls?: list<scalar|Param|null>,
|
||||
* }>,
|
||||
* accepted_levels?: list<scalar|Param|null>,
|
||||
* min_level?: scalar|Param|null, // Default: "DEBUG"
|
||||
* max_level?: scalar|Param|null, // Default: "EMERGENCY"
|
||||
* buffer_size?: scalar|Param|null, // Default: 0
|
||||
* flush_on_overflow?: bool|Param, // Default: false
|
||||
* handler?: scalar|Param|null,
|
||||
* url?: scalar|Param|null,
|
||||
* exchange?: scalar|Param|null,
|
||||
* exchange_name?: scalar|Param|null, // Default: "log"
|
||||
* channel?: scalar|Param|null, // Default: null
|
||||
* bot_name?: scalar|Param|null, // Default: "Monolog"
|
||||
* use_attachment?: scalar|Param|null, // Default: true
|
||||
* use_short_attachment?: scalar|Param|null, // Default: false
|
||||
* include_extra?: scalar|Param|null, // Default: false
|
||||
* icon_emoji?: scalar|Param|null, // Default: null
|
||||
* webhook_url?: scalar|Param|null,
|
||||
* exclude_fields?: list<scalar|Param|null>,
|
||||
* token?: scalar|Param|null,
|
||||
* region?: scalar|Param|null,
|
||||
* source?: scalar|Param|null,
|
||||
* use_ssl?: bool|Param, // Default: true
|
||||
* user?: mixed,
|
||||
* title?: scalar|Param|null, // Default: null
|
||||
* host?: scalar|Param|null, // Default: null
|
||||
* port?: scalar|Param|null, // Default: 514
|
||||
* config?: list<scalar|Param|null>,
|
||||
* members?: list<scalar|Param|null>,
|
||||
* connection_string?: scalar|Param|null,
|
||||
* timeout?: scalar|Param|null,
|
||||
* time?: scalar|Param|null, // Default: 60
|
||||
* deduplication_level?: scalar|Param|null, // Default: 400
|
||||
* store?: scalar|Param|null, // Default: null
|
||||
* connection_timeout?: scalar|Param|null,
|
||||
* persistent?: bool|Param,
|
||||
* message_type?: scalar|Param|null, // Default: 0
|
||||
* parse_mode?: scalar|Param|null, // Default: null
|
||||
* disable_webpage_preview?: bool|Param|null, // Default: null
|
||||
* disable_notification?: bool|Param|null, // Default: null
|
||||
* split_long_messages?: bool|Param, // Default: false
|
||||
* delay_between_messages?: bool|Param, // Default: false
|
||||
* topic?: int|Param, // Default: null
|
||||
* factor?: int|Param, // Default: 1
|
||||
* tags?: list<scalar|Param|null>,
|
||||
* console_formatter_options?: mixed, // Default: []
|
||||
* formatter?: scalar|Param|null,
|
||||
* nested?: bool|Param, // Default: false
|
||||
* publisher?: string|array{
|
||||
* id?: scalar|Param|null,
|
||||
* hostname?: scalar|Param|null,
|
||||
* port?: scalar|Param|null, // Default: 12201
|
||||
* chunk_size?: scalar|Param|null, // Default: 1420
|
||||
* encoder?: "json"|"compressed_json"|Param,
|
||||
* },
|
||||
* mongodb?: string|array{
|
||||
* id?: scalar|Param|null, // ID of a MongoDB\Client service
|
||||
* uri?: scalar|Param|null,
|
||||
* username?: scalar|Param|null,
|
||||
* password?: scalar|Param|null,
|
||||
* database?: scalar|Param|null, // Default: "monolog"
|
||||
* collection?: scalar|Param|null, // Default: "logs"
|
||||
* },
|
||||
* elasticsearch?: string|array{
|
||||
* id?: scalar|Param|null,
|
||||
* hosts?: list<scalar|Param|null>,
|
||||
* host?: scalar|Param|null,
|
||||
* port?: scalar|Param|null, // Default: 9200
|
||||
* transport?: scalar|Param|null, // Default: "Http"
|
||||
* user?: scalar|Param|null, // Default: null
|
||||
* password?: scalar|Param|null, // Default: null
|
||||
* },
|
||||
* index?: scalar|Param|null, // Default: "monolog"
|
||||
* document_type?: scalar|Param|null, // Default: "logs"
|
||||
* ignore_error?: scalar|Param|null, // Default: false
|
||||
* redis?: string|array{
|
||||
* id?: scalar|Param|null,
|
||||
* host?: scalar|Param|null,
|
||||
* password?: scalar|Param|null, // Default: null
|
||||
* port?: scalar|Param|null, // Default: 6379
|
||||
* database?: scalar|Param|null, // Default: 0
|
||||
* key_name?: scalar|Param|null, // Default: "monolog_redis"
|
||||
* },
|
||||
* predis?: string|array{
|
||||
* id?: scalar|Param|null,
|
||||
* host?: scalar|Param|null,
|
||||
* },
|
||||
* from_email?: scalar|Param|null,
|
||||
* to_email?: list<scalar|Param|null>,
|
||||
* subject?: scalar|Param|null,
|
||||
* content_type?: scalar|Param|null, // Default: null
|
||||
* headers?: list<scalar|Param|null>,
|
||||
* mailer?: scalar|Param|null, // Default: null
|
||||
* email_prototype?: string|array{
|
||||
* id: scalar|Param|null,
|
||||
* method?: scalar|Param|null, // Default: null
|
||||
* },
|
||||
* verbosity_levels?: array{
|
||||
* VERBOSITY_QUIET?: scalar|Param|null, // Default: "ERROR"
|
||||
* VERBOSITY_NORMAL?: scalar|Param|null, // Default: "WARNING"
|
||||
* VERBOSITY_VERBOSE?: scalar|Param|null, // Default: "NOTICE"
|
||||
* VERBOSITY_VERY_VERBOSE?: scalar|Param|null, // Default: "INFO"
|
||||
* VERBOSITY_DEBUG?: scalar|Param|null, // Default: "DEBUG"
|
||||
* },
|
||||
* channels?: string|array{
|
||||
* type?: scalar|Param|null,
|
||||
* elements?: list<scalar|Param|null>,
|
||||
* },
|
||||
* }>,
|
||||
* }
|
||||
* @psalm-type ConfigType = array{
|
||||
* imports?: ImportsConfig,
|
||||
* parameters?: ParametersConfig,
|
||||
@@ -1620,6 +1763,7 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param;
|
||||
* nelmio_cors?: NelmioCorsConfig,
|
||||
* api_platform?: ApiPlatformConfig,
|
||||
* lexik_jwt_authentication?: LexikJwtAuthenticationConfig,
|
||||
* monolog?: MonologConfig,
|
||||
* "when@dev"?: array{
|
||||
* imports?: ImportsConfig,
|
||||
* parameters?: ParametersConfig,
|
||||
@@ -1632,6 +1776,7 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param;
|
||||
* nelmio_cors?: NelmioCorsConfig,
|
||||
* api_platform?: ApiPlatformConfig,
|
||||
* lexik_jwt_authentication?: LexikJwtAuthenticationConfig,
|
||||
* monolog?: MonologConfig,
|
||||
* },
|
||||
* "when@prod"?: array{
|
||||
* imports?: ImportsConfig,
|
||||
@@ -1645,6 +1790,7 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param;
|
||||
* nelmio_cors?: NelmioCorsConfig,
|
||||
* api_platform?: ApiPlatformConfig,
|
||||
* lexik_jwt_authentication?: LexikJwtAuthenticationConfig,
|
||||
* monolog?: MonologConfig,
|
||||
* },
|
||||
* "when@test"?: array{
|
||||
* imports?: ImportsConfig,
|
||||
@@ -1658,6 +1804,7 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param;
|
||||
* nelmio_cors?: NelmioCorsConfig,
|
||||
* api_platform?: ApiPlatformConfig,
|
||||
* lexik_jwt_authentication?: LexikJwtAuthenticationConfig,
|
||||
* monolog?: MonologConfig,
|
||||
* },
|
||||
* ...<string, ExtensionType|array{ // extra keys must follow the when@%env% pattern or match an extension alias
|
||||
* imports?: ImportsConfig,
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
parameters:
|
||||
app.version: '0.1.1'
|
||||
app.version: '0.1.5'
|
||||
|
||||
43
deploy/nginx/sirh.conf
Normal file
43
deploy/nginx/sirh.conf
Normal file
@@ -0,0 +1,43 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name sirh.malio-dev.fr;
|
||||
|
||||
root /var/www/sirh/frontend/.output/public;
|
||||
index index.html;
|
||||
|
||||
location ^~ /api/ {
|
||||
root /var/www/sirh/public;
|
||||
try_files $uri /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ^~ /bundles/ {
|
||||
root /var/www/sirh/public;
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
location = /api/login_check {
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME /var/www/sirh/public/index.php;
|
||||
fastcgi_param DOCUMENT_ROOT /var/www/sirh/public;
|
||||
fastcgi_param SCRIPT_NAME /index.php;
|
||||
fastcgi_param PATH_INFO /login_check;
|
||||
fastcgi_param REQUEST_URI /login_check;
|
||||
fastcgi_pass unix:/run/php/php8.4-fpm.sock;
|
||||
}
|
||||
|
||||
location ~ ^/index\.php(/|$) {
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME /var/www/sirh/public/index.php;
|
||||
fastcgi_param DOCUMENT_ROOT /var/www/sirh/public;
|
||||
fastcgi_pass unix:/run/php/php8.4-fpm.sock;
|
||||
internal;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
return 404;
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
@@ -39,24 +39,44 @@
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<div class="space-y-4">
|
||||
<div>
|
||||
<label class="text-md font-semibold text-neutral-700" for="start-date">Date de début</label>
|
||||
<input
|
||||
id="start-date"
|
||||
v-model="absenceForm.startDate"
|
||||
type="date"
|
||||
class="mt-2 w-full rounded-md border border-neutral-300 px-3 py-2 text-md text-neutral-900"
|
||||
/>
|
||||
<label class="text-md font-semibold text-neutral-700" for="start-date">Début</label>
|
||||
<div class="mt-2 grid grid-cols-2 gap-2">
|
||||
<input
|
||||
id="start-date"
|
||||
v-model="absenceForm.startDate"
|
||||
type="date"
|
||||
class="w-full rounded-md border border-neutral-300 px-3 py-2 text-md text-neutral-900"
|
||||
/>
|
||||
<select
|
||||
v-model="absenceForm.startHalf"
|
||||
class="w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-md text-neutral-900"
|
||||
>
|
||||
<option v-for="half in HALF_DAYS" :key="half.value" :value="half.value">
|
||||
{{ half.label }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-md font-semibold text-neutral-700" for="end-date">Date de fin</label>
|
||||
<input
|
||||
id="end-date"
|
||||
v-model="absenceForm.endDate"
|
||||
type="date"
|
||||
class="mt-2 w-full rounded-md border border-neutral-300 px-3 py-2 text-md text-neutral-900"
|
||||
/>
|
||||
<label class="text-md font-semibold text-neutral-700" for="end-date">Fin</label>
|
||||
<div class="mt-2 grid grid-cols-2 gap-2">
|
||||
<input
|
||||
id="end-date"
|
||||
v-model="absenceForm.endDate"
|
||||
type="date"
|
||||
class="w-full rounded-md border border-neutral-300 px-3 py-2 text-md text-neutral-900"
|
||||
/>
|
||||
<select
|
||||
v-model="absenceForm.endHalf"
|
||||
class="w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-md text-neutral-900"
|
||||
>
|
||||
<option v-for="half in HALF_DAYS" :key="half.value" :value="half.value">
|
||||
{{ half.label }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -103,6 +123,8 @@ import { computed, reactive, toRef, watch } from 'vue'
|
||||
import type { Employee } from '~/services/dto/employee'
|
||||
import type { AbsenceType } from '~/services/dto/absence-type'
|
||||
import type { Absence } from '~/services/dto/absence'
|
||||
import type { HalfDay } from '~/services/dto/half-day'
|
||||
import { HALF_DAYS } from '~/services/dto/half-day'
|
||||
import AppDrawer from '~/components/AppDrawer.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -113,7 +135,9 @@ const props = defineProps<{
|
||||
employeeId: number | ''
|
||||
typeId: number | ''
|
||||
startDate: string
|
||||
startHalf: HalfDay
|
||||
endDate: string
|
||||
endHalf: HalfDay
|
||||
comment: string
|
||||
}
|
||||
editingAbsence: Absence | null
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<template>
|
||||
<div class="max-h-[80vh] overflow-auto rounded-lg border border-neutral-200 bg-white">
|
||||
<div class="h-full min-h-0 overflow-auto rounded-lg border border-neutral-200 bg-white">
|
||||
<div class="min-w-[900px]">
|
||||
<div class="grid" :style="gridStyle">
|
||||
<div
|
||||
class="sticky left-0 z-20 border-b border-neutral-200 bg-tertiary-500 px-4 py-3 text-md font-semibold text-neutral-700"
|
||||
class="sticky left-0 top-0 z-30 border-b border-neutral-200 bg-tertiary-500 px-4 py-3 text-md font-semibold text-neutral-700"
|
||||
>
|
||||
Employés
|
||||
</div>
|
||||
<div
|
||||
v-for="day in daysInMonth"
|
||||
:key="day.date"
|
||||
class="border-b border-neutral-200 bg-tertiary-500 px-2 py-3 text-center text-xs font-semibold text-neutral-700"
|
||||
class="sticky top-0 z-20 border-b border-neutral-200 bg-tertiary-500 px-2 py-3 text-center text-xs font-semibold text-neutral-700"
|
||||
>
|
||||
<div>{{ day.label }}</div>
|
||||
<div class="text-[10px] text-neutral-500">{{ day.weekday }}</div>
|
||||
@@ -28,18 +28,46 @@
|
||||
:key="employee.id + '-' + day.date"
|
||||
class="border-b border-neutral-100 px-2 py-2 text-center text-xs text-neutral-800"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="flex h-8 w-full items-center justify-center rounded-md border border-neutral-200 text-[11px] font-semibold text-neutral-800 hover:border-primary-500/40"
|
||||
:class="isHolidayDate(day.date) ? 'cursor-not-allowed opacity-80' : ''"
|
||||
:style="getCellStyle(employee.id, day.date)"
|
||||
:disabled="isHolidayDate(day.date)"
|
||||
@click="handleCellClick(employee, day.date)"
|
||||
>
|
||||
<span v-if="getCellCode(employee.id, day.date)">
|
||||
{{ getCellCode(employee.id, day.date) }}
|
||||
</span>
|
||||
</button>
|
||||
<template v-if="getCellInfo(employee.id, day.date)">
|
||||
<button
|
||||
type="button"
|
||||
class="relative flex h-8 w-full items-center justify-center overflow-hidden rounded-md border border-neutral-200 text-[11px] font-semibold text-neutral-800 hover:border-primary-500/40"
|
||||
:class="isHolidayDate(day.date) ? 'cursor-not-allowed opacity-80' : ''"
|
||||
:style="getCellStyle(employee.id, day.date)"
|
||||
:disabled="isHolidayDate(day.date)"
|
||||
@click="handleCellClick(employee, day.date)"
|
||||
>
|
||||
<span v-if="!getCellInfo(employee.id, day.date)?.halfLabel">
|
||||
{{ getCellInfo(employee.id, day.date)?.code }}
|
||||
</span>
|
||||
<template v-else>
|
||||
<span
|
||||
v-if="getCellInfo(employee.id, day.date)?.halfLabel === 'AM'"
|
||||
class="absolute top-0 left-0 flex h-1/2 w-full items-center justify-center text-[10px] font-semibold"
|
||||
>
|
||||
{{ getCellInfo(employee.id, day.date)?.code }}
|
||||
</span>
|
||||
<span
|
||||
v-else
|
||||
class="absolute bottom-0 left-0 flex h-1/2 w-full items-center justify-center text-[10px] font-semibold"
|
||||
>
|
||||
{{ getCellInfo(employee.id, day.date)?.code }}
|
||||
</span>
|
||||
</template>
|
||||
</button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<button
|
||||
type="button"
|
||||
class="relative flex h-8 w-full items-center justify-center rounded-md border border-neutral-200 text-[11px] font-semibold text-neutral-800 hover:border-primary-500/40"
|
||||
:class="isHolidayDate(day.date) ? 'cursor-not-allowed opacity-80' : ''"
|
||||
:style="getCellStyle(employee.id, day.date)"
|
||||
:disabled="isHolidayDate(day.date)"
|
||||
@click="handleCellClick(employee, day.date)"
|
||||
>
|
||||
<span></span>
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
@@ -49,6 +77,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Employee } from '~/services/dto/employee'
|
||||
import type { HalfDay } from '~/services/dto/half-day'
|
||||
|
||||
type DayInfo = {
|
||||
date: string
|
||||
@@ -61,7 +90,7 @@ defineProps<{
|
||||
visibleEmployees: Employee[]
|
||||
gridStyle: Record<string, string>
|
||||
getCellStyle: (employeeId: number, date: string) => Record<string, string> | undefined
|
||||
getCellCode: (employeeId: number, date: string) => string
|
||||
getCellInfo: (employeeId: number, date: string) => { id: number; code: string; color: string; halfLabel?: HalfDay; textColor?: string } | null
|
||||
formatEmployeeName: (employee: Employee) => string
|
||||
isHolidayDate: (date: string) => boolean
|
||||
}>()
|
||||
|
||||
@@ -4,9 +4,14 @@ import { useAuthStore } from '~/stores/auth'
|
||||
|
||||
export type AnyObject = Record<string, unknown>
|
||||
|
||||
export type BlobResponse = {
|
||||
data: Blob
|
||||
headers: Headers
|
||||
}
|
||||
|
||||
export type ApiClient = {
|
||||
get<T>(url: string, query?: AnyObject, options?: ApiFetchOptions<'json'>): Promise<T>
|
||||
getBlob(url: string, query?: AnyObject, options?: ApiFetchOptions<'blob'>): Promise<Blob>
|
||||
getBlob(url: string, query?: AnyObject, options?: ApiFetchOptions<'blob'>): Promise<BlobResponse>
|
||||
post<T>(url: string, body?: AnyObject, options?: ApiFetchOptions<'json'>): Promise<T>
|
||||
put<T>(url: string, body?: AnyObject, options?: ApiFetchOptions<'json'>): Promise<T>
|
||||
patch<T>(url: string, body?: AnyObject, options?: ApiFetchOptions<'json'>): Promise<T>
|
||||
@@ -165,7 +170,9 @@ export const useApi = (): ApiClient => {
|
||||
return request<T>('GET', url, { ...options, query })
|
||||
},
|
||||
getBlob(url: string, query: AnyObject = {}, options: ApiFetchOptions<'blob'> = {}) {
|
||||
return client<Blob>(url, { ...options, method: 'GET', query, responseType: 'blob' })
|
||||
return client
|
||||
.raw(url, { ...options, method: 'GET', query, responseType: 'blob' })
|
||||
.then((res) => ({ data: res._data as Blob, headers: res.headers }))
|
||||
},
|
||||
post<T>(url: string, body: AnyObject = {}, options: ApiFetchOptions<'json'> = {}) {
|
||||
return request<T>('POST', url, { ...options, body })
|
||||
|
||||
@@ -4,16 +4,17 @@ export const usePdfPrinter = () => {
|
||||
const api = useApi()
|
||||
|
||||
const printPdf = async (url: string): Promise<void> => {
|
||||
const blob = await api.getBlob(url);
|
||||
const res = await api.getBlob(url);
|
||||
const disposition = res.headers.get('content-disposition') || '';
|
||||
const match = disposition.match(/filename="(.+?)"/i);
|
||||
const filename = match?.[1] ?? 'document.pdf';
|
||||
|
||||
const pdfBlob = blob.type === 'application/pdf'
|
||||
? blob
|
||||
: new Blob([blob], { type: 'application/pdf' });
|
||||
const pdfBlob = res.data.type === 'application/pdf'
|
||||
? res.data
|
||||
: new Blob([res.data], { type: 'application/pdf' });
|
||||
|
||||
const blobUrl = URL.createObjectURL(pdfBlob);
|
||||
|
||||
const filename = `test.pdf`;
|
||||
|
||||
const a = document.createElement('a');
|
||||
a.href = blobUrl;
|
||||
a.download = filename;
|
||||
|
||||
@@ -1,68 +1,80 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="h-full flex flex-col overflow-hidden">
|
||||
<div class="flex flex-wrap items-center justify-between gap-4">
|
||||
<h1 class="text-4xl font-bold text-primary-500">Calendrier des absences</h1>
|
||||
</div>
|
||||
<div class="flex items-center justify-between py-6">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="flex flex-wrap items-center gap-4 rounded-md border border-neutral-300 px-3 py-2">
|
||||
<div v-for="site in sites" :key="site.id" class="flex items-center gap-2">
|
||||
<div :style="{ backgroundColor: site.color }" class="h-4 w-4 rounded"></div>
|
||||
<label class="text-md" :for="`site-${site.id}`">{{ site.name }}</label>
|
||||
<input
|
||||
:id="`site-${site.id}`"
|
||||
v-model="selectedSiteIds"
|
||||
:value="site.id"
|
||||
type="checkbox"
|
||||
class="h-4 w-4"
|
||||
/>
|
||||
<div class="py-6">
|
||||
<div class="flex items-center justify-between gap-4">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="flex flex-wrap items-center gap-4 rounded-md border border-neutral-300 px-3 py-2">
|
||||
<div v-for="site in sites" :key="site.id" class="flex items-center gap-2">
|
||||
<div :style="{ backgroundColor: site.color }" class="h-4 w-4 rounded"></div>
|
||||
<label class="text-md" :for="`site-${site.id}`">{{ site.name }}</label>
|
||||
<input
|
||||
:id="`site-${site.id}`"
|
||||
v-model="selectedSiteIds"
|
||||
:value="site.id"
|
||||
type="checkbox"
|
||||
class="h-4 w-4"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<select
|
||||
v-model="selectedMonth"
|
||||
class="h-10 rounded-md border border-neutral-300 bg-white px-3 text-md text-neutral-900"
|
||||
>
|
||||
<option v-for="month in months" :key="month.value" :value="month.value">
|
||||
{{ month.label }}
|
||||
</option>
|
||||
</select>
|
||||
<select
|
||||
v-model="selectedYear"
|
||||
class="h-10 rounded-md border border-neutral-300 bg-white px-3 text-md text-neutral-900"
|
||||
>
|
||||
<option v-for="year in years" :key="year" :value="year">
|
||||
{{ year }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex gap-4">
|
||||
<button
|
||||
type="button"
|
||||
class="h-10 rounded-lg bg-primary-500 px-4 text-md font-semibold text-white hover:bg-secondary-500"
|
||||
@click="openCreateFromToday"
|
||||
>
|
||||
Ajouter une absence
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="h-10 rounded-lg bg-primary-500 px-4 text-md font-semibold text-white hover:bg-secondary-500"
|
||||
@click="openPrint"
|
||||
>
|
||||
Imprimer
|
||||
</button>
|
||||
</div>
|
||||
<select
|
||||
v-model="selectedMonth"
|
||||
class="h-10 rounded-md border border-neutral-300 bg-white px-3 text-md text-neutral-900"
|
||||
>
|
||||
<option v-for="month in months" :key="month.value" :value="month.value">
|
||||
{{ month.label }}
|
||||
</option>
|
||||
</select>
|
||||
<select
|
||||
v-model="selectedYear"
|
||||
class="h-10 rounded-md border border-neutral-300 bg-white px-3 text-md text-neutral-900"
|
||||
>
|
||||
<option v-for="year in years" :key="year" :value="year">
|
||||
{{ year }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex gap-4">
|
||||
<button
|
||||
type="button"
|
||||
class="h-10 rounded-lg bg-primary-500 px-4 text-md font-semibold text-white hover:bg-secondary-500"
|
||||
@click="openCreateFromToday"
|
||||
>
|
||||
Ajouter une absence
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="h-10 rounded-lg bg-primary-500 px-4 text-md font-semibold text-white hover:bg-secondary-500"
|
||||
@click="openPrint"
|
||||
>
|
||||
Imprimer
|
||||
</button>
|
||||
<div class="mt-3 flex items-center gap-4">
|
||||
<input
|
||||
v-model="employeeFilter"
|
||||
type="text"
|
||||
placeholder="Chercher un employé (nom ou prénom)"
|
||||
class="h-10 w-full max-w-md rounded-md border border-neutral-300 bg-white px-3 text-md text-neutral-900"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<CalendarGrid
|
||||
:days-in-month="daysInMonth"
|
||||
:visible-employees="visibleEmployees"
|
||||
:grid-style="gridStyle"
|
||||
:get-cell-style="getCellStyle"
|
||||
:get-cell-code="getCellCode"
|
||||
:format-employee-name="formatEmployeeName"
|
||||
:is-holiday-date="isHolidayDate"
|
||||
@cell-click="openCreate"
|
||||
/>
|
||||
<div class="flex-1 min-h-0">
|
||||
<CalendarGrid
|
||||
:days-in-month="daysInMonth"
|
||||
:visible-employees="visibleEmployees"
|
||||
:grid-style="gridStyle"
|
||||
:get-cell-style="getCellStyle"
|
||||
:get-cell-info="getCellInfo"
|
||||
:format-employee-name="formatEmployeeName"
|
||||
:is-holiday-date="isHolidayDate"
|
||||
@cell-click="openCreate"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<AbsenceFormDrawer
|
||||
v-model="isDrawerOpen"
|
||||
@@ -90,6 +102,8 @@
|
||||
import type {Employee} from '~/services/dto/employee'
|
||||
import type {AbsenceType} from '~/services/dto/absence-type'
|
||||
import type {Absence} from '~/services/dto/absence'
|
||||
import type {HalfDay} from '~/services/dto/half-day'
|
||||
import {HALF_DAYS} from '~/services/dto/half-day'
|
||||
import {listEmployees} from '~/services/employees'
|
||||
import {listAbsenceTypes} from '~/services/absence-types'
|
||||
import {createAbsence, deleteAbsence, listAbsences, updateAbsence} from '~/services/absences'
|
||||
@@ -99,6 +113,7 @@ import CalendarGrid from '~/components/CalendarGrid.vue'
|
||||
import AbsenceFormDrawer from '~/components/AbsenceFormDrawer.vue'
|
||||
import AbsencePrintDrawer from '~/components/AbsencePrintDrawer.vue'
|
||||
|
||||
// Données principales affichées dans la grille.
|
||||
const employees = ref<Employee[]>([])
|
||||
const sites = computed(() => {
|
||||
const siteMap = new Map<number, { id: number; name: string; color: string }>()
|
||||
@@ -110,6 +125,7 @@ const sites = computed(() => {
|
||||
return Array.from(siteMap.values()).sort((siteA, siteB) => siteA.name.localeCompare(siteB.name, 'fr'))
|
||||
})
|
||||
|
||||
// Filtres de sites (par défaut: tous sélectionnés à l'init).
|
||||
const selectedSiteIds = ref<number[]>([])
|
||||
const sitesInitialized = ref(false)
|
||||
|
||||
@@ -119,6 +135,7 @@ watch(sites, (next) => {
|
||||
sitesInitialized.value = true
|
||||
}, { immediate: true })
|
||||
|
||||
// Tri stable: site -> nom -> prénom.
|
||||
const sortedEmployees = computed(() => {
|
||||
return [...employees.value].sort((employeeA, employeeB) => {
|
||||
const siteNameA = employeeA.site?.name ?? ''
|
||||
@@ -133,21 +150,33 @@ const sortedEmployees = computed(() => {
|
||||
})
|
||||
})
|
||||
|
||||
// Employés visibles selon le filtre de sites.
|
||||
const employeeFilter = ref('')
|
||||
|
||||
const visibleEmployees = computed(() => {
|
||||
if (selectedSiteIds.value.length === 0) return []
|
||||
const filter = employeeFilter.value.trim().toLowerCase()
|
||||
return sortedEmployees.value.filter((employee) => {
|
||||
return employee.site?.id && selectedSiteIds.value.includes(employee.site.id)
|
||||
const siteOk = employee.site?.id && selectedSiteIds.value.includes(employee.site.id)
|
||||
if (!siteOk) return false
|
||||
if (!filter) return true
|
||||
const first = employee.firstName?.toLowerCase() ?? ''
|
||||
const last = employee.lastName?.toLowerCase() ?? ''
|
||||
return first.includes(filter) || last.includes(filter)
|
||||
})
|
||||
})
|
||||
// Données de référence et absences du mois affiché.
|
||||
const absenceTypes = ref<AbsenceType[]>([])
|
||||
const absences = ref<Absence[]>([])
|
||||
const publicHolidays = ref<Record<string, string>>({})
|
||||
|
||||
// États UI.
|
||||
const isDrawerOpen = ref(false)
|
||||
const isSubmitting = ref(false)
|
||||
const editingAbsence = ref<Absence | null>(null)
|
||||
const isPrintOpen = ref(false)
|
||||
|
||||
// Sélecteurs de période.
|
||||
const now = new Date()
|
||||
const selectedMonth = ref(now.getMonth())
|
||||
const selectedYear = ref(now.getFullYear())
|
||||
@@ -170,43 +199,53 @@ const months = [
|
||||
const years = Array.from({length: 5}, (unusedValue, index) => now.getFullYear() - 2 + index)
|
||||
|
||||
|
||||
// Infos de calendrier calculées.
|
||||
const daysInMonth = computed(() => getDaysInMonth(selectedYear.value, selectedMonth.value))
|
||||
const monthStartDate = computed(() => new Date(selectedYear.value, selectedMonth.value, 1))
|
||||
const monthEndDate = computed(() => new Date(selectedYear.value, selectedMonth.value + 1, 0))
|
||||
|
||||
// Largeur fixe de la colonne employés + une colonne par jour.
|
||||
const gridStyle = computed(() => ({
|
||||
gridTemplateColumns: `160px repeat(${daysInMonth.value.length}, minmax(44px, 1fr))`
|
||||
}))
|
||||
|
||||
// Formulaire d'absence (AM/PM par défaut = journée complète).
|
||||
const form = reactive({
|
||||
employeeId: '' as number | '',
|
||||
typeId: '' as number | '',
|
||||
startDate: '',
|
||||
startHalf: 'AM' as HalfDay,
|
||||
endDate: '',
|
||||
endHalf: 'PM' as HalfDay,
|
||||
comment: ''
|
||||
})
|
||||
|
||||
// Formulaire d'impression (intervalle + sites).
|
||||
const printForm = reactive({
|
||||
from: '',
|
||||
to: '',
|
||||
siteIds: [] as number[]
|
||||
})
|
||||
|
||||
|
||||
// Remet le formulaire à zéro.
|
||||
const resetForm = () => {
|
||||
form.employeeId = ''
|
||||
form.typeId = ''
|
||||
form.startDate = ''
|
||||
form.startHalf = 'AM'
|
||||
form.endDate = ''
|
||||
form.endHalf = 'PM'
|
||||
form.comment = ''
|
||||
}
|
||||
|
||||
// Ferme le drawer et nettoie l'état.
|
||||
const closeDrawer = () => {
|
||||
isDrawerOpen.value = false
|
||||
editingAbsence.value = null
|
||||
resetForm()
|
||||
}
|
||||
|
||||
// Ouvre l'impression avec la période du mois courant.
|
||||
const openPrint = () => {
|
||||
const monthStart = toYmd(selectedYear.value, selectedMonth.value, 1)
|
||||
const monthEnd = toYmd(selectedYear.value, selectedMonth.value + 1, 0)
|
||||
@@ -220,12 +259,43 @@ const closePrint = () => {
|
||||
isPrintOpen.value = false
|
||||
}
|
||||
|
||||
// Parse "YYYY-MM-DD" en Date (ou null).
|
||||
const parseYmd = (value: string) => {
|
||||
const [year, month, day] = value.split('-').map(Number)
|
||||
if (!year || !month || !day) return null
|
||||
return new Date(year, month - 1, day)
|
||||
}
|
||||
|
||||
// Détermine si la journée est une demi-journée (AM/PM) ou complète.
|
||||
const getHalfForDate = (
|
||||
startDate: string,
|
||||
endDate: string,
|
||||
startHalf: HalfDay,
|
||||
endHalf: HalfDay,
|
||||
date: string
|
||||
) => {
|
||||
if (startDate === endDate) {
|
||||
return startHalf === endHalf ? startHalf : null
|
||||
}
|
||||
if (date === startDate && startHalf === 'PM') return 'PM'
|
||||
if (date === endDate && endHalf === 'AM') return 'AM'
|
||||
return null
|
||||
}
|
||||
|
||||
// Renvoie les segments occupés pour une date donnée (AM/PM).
|
||||
const getSegmentsForDate = (
|
||||
startDate: string,
|
||||
endDate: string,
|
||||
startHalf: HalfDay,
|
||||
endHalf: HalfDay,
|
||||
date: string
|
||||
) => {
|
||||
const half = getHalfForDate(startDate, endDate, startHalf, endHalf, date)
|
||||
if (!half) return HALF_DAYS.map((item) => item.value) as HalfDay[]
|
||||
return [half] as HalfDay[]
|
||||
}
|
||||
|
||||
// Ajoute des mois tout en gardant un jour valide.
|
||||
const addMonths = (date: Date, months: number) => {
|
||||
const next = new Date(date.getFullYear(), date.getMonth() + months, date.getDate())
|
||||
if (next.getMonth() !== (date.getMonth() + months) % 12) {
|
||||
@@ -234,6 +304,7 @@ const addMonths = (date: Date, months: number) => {
|
||||
return next
|
||||
}
|
||||
|
||||
// Limite l'intervalle d'impression à 2 mois max.
|
||||
const enforcePrintRange = () => {
|
||||
if (!printForm.from) return
|
||||
const start = parseYmd(printForm.from)
|
||||
@@ -266,6 +337,7 @@ const enforcePrintRange = () => {
|
||||
watch(() => printForm.from, enforcePrintRange)
|
||||
watch(() => printForm.to, enforcePrintRange)
|
||||
|
||||
// Chargements API.
|
||||
const loadEmployees = async () => {
|
||||
employees.value = await listEmployees()
|
||||
}
|
||||
@@ -302,15 +374,17 @@ watch(selectedYear, async () => {
|
||||
|
||||
// Indexation des absences par cellule pour eviter un find() a chaque case.
|
||||
const cellAbsenceMap = computed(() => {
|
||||
const map = new Map<string, { id: number; code: string; color: string; textColor?: string }>()
|
||||
const map = new Map<string, { id: number; code: string; color: string; halfLabel?: HalfDay; textColor?: string }>()
|
||||
const monthStart = monthStartDate.value
|
||||
const monthEnd = monthEndDate.value
|
||||
|
||||
for (const absence of absences.value) {
|
||||
const employeeId = absence.employee?.id
|
||||
if (!employeeId) continue
|
||||
const start = parseYmd(normalizeDate(absence.startDate))
|
||||
const end = parseYmd(normalizeDate(absence.endDate))
|
||||
const startDate = normalizeDate(absence.startDate)
|
||||
const endDate = normalizeDate(absence.endDate)
|
||||
const start = parseYmd(startDate)
|
||||
const end = parseYmd(endDate)
|
||||
if (!start || !end) continue
|
||||
|
||||
const rangeStart = start < monthStart ? monthStart : start
|
||||
@@ -322,11 +396,20 @@ const cellAbsenceMap = computed(() => {
|
||||
currentDate <= rangeEnd;
|
||||
currentDate.setDate(currentDate.getDate() + 1)
|
||||
) {
|
||||
const key = `${employeeId}-${toYmd(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate())}`
|
||||
const dateKey = toYmd(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate())
|
||||
const key = `${employeeId}-${dateKey}`
|
||||
const halfLabel = getHalfForDate(
|
||||
startDate,
|
||||
endDate,
|
||||
absence.startHalf ?? 'AM',
|
||||
absence.endHalf ?? 'PM',
|
||||
dateKey
|
||||
) ?? undefined
|
||||
map.set(key, {
|
||||
id: absence.id,
|
||||
code: absence.type?.code ?? '',
|
||||
color: absence.type?.color ?? '#222783'
|
||||
color: absence.type?.color ?? '#222783',
|
||||
halfLabel
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -334,15 +417,17 @@ const cellAbsenceMap = computed(() => {
|
||||
return map
|
||||
})
|
||||
|
||||
// Jours fériés (interdit pour la création).
|
||||
const isHolidayDate = (date: string) => {
|
||||
return Boolean(publicHolidays.value[date])
|
||||
}
|
||||
|
||||
// Renvoie l'absence effective pour une cellule (ou un "Férié").
|
||||
const getCellAbsence = (employeeId: number, date: string) => {
|
||||
if (isHolidayDate(date)) {
|
||||
return {
|
||||
id: 0,
|
||||
code: 'F',
|
||||
code: 'Férié',
|
||||
color: '#b3e5fc',
|
||||
textColor: '#0f172a'
|
||||
}
|
||||
@@ -352,20 +437,35 @@ const getCellAbsence = (employeeId: number, date: string) => {
|
||||
return null
|
||||
}
|
||||
|
||||
// Style de cellule (plein ou demi-journée).
|
||||
const getCellStyle = (employeeId: number, date: string) => {
|
||||
const absence = getCellAbsence(employeeId, date)
|
||||
if (!absence) return undefined
|
||||
|
||||
if (absence.halfLabel) {
|
||||
const color = absence.color
|
||||
const textColor = absence.textColor ?? '#FFF'
|
||||
const backgroundImage = absence.halfLabel === 'AM'
|
||||
? `linear-gradient(180deg, ${color} 0 50%, transparent 50% 100%)`
|
||||
: `linear-gradient(180deg, transparent 0 50%, ${color} 50% 100%)`
|
||||
return {
|
||||
backgroundImage,
|
||||
backgroundColor: 'transparent',
|
||||
color: textColor
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
backgroundColor: absence.color,
|
||||
color: absence.textColor ?? '#fff'
|
||||
}
|
||||
}
|
||||
|
||||
const getCellCode = (employeeId: number, date: string) => {
|
||||
return getCellAbsence(employeeId, date)?.code ?? ''
|
||||
const getCellInfo = (employeeId: number, date: string) => {
|
||||
return getCellAbsence(employeeId, date)
|
||||
}
|
||||
|
||||
// Ouverture du drawer depuis une cellule.
|
||||
const openCreate = (employee: Employee, date: string) => {
|
||||
if (isHolidayDate(date)) {
|
||||
window.alert("Impossible de creer une absence un jour ferie.")
|
||||
@@ -384,12 +484,16 @@ const openCreate = (employee: Employee, date: string) => {
|
||||
form.typeId = existing.type.id
|
||||
form.startDate = normalizeDate(existing.startDate)
|
||||
form.endDate = normalizeDate(existing.endDate)
|
||||
form.startHalf = existing.startHalf ?? 'AM'
|
||||
form.endHalf = existing.endHalf ?? 'PM'
|
||||
form.comment = existing.comment ?? ''
|
||||
} else {
|
||||
editingAbsence.value = null
|
||||
form.employeeId = employee.id
|
||||
form.startDate = date
|
||||
form.endDate = date
|
||||
form.startHalf = 'AM'
|
||||
form.endHalf = 'PM'
|
||||
form.typeId = ''
|
||||
form.comment = ''
|
||||
}
|
||||
@@ -397,6 +501,7 @@ const openCreate = (employee: Employee, date: string) => {
|
||||
isDrawerOpen.value = true
|
||||
}
|
||||
|
||||
// Ouverture du drawer depuis le bouton "Ajouter".
|
||||
const openCreateFromToday = () => {
|
||||
editingAbsence.value = null
|
||||
form.employeeId = ''
|
||||
@@ -409,10 +514,13 @@ const openCreateFromToday = () => {
|
||||
}
|
||||
form.startDate = today
|
||||
form.endDate = today
|
||||
form.startHalf = 'AM'
|
||||
form.endHalf = 'PM'
|
||||
form.comment = ''
|
||||
isDrawerOpen.value = true
|
||||
}
|
||||
|
||||
// Vérifie la présence d'un férié dans l'intervalle.
|
||||
const hasHolidayInRange = (startDate: string, endDate: string) => {
|
||||
const start = parseYmd(startDate)
|
||||
const end = parseYmd(endDate)
|
||||
@@ -430,6 +538,7 @@ const hasHolidayInRange = (startDate: string, endDate: string) => {
|
||||
return false
|
||||
}
|
||||
|
||||
// Soumission du formulaire: validations + chevauchement + save.
|
||||
const handleSubmit = async () => {
|
||||
if (isSubmitting.value) return
|
||||
|
||||
@@ -437,6 +546,14 @@ const handleSubmit = async () => {
|
||||
try {
|
||||
const start = normalizeDate(form.startDate)
|
||||
const end = normalizeDate(form.endDate)
|
||||
if (start > end) {
|
||||
window.alert("La date de fin ne peut pas etre avant la date de debut.")
|
||||
return
|
||||
}
|
||||
if (start === end && form.startHalf === 'PM' && form.endHalf === 'AM') {
|
||||
window.alert("La demi-journee de fin ne peut pas etre avant la demi-journee de debut.")
|
||||
return
|
||||
}
|
||||
if (hasHolidayInRange(start, end)) {
|
||||
window.alert("Impossible de creer une absence sur un jour ferie.")
|
||||
return
|
||||
@@ -446,7 +563,40 @@ const handleSubmit = async () => {
|
||||
if (editingAbsence.value && absence.id === editingAbsence.value.id) return false
|
||||
const aStart = normalizeDate(absence.startDate)
|
||||
const aEnd = normalizeDate(absence.endDate)
|
||||
return start <= aEnd && end >= aStart
|
||||
if (start > aEnd || end < aStart) return false
|
||||
|
||||
const overlapStart = start > aStart ? start : aStart
|
||||
const overlapEnd = end < aEnd ? end : aEnd
|
||||
const overlapStartDate = parseYmd(overlapStart)
|
||||
const overlapEndDate = parseYmd(overlapEnd)
|
||||
if (!overlapStartDate || !overlapEndDate) return false
|
||||
|
||||
for (
|
||||
let currentDate = new Date(overlapStartDate.getTime());
|
||||
currentDate <= overlapEndDate;
|
||||
currentDate.setDate(currentDate.getDate() + 1)
|
||||
) {
|
||||
const dateKey = toYmd(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate())
|
||||
const existingSegments = getSegmentsForDate(
|
||||
aStart,
|
||||
aEnd,
|
||||
absence.startHalf ?? 'AM',
|
||||
absence.endHalf ?? 'PM',
|
||||
dateKey
|
||||
)
|
||||
const newSegments = getSegmentsForDate(
|
||||
start,
|
||||
end,
|
||||
form.startHalf,
|
||||
form.endHalf,
|
||||
dateKey
|
||||
)
|
||||
if (existingSegments.some((segment) => newSegments.includes(segment))) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
})
|
||||
|
||||
if (overlaps.length > 0) {
|
||||
@@ -466,7 +616,9 @@ const handleSubmit = async () => {
|
||||
employeeId: Number(form.employeeId),
|
||||
typeId: Number(form.typeId),
|
||||
startDate: form.startDate,
|
||||
startHalf: form.startHalf,
|
||||
endDate: form.endDate,
|
||||
endHalf: form.endHalf,
|
||||
comment: form.comment
|
||||
})
|
||||
} else {
|
||||
@@ -474,7 +626,9 @@ const handleSubmit = async () => {
|
||||
employeeId: Number(form.employeeId),
|
||||
typeId: Number(form.typeId),
|
||||
startDate: form.startDate,
|
||||
startHalf: form.startHalf,
|
||||
endDate: form.endDate,
|
||||
endHalf: form.endHalf,
|
||||
comment: form.comment
|
||||
})
|
||||
}
|
||||
@@ -486,6 +640,7 @@ const handleSubmit = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// Suppression de l'absence en cours d'édition.
|
||||
const handleDelete = async () => {
|
||||
if (!editingAbsence.value) return
|
||||
|
||||
@@ -497,11 +652,13 @@ const handleDelete = async () => {
|
||||
await loadAbsences()
|
||||
}
|
||||
|
||||
// Affiche "Prénom N.".
|
||||
const formatEmployeeName = (employee: Employee) => {
|
||||
const initial = employee.lastName ? `${employee.lastName[0].toUpperCase()}.` : ''
|
||||
return `${employee.firstName} ${initial}`.trim()
|
||||
}
|
||||
|
||||
// Impression PDF de l'intervalle sélectionné.
|
||||
const { printPdf } = usePdfPrinter()
|
||||
const handlePrint = async () => {
|
||||
const params = new URLSearchParams()
|
||||
|
||||
@@ -63,7 +63,6 @@ const handleSubmit = async () => {
|
||||
|
||||
isSubmitting.value = true
|
||||
try {
|
||||
console.log(useRuntimeConfig().public.apiBase)
|
||||
await auth.login(username.value, password.value)
|
||||
|
||||
await router.push('/')
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -1,4 +1,5 @@
|
||||
import type { Absence } from './dto/absence'
|
||||
import type { HalfDay } from './dto/half-day'
|
||||
import { extractItems } from '~/utils/api'
|
||||
|
||||
type ListAbsencesFilters = {
|
||||
@@ -31,7 +32,9 @@ export const createAbsence = async (payload: {
|
||||
employeeId: number
|
||||
typeId: number
|
||||
startDate: string
|
||||
startHalf: HalfDay
|
||||
endDate: string
|
||||
endHalf: HalfDay
|
||||
comment?: string
|
||||
}) => {
|
||||
const api = useApi()
|
||||
@@ -39,7 +42,9 @@ export const createAbsence = async (payload: {
|
||||
employee: `/api/employees/${payload.employeeId}`,
|
||||
type: `/api/absence_types/${payload.typeId}`,
|
||||
startDate: payload.startDate,
|
||||
startHalf: payload.startHalf,
|
||||
endDate: payload.endDate,
|
||||
endHalf: payload.endHalf,
|
||||
comment: payload.comment
|
||||
}, {
|
||||
toastSuccessKey: 'success.absence.create',
|
||||
@@ -52,7 +57,9 @@ export const updateAbsence = async (payload: {
|
||||
employeeId: number
|
||||
typeId: number
|
||||
startDate: string
|
||||
startHalf: HalfDay
|
||||
endDate: string
|
||||
endHalf: HalfDay
|
||||
comment?: string
|
||||
}) => {
|
||||
const api = useApi()
|
||||
@@ -60,7 +67,9 @@ export const updateAbsence = async (payload: {
|
||||
employee: `/api/employees/${payload.employeeId}`,
|
||||
type: `/api/absence_types/${payload.typeId}`,
|
||||
startDate: payload.startDate,
|
||||
startHalf: payload.startHalf,
|
||||
endDate: payload.endDate,
|
||||
endHalf: payload.endHalf,
|
||||
comment: payload.comment
|
||||
}, {
|
||||
toastSuccessKey: 'success.absence.update',
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import type { Employee } from './employee'
|
||||
import type { AbsenceType } from './absence-type'
|
||||
import type { HalfDay } from './half-day'
|
||||
|
||||
export type Absence = {
|
||||
id: number
|
||||
startDate: string
|
||||
startHalf: HalfDay
|
||||
endDate: string
|
||||
endHalf: HalfDay
|
||||
comment?: string | null
|
||||
employee: Employee
|
||||
type: AbsenceType
|
||||
|
||||
6
frontend/services/dto/half-day.ts
Normal file
6
frontend/services/dto/half-day.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export type HalfDay = 'AM' | 'PM'
|
||||
|
||||
export const HALF_DAYS: { value: HalfDay; label: string }[] = [
|
||||
{ value: 'AM', label: 'Matin' },
|
||||
{ value: 'PM', label: 'Après-midi' }
|
||||
]
|
||||
28
migrations/Version20260210120000.php
Normal file
28
migrations/Version20260210120000.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version20260210120000 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add start/end half-day fields to absences';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql("ALTER TABLE absences ADD start_half VARCHAR(2) NOT NULL DEFAULT 'AM'");
|
||||
$this->addSql("ALTER TABLE absences ADD end_half VARCHAR(2) NOT NULL DEFAULT 'PM'");
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE absences DROP COLUMN start_half');
|
||||
$this->addSql('ALTER TABLE absences DROP COLUMN end_half');
|
||||
}
|
||||
}
|
||||
83
scripts/deploy-release.sh
Normal file
83
scripts/deploy-release.sh
Normal file
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Usage: ./scripts/deploy-release.sh v0.0.1
|
||||
# Requires: curl, tar, (optional) rsync
|
||||
#
|
||||
# Auth token: set RELEASE_TOKEN env var or create /etc/sirh-release-token
|
||||
umask 002
|
||||
|
||||
TAG="${1:-}"
|
||||
if [ -z "$TAG" ]; then
|
||||
echo "Usage: $0 v0.0.1" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
REPO_OWNER="MALIO-DEV"
|
||||
REPO_NAME="SIRH"
|
||||
GITEA_API="https://gitea.malio.fr/api/v1"
|
||||
DEPLOY_DIR="/var/www/sirh"
|
||||
|
||||
if [ -f /etc/sirh-release-token ] && [ -z "${RELEASE_TOKEN:-}" ]; then
|
||||
RELEASE_TOKEN="$(cat /etc/sirh-release-token)"
|
||||
fi
|
||||
|
||||
tmp_dir="$(mktemp -d)"
|
||||
cleanup() {
|
||||
rm -rf "$tmp_dir"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
release_json="$tmp_dir/release.json"
|
||||
curl_opts=(-sS)
|
||||
if [ -n "${RELEASE_TOKEN:-}" ]; then
|
||||
curl_opts+=(-H "Authorization: token ${RELEASE_TOKEN}")
|
||||
fi
|
||||
curl "${curl_opts[@]}" \
|
||||
"${GITEA_API}/repos/${REPO_OWNER}/${REPO_NAME}/releases/tags/${TAG}" \
|
||||
-o "$release_json"
|
||||
|
||||
asset_url="$(python3 - "$release_json" <<'PY'
|
||||
import json, sys
|
||||
data = json.load(open(sys.argv[1], 'r'))
|
||||
assets = data.get("assets", [])
|
||||
for a in assets:
|
||||
name = a.get("name", "")
|
||||
if name.startswith("sirh-") and name.endswith(".tar.gz"):
|
||||
print(a.get("browser_download_url", ""))
|
||||
break
|
||||
PY
|
||||
)"
|
||||
|
||||
if [ -z "$asset_url" ]; then
|
||||
echo "Release asset not found for tag ${TAG}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
archive="$tmp_dir/artefact.tar.gz"
|
||||
curl "${curl_opts[@]}" -L "$asset_url" -o "$archive"
|
||||
|
||||
tar -xzf "$archive" -C "$tmp_dir"
|
||||
|
||||
if command -v rsync >/dev/null 2>&1; then
|
||||
rsync -a --delete --no-perms --no-owner --no-group \
|
||||
--exclude ".env" \
|
||||
--exclude ".env.local" \
|
||||
--exclude "config/jwt" \
|
||||
--exclude "var" \
|
||||
"$tmp_dir"/ "$DEPLOY_DIR"/
|
||||
else
|
||||
cp -a "$tmp_dir"/. "$DEPLOY_DIR"/
|
||||
fi
|
||||
|
||||
# Ensure Nginx can traverse the deploy path.
|
||||
chmod o+rx "$(dirname "$DEPLOY_DIR")" "$DEPLOY_DIR" 2>/dev/null || true
|
||||
|
||||
echo "Release ${TAG} deployed to ${DEPLOY_DIR}"
|
||||
|
||||
if [ -f "${DEPLOY_DIR}/.env" ]; then
|
||||
echo "Running migrations (if any)..."
|
||||
php "${DEPLOY_DIR}/bin/console" doctrine:migrations:migrate --no-interaction --env=prod
|
||||
else
|
||||
echo "Skip migrations: ${DEPLOY_DIR}/.env not found" >&2
|
||||
fi
|
||||
@@ -50,10 +50,18 @@ class Absence
|
||||
#[Groups(['absence:read'])]
|
||||
private DateTimeInterface $startDate;
|
||||
|
||||
#[ORM\Column(type: 'string', length: 2, options: ['default' => 'AM'])]
|
||||
#[Groups(['absence:read'])]
|
||||
private string $startHalf = 'AM';
|
||||
|
||||
#[ORM\Column(type: 'date')]
|
||||
#[Groups(['absence:read'])]
|
||||
private DateTimeInterface $endDate;
|
||||
|
||||
#[ORM\Column(type: 'string', length: 2, options: ['default' => 'PM'])]
|
||||
#[Groups(['absence:read'])]
|
||||
private string $endHalf = 'PM';
|
||||
|
||||
#[ORM\Column(type: 'text', nullable: true)]
|
||||
#[Groups(['absence:read'])]
|
||||
private ?string $comment = null;
|
||||
@@ -111,6 +119,30 @@ class Absence
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getStartHalf(): string
|
||||
{
|
||||
return $this->startHalf;
|
||||
}
|
||||
|
||||
public function setStartHalf(string $startHalf): self
|
||||
{
|
||||
$this->startHalf = $startHalf;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEndHalf(): string
|
||||
{
|
||||
return $this->endHalf;
|
||||
}
|
||||
|
||||
public function setEndHalf(string $endHalf): self
|
||||
{
|
||||
$this->endHalf = $endHalf;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getComment(): ?string
|
||||
{
|
||||
return $this->comment;
|
||||
|
||||
@@ -78,7 +78,11 @@ class AbsencePrintProvider implements ProviderInterface
|
||||
$dompdf->setPaper('A3', 'landscape');
|
||||
$dompdf->render();
|
||||
|
||||
$filename = 'test';
|
||||
$filename = sprintf(
|
||||
'absences_du_%s_au_%s.pdf',
|
||||
$fromDate->format('d-m-Y'),
|
||||
$toDate->format('d-m-Y')
|
||||
);
|
||||
|
||||
return new Response($dompdf->output(), Response::HTTP_OK, [
|
||||
'Content-Type' => 'application/pdf',
|
||||
@@ -180,17 +184,38 @@ class AbsencePrintProvider implements ProviderInterface
|
||||
|
||||
$absenceStart = DateTimeImmutable::createFromInterface($absence->getStartDate());
|
||||
$absenceEnd = DateTimeImmutable::createFromInterface($absence->getEndDate());
|
||||
$startHalf = $absence->getStartHalf();
|
||||
$endHalf = $absence->getEndHalf();
|
||||
|
||||
$start = max($absenceStart, $from);
|
||||
$end = min($absenceEnd, $to);
|
||||
|
||||
$current = $start;
|
||||
while ($current <= $end) {
|
||||
$dateKey = $current->format('Y-m-d');
|
||||
$dateKey = $current->format('Y-m-d');
|
||||
$isSameDay = $absenceStart->format('Y-m-d') === $absenceEnd->format('Y-m-d');
|
||||
$isStartDay = $current->format('Y-m-d') === $absenceStart->format('Y-m-d');
|
||||
$isEndDay = $current->format('Y-m-d') === $absenceEnd->format('Y-m-d');
|
||||
$halfLabel = null;
|
||||
|
||||
if ($isSameDay) {
|
||||
if ($startHalf === $endHalf) {
|
||||
$halfLabel = $startHalf;
|
||||
}
|
||||
} else {
|
||||
if ($isStartDay && 'PM' === $startHalf) {
|
||||
$halfLabel = 'PM';
|
||||
}
|
||||
if ($isEndDay && 'AM' === $endHalf) {
|
||||
$halfLabel = 'AM';
|
||||
}
|
||||
}
|
||||
|
||||
$map[$employeeId][$dateKey] = [
|
||||
'code' => (string) $type->getCode(),
|
||||
'color' => (string) $type->getColor(),
|
||||
'code' => (string) $type->getCode(),
|
||||
'color' => (string) $type->getColor(),
|
||||
'half' => null !== $halfLabel,
|
||||
'halfLabel' => $halfLabel,
|
||||
];
|
||||
|
||||
$current = $current->add(new DateInterval('P1D'));
|
||||
|
||||
12
symfony.lock
12
symfony.lock
@@ -145,6 +145,18 @@
|
||||
".editorconfig"
|
||||
]
|
||||
},
|
||||
"symfony/monolog-bundle": {
|
||||
"version": "4.0",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "3.7",
|
||||
"ref": "1b9efb10c54cb51c713a9391c9300ff8bceda459"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/monolog.yaml"
|
||||
]
|
||||
},
|
||||
"symfony/property-info": {
|
||||
"version": "8.0",
|
||||
"recipe": {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 2mm;
|
||||
padding: 4mm;
|
||||
font-family: Helvetica, sans-serif;
|
||||
font-size: 8px;
|
||||
}
|
||||
@@ -69,6 +69,11 @@
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
.holiday-code {
|
||||
font-weight: bold;
|
||||
font-size: 4px;
|
||||
}
|
||||
|
||||
.month-separator {
|
||||
border-right: 4px solid #0a0a0a !important;
|
||||
}
|
||||
@@ -80,6 +85,49 @@
|
||||
.holiday {
|
||||
background: #b3e5fc;
|
||||
}
|
||||
|
||||
.body-cell {
|
||||
height: 6mm;
|
||||
padding: 0 !important;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.full-cell {
|
||||
display: block;
|
||||
height: 6mm;
|
||||
line-height: 6mm;
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.half-table {
|
||||
width: 100%;
|
||||
height: 6mm;
|
||||
border-collapse: collapse;
|
||||
table-layout: fixed;
|
||||
border: 0;
|
||||
border-spacing: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.half-td {
|
||||
height: 3mm;
|
||||
line-height: 3mm;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
font-size: 7px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
td.body-cell table,
|
||||
td.body-cell td {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -198,11 +246,26 @@
|
||||
{% set info = absenceMap[employee.id][day.date] ?? null %}
|
||||
{% set isMonthEnd = (not loop.last) and (days[loop.index].date|date('n') != day.date|date('n')) %}
|
||||
{% set isWeekend = day.date|date('N') in [6, 7] %}
|
||||
<td class="col-day{% if isMonthEnd %} month-separator{% endif %}{% if isWeekend %} weekend{% endif %}{% if isHoliday %} holiday{% endif %}" style="width: {{ dayColWidthMm }}mm;{% if info and not isHoliday %} background-color: {{ info.color }};{% endif %}">
|
||||
<td class="col-day body-cell{% if isMonthEnd %} month-separator{% endif %}{% if isWeekend %} weekend{% endif %}{% if isHoliday %} holiday{% endif %}" style="width: {{ dayColWidthMm }}mm;{% if info and not isHoliday and not info.half %} background-color: {{ info.color }};{% endif %}">
|
||||
{% if isHoliday %}
|
||||
<span class="code">F</span>
|
||||
<span class="full-cell code">Férié</span>
|
||||
{% elseif info %}
|
||||
<span class="code">{{ info.code }}</span>
|
||||
{% if info.half %}
|
||||
<table class="half-table">
|
||||
<tr>
|
||||
<td class="half-td" style="{% if info.halfLabel == 'AM' %}background-color: {{ info.color }};{% endif %}">
|
||||
{% if info.halfLabel == 'AM' %}{{ info.code }}{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="half-td" style="{% if info.halfLabel == 'PM' %}background-color: {{ info.color }};{% endif %}">
|
||||
{% if info.halfLabel == 'PM' %}{{ info.code }}{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{% else %}
|
||||
<span class="full-cell code">{{ info.code }}</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user