<script type="text/javascript" src="<?php echo base_url();?>assets/js/settings.js"></script>
<aside class="right-side">
    <style type="text/css">
        #alt-server {
            margin-top: 40px;
            padding: 20px 0px; 
            border-top: 2px dotted #f33;
            box-shadow: 3px 3px 9px #eee;
        }
        
        #alt-server label {
            color: #999;
            font-size: 12px;
        }
        
        .alt-inp {
            border: none;
            border-bottom: 1px dotted #999;
            padding: 5px;
            letter-spacing: 2px;
            min-width: 320px;
            
        }
        
        .alt-inp:focus {
            outline: none;
            border-bottom: 2px solid #f33;
        }
        
        #alt-import-dialog .no-results {
            margin-top: 10%;
        }
        
        #alt-import-dialog .close-btn {
            position: absolute;
            font-size: 24px;
            right: 20px;
            color: #ccc;
            font-style: normal;
            font-family: sans-serif;
            cursor: pointer;
            display: none;
        }
        
        #alt-import {
            display: none;
        }
        
        #alt-import .title {
            color: #f33;
            /*border-bottom: 2px solid #f33;*/
            
            margin-bottom: 20px;
            padding: 5px 10px;
        }
        
        #alt-import .title h2 {
            letter-spacing: 3px;
            font-size: 25px;
        }
        
        #alt-import .title span {
            position: absolute;
            right: 45px;
            margin-top: -50px;
        }
        
        #alt-import .title span .fa{
            margin: 5px;
            padding: 10px;
            background: #f33;
            color: #fff;
            border-radius: 41px;
            min-width: 42px;
            min-height: 38px;
            font-size: 18px;
            text-align: center;
            font-weight: bold;
            box-shadow: 3px 3px 9px #999;
            border: 2px solid;
            cursor: pointer;
        }
        
        #alt-import .title .ctrl-btn.fa-play {
            background: #FFC107;
            padding-right: 4px;
        }
        
        #alt-import-pro {
            display: none;
            position: absolute;
            width: 97%;
            margin-top: -22px;
            box-shadow: 1px 3px 6px #ccc;
            height: 5px;
        }
        
        #alt-import-pro > div.pro-bar {
            max-width: 0%;
            background: #f33;
            min-height: 5px;
            border-radius: 25px;
        }
            
        #alt-import-pro > div.status {
            margin: 10px;
        }
            
        
        #alt-import-pro > div.status span {
            color: #999;
        }
        
        #alt-import-status-percent {
            position: absolute;
            right: 45px;
        }
        
        #alt-import #plotter{
            margin: 30px 10px;
            margin-top: 60px;
            overflow-y : scroll;
            max-height: 400px;
            
        }
        
        #alt-import #plotter tr {
            
        }
        
        #alt-import #plotter td {
            padding: 5px 20px;
            text-align: right;
            color: #999;
        }
        
        #alt-import #plotter tr.done td {
            color: #1ba;
        }
        
        #alt-import #plotter tr.active td {
            color: #f33;
        }
        
        #alt-import.paused #plotter tr.active td {
            color: #FFC107 !important;
        }
        
        #alt-import.paused .title h2 {
            animation: blnk 1s infinite;
        }
        
        #alt-timer {
            right: 100px !important;
            margin-top: -32px !important;
            color: #999;
            letter-spacing: 2px;
            text-shadow: 1px 1px 1px #ccc;
        }
        
        .load-ico {
            font-weight: bold;
            font-size: 65px;
            margin: 20px 0px;
            color: #fff;
            background: #f33;
            border-radius: 50px;
            /*box-shadow: 3px 2px 9px #999, -3px -2px 9px #999;*/
            border: 5px solid #fff;
            min-width: 75px;
            min-height: 65px;
        }
        
        .load-ico.fa-check {
            background: #1ba;
            padding: 10px;
            font-size: 55px;
            box-shadow: 3px 3px 9px #eee;
            min-height: 75px;
            min-width: 85px;
            
        }
        
        @keyframes blnk {
            0% {
                color: #F33;
            }
            
            25% {
                color: #FFC107;
            }
            
            50% {
                color: #fff;
            }
            
            75% {
                color: #FFC107;
            }
            
            100% {
                color: #F33;
            }
        }
        
        #alt-import-msg .btn {
            border: none;
            margin: 20px 0px;
        }
        
    </style>
    <section class="content-header">
        <div class="title_bar">
            <h1 class="major_txt_color">General Settings Edit</h1>
            <div class="breadcrumb_container"><?php echo breadcrumb_links();?></div>
        </div>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box-header">
                    <div class="box-body table-responsive">
                        <?php if(!empty($success)) {?>
                            <div class="alert alert-success alert-dismissable">
                                <i class="fa fa-thumbs-o-up"></i>
                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                                <h4><?php echo $success;?></h4>
                            </div>
                        <?php }
                        else if(!empty($error)) {?>
                            <div class="alert alert-danger alert-dismissable">
                                <i class="fa fa-thumbs-o-down"></i>
                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                                <h4><?php echo $error;?></h4>
                            </div>
                        <?php }?>
                    </div>
                    <!-- .box-tools -->
                </div>
            </div>
            
            <div class="col-xs-12">
                <h3 style="margin-top: 0; margin-right: 5px; width: 100%; display: inline-block;">
                    <a class="label btn btn-primary float-rht edit" href="<?php echo $view_link?>"><span>View</span></a>
                </h3>
                 <form name="general_settings" action="<?php echo $form_action;?>" method="post" enctype="multipart/form-data">
                    <div class="box box-danger">
                        <div class="box-body">
                            <ul class="error_container"></ul>
                            <div class="col-xs-12">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label>Year Setting<span class="required">*</span></label>
                                        <select name="year_end_month" class="form-control select2">
                                            <option value="">Select Month</option>
                                            <?php foreach ($months as $key=>$month) { ?>
                                                <option value="<?php echo $key;?>" <?php echo ($key == $setting->year_end_month) ? 'selected' : '';?>><?php echo $month;?></option>
                                            <?php } ?>
                                        </select>
                                    </div>
                                    <div class="form-group">
                                        <label>Prefix</label>
                                        <div class="checkbox">
                                            <label style="padding-left: 0px !important;">
                                                <input type="checkbox" class="form-control prefix" name="prefix" value="1" <?php echo ($setting->prefix == 1) ? 'checked' : '';?> />
                                            </label>
                                        </div>
                                    </div>
                                    
                                    <div class="form-group">
                                        <label>GST<span class="required">*</span></label>
                                        <input type="text" class="form-control gst" name="gst" value="<?php echo $setting->gst;?>" />
                                    </div>  
                                    
                                    <div class="form-group">
                                        <label>Synchronous URL<span class="required">*</span></label>
                                        <div class="input-group input-group-sm">                                        
                                            <input type="text" class="form-control sync_url" name="sync_url" value="<?php echo $setting->sync_url;?>" >
                                            <span class="input-group-btn"><button type="button" id="sync" class="btn btn-info btn-flat" data-loading-text="Loading...">Sync Now</button></span>
                                        </div>
                                    </div>
                                    
                                    <div class="form-group">
                                        <label>Database Truncate (Billing Module)</label>
                                        <div class="input-group input-group-sm db_truncate">
                                            <span class="input-group-btn"><button type="button" id="db_truncate" class="btn btn-info db_truncate" style="border-radius: 2px; background-color:#e91e63; border-color: #e91e63;">Truncate</button></span>
                                        </div>
                                    </div>
                                    
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label>Counter Availability</label>
                                        <div class="checkbox">
                                            <label style="padding-left: 0px !important;">
                                                <input type="checkbox" class="form-control kiosk_availability" name="kiosk_availability" value="1" <?php echo ($setting->kiosk_availability == 1) ? 'checked' : '';?> />
                                            </label>
                                        </div>
                                    </div>
                                    
                                    <div class="form-group">
                                        <label>Kiosk Availability (Kiosk-Scan)</label>
                                        <div class="checkbox">
                                            <label style="padding-left: 0px !important;">
                                                <input type="checkbox" class="form-control scan_availability" name="scan_availability" value="1" <?php echo ($setting->scan_availability == 1) ? 'checked' : '';?> />
                                            </label>
                                        </div>
                                    </div>
                                    
                                    <div class="form-group" style="clear: both;">
                                        <label>Num Pad</label>
                                        <div class="checkbox">
                                            <label style="padding-left: 0px !important;">
                                                <input type="checkbox" class="form-control num_pad" name="num_pad" value="1" <?php echo ($setting->num_pad == 1) ? 'checked' : '';?> />
                                            </label>
                                        </div>
                                    </div>
                                    
                                    <div class="form-group">
                                        <label>Is Category (Archanai)</label>
                                        <div class="checkbox">
                                            <label style="padding-left: 0px !important;">
                                                <input type="checkbox" class="form-control archanai_cat" name="archanai_cat" value="1" <?php echo ($setting->is_category == 1) ? 'checked' : '';?> />
                                            </label>
                                        </div>
                                    </div>
                                    
                                    <div class="form-group" style="clear: both;">
                                        <label>OTP Contact No</label>
                                        <input type="text" class="form-control otp_contact_no" name="otp_contact_no" value="<?php echo $setting->otp_contact_no;?>" />
                                    </div>
                                </div>
                                
                            </div>
                        
                            <div class="col-xs-12" id="alt-server">
                                <div style="padding: 5px 15px; font-weight: bold; color: #fff; background: #f33; width: 165px; margin: 10px; margin-bottom: 20px; box-shadow: 2px 2px 4px #999;"><i class="fa fa-empire" style="margin-right: 5px;"></i>Alt. Server</div>
                                <div style="width: 340px; position: absolute; right: 0px; margin-top: -45px; box-shadow: -2px -2px 6px #eee; padding: 10px 10px;">
                                    
                                    <div style="float: left;  margin: 10px 20px 0px 0px;">
                                        <input type="checkbox" name="alt_chk" <?php echo $alt_server['alt_url']['status'] == "1" ? 'checked' : ''; ?> />
                                        <label for="alt_chk" style="border-bottom: 1px dotted #999; padding-bottom: 2px; margin-left: 2px; letter-spacing: 1px; color: #bababa;">Enable</label>
                                    </div>
                                    
                                    <div style="float: left;  margin-top: 10px;">
                                        <input type="checkbox" name="server_down" <?php echo $alt_server['server_down']['value'] == "1" ? 'checked' : ''; ?>  value="1" />
                                        <label for="server_down" style="border-bottom: 1px dotted #999; padding-bottom: 2px; margin-left: 2px; letter-spacing: 1px; color: #bababa;">Server Down</label>
                                    </div>
                                    
                                    <div style="float: left;  margin-left: 25px;">
                                        <button class="alt-import-btn" style="color: #fff; border: none; padding: 5px; background: #f33; box-shadow: 2px 2px 3px #999; min-width: 95px;" data-url="<?php echo $alt_server['alt_url']['value']; ?>" data-host="<?php echo $alt_server['alt_host']['value']; ?>" data-user="<?php echo $alt_server['alt_user']['value']; ?>" data-pass="<?php echo $alt_server['alt_pass']['value']; ?>" data-db="<?php echo $alt_server['alt_db']['value']; ?>" ><i class="fa fa-download"></i> Import</button>
                                    </div>   
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label>App URL</label>
                                        <input type="text" class="alt-inp" name="alt_url" value="<?php echo $alt_server['alt_url']['value']; ?>" placeholder="http://example.com/" />
                                        
                                    </div>
                                    
                                    <div class="form-group">
                                        <label>DB Host</label>
                                        <input type="text" class="alt-inp" name="alt_host" value="<?php echo $alt_server['alt_host']['value']; ?>" placeholder="localhost:80" />
                                    </div>
                                    
                                    <div class="form-group">
                                        <label>DB Name</label>
                                        <input type="text" class="alt-inp" name="alt_db" value="<?php echo $alt_server['alt_db']['value']; ?>" placeholder="tiru" />
                                    </div>
                                    
                                </div>
                                
                                <div class="col-md-6">
                                    
                                    <div class="form-group">
                                        <label>DB User</label>
                                        <input type="text" class="alt-inp" name="alt_user" value="<?php echo $alt_server['alt_user']['value']; ?>" placeholder="root" />
                                    </div>
                                    
                                    <div class="form-group">
                                        <label>DB Password</label>
                                        <input type="password" class="alt-inp" name="alt_pass" value="<?php echo $alt_server['alt_pass']['value']; ?>" placeholder="" />
                                    </div>
                                    
                                </div>
                                
                            </div>
                        </div>    

                            
                        <div class="container">  
                            <!-- Modal -->
                            <div class="modal fade" id="myModal" role="dialog">
                              <div class="modal-dialog">

                                <!-- Modal content-->
                                <div class="modal-content">
                                  <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                                    <h4 class="modal-title" style="text-align: center;font-size: 22px;">Sync Data From One Server to Another</h4>
                                  </div>
                                  <div class="modal-body" style="text-align: center;">
                                      <div class="inprogress"><i class="fa fa-circle-o-notch fa-spin" style="font-size:40px"></i>
                                          <p style="margin: 50px;font-size: 18px;letter-spacing: 1px;line-height: 39px;">Sync Operation is In Progress.<br>Please Wait Until the Pop-up Closed!! <br> Thanks!!</p></div>
                                       <div class="completed">   
                                           <p style="margin:15px;font-size: 18px;letter-spacing: 1px;line-height: 39px;">Sync Operation is Completed.<br> Thanks!!</p>
                                       </div>
                                  </div>
                                    <div class="modal-footer" style="display: none; border-top: 2px solid #f5f5f5;">
                                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                  </div>
                                </div>

                              </div>
                            </div>  
                        </div>
                        
                        <div class="box-footer form-actions float-clear" style="text-align:center;">
                            <input class="btn reset" type="reset" value="Reset" />
                            <input type="submit" name="submit" value="Update" class="btn btn-success btn-primary" />
                        </div>
                    </div><!-- /.box -->
                </form>
            </div><!-- /.col-xs-12 -->
        </div><!-- /.row -->
    </section><!-- /.content -->
</aside>

