<?php

//addition of goods to the storehouse
require_once "./config/Autoload.php";
//class autoload
$storehouse = Storehouse::getAllStorehouse();
//variable that contains the names of the warehouses
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.ord/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Добавить товар</title>
    <link href="style/add_product.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"--></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
    <script src="js/script_v1.js"></script>
</head>
<body>
<!--Header -->
<div class="container-fluid menu">
    <nav class="navbar navbar-default">
        <div class="container-fluid nav">
            <div class="navbar-collapse" id="bs-example-navbar-collapse-1">    <!--Header menu -->
                <ul class="nav navbar-nav">
                    <li>
                        <a class="navbar-brand" href="index.php">Storehouse</a>
 $info_array = array();
 //array for sending multiple data by json to SavaScript
 if ($res['storehouse_id'] == $storehouse_id) {
     //if true - the goods already on this stock
     $info_f = 'This product is on this stock';
     $info_array[] = $info_f;
     //put the information into an array to send by json
     echo json_encode($info_array);
     //send json data to JavaScript
 } else {
     $change_stock = Stock::change_stock($id, $storehouse_id);
     //change the id warehouse
     $change_stock_product = Product::change_stock($id, $storehouse_id);
     //change the id warehouse
     if ($change_stock == TRUE && $change_stock_product == TRUE) {
         $warehouse_name = Storehouse::getStorehouse($storehouse_id);
         //get the name of the warehouse to display to the user from JavaScript
         $warehouse_name = mysqli_fetch_array($warehouse_name);
         $info = 'Product successfully transferred';
         $info_array[] = $info;
         //put the information into an array to send by json
         $info_array[] = $warehouse_name['name'];
         //put the information into an array to send by json
         echo json_encode($info_array);
         //send json data to JavaScript
     } else {
         $info_d = 'Please try again';
         $info_array[] = $info_d;
         //put the information into an array to send by json
         echo json_encode($info_array);
         //send json data to JavaScript