This commit is contained in:
Thomas Peterson 2025-07-28 10:20:30 +02:00
parent 6382621ee5
commit 918e4f9455
61 changed files with 14482 additions and 2670 deletions

9295
dev_db/backup.sql Normal file

File diff suppressed because one or more lines are too long

BIN
dev_db/db.dump Normal file

Binary file not shown.

View File

@ -30,9 +30,8 @@
"doctrine/doctrine-bundle": "^2", "doctrine/doctrine-bundle": "^2",
"doctrine/mongodb-odm-bundle": "^5", "doctrine/mongodb-odm-bundle": "^5",
"doctrine/orm": "^2.7", "doctrine/orm": "^2.7",
"mistic100/randomcolor": "^1.1",
"spatie/array-to-xml": "^3.4",
"gabrielbull/ups-api": "dev-master", "gabrielbull/ups-api": "dev-master",
"gesdinet/jwt-refresh-token-bundle": "^1.5",
"gregwar/captcha-bundle": "^2.2", "gregwar/captcha-bundle": "^2.2",
"guzzlehttp/guzzle": "^7", "guzzlehttp/guzzle": "^7",
"horstoeko/zugferd": "^1.0", "horstoeko/zugferd": "^1.0",
@ -44,10 +43,11 @@
"lexik/form-filter-bundle": "^7", "lexik/form-filter-bundle": "^7",
"lexik/jwt-authentication-bundle": "^3", "lexik/jwt-authentication-bundle": "^3",
"liip/imagine-bundle": "2.9.*", "liip/imagine-bundle": "2.9.*",
"mistic100/randomcolor": "^1.1",
"mobiledetect/mobiledetectlib": "^2.8", "mobiledetect/mobiledetectlib": "^2.8",
"mpdf/mpdf": "dev-qrcode", "mpdf/mpdf": "dev-qrcode",
"mpdf/qrcode": "^1.2", "mpdf/qrcode": "^1.2",
"nelmio/api-doc-bundle": "v4.11.1", "nelmio/api-doc-bundle": "^5",
"nelmio/cors-bundle": "^2.2", "nelmio/cors-bundle": "^2.2",
"nicolab/php-ftp-client": "^1.4", "nicolab/php-ftp-client": "^1.4",
"oneup/uploader-bundle": "^3", "oneup/uploader-bundle": "^3",
@ -66,6 +66,7 @@
"scssphp/scssphp": "v1.11.1", "scssphp/scssphp": "v1.11.1",
"sensio/framework-extra-bundle": "^6.1", "sensio/framework-extra-bundle": "^6.1",
"sofort/sofortlib-php": "3.3.2", "sofort/sofortlib-php": "3.3.2",
"spatie/array-to-xml": "^3.4",
"symfony/asset": "*", "symfony/asset": "*",
"symfony/asset-mapper": "6.4.*", "symfony/asset-mapper": "6.4.*",
"symfony/console": "*", "symfony/console": "*",
@ -186,8 +187,7 @@
"assets:install %PUBLIC_DIR%": "symfony-cmd", "assets:install %PUBLIC_DIR%": "symfony-cmd",
"importmap:install": "symfony-cmd" "importmap:install": "symfony-cmd"
}, },
"post-install-cmd": [ "post-install-cmd": [],
],
"post-update-cmd": [ "post-update-cmd": [
"@auto-scripts" "@auto-scripts"
] ]

445
src/new/composer.lock generated
View File

@ -4,34 +4,34 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "165c392e6106046b8c285f0211498131", "content-hash": "9b481d5b6c4b610b15183e3afe963bd1",
"packages": [ "packages": [
{ {
"name": "azuyalabs/yasumi", "name": "azuyalabs/yasumi",
"version": "2.7.0", "version": "2.8.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/azuyalabs/yasumi.git", "url": "https://github.com/azuyalabs/yasumi.git",
"reference": "37d1215d4f4012d3185bb9990c76ca17a4ff1c30" "reference": "cc07874da062070fdc201a4297a7724f7d6aafb2"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/azuyalabs/yasumi/zipball/37d1215d4f4012d3185bb9990c76ca17a4ff1c30", "url": "https://api.github.com/repos/azuyalabs/yasumi/zipball/cc07874da062070fdc201a4297a7724f7d6aafb2",
"reference": "37d1215d4f4012d3185bb9990c76ca17a4ff1c30", "reference": "cc07874da062070fdc201a4297a7724f7d6aafb2",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-json": "*", "ext-json": "*",
"php": ">=8.0" "php": ">=8.1"
}, },
"require-dev": { "require-dev": {
"azuyalabs/php-cs-fixer-config": "^0.3",
"ext-intl": "*", "ext-intl": "*",
"friendsofphp/php-cs-fixer": "^2.19 || ^3.40",
"mikey179/vfsstream": "^1.6", "mikey179/vfsstream": "^1.6",
"phan/phan": "^5.4", "phpstan/phpstan": "^2.1",
"phpstan/phpstan": "^1.10", "phpstan/phpstan-deprecation-rules": "^2.0",
"phpunit/phpunit": "^8.5 || ^9.6", "phpunit/phpunit": "^8.5 || ^9.6",
"vimeo/psalm": "^5.16" "vimeo/psalm": "^6.12"
}, },
"suggest": { "suggest": {
"ext-calendar": "For calculating the date of Easter" "ext-calendar": "For calculating the date of Easter"
@ -50,10 +50,11 @@
{ {
"name": "Sacha Telgenhof", "name": "Sacha Telgenhof",
"email": "me@sachatelgenhof.com", "email": "me@sachatelgenhof.com",
"homepage": "https://www.sachatelgenhof.com",
"role": "Maintainer" "role": "Maintainer"
} }
], ],
"description": "The easy PHP Library for calculating holidays.", "description": "The easy PHP Library for calculating holidays",
"homepage": "https://www.yasumi.dev", "homepage": "https://www.yasumi.dev",
"keywords": [ "keywords": [
"Bank", "Bank",
@ -77,7 +78,7 @@
"type": "other" "type": "other"
} }
], ],
"time": "2024-01-07T14:12:44+00:00" "time": "2025-07-13T15:40:05+00:00"
}, },
{ {
"name": "behat/transliterator", "name": "behat/transliterator",
@ -2709,6 +2710,86 @@
}, },
"time": "2022-07-12T08:47:40+00:00" "time": "2022-07-12T08:47:40+00:00"
}, },
{
"name": "gesdinet/jwt-refresh-token-bundle",
"version": "v1.5.0",
"source": {
"type": "git",
"url": "https://github.com/markitosgv/JWTRefreshTokenBundle.git",
"reference": "8706b0d8dcb26610358ba3328ec412315b55c3cd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/markitosgv/JWTRefreshTokenBundle/zipball/8706b0d8dcb26610358ba3328ec412315b55c3cd",
"reference": "8706b0d8dcb26610358ba3328ec412315b55c3cd",
"shasum": ""
},
"require": {
"doctrine/persistence": "^1.3.3|^2.0|^3.0|^4.0",
"lexik/jwt-authentication-bundle": "^2.0|^3.0",
"php": ">=7.4",
"symfony/config": "^5.4|^6.0|^7.0",
"symfony/console": "^5.4|^6.0|^7.0",
"symfony/dependency-injection": "^5.4|^6.0|^7.0",
"symfony/deprecation-contracts": "^2.1|^3.0",
"symfony/event-dispatcher": "^5.4|^6.0|^7.0",
"symfony/http-foundation": "^5.4|^6.0|^7.0",
"symfony/http-kernel": "^5.4|^6.0|^7.0",
"symfony/polyfill-php80": "^1.15",
"symfony/property-access": "^5.4|^6.0|^7.0",
"symfony/security-bundle": "^5.4|^6.0|^7.0",
"symfony/security-core": "^5.4|^6.0|^7.0",
"symfony/security-http": "^5.4|^6.0|^7.0"
},
"conflict": {
"doctrine/mongodb-odm": "<2.2",
"doctrine/orm": "<2.7"
},
"require-dev": {
"doctrine/annotations": "^1.13|^2.0",
"doctrine/cache": "^1.11|^2.0",
"doctrine/mongodb-odm": "^2.2",
"doctrine/orm": "^2.7|^3.0",
"matthiasnoback/symfony-config-test": "^4.2|^5.0",
"matthiasnoback/symfony-dependency-injection-test": "^4.2|^5.0",
"phpunit/phpunit": "^9.5",
"symfony/cache": "^5.4|^6.0|^7.0",
"symfony/security-guard": "^5.4"
},
"type": "symfony-bundle",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"Gesdinet\\JWTRefreshTokenBundle\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marcos Gómez Vilches",
"email": "marcos@gesdinet.com"
}
],
"description": "Implements a refresh token system over Json Web Tokens in Symfony",
"keywords": [
"jwt refresh token bundle symfony json web"
],
"support": {
"issues": "https://github.com/markitosgv/JWTRefreshTokenBundle/issues",
"source": "https://github.com/markitosgv/JWTRefreshTokenBundle/tree/v1.5.0"
},
"time": "2025-06-24T13:08:37+00:00"
},
{ {
"name": "goetas-webservices/xsd2php-runtime", "name": "goetas-webservices/xsd2php-runtime",
"version": "v0.2.17", "version": "v0.2.17",
@ -4758,22 +4839,22 @@
}, },
{ {
"name": "maennchen/zipstream-php", "name": "maennchen/zipstream-php",
"version": "3.1.2", "version": "3.2.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/maennchen/ZipStream-PHP.git", "url": "https://github.com/maennchen/ZipStream-PHP.git",
"reference": "aeadcf5c412332eb426c0f9b4485f6accba2a99f" "reference": "9712d8fa4cdf9240380b01eb4be55ad8dcf71416"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/aeadcf5c412332eb426c0f9b4485f6accba2a99f", "url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/9712d8fa4cdf9240380b01eb4be55ad8dcf71416",
"reference": "aeadcf5c412332eb426c0f9b4485f6accba2a99f", "reference": "9712d8fa4cdf9240380b01eb4be55ad8dcf71416",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-mbstring": "*", "ext-mbstring": "*",
"ext-zlib": "*", "ext-zlib": "*",
"php-64bit": "^8.2" "php-64bit": "^8.3"
}, },
"require-dev": { "require-dev": {
"brianium/paratest": "^7.7", "brianium/paratest": "^7.7",
@ -4782,7 +4863,7 @@
"guzzlehttp/guzzle": "^7.5", "guzzlehttp/guzzle": "^7.5",
"mikey179/vfsstream": "^1.6", "mikey179/vfsstream": "^1.6",
"php-coveralls/php-coveralls": "^2.5", "php-coveralls/php-coveralls": "^2.5",
"phpunit/phpunit": "^11.0", "phpunit/phpunit": "^12.0",
"vimeo/psalm": "^6.0" "vimeo/psalm": "^6.0"
}, },
"suggest": { "suggest": {
@ -4824,7 +4905,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/maennchen/ZipStream-PHP/issues", "issues": "https://github.com/maennchen/ZipStream-PHP/issues",
"source": "https://github.com/maennchen/ZipStream-PHP/tree/3.1.2" "source": "https://github.com/maennchen/ZipStream-PHP/tree/3.2.0"
}, },
"funding": [ "funding": [
{ {
@ -4832,7 +4913,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2025-01-27T12:07:53+00:00" "time": "2025-07-17T11:15:13+00:00"
}, },
{ {
"name": "markbaker/complex", "name": "markbaker/complex",
@ -5613,61 +5694,71 @@
}, },
{ {
"name": "nelmio/api-doc-bundle", "name": "nelmio/api-doc-bundle",
"version": "v4.11.1", "version": "v5.4.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nelmio/NelmioApiDocBundle.git", "url": "https://github.com/nelmio/NelmioApiDocBundle.git",
"reference": "d40c4eb0c090675f3685f75712af331f02924462" "reference": "49098f9e3f5e7a466b95b1d108d45857ba533c96"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nelmio/NelmioApiDocBundle/zipball/d40c4eb0c090675f3685f75712af331f02924462", "url": "https://api.github.com/repos/nelmio/NelmioApiDocBundle/zipball/49098f9e3f5e7a466b95b1d108d45857ba533c96",
"reference": "d40c4eb0c090675f3685f75712af331f02924462", "reference": "49098f9e3f5e7a466b95b1d108d45857ba533c96",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"doctrine/annotations": "^1.11|^2.0", "php": ">=8.1",
"ext-json": "*", "phpdocumentor/reflection-docblock": "^5.0",
"php": ">=7.2", "phpdocumentor/type-resolver": "^1.8.2",
"phpdocumentor/reflection-docblock": "^3.1|^4.0|^5.0", "psr/cache": "^1.0 || ^2.0 || ^3.0",
"psr/cache": "^1.0|^2.0|^3.0", "psr/container": "^1.0 || ^2.0",
"psr/container": "^1.0|^2.0", "psr/log": "^1.0 || ^2.0 || ^3.0",
"psr/log": "^1.0|^2.0|^3.0", "symfony/config": "^6.4 || ^7.1",
"symfony/config": "^4.4|^5.0|^6.0", "symfony/console": "^6.4 || ^7.1",
"symfony/console": "^4.4|^5.0|^6.0", "symfony/dependency-injection": "^6.4 || ^7.1",
"symfony/dependency-injection": "^4.4|^5.0|^6.0", "symfony/deprecation-contracts": "^2.1 || ^3",
"symfony/framework-bundle": "^4.4|^5.0|^6.0", "symfony/framework-bundle": "^6.4 || ^7.1",
"symfony/http-foundation": "^4.4|^5.0|^6.0", "symfony/http-foundation": "^6.4 || ^7.1",
"symfony/http-kernel": "^4.4|^5.0|^6.0", "symfony/http-kernel": "^6.4 || ^7.1",
"symfony/options-resolver": "^4.4|^5.0|^6.0", "symfony/options-resolver": "^6.4 || ^7.1",
"symfony/property-info": "^4.4|^5.0|^6.0", "symfony/property-info": "^6.4 || ^7.1",
"symfony/routing": "^4.4|^5.0|^6.0", "symfony/routing": "^6.4 || ^7.1",
"zircote/swagger-php": "^4.2.15" "zircote/swagger-php": "^4.11.1 || ^5.0"
}, },
"conflict": { "conflict": {
"symfony/framework-bundle": "4.2.7" "zircote/swagger-php": "4.8.7"
}, },
"require-dev": { "require-dev": {
"api-platform/core": "^2.7.0|^3@dev", "api-platform/core": "^3.2",
"composer/package-versions-deprecated": "1.11.99.1", "friendsofphp/php-cs-fixer": "^3.52",
"friendsofsymfony/rest-bundle": "^2.8|^3.0", "friendsofsymfony/rest-bundle": "^3.2.0",
"jms/serializer": "^1.14|^3.0", "jms/serializer": "^3.32",
"jms/serializer-bundle": "^2.3|^3.0|^4.0|^5.0@beta", "jms/serializer-bundle": "^5.5",
"sensio/framework-extra-bundle": "^4.4|^5.2|^6.0", "phpstan/phpstan": "^1.10",
"symfony/asset": "^4.4|^5.2|^6.0", "phpstan/phpstan-phpunit": "^1.3",
"symfony/browser-kit": "^4.4|^5.2|^6.0", "phpstan/phpstan-strict-rules": "^1.5",
"symfony/cache": "^4.4|^5.2|^6.0", "phpstan/phpstan-symfony": "^1.3",
"symfony/deprecation-contracts": "^2.1|^3", "phpunit/phpunit": "^10.5",
"symfony/dom-crawler": "^4.4|^5.2|^6.0", "symfony/asset": "^6.4 || ^7.1",
"symfony/form": "^4.4|^5.2|^6.0", "symfony/browser-kit": "^6.4 || ^7.1",
"symfony/phpunit-bridge": "^5.2", "symfony/cache": "^6.4 || ^7.1",
"symfony/property-access": "^4.4|^5.2|^6.0", "symfony/dom-crawler": "^6.4 || ^7.1",
"symfony/serializer": "^4.4|^5.2|^6.0", "symfony/expression-language": "^6.4 || ^7.1",
"symfony/stopwatch": "^4.4|^5.2|^6.0", "symfony/finder": "^6.4 || ^7.1",
"symfony/templating": "^4.4|^5.2|^6.0", "symfony/form": "^6.4 || ^7.1",
"symfony/twig-bundle": "^4.4|^5.2|^6.0", "symfony/phpunit-bridge": "^6.4 || ^7.1",
"symfony/validator": "^4.4|^5.2|^6.0", "symfony/property-access": "^6.4 || ^7.1",
"willdurand/hateoas-bundle": "^1.0|^2.0" "symfony/security-csrf": "^6.4 || ^7.1",
"symfony/security-http": "^6.4 || ^7.1",
"symfony/serializer": "^6.4 || ^7.1",
"symfony/stopwatch": "^6.4 || ^7.1",
"symfony/templating": "^6.4 || ^7.1",
"symfony/translation": "^6.4 || ^7.1",
"symfony/twig-bundle": "^6.4 || ^7.1",
"symfony/uid": "^6.4 || ^7.1",
"symfony/validator": "^6.4 || ^7.1",
"willdurand/hateoas-bundle": "^2.7",
"willdurand/negotiation": "^3.0"
}, },
"suggest": { "suggest": {
"api-platform/core": "For using an API oriented framework.", "api-platform/core": "For using an API oriented framework.",
@ -5677,6 +5768,7 @@
"symfony/cache": "For using a PSR-6 compatible cache implementation with the API doc generator.", "symfony/cache": "For using a PSR-6 compatible cache implementation with the API doc generator.",
"symfony/form": "For describing your form type models.", "symfony/form": "For describing your form type models.",
"symfony/monolog-bundle": "For using a PSR-3 compatible logger implementation with the API PHP describer.", "symfony/monolog-bundle": "For using a PSR-3 compatible logger implementation with the API PHP describer.",
"symfony/security-csrf": "For using csrf protection tokens in forms.",
"symfony/serializer": "For describing your models.", "symfony/serializer": "For describing your models.",
"symfony/twig-bundle": "For using the Swagger UI.", "symfony/twig-bundle": "For using the Swagger UI.",
"symfony/validator": "For describing the validation constraints in your models.", "symfony/validator": "For describing the validation constraints in your models.",
@ -5685,32 +5777,26 @@
"type": "symfony-bundle", "type": "symfony-bundle",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "4.x-dev" "dev-4.x": "4.x-dev",
"dev-5.x": "5.x-dev"
} }
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Nelmio\\ApiDocBundle\\": "" "Nelmio\\ApiDocBundle\\": "src/"
}, }
"exclude-from-classmap": [
"Tests/"
]
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
"authors": [ "authors": [
{
"name": "Nelmio",
"homepage": "http://nelm.io"
},
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "https://github.com/nelmio/NelmioApiDocBundle/contributors" "homepage": "https://github.com/nelmio/NelmioApiDocBundle/contributors"
} }
], ],
"description": "Generates documentation for your REST API from annotations", "description": "Generates documentation for your REST API from attributes",
"keywords": [ "keywords": [
"api", "api",
"doc", "doc",
@ -5719,9 +5805,15 @@
], ],
"support": { "support": {
"issues": "https://github.com/nelmio/NelmioApiDocBundle/issues", "issues": "https://github.com/nelmio/NelmioApiDocBundle/issues",
"source": "https://github.com/nelmio/NelmioApiDocBundle/tree/v4.11.1" "source": "https://github.com/nelmio/NelmioApiDocBundle/tree/v5.4.0"
}, },
"time": "2023-02-01T07:18:39+00:00" "funding": [
{
"url": "https://github.com/DjordyKoert",
"type": "github"
}
],
"time": "2025-06-26T15:03:21+00:00"
}, },
{ {
"name": "nelmio/cors-bundle", "name": "nelmio/cors-bundle",
@ -5942,6 +6034,64 @@
}, },
"time": "2022-03-22T15:42:45+00:00" "time": "2022-03-22T15:42:45+00:00"
}, },
{
"name": "nikic/php-parser",
"version": "v5.6.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "221b0d0fdf1369c71047ad1d18bb5880017bbc56"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/221b0d0fdf1369c71047ad1d18bb5880017bbc56",
"reference": "221b0d0fdf1369c71047ad1d18bb5880017bbc56",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"ext-json": "*",
"ext-tokenizer": "*",
"php": ">=7.4"
},
"require-dev": {
"ircmaxell/php-yacc": "^0.0.7",
"phpunit/phpunit": "^9.0"
},
"bin": [
"bin/php-parse"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.0-dev"
}
},
"autoload": {
"psr-4": {
"PhpParser\\": "lib/PhpParser"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Nikita Popov"
}
],
"description": "A PHP parser written in PHP",
"keywords": [
"parser",
"php"
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v5.6.0"
},
"time": "2025-07-27T20:03:57+00:00"
},
{ {
"name": "oneup/uploader-bundle", "name": "oneup/uploader-bundle",
"version": "3.2.1", "version": "3.2.1",
@ -6560,16 +6710,16 @@
}, },
{ {
"name": "phpoffice/phpspreadsheet", "name": "phpoffice/phpspreadsheet",
"version": "1.29.11", "version": "1.29.12",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHPOffice/PhpSpreadsheet.git", "url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
"reference": "05b6c4378ddf3e81b460ea645c42b46432c0db25" "reference": "7c06eed662cce7ecab88f6f9f7626b443f5285df"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/05b6c4378ddf3e81b460ea645c42b46432c0db25", "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/7c06eed662cce7ecab88f6f9f7626b443f5285df",
"reference": "05b6c4378ddf3e81b460ea645c42b46432c0db25", "reference": "7c06eed662cce7ecab88f6f9f7626b443f5285df",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -6660,9 +6810,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues", "issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues",
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.29.11" "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.29.12"
}, },
"time": "2025-06-23T01:22:06+00:00" "time": "2025-07-23T04:40:30+00:00"
}, },
{ {
"name": "phpseclib/phpseclib", "name": "phpseclib/phpseclib",
@ -6776,16 +6926,16 @@
}, },
{ {
"name": "phpstan/phpdoc-parser", "name": "phpstan/phpdoc-parser",
"version": "2.1.0", "version": "2.2.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpdoc-parser.git", "url": "https://github.com/phpstan/phpdoc-parser.git",
"reference": "9b30d6fd026b2c132b3985ce6b23bec09ab3aa68" "reference": "b9e61a61e39e02dd90944e9115241c7f7e76bfd8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/9b30d6fd026b2c132b3985ce6b23bec09ab3aa68", "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/b9e61a61e39e02dd90944e9115241c7f7e76bfd8",
"reference": "9b30d6fd026b2c132b3985ce6b23bec09ab3aa68", "reference": "b9e61a61e39e02dd90944e9115241c7f7e76bfd8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -6817,9 +6967,9 @@
"description": "PHPDoc parser with support for nullable, intersection and generic types", "description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": { "support": {
"issues": "https://github.com/phpstan/phpdoc-parser/issues", "issues": "https://github.com/phpstan/phpdoc-parser/issues",
"source": "https://github.com/phpstan/phpdoc-parser/tree/2.1.0" "source": "https://github.com/phpstan/phpdoc-parser/tree/2.2.0"
}, },
"time": "2025-02-19T13:28:12+00:00" "time": "2025-07-13T07:04:09+00:00"
}, },
{ {
"name": "picqer/sendcloud-php-client", "name": "picqer/sendcloud-php-client",
@ -15016,36 +15166,41 @@
}, },
{ {
"name": "zircote/swagger-php", "name": "zircote/swagger-php",
"version": "4.11.1", "version": "5.1.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zircote/swagger-php.git", "url": "https://github.com/zircote/swagger-php.git",
"reference": "7df10e8ec47db07c031db317a25bef962b4e5de1" "reference": "471f2e7c24c9508a2ee08df245cab64b62dbf721"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zircote/swagger-php/zipball/7df10e8ec47db07c031db317a25bef962b4e5de1", "url": "https://api.github.com/repos/zircote/swagger-php/zipball/471f2e7c24c9508a2ee08df245cab64b62dbf721",
"reference": "7df10e8ec47db07c031db317a25bef962b4e5de1", "reference": "471f2e7c24c9508a2ee08df245cab64b62dbf721",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-json": "*", "ext-json": "*",
"php": ">=7.2", "nikic/php-parser": "^4.19 || ^5.0",
"php": ">=7.4",
"psr/log": "^1.1 || ^2.0 || ^3.0", "psr/log": "^1.1 || ^2.0 || ^3.0",
"symfony/deprecation-contracts": "^2 || ^3", "symfony/deprecation-contracts": "^2 || ^3",
"symfony/finder": ">=2.2", "symfony/finder": "^5.0 || ^6.0 || ^7.0",
"symfony/yaml": ">=3.3" "symfony/yaml": "^5.0 || ^6.0 || ^7.0"
},
"conflict": {
"symfony/process": ">=6, <6.4.14"
}, },
"require-dev": { "require-dev": {
"composer/package-versions-deprecated": "^1.11", "composer/package-versions-deprecated": "^1.11",
"doctrine/annotations": "^1.7 || ^2.0", "doctrine/annotations": "^2.0",
"friendsofphp/php-cs-fixer": "^2.17 || 3.62.0", "friendsofphp/php-cs-fixer": "^3.62.0",
"phpstan/phpstan": "^1.6", "phpstan/phpstan": "^1.6 || ^2.0",
"phpunit/phpunit": ">=8", "phpunit/phpunit": "^9.0",
"vimeo/psalm": "^4.23" "rector/rector": "^1.0 || ^2.0",
"vimeo/psalm": "^4.30 || ^5.0"
}, },
"suggest": { "suggest": {
"doctrine/annotations": "^1.7 || ^2.0" "doctrine/annotations": "^2.0"
}, },
"bin": [ "bin": [
"bin/openapi" "bin/openapi"
@ -15053,7 +15208,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "4.x-dev" "dev-master": "5.x-dev"
} }
}, },
"autoload": { "autoload": {
@ -15081,8 +15236,8 @@
"homepage": "https://radebatz.net" "homepage": "https://radebatz.net"
} }
], ],
"description": "swagger-php - Generate interactive documentation for your RESTful API using phpdoc annotations", "description": "Generate interactive documentation for your RESTful API using PHP attributes (preferred) or PHPDoc annotations",
"homepage": "https://github.com/zircote/swagger-php/", "homepage": "https://github.com/zircote/swagger-php",
"keywords": [ "keywords": [
"api", "api",
"json", "json",
@ -15091,9 +15246,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/zircote/swagger-php/issues", "issues": "https://github.com/zircote/swagger-php/issues",
"source": "https://github.com/zircote/swagger-php/tree/4.11.1" "source": "https://github.com/zircote/swagger-php/tree/5.1.4"
}, },
"time": "2024-10-15T19:20:02+00:00" "time": "2025-07-15T23:54:13+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [
@ -15503,16 +15658,16 @@
}, },
{ {
"name": "masterminds/html5", "name": "masterminds/html5",
"version": "2.9.0", "version": "2.10.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/Masterminds/html5-php.git", "url": "https://github.com/Masterminds/html5-php.git",
"reference": "f5ac2c0b0a2eefca70b2ce32a5809992227e75a6" "reference": "fcf91eb64359852f00d921887b219479b4f21251"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Masterminds/html5-php/zipball/f5ac2c0b0a2eefca70b2ce32a5809992227e75a6", "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/fcf91eb64359852f00d921887b219479b4f21251",
"reference": "f5ac2c0b0a2eefca70b2ce32a5809992227e75a6", "reference": "fcf91eb64359852f00d921887b219479b4f21251",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -15564,9 +15719,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/Masterminds/html5-php/issues", "issues": "https://github.com/Masterminds/html5-php/issues",
"source": "https://github.com/Masterminds/html5-php/tree/2.9.0" "source": "https://github.com/Masterminds/html5-php/tree/2.10.0"
}, },
"time": "2024-03-31T07:05:07+00:00" "time": "2025-07-25T09:04:22+00:00"
}, },
{ {
"name": "mockery/mockery", "name": "mockery/mockery",
@ -15747,64 +15902,6 @@
], ],
"time": "2025-02-26T09:01:07+00:00" "time": "2025-02-26T09:01:07+00:00"
}, },
{
"name": "nikic/php-parser",
"version": "v5.5.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "ae59794362fe85e051a58ad36b289443f57be7a9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/ae59794362fe85e051a58ad36b289443f57be7a9",
"reference": "ae59794362fe85e051a58ad36b289443f57be7a9",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"ext-json": "*",
"ext-tokenizer": "*",
"php": ">=7.4"
},
"require-dev": {
"ircmaxell/php-yacc": "^0.0.7",
"phpunit/phpunit": "^9.0"
},
"bin": [
"bin/php-parse"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.0-dev"
}
},
"autoload": {
"psr-4": {
"PhpParser\\": "lib/PhpParser"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Nikita Popov"
}
],
"description": "A PHP parser written in PHP",
"keywords": [
"parser",
"php"
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v5.5.0"
},
"time": "2025-05-31T08:24:38+00:00"
},
{ {
"name": "phar-io/manifest", "name": "phar-io/manifest",
"version": "2.0.4", "version": "2.0.4",
@ -16057,16 +16154,16 @@
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.12.27", "version": "1.12.28",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "3a6e423c076ab39dfedc307e2ac627ef579db162" "reference": "fcf8b71aeab4e1a1131d1783cef97b23a51b87a9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/3a6e423c076ab39dfedc307e2ac627ef579db162", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/fcf8b71aeab4e1a1131d1783cef97b23a51b87a9",
"reference": "3a6e423c076ab39dfedc307e2ac627ef579db162", "reference": "fcf8b71aeab4e1a1131d1783cef97b23a51b87a9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -16111,7 +16208,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2025-05-21T20:51:45+00:00" "time": "2025-07-17T17:15:39+00:00"
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",

View File

@ -51,6 +51,7 @@ return [
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true], Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
Nelmio\ApiDocBundle\NelmioApiDocBundle::class => ['all' => true], Nelmio\ApiDocBundle\NelmioApiDocBundle::class => ['all' => true],
Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true], Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true],
Gesdinet\JWTRefreshTokenBundle\GesdinetJWTRefreshTokenBundle::class => ['all' => true],
Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle::class => ['dev' => true, 'test' => true], Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle::class => ['dev' => true, 'test' => true],
Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle::class => ['dev' => true, 'test' => true], Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle::class => ['dev' => true, 'test' => true],
Hautelook\AliceBundle\HautelookAliceBundle::class => ['dev' => true, 'test' => true], Hautelook\AliceBundle\HautelookAliceBundle::class => ['dev' => true, 'test' => true],

