| 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/onesupportsys.onesolution.hk/project/views/ |
Upload File : |
<?php
session_start();
$allow_edit_mode = false;
if (Util::isAdmin()) { // admin
$allow_edit_mode = true;
} else {
if (empty($project['id'])) { // new job
$allow_edit_mode = true;
}
}
?><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ng="http://angularjs.org">
<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;
}
#showweek td{
text-align: center;
}
</style>
<?php require(__DIR__ . '/../../inc/_head_script.php'); ?>
<script>
function scrollToId(id) {
var $root = $('html, body'),
$body = $('body'),
$e = $('#' + id);
var paddingTop = $body.css('padding-top');
paddingTop = parseInt(paddingTop, 10);
paddingTop = isNaN(paddingTop) ? 0 : paddingTop;
$root.animate({
scrollTop: $e.offset().top - paddingTop
}, 500);
}
</script>
<script>
$(function() {
var staffoptions = "";
<?php foreach ($staffs as $staff): ?>
staffoptions = staffoptions +"<option value='<?= h($staff['id']) ?>'<?= $staff['id'] == $project[$attribute] ? ' selected=\"selected\"' : '' ?>><?= $staff['actived'] == 1 ? '' : '[Disabled] ' ?><?= h($staff['username']) ?></option>";
<?php endforeach; ?>
var addDiv = $('#addstaff');
var i = $('#addstaff #container').size() + 1;
$('#addNew').live('click', function() {
$('<div id="container"><div class="control-group" id="staff_'+i+'"><label class="control-label" for="staff_id">Staff</label><div class="controls"><select id="staff_'+i+'" name="staff_id1[]" placeholder="Select a Staff" class="required select2"><option value=""></option>'+staffoptions+'</select><a href="#" id="remNew" class="btn" > -Remove </a></div>').appendTo(addDiv);
i++;
//recall function
$('#actual_start_time, #actual_end_time, #start_time, #end_time, #call_time, .time').change(function (event) {
var $this = $(this),
val = $this.val();
if (val && val.length && val.length == 4) {
var number = parseInt(val, 10);
if (!isNaN(number)) {
$this.val([val.slice(0, 2), ':', val.slice(2)].join(''));
event.preventDefault();
$this.trigger('change');
}
}
});
<?php if ($project['status'] == 1): // open ?>
$('.date-picker').datetimepicker({ pickTime: false });
$('.time-picker').datetimepicker({ pickDate: false, pickSeconds: false });
<?php else: ?>
var $form = $('#form');
$('input, textarea, select', $form).prop('disabled', true);
<?php endif; ?>
$('.select2').select2();
<?php if ($project['status'] == 1 && !Util::isAdmin() && $allow_edit_mode): ?>
$('#staff_id').select2('readonly', true);
$('#staff_id').select2('enable', true);
<?php endif; ?>
$('#form').validate();
return false;
});
$('#remNew').live('click', function() {
if( i > 1 ) {
$(this).parents('#container').remove();
i--;
}
return false;
});
});
</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; ?>
<?php if (isset($_SESSION["clash_job_array"]) && !empty($_SESSION["clash_job_array"])): ?>
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
<h5 class="alert-heading">Note:</h5>
<p><?="Job number:".implode(" ",$_SESSION["clash_job_array"])." CLASH new added/modified Job!!"?></p>
</div>
<?php endif; ?>
<?php if (empty($project['id'])): ?>
<h2>Add Project</h2>
<?php else: ?>
<div class="control-group pull-right">
<div class="controls">
<code>Status: <?= h($statusOptions[$project['status']]) ?></code>
<?php if (Util::isAdmin()): ?>
<?php if ($project['status'] == 1): ?>
<button type="button" id="confirm_btn" class="btn btn-warning">Close</button>
<?php endif; ?>
<?php if ($project['status'] != 1): ?>
<button type="button" id="reopen_btn" class="btn btn-warning">Reopen</button>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
<?php if (Util::isAdmin()): ?>
<div style="display:none">
<form id="status_form" action="status.php" method="post">
<?php $attribute = 'id'; ?>
<input type="hidden" name="<?= $attribute ?>" value="<?= h($project[$attribute]) ?>"/>
<?php $attribute = 'status'; ?>
<input type="hidden" id="status_form_<?= $attribute ?>" name="<?= $attribute ?>" value="<?= h($project[$attribute]) ?>"/>
</form>
</div>
<script type="text/javascript">
$(function () {
var isDirty = false;
function changeStatus(statusText, status) {
if (isDirty) {
bootbox.alert('The form changed data, please save first or reopen this page.');
} else {
var message = 'Are you sure to change job status to ' + statusText + '?';
bootbox.confirm(message, 'No', 'Yes', function (result) {
if (result) {
$('#status_form_status').val(status);
$('#status_form').submit();
}
});
}
}
$('#confirm_btn').click(function (event) {
event.preventDefault();
changeStatus('CLOSE', '2');
});
$('#reopen_btn').click(function (event) {
event.preventDefault();
changeStatus('OPEN', '1');
});
$('#void_btn').click(function (event) {
event.preventDefault();
changeStatus('VOID', '3');
});
var value = null;
$('#form').on('focus', 'input, textarea, select', function () {
value = $(this).val();
});
$('#form').on('blur', 'input, textarea, select', function () {
if ($(this).val() != value) {
isDirty = true;
}
});
});
</script>
<?php endif; ?>
<h2 id="goto_top">
Edit Project: #<?= h($project['id']) ?>
</h2>
<?php endif; ?>
<form id="form" class="form-horizontal" method="post">
<?php $attribute = 'id'; ?>
<input type="hidden" name="<?= $attribute ?>" value="<?= h($project[$attribute]) ?>"/>
<div class="control-group">
<?php $attribute = 'project_name';
$label = 'Project Name'; ?>
<label class="control-label" for="<?= $attribute ?>"><?= $label ?></label>
<div class="controls">
<input type="text" id="<?= $attribute ?>" name="<?= $attribute ?>" placeholder="Enter <?= $label ?>" class="required span4" <?= $allow_edit_mode ? '' : ' disabled="disabled"' ?> value="<?=$project[$attribute]?>"/>
</div>
</div>
<div class="control-group">
<?php $attribute = 'customer_id';
$label = 'Customer'; ?>
<label class="control-label" for="<?= $attribute ?>"><?= $label ?></label>
<div class="controls">
<select id="<?= $attribute ?>" name="<?= $attribute ?>" placeholder="Select a <?= $label ?>" class="required select2"<?= $allow_edit_mode ? '' : ' disabled="disabled"' ?>>
<option value=""></option>
<?php foreach ($customers as $customer): ?>
<option value="<?= h($customer['cust_id']) ?>"<?= $customer['cust_id'] == $project[$attribute] ? ' selected="selected"' : '' ?>><?= $customer['enable'] == 1 ? '' : '[Disabled] ' ?><?= h($customer['company_name']) ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<?php if($project["status"] == 1 && $allow_edit_mode){ ?>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn btn-primary">Save</button>
<?php if (empty($project['id'])): ?>
<button type="reset" class="btn">Reset</button>
<?php endif; ?>
</div>
</div>
<?php } ?>
</form>
<script type="text/javascript">
$(function () {
$('#actual_start_time, #actual_end_time, #start_time, #end_time, #call_time, .time').change(function (event) {
var $this = $(this),
val = $this.val();
if (val && val.length && val.length == 4) {
var number = parseInt(val, 10);
if (!isNaN(number)) {
$this.val([val.slice(0, 2), ':', val.slice(2)].join(''));
event.preventDefault();
$this.trigger('change');
}
}
});
<?php if ($project['status'] == 1): // open ?>
$('.date-picker').datetimepicker({ pickTime: false });
$('.time-picker').datetimepicker({ pickDate: false, pickSeconds: false });
<?php else: ?>
var $form = $('#form');
$('input, textarea, select', $form).prop('disabled', true);
<?php endif; ?>
$('.select2').select2();
<?php if ($project['status'] == 1 && !Util::isAdmin() && $allow_edit_mode): ?>
$('#staff_id').select2('readonly', true);
$('#staff_id').select2('enable', true);
<?php endif; ?>
$('#form').validate();
});
</script>
<?php require(__DIR__ . '/../../inc/_footer.php'); ?>
</div>
<!-- /container -->
</body>
</html>
<?php
unset($_SESSION["clash_job_array"]);
unset($_SESSION["clash_project_array"]);
?>