2020-11-05 08:54:04 -05:00
|
|
|
<?php
|
2017-11-23 18:09:36 -05:00
|
|
|
$offset = 0;
|
2021-03-18 13:26:03 -04:00
|
|
|
if (isset($_GET['ajax'])) {
|
|
|
|
$constellation->render_incidents(false, $_GET['offset'], 5);
|
2017-11-23 18:09:36 -05:00
|
|
|
exit();
|
2021-03-18 13:26:03 -04:00
|
|
|
} else if (isset($_GET['offset'])) {
|
2017-11-23 18:09:36 -05:00
|
|
|
$offset = $_GET['offset'];
|
|
|
|
}
|
|
|
|
|
2021-03-18 13:26:03 -04:00
|
|
|
if (isset($_GET['new']) && $_GET['new'] == "incident") {
|
2017-11-23 18:09:36 -05:00
|
|
|
Incident::add();
|
|
|
|
}
|
|
|
|
|
2021-03-18 13:26:03 -04:00
|
|
|
if (isset($_GET['delete'])) {
|
2017-11-23 18:09:36 -05:00
|
|
|
Incident::delete($_GET['delete']);
|
|
|
|
}
|
2020-11-05 08:54:04 -05:00
|
|
|
if (isset($_GET['tasks'])) {
|
2021-03-18 13:26:03 -04:00
|
|
|
Queue::process_queue();
|
2020-11-05 08:54:04 -05:00
|
|
|
}
|
2017-11-23 18:09:36 -05:00
|
|
|
|
2021-03-19 14:38:54 -04:00
|
|
|
Template::render_header(_("Dashboard"), "dashboard", true);
|
2017-11-23 18:09:36 -05:00
|
|
|
?>
|
|
|
|
|
2021-03-18 13:26:03 -04:00
|
|
|
<div class="text-center">
|
|
|
|
<h1><?php echo _("Dashboard"); ?></h1>
|
|
|
|
<h3><?php echo _("Welcome"); ?> <?php echo $user->get_name(); ?></h3>
|
|
|
|
</div>
|
2017-11-23 18:09:36 -05:00
|
|
|
|
2021-03-18 13:26:03 -04:00
|
|
|
<div id="current">
|
|
|
|
<?php
|
|
|
|
$services = $constellation->render_status(true);
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
<div id="timeline">
|
|
|
|
<div class="item">
|
|
|
|
<div class="timeline">
|
|
|
|
<div class="line text-muted"></div>
|
|
|
|
<h3><?php echo _("New incident"); ?></h3>
|
2021-03-18 18:20:41 -04:00
|
|
|
<form id="new-incident" action="<?php echo WEB_URL; ?>/admin/?new=incident" method="POST">
|
2021-03-18 19:23:51 -04:00
|
|
|
<div class="servicelist">
|
2021-03-18 13:26:03 -04:00
|
|
|
<?php if (isset($message)) { ?>
|
|
|
|
<p class="alert alert-danger"><?php echo $message ?></p>
|
2017-11-23 18:09:36 -05:00
|
|
|
<?php
|
|
|
|
} ?>
|
2021-03-18 18:20:41 -04:00
|
|
|
<div id="status-container">
|
2021-03-18 13:26:03 -04:00
|
|
|
<?php
|
|
|
|
if (isset($_POST['services']) && !is_array($_POST['services'])) {
|
|
|
|
$post_services = array($_POST['services']);
|
|
|
|
} else {
|
|
|
|
$post_services = array();
|
|
|
|
}
|
2018-01-12 15:35:31 -05:00
|
|
|
|
2021-03-18 13:26:03 -04:00
|
|
|
foreach ($services as $service) {
|
|
|
|
?>
|
2021-03-19 06:35:11 -04:00
|
|
|
<div class="input-group mb-2">
|
2021-03-18 13:26:03 -04:00
|
|
|
<?php if ($service->get_status() != -1) { ?>
|
|
|
|
<div class="input-group-text service">
|
|
|
|
<input type="checkbox" name="services[]" value="<?php echo $service->get_id(); ?>" <?php echo (in_array($service->get_id(), $post_services)) ? "checked" : ''; ?> id="service-<?php echo $service->get_id(); ?>">
|
|
|
|
</div>
|
|
|
|
<label id="name" class="input-group-text form-control" for="service-<?php echo $service->get_id(); ?>"><?php echo $service->get_name(); ?></label>
|
|
|
|
<label id="status" class="input-group-text btn-<?php if ($service->get_status() != -1) {
|
|
|
|
echo $classes[$service->get_status()];
|
|
|
|
} ?>" for="service-<?php echo $service->get_id(); ?>"><?php echo $statuses[$service->get_status()]; ?></label>
|
|
|
|
<?php } ?>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
2017-11-23 18:09:36 -05:00
|
|
|
</div>
|
2018-01-12 18:57:13 -05:00
|
|
|
</div>
|
2021-03-18 11:48:31 -04:00
|
|
|
<article class="card new border-primary mb-3">
|
|
|
|
<div class="card-colore icon bg-primary"><i class="fa fa-info"></i></div>
|
|
|
|
<div class="card-colore card-header bg-primary border-primary">
|
2021-03-18 13:26:03 -04:00
|
|
|
<input type="text" name="title" id="title" placeholder="<?php echo _("Title"); ?>" value="<?php echo (isset($_POST['title']) ? htmlspecialchars($_POST['title']) : ''); ?>" required>
|
2021-03-18 11:48:31 -04:00
|
|
|
<span id="time" class="float-end">
|
2021-03-18 18:20:41 -04:00
|
|
|
<input id="time_input" type="text" pattern="(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))" name="time" value="<?php echo (isset($_POST['time']) ? htmlspecialchars($_POST['time']) : ''); ?>" title="Use ISO 8601 format (e.g. 2017-11-23T19:50:51+00:00)" placeholder="<?php echo _("Time"); ?>">
|
|
|
|
<input id="time_input_js" name="time_js" type="hidden">
|
2021-03-18 11:48:31 -04:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div class="card-body text-primary">
|
2021-03-18 13:26:03 -04:00
|
|
|
<p class="card-text"><textarea name="text" placeholder="<?php echo _("Here goes your text..."); ?>" required><?php echo (isset($_POST['text']) ? htmlspecialchars($_POST['text']) : ''); ?></textarea></p>
|
2021-03-18 11:48:31 -04:00
|
|
|
</div>
|
|
|
|
<div class="card-footer bg-transparent border-primary">
|
2021-03-18 13:26:03 -04:00
|
|
|
<small><?php echo _("Posted by"); ?>: <?php echo $user->get_username(); ?></small>
|
|
|
|
<span class="float-end" id="end_time_wrapper"><?php echo _("Ending"); ?>:
|
2021-03-18 18:20:41 -04:00
|
|
|
<input id="end_time" title="Use ISO 8601 format (e.g. 2017-11-23T19:50:51+00:00)" type="text" pattern="(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))" name="end_time" placeholder="<?php echo _("End time"); ?>" value="<?php echo (isset($_POST['end_time']) ? htmlspecialchars($_POST['end_time']) : ''); ?>">
|
|
|
|
<input id="end_time_js" name="end_time_js" type="hidden">
|
2021-03-18 11:48:31 -04:00
|
|
|
</span>
|
2018-01-12 18:57:13 -05:00
|
|
|
</div>
|
2021-03-18 11:48:31 -04:00
|
|
|
</article>
|
|
|
|
<div class="input-group">
|
|
|
|
<select class="form-select" id="type" name="type">
|
2020-11-05 08:54:04 -05:00
|
|
|
<?php
|
2021-03-18 13:26:03 -04:00
|
|
|
if (isset($_POST['type'])) {
|
2017-11-23 18:09:36 -05:00
|
|
|
$selected_status = $_POST['type'];
|
2021-03-18 13:26:03 -04:00
|
|
|
} else {
|
2017-11-23 18:09:36 -05:00
|
|
|
$selected_status = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($statuses as $key => $value) {
|
2021-03-18 13:26:03 -04:00
|
|
|
echo '<option value="' . $key . '"' . (($key == $selected_status) ? ' selected' : '') . '>' . $value . '</option>';
|
2017-11-23 18:09:36 -05:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
</select>
|
2021-03-18 18:21:39 -04:00
|
|
|
<button class="card-colore btn btn-secondary" type="submit"><?php echo _("Submit"); ?></button>
|
2021-03-18 11:48:31 -04:00
|
|
|
</div>
|
2021-03-18 13:26:03 -04:00
|
|
|
</form>
|
|
|
|
<?php
|
|
|
|
$constellation->render_incidents(true, $offset, 5, true);
|
|
|
|
$constellation->render_incidents(false, $offset, 5, true);
|
|
|
|
?>
|
2017-11-23 18:09:36 -05:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-03-18 13:26:03 -04:00
|
|
|
</div>
|