View File

@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
use PSC\Shop\EntityBundle\Document\RefreshToken;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('gesdinet_jwt_refresh_token', [
'manager_type' => 'mongodb',
'refresh_token_class' => RefreshToken::class,
]);
};

View File

@ -6,60 +6,55 @@ use PSC\Shop\EntityBundle\Document\Instance;
use PSC\Shop\EntityBundle\Entity\Contact; use PSC\Shop\EntityBundle\Entity\Contact;
use PSC\Shop\EntityBundle\Entity\Shop; use PSC\Shop\EntityBundle\Entity\Shop;
use PSC\Shop\UserBundle\Model\ApiUser; use PSC\Shop\UserBundle\Model\ApiUser;
use PSC\Shop\UserBundle\Security\ApiKeyAuthenticator;
use PSC\Shop\UserBundle\Security\ApiKeyExtractor;
use PSC\Shop\UserBundle\Security\ApiKeyHandler;
use PSC\Shop\UserBundle\Security\ApiKey\ApiKeyProvider; use PSC\Shop\UserBundle\Security\ApiKey\ApiKeyProvider;
use PSC\Shop\UserBundle\Security\ApiKey\InstanceProvider; use PSC\Shop\UserBundle\Security\ApiKey\InstanceProvider;
use PSC\Shop\UserBundle\Security\ApiKey\ShopProvider; use PSC\Shop\UserBundle\Security\ApiKey\ShopProvider;
use PSC\Shop\UserBundle\Security\ApiKeyAuthenticator;
use PSC\Shop\UserBundle\Security\ApiKeyExtractor;
use PSC\Shop\UserBundle\Security\ApiKeyHandler;
use PSC\Shop\UserBundle\Security\User\UserProvider; use PSC\Shop\UserBundle\Security\User\UserProvider;
use PSC\Shop\UserBundle\Security\ZendAuthenticator; use PSC\Shop\UserBundle\Security\ZendAuthenticator;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy; use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy;
return static function (ContainerConfigurator $containerConfigurator): void { return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension( $containerConfigurator->extension('security', [
'security',
[
'session_fixation_strategy' => SessionAuthenticationStrategy::NONE, 'session_fixation_strategy' => SessionAuthenticationStrategy::NONE,
'password_hashers' => 'password_hashers' => [
[ Contact::class => ['algorithm' => 'auto'],
Contact::class =>
['algorithm' => 'auto']
], ],
'role_hierarchy' => 'role_hierarchy' => [
[
'ROLE_SHOP' => 'ROLE_USER', 'ROLE_SHOP' => 'ROLE_USER',
'ROLE_PRODUCT_EDITOR' => ['ROLE_SHOP'], 'ROLE_PRODUCT_EDITOR' => ['ROLE_SHOP'],
'ROLE_SHOP_OPERATOR' => [ 'ROLE_SHOP_OPERATOR' => [
'ROLE_SHOP', 'ROLE_SHOP',
'ROLE_PRODUCTION', 'ROLE_PRODUCTION',
'ROLE_PRODUCT_EDITOR' 'ROLE_PRODUCT_EDITOR',
], ],
'ROLE_SHOP_ADMIN' => [ 'ROLE_SHOP_ADMIN' => [
'ROLE_SHOP', 'ROLE_SHOP',
'ROLE_SHOP_OPERATOR' 'ROLE_SHOP_OPERATOR',
], ],
'ROLE_ADMIN' => [ 'ROLE_ADMIN' => [
'ROLE_SHOP', 'ROLE_SHOP',
'ROLE_SHOP_OPERATOR', 'ROLE_SHOP_OPERATOR',
'ROLE_SHOP_ADMIN' 'ROLE_SHOP_ADMIN',
], ],
'ROLE_WAREHOUSE' => [ 'ROLE_WAREHOUSE' => [
'ROLE_USER', 'ROLE_USER',
'ROLE_ADMIN' 'ROLE_ADMIN',
], ],
'ROLE_PRODUCTION' => [ 'ROLE_PRODUCTION' => [
'ROLE_USER', 'ROLE_USER',
'ROLE_ADMIN', 'ROLE_ADMIN',
'ROLE_WAREHOUSE' 'ROLE_WAREHOUSE',
], ],
'ROLE_SUPER_SHOP' => [ 'ROLE_SUPER_SHOP' => [
'ROLE_USER', 'ROLE_USER',
'ROLE_SHOP', 'ROLE_SHOP',
'ROLE_ADMIN', 'ROLE_ADMIN',
'ROLE_PRODUCTION', 'ROLE_PRODUCTION',
'ROLE_WAREHOUSE' 'ROLE_WAREHOUSE',
], ],
'ROLE_SUPER_ADMIN' => [ 'ROLE_SUPER_ADMIN' => [
'ROLE_USER', 'ROLE_USER',
@ -68,11 +63,11 @@ return static function (ContainerConfigurator $containerConfigurator): void {
'ROLE_WAREHOUSE', 'ROLE_WAREHOUSE',
'ROLE_PRODUCTION', 'ROLE_PRODUCTION',
'ROLE_SUPER_SHOP', 'ROLE_SUPER_SHOP',
'ROLE_ALLOWED_TO_SWITCH' 'ROLE_ALLOWED_TO_SWITCH',
], ],
'ROLE_API' => [ 'ROLE_API' => [
'ROLE_SHOP' 'ROLE_SHOP',
] ],
], ],
'providers' => [ 'providers' => [
//'database' => ['entity' => ['class' => Contact::class]], //'database' => ['entity' => ['class' => Contact::class]],
@ -80,12 +75,10 @@ return static function (ContainerConfigurator $containerConfigurator): void {
'shop_provider' => ['id' => ShopProvider::class], 'shop_provider' => ['id' => ShopProvider::class],
'instance_provider' => ['id' => InstanceProvider::class], 'instance_provider' => ['id' => InstanceProvider::class],
'all' => [ 'all' => [
'chain' => 'chain' => [
[ 'providers' => ['user_provider', 'shop_provider', 'instance_provider'],
'providers' => ],
['user_provider', 'shop_provider', 'instance_provider'] ],
]
]
// 'database_token' => ['entity' => ['class' => Shop::class]], // 'database_token' => ['entity' => ['class' => Shop::class]],
// 'database_api_key' => ['entity' => ['class' => Instance::class]], // 'database_api_key' => ['entity' => ['class' => Instance::class]],
], ],
@ -103,13 +96,13 @@ return static function (ContainerConfigurator $containerConfigurator): void {
'enable_csrf' => true, 'enable_csrf' => true,
'default_target_path' => 'psc_backend_dashboard_index', 'default_target_path' => 'psc_backend_dashboard_index',
'username_parameter' => 'username', 'username_parameter' => 'username',
'password_parameter' => 'password' 'password_parameter' => 'password',
], ],
'logout' => [ 'logout' => [
'invalidate_session' => false, 'invalidate_session' => false,
'path' => 'psc_backend_logout', 'path' => 'psc_backend_logout',
'target' => 'psc_backend_login' 'target' => 'psc_backend_login',
] ],
], ],
'api_login' => [ 'api_login' => [
'pattern' => '/api/login', 'pattern' => '/api/login',
@ -118,22 +111,26 @@ return static function (ContainerConfigurator $containerConfigurator): void {
'json_login' => [ 'json_login' => [
'check_path' => '/api/login_check', 'check_path' => '/api/login_check',
'success_handler' => 'lexik_jwt_authentication.handler.authentication_success', 'success_handler' => 'lexik_jwt_authentication.handler.authentication_success',
'failure_handler' => 'lexik_jwt_authentication.handler.authentication_failure' 'failure_handler' => 'lexik_jwt_authentication.handler.authentication_failure',
] ],
], ],
'api' => [ 'api' => [
'pattern' => '^/api', 'pattern' => '^/api',
'stateless' => false, 'stateless' => false,
'provider' => 'all', 'provider' => 'all',
'entry_point' => 'jwt',
'jwt' => null, 'jwt' => null,
'refresh_jwt' => [
'check_path' => '/api/token/refresh',
],
'access_token' => [ 'access_token' => [
'token_handler' => ApiKeyHandler::class, 'token_handler' => ApiKeyHandler::class,
'token_extractors' => ApiKeyExtractor::class 'token_extractors' => ApiKeyExtractor::class,
], ],
'custom_authenticators' => [ 'custom_authenticators' => [
ApiKeyAuthenticator::class, ApiKeyAuthenticator::class,
ZendAuthenticator::class, ZendAuthenticator::class,
] ],
], ],
'storefront' => [ 'storefront' => [
'pattern' => '^/', 'pattern' => '^/',
@ -143,35 +140,34 @@ return static function (ContainerConfigurator $containerConfigurator): void {
'custom_authenticators' => [ 'custom_authenticators' => [
ApiKeyAuthenticator::class, ApiKeyAuthenticator::class,
ZendAuthenticator::class, ZendAuthenticator::class,
] ],
] ],
], ],
'access_control' => [ 'access_control' => [
[ [
'path' => '^/production', 'path' => '^/production',
'roles' => 'ROLE_SHOP' 'roles' => 'ROLE_SHOP',
], ],
[ [
'path' => '^/backend/login', 'path' => '^/backend/login',
'roles' => 'PUBLIC_ACCESS' 'roles' => 'PUBLIC_ACCESS',
], ],
[ [
'path' => '^/backend/order/detail/package/printpartner', 'path' => '^/backend/order/detail/package/printpartner',
'roles' => 'PUBLIC_ACCESS' 'roles' => 'PUBLIC_ACCESS',
], ],
[ [
'path' => '^/backend/order/detail/package/download', 'path' => '^/backend/order/detail/package/download',
'roles' => 'PUBLIC_ACCESS' 'roles' => 'PUBLIC_ACCESS',
], ],
[ [
'path' => '^/backend', 'path' => '^/backend',
'roles' => 'ROLE_SHOP' 'roles' => 'ROLE_SHOP',
], ],
[ [
'path' => '^/', 'path' => '^/',
'roles' => 'PUBLIC_ACCESS' 'roles' => 'PUBLIC_ACCESS',
] ],
] ],
] ]);
);
}; };

