<?php

namespace Modules\Additional\Specifique\Client114\Html;

use Skeleton\Router;

class LitigeFacture
{
    /** @var Router $router */
    // @phpstan-ignore-next-line
    private Router $router;
    
    public function __construct(Router $router)
    {
        $this->router = $router;
    }

    public function litigeSpecifique() : string
    {
        $html =
        "<script>
            function litigeSpec(numFact, type){
                if(type=='L'){
                    console.log('test spé');
                    $.ajax({
                        url : '".$this->router->generateUri('Specifique114.BapPartiel.bapPartiel')."',
                        type : 'POST',
                        dataType : 'html',
                        data: {'numFact' : numFact}, 
                        success : function(data){
                            desactivePopup();
                            desactiveLoader();
                            $(\"#modal-content\").addClass(\"modal_small\");
                            $(\"#modal-body\").html(data);
                            activePopup();
                        }
                    }); 
                }
                else{
                    reloadGestionFacture('".$this->router->generateUri('Facture.GestionFacture.index')."');
                }
            }
            </script>";
        return $html;
    }
}
