<?php

$MODULE_NAME= 'Test';
$TB_NAME= 'Build';

?>

<!-- PAGE-HEADER -->
<div class="page-header">
    <div>
        <h1 class="page-title"><?= $title ?></h1>
    </div>
    <div class="ms-auto pageheader-btn">
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="javascript:void(0);">اسم القائمة</a></li>
            <li class="breadcrumb-item active" aria-current="page">اسم الشاشة</li>
        </ol>
    </div>
</div>
<!-- PAGE-HEADER END -->
<!-- Row -->
<div class="row">
    <div class="col-lg-12">
        <div class="card">
            <div class="card-header align-items-center d-flex py-3">
                <div class="mb-0 flex-grow-1 card-title">
                    <?= $title ?>
                </div>
                <div class="flex-shrink-0">
                    <a class="btn btn-info" href=""><i class="fa fa-plus"></i>جديد</a>
                </div>
            </div><!-- end card header -->
            <div class="card-body">

                <form class="form-vertical" id="<?=$TB_NAME?>_form" >
                    <div class="row">

                        <div class="form-group col-md-2">
                            <label> المقر</label>
                            <select name="branch_id" id="dp_branch_id" class="form-control sel2">
                                <option value="">_______</option>
                                <option value="2">مقر غزة</option>
                                <option value="3">مقر الشمال</option>
                                <option value="4">مقر الوسطى</option>
                            </select>
                        </div>

                        <div class="form-group col-sm-2">
                            <label>عنوان السكن</label>
                            <div>
                                <input type="text" value="" name="address" id="txt_address" class="form-control" />
                            </div>
                        </div>

                    </div>
                </form>
                <br>
                <div class="flex-shrink-0">
                    <button type="button" onclick="javascript:search();" class="btn btn-primary"><i class="glyphicon glyphicon-search"></i> إستعلام</button>
                    <button type="button" onclick="javascript:clear_form();"  class="btn btn-cyan-light"><i class="fas fa-eraser"></i>تفريغ الحقول</button>

                </div>
                <hr>
                <div id="container">

                </div>
            </div><!--end card body-->
        </div><!--end card --->
    </div><!--end col lg-12--->
</div><!--end row--->

<?php
$scripts = <<<SCRIPT

<script type="text/javascript">

    $('.sel2').select2();
    
    function values_search(add_page){
        var values= { page:1 };
        if(add_page==0)
            delete values.page;
        return values;
    }

    function search(){
        var values= values_search(1);

        get_data('http://localhost/gfc_2022/Test/Build/get_page', values ,function(data){
            $('#container').html(data);
        },'html');
    }

    function LoadingData(){
        var values= values_search(0);
        ajax_pager_data('#page_tb > tbody',values);
    }

    function clear_form(){
        $('#dp_branch_id').select2('val',0);
        $('#txt_address').val('');
    }
    
</script>

SCRIPT;
sec_scripts($scripts);

?>