View File

@ -1,3 +1,6 @@
ux_autocomplete: ux_autocomplete:
resource: '@AutocompleteBundle/config/routes.php' resource: '@AutocompleteBundle/config/routes.php'
prefix: '/autocomplete' prefix: '/autocomplete'
api_refresh_token:
path: /api/token/refresh

View File

@ -2,7 +2,7 @@ PSC\Shop\EntityBundle\Entity\Install:
install_1: install_1:
# uid: 1 # uid: 1
colordb: "TEST" colordb: "TEST"
paperdb: > paperContainer: >
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Dokument: Papiercontainer --> <!-- Dokument: Papiercontainer -->
<container> <container>

View File

@ -0,0 +1,11 @@
<?php
namespace PSC\Shop\EntityBundle\Document;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
use Gesdinet\JWTRefreshTokenBundle\Document\RefreshToken as BaseRefreshToken;
#[ODM\Document(collection: 'refresh_tokens')]
class RefreshToken extends BaseRefreshToken
{
}

View File

@ -0,0 +1,27 @@
<?php
namespace PSC\Shop\MediaBundle\Api\Folder;
use OpenApi\Attributes\RequestBody;
use OpenApi\Attributes\Response;
use OpenApi\Attributes\Tag;
use PSC\Shop\MediaBundle\Dto\Folder\Input;
use PSC\Shop\MediaBundle\Model\Folder;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
class Add extends AbstractController
{
#[Response(response: 200, description: 'add Folder', ref: Folder::class)]
#[Route(path: '/folder/add', methods: ['POST'])]
#[Tag('Media')]
#[RequestBody(content: new Model(type: Input::class))]
#[ParamConverter('data', class: Input::class, converter: 'psc_rest.request_body')]
#[IsGranted('SHOP_ADMIN')]
public function add(Input $data)
{
return $this->json($data);
}
}

View File

@ -0,0 +1,11 @@
<?php
namespace PSC\Shop\MediaBundle\Dto\Folder;
use OpenApi\Attributes\Property;
final class Input
{
#[Property(type: 'string')]
public string $name;
}

View File

@ -0,0 +1,48 @@
<?php
namespace PSC\Shop\MediaBundle\Model;
use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA;
class Folder
{
#[OA\Property(type: 'string')]
private string $title = '';
#[OA\Property(type: 'string')]
private string $uuid = '';
#[OA\Property(type: 'array', items: new OA\Items(ref: new Model(type: Folder::class)))]
private array $subFolders = [];
public function getTitle(): string
{
return $this->title;
}
public function setTitle(string $title): void
{
$this->title = $title;
}
public function getUuid(): string
{
return $this->uuid;
}
public function setUuid(string $uuid): void
{
$this->uuid = $uuid;
}
public function getSubFolders(): array
{
return $this->subFolders;
}
public function setSubFolders(array $subFolders): void
{
$this->subFolders = $subFolders;
}
}

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Class QRImagick * Class QRImagick
* *
@ -61,7 +62,6 @@ class QRImagickCMYK extends QROutputAbstract
*/ */
public function __construct(SettingsContainerInterface $options, QRMatrix $matrix) public function __construct(SettingsContainerInterface $options, QRMatrix $matrix)
{ {
foreach (['fileinfo', 'imagick'] as $ext) { foreach (['fileinfo', 'imagick'] as $ext) {
if (!extension_loaded($ext)) { if (!extension_loaded($ext)) {
throw new QRCodeOutputException(sprintf('ext-%s not loaded', $ext)); // @codeCoverageIgnore throw new QRCodeOutputException(sprintf('ext-%s not loaded', $ext)); // @codeCoverageIgnore
@ -79,7 +79,6 @@ class QRImagickCMYK extends QROutputAbstract
*/ */
public static function moduleValueIsValid($value): bool public static function moduleValueIsValid($value): bool
{ {
if (!is_string($value)) { if (!is_string($value)) {
return false; return false;
} }
@ -91,7 +90,10 @@ class QRImagickCMYK extends QROutputAbstract
// #rrggbb(aa) // #rrggbb(aa)
// #rrrrggggbbbb(aaaa) // #rrrrggggbbbb(aaaa)
// ... // ...
if (preg_match('/^#[a-f\d]+$/i', $value) && in_array((strlen($value) - 1), [3, 4, 6, 8, 9, 12, 16, 24, 32], true)) { if (
preg_match('/^#[a-f\d]+$/i', $value) &&
in_array(strlen($value) - 1, [3, 4, 6, 8, 9, 12, 16, 24, 32], true)
) {
return true; return true;
} }
@ -123,7 +125,7 @@ class QRImagickCMYK extends QROutputAbstract
*/ */
protected function getDefaultModuleValue(bool $isDark): ImagickPixel protected function getDefaultModuleValue(bool $isDark): ImagickPixel
{ {
return $this->prepareModuleValue(($isDark) ? '#000' : '#fff'); return $this->prepareModuleValue($isDark ? '#000' : '#fff');
} }
/** /**
@ -131,7 +133,7 @@ class QRImagickCMYK extends QROutputAbstract
* *
* @return string|\Imagick * @return string|\Imagick
*/ */
public function dump(string $file = null) public function dump(null|string $file = null)
{ {
$this->setBgColor(); $this->setBgColor();
@ -153,7 +155,7 @@ class QRImagickCMYK extends QROutputAbstract
$this->saveToFile($imageData, $file); $this->saveToFile($imageData, $file);
if ($this->options->outputBase64) { if ($this->options->outputBase64) {
$imageData = $this->toBase64DataURI($imageData, (new finfo(FILEINFO_MIME_TYPE))->buffer($imageData)); $imageData = $this->toBase64DataURI($imageData, new finfo(FILEINFO_MIME_TYPE)->buffer($imageData));
} }
return $imageData; return $imageData;
@ -164,7 +166,6 @@ class QRImagickCMYK extends QROutputAbstract
*/ */
protected function setBgColor(): void protected function setBgColor(): void
{ {
if ($this::moduleValueIsValid($this->options->bgColor)) { if ($this::moduleValueIsValid($this->options->bgColor)) {
$this->backgroundColor = $this->prepareModuleValue($this->options->bgColor); $this->backgroundColor = $this->prepareModuleValue($this->options->bgColor);
@ -182,7 +183,7 @@ class QRImagickCMYK extends QROutputAbstract
$imagick = new Imagick(); $imagick = new Imagick();
[$width, $height] = $this->getOutputDimensions(); [$width, $height] = $this->getOutputDimensions();
$imagick->newImage($width, $height, $this->backgroundColor, $this->options->imagickFormat); $imagick->newImage($width, $height, 'none', $this->options->imagickFormat);
$imagick->setColorSpace(Imagick::COLORSPACE_CMYK); $imagick->setColorSpace(Imagick::COLORSPACE_CMYK);
if ($this->options->quality > -1) { if ($this->options->quality > -1) {
$imagick->setImageCompressionQuality(max(0, min(100, $this->options->quality))); $imagick->setImageCompressionQuality(max(0, min(100, $this->options->quality)));
@ -196,7 +197,6 @@ class QRImagickCMYK extends QROutputAbstract
*/ */
protected function setTransparencyColor(): void protected function setTransparencyColor(): void
{ {
if (!$this->options->imageTransparent) { if (!$this->options->imageTransparent) {
return; return;
} }
@ -232,7 +232,6 @@ class QRImagickCMYK extends QROutputAbstract
*/ */
protected function module(int $x, int $y, int $M_TYPE): void protected function module(int $x, int $y, int $M_TYPE): void
{ {
if (!$this->drawLightModules && !$this->matrix->isDark($M_TYPE)) { if (!$this->drawLightModules && !$this->matrix->isDark($M_TYPE)) {
return; return;
} }
@ -241,21 +240,20 @@ class QRImagickCMYK extends QROutputAbstract
if ($this->drawCircularModules && !$this->matrix->checkTypeIn($x, $y, $this->keepAsSquare)) { if ($this->drawCircularModules && !$this->matrix->checkTypeIn($x, $y, $this->keepAsSquare)) {
$this->imagickDraw->circle( $this->imagickDraw->circle(
(($x + 0.5) * $this->scale), ($x + 0.5) * $this->scale,
(($y + 0.5) * $this->scale), ($y + 0.5) * $this->scale,
(($x + 0.5 + $this->circleRadius) * $this->scale), ($x + 0.5 + $this->circleRadius) * $this->scale,
(($y + 0.5) * $this->scale) ($y + 0.5) * $this->scale,
); );
return; return;
} }
$this->imagickDraw->rectangle( $this->imagickDraw->rectangle(
($x * $this->scale), $x * $this->scale,
($y * $this->scale), $y * $this->scale,
((($x + 1) * $this->scale) - 1), (($x + 1) * $this->scale) - 1,
((($y + 1) * $this->scale) - 1) (($y + 1) * $this->scale) - 1,
); );
} }
} }

View File

@ -12,10 +12,10 @@ class Barcode extends Node
public function __construct( public function __construct(
Node $annotation, Node $annotation,
AbstractExpression $parameters = null, null|AbstractExpression $parameters = null,
Node $body, Node $body,
$lineno, $lineno,
$tag = null $tag = null,
) { ) {
$nodes = [ $nodes = [
'body' => $body, 'body' => $body,
@ -36,18 +36,53 @@ class Barcode extends Node
$compiler->raw('$_options = [];'); $compiler->raw('$_options = [];');
} }
$node = $this->getNode('body'); $node = $this->getNode('body');
$compiler->subcompile($node) $compiler->subcompile($node)->raw(PHP_EOL);
->raw(PHP_EOL); $compiler->raw('
$compiler->raw( if(isset($_options["svg"]) && $_options["svg"] == true) {
' $options = new chillerlan\QRCode\QROptions;
$options->outputType = \chillerlan\QRCode\Output\QROutputInterface::MARKUP_SVG;
$options->outputBase64 = true;
$options->drawLightModules = false;
$options->moduleValues = [
// finder
\chillerlan\QRCode\Data\QRMatrix::M_FINDER_DARK => $_options["finderdotdark"]?? [0, 0, 0],
\chillerlan\QRCode\Data\QRMatrix::M_FINDER_DOT => $_options["finderdot"]?? [0, 0, 0],
\chillerlan\QRCode\Data\QRMatrix::M_FINDER => $_options["bgcolor"]?? [255, 255, 255],
// alignment
\chillerlan\QRCode\Data\QRMatrix::M_ALIGNMENT_DARK => $_options["color"]?? [0, 0, 0],
\chillerlan\QRCode\Data\QRMatrix::M_ALIGNMENT => $_options["bgcolor"]?? [255, 255, 255],
// timing
\chillerlan\QRCode\Data\QRMatrix::M_TIMING_DARK => $_options["color"]?? [0, 0, 0],
\chillerlan\QRCode\Data\QRMatrix::M_TIMING => $_options["bgcolor"]?? [255, 255, 255],
// format
\chillerlan\QRCode\Data\QRMatrix::M_FORMAT_DARK => $_options["color"]?? [0, 0, 0],
\chillerlan\QRCode\Data\QRMatrix::M_FORMAT => $_options["bgcolor"]?? [255, 255, 255],
// version
\chillerlan\QRCode\Data\QRMatrix::M_VERSION_DARK => $_options["color"]?? [0, 0, 0],
\chillerlan\QRCode\Data\QRMatrix::M_VERSION => $_options["bgcolor"]?? [255, 255, 255],
// data
\chillerlan\QRCode\Data\QRMatrix::M_DATA_DARK => $_options["color"]?? [0, 0, 0],
\chillerlan\QRCode\Data\QRMatrix::M_DATA => $_options["bgcolor"]?? [255, 255, 255],
// darkmodule
\chillerlan\QRCode\Data\QRMatrix::M_DARKMODULE => $_options["color"]?? [0, 0, 0],
// separator
\chillerlan\QRCode\Data\QRMatrix::M_QUIETZONE => $_options["bgcolor"]?? [255, 255, 255],
\chillerlan\QRCode\Data\QRMatrix::M_SEPARATOR => $_options["bgcolor"]?? [255, 255, 255],
];
$str = "<img width=\"" . $_options["width"] . "\" src=\"" .
(new \chillerlan\QRCode\QRCode($options))->render(trim($context["barcode"])) . "\" />";
file_put_contents("/data/www/old/cache/test.svg", $str);
echo $str;
}elseif(isset($_options["cmyk"]) && $_options["cmyk"] == true) {
$options = new \PSC\System\SettingsBundle\Barcode\QRGdWithLogoOptions(); $options = new \PSC\System\SettingsBundle\Barcode\QRGdWithLogoOptions();
$options->version = -1; $options->version = -1;
$options->versionMax = 40; $options->versionMax = 40;
$options->eccLevel = \chillerlan\QRCode\Common\EccLevel::H; $options->eccLevel = \chillerlan\QRCode\Common\EccLevel::H;
$options->outputType = \chillerlan\QRCode\Output\QROutputInterface::CUSTOM; $options->outputType = \chillerlan\QRCode\Output\QROutputInterface::CUSTOM;
if(isset($_options["cmyk"]) && $_options["cmyk"] == true) {
$options->outputInterface = \PSC\System\SettingsBundle\Barcode\QRImagickCMYK::class; $options->outputInterface = \PSC\System\SettingsBundle\Barcode\QRImagickCMYK::class;
$options->imagickFormat = "jpeg"; $options->imagickFormat = "jpg";
$options->moduleValues = [ $options->moduleValues = [
// finder // finder
\chillerlan\QRCode\Data\QRMatrix::M_FINDER_DARK => $_options["finderdotdark"]?? [0, 0, 0], \chillerlan\QRCode\Data\QRMatrix::M_FINDER_DARK => $_options["finderdotdark"]?? [0, 0, 0],
@ -75,9 +110,14 @@ if(isset($_options["cmyk"]) && $_options["cmyk"] == true) {
\chillerlan\QRCode\Data\QRMatrix::M_SEPARATOR => $_options["bgcolor"]?? [255, 255, 255], \chillerlan\QRCode\Data\QRMatrix::M_SEPARATOR => $_options["bgcolor"]?? [255, 255, 255],
]; ];
$filename = md5(trim($context["barcode"])).".jpeg"; $filename = md5(trim($context["barcode"])).".jpeg";
(new \chillerlan\QRCode\QRCode($options))->render(trim($context["barcode"]), "/data/www/old/" . $filename); (new \chillerlan\QRCode\QRCode($options))->render(trim($context["barcode"]), "/data/www/old/cache/" . $filename);
echo "<img src=\"/data/www/old/$filename\" />"; echo "<img src=\"/data/www/old/cache/$filename\" />";
}else{ }else{
$options = new \PSC\System\SettingsBundle\Barcode\QRGdWithLogoOptions();
$options->version = -1;
$options->versionMax = 40;
$options->eccLevel = \chillerlan\QRCode\Common\EccLevel::H;
$options->outputType = \chillerlan\QRCode\Output\QROutputInterface::CUSTOM;
if(isset($_options["logo"]) && $_options["logo"] == true) { if(isset($_options["logo"]) && $_options["logo"] == true) {
$options->logo = $_options["logo"]; $options->logo = $_options["logo"];
if(isset($_options["melt"]) && $_options["melt"] == true) { if(isset($_options["melt"]) && $_options["melt"] == true) {
@ -143,8 +183,6 @@ if(isset($_options["cmyk"]) && $_options["cmyk"] == true) {
(new \chillerlan\QRCode\QRCode($options))->render(trim($context["barcode"]), "/tmp/" . $filename); (new \chillerlan\QRCode\QRCode($options))->render(trim($context["barcode"]), "/tmp/" . $filename);
echo "<img src=\"/tmp/$filename\" />"; echo "<img src=\"/tmp/$filename\" />";
} }
' ');
);
} }
} }

View File

@ -106,6 +106,15 @@
"gabrielbull/ups-api": { "gabrielbull/ups-api": {
"version": "dev-master" "version": "dev-master"
}, },
"gesdinet/jwt-refresh-token-bundle": {
"version": "1.5",
"recipe": {
"repo": "github.com/symfony/recipes-contrib",
"branch": "main",
"version": "1.0",
"ref": "2390b4ed5c195e0b3f6dea45221f3b7c0af523a0"
}
},
"gregwar/captcha-bundle": { "gregwar/captcha-bundle": {
"version": "v2.2.0" "version": "v2.2.0"
}, },

View File

@ -0,0 +1,36 @@
<?php
namespace App\Tests\PSC\Shop\Media\Api;
use PSC\Shop\ContactBundle\Repository\ContactRepository;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Tests\RefreshDatabaseTrait;
class FolderTest extends WebTestCase
{
use RefreshDatabaseTrait;
public function testCreateFolder(): void
{
$client = static::createClient();
$userRepository = static::getContainer()->get(ContactRepository::class);
$testUser = $userRepository->loadUserByUsername('admin@shop.de');
$client->loginUser($testUser, 'api');
$client->request(
'POST',
'/api/media/folder/create',
[
'name' => 'Test1',
],
[],
);
self::assertResponseIsSuccessful($client->getResponse());
$media = json_decode($client->getResponse()->getContent(), true);
}
}

View File

@ -21,7 +21,6 @@ class PaperDBTest extends WebTestCase
$client->jsonRequest('GET', '/api/system/papercontainer', [], []); $client->jsonRequest('GET', '/api/system/papercontainer', [], []);
$this->assertResponseIsSuccessful(); $this->assertResponseIsSuccessful();
var_dump($client->getResponse()->getContent());
self::assertJson($client->getResponse()->getContent()); self::assertJson($client->getResponse()->getContent());
} }
@ -33,9 +32,25 @@ class PaperDBTest extends WebTestCase
$client->loginUser($testUser, 'api'); $client->loginUser($testUser, 'api');
$client->jsonRequest('GET', '/api/system/papercontainer', [], []); $str = '<?xml version="1.0" encoding="UTF-8"?>
<!-- Dokument: Papiercontainer -->
<container>
<papiercontainer id="innen">
<papier id="ct120"/>
<papier id="ct220"/>
</papiercontainer>
</container>';
$client->jsonRequest('PUT', '/api/system/papercontainer', ['content' => $str], []);
$this->assertResponseIsSuccessful(); $this->assertResponseIsSuccessful();
self::assertJson($client->getResponse()->getContent()); self::assertJson($client->getResponse()->getContent());
$client->jsonRequest('GET', '/api/system/papercontainer', [], []);
$this->assertResponseIsSuccessful();
self::assertStringEqualsStringIgnoringLineEndings(
json_decode($client->getResponse()->getContent(), true)['content'],
$str,
);
} }
} }

View File

@ -0,0 +1,71 @@
<?php
namespace Plugins\System\PSC\XmlCalc\Api;
use PSC\Shop\ContactBundle\Repository\ContactRepository;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Tests\RefreshDatabaseTrait;
class UpdateProductTest extends WebTestCase
{
use RefreshDatabaseTrait;
public function testUpdateXml(): void
{
$client = static::createClient();
$userRepository = static::getContainer()->get(ContactRepository::class);
$testUser = $userRepository->loadUserByUsername('company@shop.de');
$client->loginUser($testUser, 'api');
$calcXml = '<?xml version="1.0" encoding="utf-8"?>
<kalkulation>
<artikel>
<name>SD-Durchschreibesätze A4-Blocks</name>
<kommentar>210 mm x 297 mm</kommentar>
<option id="auflage" name="Auflage" type="Input" default="10"/>
<option id="calc_rabatt" type="Hidden">
<contact.accountType default="1">
<grenze calc_value="1">0-1</grenze>
<grenze calc_value="0.8">2</grenze>
<grenze calc_value="0.5">3</grenze>
</contact.accountType>
</option>
<option id="calc_rabatt_account" type="Hidden">
<contact.account default="1">
<grenze calc_value="1">1</grenze>
<grenze calc_value="8">2</grenze>
<grenze calc_value="5">3</grenze>
</contact.account>
</option>
<option id="selectTest" name="selectTest" type="Select" default="1">
<opt id="1" name="eins"></opt>
<opt id="2" name="zwei"></opt>
</option>
<option id="calc" type="Hidden">
<auflage>
<grenze formel="0.26*$Vauflage$V">1-</grenze>
</auflage>
</option>
</artikel>
</kalkulation>';
$client->jsonRequest(
'PUT',
'/api/plugin/system/psc/xmlcalc/product/01938686-0e4d-7da9-bae3-b2e1b1681f9f',
[
'calcXml' => $calcXml,
],
[],
);
$this->assertResponseIsSuccessful();
self::assertJson($client->getResponse()->getContent());
}
}

View File

@ -23,20 +23,31 @@ use Symfony\Component\Serializer\SerializerInterface;
class Settings extends AbstractController class Settings extends AbstractController
{ {
public function __construct(
public function __construct(private EntityManagerInterface $entityManager, private DocumentManager $documentManager, private SerializerInterface $serializer) private EntityManagerInterface $entityManager,
{ private DocumentManager $documentManager,
} private SerializerInterface $serializer,
) {}
#[Route(path: '/settings/{uuid}', methods: ['GET'])] #[Route(path: '/settings/{uuid}', methods: ['GET'])]
#[Tag('Plugin/Custom/PSC/CollectLayouter')] #[Tag('Plugin/Custom/PSC/CollectLayouter')]
#[Response(response: 200, description: 'return settings', content: new JsonContent(ref: new Model(type: Setting::class)))] #[Response(
public function generatePreview(string $uuid = ""): JsonResponse { response: 200,
description: 'return settings',
content: new JsonContent(ref: new Model(type: Setting::class)),
)]
public function generatePreview(string $uuid = ''): JsonResponse
{
$product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $uuid]); $product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $uuid]);
$productDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)->findOneBy(['uid' => $product->getUID()]); $productDoc = $this->documentManager
$settings = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config')?? '{}', Setting::class, 'json'); ->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)
->findOneBy(['uid' => $product->getUID()]);
$settings = $this->serializer->deserialize(
$productDoc->getPluginSettingModule('collectlayouter', 'config') ?? '{}',
Setting::class,
'json',
);
return $this->json($settings); return $this->json($settings);
} }
@ -45,15 +56,26 @@ class Settings extends AbstractController
#[Tag('Plugin/Custom/PSC/CollectLayouter')] #[Tag('Plugin/Custom/PSC/CollectLayouter')]
#[ParamConverter('data', class: Setting::class, converter: 'psc_rest.request_body')] #[ParamConverter('data', class: Setting::class, converter: 'psc_rest.request_body')]
#[RequestBody(description: 'content', content: new JsonContent(ref: Setting::class))] #[RequestBody(description: 'content', content: new JsonContent(ref: Setting::class))]
#[Response(response: 200, description: 'return settings', content: new JsonContent(ref: new Model(type: Setting::class)))] #[Response(
public function save(string $uuid, Setting $data): JsonResponse { response: 200,
description: 'return settings',
content: new JsonContent(ref: new Model(type: Setting::class)),
)]
public function save(string $uuid, Setting $data): JsonResponse
{
$product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $uuid]); $product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $uuid]);
$productDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)->findOneBy(['uid' => $product->getUID()]); $productDoc = $this->documentManager
$settings = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config')?? '{}', Setting::class, 'json'); ->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)
->findOneBy(['uid' => $product->getUID()]);
$settings = $this->serializer->deserialize(
$productDoc->getPluginSettingModule('collectlayouter', 'config') ?? '{}',
Setting::class,
'json',
);
$data->setFonts($settings->getFonts()); $data->setFonts($settings->getFonts());
$data->setSpotColors($settings->getSpotColors());
$data->setCustomerForm($settings->getCustomerForm()); $data->setCustomerForm($settings->getCustomerForm());
$productDoc->setPluginSettingModule('collectlayouter', 'config', $this->serializer->serialize($data, 'json')); $productDoc->setPluginSettingModule('collectlayouter', 'config', $this->serializer->serialize($data, 'json'));
@ -62,5 +84,5 @@ class Settings extends AbstractController
return $this->json($data); return $this->json($data);
} }
} }

