<div class="wrapper">
    <div class="container">
        <!-- Page-Title -->
        <div class="row">
            <div class="col-sm-12">
                <div class="btn-group pull-right m-t-10">
                    <!--<button onclick="openaddevent();" class="btn btn-primary waves-effect waves-light m-r-10"><i class="fa fa-plus"></i> Add Event</button>-->

                </div>
                <h4 class="page-title">Business Setup:</h4>
                <div class="col-md-12">
                    <?php if ($this->session->flashdata('Success') && $this->session->flashdata('Success') != "") { ?>
                        <div class="row">
                            <div class="col-sm-12">
                                <div class="alert alert-success">
                                    <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                                    <strong>Success!</strong> <?php echo $this->session->flashdata('Success'); ?>
                                </div>
                            </div>
                        </div>
                    <?php } ?>
                    <?php if ($this->session->flashdata('Error') && $this->session->flashdata('Error') != "") { ?>
                        <div class="row">
                            <div class="col-sm-12">
                                <div class="alert alert-danger">
                                    <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                                    <strong>Error!</strong> <?php echo $this->session->flashdata('Error'); ?>
                                </div>
                            </div>
                        </div>
                    <?php } ?>
                    <div class="card-box ">
                        <div class="row">
                            <div class="col-md-4">
                                <form method="post" action='<?php echo base_url(); ?>superuser_controller/update_business_details'>
                                    <div class="form-group">                                      
                                        <input type='hidden' readonly="readonly" name="id_business" value="<?php echo $business[0]['id_business']; ?>" />
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label" for="business_name">Business Name</label>
                                        <input class='form-control' name="business_name" value="<?php echo $business[0]['business_name']; ?>" />
                                    </div>
                                    <h4 class="text-primary">Loyalty Program:</h4>
                                    <div class="form-group">
                                        <label class="form-label" for="loyalty_enable">Enable Loyalty Program</label>
                                        <select class='form-control' name="loyalty_enable" >
                                            <option <?php if ($business[0]['loyalty_enable'] == 'Y') {
                                                    echo "selected='selected'";
                                                } ?> value='Y'>Yes</option>
                                            <option <?php if ($business[0]['loyalty_enable'] == 'N') {
                                                echo "selected='selected'";
                                            } ?> value='N'>No</option>
                                        </select>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label" for="s_loyalty">Enable Loyalty on Services</label>
                                        <select class='form-control' name="s_loyalty" >
                                            <option <?php if ($business[0]['s_loyalty'] == 'Y') {
                                                echo "selected='selected'";
                                            } ?> value='Y'>Yes</option>
                                            <option value="<?php if ($business[0]['s_loyalty'] == 'N') {
                                                echo "selected='selected'";
                                            } ?>" value='N'>No</option>
                                        </select>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label" for="r_loyalty_enable">Enable Loyalty on Retail</label>
                                        <select class='form-control' name="r_loyalty_enable" >
                                            <option<?php if ($business[0]['r_loyalty_enable'] == 'Y') {
                                                echo "selected='selected'";
                                            } ?> value='Y'>Yes</option>
                                            <option <?php if ($business[0]['r_loyalty_enable'] == 'N') {
                                                echo "selected='selected'";
                                            } ?> value='N'>No</option>
                                        </select>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label" for="l_point_value">1 Point is given on spending </label>
                                        <input class='form-control' name="l_point_value" value="<?php echo $business[0]['l_point_value']; ?>" />
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label" for="l_point_discount">Discount given again 1 Point </label>
                                        <input class='form-control' name="l_point_discount" value="<?php echo $business[0]['l_point_discount']; ?>" />
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label" for="loyalty_mode">Loyalty Mode</label>
                                        <select class='form-control' name="loyalty_mode" >
                                            <option <?php if ($business[0]['loyalty_mode'] == 'RupeeDiscount') {
                                                echo "selected='selected'";
                                            } ?> value='RupeeDiscount'>Rupee</option>
                                            <option <?php if ($business[0]['loyalty_mode'] == 'PercDiscount') {
                                                echo "selected='selected'";
                                            } ?> value='PercDiscount'>Percentage</option>
                                        </select>
                                    </div>
                                    <hr>
                                    <div class="form-group">
                                        <label class="form-label" for="loyalty_sms">Enable SMS on Invoicing</label>
                                        <select class='form-control' name="loyalty_sms" >
                                            <option <?php if ($business[0]['loyalty_sms'] == 'Yes') {
                                                echo "selected='selected'";
                                            } ?> value='Yes'>Yes</option>
                                            <option <?php if ($business[0]['loyalty_sms'] == 'No') {
                                                echo "selected='selected'";
                                            } ?> value='No'>No</option>
                                        </select>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label" for="show_amount">Send Amount in SMS</label>
                                        <select class='form-control' name="show_amount" >
                                            <option <?php if ($business[0]['show_amount'] == 'Yes') {
                                                echo "selected='selected'";
                                            } ?> value='Yes'>Yes</option>
                                            <option <?php if ($business[0]['show_amount'] == 'No') {
                                                echo "selected='selected'";
                                            } ?> value='No'>No</option>
                                        </select>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label" for="show_points">Send Points Earned in SMS</label>

                                        <select class='form-control' name="show_points" >
                                            <option <?php if ($business[0]['show_points'] == 'Yes') {
                                                echo "selected='selected'";
                                            } ?> value='Yes'>Yes</option>
                                            <option <?php if ($business[0]['show_points'] == 'No') {
                                                echo "selected='selected'";
                                            } ?> value='No'>No</option>
                                        </select>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label" for="admin_notifications">Enable Admin Notification SMS</label>
                                        <select class='form-control' name="admin_notifications" >
                                            <option <?php if ($business[0]['admin_notifications'] == 'Yes') {
                                                echo "selected='selected'";
                                            } ?> value='Yes'>Yes</option>
                                            <option <?php if ($business[0]['admin_notifications'] == 'No') {
                                                echo "selected='selected'";
                                            } ?> value='No'>No</option>
                                        </select>
                                    </div>
                            </div>    
                            <div class="col-md-4">
                                <div class="form-group">   </div>
                                <h4 class="text-primary">Invoice and Menu:</h4>
                                <div class="form-group">
                                    <label class="form-label" for="show_staff">Show Staff on Invoice</label>
                                    <select class='form-control' name="show_staff" >
                                        <option <?php if ($business[0]['show_staff'] == 'Y') {
                                            echo "selected='selected'";
                                        } ?> value='Y'>Yes</option>
                                        <option <?php if ($business[0]['show_staff'] == 'N') {
                                            echo "selected='selected'";
                                        } ?> value='N'>No</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label class="form-label" for="invoicenumber">Show Invoice# on Invoice</label>
                                    <select class='form-control' name="invoicenumber" >
                                        <option <?php if ($business[0]['invoicenumber'] == 'Yes') {
                                            echo "selected='selected'";
                                        } ?> value='Yes'>Yes</option>
                                        <option <?php if ($business[0]['invoicenumber'] == 'No') {
                                            echo "selected='selected'";
                                        } ?> value='No'>No</option>
                                    </select>
                                </div>
                                <?php if(isset($business[0]['till_closing'])) {?>
                                <div class="form-group">
                                    <label class="form-label" for="till_closing">Show Till Closing Form on Scheduler</label>

                                    <select class='form-control' name="till_closing" >
                                        <option <?php if ($business[0]['till_closing'] == 'Yes') {
                                            echo "selected='selected'";
                                        } ?> value='Yes'>Yes</option>
                                        <option <?php if ($business[0]['till_closing'] == 'No') {
                                            echo "selected='selected'";
                                        } ?> value='No'>No</option>
                                    </select>
                                </div>
                                <?php } ?>
                                <div class="form-group">
                                    <label class="form-label" for="b_switch">Show Branch Switch Button</label>
                                    <select class='form-control' name="b_switch" >
                                        <option <?php if ($business[0]['b_switch'] == 'Yes') {
                                            echo "selected='selected'";
                                        } ?> value='Yes'>Yes</option>
                                        <option <?php if ($business[0]['b_switch'] == 'No') {
                                            echo "selected='selected'";
                                        } ?> value='No'>No</option>
                                    </select>
                                </div>

                                <hr>
                                 <?php if(isset($business[0]['gym'])) {?>
                                <div class="form-group">
                                    <label class="form-label" for="gym">Enable Gym Menu</label>
                                    <select class='form-control' name="gym" >
                                        <option <?php if ($business[0]['gym'] == 'Yes') {
                                            echo "selected='selected'";
                                        } ?> value='Yes'>Yes</option>
                                        <option <?php if ($business[0]['gym'] == 'No') {
                                            echo "selected='selected'";
                                        } ?> value='No'>No</option>
                                    </select>
                                </div>
                                <?php } ?>
                                 <?php if(isset($business[0]['programs'])) {?>
                                <div class="form-group">
                                    <label class="form-label" for="programs">Enable Programs Menu</label>

                                    <select class='form-control' name="programs" >
                                        <option <?php if ($business[0]['programs'] == 'Yes') {
                                            echo "selected='selected'";
                                        } ?> value='Yes'>Yes</option>
                                        <option <?php if ($business[0]['programs'] == 'No') {
                                                echo "selected='selected'";
                                            } ?> value='No'>No</option>
                                    </select>
                                </div>
                                <?php } ?>
                                <?php if(isset($business[0]['training'])) {?>
                                <div class="form-group">
                                    <label class="form-label" for="training">Enable Training Menu</label>

                                    <select class='form-control' name="training" >
                                        <option <?php if ($business[0]['training'] == 'Yes') {
                                            echo "selected='selected'";
                                        } ?> value='Yes'>Yes</option>
                                        <option <?php if ($business[0]['training'] == 'No') {
                                            echo "selected='selected'";
                                        } ?> value='No'>No</option>
                                    </select>
                                </div>
                                <?php } ?>
                                <?php if(isset($business[0]['fineprint'])) {?>
                                <div class="form-group">
                                    <label class="form-label" for="fineprint">Print Thank You on Invoice</label>
                                    <select class='form-control' name="fineprint" >
                                        <option <?php if(isset($business[0]['fineprint'])) {if ($business[0]['fineprint'] == 'Yes') {
                                            echo "selected='selected'";
                                        }} ?> value='Yes'>Yes</option>
                                        <option <?php  if(isset($business[0]['fineprint'])) {if($business[0]['fineprint'] == 'No') {
                                            echo "selected='selected'";
                                        }} ?> value='No'>No</option>
                                    </select>
                                </div>
                                <?php } ?>
                                <?php if(isset($business[0]['invoice_terms'])) {?>
                                <div class="form-group">
                                    <label class="form-label" for="invoice_terms">Print Payment Terms on Invoice</label>
                                    <select class='form-control' name="invoice_terms" >
                                        <option <?php if(isset($business[0]['invoice_terms'])) {if ($business[0]['invoice_terms'] == 'Yes') {
                                            echo "selected='selected'";
                                        }} ?> value='Yes'>Yes</option>
                                        <option <?php  if(isset($business[0]['invoice_terms'])) {if($business[0]['invoice_terms'] == 'No') {
                                            echo "selected='selected'";
                                        }} ?> value='No'>No</option>
                                    </select>
                                </div>
                                <?php } ?>
                                <div class="form-group">
                                    <label class="form-label" for="payment_terms">Invoice Payment Terms</label>
                                    <textarea class='form-control' rows="8" name="payment_terms" ><?php if(isset($business[0]['payment_terms'])){echo $business[0]['payment_terms'];}?></textarea>
                                </div>
                            </div>
                            
                            <div class='col-md-4'>
                                <h4 class="text-primary">Branch Options:</h4>
                                <div class="form-group"></div>
                                 <?php if(isset($business[0]['ho'])){?>
                                <div class="form-group">
                                    <label class="form-label text-danger" for="ho">This Branch is set as the Head Office</label>

                                    <select class='form-control' name="ho" >
                                        <option <?php if ($business[0]['ho'] == 'Yes') {
                                            echo "selected='selected'";
                                        } ?> value='Yes'>Yes</option>
                                        <option <?php if ($business[0]['ho'] == 'No') {
                                            echo "selected='selected'";
                                        } ?> value='No'>No</option>
                                    </select>
                                </div>
                                <?php } ?>
                                <?php if(isset($business[0]['common_products'])){?>
                                <div class="form-group">
                                    <label class="form-label text-danger" for="common_products">This Branch uses Common Products Pool</label>

                                    <select class='form-control' name="common_products" >
                                        <option <?php if ($business[0]['common_products'] == 'Yes') {
                                            echo "selected='selected'";
                                        } ?> value='Yes'>Yes</option>
                                        <option <?php if ($business[0]['common_products'] == 'No') {
                                            echo "selected='selected'";
                                        } ?> value='No'>No</option>
                                    </select>
                                </div>
                                <?php } ?>
                                <?php if(isset($business[0]['auto_vouchers'])){?>
                                <div class="form-group">
                                    <label class="form-label text-danger" for="auto_vouchers">Auto Account Vouchers are Enabled</label>

                                    <select class='form-control' name="auto_vouchers" >
                                        <option <?php if ($business[0]['auto_vouchers'] == 'Yes') {
                                            echo "selected='selected'";
                                        } ?> value='Yes'>Yes</option>
                                        <option <?php if ($business[0]['auto_vouchers'] == 'No') {
                                            echo "selected='selected'";
                                        } ?> value='No'>No</option>
                                    </select>
                                </div>
                                <?php } ?>
                                <?php if(isset($business[0]['tax_mode'])){?>
                                <div class="form-group">
                                    <label class="form-label text-danger" for="tax_mode">Sales Tax Will Be Applied Before or After Discount</label>

                                    <select class='form-control' name="tax_mode" >
                                        <option <?php if(isset($business[0]['tax_mode']) && $business[0]['tax_mode'] == 'before') {
                                            echo "selected='selected'";
                                        } ?> value='before'>Before Discount</option>
                                        <option <?php if (isset($business[0]['tax_mode']) && $business[0]['tax_mode'] == 'after') {
                                            echo "selected='selected'";
                                        } ?> value='after'>After Discount</option>
                                    </select>
                                </div>
                                <?php } ?>
                                <?php if(isset($business[0]['hide_cell'])){?>
                                <div class="form-group">
                                    <label class="form-label text-danger" for="hide_cell">Customer Cell Will Be Hidden</label>

                                    <select class='form-control' name="hide_cell" >
                                        <option <?php if ($business[0]['hide_cell'] == 'Yes') {
                                            echo "selected='selected'";
                                        } ?> value='Yes'>Yes</option>
                                        <option <?php if ($business[0]['hide_cell'] == 'No') {
                                            echo "selected='selected'";
                                        } ?> value='No'>No</option>
                                    </select>
                                </div>
                                <?php } ?>
                                 <?php if(isset($business[0]['discount_pw'])){?>
                                <div class="form-group">
                                    <label class="form-label text-danger" for="discount_pw">Discount is Password Protected</label>

                                    <select class='form-control' name="discount_pw" >
                                        <option <?php if ($business[0]['discount_pw'] == 'Y') {
                                            echo "selected='selected'";
                                        } ?> value='Y'>Yes</option>
                                        <option <?php if ($business[0]['discount_pw'] == 'N') {
                                            echo "selected='selected'";
                                        } ?> value='N'>No</option>
                                    </select>
                                </div>
                                <?php } ?>
                                <?php if(isset($business[0]['allow_invoice_cancel'])){?>
                                <div class="form-group">
                                    <label class="form-label text-danger" for="allow_invoice_cancel">Reception can cancel Invoices</label>

                                    <select class='form-control' name="allow_invoice_cancel" >
                                        <option <?php if ($business[0]['allow_invoice_cancel'] == 'Yes') {
                                            echo "selected='selected'";
                                        } ?> value='Yes'>Yes</option>
                                        <option <?php if ($business[0]['allow_invoice_cancel'] == 'No') {
                                            echo "selected='selected'";
                                        } ?> value='No'>No</option>
                                    </select>
                                </div>
                                <?php } ?>
                                <?php if(isset($business[0]['allow_balance'])){?>
                                <div class="form-group">
                                    <label class="form-label text-danger" for="allow_balance">Invoices can be created with Balances</label>

                                    <select class='form-control' name="allow_balance" >
                                        <option <?php if ($business[0]['allow_balance'] == 'Yes') {
                                            echo "selected='selected'";
                                        } ?> value='Yes'>Yes</option>
                                        <option <?php if ($business[0]['allow_balance'] == 'No') {
                                            echo "selected='selected'";
                                        } ?> value='No'>No</option>
                                    </select>
                                </div>
                                <?php } ?>
                                <div class="">
                                    <button type='submit' style='float: right' class="btn btn-pink">Save</button>
                                </div> 
                                </form>
                            </div>                           
                        </div>
                    </div>
                </div>