<?php echo $header; ?>
<section class="main-container gifts-list">

<?php echo $breadcrumbs; ?>
	<article class="col-main">

          <div class="page-title">
            <h2><?php echo $heading_title; ?></h2>
          </div>

          <ol class="one-page-checkout">
          	<li class="section allow active custom_lista_input_box">
          		<div id="content">

				<div>

				<table id="lista-desktop" class="table" style="width: 49% !important; float: left;">
				<tbody>
					<tr>
					<td width="80"><b><?php echo $column_lista;?></b></td>
					<td><?php echo $nome;?></td>
					</tr>
					<tr>
					<td><b><?php echo $column_categoria;?></b></td>
					<td><?php echo $categoria;?></td>
					</tr>
					<tr>
					<td><b><?php echo $column_data;?></b></td>
					<td><?php echo $evento;?></td>
					</tr>
					<tr>
					<td><b><?php echo $column_cliente;?></b></td>
					<td><?php echo $cliente;?></td>
					</tr>
					<tr>
					<td><b><?php echo $column_cep;?></b></td>
					<td><?php echo $cep;?></td>
					</tr>
				</tbody>
				</table>

				<table id="lista-desktop" class="table" style="width: 49% !important; float: right;">
				<tbody>
					<tr>
					<td width="80"><b><?php echo $column_logradouro;?></b></td>
					<td><?php echo $logradouro;?>, <?php echo $numero; ?></td>
					</tr>
					<tr>
					<td><b><?php echo $column_complemento;?></b></td>
					<td><?php echo $complemento;?></td>
					</tr>
					<tr>
					<td><b><?php echo $column_bairro;?></b></td>
					<td><?php echo $bairro;?></td>
					</tr>
					<tr>
					<td><b><?php echo $column_cidade;?></b></td>
					<td><?php echo $cidade;?></td>
					</tr>
					<tr>
					<td><b><?php echo $column_bairro;?></b></td>
					<td><?php echo $bairro;?></td>
					</tr>
				</tbody>
				</table>



				<table class="table produtos-lista table-action left-lista">
						  <thead>
                            		<tr>
                            			<th class="t-big"><?php echo $column_lista; ?></th>
                            			<th class="t-big"><?php echo $column_categoria; ?></th>
                            			<th class="t-big"><?php echo $column_data; ?></th>
                            			<th class="t-big"><?php echo $column_cliente; ?></th>
										<th class="t-big"><?php echo $column_cep; ?></th>

                            		</tr>
                           </thead>

						  <tbody>
                            		<tr>
                            			<td class="fix"></td>
                            			<td class="info_responsive"><b><?php echo $column_lista;?></b></td>
                            			<td><?php echo $nome; ?></td>
                            			<td class="info_responsive"><b><?php echo $column_categoria;?></b></td>
                            			<td><?php echo $categoria; ?></td>
                            			<td class="info_responsive"><b><?php echo $column_data;?></b></td>
                            			<td><?php echo $evento; ?></td>
                            			<td class="info_responsive"><b><?php echo $column_cliente;?></b></td>
                            			<td><?php echo $cliente; ?></td>
										<td class="info_responsive"><b><?php echo $column_cep;?></b></td>
                            			<td><?php echo $cep; ?></td>
										<td class="fix-margin"></td>
                            		</tr>
                            	</tbody>
						</table>
						</div>

						<div>
				<table class="table produtos-lista table-action right-lista">
						  <thead>
                            		<tr>
                            			<th class="t-big"><?php echo $column_logradouro; ?></th>
										<th class="t-big"><?php echo $column_numero; ?></th>
										<th class="t-big"><?php echo $column_bairro; ?></th>
										<th class="t-big"><?php echo $column_cidade; ?></th>
										<th class="t-big"><?php echo $column_estado; ?></th>
                            		</tr>
                           </thead>

						  <tbody>
                            		<tr>
                            			<td class="fix"></td>
                            			<td class="info_responsive"><b><?php echo $column_logradouro;?></b></td>
                            			<td><?php echo $logradouro; ?></td>
										<td class="info_responsive"><b><?php echo $column_numero;?></b></td>
                            			<td><?php echo $numero; ?></td>
										<td class="info_responsive"><b><?php echo $column_bairro;?></b></td>
                            			<td><?php echo $bairro; ?></td>
										<td class="info_responsive"><b><?php echo $column_cidade;?></b></td>
                            			<td><?php echo $cidade; ?></td>
										<td class="info_responsive"><b><?php echo $column_estado;?></b></td>
                            			<td><?php echo $estado; ?></td>
										<td class="fix-margin"></td>
                            		</tr>
                            	</tbody>
						</table>
						</div>

						<table class="table produtos-lista table-action">
						  <tbody>
							<tr>
							  <td><b><?php echo $column_google_maps; ?></b></td>
							</tr>
							<tr>
							  <td><div id="google_maps" style="width: 100%; height: 290px;">
                  <iframe src="https://www.google.com/maps?q=<?php echo $logradouro ?>,+<?php echo $numero ?>,+<?php echo $complemento ?>,+<?php echo str_replace("'", "", $cidade); ?>,+<?php echo $estado ?>&hl=es;z=14&output=embed" width='100%' height='290' frameborder='0' style='border:0' allowfullscreen></iframe>
                </div></td>
							</tr>
						  </tbody>
						</table>

                        <?php if($produtos && $this->config->get('futuralistapresente_Exibe_Totais')): ?>
                    	<div>
                        	<table class="table produtos-lista table-action">
                            	<thead>
                            		<tr>
                            			<th class="t-medium"><b><?php echo $entry_total_itens; ?></b></th>
                            			<th class="t-medium"><b><?php echo $entry_total_valor_itens; ?></b></th>
                            			<th class="t-medium"><b><?php echo $entry_total_itens_vendidos; ?></b></th>
                            			<th class="t-medium"><b><?php echo $entry_total_valor_itens_vendidos; ?></b></th>
                            		</tr>
                            	</thead>

                            	<tbody>
                            		<tr>
                            			<td class="fix"></td>
                            			<td class="info_responsive"><b><?php echo $entry_total_itens;?></b></td>
                            			<td><?php echo $totalProdutosEstoque; ?></td>
                            			<td class="info_responsive"><b><?php echo $entry_total_valor_itens;?></b></td>
                            			<td><?php echo $valor_total_lista; ?></td>
                            			<td class="info_responsive"><b><?php echo $entry_total_itens_vendidos;?></b></td>
                            			<td><?php echo $totalProdutosComprados; ?></td>
                            			<td class="info_responsive"><b><?php echo $entry_total_valor_itens_vendidos;?></b></td>
                            			<td><?php echo $valor_total_pedido; ?></td>
						<td class="fix-margin"></td>
                            		</tr>
                            	</tbody>
                        	</table>
                    	</div>
                        <?php endif; ?>

                        <div class="page-title">
                             <h1><?php echo $title_presentes; ?></h1>
                        </div>
                    	<table class="table table-action lista-presente">
                    	  <thead>
                    		<tr>
                    		  <th><?php echo $column_prod_img; ?></th>
                    		  <th><?php echo $column_prod_nome; ?></th>
                              <?php if($this->config->get('futuralistapresente_Exibe_Coluna_Estoque_Vendido')): ?>
                    		  <th><?php echo $column_prod_qtde_estoque; ?></th>
                    		  <th><?php echo $column_prod_qtde_comprado; ?></th>
                    		  <?php endif; ?>
                    		  <th><?php echo $column_prod_qtde; ?></th>
                    		  <th><?php echo $column_prod_valor; ?></th>
                    		  <th><?php echo $column_prod_opcao; ?></th>
                    		</tr>
                    	  </thead>

                    	  <tbody>
                            <?php if($produtos) { ?>
                            <?php $cont = 1; ?>
                    		<?php foreach($produtos as $produto){ ?>
                            <tr class="itemlista<?php echo $produto['item']?>">
                    				<td class="fix"></td>
                                    <td class="center_image"><img src="<?php echo $produto['imagem']?>"/></td>

                                    <td class="info_responsive"><b><?php echo $column_prod_nome;?></b></td>
                    				<td class="clearfix">
                              <a
                                href="<?php  echo $produto['href']; ?>"
                                class="border_none"
                              >
                                <?php  echo $produto['nome']; ?>

                                <?php if ($produto['itens_kit']) { ?>
                                  <?php foreach ($produto['itens_kit'] as $itemKit) { ?>
                                    <small class="visible-block text-gray">
                                      <?php echo $itemKit['quantidade']; ?> - <?php echo $itemKit['descricao']; ?>
                                    </small>
                                  <?php } ?>
                                <?php } ?>

                                <?php if(($this->config->get('futuragrade_status'))){ ?>
                                  <?php if(isset($produto['color_description'])){ ?>
                                    <br/><small>Cor: <?php echo $produto['color_description']; ?></small><br>
                                  <?php } ?>

                                  <?php if(isset($produto['size_description'])){ ?>
                                    <small>Tam.: <?php echo $produto['size_description']; ?></small> <br>
                                  <?php } ?>

                                  <?php if(isset($produto['specification_description'])){ ?>
                                    <small><?php echo $futuragrade_abrev_title_specification; ?> <?php echo $produto['specification_description']; ?></small> <br>
                                  <?php } ?>
                                <?php } ?>

                              </a>
                    				</td>
                                    <?php if($this->config->get('futuralistapresente_Exibe_Coluna_Estoque_Vendido')): ?>
                                    <td class="info_responsive"><b><?php echo $column_prod_qtde_estoque; ?></b></td>
                    				<td><?php echo $produto['totalItens']; ?></td>
                                    <td class="info_responsive"><b><?php echo $column_prod_qtde_comprado; ?></b></td>
                    				<td><?php echo $produto['qtdeComp']; ?></td>
                                    <?php endif; ?>
                                    <td class="info_responsive"><b><?php echo $column_prod_qtde; ?></b></td>
                                    <td>
                                        <?php if($produto['qtde']){ ?>
                                              <?php echo $produto['qtde']; ?>
                                        <!-- <select name="qtde" id="qtde" > -->
                                        <?php  //for($cont = 1 ; $cont <= (int)$produto['qtde'] ; $cont++): ?>
                                            <!-- <option value="<?php //echo $cont; ?>"><?php //echo $cont; ?></option> -->
                                        <?php //endfor; ?>
                                         <!-- </select> -->
                                        <?php }//else{ ?>
                                        <!-- <strong>Esgotado</strong>  -->
                                        <?php //} ?>
                                    </td>
                                    <td class="info_responsive"><b><?php echo $column_prod_valor;?></b></td>
                    				        <td>
                                      <?php if ($produto['special']) { ?>
                                        <span style="display:block; text-decoration: line-through;"><?php echo $this->language->get('text_de'); ?><?php echo $produto['valor']?></span>
                                        <span style="display:block; font-size:13px; font-weight:bold;"><?php echo $this->language->get('text_por'); ?><?php echo $produto['special']?></span>
                                      <?php }else{ ?>
                                        <span style="display:block; font-size:13px; font-weight:bold;"><?php echo $produto['valor']?></span>
                                      <?php } ?>
                                    </td>
                                    <!--<td class="info_responsive"><?//echo $column_prod_opcoes;?></td>-->
                    				<!--<td><?//=$produto['opcoes']?></td>-->
                                    <td class="info_responsive">
                                        <b><?php if($produto['qtde']){
                    											echo $column_prod_opcao;
                                         } ?><b>
                                    </td>
                                    <td class="pedido-total">
                                        <?php if($produto['qtde']){ ?>
                                            <div>
                                            <input type="hidden" name="produto" value = "<?php echo $produto['id_prod']?>" />
                                            <input type="hidden" name="item" value = "<?php echo $produto['item']?>" />
                                            <input type="hidden" name="qtdeorig" value = "<?php echo $produto['qtde']?>" />
																						<input type="hidden" name="qtdeComp" value = "<?php echo $produto['qtdeComp']?>" />
                                            <?php  if($produto['opcoes2']){ ?>
                                            <?php foreach($produto['opcoes2'] as $k=>$v){ ?>
                                            <?php if($v['op_array']){ ?>
                                            <input type="hidden" name="opcoes[<?php echo $v['op_parent_opcao']?>][]" value = "<?php echo $v['op_id_opcao']?>" />
                                            <?php } else { ?>
                                            <input type="hidden" name="opcoes[<?php echo $v['op_parent_opcao']?>]" value = "<?php echo $v['op_id_opcao']?>" />
                                            <?php } ?>
                                            <?php } ?>
                                            <?php } ?>
                                            </div>
																							<?php if($produto['qtde']!=$produto['qtdeComp']){ ?>
																								<button
																									type="button"
																									onclick="$(this).addtocart(<?php echo $produto['item']?>)"
																									class="btn-default btn-medium btn-cart"
																								>
																									<span><?php echo $button_cart; ?></span>
																								</button>
																								<!-- <span class="btn-cart-notification js-btn-cart-notification" data-notification-value="1"></span> -->
                                         			<?php }else{ ?>
																							<span class="text-error text-uppercase">
																								<i class="fas fa-ban" aria-hidden="true"></i>
																								Já adquirido
																							</span>
																							<?php } ?>
                                         <?php } ?>
                                    </td>
                    			<td class="fix-margin"></td>
                    		</tr>
                    	    <?php $cont++; ?>
                            <?php } ?>
                            <?php } else { ?>
                            <tr><td style="text-align: center;  line-height: 25px;" colspan = "8" >Nenhum presente ainda para essa lista.</td></tr>
                            <?php } ?>
                        </tbody>
                        </table>
          		</div>
          	</li>
          </ol>

	</article>
