<?php session_start();
require_once('Connections/courier.php'); 
include_once('categorieslist.php');
require_once 'functions/functions.php';?>
<head>
    <style type="text/css">
        .form-control-mine{
            color: #333333;
            background-color: #ffffff;
            border: 1px solid #e5e5e5;
            padding: 6px 12px;
            font-size: 14px;
        }

        i.icon-trash:hover{
            color:red;
            cursor: pointer;
        }
        i.icon-edit:hover{
            color:blue;
            cursor: pointer;
        }
    </style>
</head>
<div class="page-bar">
                        <ul class="page-breadcrumb">
                            <li>
                                <i class="icon-home"></i>
                                <a href="index.html">Home</a>
                                <i class="fa fa-angle-right"></i>
                            </li>
                            <li>
                                <span>Dashboard</span>
                            </li>
                        </ul>
                        <div class="page-toolbar">
                            <div class="btn-group pull-right">
                                <button type="button" class="btn btn-fit-height grey-salt dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-delay="1000" data-close-others="true"> Actions
                                    <i class="fa fa-angle-down"></i>
                                </button>
                                <ul class="dropdown-menu pull-right" role="menu">
                                    <li id="refresh_btn" onclick="getstep('list_of_all_categories');">
                                        <a href="#">
                                            <i class="icon-refresh"></i> Refresh</a>
                                    </li>
                                    <li>
                                        <a data-toggle="modal" href="#basic">
                                            <i class="icon-plus"></i> Add New Category </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
</div>

<div class="row">
    <div class="col-lg-12 col-md-12 col-xs-12 col-sm-12">
        <div class="portlet light ">
            <div class="portlet-title">
                <div class="caption">
                    <span class="caption-subject bold uppercase font-dark">LIST OF ALL ITEM CATEGORIES </span>
                </div>
            </div>

            <div class="portlet-body" style="height:550px;overflow-y: scroll">
<?php 
	$accountlist = new CategoriesList();
	$accountlist->init(0,$_SESSION['FINANCIAL_YR_END']); ?>
	<table class="table table-advance table-hover">
            <thead>
                <tr>
                    <th>CATEGORY/ITEM NAME</th>
                    <th>TYPE</th>
                    <th></th>
                </tr>
            </thead>
<?php
        $accountlist->account_st_main(-1);
	echo "</table>";
 ?>
            </div>
        </div>
    </div>
</div>



<div class="modal fade" id="basic" tabindex="-1" role="basic" aria-hidden="true">
                                            <div class="modal-dialog">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                                                        <h4 class="modal-title">New Item Category</h4>
                                                    </div>
                                                    <div class="modal-body"> 
                                                    
                                                    <form class="form-horizontal" role="form">
                                                        <div class="form-body">
                                                        <div class="form-group">
                                                    <label class="col-md-3 control-label">Parent Category</label>
                                                    <div class="col-md-9">
                                                        <select name="parent_name" id="parent_name" class="form-control">
                                                            <option value="">Select Parent Name</option>
                                                            <option value="0">No Parent Name</option>
                                                            <?php
                                                                $item_categories = mysql_query("SELECT * FROM item_categories ORDER BY category_name ASC");
                                                                while($row = mysql_fetch_assoc($item_categories)){ ?>
                                                                    <option value="<?php echo $row['id']; ?>"><?php echo $row['category_name'];?></option>
                                                                <?php } ?>
                                                        </select>
                                                    </div>
                                                </div>
												
	                                            <div class="form-group">
                                                    <label class="col-md-3 control-label">Category Name</label>
                                                    <div class="col-md-9">
                                                        <input name="category_name" id="category_name" type="text" class="form-control" placeholder="">
                                                    </div>
                                                </div>
	                                            
                                                <div class="form-group">
                                                    <label class="col-md-3 control-label">Category Code</label>
                                                    <div class="col-md-9">
                                                        <input name="category_code" id="category_code" type="text" class="form-control" placeholder="">
                                                    </div>
                                                </div>

                                                        </div>
                                                    </form>


                                                    </div>
                                                    <div class="modal-footer">
                                                        <button id="close_modal_btn" type="button" class="btn red" data-dismiss="modal">Close</button>
                                                        <button onclick="getData('save_new_item_category', '0', '');return false;" type="button" class="btn green">Save Info</button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>  