View File

@ -1,4 +1,5 @@
<?php <?php
namespace Plugin\Custom\PSC\CollectLayouter\Controller\Backend; namespace Plugin\Custom\PSC\CollectLayouter\Controller\Backend;
use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ODM\MongoDB\DocumentManager;
@ -17,55 +18,80 @@ use Symfony\Component\Serializer\SerializerInterface;
#[Route('/product')] #[Route('/product')]
class IndexController extends AbstractController class IndexController extends AbstractController
{ {
public function __construct(
public function __construct(private EntityManagerInterface $entityManager, private DocumentManager $documentManager, private SerializerInterface $serializer) private EntityManagerInterface $entityManager,
{ private DocumentManager $documentManager,
private SerializerInterface $serializer,
} ) {}
#[Template] #[Template]
#[Security("is_granted('ROLE_ADMIN')")] #[Security("is_granted('ROLE_ADMIN')")]
#[Route('/edit/{uuid}', defaults: ['uuid' => '', 'test' => false], name: 'psc_plugin_custom_collectlayouter_backend_index')] #[Route(
public function indexAction( '/edit/{uuid}',
Request $request, defaults: ['uuid' => '', 'test' => false],
JWTTokenManagerInterface $JWTTokenManager, name: 'psc_plugin_custom_collectlayouter_backend_index',
$uuid) )]
public function indexAction(Request $request, JWTTokenManagerInterface $JWTTokenManager, $uuid)
{ {
$product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $uuid]); $product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $uuid]);
$productDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)->findOneBy(['uid' => $product->getUID()]); $productDoc = $this->documentManager
->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)
->findOneBy(['uid' => $product->getUID()]);
$setting = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config')?? '{}', Setting::class, 'json'); $setting = $this->serializer->deserialize(
$productDoc->getPluginSettingModule('collectlayouter', 'config') ?? '{}',
Setting::class,
'json',
);
$formFonts = $this->createForm(\Plugin\Custom\PSC\CollectLayouter\Form\Fonts::class, $setting); $formFonts = $this->createForm(\Plugin\Custom\PSC\CollectLayouter\Form\Fonts::class, $setting);
$formFonts->handleRequest($request); $formFonts->handleRequest($request);
$formSpotColors = $this->createForm(\Plugin\Custom\PSC\CollectLayouter\Form\SpotColors::class, $setting);
$formSpotColors->handleRequest($request);
$formCustomer = $this->createForm(\Plugin\Custom\PSC\CollectLayouter\Form\CustomerForm::class, $setting); $formCustomer = $this->createForm(\Plugin\Custom\PSC\CollectLayouter\Form\CustomerForm::class, $setting);
$formCustomer->handleRequest($request); $formCustomer->handleRequest($request);
if ($formFonts->isSubmitted() && $formFonts->isValid()) { if ($formFonts->isSubmitted() && $formFonts->isValid()) {
$productDoc->setPluginSettingModule('collectlayouter', 'config', $this->serializer->serialize($setting, 'json')); $productDoc->setPluginSettingModule(
'collectlayouter',
'config',
$this->serializer->serialize($setting, 'json'),
);
$this->documentManager->persist($productDoc);
$this->documentManager->flush();
}
if ($formSpotColors->isSubmitted() && $formSpotColors->isValid()) {
$productDoc->setPluginSettingModule(
'collectlayouter',
'config',
$this->serializer->serialize($setting, 'json'),
);
$this->documentManager->persist($productDoc); $this->documentManager->persist($productDoc);
$this->documentManager->flush(); $this->documentManager->flush();
} }
if ($formCustomer->isSubmitted() && $formCustomer->isValid()) { if ($formCustomer->isSubmitted() && $formCustomer->isValid()) {
$productDoc->setPluginSettingModule('collectlayouter', 'config', $this->serializer->serialize($setting, 'json')); $productDoc->setPluginSettingModule(
'collectlayouter',
'config',
$this->serializer->serialize($setting, 'json'),
);
$this->documentManager->persist($productDoc); $this->documentManager->persist($productDoc);
$this->documentManager->flush(); $this->documentManager->flush();
} }
return array( return [
'customerForm' => $formCustomer->createView(), 'customerForm' => $formCustomer->createView(),
'fontsForm' => $formFonts->createView(), 'fontsForm' => $formFonts->createView(),
'spotColorsForm' => $formSpotColors->createView(),
'product' => $product, 'product' => $product,
'setting' => $setting, 'setting' => $setting,
'contactUuid' => $this->getUser()->getUuid(), 'contactUuid' => $this->getUser()->getUuid(),
'jwt' => $JWTTokenManager->create($this->getUser()) 'jwt' => $JWTTokenManager->create($this->getUser()),
); ];
} }
} }

View File

@ -0,0 +1,40 @@
<?php
namespace Plugin\Custom\PSC\CollectLayouter\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class SpotColor extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('name', TextType::class, [
'label' => 'Name',
]);
$builder->add('c', TextType::class, [
'label' => 'C',
]);
$builder->add('m', TextType::class, [
'label' => 'M',
]);
$builder->add('y', TextType::class, [
'label' => 'Y',
]);
$builder->add('k', TextType::class, [
'label' => 'K',
]);
return $builder;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => \Plugin\Custom\PSC\CollectLayouter\Model\SpotColor::class,
'allow_extra_fields' => true,
]);
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace Plugin\Custom\PSC\CollectLayouter\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\UX\LiveComponent\Form\Type\LiveCollectionType;
class SpotColors extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('spotColors', LiveCollectionType::class, [
'entry_type' => SpotColor::class,
'entry_options' => ['label' => false],
'label' => false,
'allow_add' => true,
'allow_delete' => true,
'by_reference' => true,
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => \Plugin\Custom\PSC\CollectLayouter\Model\Setting::class,
'allow_extra_fields' => true,
]);
}
}

View File

