<?php
namespace App\Controller\GestionComerciale;
use App\Entity\Adresses\Adresse;
use App\Entity\Articles\Article;
use App\Entity\Articles\ArticleCategorie;
use App\Entity\Articles\Categorie;
use App\Entity\Articles\ConditionAchat;
use App\Entity\Rangements\Caisse;
use App\Entity\Articles\ConditionnementAchat;
use App\Entity\Articles\ConditionVente;
use App\Entity\Clients\Client;
use App\Entity\FO\CompteBancaire;
use App\Entity\Fournisseurs\Fournisseur;
use App\Entity\GestionComerciale\Acompte;
use App\Entity\GestionComerciale\ArticleCommande;
use App\Entity\GestionComerciale\Commande;
use App\Entity\GestionComerciale\CommandeFournisseur;
use App\Entity\GestionComerciale\Fabrication;
use App\Entity\GestionComerciale\FabricationMultiple;
use App\Model\GestionCommerciale\TypeDocumentCommercial;
use App\Entity\Taxes\Taxe;
use App\Entity\Traductions\Traduction;
use App\Form\GestionComercialeBundle\CopiesLignesType;
use App\Service\Articles\ArticleService;
use App\Service\FO\DateService;
use App\Service\Fournisseurs\FournisseurService;
use App\Service\GestionComerciale\CommandeService;
use App\Service\GestionComerciale\FabricationService;
use App\Service\Utilisateur\ColonneTableauService;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormError;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Knp\Bundle\PaginatorBundle\Pagination\SlidingPagination;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
class ActionAjaxController extends AbstractController
{
/**
* @Route("/vente/commande/ajax/detail/{id}", name="dtc_commande_detail_ajax")
*/
public function detailCommandeAction(Request $request, Commande $commande,CommandeService $commandeService)
{
$get = $request->query->all();
$mode = "";
if ( ! empty($get["mode"])) {
$mode = $get["mode"];
}
if($commande->getOrigine() =="ERP" && $commande->getIdImport() > 0) {
//$this->commandeService->importDocumentsErp($client_tab["id"],["devis","commandes","bls","factures"],["id_doc_erp"=>359738],$cron);
$commandeService->importDocumentsErp($commande->getClient()->getId(),["devis","commandes","bls","factures"],["log"=>false,"id_doc_erp"=>$commande->getIdImport()],NULL);
}
$rendu = $this->renderView('GestionComerciale/Commande/detail_datatable.html.twig', ['commande' => $commande, "mode" => $mode]);
return new JsonResponse(['rendu' => $rendu]);
}
}