Commit fc6d146a authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Début de mise en place des assertions

parent 7705fad4
Loading
Loading
Loading
Loading
+60 −6
Original line number Diff line number Diff line
@@ -17,14 +17,68 @@ use Unicaen\OpenDocument\Calc;

<script>

    function ts()
    {
        unicaenVue.flashMessenger.toast('Mon message uh iuh iuhx iscuh sqidhf zihuf azif rhaoqh foaizuhf oqh foiazer hoiuzhq oiazuh oizhu iqduhf', 'success');

    function toast(message, severity) {
        const bgClasses = {
            info: 'bg-info',
            success: 'bg-success',
            warning: 'bg-warning',
            error: 'bg-danger'
        };
        const iconClasses = {
            info: 'info-circle',
            success: 'check-circle',
            warning: 'exclamation-circle',
            error: 'exclamation-triangle'
        };

        let toastContainer = document.getElementById('unicaen-vue-toast-container');
        if (!toastContainer) {
            toastContainer = document.createElement('div');
            toastContainer.id = 'unicaen-vue-toast-container';
            toastContainer.classList.add('toast-container', 'position-fixed', 'top-0', 'end-0', 'p-3');
            document.body.appendChild(toastContainer);
        }

        // Création de l'élément HTML pour le toast
        const toast = document.createElement('div');
        toast.classList.add('toast', 'show', 'text-white', bgClasses[severity] ? bgClasses[severity] : 'bg-secondary');
        toast.setAttribute('role', 'alert');
        toast.setAttribute('aria-live', 'assertive');
        toast.setAttribute('aria-atomic', 'true');

        if (severity === 'error'){
            toast.setAttribute('style', 'width:100%');
        }

    function te()
    {
        unicaenVue.flashMessenger.toast('Mon erreur', 'error');
        const toastContent =
            '<button class="btn-close btn-close-white h5" style="float:right" data-bs-dismiss="toast" aria-label="Close"></button>' +
            '<i class="icon fas fa-' + iconClasses[severity] + '" style="float: left;font-size: 26pt;padding-left: .4rem;margin-top:.4rem;padding-right: 1rem;"></i>' +
            '<div class="toast-body">' + message + '  </div>';


        toast.innerHTML = toastContent;

        // Ajout du toast à l'élément du conteneur de toasts
        toastContainer.appendChild(toast);

        // Affichage du toast
        //const bsToast = new bootstrap.Toast(toast);
        //bsToast.show();

        // Masquage du toast si ce n'est pas une erreur
        if (severity !== 'error') {
            // setTimeout(() => {
            //     toast.classList.remove('show');
            // }, 3000);
        }
    }

    $(() => {
        toast('mon success est phénoménal et j\'ai envie d\'en parler tout le temps mais ce serait bien trop long à expliquer et patati et patatta', 'success');
        toast('Et voici une info à ne pas rater!!', 'info');
        toast('Warning', 'warning');
        toast('Erreur magistrale!!!', 'error');
    });

</script>
+8 −8
Original line number Diff line number Diff line
@@ -7298,7 +7298,7 @@
            "source": {
                "type": "git",
                "url": "https://git.unicaen.fr/lib/unicaen/vue.git",
                "reference": "c3de98637d9f5654486e9cbb099f40dd0ccbe6fd"
                "reference": "d97686f3adfd79a11046229ea84f005ad6b35462"
            },
            "type": "library",
            "autoload": {
@@ -7310,7 +7310,7 @@
                ]
            },
            "description": "Module pour utiliser Vue.js",
            "time": "2023-04-05T13:52:02+00:00"
            "time": "2023-04-06T13:55:38+00:00"
        },
        {
            "name": "unicaen/zfc-user",
@@ -8292,16 +8292,16 @@
        },
        {
            "name": "phpstan/phpdoc-parser",
            "version": "1.17.1",
            "version": "1.18.0",
            "source": {
                "type": "git",
                "url": "https://github.com/phpstan/phpdoc-parser.git",
                "reference": "d3753fcb3abc6f78f5de6f72153d4b9c99c72dee"
                "reference": "882eabc9b6a12e25c27091a261397f9c8792e722"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/d3753fcb3abc6f78f5de6f72153d4b9c99c72dee",
                "reference": "d3753fcb3abc6f78f5de6f72153d4b9c99c72dee",
                "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/882eabc9b6a12e25c27091a261397f9c8792e722",
                "reference": "882eabc9b6a12e25c27091a261397f9c8792e722",
                "shasum": ""
            },
            "require": {
@@ -8331,9 +8331,9 @@
            "description": "PHPDoc parser with support for nullable, intersection and generic types",
            "support": {
                "issues": "https://github.com/phpstan/phpdoc-parser/issues",
                "source": "https://github.com/phpstan/phpdoc-parser/tree/1.17.1"
                "source": "https://github.com/phpstan/phpdoc-parser/tree/1.18.0"
            },
            "time": "2023-04-04T11:11:22+00:00"
            "time": "2023-04-06T07:26:43+00:00"
        },
        {
            "name": "sabre/event",
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ use UnicaenPrivilege\Assertion\AssertionFactory;

return [
    'services' => [
        Assertion\MissionAssertion::class => AssertionFactory::class,
        Assertion\WorkflowAssertion::class => AssertionFactory::class,
        Service\MissionService::class     => Service\MissionServiceFactory::class,
    ],
];
 No newline at end of file
+17 −2
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@ namespace Mission;
use Application\Entity\Db\WfEtape;
use Application\Provider\Privilege\Privileges;
use UnicaenPrivilege\Assertion\AssertionFactory;
use UnicaenPrivilege\Guard\PrivilegeController;


return [
@@ -112,7 +111,7 @@ return [
                    ],
                    'workflow-etape-code' => WfEtape::CODE_MISSION_SAISIE,
                    'withtarget' => true,
                    'visible'             => Assertion\MissionAssertion::class,
                    'visible' => Assertion\WorkflowAssertion::class,
                    'order' => 8,
                ],
            ],
@@ -126,4 +125,20 @@ return [
    'forms' => [
        Form\MissionForm::class => Form\MissionFormFactory::class,
    ],

    'rules' => [
        [
            'privileges' => [
                Privileges::MISSION_EDITION,
                Privileges::MISSION_VALIDATION,
                Privileges::MISSION_DEVALIDATION
            ],
            'resources' => 'Mission',
            'assertion' => Assertion\SaisieAssertion::class,
        ],
    ],

    'services' => [
        Assertion\SaisieAssertion::class => AssertionFactory::class,
    ],
];
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ return [
                    ],
                    'workflow-etape-code' => WfEtape::CODE_MISSION_SAISIE_REALISE,
                    'withtarget'          => true,
                    'visible'             => Assertion\MissionAssertion::class,
                    'visible'             => Assertion\WorkflowAssertion::class,
                    'order'               => 10,
                ],
            ],
Loading