<?php

/*
 * PuzzleApp
 * Webemyos
 * Jérôme Oliva
 * GNU Licence
 */

namespace Apps\Crm\Module\DialogAdminCrm;

use Core\Control\Button\Button;
use Core\Controller\Controller;
use Core\View\View;

use Apps\Crm\Entity\CrmProspect;
use Apps\Crm\Widget\CrmProspectForm\CrmProspectForm;

/*
 * 
 */
 class DialogAdminCrmController extends Controller
 {
    /**
     * Constructeur
     */
    function _construct($core="")
    {
          $this->Core = $core;
    }

    /**
     * Create
     */
    function Create()
    {
    }

    /**
     * Init
     */
    function Init()
    {
    }

    /**
     * Render
     */
    function Show($all=true)
    {
         return $this->Index();
    }
    
    /*
    * Get the home page
    */
   function Index()
   {
       $view = new View(__DIR__."/View/index.tpl", $this->Core);
       return $view->Render();
   }

   /***
    * Edd/Edit a prospect
    */
   function AddProspect($prospectId){

        $prospectForm = new CrmProspectForm($this->Core);

        if($prospectId != ""){
            $prospect = new CrmProspect($this->Core);
            $prospect->GetById($prospectId);

            $prospectForm->Load($prospect);
        }

        return $prospectForm->Render();
   }
          
          /*action*/
 }?>