<?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 "Setari config";?></legend>
                <?php
                        if(isset($info))
                        {
                            if(isset($info['info']))
                            echo <<< INF
                                    <div class="row">
                                        <div class="col-md-6">
                                              <div class="alert alert-info" role="alert">{$info['info']}</div>
                                        </div>
                                    </div>
INF;
                        else
                            if(isset($info['eroare']))
                                echo <<< ERR
                                    <div class="panel panel-red">
                                        <div class="panel-heading">
                                            <h3 class="panel-title">$ERROR_TITLE</h3>
                                        </div>
                                    <div class="panel-body">
                                        {$info['eroare']}
                                    </div>
                            </div>
ERR;
                        }
                        ?>

                <div class="row">
                <form id="my_set" action="<?php echo base_url();?>adm/setari/save_config" method="POST" enctype="multipart/form-data">
                    <div class="col-lg-6 col-md-6 col-sm-8 col-xs-12">
                        <label>Adresa fisiere locatie server (*)</label><br />
                        <input class="form-control" type="text" id="path"  name="path" value="<?=(isset($infoGeneraleConfig) && $infoGeneraleConfig)? $infoGeneraleConfig->path : '';?>" placeholder="Adresa fisiere locatie server">
                    </div>
                    <div class="clearfix"></div><br/>

                    <div class="col-lg-6 col-md-6 col-sm-8 col-xs-12">
                        <label>Adresa fisiere trimise (*)</label><br />
                        <input class="form-control" type="text" id="new_path"  name="new_path" value="<?=(isset($infoGeneraleConfig) && $infoGeneraleConfig)? $infoGeneraleConfig->new_path : '';?>" placeholder="Adresa fisiere locatie server">
                    </div>
                    <div class="clearfix"></div><br/>

                    <div class="col-lg-6 col-md-6 col-sm-8 col-xs-12">
                        <label>Separator denumire document (ex: OneIT_doc_123.pdf) (*)</label><br />
                        <input class="form-control" type="text" id="sep"  name="sep" value="<?=(isset($infoGeneraleConfig) && $infoGeneraleConfig)? $infoGeneraleConfig->separator : '';?>" placeholder="Separator denumire document">
                    </div>
                    <div class="clearfix"></div><br/>
                    
                    <div class="col-lg-3 col-md-6 col-sm-8 col-xs-12">
                      <button id="save_btn" type="submit" class="btn btn-primary">Salveaza</button>
                    </div><br />
                    </form>
                </div>
            </fieldset>
            </fieldset>
            </div>
        </div>
        <!-- /#page-wrapper -->
    </div>
    <!-- /#wrapper -->
    <div id="gif" class="modal fade loading-gif">
                 <div class="modal-dialog">
                       <div>
                           <img src="<?=base_url()?>img/loading.gif">
                       </div>
                 </div>
    </div>
<?php require_once(APPPATH.'/views/footer.php'); ?> 
<script>
        $(document).ready(function(){

            $("#my_set").validate({
                    // validation rules
                    rules: {
                        path: "required",
                        new_path: "required",
                        sep: "required"
                    },
                    // Specify validation error messages
                    messages: {
                        path: "Completeaza adresa locatie fisiere pe server.",
                        new_path: "Completeaza noua adresa locatie fisiere trimise pe server.",
                        sep: "Completeaza un separator din denumire document."
                    },
                    submitHandler: function(form) {
                      form.submit();
                    }
            });
        });

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