<?php require_once(APPPATH.'/views/header.php'); ?>
<body>
    <div id="wrapper">
    <?php require_once(APPPATH.'/views/menu_user.php'); ?>
        <div id="page-wrapper">
            <div class="container-fluid">
                <fieldset class="admin-border">
                    <fieldset class="scheduler-border">
                    <legend class="scheduler-border"><?php echo $title;?></legend>
                        <div class="row">
                        <form id="my_set" action="<?php echo base_url();?>adm/arhiva/add" method="POST" enctype="multipart/form-data">
                            
                            <div class="col-lg-4 col-md-6 col-sm-8 col-xs-12">
                                <label>Scaneaza codul (*)</label><br />
                                <input class="form-control" type="number" id="cod"  name="cod" placeholder="Cod">
                            </div>
                            <div class="clearfix"></div><br/>
                            <div class="col-lg-4 col-md-6 col-sm-8 col-xs-12">
                                <label>Document (*)</label><br />
                                <select class="form-control" id="document" name="document">
                                    <?=(isset($select_docs) && $select_docs)? $select_docs:'';?>
                                </select>
                            </div>
                            <div class="clearfix"></div><br/>
                            <div class="col-lg-4 col-md-6 col-sm-8 col-xs-12">
                                <label>Client (*) <a id="new_client" class="btn btn-primary"><i class="fa fa-plus"></i></a></label><br />
                                <select class="form-control" id="client" name="client">
                                    <?=(isset($select_client) && $select_client)? $select_client:'';?>
                                </select>
                            </div>
                            <div class="clearfix"></div><br/>
                            <div class="col-lg-4 col-md-6 col-sm-8 col-xs-12">
                                <label>Observatii (*)</label><br />
                                <textarea class="form-control" type="text" id="observatii"  name="observatii"  placeholder="Observatii"></textarea>
                            </div>
                            <div class="clearfix"></div><br/>
                            <div class="col-lg-4 col-md-6 col-sm-8 col-xs-12">
                                <label>Status (*)</label><br />
                                <select class="form-control" id="status" name="status">
                                    <?=(isset($select_status) && $select_status)? $select_status:'';?>
                                </select>
                            </div>
                            <div class="clearfix"></div><br/>
                            <div class="col-lg-4 col-md-6 col-sm-8 col-xs-12">
                            <button id="save_btn" type="submit" class="btn btn-primary">Adauga</button>
                            </div><br />
                            </form>
                        </div>
                    <br/>
                    </fieldset>
                </fieldset>
            </div>
        </div>
        <!-- /#page-wrapper -->
    </div>
    <div id="gif" class="modal fade loading-gif">
        <div class="modal-dialog">
            <div>
                <img src="<?=base_url()?>img/loading.gif">
            </div>
        </div>
    </div>
    <!-- /#wrapper -->
<?php require_once(APPPATH.'/views/footer.php'); ?> 
<script>
            
        $(document).ready(function(){
            $("#cod").focus();

            $("#cod").change(function() {
                var cod = $("#cod").val();
                $("#document").val(cod);
            });

            $("#my_set").validate({
                    // validation rules
                    rules: {
                        client: {min:1},
                        document: {min:1}
                    },
                    // Specify validation error messages
                    messages: {
                        client: "Selecteaza un client",
                        document: "Selecteaza un document"                        
                    },
                    submitHandler: function(form) {
                      form.submit();
                    }
            });
        });

</script>     
</body>
</html>