Add jobs feature (close #4)
parent
aa235fcdcb
commit
331788c0d3
Binary file not shown.
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
CREATE TABLE IF NOT EXISTS `jobs` (
|
||||
`jobid` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`jobname` VARCHAR(200) NOT NULL,
|
||||
`jobcode` VARCHAR(200) NULL DEFAULT NULL,
|
||||
`color` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`deleted` TINYINT(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`jobid`),
|
||||
UNIQUE INDEX `jobid_UNIQUE` (`jobid` ASC))
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `job_groups` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`groupid` VARCHAR(45) NOT NULL,
|
||||
`jobid` INT(11) NOT NULL,
|
||||
PRIMARY KEY (`id`, `groupid`, `jobid`),
|
||||
UNIQUE INDEX `id_UNIQUE` (`id` ASC),
|
||||
INDEX `fk_job_groups_jobs1_idx` (`jobid` ASC),
|
||||
CONSTRAINT `fk_job_groups_jobs1`
|
||||
FOREIGN KEY (`jobid`)
|
||||
REFERENCES `qwikclock`.`jobs` (`jobid`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `job_tracking` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`uid` INT(11) NOT NULL,
|
||||
`jobid` INT(11) NOT NULL,
|
||||
`start` DATETIME NULL DEFAULT NULL,
|
||||
`end` DATETIME NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`, `uid`, `jobid`),
|
||||
INDEX `fk_job_tracking_jobs1_idx` (`jobid` ASC),
|
||||
UNIQUE INDEX `id_UNIQUE` (`id` ASC),
|
||||
CONSTRAINT `fk_job_tracking_jobs1`
|
||||
FOREIGN KEY (`jobid`)
|
||||
REFERENCES `qwikclock`.`jobs` (`jobid`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = utf8;
|
@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
require __DIR__ . '/../required.php';
|
||||
|
||||
dieifnotloggedin();
|
||||
|
||||
header("Content-Type: application/json");
|
||||
|
||||
require_once __DIR__ . "/login.php";
|
||||
require_once __DIR__ . "/userinfo.php";
|
||||
|
||||
$account_is_admin = account_has_permission($_SESSION['username'], "QWIKCLOCK_ADMIN");
|
||||
$showmanaged = ($VARS['show_all'] == 1 && (account_has_permission($_SESSION['username'], "QWIKCLOCK_MANAGE") || $account_is_admin));
|
||||
$managed_uids = [];
|
||||
$managed_uids[] = $_SESSION['uid'];
|
||||
if ($showmanaged) {
|
||||
if ($account_is_admin) {
|
||||
$managed_uids = false;
|
||||
} else {
|
||||
$managed_uids = getManagedUIDs($_SESSION['uid']);
|
||||
$managed_uids[] = $_SESSION['uid'];
|
||||
}
|
||||
}
|
||||
|
||||
$out = [];
|
||||
|
||||
$out['draw'] = intval($VARS['draw']);
|
||||
|
||||
if ($managed_uids === false) {
|
||||
$out['recordsTotal'] = $database->count('job_tracking');
|
||||
} else {
|
||||
$out['recordsTotal'] = $database->count('job_tracking', ['uid' => $managed_uids]);
|
||||
}
|
||||
|
||||
$filter = false;
|
||||
|
||||
// sort
|
||||
$order = null;
|
||||
$sortby = "DESC";
|
||||
if ($VARS['order'][0]['dir'] == 'asc') {
|
||||
$sortby = "ASC";
|
||||
}
|
||||
switch ($VARS['order'][0]['column']) {
|
||||
case 2:
|
||||
$order = ["jobname" => $sortby];
|
||||
break;
|
||||
case 3:
|
||||
$order = ["start" => $sortby];
|
||||
break;
|
||||
case 4:
|
||||
$order = ["end" => $sortby];
|
||||
break;
|
||||
}
|
||||
|
||||
// search
|
||||
if (!is_empty($VARS['search']['value'])) {
|
||||
$filter = true;
|
||||
$wherenolimit = [
|
||||
"AND" => [
|
||||
"OR" => [
|
||||
"jobname[~]" => $VARS['search']['value'],
|
||||
"jobcode[~]" => $VARS['search']['value'],
|
||||
"start[~]" => $VARS['search']['value'],
|
||||
"end[~]" => $VARS['search']['value'],
|
||||
],
|
||||
"uid" => $managed_uids
|
||||
]
|
||||
];
|
||||
if ($managed_uids !== false) {
|
||||
$where["AND"]["uid"] = $managed_uids;
|
||||
}
|
||||
$where = $wherenolimit;
|
||||
$where["LIMIT"] = [$VARS['start'], $VARS['length']];
|
||||
} else {
|
||||
$where = ["LIMIT" => [$VARS['start'], $VARS['length']]];
|
||||
if ($managed_uids !== false) {
|
||||
$where["uid"] = $managed_uids;
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_null($order)) {
|
||||
$where["ORDER"] = $order;
|
||||
}
|
||||
|
||||
|
||||
$jobs = $database->select('job_tracking', ['[>]jobs' => ['jobid']], [
|
||||
'id',
|
||||
'job_tracking.jobid',
|
||||
'uid',
|
||||
'start',
|
||||
'end',
|
||||
'jobname',
|
||||
'jobcode',
|
||||
'color',
|
||||
'deleted'
|
||||
], $where);
|
||||
|
||||
$usercache = [];
|
||||
|
||||
$editself = account_has_permission($_SESSION['username'], "QWIKCLOCK_EDITSELF");
|
||||
|
||||
for ($i = 0; $i < count($jobs); $i++) {
|
||||
// Get user info
|
||||
if (!isset($usercache[$jobs[$i]['uid']])) {
|
||||
$usercache[$jobs[$i]['uid']] = getUserByID($jobs[$i]['uid']);
|
||||
}
|
||||
|
||||
$jobs[$i][0] = "";
|
||||
if ($_SESSION['uid'] == $jobs[$i]['uid']) {
|
||||
if ($editself) {
|
||||
$jobs[$i][1] = '<a class="btn btn-blue btn-xs" href="app.php?page=editjobhistory&job=' . $jobs[$i]['id'] . '"><i class="fa fa-pencil-square-o"></i> ' . lang("edit", false) . '</a>';
|
||||
} else {
|
||||
$jobs[$i][1] = "";
|
||||
}
|
||||
} else if ($showmanaged) {
|
||||
$jobs[$i][1] = '<a class="btn btn-blue btn-xs" href="app.php?page=editjobhistory&job=' . $jobs[$i]['id'] . '"><i class="fa fa-pencil-square-o"></i> ' . lang("edit", false) . '</a>';
|
||||
} else {
|
||||
$jobs[$i][1] = "";
|
||||
}
|
||||
$jobs[$i][2] = '<span class="label label-' . $jobs[$i]['color'] . '"> </span> ' . ($jobs[$i]['deleted'] == 1 ? "<s>" : "") . $jobs[$i]['jobname'] . ($jobs[$i]['deleted'] == 1 ? "</s>" : "");
|
||||
$jobs[$i][3] = date(DATETIME_FORMAT, strtotime($jobs[$i]['start']));
|
||||
if (is_null($jobs[$i]['end'])) {
|
||||
$jobs[$i][4] = lang("na", false);
|
||||
} else {
|
||||
$jobs[$i][4] = date(DATETIME_FORMAT, strtotime($jobs[$i]['end']));
|
||||
}
|
||||
$jobs[$i][5] = $usercache[$jobs[$i]['uid']]['name'];
|
||||
}
|
||||
|
||||
$out['status'] = "OK";
|
||||
if ($filter) {
|
||||
$recordsFiltered = $database->count('job_tracking', ['[>]jobs' => ['jobid']], 'job_tracking.id', $wherenolimit);
|
||||
} else {
|
||||
$recordsFiltered = $out['recordsTotal'];
|
||||
}
|
||||
$out['recordsFiltered'] = $recordsFiltered;
|
||||
$out['data'] = $jobs;
|
||||
|
||||
echo json_encode($out);
|
@ -0,0 +1,104 @@
|
||||
<?php
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
require_once __DIR__ . '/../required.php';
|
||||
|
||||
redirectifnotloggedin();
|
||||
|
||||
$data = [
|
||||
"jobid" => "",
|
||||
"jobname" => "",
|
||||
"jobcode" => "",
|
||||
"color" => ""
|
||||
];
|
||||
|
||||
$editing = false;
|
||||
if (isset($VARS['job']) && $database->has('jobs', ['jobid' => $VARS['job']])) {
|
||||
$editing = true;
|
||||
|
||||
$data = $database->get('jobs', [
|
||||
"jobid",
|
||||
"jobname",
|
||||
"jobcode",
|
||||
"color",
|
||||
], [
|
||||
'jobid' => $VARS['job']
|
||||
]);
|
||||
}
|
||||
?>
|
||||
|
||||
<form role="form" action="action.php" method="POST">
|
||||
<div class="panel panel-blue">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">
|
||||
<?php if ($editing) { ?>
|
||||
<i class="fa fa-pencil"></i> <?php lang("edit job"); ?>
|
||||
<?php } else { ?>
|
||||
<i class="fa fa-plus"></i> <?php lang("new job"); ?>
|
||||
<?php } ?>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="jobname"><i class="fa fa-briefcase"></i> <?php lang("name"); ?></label>
|
||||
<input type="text" class="form-control" name="jobname" id="jobname" required="required" value="<?php echo $data['jobname']; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="jobcode"><i class="fa fa-barcode"></i> <?php lang("code"); ?></label>
|
||||
<input type="text" class="form-control" name="jobcode" id="jobcode" value="<?php echo $data['jobcode']; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="color"><i class="fa fa-paint-brush"></i> <?php lang("color"); ?></label>
|
||||
<?php
|
||||
$color = is_null($data['color']) ? "" : $data['color'];
|
||||
?>
|
||||
<select name="color" class="form-control">
|
||||
<?php
|
||||
$colors = ['', 'Red', 'Pink', 'Purple', 'Deep Purple', 'Indigo', 'Blue', 'Light Blue', 'Cyan', 'Teal', 'Green', 'Light Green', 'Lime', 'Yellow', 'Amber', 'Orange', 'Deep Orange', 'Brown', 'Grey', 'Blue Grey'];
|
||||
|
||||
function colorToVal($color) {
|
||||
return str_replace(" ", "-", strtolower($color));
|
||||
}
|
||||
|
||||
foreach ($colors as $c) {
|
||||
$cv = colorToVal($c);
|
||||
if ($c == "") {
|
||||
$c = lang("none", false);
|
||||
}
|
||||
if ($data['color'] == $cv) {
|
||||
echo "<option value=\"$cv\" selected>$c</option>";
|
||||
} else {
|
||||
echo "<option value=\"$cv\">$c</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="jobid" value="<?php echo $data['jobid']; ?>" />
|
||||
<input type="hidden" name="action" value="editjob" />
|
||||
<input type="hidden" name="source" value="editjobs" />
|
||||
|
||||
<div class="panel-footer">
|
||||
<button type="submit" class="btn btn-success"><i class="fa fa-floppy-o"></i> <?php lang("save"); ?></button>
|
||||
<?php
|
||||
if ($editing && account_has_permission($_SESSION['username'], "QWIKCLOCK_ADMIN")) {
|
||||
?>
|
||||
<a href="action.php?action=deletejob&source=editjobs&jobid=<?php echo $data['jobid']; ?>" class="btn btn-danger btn-xs pull-right mgn-top-8px"><i class="fa fa-times"></i> <?php lang('delete'); ?></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
require_once __DIR__ . '/../required.php';
|
||||
|
||||
redirectifnotloggedin();
|
||||
|
||||
$data = [
|
||||
"id" => "",
|
||||
"start" => "",
|
||||
"end" => "",
|
||||
"jobid" => "",
|
||||
];
|
||||
|
||||
$editing = false;
|
||||
if (isset($VARS['job']) && $database->has('job_tracking', ['id' => $VARS['job']])) {
|
||||
$editing = true;
|
||||
|
||||
$data = $database->get('job_tracking', [
|
||||
"id",
|
||||
"start",
|
||||
"end",
|
||||
"jobid"
|
||||
], [
|
||||
'id' => $VARS['job']
|
||||
]);
|
||||
}
|
||||
?>
|
||||
|
||||
<form role="form" action="action.php" method="POST">
|
||||
<div class="panel panel-blue">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">
|
||||
<?php if ($editing) { ?>
|
||||
<i class="fa fa-pencil"></i> <?php lang("edit job"); ?>
|
||||
<?php } else { ?>
|
||||
<i class="fa fa-plus"></i> <?php lang("new job"); ?>
|
||||
<?php } ?>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="job"><i class="fa fa-briefcase"></i> <?php lang("job"); ?></label>
|
||||
<select class="form-control" name="job" required>
|
||||
<option></option>
|
||||
<?php
|
||||
$jobs = [];
|
||||
if ($database->count("job_groups") > 0) {
|
||||
require_once __DIR__ . "/../lib/userinfo.php";
|
||||
$groups = getGroupsByUID($_SESSION['uid']);
|
||||
$gids = [];
|
||||
foreach ($groups as $g) {
|
||||
$gids[] = $g['id'];
|
||||
}
|
||||
$jobs = $database->select('jobs', ['[>]job_groups' => ['jobid']], ['jobs.jobid', 'jobname'], ["AND" => ['groupid' => $gids, 'deleted' => 0]]);
|
||||
} else {
|
||||
$jobs = $database->select('jobs', ['jobid', 'jobname'], ['deleted' => 0]);
|
||||
}
|
||||
|
||||
foreach ($jobs as $job) {
|
||||
?>
|
||||
<option value="<?php echo $job['jobid']; ?>"<?php echo ($job['jobid'] == $data['jobid'] ? " selected" : ""); ?>><?php echo $job['jobname']; ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="start"><i class="fa fa-play"></i> <?php lang("start"); ?></label>
|
||||
<input type="text" class="form-control" name="start" id="start" value="<?php echo is_empty($data['start']) ? "" : date("D F j Y g:i a", strtotime($data['start'])); ?>" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="end"><i class="fa fa-stop"></i> <?php lang("end"); ?></label>
|
||||
<input type="text" class="form-control" name="end" id="end" value="<?php echo is_empty($data['end']) ? "" : date("D F j Y g:i a", strtotime($data['end'])); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="jobid" value="<?php echo $VARS['job']; ?>" />
|
||||
<input type="hidden" name="action" value="editjobhistory" />
|
||||
<input type="hidden" name="source" value="jobs" />
|
||||
|
||||
<div class="panel-footer">
|
||||
<button type="submit" class="btn btn-success"><i class="fa fa-floppy-o"></i> <?php lang("save"); ?></button>
|
||||
<?php
|
||||
if ($editing) {
|
||||
?>
|
||||
<a href="action.php?action=deletejobhistory&source=jobs&jobid=<?php echo $VARS['job']; ?>" class="btn btn-danger btn-xs pull-right mgn-top-8px"><i class="fa fa-times"></i> <?php lang('delete'); ?></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
require_once __DIR__ . '/../required.php';
|
||||
|
||||
redirectifnotloggedin();
|
||||
?>
|
||||
<div class="btn-group mgn-btm-10px">
|
||||
<?php
|
||||
if (account_has_permission($_SESSION['username'], "QWIKCLOCK_ADMIN")) {
|
||||
?>
|
||||
<a href="app.php?page=editjob" class="btn btn-success"><i class="fa fa-plus"></i> <?php lang("add job"); ?></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<table id="jobtable" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-priority="0"></th>
|
||||
<th data-priority="1"><?php lang('actions'); ?></th>
|
||||
<th data-priority="1"><i class="fa fa-fw fa-briefcase hidden-xs"></i> <?php lang('name'); ?></th>
|
||||
<th data-priority="2"><i class="fa fa-fw fa-barcode hidden-xs"></i> <?php lang('code'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$jobs = $database->select('jobs', ['jobid (id)', 'jobname (name)', 'jobcode (code)', 'color'], ['deleted' => 0]);
|
||||
foreach ($jobs as $j) {
|
||||
echo "<tr><td></td><td>" . '<a class="btn btn-primary btn-xs" href="app.php?page=editjob&job=' . $j['id'] . '"><i class="fa fa-pencil-square-o"></i> ' . lang("edit", false) . '</a>' . "</td><td>" . '<span class="label label-' . $j['color'] . '"> </span> ' . $j['name'] . "</td><td>" . $j['code'] . "</td></tr>";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th data-priority="0"></th>
|
||||
<th data-priority="1"><?php lang('actions'); ?></th>
|
||||
<th data-priority="1"><i class="fa fa-fw fa-briefcase hidden-xs"></i> <?php lang('name'); ?></th>
|
||||
<th data-priority="2"><i class="fa fa-fw fa-barcode hidden-xs"></i> <?php lang('code'); ?></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
require_once __DIR__ . '/../required.php';
|
||||
|
||||
redirectifnotloggedin();
|
||||
?>
|
||||
<div class="btn-group mgn-btm-10px">
|
||||
<?php
|
||||
if (account_has_permission($_SESSION['username'], "QWIKCLOCK_ADMIN")) {
|
||||
?>
|
||||
<a href="app.php?page=editjobs" class="btn btn-primary"><i class="fa fa-pencil"></i> <?php lang("edit jobs"); ?></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<p class="page-header h5"><i class="fa fa-briefcase fa-fw"></i> <?php lang("select a job") ?></p>
|
||||
<div class="container" id="job-btn-bin">
|
||||
<?php
|
||||
$jobs = [];
|
||||
if ($database->count("job_groups") > 0) {
|
||||
require_once __DIR__ . "/../lib/userinfo.php";
|
||||
$groups = getGroupsByUID($_SESSION['uid']);
|
||||
$gids = [];
|
||||
foreach ($groups as $g) {
|
||||
$gids[] = $g['id'];
|
||||
}
|
||||
$jobs = $database->select('jobs', ['[>]job_groups' => ['jobid']], ['jobs.jobid', 'jobname', 'jobcode', 'color'], ["AND" => ['groupid' => $gids, 'deleted' => 0]]);
|
||||
} else {
|
||||
$jobs = $database->select('jobs', ['jobid', 'jobname', 'jobcode', 'color'], ['deleted' => 0]);
|
||||
}
|
||||
|
||||
foreach ($jobs as $job) {
|
||||
$color = "default";
|
||||
if (!is_null($job['color']) && $job['color'] != "") {
|
||||
$color = $job['color'];
|
||||
}
|
||||
?>
|
||||
<a class="job-btn" href="action.php?action=setjob&source=jobs&job=<?php echo $job['jobid']; ?>">
|
||||
<span class="btn btn-<?php echo $color; ?>"><?php echo $job['jobname']; ?></span>
|
||||
</a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<a class="job-btn" href="action.php?action=setjob&source=jobs&job=-1">
|
||||
<span class="btn btn-danger"><i class="fa fa-times"></i> <?php lang("none"); ?></span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<p class="page-header h5"><i class="fa fa-history fa-fw"></i> <?php lang("job history") ?></p>
|
||||
<table id="jobtable" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-priority="0"></th>
|
||||
<th data-priority="1"><?php lang('actions'); ?></th>
|
||||
<th data-priority="1"><i class="fa fa-fw fa-briefcase hidden-xs"></i> <?php lang('job'); ?></th>
|
||||
<th data-priority="2"><i class="fa fa-fw fa-play hidden-xs"></i> <?php lang('start'); ?></th>
|
||||
<th data-priority="2"><i class="fa fa-fw fa-stop hidden-xs"></i> <?php lang('stop'); ?></th>
|
||||
<th data-priority="3"><i class="fa fa-fw fa-user hidden-xs"></i> <?php lang('user'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th data-priority="0"></th>
|
||||
<th data-priority="1"><?php lang('actions'); ?></th>
|
||||
<th data-priority="1"><i class="fa fa-fw fa-briefcase hidden-xs"></i> <?php lang('job'); ?></th>
|
||||
<th data-priority="2"><i class="fa fa-fw fa-play hidden-xs"></i> <?php lang('start'); ?></th>
|
||||
<th data-priority="2"><i class="fa fa-fw fa-stop hidden-xs"></i> <?php lang('stop'); ?></th>
|
||||
<th data-priority="3"><i class="fa fa-fw fa-user hidden-xs"></i> <?php lang('user'); ?></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<script nonce="<?php echo $SECURE_NONCE; ?>">
|
||||
var lang_show_all = "<?php lang("show all"); ?>";
|
||||
</script>
|
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
|
||||
$(function () {
|
||||
$('#start').datetimepicker({
|
||||
format: "ddd MMMM D YYYY h:mm a",
|
||||
useCurrent: false
|
||||
});
|
||||
$('#end').datetimepicker({
|
||||
format: "ddd MMMM D YYYY h:mm a",
|
||||
useCurrent: false
|
||||
});
|
||||
});
|
@ -0,0 +1,34 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var jobtable = $('#jobtable').DataTable({
|
||||
responsive: {
|
||||
details: {
|
||||
display: $.fn.dataTable.Responsive.display.modal({
|
||||
header: function (row) {
|
||||
var data = row.data();
|
||||
return "<i class=\"fa fa-briefcase fa-fw\"></i> " + data[1];
|
||||
}
|
||||
}),
|
||||
renderer: $.fn.dataTable.Responsive.renderer.tableAll({
|
||||
tableClass: 'table'
|
||||
}),
|
||||
type: "column"
|
||||
}
|
||||
},
|
||||
columnDefs: [
|
||||
{
|
||||
targets: 0,
|
||||
className: 'control',
|
||||
orderable: false
|
||||
},
|
||||
{
|
||||
targets: 1,
|
||||
orderable: false
|
||||
}
|
||||
],
|
||||
order: [
|
||||
[2, 'desc']
|
||||
]
|
||||
});
|
@ -0,0 +1,53 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var jobtable = $('#jobtable').DataTable({
|
||||
responsive: {
|
||||
details: {
|
||||
display: $.fn.dataTable.Responsive.display.modal({
|
||||
header: function (row) {
|
||||
var data = row.data();
|
||||
return "<i class=\"fa fa-briefcase fa-fw\"></i> " + data[1];
|
||||
}
|
||||
}),
|
||||
renderer: $.fn.dataTable.Responsive.renderer.tableAll({
|
||||
tableClass: 'table'
|
||||
}),
|
||||
type: "column"
|
||||
}
|
||||
},
|
||||
columnDefs: [
|
||||
{
|
||||
targets: 0,
|
||||
className: 'control',
|
||||
orderable: false
|
||||
},
|
||||
{
|
||||
targets: 1,
|
||||
orderable: false
|
||||
},
|
||||
{
|
||||
targets: 5,
|
||||
orderable: false
|
||||
}
|
||||
],
|
||||
order: [
|
||||
[3, 'desc']
|
||||
],
|
||||
serverSide: true,
|
||||
ajax: {
|
||||
url: "lib/getjobhistorytable.php",
|
||||
data: function (d) {
|
||||
if ($('#show_all_checkbox').is(':checked')) {
|
||||
d.show_all = 1;
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
$('#jobtable_filter').append("<div class=\"checkbox inblock\"><label><input type=\"checkbox\" id=\"show_all_checkbox\"> " + lang_show_all + "</label></div>");
|
||||
|
||||
$('#show_all_checkbox').click(function () {
|
||||
jobtable.ajax.reload();
|
||||
});
|
Loading…
Reference in New Issue