<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
    <title>Главная</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <script type="text/javascript" src="jquery/jquery.js"></script>
    <script type="text/javascript" src="jquery/jquery-ui.min.js"></script>
    <script type="text/javascript" src="jquery/jquery.mask.min.js"></script>
    <script type="text/javascript" src="jquery/datepicker-ru.js"></script>

    <script type="text/javascript" src="js/code.js"></script>

    <link href="css/jquery-ui.min.css" rel="stylesheet" type="text/css">
    <link href="css/style.css" rel="stylesheet" type="text/css">

    <link href="css/select2.min.css" rel="stylesheet" />
    <script src="js/select2.min.js"></script>
    <script src="js/ru.js"></script>
</head>
<body>
<div id="box1" align="center">
    <div><h3>Склад</h3></div>

    <div id="menu" align="center"></div>

    <div id="box">
        <table border="1" class="tableStyle" id="table1">
            <tr>
                <th colspan="2">Редактирование Склад</th>
            </tr>
            <tr>
                <td>
                    Модель
                </td>
                <td>
                    <input id="model" type="text" value="<%=data.model%>">
                </td>
            </tr>
            <tr>
                <td>
                    Тип
                </td>
                <td>
                    <input id="type" type="text" value="<%=data.type%>">
                </td>
            </tr>
            <tr>
                <td>
                    Стоимость
                </td>
                <td>
                    <input id="cost" type="text" value="<%=data.cost%>">
                </td>
            </tr>
            <tr align="center" >
                <td>
                    <input type="button" onclick="save()" value="Сохранить">
                </td>
                <td>
                    <input type="button" onclick="cancel()" value="Отмена">
                </td>
            </tr>
        </table>
    </div>
</div>
</body>
<script>
    $.post('/menu', function(data) {
        $('#menu').append(data);
    });

    function cancel() {
        location.href = '/storage';
    }

    function save() {
        var data = {
            model: $('#model').val(),
            type: $("#type").val(),
            cost: $("#cost").val(),
            id: getQueryVariable("id")
        };
        $.post("/updateStorage", data, function () {
            location.href = '/storage';
        });
    }
</script>
</html>