<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">المصروفات والإيرادات</a></li>
            <li><a href="#">المصروفات</a></li>
            <li class="active">عرض المصروفات</li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading">عرض المصروفات</div>
            <div class="panel-body">

                <!---------- start outputString alert ----------->
                <div id="outputString" class="alert alert-block alert-success fade in" style="display:none">
                    <button type="button" class="close pull-left" data-dismiss="alert" aria-hidden="true">&times;</button>
                    <p id="outputStringValue">{$outputString}</p>
                    <div class="clearfix"></div>
                </div>
                <!---------  end outputString alert ------------>

                <form class="form-inline hidden-print" method="post" action="expensesController.php?do=show">
                    <div class="form-group">
                        <label class="sr-only">إسم نوع المصروف</label>
                        <select data-placeholder="اختر نوع المصروف"  class="select2 wdt100"  name="expensestypeid" id="expensestypeid" >
                            <option value="-1">اختر نوع المصروف</option>


                            {foreach $alldata as $type}

                            <option value="{$type->expensestypeid}">{$type->expensestypename}</option>

                            {/foreach}

                        </select>

                    </div>
                    <br />
                    <div class="form-group">
                        <label class="sr-only">من التاريخ</label>
                        <input type="text" class="form-control awdatepicker" autocomplete="off"   data-date-format="yyyy-mm-dd" name="from" >
                    </div>
                    <div class="form-group">
                        <label class="sr-only">إلى التاريخ</label>
                        <input type="text" class="form-control awdatepicker" autocomplete="off"   data-date-format="yyyy-mm-dd" name="to" >
                    </div>
                    <button type="submit" class="btn btn-primary hidden-print">بحث</button>
                </form>
                <div class="panel panel-default">
                    <!-- Default panel contents -->
                    <div class="panel-heading">{$message}</div>
                    <div class="panel-body">
                        <div class="col-lg-offset-8 col-lg-4 ">
                            <div class="well well-sm">
                                <h4 class="text-center">إجمالي المصروفات:  {$sum}</h4>
                            </div>
                        </div>
                        {literal}
                        <br />        <br />
                        <br />
                        <br />

                        <form id="form1" name="form1" method="post" action="expensesController.php?do=executeOperation" onsubmit="if (Spry.Widget.Form.validate(this)) {
                    return countChoosenProducts('expensesController');
                } else {
                    return false;
                }
                " enctype="multipart/form-data">
                            {/literal}
                            <!-- Table -->
                            <table class="table table-black">
                                <thead>
                                    <tr>
                                        <th class="hidden-print">
                                            <label>
                                                <input type="checkbox" name="checkAll" id="checkAll"/>
                                            </label>
                                        </th>
                                        <th>إسم المصروف</th>
                                        <th>نوع المصروف</th>
                                        <th>التاريخ</th>
                                        <th>المبلغ</th>
                                        <th>التعليق</th>
                                        <th class="hidden-print">حذف مؤقت/إلغاء الحذف</th>
                                        <th class="hidden-print">التعديل</th>
                                        <th class="hidden-print">حذف</th>
                                    </tr>
                                </thead>
                                <tbody>

                                    {foreach $expenseData as $data}
                                    {if {$data->conditions} eq 1}
                                    <tr class="danger"> {elseif {$data->conditions} eq 0}

                                    <tr> {/if}
                                        <td class="hidden-print">
                                            <label>
                                                <input type="checkbox" name="choosedItem[]" id="checked{$i}" class="choosenItem" value="{$data->expensesid}" />
                                            </label>
                                        </td>
                                        <td> {$data->expensesname} </td>
                                        <td>{$data->expensestypename}</td>
                                        <td>{$data->expensesdate}</td>
                                        <td>{$data->expensesValue}</td>
                                        <td>{if {$data->expensesdetails} <> ""}
                                            {$data->expensesdetails}
                                            {else } لا يوجد تعليق
                                            {/if} </td>
                                        <td  class="hidden-print"> {if {$data->conditions} eq 0} <a href="expensesController.php?do=tempdelete&id={$data->expensesid}" type="button" class="btn btn-default btn-lg removeicon"> </a> {elseif {$data->conditions} eq 1 } <a  href="expensesController.php?do=returndelete&id={$data->expensesid}" type="button" class="btn btn-default btn-lg correcticon"> </a> </td>
                                        {/if}
                                        <td  class="hidden-print"> <a href="expensesController.php?do=edit&id={$data->expensesid}"  type="button" class="btn btn-default btn-lg editicon"></a></td>
                                        <td class="hidden-print" ><!--<a onclick="getValue({$data->expensesid})" name="dd" > حذف </a>-->
                                            <a href="expensesController.php?do=delete&id={$data->expensesid}" name="dd"  type="button" class="btn btn-default btn-lg deleteicon"> </a> </td>
                                    </tr>
                                    {/foreach}

                                </tbody>

                            </table>
                            <div class="clearfix hidden-print"></div>
                            <hr />
                            <div  class="">
                                <div class="col-lg-12 hidden-print">
                                    <div class="well well-sm">
                                        <div class="form-group " >
                                            <div class="col-lg-4 hidden-print">
                                                <label for="operation"></label>
                                                <span id="spryselect1">
                                                    <select name="operation" id="operation"  data-placeholder="اختر العملية"  class="select2 wdt100">
                                                        <option value="-1"></option>
                                                        <option value="1">حذف مؤقت</option>
                                                        <option value="2">إلغاء الحذف</option>
                                                        <option value="3">حذف نهائي</option>
                                                    </select>
                                                    <span class="selectInvalidMsg">اختر العملية</span></span></div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-lg-4">
                                                <input name=""  class="hidden-print btn btn-primary" type="submit" value="تنفيذ"/>
                                            </div>
                                        </div>

                                        <!-----------  start noElementsError alert ------------->
                                        <div class="clearfix"></div>
                                        <div id="noElementsError" class="alert alert-danger fade in" style="display:none;">
                                            <button type="button" class="close pull-left" data-dismiss="alert" aria-hidden="true">×</button>
                                            <p>يجب اختيار العناصر أولاً</p>
                                            <div class="clearfix"></div>
                                        </div>
                                        <!----------  end noElementsError alert -------------->

                                        <div class="clearfix"></div>
                                    </div>
                                </div>
                                <div class="col-lg-offset-8 col-lg-4 ">
                                    <div class="well well-sm">
                                        <h4 class="text-center">إجمالي المصروفات:  {$sum}</h4>
                                    </div>
                                </div>
                                <div class="clearfix"></div>
                            </div>
                        </form>

                        <div class="clearfix"></div>
                        <hr />
                        <div  class="hidden-print">
                            <div class="col-lg-12">
                                <div class="form-group">
                                    <div class="col-lg-4">
                                        <button type="button" onclick="print_Custom('mycustomheader');" class="btn btn-success pull-right">طباعة</button>
                                    </div>
                                </div>
                            </div>
                            <div class="clearfix"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        {literal}
        <script type="text/javascript">
            var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", {invalidValue: "-1", isRequired: false});
        </script>
        {/literal}