@ -11,53 +11,55 @@ use Twig\Environment;
class MPDF class MPDF
{ {
private ?\Mpdf\Mpdf $mpdf = null; private null|\Mpdf\Mpdf $mpdf = null;
private string $imageName; private string $imageName;
private string $pdfFile; private string $pdfFile;
private array $previewFiles; private array $previewFiles;
private Setting $setting; private Setting $setting;
private ?Contact $contact = null; private null|Contact $contact = null;
private array $data = []; private array $data = [];
public function __construct(private DocumentManager $documentManager, private Environment $twig) public function __construct(
{ private DocumentManager $documentManager,
private Environment $twig,
} ) {}
private function init(): void private function init(): void
{ {
$config = array_merge([
$config = array_merge(
[
'mode' => 'utf-8', 'mode' => 'utf-8',
'format' => [$this->setting->getSheetWidth(), $this->setting->getSheetHeight()], 'format' => [$this->setting->getSheetWidth(), $this->setting->getSheetHeight()],
'img_dpi' => 300, 'img_dpi' => 300,
'tempDir' => sys_get_temp_dir() 'tempDir' => sys_get_temp_dir(),
], ], $this->buildFontArray());
$this->buildFontArray()
);
$this->mpdf = new \Mpdf\Mpdf($config); $this->mpdf = new \Mpdf\Mpdf($config);
foreach ($this->setting->getSpotColors() as $spotColor) {
$this->mpdf->addSpotColor(
$spotColor->getName(),
$spotColor->getC(),
$spotColor->getM(),
$spotColor->getY(),
$spotColor->getK(),
);
}
$this->mpdf->PDFX = $this->setting->isPdfx(); $this->mpdf->PDFX = $this->setting->isPdfx();
$this->mpdf->PDFXauto = true; $this->mpdf->PDFXauto = true;
$this->mpdf->useKerning = true; $this->mpdf->useKerning = true;
$this->mpdf->SetDisplayMode('fullpage'); $this->mpdf->SetDisplayMode('fullpage');
$this->imageName = sys_get_temp_dir() . '/' . uniqid(); $this->imageName = sys_get_temp_dir() . '/' . uniqid();
$this->pdfFile = $this->imageName . ".pdf"; $this->pdfFile = $this->imageName . '.pdf';
$this->previewFiles = []; $this->previewFiles = [];
} }
public function clearTempFiles(): void public function clearTempFiles(): void
{ {
unlink($this->pdfFile); unlink($this->pdfFile);
array_walk( array_walk($this->previewFiles, function ($file) {
$this->previewFiles,
function ($file) {
unlink($file); unlink($file);
} });
);
$this->previewFiles = []; $this->previewFiles = [];
$this->pdfFile = ""; $this->pdfFile = '';
} }
private function buildPageCss(Setting $setting): string private function buildPageCss(Setting $setting): string
@ -68,35 +70,34 @@ class MPDF
return <<<EOD return <<<EOD
@page { @page {
margin: 0mm; margin: 0mm;
size: $width $height; size: {$width} {$height};
marks: NONE; marks: NONE;
} }
EOD; EOD;
} }
private function buildFontArray(): array private function buildFontArray(): array
{ {
$defaultConfig = (new \Mpdf\Config\ConfigVariables())->getDefaults(); $defaultConfig = new \Mpdf\Config\ConfigVariables()->getDefaults();
$fontDirs = $defaultConfig['fontDir']; $fontDirs = $defaultConfig['fontDir'];
$defaultFontConfig = (new \Mpdf\Config\FontVariables())->getDefaults(); $defaultFontConfig = new \Mpdf\Config\FontVariables()->getDefaults();
$fontData = $defaultFontConfig['fontdata']; $fontData = $defaultFontConfig['fontdata'];
$temp = [ $temp = [
'fontDir' => $fontDirs, 'fontDir' => $fontDirs,
'fontdata' => $fontData 'fontdata' => $fontData,
]; ];
foreach ($this->setting->getFonts() as $font) { foreach ($this->setting->getFonts() as $font) {
if ($font->getName() != "") { if ($font->getName() != '') {
if ($font->getFontR() != "") { if ($font->getFontR() != '') {
$media = $this->documentManager->getRepository(Media::class)->find(new ObjectId($font->getFontR())); $media = $this->documentManager->getRepository(Media::class)->find(new ObjectId($font->getFontR()));
if ($media) { if ($media) {
$filename = pathinfo('/data/www/new/web' . $media->getUrl()); $filename = pathinfo('/data/www/new/web' . $media->getUrl());
$temp['fontDir'][] = $filename['dirname']; $temp['fontDir'][] = $filename['dirname'];
$temp['fontdata'][$font->getName()] = [ $temp['fontdata'][$font->getName()] = [
'R' => $filename['basename'] 'R' => $filename['basename'],
]; ];
if ($font->getUseOtl() || $font->getUseOtl() === null) { if ($font->getUseOtl() || $font->getUseOtl() === null) {
$temp['fontdata'][$font->getName()]['useOTL'] = 0xFF; $temp['fontdata'][$font->getName()]['useOTL'] = 0xFF;
@ -126,12 +127,28 @@ EOD;
public function generate(bool $print = false): void public function generate(bool $print = false): void
{ {
$this->init(); $this->init();
if ($this->setting->getBackgroundFile() && ((!$print && $this->setting->isDisplayBackgroundInPreview()) || ($print && $this->setting->isDisplayBackgroundInPrint()))) { if (
$media = $this->documentManager->getRepository(Media::class)->find(new ObjectId($this->setting->getBackgroundFile())); $this->setting->getBackgroundFile() &&
(
!$print && $this->setting->isDisplayBackgroundInPreview() ||
$print && $this->setting->isDisplayBackgroundInPrint()
)
) {
$media = $this->documentManager
->getRepository(Media::class)
->find(new ObjectId($this->setting->getBackgroundFile()));
$this->mpdf->SetDocTemplate('/data/www/new/web' . $media->getUrl()); $this->mpdf->SetDocTemplate('/data/www/new/web' . $media->getUrl());
} }
if ($this->setting->getBackgroundFile2() && ((!$print && $this->setting->isDisplayBackgroundInPreview2()) || ($print && $this->setting->isDisplayBackgroundInPrint2()))) { if (
$media = $this->documentManager->getRepository(Media::class)->find(new ObjectId($this->setting->getBackgroundFile2())); $this->setting->getBackgroundFile2() &&
(
!$print && $this->setting->isDisplayBackgroundInPreview2() ||
$print && $this->setting->isDisplayBackgroundInPrint2()
)
) {
$media = $this->documentManager
->getRepository(Media::class)
->find(new ObjectId($this->setting->getBackgroundFile2()));
$this->mpdf->SetDocTemplate('/data/www/new/web' . $media->getUrl()); $this->mpdf->SetDocTemplate('/data/www/new/web' . $media->getUrl());
} }
@ -153,13 +170,13 @@ EOD;
$im->setCompressionQuality(98); $im->setCompressionQuality(98);
$im->SetColorspace(\Imagick::COLORSPACE_SRGB); $im->SetColorspace(\Imagick::COLORSPACE_SRGB);
$im->setResolution(300, 300); $im->setResolution(300, 300);
$im->readImage($this->pdfFile . "[" . $i . "]"); $im->readImage($this->pdfFile . '[' . $i . ']');
$im->thumbnailimage(800, 800, true); $im->thumbnailimage(800, 800, true);
$im->mergeImageLayers(\imagick::LAYERMETHOD_FLATTEN); $im->mergeImageLayers(\imagick::LAYERMETHOD_FLATTEN);
$im->setImageAlphaChannel(\imagick::ALPHACHANNEL_REMOVE); $im->setImageAlphaChannel(\imagick::ALPHACHANNEL_REMOVE);
$im->setImageFormat('jpg'); $im->setImageFormat('jpg');
$im->writeimage($this->imageName . '_' . $i . ".jpeg"); $im->writeimage($this->imageName . '_' . $i . '.jpeg');
$this->previewFiles[] = $this->imageName . '_' . $i . ".jpeg"; // base64_encode(file_get_contents()); $this->previewFiles[] = $this->imageName . '_' . $i . '.jpeg'; // base64_encode(file_get_contents());
} }
} }
@ -172,5 +189,4 @@ EOD;
{ {
return $this->pdfFile; return $this->pdfFile;
} }
} }

View File

@ -5,70 +5,70 @@ namespace Plugin\Custom\PSC\CollectLayouter\Model;
class Font class Font
{ {
public function __construct( public function __construct(
private ?string $name = "", private null|string $name = '',
private ?string $fontR = "", private null|string $fontR = '',
private ?string $fontB = "", private null|string $fontB = '',
private ?string $fontI = "", private null|string $fontI = '',
private ?string $fontBI = "", private null|string $fontBI = '',
private ?bool $useOtl = true private null|bool $useOtl = true,
) { ) {}
}
public function getName(): ?string public function getName(): null|string
{ {
return $this->name; return $this->name;
} }
public function setName(?string $name): void public function setName(null|string $name): void
{ {
$this->name = $name; $this->name = $name;
} }
public function getFontR(): ?string public function getFontR(): null|string
{ {
return $this->fontR; return $this->fontR;
} }
public function setFontR(?string $fontR): void public function setFontR(null|string $fontR): void
{ {
$this->fontR = $fontR; $this->fontR = $fontR;
} }
public function getFontB(): ?string public function getFontB(): null|string
{ {
return $this->fontB; return $this->fontB;
} }
public function setFontB(?string $fontB): void public function setFontB(null|string $fontB): void
{ {
$this->fontB = $fontB; $this->fontB = $fontB;
} }
public function getFontI(): ?string public function getFontI(): null|string
{ {
return $this->fontI; return $this->fontI;
} }
public function setFontI(?string $fontI): void public function setFontI(null|string $fontI): void
{ {
$this->fontI = $fontI; $this->fontI = $fontI;
} }
public function getFontBI(): ?string public function getFontBI(): null|string
{ {
return $this->fontBI; return $this->fontBI;
} }
public function setFontBI(?string $fontBI): void public function setFontBI(null|string $fontBI): void
{ {
$this->fontBI = $fontBI; $this->fontBI = $fontBI;
} }
public function getUseOtl(): ?bool public function getUseOtl(): null|bool
{ {
return $this->useOtl; return $this->useOtl;
} }
public function setUseOtl(?bool $useOtl): void
public function setUseOtl(null|bool $useOtl): void
{ {
$this->useOtl = $useOtl; $this->useOtl = $useOtl;
} }

View File

@ -4,6 +4,10 @@ namespace Plugin\Custom\PSC\CollectLayouter\Model;
class Setting class Setting
{ {
/**
* @var \Plugin\Custom\PSC\CollectLayouter\Model\SpotColor[]
*/
private array $spotColors = [];
/** /**
* @var \Plugin\Custom\PSC\CollectLayouter\Model\Font[] * @var \Plugin\Custom\PSC\CollectLayouter\Model\Font[]
*/ */
@ -17,12 +21,12 @@ class Setting
private int $sheetWidth = 0; private int $sheetWidth = 0;
private int $sheetHeight = 0; private int $sheetHeight = 0;
private bool $pdfx = true; private bool $pdfx = true;
private string $html = ""; private string $html = '';
private string $css = ""; private string $css = '';
private string $backgroundFile = ""; private string $backgroundFile = '';
private string $backgroundFile2 = ""; private string $backgroundFile2 = '';
private string $basketField1Format = ""; private string $basketField1Format = '';
private string $basketField2Format = ""; private string $basketField2Format = '';
private bool $displayBackgroundInPreview = true; private bool $displayBackgroundInPreview = true;
private bool $displayBackgroundInPreview2 = false; private bool $displayBackgroundInPreview2 = false;
private bool $displayBackgroundInPrint = true; private bool $displayBackgroundInPrint = true;
@ -130,6 +134,16 @@ class Setting
return $this; return $this;
} }
public function setSpotColors(array $colors): void
{
$this->spotColors = $colors;
}
public function getSpotColors(): array
{
return $this->spotColors;
}
public function setFonts(array $fonts): void public function setFonts(array $fonts): void
{ {
$this->fonts = $fonts; $this->fonts = $fonts;
@ -242,10 +256,8 @@ class Setting
public function getListSetting(): array public function getListSetting(): array
{ {
return array_filter( return array_filter($this->customerForm, function ($item) {
$this->customerForm, function ($item) {
return $item->getList(); return $item->getList();
} });
);
} }
} }

View File

@ -0,0 +1,64 @@
<?php
namespace Plugin\Custom\PSC\CollectLayouter\Model;
class SpotColor
{
public function __construct(
private null|string $name = '',
private null|string $c = '',
private null|string $m = '',
private null|string $y = '',
private null|string $k = '',
) {}
public function getName(): null|string
{
return $this->name;
}
public function setName(null|string $name): void
{
$this->name = $name;
}
public function getC(): null|string
{
return $this->c;
}
public function setC(null|string $value): void
{
$this->c = $value;
}
public function getM(): null|string
{
return $this->m;
}
public function setM(null|string $value): void
{
$this->m = $value;
}
public function getY(): null|string
{
return $this->y;
}
public function setY(null|string $value): void
{
$this->y = $value;
}
public function getK(): null|string
{
return $this->k;
}
public function setK(null|string $value): void
{
$this->k = $value;
}
}

View File

@ -56,6 +56,16 @@
aria-controls="fonts" aria-controls="fonts"
aria-selected="false">Fonts</button> aria-selected="false">Fonts</button>
</li> </li>
<li class="nav-item" role="presentation">
<button class="nav-link"
id="spots-tab"
data-bs-toggle="tab"
data-bs-target="#spots"
type="button"
role="tab"
aria-controls="spots"
aria-selected="false">Spot Colors</button>
</li>
</ul> </ul>
<div class="tab-content" id="myTabContent"> <div class="tab-content" id="myTabContent">
<div class="tab-pane active" <div class="tab-pane active"
@ -302,6 +312,15 @@
setting: setting setting: setting
}) }} }) }}
</div> </div>
<div class="tab-pane"
id="spots"
role="tabpanel"
aria-labelledby="spots-tab">
{{ component('SpotColorsForm', {
form: spotColorsForm,
setting: setting
}) }}
</div>
</div> </div>
</main> </main>
</div> </div>

View File

@ -0,0 +1,60 @@
{% form_theme form 'bootstrap_5_layout.html.twig' %}
<div
{{ attributes }}
>
{{ form_start(form) }}
<table class="table">
<thead>
<tr>
<td>Name</td>
<td>c</td>
<td>m</td>
<td>y</td>
<td>k</td>
<td></td>
</tr>
</thead>
<tbody>
{% for key, itemForm in form.spotColors %}
<tr>
<td>
{{ form_row(itemForm.name, {
label: false
}) }}
</td>
<td>
{{ form_row(itemForm.c, {
label: false
}) }}
</td>
<td>
{{ form_row(itemForm.m, {
label: false
}) }}
</td>
<td>
{{ form_row(itemForm.y, {
label: false
}) }}
</td>
<td>
{{ form_row(itemForm.k, {
label: false
}) }}
</td>
<td>
{{ form_row(itemForm.vars.button_delete, { label: 'X', attr: { class: 'btn btn-sm btn-danger' } }) }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<hr class="mb-3 mt-3"/>
{{ form_widget(form.spotColors.vars.button_add, { label: '+ Add Color', attr: { class: 'btn btn-sm btn-info' } }) }}
<div class="">
<button type="submit" class="btn btn-sm btn-success" formnovalidate>Save</button>
</div>
{{ form_row(form._token) }}
{{ form_end(form, {'render_rest' : false}) }}
</div>

View File

@ -0,0 +1,28 @@
<?php
namespace Plugin\Custom\PSC\CollectLayouter\Twig;
use Plugin\Custom\PSC\CollectLayouter\Form\SpotColors;
use Plugin\Custom\PSC\CollectLayouter\Model\Setting;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormInterface;
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
use Symfony\UX\LiveComponent\Attribute\LiveProp;
use Symfony\UX\LiveComponent\DefaultActionTrait;
use Symfony\UX\LiveComponent\LiveCollectionTrait;
#[AsLiveComponent(template: '@PluginCustomPSCCollectLayouter/components/SpotColorsForm.html.twig')]
class SpotColorsForm extends AbstractController
{
use DefaultActionTrait;
use LiveCollectionTrait;
#[LiveProp(fieldName: 'formValues', useSerializerForHydration: true)]
public Setting $setting;
protected function instantiateForm(): FormInterface
{
return $this->createForm(SpotColors::class, $this->setting);
}
}

View File

@ -2,6 +2,8 @@
namespace Plugin\Custom\PSC\FormBuilder\Controller\Backend; namespace Plugin\Custom\PSC\FormBuilder\Controller\Backend;
use Gesdinet\JWTRefreshTokenBundle\Generator\RefreshTokenGeneratorInterface;
use Gesdinet\JWTRefreshTokenBundle\Model\RefreshTokenManagerInterface;
use Lexik\Bundle\JWTAuthenticationBundle\Services\JWTTokenManagerInterface; use Lexik\Bundle\JWTAuthenticationBundle\Services\JWTTokenManagerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
@ -14,8 +16,17 @@ class ProductController extends AbstractController
#[Template] #[Template]
#[Security("is_granted('ROLE_USER')")] #[Security("is_granted('ROLE_USER')")]
#[Route(path: '/edit', name: 'psc_backend_invoice_index_create')] #[Route(path: '/edit', name: 'psc_backend_invoice_index_create')]
public function edit(JWTTokenManagerInterface $jwtManager) public function edit(
{ JWTTokenManagerInterface $jwtManager,
return ['jwt' => $jwtManager->create($this->getUser())]; RefreshTokenGeneratorInterface $refreshTokenGenerator,
RefreshTokenManagerInterface $refreshTokenManager,
) {
$refreshToken = $refreshTokenGenerator->createForUserWithTtl($this->getUser(), 2592000);
$refreshTokenManager->save($refreshToken);
return [
'jwt' => $jwtManager->create($this->getUser()),
'refresh_token' => $refreshToken,
];
} }
} }

View File

@ -5,6 +5,7 @@
"name": "my-vue-app", "name": "my-vue-app",
"dependencies": { "dependencies": {
"@codemirror/lang-json": "^6.0.2", "@codemirror/lang-json": "^6.0.2",
"@codemirror/lang-php": "^6.0.2",
"@codemirror/lang-xml": "^6.1.0", "@codemirror/lang-xml": "^6.1.0",
"@tailwindcss/vite": "^4.1.10", "@tailwindcss/vite": "^4.1.10",
"@vueuse/core": "^13.5.0", "@vueuse/core": "^13.5.0",
@ -23,7 +24,6 @@
"vue-codemirror": "^6.1.1", "vue-codemirror": "^6.1.1",
"vue-draggable-plus": "^0.6.0", "vue-draggable-plus": "^0.6.0",
"vue-i18n": "^11.1.9", "vue-i18n": "^11.1.9",
"xml-beautify": "^1.2.3",
"xml-formatter": "^3.6.6", "xml-formatter": "^3.6.6",
}, },
"devDependencies": { "devDependencies": {
@ -104,8 +104,16 @@
"@codemirror/commands": ["@codemirror/commands@6.8.1", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.4.0", "@codemirror/view": "^6.27.0", "@lezer/common": "^1.1.0" } }, "sha512-KlGVYufHMQzxbdQONiLyGQDUW0itrLZwq3CcY7xpv9ZLRHqzkBSoteocBHtMCoY7/Ci4xhzSrToIeLg7FxHuaw=="], "@codemirror/commands": ["@codemirror/commands@6.8.1", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.4.0", "@codemirror/view": "^6.27.0", "@lezer/common": "^1.1.0" } }, "sha512-KlGVYufHMQzxbdQONiLyGQDUW0itrLZwq3CcY7xpv9ZLRHqzkBSoteocBHtMCoY7/Ci4xhzSrToIeLg7FxHuaw=="],
"@codemirror/lang-css": ["@codemirror/lang-css@6.3.1", "", { "dependencies": { "@codemirror/autocomplete": "^6.0.0", "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", "@lezer/common": "^1.0.2", "@lezer/css": "^1.1.7" } }, "sha512-kr5fwBGiGtmz6l0LSJIbno9QrifNMUusivHbnA1H6Dmqy4HZFte3UAICix1VuKo0lMPKQr2rqB+0BkKi/S3Ejg=="],
"@codemirror/lang-html": ["@codemirror/lang-html@6.4.9", "", { "dependencies": { "@codemirror/autocomplete": "^6.0.0", "@codemirror/lang-css": "^6.0.0", "@codemirror/lang-javascript": "^6.0.0", "@codemirror/language": "^6.4.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.17.0", "@lezer/common": "^1.0.0", "@lezer/css": "^1.1.0", "@lezer/html": "^1.3.0" } }, "sha512-aQv37pIMSlueybId/2PVSP6NPnmurFDVmZwzc7jszd2KAF8qd4VBbvNYPXWQq90WIARjsdVkPbw29pszmHws3Q=="],
"@codemirror/lang-javascript": ["@codemirror/lang-javascript@6.2.4", "", { "dependencies": { "@codemirror/autocomplete": "^6.0.0", "@codemirror/language": "^6.6.0", "@codemirror/lint": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.17.0", "@lezer/common": "^1.0.0", "@lezer/javascript": "^1.0.0" } }, "sha512-0WVmhp1QOqZ4Rt6GlVGwKJN3KW7Xh4H2q8ZZNGZaP6lRdxXJzmjm4FqvmOojVj6khWJHIb9sp7U/72W7xQgqAA=="],
"@codemirror/lang-json": ["@codemirror/lang-json@6.0.2", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@lezer/json": "^1.0.0" } }, "sha512-x2OtO+AvwEHrEwR0FyyPtfDUiloG3rnVTSZV1W8UteaLL8/MajQd8DpvUb2YVzC+/T18aSDv0H9mu+xw0EStoQ=="], "@codemirror/lang-json": ["@codemirror/lang-json@6.0.2", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@lezer/json": "^1.0.0" } }, "sha512-x2OtO+AvwEHrEwR0FyyPtfDUiloG3rnVTSZV1W8UteaLL8/MajQd8DpvUb2YVzC+/T18aSDv0H9mu+xw0EStoQ=="],
"@codemirror/lang-php": ["@codemirror/lang-php@6.0.2", "", { "dependencies": { "@codemirror/lang-html": "^6.0.0", "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", "@lezer/common": "^1.0.0", "@lezer/php": "^1.0.0" } }, "sha512-ZKy2v1n8Fc8oEXj0Th0PUMXzQJ0AIR6TaZU+PbDHExFwdu+guzOA4jmCHS1Nz4vbFezwD7LyBdDnddSJeScMCA=="],
"@codemirror/lang-xml": ["@codemirror/lang-xml@6.1.0", "", { "dependencies": { "@codemirror/autocomplete": "^6.0.0", "@codemirror/language": "^6.4.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0", "@lezer/common": "^1.0.0", "@lezer/xml": "^1.0.0" } }, "sha512-3z0blhicHLfwi2UgkZYRPioSgVTo9PV5GP5ducFH6FaHy0IAJRg+ixj5gTR1gnT/glAIC8xv4w2VL1LoZfs+Jg=="], "@codemirror/lang-xml": ["@codemirror/lang-xml@6.1.0", "", { "dependencies": { "@codemirror/autocomplete": "^6.0.0", "@codemirror/language": "^6.4.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0", "@lezer/common": "^1.0.0", "@lezer/xml": "^1.0.0" } }, "sha512-3z0blhicHLfwi2UgkZYRPioSgVTo9PV5GP5ducFH6FaHy0IAJRg+ixj5gTR1gnT/glAIC8xv4w2VL1LoZfs+Jg=="],
"@codemirror/language": ["@codemirror/language@6.11.2", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.23.0", "@lezer/common": "^1.1.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0", "style-mod": "^4.0.0" } }, "sha512-p44TsNArL4IVXDTbapUmEkAlvWs2CFQbcfc0ymDsis1kH2wh0gcY96AS29c/vp2d0y2Tquk1EDSaawpzilUiAw=="], "@codemirror/language": ["@codemirror/language@6.11.2", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.23.0", "@lezer/common": "^1.1.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0", "style-mod": "^4.0.0" } }, "sha512-p44TsNArL4IVXDTbapUmEkAlvWs2CFQbcfc0ymDsis1kH2wh0gcY96AS29c/vp2d0y2Tquk1EDSaawpzilUiAw=="],
@ -200,12 +208,20 @@
"@lezer/common": ["@lezer/common@1.2.3", "", {}, "sha512-w7ojc8ejBqr2REPsWxJjrMFsA/ysDCFICn8zEOR9mrqzOu2amhITYuLD8ag6XZf0CFXDrhKqw7+tW8cX66NaDA=="], "@lezer/common": ["@lezer/common@1.2.3", "", {}, "sha512-w7ojc8ejBqr2REPsWxJjrMFsA/ysDCFICn8zEOR9mrqzOu2amhITYuLD8ag6XZf0CFXDrhKqw7+tW8cX66NaDA=="],
"@lezer/css": ["@lezer/css@1.3.0", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.3.0" } }, "sha512-pBL7hup88KbI7hXnZV3PQsn43DHy6TWyzuyk2AO9UyoXcDltvIdqWKE1dLL/45JVZ+YZkHe1WVHqO6wugZZWcw=="],
"@lezer/highlight": ["@lezer/highlight@1.2.1", "", { "dependencies": { "@lezer/common": "^1.0.0" } }, "sha512-Z5duk4RN/3zuVO7Jq0pGLJ3qynpxUVsh7IbUbGj88+uV2ApSAn6kWg2au3iJb+0Zi7kKtqffIESgNcRXWZWmSA=="], "@lezer/highlight": ["@lezer/highlight@1.2.1", "", { "dependencies": { "@lezer/common": "^1.0.0" } }, "sha512-Z5duk4RN/3zuVO7Jq0pGLJ3qynpxUVsh7IbUbGj88+uV2ApSAn6kWg2au3iJb+0Zi7kKtqffIESgNcRXWZWmSA=="],
"@lezer/html": ["@lezer/html@1.3.10", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0" } }, "sha512-dqpT8nISx/p9Do3AchvYGV3qYc4/rKr3IBZxlHmpIKam56P47RSHkSF5f13Vu9hebS1jM0HmtJIwLbWz1VIY6w=="],
"@lezer/javascript": ["@lezer/javascript@1.5.1", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.1.3", "@lezer/lr": "^1.3.0" } }, "sha512-ATOImjeVJuvgm3JQ/bpo2Tmv55HSScE2MTPnKRMRIPx2cLhHGyX2VnqpHhtIV1tVzIjZDbcWQm+NCTF40ggZVw=="],
"@lezer/json": ["@lezer/json@1.0.3", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0" } }, "sha512-BP9KzdF9Y35PDpv04r0VeSTKDeox5vVr3efE7eBbx3r4s3oNLfunchejZhjArmeieBH+nVOpgIiBJpEAv8ilqQ=="], "@lezer/json": ["@lezer/json@1.0.3", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0" } }, "sha512-BP9KzdF9Y35PDpv04r0VeSTKDeox5vVr3efE7eBbx3r4s3oNLfunchejZhjArmeieBH+nVOpgIiBJpEAv8ilqQ=="],
"@lezer/lr": ["@lezer/lr@1.4.2", "", { "dependencies": { "@lezer/common": "^1.0.0" } }, "sha512-pu0K1jCIdnQ12aWNaAVU5bzi7Bd1w54J3ECgANPmYLtQKP0HBj2cE/5coBD66MT10xbtIuUr7tg0Shbsvk0mDA=="], "@lezer/lr": ["@lezer/lr@1.4.2", "", { "dependencies": { "@lezer/common": "^1.0.0" } }, "sha512-pu0K1jCIdnQ12aWNaAVU5bzi7Bd1w54J3ECgANPmYLtQKP0HBj2cE/5coBD66MT10xbtIuUr7tg0Shbsvk0mDA=="],
"@lezer/php": ["@lezer/php@1.0.4", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.1.0" } }, "sha512-D2dJ0t8Z28/G1guztRczMFvPDUqzeMLSQbdWQmaiHV7urc8NlEOnjYk9UrZ531OcLiRxD4Ihcbv7AsDpNKDRaQ=="],
"@lezer/xml": ["@lezer/xml@1.0.6", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0" } }, "sha512-CdDwirL0OEaStFue/66ZmFSeppuL6Dwjlk8qk153mSQwiSH/Dlri4GNymrNWnUmPl2Um7QfV1FO9KFUyX3Twww=="], "@lezer/xml": ["@lezer/xml@1.0.6", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0" } }, "sha512-CdDwirL0OEaStFue/66ZmFSeppuL6Dwjlk8qk153mSQwiSH/Dlri4GNymrNWnUmPl2Um7QfV1FO9KFUyX3Twww=="],
"@marijn/find-cluster-break": ["@marijn/find-cluster-break@1.0.2", "", {}, "sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g=="], "@marijn/find-cluster-break": ["@marijn/find-cluster-break@1.0.2", "", {}, "sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g=="],
@ -630,8 +646,6 @@
"which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="], "which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="],
"xml-beautify": ["xml-beautify@1.2.3", "", {}, "sha512-VsYpkqoVawIP84pi00XukPsgQHqOhgrpwTHlXqqRMAgYZ1u+Yw3KHIUhO1Igf19d5CQ5h6ExJT1hFCJRLmzADg=="],
"xml-formatter": ["xml-formatter@3.6.6", "", { "dependencies": { "xml-parser-xo": "^4.1.4" } }, "sha512-yfofQht42x2sN1YThT6Er6GFXiQinfDAsMTNvMPi2uZw5/Vtc2PYHfvALR8U+b2oN2ekBxLd2tGWV06rAM8nQA=="], "xml-formatter": ["xml-formatter@3.6.6", "", { "dependencies": { "xml-parser-xo": "^4.1.4" } }, "sha512-yfofQht42x2sN1YThT6Er6GFXiQinfDAsMTNvMPi2uZw5/Vtc2PYHfvALR8U+b2oN2ekBxLd2tGWV06rAM8nQA=="],
"xml-parser-xo": ["xml-parser-xo@4.1.4", "", {}, "sha512-wo+yWDNeMwd1ctzH4CsiGXaAappDsxuR+VnmPewOzHk/zvefksT2ZlcWpAePl11THOWgnIZM4GjvumevurNWZw=="], "xml-parser-xo": ["xml-parser-xo@4.1.4", "", {}, "sha512-wo+yWDNeMwd1ctzH4CsiGXaAappDsxuR+VnmPewOzHk/zvefksT2ZlcWpAePl11THOWgnIZM4GjvumevurNWZw=="],

