<?php 
if($this->user['user_group'] >= "3") {
	$shopsall = $this->getShops();

	if($_POST['ajax'] == "okRequest"){
		$item_id = $_POST['shop_id'];
		if($this->user['user_group'] >= 3){
			$this->editShop("`shop_status` = '1'", $item_id);
			$this->sendUserProject($item_id, $this->user['user_id'], 1);

			// Отправка уведомления на почту юзера
			$shop = $this->getShopByID((int)$_POST['shop_id']);
			$user = $this->userInfo($shop['user_id']);

			$status = 1;
			require_once("./cp_engine/theme/email/project.php");
			$this->smtpmail($user['user_email'], "LocalPay | Одобрение проекта", $body);
			exit("1");
		} else {
			exit("0");
		}
	}

	if($_POST['ajax'] == "aremoveRequest"){
		$item_id = $_POST['shop_id'];
		$reason = $_POST['reason'];
		if($this->user['user_group'] >= 3){
			$this->editShop("`shop_status` = '2', `shop_reason` = '{$reason}'", $item_id);
			$this->sendUserProject($item_id, $this->user['user_id'], 2);
			
			// Отправка уведомления на почту юзера
			$shop = $this->getShopByID((int)$_POST['shop_id']);
			$user = $this->userInfo($shop['user_id']);

			$status = 2;
			$message = $reason;
			require_once("./cp_engine/theme/email/project.php");
			$this->smtpmail($user['user_email'], "LocalPay | Проект заблокирован", $body);
			exit("1");
		} else {
			exit("0");
		}
	}

	$this->view(array("theme/_common/_header", "theme/project/all", "theme/_common/_footer"), array("user" => $this->user, "shops" => $this->shops, "shopsall" => $shopsall)); 
} else {
	$this->view(array("theme/_common/_header", "theme/errors/404", "theme/_common/_footer"), array("user" => $this->user, "shops" => $this->shops)); 
}