| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/onesupportdemo.onesolution.hk/customer/views/ |
Upload File : |
<?php
if (!Util::isAdmin()) {
header("Location: ../index.php" );
exit;
}
$sql = "SELECT * FROM v_cm_customer_support ORDER BY company_name";
$parameters = array(0);
if (!($sth = $dbh->prepare($sql))) {
throw new Exception("sql prepare statement failure: $sql");
}
$sth->setFetchMode(PDO::FETCH_ASSOC);
if (!$sth->execute($parameters)) {
throw new Exception("sql execute statement failure: $sql");
}
$customers = $sth->fetchAll();
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php require(__DIR__ . '/../../inc/_head_meta.php'); ?>
<?php require(__DIR__ . '/../../inc/_head_css.php'); ?>
<style type="text/css">
body {
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
padding-bottom: 40px;
}
</style>
<?php require(__DIR__ . '/../../inc/_head_script.php'); ?>
<script type="text/javascript">
$(function() {
$('.select2').select2();
});
</script>
</head>
<body>
<?php require( __DIR__ . '/../../inc/_navbar.php'); ?>
<div class="container">
<?php if (isset($message) && !empty($message)): ?>
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
<h5 class="alert-heading">Note:</h5>
<p><?=$message?></p>
</div>
<?php endif; ?>
<h2><?=empty($customer['cust_id']) ? 'Add' : 'Modify'?> Customer</h2>
<form id="form" class="form-horizontal" method="post">
<?php $attribute = 'cust_id'; ?>
<input type="hidden" name="<?=$attribute?>" value="<?=h($customer[$attribute])?>" />
<div class="control-group">
<?php $attribute = 'company_name'; $label = 'Customer name'; ?>
<label class="control-label" for="<?=$attribute?>"><?=$label?><text style="color:red;"> *</text></label>
<div class="controls">
<textarea id="<?= $attribute ?>" name="<?= $attribute ?>" class="span6 required" placeholder="<?= $label ?>"><?= h($customer[$attribute]) ?></textarea>
</div>
</div>
<div class="control-group">
<?php $attribute = 'billaddress'; $label = 'Address'; ?>
<label class="control-label" for="<?=$attribute?>"><?=$label?><text style="color:red;"> *</text></label>
<div class="controls">
<textarea id="<?= $attribute ?>" name="<?= $attribute ?>" class="span6 required" placeholder="<?= $label ?>"><?= h($customer[$attribute]) ?></textarea>
</div>
</div>
<div class="control-group">
<?php $attribute = 'contact_person'; $label = 'Contact person'; ?>
<label class="control-label" for="<?=$attribute?>"><?=$label?><text style="color:red;"> *</text></label>
<div class="controls">
<input type="text" id="<?=$attribute?>" name="<?=$attribute?>" class="required" value="<?=h($customer[$attribute])?>" placeholder="<?=$label?>" />
</div>
</div>
<div class="control-group">
<?php $attribute = 'email'; $label = 'Email'; ?>
<label class="control-label" for="<?=$attribute?>"><?=$label?><text style="color:red;"> *</text></label>
<div class="controls">
<input type="text" id="<?=$attribute?>" name="<?=$attribute?>" class="required email" value="<?=h($customer[$attribute])?>" placeholder="<?=$label?>" />
</div>
</div>
<div class="control-group">
<?php $attribute = 'tel_no'; $label = 'Phone No.'; ?>
<label class="control-label" for="<?=$attribute?>"><?=$label?><text style="color:red;"> *</text></label>
<div class="controls">
<input type="text" id="<?=$attribute?>" name="<?=$attribute?>" class="required" value="<?=h($customer[$attribute])?>" placeholder="<?=$label?>" />
</div>
</div>
<div class="control-group hidden">
<?php $attribute = 'email_support'; $label = ' Email Support'; ?>
<label class="control-label" for="<?=$attribute?>"><?=$label?><text style="color:red;"> *</text></label>
<div class="controls">
<input type="text" id="<?=$attribute?>" name="<?=$attribute?>" class="required email" value="<?=h($customer[$attribute])?>" placeholder="<?=$label?>" />
</div>
</div>
<?php if(!empty($customer['cust_id'])){ ?>
<div class="control-group">
<?php $attribute = 'enable'; $label = 'Status'; ?>
<label class="control-label"><?=$label?><text style="color:red;"> *</text></label>
<div class="controls">
<label class="radio">
<input type="radio" name="<?=$attribute?>"<?=$customer[$attribute] == 1 ? ' checked="checked"' : ''?> placeholder="<?=$label?>" value="1" class="required" /> Enable<br>
<input type="radio" name="<?=$attribute?>"<?=$customer[$attribute] == 0 ? ' checked="checked"' : ''?> placeholder="<?=$label?>" value="0" class="required" /> Disable
</label>
</div>
</div>
<?php } ?>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn btn-danger">Save</button>
<button type="button" class="btn btn-default" onClick="history.go(-1);">Back</button>
</div>
</div>
</form>
<script type="text/javascript">
$(function() {
$('.select2').select2();
$('#form').validate({
rules: {
'loginpw': {
minlength: 4
},
'loginpw2': {
equalTo: '#loginpw'
}
}
});
});
</script>
<?php require( __DIR__ . '/../../inc/_footer.php'); ?>
</div> <!-- /container -->
</body>
</html>