View File

@ -12,6 +12,7 @@
"dependencies": { "dependencies": {
"@codemirror/lang-json": "^6.0.2", "@codemirror/lang-json": "^6.0.2",
"@codemirror/lang-xml": "^6.1.0", "@codemirror/lang-xml": "^6.1.0",
"@codemirror/lang-php": "^6.0.2",
"@tailwindcss/vite": "^4.1.10", "@tailwindcss/vite": "^4.1.10",
"@vueuse/core": "^13.5.0", "@vueuse/core": "^13.5.0",
"class-variance-authority": "^0.7.1", "class-variance-authority": "^0.7.1",

View File

@ -1,17 +1,16 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from 'vue' import { ref, watch } from 'vue'
import { Codemirror } from 'vue-codemirror' import { Codemirror } from 'vue-codemirror'
import { xml } from '@codemirror/lang-xml' import { php } from '@codemirror/lang-php'
import { useGlobalStore } from '../../stores/Global' import { useGlobalStore } from '../../stores/Global'
import xmlFormat from 'xml-formatter'
import { debounce } from 'ts-debounce' import { debounce } from 'ts-debounce'
import { Button } from '../ui/button' import { Button } from '../ui/button'
const store = useGlobalStore(); const store = useGlobalStore();
const xmlString = ref(xmlFormat(store.formel)) const xmlString = ref(store.formulas)
const extensions = [xml()]; const extensions = [php({plain: true})];
const cmOptions = { const cmOptions = {
lineNumbers: true, lineNumbers: true,
@ -19,8 +18,8 @@ const cmOptions = {
theme: 'default', theme: 'default',
}; };
watch(xmlString, (formel) => { watch(xmlString, (formulas) => {
store.formel = formel store.formulas = formulas
}) })
function manualSync() { function manualSync() {

View File

@ -9,7 +9,7 @@ import { Button } from '../ui/button'
const store = useGlobalStore(); const store = useGlobalStore();
const xmlString = ref(xmlFormat(store.paperdb)) const xmlString = ref(xmlFormat(store.paperContainer))
const extensions = [xml()]; const extensions = [xml()];
@ -19,8 +19,8 @@ const cmOptions = {
theme: 'default', theme: 'default',
}; };
watch(xmlString, (paperdb) => { watch(xmlString, (paperContainer) => {
store.paperdb = paperdb store.paperContainer = paperContainer
}) })
function manualSync() { function manualSync() {

View File

@ -1,17 +1,16 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from 'vue' import { ref, watch } from 'vue'
import { Codemirror } from 'vue-codemirror' import { Codemirror } from 'vue-codemirror'
import { xml } from '@codemirror/lang-xml' import { php } from '@codemirror/lang-php'
import { useGlobalStore } from '../../stores/Global' import { useGlobalStore } from '../../stores/Global'
import xmlFormat from 'xml-formatter'
import { debounce } from 'ts-debounce' import { debounce } from 'ts-debounce'
import { Button } from '../ui/button' import { Button } from '../ui/button'
const store = useGlobalStore(); const store = useGlobalStore();
const xmlString = ref(xmlFormat(store.parameter)) const xmlString = ref(store.parameter)
const extensions = [xml()]; const extensions = [php({plain: true})];
const cmOptions = { const cmOptions = {
lineNumbers: true, lineNumbers: true,

View File

@ -7,7 +7,7 @@ const globalStore = useGlobalStore()
const itemStore = useItemStore() const itemStore = useItemStore()
function manualSave() { function manualSave() {
globalStore.manualSave(itemStore.loadJSON()) globalStore.manualSave()
} }
</script> </script>

View File

@ -3,6 +3,7 @@ import { useGlobalStore } from '../../../stores/Global'
import InputElement from '../../../model/InputElement' import InputElement from '../../../model/InputElement'
import SelectElement from '../../../model/SelectElement' import SelectElement from '../../../model/SelectElement'
import MediaElement from '../../../model/MediaElement' import MediaElement from '../../../model/MediaElement'
import FieldsetElement from '../../../model/FieldsetElement'
import HiddenElement from '../../../model/HiddenElement' import HiddenElement from '../../../model/HiddenElement'
import TextElement from '../../../model/TextElement' import TextElement from '../../../model/TextElement'
import Row from '../../../model/Row' import Row from '../../../model/Row'
@ -11,6 +12,7 @@ import HeadlineElement from '../../../model/HeadlineElement'
import InputElementProperties from '../properties/InputElement.vue' import InputElementProperties from '../properties/InputElement.vue'
import SelectElementProperties from '../properties/SelectElement.vue' import SelectElementProperties from '../properties/SelectElement.vue'
import MediaElementProperties from '../properties/MediaElement.vue' import MediaElementProperties from '../properties/MediaElement.vue'
import FieldsetElementProperties from '../properties/FieldsetElement.vue'
import HiddenElementProperties from '../properties/HiddenElement.vue' import HiddenElementProperties from '../properties/HiddenElement.vue'
import TextElementProperties from '../properties/TextElement.vue' import TextElementProperties from '../properties/TextElement.vue'
import TextareaElementProperties from '../properties/TextareaElement.vue' import TextareaElementProperties from '../properties/TextareaElement.vue'
@ -81,6 +83,12 @@ watch(openModal, (newOpenModal) => {
> >
</TextElementProperties> </TextElementProperties>
<FieldsetElementProperties
v-if="globalStore.getActiveItem.type === 12"
v-model="globalStore.getActiveItem as FieldsetElement"
>
</FieldsetElementProperties>
<SelectElementProperties <SelectElementProperties
v-if="globalStore.getActiveItem.type === 3" v-if="globalStore.getActiveItem.type === 3"
v-model="globalStore.getActiveItem as SelectElement" v-model="globalStore.getActiveItem as SelectElement"

View File

@ -1,3 +1,20 @@
<script lang="ts" setup>
import { BetweenVerticalStart } from 'lucide-vue-next';
import Row from '../../../model/Row';
import Column from '../../../model/Column';
interface Props {
row: Row
}
const props = defineProps<Props>()
function addColumn(row: Row) {
row.addColumnAtTheEnd(new Column())
}
</script>
<template> <template>
<div class="p-5 m-2 h-full text-center">Empty</div> <div @click="addColumn(props.row)" class="flex h-full justify-center">
<span class=" font-medium text-gray-900 bg-white dark:text-white dark:bg-gray-900 pointer-events-none"><BetweenVerticalStart /></span>
</div>
</template> </template>

View File

@ -0,0 +1,75 @@
<script lang="ts" setup>
import Fieldset from '../../../model/Fieldset';
import BaseElement from '../../../model/BaseElement';
import { ref, computed } from 'vue';
import EmptyElementForm from './EmptyElementForm.vue'
import { RenderElements } from './../renderelements'
import { useItemStore } from '../../../stores/Items'
import { useGlobalStore } from '../../../stores/Global'
import Parser from '../../../lib/parser'
import { CirclePlus } from 'lucide-vue-next';
interface Props {
modelValue: Fieldset
}
const props = defineProps<Props>()
let emit = defineEmits(['update:modelValue']);
const dragUuid = ref("");
let isPreview = ref(false)
const itemStore = useItemStore()
const globalStore = useGlobalStore()
const theModel = computed({
get: () => props.modelValue,
set: (value) => emit('update:modelValue', value),
});
const onDrop = (event: DragEvent, targetUuid: string, fieldset: Fieldset) => {
if(globalStore.getDragMode == "insert") {
const itemId = Number(event.dataTransfer?.getData('itemId'));
fieldset.items.push(Parser.getModelForType(itemId))
globalStore.setDragMode("")
event.stopImmediatePropagation()
}
}
const dragLeaveEmpty = (event: DragEvent, uuid: string) => {
dragUuid.value = ""
event.stopImmediatePropagation()
}
globalStore.$subscribe((mutation, state) => {
if(state.showPreview) {
isPreview.value = true
}else{
isPreview.value = false
}
})
const dragEnterEmpty = (event: DragEvent, uuid: string) => {
dragUuid.value = uuid
event.stopImmediatePropagation()
if(globalStore.getDragMode == "sort" && uuid != globalStore.getSourceDragUuid) {
event.stopImmediatePropagation()
}
}
</script>
<template>
<fieldset class="fieldset bg-base-200 border-base-300 rounded-box w-full border p-4">
<legend v-if="theModel!.name != ''" class="fieldset-legend">{{ theModel!.name}}</legend>
<div class="h-8 group items-center content-justify w-full mb-2" v-if="theModel!.items.length == 0" @drop="onDrop($event, theModel!.uuid, theModel!)" @dragleave="dragLeaveEmpty($event)" @dragenter="dragEnterEmpty($event)">
<div class="inline-flex items-center justify-center w-full pointer-events-none">
<hr class="w-64 h-px my-2 bg-gray-200 border-0 dark:bg-gray-700 transition duration-200 pointer-events-none" :class="{ 'bg-orange-500': dragUuid == theModel!.uuid }" >
<span class="absolute px-3 font-medium text-gray-900 bg-white dark:text-white dark:bg-gray-900 pointer-events-none"><CirclePlus :class="{ 'text-orange-500': dragUuid == theModel!.uuid }" class="transition duration-200 pointer-events-none" /></span>
</div>
</div>
<RenderElements
v-if="theModel!.items.length > 0"
v-bind:items="theModel!.items"/>
</fieldset>
</template>

View File

@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import MediaElement from '../../../model/MediaElement'; import { fetchMediaDirectories, uploadFile } from '../../../lib/api';
import { computed } from 'vue'; import { computed, onMounted, ref } from 'vue';
interface Props { interface Props {
modelValue: MediaElement modelValue: MediaElement
@ -14,11 +14,112 @@ const theModel = computed({
set: (value) => emit('update:modelValue', value), set: (value) => emit('update:modelValue', value),
}); });
const uploadProgress = ref(0);
const isDragging = ref(false);
const directories = ref<string[]>([]);
const selectedDirectory = ref<string>('');
const onDragOver = () => {
isDragging.value = true;
};
const onDragLeave = () => {
isDragging.value = false;
};
const onDrop = (event: DragEvent) => {
isDragging.value = false;
const files = event.dataTransfer?.files;
if (files && files.length > 0) {
handleFile(files[0]);
}
};
const onFileChange = (event: Event) => {
const target = event.target as HTMLInputElement;
const files = target.files;
if (files && files.length > 0) {
handleFile(files[0]);
}
};
onMounted(async () => {
try {
directories.value = await fetchMediaDirectories();
if (directories.value.length > 0) {
selectedDirectory.value = directories.value[0];
}
} catch (error) {
console.error('Failed to fetch directories', error);
}
});
const handleFile = async (file: File) => {
uploadProgress.value = 0;
try {
await uploadFile(file, (progress) => {
uploadProgress.value = progress;
});
console.log('Upload successful');
// Handle successful upload
} catch (error) {
console.error('Upload failed', error);
// Handle failed upload
} finally {
setTimeout(() => (uploadProgress.value = 0), 2000);
}
};
</script> </script>
<template> <template>
<div class="flex gap-2 flex-row"> <div class="flex gap-2 flex-row">
<label class="w-60 flex-inital">{{theModel.name}}</label> <label class="w-60 flex-inital">{{theModel.name}}</label>
<div
class="flex items-center justify-center w-full"
@dragover.prevent="onDragOver"
@dragleave.prevent="onDragLeave"
@drop.prevent="onDrop"
:class="{ 'border-blue-500': isDragging }"
>
<label
for="dropzone-file"
class="flex flex-col items-center justify-center w-full h-64 border-2 border-gray-300 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:hover:bg-bray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600"
>
<div class="flex flex-col items-center justify-center pt-5 pb-6">
<svg
class="w-8 h-8 mb-4 text-gray-500 dark:text-gray-400"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 20 16"
>
<path
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"
/>
</svg>
<p class="mb-2 text-sm text-gray-500 dark:text-gray-400">
<span class="font-semibold">Click to upload</span> or drag and drop
</p>
<p class="text-xs text-gray-500 dark:text-gray-400">
SVG, PNG, JPG or GIF (MAX. 800x400px)
</p>
</div>
<input id="dropzone-file" type="file" class="hidden" @change="onFileChange" />
</label>
</div>
<div class="flex items-center justify-center w-full">
<select v-model="selectedDirectory" class="w-full p-2 border rounded-md">
<option v-for="dir in directories" :key="dir" :value="dir">{{ dir }}</option>
</select>
</div>
<div v-if="uploadProgress > 0" class="w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700">
<div class="bg-blue-600 h-2.5 rounded-full" :style="{ width: uploadProgress + '%' }"></div>
</div>
</div> </div>
</template> </template>

View File

@ -8,7 +8,7 @@ import { RenderElements } from './../renderelements'
import { useItemStore } from '../../../stores/Items' import { useItemStore } from '../../../stores/Items'
import { useGlobalStore } from '../../../stores/Global' import { useGlobalStore } from '../../../stores/Global'
import Parser from '../../../lib/parser' import Parser from '../../../lib/parser'
import { CirclePlus } from 'lucide-vue-next'; import { Delete, BetweenVerticalStart, CirclePlus } from 'lucide-vue-next';
interface Props { interface Props {
modelValue: Row modelValue: Row
@ -68,13 +68,34 @@ const dragEnterEmpty = (event: DragEvent, uuid: string) => {
event.stopImmediatePropagation() event.stopImmediatePropagation()
} }
} }
const addColumn = (mode: int, model: Row, uuid: string) => {
if(mode == 1) {
model.addColumnAtTheBeginning(new Column());
}
if(mode == 2) {
model.addColumnAtTheEnd(new Column());
}
if(mode == 3) {
model.addColumnAt(new Column(), uuid);
}
}
const deleteColumn = (row: Row, targetUuid: string) => {
row.deleteColumnAt(targetUuid);
}
</script> </script>
<template> <template>
<div class="flex gap-2 flex-col"> <div class="flex gap-2 flex-col">
<div class="w-full flex flex-row gap-1" v-if="theModel!.columns.length > 0"> <div class="w-full flex flex-row gap-1 h-full" v-if="theModel!.columns.length > 0">
<div :class="{border: !isPreview}" class="flex-1 p-1 bg-white" v-for="col in theModel!.columns"> <div @click="addColumn(1, theModel!, '')" v-if="!isPreview" class="flex h-full justify-center place-self-center">
<div class="h-8 group items-center content-justify w-full mb-2" v-if="col.items.length == 0" @drop="onDrop($event, theModel!.uuid, col)" @dragleave="dragLeaveEmpty($event, col.uuid)" @dragenter="dragEnterEmpty($event, col.uuid)"> <span class=" font-medium text-gray-900 bg-white dark:text-white dark:bg-gray-900 pointer-events-none"><BetweenVerticalStart /></span>
</div>
<div class="flex w-full h-auto" v-for="col in theModel!.columns">
<div :class="{border: !isPreview}" class="flex-1 p-1 bg-white" >
<div class="h-8 group items-center content-justify w-full mb-2" v-if="!isPreview && col.items.length == 0" @drop="onDrop($event, theModel!.uuid, col)" @dragleave="dragLeaveEmpty($event, col.uuid)" @dragenter="dragEnterEmpty($event, col.uuid)">
<div class="inline-flex items-center justify-center w-full pointer-events-none"> <div class="inline-flex items-center justify-center w-full pointer-events-none">
<hr class="w-64 h-px my-2 bg-gray-200 border-0 dark:bg-gray-700 transition duration-200 pointer-events-none" :class="{ 'bg-orange-500': dragUuid == col.uuid }" > <hr class="w-64 h-px my-2 bg-gray-200 border-0 dark:bg-gray-700 transition duration-200 pointer-events-none" :class="{ 'bg-orange-500': dragUuid == col.uuid }" >
<span class="absolute px-3 font-medium text-gray-900 bg-white dark:text-white dark:bg-gray-900 pointer-events-none"><CirclePlus :class="{ 'text-orange-500': dragUuid == col.uuid }" class="transition duration-200 pointer-events-none" /></span> <span class="absolute px-3 font-medium text-gray-900 bg-white dark:text-white dark:bg-gray-900 pointer-events-none"><CirclePlus :class="{ 'text-orange-500': dragUuid == col.uuid }" class="transition duration-200 pointer-events-none" /></span>
@ -85,8 +106,16 @@ const dragEnterEmpty = (event: DragEvent, uuid: string) => {
v-if="col.items.length > 0" v-if="col.items.length > 0"
v-bind:items="col.items"/> v-bind:items="col.items"/>
</div> </div>
<div @click="deleteColumn(theModel!, col.uuid)" v-if="!isPreview" class="flex h-auto justify-center place-self-center">
<span class=" font-medium text-red-500 bg-white dark:text-white dark:bg-gray-900 pointer-events-none"><Delete /></span>
</div>
<div @click="addColumn(3, theModel!, col.uuid)" v-if="!isPreview" class="flex h-auto justify-center place-self-center">
<span class=" font-medium text-gray-900 bg-white dark:text-white dark:bg-gray-900 pointer-events-none"><BetweenVerticalStart /></span>
</div>
</div>
</div> </div>
<EmptyElementForm <EmptyElementForm
:row="theModel!"
v-if="theModel!.columns.length == 0"/> v-if="theModel!.columns.length == 0"/>
</div> </div>
</template> </template>

View File

@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { useGlobalStore } from '../../../stores/Global' import { useGlobalStore } from '../../../stores/Global'
import { Image, SquareParking, SquareDot, SquareMenu, SquarePen, SquareChevronDown, SquareDashed } from 'lucide-vue-next'; import { Image, Rows3, TableCellsMerge, SquareParking, SquareDot, SquareMenu, SquarePen, SquareChevronDown, SquareDashed } from 'lucide-vue-next';
import { Switch } from '../../../components/ui/switch' import { Switch } from '../../../components/ui/switch'
import { Label } from '../../../components/ui/label' import { Label } from '../../../components/ui/label'
import { ref, watch } from 'vue' import { ref, watch } from 'vue'
@ -52,6 +52,10 @@ watch(previewMode, (newPreviewMode) => {
<SquareParking /> <SquareParking />
<span>{{ $t('text') }}</span> <span>{{ $t('text') }}</span>
</div> </div>
<div id="fieldset" class="border-1 p-2 w-full flex flex-row gap-2" draggable="true" @dragstart="startDrag($event, '12')" @dragenter.prevent @dragover.prevent>
<Rows3 />
<span>{{ $t('fieldset') }}</span>
</div>
<div id="media" class="border-1 p-2 w-full flex flex-row gap-2" draggable="true" @dragstart="startDrag($event, '9')" @dragenter.prevent @dragover.prevent> <div id="media" class="border-1 p-2 w-full flex flex-row gap-2" draggable="true" @dragstart="startDrag($event, '9')" @dragenter.prevent @dragover.prevent>
<Image /> <Image />
<span>{{ $t('media') }}</span> <span>{{ $t('media') }}</span>
@ -73,7 +77,7 @@ watch(previewMode, (newPreviewMode) => {
<span>{{ $t('hidden') }}</span> <span>{{ $t('hidden') }}</span>
</div> </div>
<div id="row" class="border-1 p-2 w-full flex flex-row gap-2" draggable="true" @dragstart="startDrag($event, '7')" @dragenter.prevent @dragover.prevent> <div id="row" class="border-1 p-2 w-full flex flex-row gap-2" draggable="true" @dragstart="startDrag($event, '7')" @dragenter.prevent @dragover.prevent>
<SquareDashed /> <TableCellsMerge />
<span>{{ $t('row') }}</span> <span>{{ $t('row') }}</span>
</div> </div>
</div> </div>

View File

@ -0,0 +1,32 @@
<script lang="ts" setup>
import FieldsetElement from '../../../model/FieldsetElement';
import { computed } from 'vue';
import { Input } from '../../../components/ui/input'
import {
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectTrigger,
SelectValue,
} from '../../../components/ui/select'
const props = defineProps({
modelValue: FieldsetElement
})
let emit = defineEmits(['update:modelValue']);
const theModel = computed({
get: () => props.modelValue,
set: (value) => emit('update:modelValue', value),
});
</script>
<template>
<label>{{ $t('id') }}</label>
<Input v-model="theModel!.id" />
<label>{{ $t('name') }}</label>
<Input v-model="theModel!.name"/>
</template>

View File

@ -17,7 +17,7 @@ const theModel = computed({
function addColumn(row: Row) { function addColumn(row: Row) {
if(row !== null) { if(row !== null) {
row.addColumn(new Column()) row.addColumnAtTheEnd(new Column())
} }
} }

View File

@ -8,9 +8,11 @@ import MediaElementForm from '../elements/MediaElementForm.vue'
import TextareaElementForm from '../elements/TextareaElementForm.vue' import TextareaElementForm from '../elements/TextareaElementForm.vue'
import SelectElementForm from '../elements/SelectElementForm.vue' import SelectElementForm from '../elements/SelectElementForm.vue'
import RowElementForm from '../elements/RowElementForm.vue' import RowElementForm from '../elements/RowElementForm.vue'
import FieldsetElementForm from '../elements/FieldsetElementForm.vue'
import InputElement from '../../../model/InputElement' import InputElement from '../../../model/InputElement'
import HiddenElement from '../../../model/HiddenElement' import HiddenElement from '../../../model/HiddenElement'
import TextElement from '../../../model/TextElement' import TextElement from '../../../model/TextElement'
import FieldsetElement from '../../../model/FieldsetElement'
import TextareaElement from '../../../model/TextareaElement' import TextareaElement from '../../../model/TextareaElement'
import HeadlineElement from '../../../model/HeadlineElement' import HeadlineElement from '../../../model/HeadlineElement'
import MediaElement from '../../../model/MediaElement' import MediaElement from '../../../model/MediaElement'
@ -113,7 +115,7 @@ const editElementDependency = (item: BaseElement) => {
<span class="absolute px-3 font-medium text-gray-900 -translate-x-1/2 bg-white left-1/2 dark:text-white dark:bg-gray-900 pointer-events-none"><CirclePlus :class="{ 'text-orange-500': dragUuid == item.uuid }" class="transition duration-200 pointer-events-none" /></span> <span class="absolute px-3 font-medium text-gray-900 -translate-x-1/2 bg-white left-1/2 dark:text-white dark:bg-gray-900 pointer-events-none"><CirclePlus :class="{ 'text-orange-500': dragUuid == item.uuid }" class="transition duration-200 pointer-events-none" /></span>
</div> </div>
</div> </div>
<div :class="{ 'border-white' : !item.hasDependencys(), 'border-blue-500': item.hasDependencys() }" @dragstart="startDrag($event, item.uuid)" draggable="true" class="element w-full flex flex-row border-l-2 hover:border-orange-500 pl-2 transition duration-500 min-h-5" v-bind:class="{ ' bg-slate-50': item.isFocused === true }"> <div :class="{ 'border-white' : !item.hasDependencys() || isPreview, 'border-blue-500': item.hasDependencys() && !isPreview }" @dragstart="startDrag($event, item.uuid)" draggable="true" class="element w-full flex flex-row border-l-2 hover:border-orange-500 pl-2 transition duration-500 min-h-5" v-bind:class="{ ' bg-slate-50': item.isFocused === true }">
<div class="grow content-center items-center"> <div class="grow content-center items-center">
<InputElementForm <InputElementForm
v-if="item.type === 2" v-if="item.type === 2"
@ -139,6 +141,10 @@ const editElementDependency = (item: BaseElement) => {
v-if="item.type === 6" v-if="item.type === 6"
v-model="item as HeadlineElement" v-model="item as HeadlineElement"
/> />
<FieldsetElementForm
v-if="item.type === 12"
v-model="item as Fieldset"
/>
<RowElementForm <RowElementForm
v-if="item.type === 7" v-if="item.type === 7"
v-model="item as Row" v-model="item as Row"

View File

@ -42,5 +42,10 @@
"options": "Optionen", "options": "Optionen",
"settings": "Einstellungen", "settings": "Einstellungen",
"save": "Speichern", "save": "Speichern",
"saving": "Speichern..." "saving": "Speichern...",
"formel_view": "Formel Ansicht",
"parameter_view": "Parameter Ansicht",
"paperdb_view": "PapierDB Ansicht",
"syncing": "Synchronisiere...",
"sync": "Synchronisieren"
} }

View File

@ -42,5 +42,10 @@
"options": "Options", "options": "Options",
"settings": "Settings", "settings": "Settings",
"save": "Save", "save": "Save",
"saving": "Saving..." "saving": "Saving...",
"formel_view": "Formula View",
"parameter_view": "Parameter View",
"paperdb_view": "PaperDB View",
"syncing": "Syncing...",
"sync": "Sync"
} }

View File

@ -1,5 +1,6 @@
import ky from 'ky'; import ky from 'ky';
const api = ky.create({ const api = ky.create({
prefixUrl: '/apps', prefixUrl: '/apps',
headers: { headers: {
@ -7,15 +8,25 @@ const api = ky.create({
}, },
timeout: 10000, timeout: 10000,
hooks: { hooks: {
beforeRequest: [ afterResponse: [
request => { (_request, _options, response) => {
// Optional: Token aus Storage holen console.log(response);
const token = localStorage.getItem('token'); return response
if (token) {
request.headers.set('Authorization', `Bearer ${token}`);
}
}, },
],
// Or retry with a fresh token on a 403 error
async (request, options, response) => {
if (response.status === 403) {
// Get a fresh token
const token = await ky('https://example.com/token').text();
// Retry with the token
request.headers.set('Authorization', `token ${token}`);
return ky(request);
}
}
]
}, },
}); });
@ -60,6 +71,15 @@ export const saveXmlToApi = async (uuid: string, xml: string) => {
} }
} }
export const saveProductToApi = async (uuid: string, xml: string) => {
try {
const response = await api.put('api/plugin/system/psc/xmlcalc/product/' + uuid, { json: { calcXml: xml } });
return await response.json();
} catch (error) {
console.error('Error XML to PRODUCT API:', error);
throw error;
}
}
export const saveJsonToApi = async (uuid: string, json: string) => { export const saveJsonToApi = async (uuid: string, json: string) => {
try { try {
const response = await api.post('api/plugin/system/psc/xmlcalc/product/json', { json: { product: uuid, json: json } }); const response = await api.post('api/plugin/system/psc/xmlcalc/product/json', { json: { product: uuid, json: json } });
@ -69,5 +89,50 @@ export const saveJsonToApi = async (uuid: string, json: string) => {
throw error; throw error;
} }
}; };
export default api; export const saveFomulasAndParameterToApi = async (uuid: string, formulas: string, parameter: string) => {
try {
const response = await api.put('api/plugin/system/psc/xmlcalc/shop/' + uuid, { json: { formel: formulas, parameter: parameter } });
return await response.json();
} catch (error) {
console.error('Error saving design to API:', error);
throw error;
}
}
export const savePaperContainerToApi = async (uuid: string, paperContainer: string) => {
try {
const response = await api.put('api/system/papercontainer', { json: { content: paperContainer } });
return await response.json();
} catch (error) {
console.error('Error saving design to API:', error);
throw error;
}
}
export const uploadFile = async (file: File, onProgress: (progress: number) => void) => {
const formData = new FormData();
formData.append('file', file);
try {
const response = await api.post('api/plugin/media/upload', { // Changed to a more appropriate media upload endpoint
body: formData,
onDownloadProgress: (progress) => {
onProgress(Math.round(progress.percent * 100));
},
});
return await response.json();
} catch (error) {
console.error('Error uploading file:', error);
throw error;
}
};
export const fetchMediaDirectories = async () => {
try {
const response = await api.get('api/plugin/media/directories');
return await response.json();
} catch (error) {
console.error('Error fetching media directories:', error);
throw error;
}
};
export default api;

View File

@ -2,6 +2,7 @@ import type BaseElement from "../model/BaseElement"
import InputElement from "../model/InputElement" import InputElement from "../model/InputElement"
import Row from "../model/Row" import Row from "../model/Row"
import MediaElement from "../model/MediaElement" import MediaElement from "../model/MediaElement"
import FieldsetElement from "../model/FieldsetElement"
import Column from "../model/Column" import Column from "../model/Column"
import HiddenElement from "../model/HiddenElement" import HiddenElement from "../model/HiddenElement"
import SelectElement from "../model/SelectElement" import SelectElement from "../model/SelectElement"
@ -13,6 +14,8 @@ export default class Parser {
static getModelForType(type: Number): BaseElement { static getModelForType(type: Number): BaseElement {
switch (type) { switch (type) {
case 12:
return new FieldsetElement
case 9: case 9:
return new MediaElement return new MediaElement
case 8: case 8:

View File

@ -1,4 +1,5 @@
import BaseElement from "./BaseElement"; import BaseElement from "./BaseElement";
import Parser from '../lib/parser'
export default class Column extends BaseElement { export default class Column extends BaseElement {
items: BaseElement[] = [] items: BaseElement[] = []
@ -16,7 +17,7 @@ export default class Column extends BaseElement {
return Object.assign( return Object.assign(
super.toJSON(), super.toJSON(),
{ {
'items': this.items.reduce((result: object[], item: BaseElement) => { 'options': this.items.reduce((result: object[], item: BaseElement) => {
result.push(item.toJSON()) result.push(item.toJSON())
return result return result
}, []) }, [])
@ -25,10 +26,10 @@ export default class Column extends BaseElement {
fromJSON(obj: any) { fromJSON(obj: any) {
super.fromJSON(obj) super.fromJSON(obj)
obj.columns.map((d: any) => { obj.options.map((d: any) => {
const column = new Column() const item = Parser.getModelForType(d.type)
column.fromJSON(d) item.fromJSON(d)
this.items.push(column) this.items.push(item)
}) })
} }
@ -72,4 +73,5 @@ export default class Column extends BaseElement {
return true return true
} }
}) })
}} }
}

View File

@ -0,0 +1,79 @@
import BaseElement from "./BaseElement";
import Parser from '../lib/parser'
export default class FieldsetElement extends BaseElement {
items: BaseElement[] = []
label: string = ''
constructor() {
super()
this.type = 12
}
addItem(item: BaseElement) {
this.items.push(item)
}
public toJSON() {
return Object.assign(
super.toJSON(),
{
'label': this.label,
'options': this.items.reduce((result: object[], item: BaseElement) => {
result.push(item.toJSON())
return result
}, [])
})
}
fromJSON(obj: any) {
super.fromJSON(obj)
this.label = obj.label
obj.options.map((d: any) => {
const item = Parser.getModelForType(d.type)
item.fromJSON(d)
this.items.push(item)
})
}
cutItem(existingUuid: string) {
let item: BaseElement | null = null;
this.items.forEach((element: BaseElement, indexArray: number) => {
if (element.uuid === existingUuid) {
item = this.items.splice(indexArray, 1)[0]
return true
}
if (item === null) {
item = element.cutItem(existingUuid)
}
});
return item
}
insertItem(item: BaseElement, targetUuid: string): boolean {
let inserted = false;
for (let i = 0; i < this.items.length; ++i) {
if (this.items[i].uuid === targetUuid) {
this.items.splice(i, 0, item);
inserted = true;
return false
}
if (!inserted) {
this.items[i].insertItem(item, targetUuid)
}
}
return inserted
}
deleteItem(item: BaseElement): boolean {
return this.items.some((element: BaseElement, indexArray: number) => {
if (element.uuid === item.uuid) {
item = this.items.splice(indexArray, 1)[0]
return true
}
if (element.deleteItem(item)) {
return true
}
})
}
}

View File

@ -9,10 +9,39 @@ export default class Row extends BaseElement {
this.type = 7 this.type = 7
} }
addColumn(column: Column) { addColumnAtTheEnd(column: Column) {
this.columns.push(column) this.columns.push(column)
} }
addColumnAtTheBeginning(column: Column) {
this.columns.unshift(column)
}
deleteColumnAt(targetUuid: string): boolean {
return this.columns.some((element: BaseElement, indexArray: number) => {
if (element.uuid === targetUuid) {
this.columns.splice(indexArray, 1)[0]
return true
}
})
}
addColumnAt(item: Column, targetUuid: string): boolean {
let inserted = false;
for (let i = 0; i < this.columns.length; ++i) {
if (this.columns[i].uuid === targetUuid) {
this.columns.splice(i + 1, 0, item);
inserted = true;
return false
}
if (!inserted) {
this.columns[i].insertItem(item, targetUuid)
}
}
return inserted
}
public toJSON() { public toJSON() {
return Object.assign( return Object.assign(
super.toJSON(), super.toJSON(),

View File

@ -1,6 +1,6 @@
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import BaseElement from '../model/BaseElement' import BaseElement from '../model/BaseElement'
import { loadJsonFromApi, loadPriceFromApi, saveDesignToApi, saveJsonToApi, saveXmlToApi } from '../lib/api' import { saveProductToApi, saveFomulasAndParameterToApi, loadJsonFromApi, loadPriceFromApi, savePaperContainerToApi, saveDesignToApi, saveXmlToApi } from '../lib/api'
import { useItemStore } from './Items' import { useItemStore } from './Items'
export const useGlobalStore = defineStore('global', { export const useGlobalStore = defineStore('global', {
@ -18,9 +18,10 @@ export const useGlobalStore = defineStore('global', {
dragMode: "", dragMode: "",
json: "", json: "",
xml: "", xml: "",
formel: "", formulas: "",
paperdb: "", paperContainer: "",
parameter: "", parameter: "",
shopUuid: "",
saving: false, saving: false,
syncing: false, syncing: false,
currentTab: 'designer', currentTab: 'designer',
@ -40,11 +41,11 @@ export const useGlobalStore = defineStore('global', {
setXml(value: string) { setXml(value: string) {
this.xml = value this.xml = value
}, },
setFormel(value: string) { setFormulas(value: string) {
this.formel = value this.formulas = value
}, },
setPaperDB(value: string) { setPaperContainer(value: string) {
this.paperdb = value this.paperContainer = value
}, },
setParameter(value: string) { setParameter(value: string) {
this.parameter = value this.parameter = value
@ -80,6 +81,10 @@ export const useGlobalStore = defineStore('global', {
const data: any = await loadJsonFromApi(uuid) const data: any = await loadJsonFromApi(uuid)
this.json = data.json this.json = data.json
this.xml = data.xml this.xml = data.xml
this.parameter = data.parameter
this.formulas = data.formulas
this.paperContainer = data.paperContainer
this.shopUuid = data.shopUuid
return data.json; return data.json;
}, },
async loadFormulaAnalyserDataFromApi(uuid: string) { async loadFormulaAnalyserDataFromApi(uuid: string) {
@ -115,15 +120,9 @@ export const useGlobalStore = defineStore('global', {
this.formulaData = JSON.parse(result.jsonGraph); this.formulaData = JSON.parse(result.jsonGraph);
}) })
}, },
manualSave(json: object[]) { manualSave() {
this.saving = true this.saving = true
saveDesignToApi(this.productUuid, json).then((result: any) => { saveProductToApi(this.productUuid, this.xml).then((result: any) => {
this.setXML(result.xml)
this.setJSON(result.json)
this.formulaData = JSON.parse(result.jsonGraph);
const itemStore = useItemStore()
itemStore.parseJSON(result.json)
this.saving = false this.saving = false
}) })
}, },
@ -139,16 +138,19 @@ export const useGlobalStore = defineStore('global', {
itemStore.parseJSON(result.json) itemStore.parseJSON(result.json)
}) })
} }
if (this.currentTab == 'json') { if (this.currentTab == 'formulas' || this.currentTab == 'parameter') {
saveJsonToApi(this.productUuid, this.json).then((result: any) => { saveFomulasAndParameterToApi(this.shopUuid, this.formulas, this.parameter).then((result: any) => {
this.setXML(result.xml) this.loadConfigFromProductApi(this.productUuid)
this.setJSON(result.json)
this.formulaData = JSON.parse(result.jsonGraph);
this.syncing = false this.syncing = false
const itemStore = useItemStore()
itemStore.parseJSON(result.json)
}) })
} }
if (this.currentTab == 'paperdb') {
savePaperContainerToApi(this.shopUuid, this.paperContainer).then((result: any) => {
this.loadConfigFromProductApi(this.productUuid)
this.syncing = false
})
}
}, },
setCurrentTab(tab: string) { setCurrentTab(tab: string) {
this.currentTab = tab this.currentTab = tab

View File

@ -15,7 +15,7 @@ export default defineConfig({
} }
}, },
outDir: '../Resources/public/formbuilderts', outDir: '../Resources/public/formbuilderts',
emptyOutDir: true, // also necessary emptyOutDir: true,
}, },
resolve: { resolve: {
alias: { alias: {
@ -29,7 +29,7 @@ export default defineConfig({
changeOrigin: true, changeOrigin: true,
configure: (proxy) => { configure: (proxy) => {
proxy.on('proxyReq', (proxyReq) => { proxy.on('proxyReq', (proxyReq) => {
proxyReq.setHeader('Authorization', 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE3NTMxMDgzOTMsImV4cCI6MTc1MzExMTk5Mywicm9sZXMiOlsiUk9MRV9BRE1JTiIsIlJPTEVfU0hPUF9PUEVSQVRPUiIsIlJPTEVfVVNFUiIsIlJPTEVfVVNFUiIsIlJPTEVfUFNDX0NvbGxlY3RfQ29udGFjdF9FZGl0IiwiUk9MRV9QU0NfQ29sbGVjdF9Db250YWN0X0FkZCIsIlJPTEVfUFNDX0NvbGxlY3RfQ29udGFjdF9EZWxldGUiLCJST0xFX1BTQ19Db2xsZWN0X0NvbnRhY3RfTG9jayIsIlJPTEVfUFNDX1IyX1NlbmRjbG91ZF9TaG93Il0sInVpZCI6MX0.BsoNxbHgk_B-_72aYyItK199n1UoKkqhvMLRxNCMdLn18c4MDegZgpLB46kQ2kafNCoIvLEWzmTDBsFXTwRizUyyWWd6qORb6J2YNdM5t5r_qKEQKeaFDTkULGKmMwmu51MrleYr0lxbW18SqQKV2M88Y_qr-NvYeC-Pkwk3plqEw7qoaQQY9qQvRBfkXI90QBL5nFjgvearcdc2NMQJUWOTG9eUwz7LM-9R5CW9Wx8HUXWjM9prUiPgPrEf-amHq_gnCpqzpd8O6c2zRJ7U9nBQ9r0vI4bgFtPysKZ6QOB-ByW9oLs2Y70n0f22YNmox2SwVbMiAWMlMyGXb1TnpA'); proxyReq.setHeader('Authorization', 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE3NTM2ODg4MTksImV4cCI6MTc1MzY5MjQxOSwicm9sZXMiOlsiUk9MRV9BRE1JTiIsIlJPTEVfU0hPUF9PUEVSQVRPUiIsIlJPTEVfVVNFUiIsIlJPTEVfVVNFUiIsIlJPTEVfUFNDX0NvbGxlY3RfQ29udGFjdF9FZGl0IiwiUk9MRV9QU0NfQ29sbGVjdF9Db250YWN0X0FkZCIsIlJPTEVfUFNDX0NvbGxlY3RfQ29udGFjdF9EZWxldGUiLCJST0xFX1BTQ19Db2xsZWN0X0NvbnRhY3RfTG9jayIsIlJPTEVfUFNDX1IyX1NlbmRjbG91ZF9TaG93Il0sInVpZCI6MX0.j8BCuZxhIqw5G6TVgV9znMkZCF98T96rm6uYyj158-vZWykPbCyLtrNRk1wJXNA5gsGKUQYKffpqOlMFIkc9YlSKcYTSZjyablGlue34ELuoT7h4JXrKSD8SYBB99wphsV0aViAoyabn5L7QZLSzhwqZYxvJrmCW_KcrCcAr1Uy-AGYJNOE39bknwwNolRSPh2Gu5x2tE85LugazW0jo9ghWuPVOB35BB9NN1HHmjwzO4uinv8oorlGSWAsnLOOdjPAY7LjcoAY59v5r3U4FmMkHj5QfxxUsBaN_0ostJWxDfqr2cJqBEk-XimsaGQdyjuD6bintNO_N2m4DxuIjgw');
}); });
}, },
}, },

View File

@ -17,6 +17,7 @@
{% block javascripts %} {% block javascripts %}
<script> <script>
var jwt_token = '{{ jwt }}'; var jwt_token = '{{ jwt }}';
var refresh_token = '{{ refresh_token }}';
</script> </script>
<script src="/apps/bundles/plugincustompscformbuilder/formbuilderts/assets/index.js"></script> <script src="/apps/bundles/plugincustompscformbuilder/formbuilderts/assets/index.js"></script>
{% endblock %} {% endblock %}

View File

@ -89,6 +89,13 @@ class Config extends AbstractController
$engine->setActiveArticle($data->xmlProduct); $engine->setActiveArticle($data->xmlProduct);
} }
return $this->json(['json' => $engine->generateJson(), 'xml' => $engine->generateXML(true)]); return $this->json([
'json' => $engine->generateJson(),
'xml' => $engine->generateXML(true),
'parameter' => $engine->getParameters(),
'paperContainer' => $product->getShop()->getInstall()->getPaperContainer(),
'shopUuid' => $product->getShop()->getUid(),
'formulas' => $engine->getFormulas(),
]);
} }
} }

View File

@ -89,9 +89,13 @@ class Design extends AbstractController
return $this->json([ return $this->json([
'json' => $engine->generateJson(), 'json' => $engine->generateJson(),
'parameter' => $engine->getParameters(),
'paperContainer' => $product->getShop()->getInstall()->getPaperContainer(),
'formulas' => $engine->getFormulas(),
'xml' => $engine->generateXML(true), 'xml' => $engine->generateXML(true),
'jsonGraph' => $engine->getCalcGraph()->generateJsonGraph(), 'jsonGraph' => $engine->getCalcGraph()->generateJsonGraph(),
'price' => $engine->getPrice() * 100, 'price' => $engine->getPrice() * 100,
'shopUuid' => $product->getShop()->getUid(),
]); ]);
} }
} }

View File

@ -2,32 +2,22 @@
namespace Plugin\System\PSC\XmlCalc\Dto\Output\Price\Validation\Input; namespace Plugin\System\PSC\XmlCalc\Dto\Output\Price\Validation\Input;
use OpenApi\Attributes\Property;
use Plugin\System\PSC\XmlCalc\Dto\Output\Price\Validation\Error; use Plugin\System\PSC\XmlCalc\Dto\Output\Price\Validation\Error;
use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Annotations as OA;
class Min extends Error { class Min extends Error
{
/** #[Property(type: 'integer')]
* @var int
*
* @OA\Property(type="integer")
*/
public int $minValue = 0; public int $minValue = 0;
/** #[Property(type: 'integer')]
* @var int
*
* @OA\Property(type="integer")
*/
public int $currentValue = 0; public int $currentValue = 0;
public function __construct(int $currentValue, int $minValue) public function __construct(int $currentValue, int $minValue)
{ {
$this->currentValue = $currentValue; $this->currentValue = $currentValue;
$this->minValue = $minValue; $this->minValue = $minValue;
$this->message = "value must be greater then " . $this->minValue; $this->message = 'value must be greater then ' . $this->minValue;
$this->type = 'input::validation::min'; $this->type = 'input::validation::min';
} }
} }