hubtel_sms/views/settings.php
2025-01-13 19:14:18 +00:00

87 lines
5.0 KiB
PHP

<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>
<?php init_head(); ?>
<div id="wrapper">
<div class="content">
<div class="row">
<div class="col-md-12">
<div class="panel_s">
<div class="panel-body">
<h4 class="no-margin"><?php echo _l('hubtel_sms_settings'); ?></h4>
<hr class="hr-panel-heading" />
<?php echo form_open(admin_url('hubtel_sms/settings')); ?>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="client_id"><?php echo _l('hubtel_client_id'); ?></label>
<input type="text" class="form-control" id="client_id" name="client_id"
value="<?php echo get_option('hubtel_sms_client_id'); ?>" required>
</div>
<div class="form-group">
<label for="client_secret"><?php echo _l('hubtel_client_secret'); ?></label>
<input type="password" class="form-control" id="client_secret" name="client_secret"
value="<?php echo get_option('hubtel_sms_client_secret'); ?>" required>
</div>
<div class="form-group">
<label for="sender_id"><?php echo _l('hubtel_sender_id'); ?></label>
<input type="text" class="form-control" id="sender_id" name="sender_id"
value="<?php echo get_option('hubtel_sms_sender_id'); ?>" required>
<small class="text-muted"><?php echo _l('hubtel_sender_id_help'); ?></small>
</div>
<div class="form-group">
<label for="enabled"><?php echo _l('settings_yes'); ?> / <?php echo _l('settings_no'); ?></label>
<div class="form-group">
<?php $checked = (get_option('hubtel_sms_enabled') == 1) ? 'checked' : ''; ?>
<div class="checkbox checkbox-primary">
<input type="checkbox" name="enabled" id="enabled" value="1" <?php echo $checked; ?>>
<label for="enabled"><?php echo _l('hubtel_sms_enable_module'); ?></label>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<?php if (get_option('hubtel_sms_client_id') && get_option('hubtel_sms_client_secret')) { ?>
<div class="panel panel-info">
<div class="panel-heading">
<?php echo _l('hubtel_account_info'); ?>
</div>
<div class="panel-body" id="hubtel_account_info">
<!-- Account balance will be loaded here via AJAX -->
<div class="text-center">
<div class="spinner-border text-primary" role="status">
<span class="sr-only">Loading...</span>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
<div class="row">
<div class="col-md-12">
<button type="submit" class="btn btn-info pull-right"><?php echo _l('submit'); ?></button>
</div>
</div>
<?php echo form_close(); ?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php init_tail(); ?>
<script>
$(function() {
// Load account info if credentials are set
<?php if (get_option('hubtel_sms_client_id') && get_option('hubtel_sms_client_secret')) { ?>
$.get(admin_url + 'hubtel_sms/get_account_info', function(response) {
if (response.success) {
var html = '<p><strong><?php echo _l('balance'); ?>:</strong> ' + response.balance + ' ' + response.currency + '</p>';
$('#hubtel_account_info').html(html);
} else {
$('#hubtel_account_info').html('<div class="alert alert-danger">' + response.message + '</div>');
}
});
<?php } ?>
});
</script>