<?php

/*------------------------------------------------------------------------
# com_invoices - Invoice Manager for Joomla
# ------------------------------------------------------------------------
# author				Germinal Camps
# copyright 			Copyright (C) 2012 - 2016 JoomlaThat.com. All Rights Reserved.
# @license				http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: 			http://www.joomlathat.com
# Technical Support:	Forum - http://www.joomlathat.com/support
-------------------------------------------------------------------------*/

//no direct access
defined('_JEXEC') or die('Restricted access.');

jimport( 'joomla.application.component.view');
jimport( 'joomla.html.html');

class InvoicesViewInvoice extends JViewLegacy
{

	public $_path = array(
		'template' => array(),
		'helper' => array()
	);

	public $_layout = 'default';

	public $template = "";

	function display($tpl = null)
	{
		$mainframe = JFactory::getApplication();

		$pathway	= $mainframe->getPathway();
		$document	= JFactory::getDocument();
		$uri	= JFactory::getURI();

		$invoice		= $this->get( 'Data');
		$template		= $this->get( 'Template');
		$items		= $this->get( 'Items');
		$taxes		= $this->get( 'Taxes');
		$payments		= $this->get( 'Payments');
		$payments2		= $this->get( 'Payments2');

		$params = JComponentHelper::getParams( 'com_invoices' );

		$this->assignRef('invoice',		$invoice);
		$this->assignRef('template',		$template);
		$this->assignRef('items',		$items);
		$this->assignRef('taxes',		$taxes);
		$this->assignRef('payments',		$payments);
		$this->assignRef('payments2',		$payments2);
		$this->assignRef('params',		$params);

		if($invoice->id){

			$document->setTitle( JText::_('INVOICE'). " " . $invoice->invoice_num );

		}

		// if(JRequest::getVar('tmpl') == 'component'){
		if(false){
			$this->setLayout('component');
			$document->addStyleSheet("https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css");
			$document->addStyleSheet("administrator/components/com_invoices/assets/libs/bootstrap/css/bootstrap-glyphicons.css");
		}
		else{
	    //TODO: This solved a bug that don't load bootstrap on invoice modal. Maybe there is a better way to solve it
	    $document->addStyleSheet("media/jui/css/bootstrap.min.css");
		}

		parent::display($tpl);
	}

}
?>
