<!DOCTYPE html>
<html lang="en">
<body>
<?php
	$ShopCFG = loadConfig('shopsemi');
	if(!is_array($ShopCFG)) throw new Exception('Shop esta vacio.');

	loadModuleConfigs('shopsemi');

	# Opciones Generales
	$ShowOnlyPrice 	= mconfig('onlyprice') ? true : false;
	$ShowMP 		= mconfig('mercadopago') ? true : false;
	$ShowPP 		= mconfig('paypal') ? true : false;
	$ShowBCP 		= mconfig('bcp') ? true : false;
	$NumWP			= mconfig('numwp');

	# Categorias
	$ShowCoins		=	mconfig('coins') ? true : false;
	$ShowVips		=	mconfig('vips') ? true : false;
	$ShowSword		=	mconfig('sword') ? true : false;
	$ShowAxe		=	mconfig('axe') ? true : false;
	$ShowMace		=	mconfig('mace') ? true : false;
	$ShowSpear		=	mconfig('spear') ? true : false;
	$ShowBow		=	mconfig('bow') ? true : false;
	$ShowStaff		=	mconfig('staff') ? true : false;
	$ShowShield		=	mconfig('shield') ? true : false;
	$ShowWings		=	mconfig('wings') ? true : false;
	$ShowOtros		=	mconfig('otros') ? true : false;
	$ShowSet		=	mconfig('set') ? true : false;
	$ShowHelm		=	mconfig('helm') ? true : false;
	$ShowArmor		=	mconfig('armor') ? true : false;
	$ShowPants		=	mconfig('pants') ? true : false;
	$ShowGloves		=	mconfig('gloves') ? true : false;
	$ShowBoots		=	mconfig('boots') ? true : false;

	echo '<div class="alert alert-danger text-center" role="alert">
			<h3 style="text-align:center;"><i class="fas fa-exclamation-circle"></i> ATENCION</h3>
			<hr>
			<p>Esto no es <b>AUTOMATICO!</b>, debes contactar con el administrador una vez que hayas donado. <b>(Click en el boton de abajo)</b>.<br>
	</div>';	

	echo '<div class="row d-flex justify-content-center">';
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-primary btn-sm btn-block categoria_shop" category="all"><i class="fas fa-eye"></i> Todo</button>';
		echo '</div>';
	if($ShowCoins){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-info btn-sm btn-block categoria_shop" category="Coins"><i class="fas fa-coins"></i> Coins</button>';
		echo '</div>';
	}
	if($ShowVips){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-warning btn-sm btn-block categoria_shop" category="Vips"><i class="fas fa-star"></i> Vips</button>';
		echo '</div>';
	}
	if($ShowSword){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-secondary btn-sm btn-block categoria_shop" category="Sword"><i class="fas fa-gavel"></i> Sword</button>';
		echo '</div>';
	}
	if($ShowAxe){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-success btn-sm btn-block categoria_shop" category="Axe"><i class="fas fa-gavel"></i> Axe</button>';
		echo '</div>';
	}
	if($ShowMace){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-danger btn-sm btn-block categoria_shop" category="Mace"><i class="fas fa-hammer"></i> Mace</button>';
		echo '</div>';
	}
	echo '</div>';
	echo '<div class="row d-flex justify-content-center mt-1">';
	if($ShowSpear){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-dark btn-sm btn-block categoria_shop" category="Spear"><i class="fas fa-gavel"></i> Spear</button>';
		echo '</div>';
	}
	if($ShowBow){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-danger btn-sm btn-block categoria_shop" category="Bow"><i class="fas fa-location-arrow"></i> Bow</button>';
		echo '</div>';
	}
	if($ShowStaff){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-success btn-sm btn-block categoria_shop" category="Staff"><i class="fas fa-candy-cane"></i> Staff</button>';
		echo '</div>';
	}
	if($ShowShield){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-warning btn-sm btn-block categoria_shop" category="Shield"><i class="fas fa-shield-alt"></i> Shield</button>';
		echo '</div>';
	}
	if($ShowWings){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-secondary btn-sm btn-block categoria_shop" category="Wings"><i class="fas fa-feather"></i> Wings</button>';
		echo '</div>';
	}
	if($ShowOtros){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-info btn-sm btn-block categoria_shop" category="Otros"><i class="fas fa-adjust"></i> Otros</button>';
		echo '</div>';
	}
	echo '</div>';
	echo '<div class="row d-flex justify-content-center mt-1">';
	if($ShowSet){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-info btn-sm btn-block categoria_shop" category="Set"><i class="fas fa-user-astronaut"></i> Set</button>';
		echo '</div>';
	}
	if($ShowHelm){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-secondary btn-sm btn-block categoria_shop" category="Helm"><i class="fab fa-redhat"></i> Helm</button>';
		echo '</div>';
	}
	if($ShowArmor){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-primary btn-sm btn-block categoria_shop" category="Armor"><i class="fas fa-tshirt"></i> Armor</button>';
		echo '</div>';
	}
	if($ShowPants){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-danger btn-sm btn-block categoria_shop" category="Pants"><i class="fab fa-leanpub"></i> Pants</button>';
		echo '</div>';
	}
	if($ShowGloves){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-warning btn-sm btn-block categoria_shop" category="Gloves"><i class="fas fa-mitten"></i> Gloves</button>';
		echo '</div>';
	}
	if($ShowBoots){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-dark btn-sm btn-block categoria_shop" category="Boots"><i class="fas fa-socks"></i> Boots</button>';
		echo '</div>';
	}
	echo '</div>';

	echo '<hr>';

	echo '<a href="https://wa.me/'.$NumWP.'" target="_blank" class="btn btn-success btn-lg btn-block text-white">Contactar para mandar comprobante</a>';
	echo '<br>';		

	echo '<div class="card-body">
				  <div class="row">';		  
	foreach($ShopCFG as $id => $ShopSemiElement) {
		$Name			= $ShopSemiElement['name'];	
		$Img			= $ShopSemiElement['img'];	
		$Desc			= $ShopSemiElement['descripcion'];	
		$PriceMP		= $ShopSemiElement['pricemp'];	
		$LinkMP			= $ShopSemiElement['linkmp'];	
		$PricePP		= $ShopSemiElement['pricepp'];	
		$LinkPP			= $ShopSemiElement['linkpp'];
		$PriceBCP		= $ShopSemiElement['pricebcp'];	
		$LinkBCP		= $ShopSemiElement['linkbcp'];	
		$ColorBG		= $ShopSemiElement['colorbg'];
		$ClassicStyle	= $ShopSemiElement['classic'];

		if(!$ShowMP || !$ShowPP) $StyleBut = 'col-md-12 col-12';
		else $StyleBut = 'col-md-6 col-6';

		if($ClassicStyle) $StylePadding = '';
		else $StylePadding = 'p-5';

		if($ShopSemiElement['category'] == 1){
			$Category = "Coins";
		}else if($ShopSemiElement['category'] == 2){
			$Category = "Vips";
		}else if($ShopSemiElement['category'] == 3){
			$Category = "Sword";
		}elseif($ShopSemiElement['category'] == 4){
			$Category = "Axe";
		}elseif($ShopSemiElement['category'] == 5){
			$Category = "Mace";
		}elseif($ShopSemiElement['category'] == 6){
			$Category = "Spear";
		}elseif($ShopSemiElement['category'] == 7){
			$Category = "Bow";
		}elseif($ShopSemiElement['category'] == 8){
			$Category = "Staff";
		}elseif($ShopSemiElement['category'] == 9){
			$Category = "Shield";
		}elseif($ShopSemiElement['category'] == 10){
			$Category = "Helm";
		}elseif($ShopSemiElement['category'] == 11){
			$Category = "Armor";
		}elseif($ShopSemiElement['category'] == 12){
			$Category = "Pants";
		}elseif($ShopSemiElement['category'] == 13){
			$Category = "Gloves";
		}elseif($ShopSemiElement['category'] == 14){
			$Category = "Boots";
		}elseif($ShopSemiElement['category'] == 15){
			$Category = "Set";					
		}elseif($ShopSemiElement['category'] == 16){
			$Category = "Wings";
		}elseif($ShopSemiElement['category'] == 17){
			$Category = "Otros";
		}else{
			$Category = "Sin Categoria";
		}

			echo '<div class="col-md-4 col-sm-12 m-b-15 p-2 col-12 categoria_shop_item" category="'.$Category.'">';
				echo '<div class="card">';
					echo '<div class="card-footer">';
						echo '<p class="card-text text-center"><span class="text-muted">'.$Category.'</span></p>';
					echo '</div>';
					echo '<div class="card-img-top d-flex flex-row justify-content-center alig-items-center" style="background-color: '.$ColorBG.' !important;">';
						echo '<img class="'.$StylePadding.' img-fluid" src="'.__PATH_IMG__.'shop/'.$Img.'" data-toggle="tooltip" data-placement="top" alt="'.$Name.'" title="'.$Name.'!">';
					echo '</div>';	
					echo '<div class="card-body">';
					echo '<h5 class="card-title text-danger"><b>'.$Name.'</b></h5>';
						echo '<p class="card-text">'.$Desc.'</p>';
					echo '</div>';
					echo '<div class="card-footer">';
						echo '<div class="row">';
						if($ShowMP){
							echo '<div class="col-md-12 col-12 align-self-center text-center mb-1">';
								echo '<div class="btn btn-outline-primary btn-sm btn-block disabled" style="opacity:1;padding: 5px;"><b>$'.number_format($PriceMP,0,',','.').' ARS</b></div>';
							echo '</div>';
							if(!$ShowOnlyPrice){
								echo '<div class="col-md-12 col-12 align-self-center text-center mb-1 botones-donaciones">';
									echo '<a class="btn btn-primary btn-sm btn-block" style="color: #fff !important;font-weight: 500;" target="_blank" href="'.$LinkMP.'" role="button"><i class="fas fa-handshake"></i> MercadoPago</a>';
								echo '</div>';
							}
						}
						if($ShowPP){
							echo '<div class="col-md-12 col-12 align-self-center text-center mb-1">';
								echo '<div class="btn btn-outline-info btn-sm btn-block disabled" style="opacity:1;padding: 5px;"><b>$'.number_format($PricePP,0,',','.').' USD</b></div>';
							echo '</div>';
							if(!$ShowOnlyPrice){
								echo '<div class="col-md-12 col-12 align-self-center text-center mb-1 botones-donaciones">';
									echo '<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
										<input type="hidden" name="cmd" value="_s-xclick">
										<input type="hidden" name="hosted_button_id" value="'.$LinkPP.'">
										<button type="submit" name="submit" class="btn btn-info btn-sm btn-block" style="font-weight: 500;"><i class="fab fa-paypal"></i> PayPal</button>
										</form>';
								echo '</div>';
							}
						}
						if($ShowBCP){
							echo '<div class="col-md-12 col-12 align-self-center text-center mb-1">';
								echo '<div class="btn btn-outline-danger btn-sm btn-block disabled" style="opacity:1;padding: 5px;"><b>S/.'.number_format($PriceBCP,0,',','.').' SOLES</b></div>';
							echo '</div>';
							if(!$ShowOnlyPrice){
								echo '<div class="col-md-12 col-12 align-self-center text-center mb-1 botones-donaciones">';
									echo '<a class="btn btn-danger btn-sm btn-block" style="color: #fff !important;font-weight: 500;" target="_blank" href="'.$LinkBCP.'" role="button"><i class="fas fa-angle-double-right"></i> BCP</a>';
								echo '</div>';
							}
						}
						echo '</div>';
					echo '</div>';
				echo '</div>';
			echo '</div>';
			echo '<br>';		
	}		

	echo '
		</div></div><br>';
?>
</body>
</html>
