<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-sm-12">
        <div class="row">
            <div class="col-sm-10">
                <h2><?php __('plugin_base_infobox_whatsapp_settings_title');?></h2>
            </div>
        </div><!-- /.row -->

        <p class="m-b-none"><i class="fa fa-info-circle"></i> <?php __('plugin_base_infobox_whatsapp_settings_desc');?></p>
    </div><!-- /.col-md-12 -->
</div>

<div class="wrapper wrapper-content animated fadeInRight">
	<?php
	$error_code = $controller->_get->toString('err');
	if (!empty($error_code))
    {
    	$titles = __('plugin_base_error_titles', true);
    	$bodies = __('plugin_base_error_bodies', true);
    	switch (true)
    	{
    		case in_array($error_code, array('PSS01')):
    			?>
    			<div class="alert alert-success">
    				<i class="fa fa-check m-r-xs"></i>
    				<strong><?php echo @$titles[$error_code]; ?></strong>
    				<?php echo @$bodies[$error_code]?>
    			</div>
    			<?php 
    			break;
    		case in_array($error_code, array('')):	
    			?>
    			<div class="alert alert-danger">
    				<i class="fa fa-exclamation-triangle m-r-xs"></i>
    				<strong><?php echo @$titles[$error_code]; ?></strong>
    				<?php echo @$bodies[$error_code]?>
    			</div>
    			<?php
    			break;
    	}
    }
    // echo "<pre>"; print_r($tpl['option_arr']); echo "</pre>";
    ?>
    <div class="tabs-container tabs-reservations m-b-lg">
        <ul class="nav nav-tabs" role="tablist">
            <?php if ($tpl['has_access_settings']): ?>
                <li role="presentation" class="active"><a href="#settings" aria-controls="settings" role="tab" data-toggle="tab" aria-expanded="true"><?php __('plugin_base_sms_tab_settings');?></a></li>
            <?php endif; ?>
            
        </ul>

        <div class="tab-content">
            <?php if ($tpl['has_access_settings']): ?>
                <div role="tabpanel" class="tab-pane active" id="settings">
                    <div class="panel-body">
                        <form id="frmWhatsapp" name="frmWhatsapp" action="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjBaseWhatsApp&amp;action=pjActionIndex" method="post" class="form-horizontal">
                            <input type="hidden" name="whatsapp_post" value="1" />
                            <input type="hidden" name="number" value="" />
                            <!-- <p class="alert alert-info alert-with-icon m-t-xs"> <i class="fa fa-info-circle"></i><?php // __('plugin_base_whatsapp_infobox_api_settings');?></p> -->

                            <br>
                            
							<div class="form-group">
								<label class="col-sm-3 control-label"><?php __('plugin_base_twilio_account_sid', false, true);?></label>
								<div class="col-sm-6">
									<input type="text" id="plugin_twilio_account_sid" name="plugin_twilio_account_sid" value="<?php echo !empty($tpl['option_arr']['plugin_twilio_account_sid']) ? $tpl['option_arr']['plugin_twilio_account_sid'] : NULL;?>" class="form-control">
								</div><!-- /.col-sm-6 -->
							</div><!-- /.form-group -->
							
							<div class="form-group">
								<label class="col-sm-3 control-label"> <?php __('plugin_base_twilio_auth_token', false, true);?></label>
								<div class="col-sm-6">
									<input type="text" id="plugin_twilio_auth_token" name="plugin_twilio_auth_token" value="<?php echo !empty($tpl['option_arr']['plugin_twilio_auth_token']) ? $tpl['option_arr']['plugin_twilio_auth_token'] : NULL;?>" class="form-control">
								</div><!-- /.col-sm-6 -->
							</div><!-- /.form-group -->

							 <div class="form-group">
								<label class="col-sm-3 control-label"><?php __('plugin_base_twilio_service_sid', false, true);?></label>
								<div class="col-sm-6">
									<input type="text" id="plugin_twilio_service_sid" name="plugin_twilio_service_sid" value="<?php echo !empty($tpl['option_arr']['plugin_twilio_service_sid']) ? $tpl['option_arr']['plugin_twilio_service_sid'] : NULL;?>" class="form-control">
								</div><!-- /.col-sm-6 -->
							</div><!-- /.form-group -->
							
							<div class="form-group">
								<label class="col-sm-3 control-label"><?php __('plugin_base_twilio_sender_number', false, true);?></label>
								<div class="col-sm-6">
									<input type="text" id="plugin_twilio_sender_number" name="plugin_twilio_sender_number" value="<?php echo !empty($tpl['option_arr']['plugin_twilio_sender_number']) ? $tpl['option_arr']['plugin_twilio_sender_number'] : NULL;?>" class="form-control">
								</div><!-- /.col-sm-6 -->
							</div><!-- /.form-group -->
							
							
                            <div class="form-group">
                                <label class="col-sm-3 control-label"><?php __('plugin_base_admin_whatsapp_number', false, true);?></label>
                                <div class="col-sm-6">
                                    <input type="text" id="plugin_base_admin_whatsapp_number" name="plugin_base_admin_whatsapp_number" value="<?php echo !empty($tpl['option_arr']['plugin_base_admin_whatsapp_number']) ? $tpl['option_arr']['plugin_base_admin_whatsapp_number'] : NULL;?>" class="form-control">
                                </div><!-- /.col-sm-6 -->
                            </div><!-- /.form-group -->
                            
                            <div class="form-group">
                            <label class="col-sm-3 control-label"><?php __('plugin_base_whatsapp_enable_disable'); ?></label>
                                <div class="col-lg-5 col-sm-7">
                                    <div class="row">
                                        <div class="col-sm-6">
                                            <div class="switch m-t-xs">
                                                <div class="onoffswitch onoffswitch-yn">
                                                    <input class="onoffswitch-checkbox" id="plugin_base_whatsappmessage_disable" name="plugin_base_whatsappmessage_disable" type="checkbox"<?php echo $tpl['option_arr']['plugin_base_whatsappmessage_disable'] == 'Yes' ? ' checked="checked"' : NULL; ?> value="Yes|No::Yes">
                                                    <label class="onoffswitch-label" for="plugin_base_whatsappmessage_disable">
                                                        <span class="onoffswitch-inner"></span>
                                                        <span class="onoffswitch-switch"></span>
                                                    </label>
                                                </div>
                                            </div>
                                        </div><!-- /.col-sm-6 -->
                                    </div><!-- /.row -->
                                </div>
                            </div>

							<div class="hr-line-dashed"></div>
							
							<div class="clearfix">
                                <button type="submit" class="ladda-button btn btn-primary btn-lg pull-left btn-phpjabbers-loader" data-style="zoom-in">
                                    <span class="ladda-label"><?php __('plugin_base_btn_save'); ?></span>
                                    <?php include $controller->getConstant('pjBase', 'PLUGIN_VIEWS_PATH') . 'pjLayouts/elements/button-animation.php'; ?>
                                </button>
                            </div>
							
                        </form>
                    </div>
                </div>
            <?php endif; ?>

            <?php if ($tpl['has_access_list']): ?>
                <div role="tabpanel" class="tab-pane<?php echo $tpl['has_access_settings']? null: ' active'; ?>" id="message-sent">
                    <div class="panel-body ibox-content">
                        <div class="row m-b-md">
                            <div class="col-md-4 col-md-offset-4">
                                <form action="" method="get" class="form-horizontal frm-filter">
                                    <div class="input-group">
                                        <input type="text" name="q" placeholder="<?php __('plugin_base_btn_search', false, true); ?>" class="form-control">
                                        <div class="input-group-btn">
                                            <button class="btn btn-primary" type="submit">
                                                <i class="fa fa-search"></i>
                                            </button>
                                        </div>
                                    </div>
                                </form>
                            </div><!-- /.col-md-3 -->
                        </div><!-- /.row -->

                        <div id="grid"></div>

                    </div>
                </div>
            <?php endif; ?>
        </div>
    </div>
</div>

<script type="text/javascript">
var pjGrid = pjGrid || {};
var myLabel = myLabel || {};
myLabel.created = <?php x__encode('plugin_base_sms_date_time_sent'); ?>;
myLabel.number = <?php x__encode('plugin_base_sms_number'); ?>;
myLabel.text = <?php x__encode('plugin_base_sms_message'); ?>;
myLabel.status = <?php x__encode('plugin_base_sms_status'); ?>;

myLabel.test_sms_title = <?php x__encode('plugin_base_sms_test_sms_title'); ?>;
myLabel.test_sms_text = <?php x__encode('plugin_base_sms_test_sms_text'); ?>;
myLabel.test_sms_number = <?php x__encode('plugin_base_sms_number'); ?>;
myLabel.btn_send_sms = <?php x__encode('plugin_base_btn_send_sms'); ?>;
myLabel.btn_cancel = <?php x__encode('plugin_base_btn_cancel'); ?>;
</script>