</section>



<script type="text/javascript">

window.waitEvent('scripts_document', function(){

	$.fn.addtocart = function(id) {
	$.ajax({
		url: 'index.php?route=listapresente/produtos/addtocart&lista_id=<?php echo $lista_id?>&cliente_id=<?php echo $cliente_id?>&not_buy=<?php echo $not_buy; ?>',
		type: 'post',
		data: $('.itemlista'+id+' input[type=\'hidden\'], .itemlista'+id+' input[type=\'hidden\']'),
		dataType: 'json',
        error: function(json){
          //alert(JSON.stringify(json));
        },
		success: function(json) {
		   // alert(JSON.stringify(json));
			$('.success, .warning, .attention, information, .error').remove();
			if (json['error']) {
					if(json['error']['option']) {
	          for (i in json['error']['option']) {
							notificationMsg(json['error']['option'][i],'warning');
	          }
	        }

          if(json['error']['qtde']){
						notificationMsg(json['error']['qtde'],'warning');
          }

          if(json['error']['lista']){
						notificationMsg(json['error']['lista'],'warning');
          }

          if(json['error']['carrinho']){
						notificationMsg(json['error']['carrinho'],'warning');
          }

				  if(json['error']['errmaxitemcart']){
						notificationMsg(json['error']['errmaxitemcart'],'warning');
					 }

					 if(json['error']['not_buy']){
						notificationMsg(json['error']['not_buy'],'warning');
				   }
		}

      if (json['success']) {
        notificationMsg(json['success'],'success');
      }
		}
	});
}

});

</script>

<?php echo $footer; ?>
