<?php /* Smarty version Smarty-3.1.7, created on 2013-01-24 22:16:00
         compiled from "C:\wamp\www\collab\activecollab\3.2.8\modules\invoicing\views\default\invoices\index.tpl" */ ?>
<?php /*%%SmartyHeaderCode:18055101b2a0abcaa1-27797794%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '03f61ddea8b488c7d837cfa4453cbf6d8ed3fa6f' => 
    array (
      0 => 'C:\\wamp\\www\\collab\\activecollab\\3.2.8\\modules\\invoicing\\views\\default\\invoices\\index.tpl',
      1 => 1357817598,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '18055101b2a0abcaa1-27797794',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'logged_user' => 0,
    'invoices' => 0,
    'companies_map' => 0,
    'invoice_states_map' => 0,
    'invoice_dates_map' => 0,
    'active_invoice' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.7',
  'unifunc' => 'content_5101b2a0ef997',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_5101b2a0ef997')) {function content_5101b2a0ef997($_smarty_tpl) {?><?php if (!is_callable('smarty_block_title')) include 'C:\\wamp\\www\\collab\\activecollab/3.2.8/angie/frameworks/environment/helpers\\block.title.php';
if (!is_callable('smarty_block_add_bread_crumb')) include 'C:\\wamp\\www\\collab\\activecollab/3.2.8/angie/frameworks/environment/helpers\\block.add_bread_crumb.php';
if (!is_callable('smarty_function_assemble')) include 'C:\\wamp\\www\\collab\\activecollab/3.2.8/angie/frameworks/environment/helpers\\function.assemble.php';
if (!is_callable('smarty_block_lang')) include 'C:\\wamp\\www\\collab\\activecollab/3.2.8/angie/frameworks/globalization/helpers\\block.lang.php';
if (!is_callable('smarty_function_image_url')) include 'C:\\wamp\\www\\collab\\activecollab/3.2.8/angie/frameworks/environment/helpers\\function.image_url.php';
if (!is_callable('smarty_function_select_project_category')) include 'C:\\wamp\\www\\collab\\activecollab/3.2.8/modules/system/helpers\\function.select_project_category.php';
if (!is_callable('smarty_function_select_company')) include 'C:\\wamp\\www\\collab\\activecollab/3.2.8/modules/system/helpers\\function.select_company.php';
if (!is_callable('smarty_function_select_project_label')) include 'C:\\wamp\\www\\collab\\activecollab/3.2.8/modules/system/helpers\\function.select_project_label.php';
if (!is_callable('smarty_modifier_json')) include 'C:\\wamp\\www\\collab\\activecollab/3.2.8/angie/frameworks/environment/helpers\\modifier.json.php';
?><?php $_smarty_tpl->smarty->_tag_stack[] = array('title', array()); $_block_repeat=true; echo smarty_block_title(array(), null, $_smarty_tpl, $_block_repeat);while ($_block_repeat) { ob_start();?>
Invoices<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_title(array(), $_block_content, $_smarty_tpl, $_block_repeat);  } array_pop($_smarty_tpl->smarty->_tag_stack);?>

<?php $_smarty_tpl->smarty->_tag_stack[] = array('add_bread_crumb', array()); $_block_repeat=true; echo smarty_block_add_bread_crumb(array(), null, $_smarty_tpl, $_block_repeat);while ($_block_repeat) { ob_start();?>
All Invoices<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_add_bread_crumb(array(), $_block_content, $_smarty_tpl, $_block_repeat);  } array_pop($_smarty_tpl->smarty->_tag_stack);?>

<!-- mass_edit_url="<?php echo smarty_function_assemble(array('route'=>'invoices'),$_smarty_tpl);?>
" -->

<div id="invoices">
	<div class="empty_content">
		<div class="objects_list_title"><?php $_smarty_tpl->smarty->_tag_stack[] = array('lang', array()); $_block_repeat=true; echo smarty_block_lang(array(), null, $_smarty_tpl, $_block_repeat);while ($_block_repeat) { ob_start();?>
Invoices<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_lang(array(), $_block_content, $_smarty_tpl, $_block_repeat);  } array_pop($_smarty_tpl->smarty->_tag_stack);?>
</div>
		<div class="objects_list_icon"><img src="<?php echo smarty_function_image_url(array('name'=>'icons/48x48/invoicing.png','module'=>'invoicing'),$_smarty_tpl);?>
" alt=""/></div>
		<div class="objects_list_details_actions">
        <ul>
            <li><a href="<?php echo smarty_function_assemble(array('route'=>'invoices_add'),$_smarty_tpl);?>
" id="new_invoice"><?php $_smarty_tpl->smarty->_tag_stack[] = array('lang', array()); $_block_repeat=true; echo smarty_block_lang(array(), null, $_smarty_tpl, $_block_repeat);while ($_block_repeat) { ob_start();?>
New Invoice<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_lang(array(), $_block_content, $_smarty_tpl, $_block_repeat);  } array_pop($_smarty_tpl->smarty->_tag_stack);?>
</a></li>
        </ul>
		</div>


		<div class="object_lists_details_tips">
		  <h3><?php $_smarty_tpl->smarty->_tag_stack[] = array('lang', array()); $_block_repeat=true; echo smarty_block_lang(array(), null, $_smarty_tpl, $_block_repeat);while ($_block_repeat) { ob_start();?>
Tips<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_lang(array(), $_block_content, $_smarty_tpl, $_block_repeat);  } array_pop($_smarty_tpl->smarty->_tag_stack);?>
:</h3>
		  <ul>
		    <li><?php $_smarty_tpl->smarty->_tag_stack[] = array('lang', array()); $_block_repeat=true; echo smarty_block_lang(array(), null, $_smarty_tpl, $_block_repeat);while ($_block_repeat) { ob_start();?>
To select a invoice and load its details, please click on it in the list on the left<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_lang(array(), $_block_content, $_smarty_tpl, $_block_repeat);  } array_pop($_smarty_tpl->smarty->_tag_stack);?>
</li>
		    <!--<li><?php $_smarty_tpl->smarty->_tag_stack[] = array('lang', array()); $_block_repeat=true; echo smarty_block_lang(array(), null, $_smarty_tpl, $_block_repeat);while ($_block_repeat) { ob_start();?>
It is possible to select multiple invoices at the same time. Just hold Ctrl key on your keyboard and click on all the invoices that you want to select<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_lang(array(), $_block_content, $_smarty_tpl, $_block_repeat);  } array_pop($_smarty_tpl->smarty->_tag_stack);?>
</li>-->
		  </ul>
		</div>
	</div>

<!--	<div class="multi_content">-->
<!--		<table>-->
<!--	    <tr>-->
<!--	      <td class="checkbox"><label><input type="checkbox" value="change_completed" /><?php $_smarty_tpl->smarty->_tag_stack[] = array('lang', array()); $_block_repeat=true; echo smarty_block_lang(array(), null, $_smarty_tpl, $_block_repeat);while ($_block_repeat) { ob_start();?>
Change Status<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_lang(array(), $_block_content, $_smarty_tpl, $_block_repeat);  } array_pop($_smarty_tpl->smarty->_tag_stack);?>
</label></td>-->
<!--	      <td class="new_value">-->
<!--	        <select name="is_completed">-->
<!--	          <option value="0"><?php $_smarty_tpl->smarty->_tag_stack[] = array('lang', array()); $_block_repeat=true; echo smarty_block_lang(array(), null, $_smarty_tpl, $_block_repeat);while ($_block_repeat) { ob_start();?>
Active<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_lang(array(), $_block_content, $_smarty_tpl, $_block_repeat);  } array_pop($_smarty_tpl->smarty->_tag_stack);?>
</option>-->
<!--	          <option value="1"><?php $_smarty_tpl->smarty->_tag_stack[] = array('lang', array()); $_block_repeat=true; echo smarty_block_lang(array(), null, $_smarty_tpl, $_block_repeat);while ($_block_repeat) { ob_start();?>
Completed<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_lang(array(), $_block_content, $_smarty_tpl, $_block_repeat);  } array_pop($_smarty_tpl->smarty->_tag_stack);?>
</option>-->
<!--	        </select>-->
<!--	      </td>-->
<!--	    </tr>-->
<!--	    <tr>-->
<!--	      <td class="checkbox"><label><input type="checkbox" value="change_category" /><?php $_smarty_tpl->smarty->_tag_stack[] = array('lang', array()); $_block_repeat=true; echo smarty_block_lang(array(), null, $_smarty_tpl, $_block_repeat);while ($_block_repeat) { ob_start();?>
Change Category<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_lang(array(), $_block_content, $_smarty_tpl, $_block_repeat);  } array_pop($_smarty_tpl->smarty->_tag_stack);?>
</label></td>-->
<!--	      <td class="new_value"><?php echo smarty_function_select_project_category(array('name'=>'category_id','user'=>$_smarty_tpl->tpl_vars['logged_user']->value,'id'=>"mass_edit_project_category",'on_new_category'=>'on_new_project_category'),$_smarty_tpl);?>
</td>-->
<!--	    </tr>-->
<!--	    <tr>-->
<!--      	<td class="checkbox"><label><input type="checkbox" value="change_client" /><?php $_smarty_tpl->smarty->_tag_stack[] = array('lang', array()); $_block_repeat=true; echo smarty_block_lang(array(), null, $_smarty_tpl, $_block_repeat);while ($_block_repeat) { ob_start();?>
Change Client<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_lang(array(), $_block_content, $_smarty_tpl, $_block_repeat);  } array_pop($_smarty_tpl->smarty->_tag_stack);?>
</label></td>-->
<!--		    <td class="new_value"><?php echo smarty_function_select_company(array('name'=>'company_id','user'=>$_smarty_tpl->tpl_vars['logged_user']->value,'optional'=>true,'can_create_new'=>false),$_smarty_tpl);?>
</td>-->
<!--		  </tr>-->
<!--	    <tr>-->
<!--      	<td class="checkbox"><label><input type="checkbox" value="change_label" /><?php $_smarty_tpl->smarty->_tag_stack[] = array('lang', array()); $_block_repeat=true; echo smarty_block_lang(array(), null, $_smarty_tpl, $_block_repeat);while ($_block_repeat) { ob_start();?>
Change Label<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_lang(array(), $_block_content, $_smarty_tpl, $_block_repeat);  } array_pop($_smarty_tpl->smarty->_tag_stack);?>
</label></td>-->
<!--		    <td class="new_value"><?php echo smarty_function_select_project_label(array('name'=>'label_id','optional'=>true,'user'=>$_smarty_tpl->tpl_vars['logged_user']->value,'can_create_new'=>false),$_smarty_tpl);?>
</td>-->
<!--		  </tr>-->
<!--		</table>-->
<!--	</div>-->
</div>

<script type="text/javascript">
  $('#new_invoice').flyoutForm({
    'success_event' : 'invoice_created',
    'title': App.lang('New Invoice')
  });
  
  $('#invoices').each(function() {
    var objects_list_wrapper = $(this);
    
    var items = <?php echo smarty_modifier_json($_smarty_tpl->tpl_vars['invoices']->value);?>
;
    var companies_map = <?php echo smarty_modifier_json($_smarty_tpl->tpl_vars['companies_map']->value);?>
;
    var states_map = <?php echo smarty_modifier_json($_smarty_tpl->tpl_vars['invoice_states_map']->value);?>
;
    var dates_map = <?php echo smarty_modifier_json($_smarty_tpl->tpl_vars['invoice_dates_map']->value);?>
;
    var mass_edit_url = '<?php echo smarty_function_assemble(array('route'=>'invoices'),$_smarty_tpl);?>
';
    var print_url = '<?php echo smarty_function_assemble(array('route'=>'invoices','print'=>1),$_smarty_tpl);?>
';

    objects_list_wrapper.objectsList({
      'id' : 'invoices',
      'items' : items,
      'objects_type' : 'invoices',
      'required_fields' : ['id', 'long_name', 'name', 'client_id', 'client_name', 'status', 'permalink'],
      'print_url' : print_url,
      'events' : App.standardObjectsListEvents(),
  		'multi_title' : App.lang(':num Invoices Selected'),
  		'multi_url' : mass_edit_url,
      'prepare_item' : function (item) {
          // update issued on grouping map
          if (item['issued_on_month'] && item['issued_on_month_verbose']) {
            var issued_on_grouping = objects_list_wrapper.objectsList('grouping_map_get', 'issued_on_month');
            if (!issued_on_grouping.map[item['issued_on_month']]) {
              var issued_on_grouping_map = issued_on_grouping.map;
              var new_issued_on_grouping_map = new Object();

              var inserted = false;
              $.each(issued_on_grouping_map, function (index, value) {
                if ((item['issued_on_month'] > index) && !inserted) {
                  new_issued_on_grouping_map[item['issued_on_month']] = item['issued_on_month_verbose'];
                  inserted = true;
                } // if
                new_issued_on_grouping_map[index] = value;
              });

              if (!inserted) {
                new_issued_on_grouping_map[item['issued_on_month']] = item['issued_on_month_verbose'];
              } // if

              objects_list_wrapper.objectsList('grouping_map_replace', 'issued_on_month', new_issued_on_grouping_map);
            } // if
          } // if

          // update due on grouping map
          if (item['due_on_month'] && item['due_on_month_verbose']) {
            var due_on_grouping = objects_list_wrapper.objectsList('grouping_map_get', 'due_on_month');
            if (!due_on_grouping.map[item['due_on_month']]) {
              var due_on_grouping_map = due_on_grouping.map;
              var new_due_on_grouping_map = new Object();

              var inserted = false;
              $.each(due_on_grouping_map, function (index, value) {
                if ((item['due_on_month'] > index) && !inserted) {
                  new_due_on_grouping_map[item['due_on_month']] = item['due_on_month_verbose'];
                  inserted = true;
                } // if
                new_due_on_grouping_map[index] = value;
              });

              if (!inserted) {
                new_due_on_grouping_map[item['due_on_month']] = item['due_on_month_verbose'];
              } // if

              objects_list_wrapper.objectsList('grouping_map_replace', 'due_on_month', new_due_on_grouping_map);
            } // if
          } // if

        return {
          'id' : item['id'],
  	  		'name' : item['short_name'],
  	  		'long_name' : item['name'],
  	  		'client_id' : item['client']['id'],
  	  		'client_name' : item['client']['name'],
          'issued_on_month' : item['issued_on_month'],
          'due_on_month' : item['due_on_month'],
  	  		'status' : item['status'],
  	  		'permalink' : item['urls']['view']
        };
      },

      'grouping' : [{ 
        'label' : App.lang("Don't group"), 
        'property' : '', 
        'icon' : App.Wireframe.Utils.imageUrl('objects-list/dont-group.png', 'environment')
      }, { 
        'label' : App.lang('By Client'), 
        'property' : 'client_id',  
        'map' : companies_map, 
        'icon' : App.Wireframe.Utils.imageUrl('objects-list/group-by-client.png', 'system') 
      }, { 
        'label' : App.lang('By Status'), 
        'property' : 'status', 
        'map' : states_map , 
        'default' : true, 
        'icon' : App.Wireframe.Utils.imageUrl('objects-list/group-by-status.png', 'environment')
      }, {
        'label' : App.lang('Issued On'),
        'property' : 'issued_on_month',
        'map' : dates_map.issued_on,
        'icon' : App.Wireframe.Utils.imageUrl('objects-list/group-by-status.png', 'environment'),
        'uncategorized_label' : App.lang('Not Issued')
      }, {
        'label' : App.lang('Payment Due On'),
        'property' : 'due_on_month',
        'map' : dates_map.due_on,
        'icon' : App.Wireframe.Utils.imageUrl('objects-list/group-by-status.png', 'environment'),
        'uncategorized_label' : App.lang('No Due Date')
      }],

      'filtering' : [{ 
        'label' : App.lang('Status'), 
        'property'  : 'status', 
        'values'  : [{ 
          'label' : App.lang('All Invoices'), 
          'value' : '', 
          'icon' : App.Wireframe.Utils.imageUrl('objects-list/all-invoices.png', 'invoicing') , 
          'default' : true, 
          'breadcrumbs' : App.lang('All Invoices')  
        }, { 
          'label' : App.lang('Drafts'), 
          'value' : '0', 
          'icon' : App.Wireframe.Utils.imageUrl('objects-list/draft-invoices.png', 'invoicing'), 
          'breadcrumbs' : App.lang('Drafts') 
        }, { 
          'label' : App.lang('Issued'), 
          'value' : '1', 
          'icon' : App.Wireframe.Utils.imageUrl('objects-list/issued-invoices.png', 'invoicing'), 
          'breadcrumbs' : App.lang('Issued')
        }, { 
          'label' : App.lang('Paid'),
          'value' : '2', 
          'icon' : App.Wireframe.Utils.imageUrl('objects-list/paid-invoices.png', 'invoicing'),
          'breadcrumbs' : App.lang('Paid')
        }, { 
          'label' : App.lang('Canceled'), 
          'value' : '3', 
          'icon' : App.Wireframe.Utils.imageUrl('objects-list/canceled-invoices.png', 'invoicing'), 
          'breadcrumbs' : App.lang('Canceled') 
        }]
      }]
    });

    // invoice added
    App.Wireframe.Events.bind('invoice_created.content', function (event, invoice) {
      objects_list_wrapper.objectsList('add_item', invoice);
    });

    // invoice updated
    App.Wireframe.Events.bind('invoice_updated.content invoice_issued.content invoice_canceled.content', function (event, invoice) {
      objects_list_wrapper.objectsList('update_item', invoice);
    });

    // invoice deleted
    App.Wireframe.Events.bind('invoice_deleted.content', function (event, invoice) {
      objects_list_wrapper.objectsList('delete_item', invoice['id']);
      objects_list_wrapper.objectsList('load_empty');
    });

    App.Wireframe.Events.bind('payment_updated.content payment_deleted.content', function (event, payment) {
      objects_list_wrapper.objectsList('update_item', payment['invoice']);
      $('#render_object_payments').paymentContainer('update_payment',payment);
      App.Wireframe.Events.trigger('invoice_updated', payment['invoice']);
    });

    App.Wireframe.Events.bind('payment_created.content', function (event, payment) {
      if(typeof(payment) == 'object') {
        objects_list_wrapper.objectsList('update_item', payment['invoice']);
        $('#render_object_payments').paymentContainer('add_payment',payment);
        App.Wireframe.Events.trigger('invoice_updated', payment['invoice']);
      } else {
        App.Wireframe.Flash.error(payment);
      }
    });


    // keep client_id map up to date
    App.objects_list_keep_companies_map_up_to_date(objects_list_wrapper, 'client_id', 'content');

	  <?php if ($_smarty_tpl->tpl_vars['active_invoice']->value->isLoaded()){?>
    objects_list_wrapper.objectsList('load_item', <?php echo clean($_smarty_tpl->tpl_vars['active_invoice']->value->getId(),$_smarty_tpl);?>
, <?php echo smarty_modifier_json($_smarty_tpl->tpl_vars['active_invoice']->value->getViewUrl());?>
); // Pre select item if this is permalink
	  <?php }?>
  });
</script><?php }} ?>