mirror of https://github.com/itflow-org/itflow
More Migration to AJAX Modal
This commit is contained in:
parent
650b8754e8
commit
e02d45db3e
17
accounts.php
17
accounts.php
|
|
@ -85,7 +85,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
?>
|
||||
|
||||
<tr>
|
||||
<td><a class="text-dark" href="#" data-toggle="modal" data-target="#editAccountModal<?php echo $account_id; ?>"><?php echo $account_name; ?></a></td>
|
||||
<td>
|
||||
<a class="text-dark" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_account_edit.php"
|
||||
data-ajax-id="<?php echo $account_id; ?>"
|
||||
>
|
||||
<?php echo $account_name; ?>
|
||||
</a>
|
||||
</td>
|
||||
<td><?php echo $account_currency_code; ?></td>
|
||||
<td class="text-right"><?php echo numfmt_format_currency($currency_format, $balance, $account_currency_code); ?></td>
|
||||
<td>
|
||||
|
|
@ -94,7 +102,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editAccountModal<?php echo $account_id; ?>">
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_account_edit.php"
|
||||
data-ajax-id="<?php echo $account_id; ?>"
|
||||
>
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<?php if ($balance == 0 && $account_id != $config_stripe_account) { //Cannot Archive an Account until it reaches 0 Balance and cant be selected as an online account ?>
|
||||
|
|
@ -109,7 +121,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
</tr>
|
||||
|
||||
<?php
|
||||
require "modals/account_edit_modal.php";
|
||||
}
|
||||
?>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
require_once '../includes/ajax_header.php';
|
||||
|
||||
$account_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_id = $account_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$account_name = nullable_htmlentities($row['account_name']);
|
||||
$account_notes = nullable_htmlentities($row['account_notes']);
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-piggy-bank mr-2"></i>Editing account: <strong><?php echo $account_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="account_id" value="<?php echo $account_id; ?>">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<div class="modal-body bg-white">
|
||||
<div class="form-group">
|
||||
<label>Account Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-piggy-bank"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" maxlength="200" value="<?php echo $account_name; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Notes</label>
|
||||
<textarea class="form-control" rows="5" placeholder="Enter some notes" name="notes"><?php echo $account_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_account" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
require_once "../includes/ajax_footer.php";
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
<?php
|
||||
|
||||
require_once '../includes/ajax_header.php';
|
||||
|
||||
$document_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_id = $document_id");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$client_id = intval($row['document_client_id']);
|
||||
$document_folder_id = nullable_htmlentities($row['document_folder_id']);
|
||||
$document_name = nullable_htmlentities($row['document_name']);
|
||||
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-file-alt mr-2"></i>Moving document: <strong><?php echo $document_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="document_id" value="<?php echo $document_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Move Document to</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="folder">
|
||||
<option value="0">/</option>
|
||||
<?php
|
||||
// Fetch all folders for the client
|
||||
$sql_all_folders = mysqli_query($mysqli, "SELECT folder_id, folder_name, parent_folder FROM folders WHERE folder_location = 0 AND folder_client_id = $client_id ORDER BY folder_name ASC");
|
||||
$folders = array();
|
||||
|
||||
// Build an associative array of folders indexed by folder_id
|
||||
while ($row = mysqli_fetch_assoc($sql_all_folders)) {
|
||||
$folders[$row['folder_id']] = array(
|
||||
'folder_id' => intval($row['folder_id']),
|
||||
'folder_name' => nullable_htmlentities($row['folder_name']),
|
||||
'parent_folder' => intval($row['parent_folder']),
|
||||
'children' => array()
|
||||
);
|
||||
}
|
||||
|
||||
// Build the folder hierarchy
|
||||
foreach ($folders as $id => &$folder) {
|
||||
if ($folder['parent_folder'] != 0 && isset($folders[$folder['parent_folder']])) {
|
||||
$folders[$folder['parent_folder']]['children'][] = &$folder;
|
||||
}
|
||||
}
|
||||
unset($folder); // Break the reference
|
||||
|
||||
// Prepare a list of root folders
|
||||
$root_folders = array();
|
||||
foreach ($folders as $id => $folder) {
|
||||
if ($folder['parent_folder'] == 0) {
|
||||
$root_folders[] = $folder;
|
||||
}
|
||||
}
|
||||
|
||||
// Display the folder options iteratively
|
||||
$stack = array();
|
||||
foreach (array_reverse($root_folders) as $folder) {
|
||||
$stack[] = array('folder' => $folder, 'level' => 0);
|
||||
}
|
||||
|
||||
while (!empty($stack)) {
|
||||
$node = array_pop($stack);
|
||||
$folder = $node['folder'];
|
||||
$level = $node['level'];
|
||||
|
||||
// Indentation for subfolders
|
||||
$indentation = str_repeat(' ', $level * 4);
|
||||
|
||||
// Check if this folder is selected
|
||||
$selected = '';
|
||||
if ($folder['folder_id'] == $document_folder_id) {
|
||||
$selected = 'selected';
|
||||
}
|
||||
|
||||
echo "<option value=\"{$folder['folder_id']}\" $selected>$indentation{$folder['folder_name']}</option>";
|
||||
|
||||
// Add children to the stack
|
||||
if (!empty($folder['children'])) {
|
||||
foreach (array_reverse($folder['children']) as $child_folder) {
|
||||
$stack[] = array('folder' => $child_folder, 'level' => $level + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="move_document" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Move</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
require_once "../includes/ajax_footer.php";
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
require_once '../includes/ajax_header.php';
|
||||
|
||||
$document_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_id = $document_id");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$client_id = intval($row['document_client_id']);
|
||||
$document_name = nullable_htmlentities($row['document_name']);
|
||||
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-file-alt mr-2"></i>Renaming document: <strong><?php echo $document_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="document_id" value="<?php echo $document_id; ?>">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Document Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-file-alt"></i></span>
|
||||
</div>
|
||||
<input class="form-control" type="text" name="name" maxlength="200" value="<?php echo $document_name; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="rename_document" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Rename</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
require_once "../includes/ajax_footer.php";
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
require_once '../includes/ajax_header.php';
|
||||
|
||||
// Initialize the HTML Purifier to prevent XSS
|
||||
require_once "../plugins/htmlpurifier/HTMLPurifier.standalone.php";
|
||||
|
||||
$purifier_config = HTMLPurifier_Config::createDefault();
|
||||
$purifier_config->set('Cache.DefinitionImpl', null); // Disable cache by setting a non-existent directory or an invalid one
|
||||
$purifier_config->set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'http' => true, 'https' => true]);
|
||||
$purifier = new HTMLPurifier($purifier_config);
|
||||
|
||||
$document_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_id = $document_id");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$document_name = nullable_htmlentities($row['document_name']);
|
||||
$document_content = $purifier->purify($row['document_content']);
|
||||
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title text-white"><i class="fa fa-fw fa-file-alt mr-2"></i><?php echo $document_name; ?></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body bg-white prettyContent">
|
||||
<?php echo $document_content; ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
require_once "../includes/ajax_footer.php";
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
<?php
|
||||
|
||||
require_once '../includes/ajax_header.php';
|
||||
|
||||
$file_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM files WHERE file_id = $file_id");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$client_id = intval($row['file_client_id']);
|
||||
$file_folder_id = nullable_htmlentities($row['file_folder_id']);
|
||||
$file_name = nullable_htmlentities($row['file_name']);
|
||||
$file_ext = nullable_htmlentities($row['file_ext']);
|
||||
if ($file_ext == 'pdf') {
|
||||
$file_icon = "file-pdf";
|
||||
} elseif ($file_ext == 'gz' || $file_ext == 'tar' || $file_ext == 'zip' || $file_ext == '7z' || $file_ext == 'rar') {
|
||||
$file_icon = "file-archive";
|
||||
} elseif ($file_ext == 'txt' || $file_ext == 'md') {
|
||||
$file_icon = "file-alt";
|
||||
} elseif ($file_ext == 'msg') {
|
||||
$file_icon = "envelope";
|
||||
} elseif ($file_ext == 'doc' || $file_ext == 'docx' || $file_ext == 'odt') {
|
||||
$file_icon = "file-word";
|
||||
} elseif ($file_ext == 'xls' || $file_ext == 'xlsx' || $file_ext == 'ods') {
|
||||
$file_icon = "file-excel";
|
||||
} elseif ($file_ext == 'pptx' || $file_ext == 'odp') {
|
||||
$file_icon = "file-powerpoint";
|
||||
} elseif ($file_ext == 'mp3' || $file_ext == 'wav' || $file_ext == 'ogg') {
|
||||
$file_icon = "file-audio";
|
||||
} elseif ($file_ext == 'mov' || $file_ext == 'mp4' || $file_ext == 'av1') {
|
||||
$file_icon = "file-video";
|
||||
} elseif ($file_ext == 'jpg' || $file_ext == 'jpeg' || $file_ext == 'png' || $file_ext == 'gif' || $file_ext == 'webp' || $file_ext == 'bmp' || $file_ext == 'tif') {
|
||||
$file_icon = "file-image";
|
||||
} else {
|
||||
$file_icon = "file";
|
||||
}
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-<?php echo $file_icon; ?> mr-2"></i>Moving File: <strong><?php echo $file_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="file_id" value="<?php echo $file_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Move File to</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="folder_id">
|
||||
<option value="0">/</option>
|
||||
<?php
|
||||
// Fetch all folders for the client
|
||||
$sql_all_folders = mysqli_query($mysqli, "SELECT folder_id, folder_name, parent_folder FROM folders WHERE folder_location = 1 AND folder_client_id = $client_id ORDER BY folder_name ASC");
|
||||
$folders = array();
|
||||
|
||||
// Build an associative array of folders indexed by folder_id
|
||||
while ($row = mysqli_fetch_assoc($sql_all_folders)) {
|
||||
$folders[$row['folder_id']] = array(
|
||||
'folder_id' => intval($row['folder_id']),
|
||||
'folder_name' => nullable_htmlentities($row['folder_name']),
|
||||
'parent_folder' => intval($row['parent_folder']),
|
||||
'children' => array()
|
||||
);
|
||||
}
|
||||
|
||||
// Build the folder hierarchy
|
||||
foreach ($folders as $id => &$folder) {
|
||||
if ($folder['parent_folder'] != 0 && isset($folders[$folder['parent_folder']])) {
|
||||
$folders[$folder['parent_folder']]['children'][] = &$folder;
|
||||
}
|
||||
}
|
||||
unset($folder); // Break the reference
|
||||
|
||||
// Prepare a list of root folders
|
||||
$root_folders = array();
|
||||
foreach ($folders as $id => $folder) {
|
||||
if ($folder['parent_folder'] == 0) {
|
||||
$root_folders[] = $folder;
|
||||
}
|
||||
}
|
||||
|
||||
// Display the folder options iteratively
|
||||
$stack = array();
|
||||
foreach (array_reverse($root_folders) as $folder) {
|
||||
$stack[] = array('folder' => $folder, 'level' => 0);
|
||||
}
|
||||
|
||||
while (!empty($stack)) {
|
||||
$node = array_pop($stack);
|
||||
$folder = $node['folder'];
|
||||
$level = $node['level'];
|
||||
|
||||
// Indentation for subfolders
|
||||
$indentation = str_repeat(' ', $level * 4);
|
||||
|
||||
// Check if this folder is selected
|
||||
$selected = '';
|
||||
if ($folder['folder_id'] == $file_folder_id) {
|
||||
$selected = 'selected';
|
||||
}
|
||||
|
||||
echo "<option value=\"{$folder['folder_id']}\" $selected>$indentation{$folder['folder_name']}</option>";
|
||||
|
||||
// Add children to the stack
|
||||
if (!empty($folder['children'])) {
|
||||
foreach (array_reverse($folder['children']) as $child_folder) {
|
||||
$stack[] = array('folder' => $child_folder, 'level' => $level + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="move_file" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Move</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
require_once "../includes/ajax_footer.php";
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
require_once '../includes/ajax_header.php';
|
||||
|
||||
$file_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM files WHERE file_id = $file_id");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$client_id = intval($row['file_client_id']);
|
||||
$file_name = nullable_htmlentities($row['file_name']);
|
||||
$file_description = nullable_htmlentities($row['file_description']);
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-<?php echo $file_icon; ?> mr-2"></i>Renaming file: <strong><?php echo $file_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="file_id" value="<?php echo $file_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>File Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="file_name" placeholder="File Name" maxlength="200" value="<?php echo $file_name; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="file_description" placeholder="Description" maxlength="250" value="<?php echo $file_description; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="rename_file" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Rename</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
require_once "../includes/ajax_footer.php";
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
require_once '../includes/ajax_header.php';
|
||||
|
||||
$folder_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM folders WHERE folder_id = $folder_id");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$folder_name = nullable_htmlentities($row['folder_name']);
|
||||
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-folder mr-2"></i>Renaming folder: <strong><?php echo $folder_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="folder_id" value="<?php echo $folder_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="folder_name" placeholder="Folder Name" maxlength="200" value="<?php echo $folder_name; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="rename_folder" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Rename</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
require_once "../includes/ajax_footer.php";
|
||||
|
|
@ -0,0 +1,275 @@
|
|||
<?php
|
||||
|
||||
require_once '../includes/ajax_header.php';
|
||||
|
||||
$location_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_id = $location_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$location_name = nullable_htmlentities($row['location_name']);
|
||||
$location_description = nullable_htmlentities($row['location_description']);
|
||||
$location_country = nullable_htmlentities($row['location_country']);
|
||||
$location_address = nullable_htmlentities($row['location_address']);
|
||||
$location_city = nullable_htmlentities($row['location_city']);
|
||||
$location_state = nullable_htmlentities($row['location_state']);
|
||||
$location_zip = nullable_htmlentities($row['location_zip']);
|
||||
$location_phone = formatPhoneNumber($row['location_phone']);
|
||||
$location_fax = formatPhoneNumber($row['location_fax']);
|
||||
$location_hours = nullable_htmlentities($row['location_hours']);
|
||||
$location_photo = nullable_htmlentities($row['location_photo']);
|
||||
$location_notes = nullable_htmlentities($row['location_notes']);
|
||||
$location_created_at = nullable_htmlentities($row['location_created_at']);
|
||||
$location_archived_at = nullable_htmlentities($row['location_archived_at']);
|
||||
$location_contact_id = intval($row['location_contact_id']);
|
||||
$client_id = intval($row['location_client_id']);
|
||||
$location_primary = intval($row['location_primary']);
|
||||
|
||||
// Tags
|
||||
$location_tag_id_array = array();
|
||||
$sql_location_tags = mysqli_query($mysqli, "SELECT * FROM location_tags WHERE location_id = $location_id");
|
||||
while ($row = mysqli_fetch_array($sql_location_tags)) {
|
||||
$location_tag_id = intval($row['tag_id']);
|
||||
$location_tag_id_array[] = $location_tag_id;
|
||||
}
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-map-marker-alt mr-2"></i>Editing location: <strong><?php echo $location_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<input type="hidden" name="location_id" value="<?php echo $location_id; ?>">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-details<?php echo $location_id; ?>">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-address<?php echo $location_id; ?>">Address</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-contact<?php echo $location_id; ?>">Contact</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-notes<?php echo $location_id; ?>">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content" <?php if (lookupUserPermission('module_client') <= 1) { echo 'inert'; } ?>>
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-details<?php echo $location_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Location Name <strong class="text-danger">*</strong> / <span class="text-secondary">Primary</span></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-map-marker"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name of location" maxlength="200" value="<?php echo $location_name; ?>" required>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="location_primary" value="1" <?php if ($location_primary == 1) { echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="description" placeholder="Short Description" value="<?php echo $location_description; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3" style="text-align: center;">
|
||||
<?php if (!empty($location_photo)) { ?>
|
||||
<img class="img-fluid" src="<?php echo "uploads/clients/$client_id/$location_photo"; ?>">
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Photo</label>
|
||||
<input type="file" class="form-control-file" name="file" accept="image/*">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-address<?php echo $location_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Address</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="address" placeholder="Street Address" maxlength="200" value="<?php echo $location_address; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>City</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-city"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="city" placeholder="City" maxlength="200" value="<?php echo $location_city; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>State / Province</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-flag"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="state" placeholder="State or Province" maxlength="200" value="<?php echo $location_state; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Postal Code</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fab fa-fw fa-usps"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="zip" placeholder="Zip or Postal Code" maxlength="200" value="<?php echo $location_zip; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Country</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-globe-americas"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="country">
|
||||
<option value="">- Country -</option>
|
||||
<?php foreach($countries_array as $country_name) { ?>
|
||||
<option <?php if ($location_country == $country_name) { echo "selected"; } ?>><?php echo $country_name; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-contact<?php echo $location_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Contact</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="contact">
|
||||
<option value="">- Contact -</option>
|
||||
<?php
|
||||
|
||||
$sql_contacts = mysqli_query($mysqli, "SELECT * FROM contacts WHERE (contact_archived_at > '$location_created_at' OR contact_archived_at IS NULL) AND contact_client_id = $client_id ORDER BY contact_archived_at ASC, contact_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_contacts)) {
|
||||
$contact_id_select = intval($row['contact_id']);
|
||||
$contact_name_select = nullable_htmlentities($row['contact_name']);
|
||||
$contact_archived_at = nullable_htmlentities($row['contact_archived_at']);
|
||||
if (empty($contact_archived_at)) {
|
||||
$contact_archived_display = "";
|
||||
} else {
|
||||
$contact_archived_display = "Archived - ";
|
||||
}
|
||||
|
||||
?>
|
||||
<option <?php if ($location_contact_id == $contact_id_select) { echo "selected"; } ?> value="<?php echo $contact_id_select; ?>"><?php echo "$contact_archived_display$contact_name_select"; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Phone</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-phone"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="phone" placeholder="Phone Number" maxlength="200" value="<?php echo $location_phone; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Fax</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-fax"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="fax" placeholder="Fax Number" maxlength="200" value="<?php echo $location_fax; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Hours</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-clock"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="hours" placeholder="Hours of operation" maxlength="200" value="<?php echo $location_hours; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-notes<?php echo $location_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" name="notes" placeholder="Notes, eg Parking Info, Building Access etc"><?php echo $location_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Tags</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-tags"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="tags[]" data-placeholder="Add some tags" multiple>
|
||||
<?php
|
||||
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 2 ORDER BY tag_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_tags_select)) {
|
||||
$tag_id_select = intval($row['tag_id']);
|
||||
$tag_name_select = nullable_htmlentities($row['tag_name']);
|
||||
?>
|
||||
<option value="<?php echo $tag_id_select; ?>" <?php if (in_array($tag_id_select, $location_tag_id_array)) { echo "selected"; } ?>><?php echo $tag_name_select; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="text-muted text-right">Location ID: <?= $location_id ?></p>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_location" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
require_once "../includes/ajax_footer.php";
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
<?php
|
||||
|
||||
require_once '../includes/ajax_header.php';
|
||||
|
||||
$product_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM products WHERE product_id = $product_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$product_name = nullable_htmlentities($row['product_name']);
|
||||
$product_description = nullable_htmlentities($row['product_description']);
|
||||
$product_price = floatval($row['product_price']);
|
||||
$product_created_at = nullable_htmlentities($row['product_created_at']);
|
||||
$category_id = intval($row['category_id']);
|
||||
$product_tax_id = intval($row['product_tax_id']);
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fas fa-fw fa-box-open mr-2"></i>Editing product: <strong><?php echo $product_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="product_id" value="<?php echo $product_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-box"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" maxlength="200" value="<?php echo $product_name; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Category <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-list"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="category" required>
|
||||
<?php
|
||||
|
||||
$sql_select = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Income' AND (category_archived_at > '$product_created_at' OR category_archived_at IS NULL)");
|
||||
while ($row = mysqli_fetch_array($sql_select)) {
|
||||
$category_id_select = intval($row['category_id']);
|
||||
$category_name_select = nullable_htmlentities($row['category_name']);
|
||||
?>
|
||||
<option <?php if ($category_id == $category_id_select) { echo "selected"; } ?> value="<?php echo $category_id_select; ?>"><?php echo $category_name_select; ?></option>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<a class="btn btn-secondary" href="admin_category.php?category=Income" target="_blank"><i class="fas fa-fw fa-plus"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label>Price <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-dollar-sign"></i></span>
|
||||
</div>
|
||||
<input type="text" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,2}" class="form-control" name="price" value="<?php echo number_format($product_price, 2, '.', ''); ?>" placeholder="0.00" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label>Tax</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-balance-scale"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="tax">
|
||||
<option value="0">None</option>
|
||||
<?php
|
||||
|
||||
$taxes_sql = mysqli_query($mysqli, "SELECT * FROM taxes WHERE (tax_archived_at > '$product_created_at' OR tax_archived_at IS NULL) ORDER BY tax_name ASC");
|
||||
while ($row = mysqli_fetch_array($taxes_sql)) {
|
||||
$tax_id_select = intval($row['tax_id']);
|
||||
$tax_name = nullable_htmlentities($row['tax_name']);
|
||||
$tax_percent = floatval($row['tax_percent']);
|
||||
?>
|
||||
<option <?php if ($tax_id_select == $product_tax_id) { echo "selected"; } ?> value="<?php echo $tax_id_select; ?>"><?php echo "$tax_name $tax_percent%"; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description</label>
|
||||
<textarea class="form-control" rows="5" name="description"><?php echo $product_description; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_product" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
require_once "../includes/ajax_footer.php";
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
|
||||
require_once '../includes/ajax_header.php';
|
||||
|
||||
$rack_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM racks WHERE rack_id = $rack_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$rack_name = nullable_htmlentities($row['rack_name']);
|
||||
$client_id = intval($row['rack_client_id']);
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-server mr-2"></i>Adding Device to Rack <strong><?php echo $rack_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<input type="hidden" name="rack_id" value="<?php echo $rack_id; ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Custom Device</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-server"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Device Name" maxlength="200">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Or Select a Device</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-desktop"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="asset">
|
||||
<option value="">- Select Asset -</option>
|
||||
<?php
|
||||
// Fetch IDs of all assets already assigned to any rack
|
||||
$assigned_assets = [];
|
||||
$assigned_sql = mysqli_query($mysqli, "SELECT unit_asset_id FROM rack_units");
|
||||
while ($assigned_row = mysqli_fetch_assoc($assigned_sql)) {
|
||||
$assigned_assets[] = intval($assigned_row['unit_asset_id']);
|
||||
}
|
||||
$assigned_assets_list = implode(',', $assigned_assets);
|
||||
$assigned_assets_list = empty($assigned_assets_list) ? '0' : $assigned_assets_list;
|
||||
|
||||
// Fetch assets not assigned to any rack
|
||||
$sql_assets = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_archived_at IS NULL AND asset_client_id = $client_id AND asset_id NOT IN ($assigned_assets_list) ORDER BY asset_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||
$asset_id = intval($row['asset_id']);
|
||||
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||
?>
|
||||
<option value="<?php echo $asset_id; ?>"><?php echo $asset_name; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Unit Number Start - End <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-sort-numeric-up-alt"></i></span>
|
||||
</div>
|
||||
<input type="number" class="form-control" name="unit_start" placeholder="Unit Start" min="1" max="<?php echo $rack_units; ?>" required>
|
||||
<input type="number" class="form-control" name="unit_end" placeholder="Unit End" min="1" max="<?php echo $rack_units; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_rack_unit" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Add to Rack</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
require_once "../includes/ajax_footer.php";
|
||||
|
|
@ -0,0 +1,180 @@
|
|||
<?php
|
||||
|
||||
require_once '../includes/ajax_header.php';
|
||||
|
||||
$rack_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM racks WHERE rack_id = $rack_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$rack_name = nullable_htmlentities($row['rack_name']);
|
||||
$rack_description = nullable_htmlentities($row['rack_description']);
|
||||
$rack_model = nullable_htmlentities($row['rack_model']);
|
||||
$rack_depth = nullable_htmlentities($row['rack_depth']);
|
||||
$rack_type = nullable_htmlentities($row['rack_type']);
|
||||
$rack_units = intval($row['rack_units']);
|
||||
$rack_photo = nullable_htmlentities($row['rack_photo']);
|
||||
$rack_physical_location = nullable_htmlentities($row['rack_physical_location']);
|
||||
$rack_notes = nullable_htmlentities($row['rack_notes']);
|
||||
$rack_location_id = nullable_htmlentities($row['rack_location_id']);
|
||||
$rack_created_at = nullable_htmlentities($row['rack_created_at']);
|
||||
$client_id = intval($row['rack_client_id']);
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-server mr-2"></i>Editing rack: <strong><?php echo $rack_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
|
||||
<input type="hidden" name="rack_id" value="<?php echo $rack_id; ?>">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-rack-details<?php echo $rack_id; ?>">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-rack-notes<?php echo $rack_id; ?>">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-rack-details<?php echo $rack_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-server"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Rack name" maxlength="200" value="<?php echo $rack_name; ?>" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="description" placeholder="Description of the rack" value="<?php echo $rack_description; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Type <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-server"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="type" required>
|
||||
<option value="">- Type -</option>
|
||||
<?php foreach($rack_type_select_array as $rack_type_select) { ?>
|
||||
<option <?php if ($rack_type == $rack_type_select) { echo "selected"; } ?>><?php echo $rack_type_select; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Model</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="make" placeholder="ex StarTech 12U Open Frame" maxlength="200" value="<?php echo $rack_model; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Depth</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-ruler"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="depth" placeholder="Rack Depth eg 800 mm or 31.5 Inches" maxlength="50" value="<?php echo $rack_depth; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Number of Units <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-sort-numeric-up-alt"></i></span>
|
||||
</div>
|
||||
<input type="number" class="form-control" name="units" placeholder="Number of Units" min="1" max="70" value="<?php echo $rack_units; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Physical Location</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="physical_location" placeholder="Physical location eg. Floor 2, Closet B" maxlength="200" value="<?php echo $rack_physical_location; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Location</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="location">
|
||||
<option value="">- Location -</option>
|
||||
<?php
|
||||
|
||||
$sql_location_select = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_archived_at IS NULL AND location_client_id = $client_id ORDER BY location_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_location_select)) {
|
||||
$location_id_select = intval($row['location_id']);
|
||||
$location_name_select = nullable_htmlentities($row['location_name']);
|
||||
?>
|
||||
<option <?php if ($rack_location_id == $location_id_select) { echo "selected"; } ?> value="<?php echo $location_id_select; ?>"><?php echo $location_name_select; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-rack-notes<?php echo $rack_id; ?>">
|
||||
|
||||
<?php if ($rack_photo) { ?>
|
||||
<img class="img-fluid p-3" alt="rack_photo" src="<?php echo "uploads/clients/$client_id/$rack_photo"; ?>">
|
||||
<?php } ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Upload Photo</label>
|
||||
<input type="file" class="form-control-file" name="file" accept="image/*">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="notes"><?php echo $rack_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_rack" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
require_once "../includes/ajax_footer.php";
|
||||
|
|
@ -0,0 +1,388 @@
|
|||
<?php
|
||||
|
||||
require_once '../includes/ajax_header.php';
|
||||
|
||||
$service_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM services WHERE service_id = $service_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$service_name = nullable_htmlentities($row['service_name']);
|
||||
$service_description = nullable_htmlentities($row['service_description']);
|
||||
$service_category = nullable_htmlentities($row['service_category']);
|
||||
$service_importance = nullable_htmlentities($row['service_importance']);
|
||||
$service_backup = nullable_htmlentities($row['service_backup']);
|
||||
$service_notes = nullable_htmlentities($row['service_notes']);
|
||||
$service_created_at = nullable_htmlentities($row['service_created_at']);
|
||||
$service_updated_at = nullable_htmlentities($row['service_updated_at']);
|
||||
$service_review_due = nullable_htmlentities($row['service_review_due']);
|
||||
$client_id = intval($row['service_client_id']);
|
||||
// Service Importance
|
||||
if ($service_importance == "High") {
|
||||
$service_importance_display = "<span class='p-2 badge badge-danger'>$service_importance</span>";
|
||||
} elseif ($service_importance == "Medium") {
|
||||
$service_importance_display = "<span class='p-2 badge badge-warning'>$service_importance</span>";
|
||||
} elseif ($service_importance == "Low") {
|
||||
$service_importance_display = "<span class='p-2 badge badge-info'>$service_importance</span>";
|
||||
} else {
|
||||
$service_importance_display = "-";
|
||||
}
|
||||
|
||||
// Associated Assets (and their logins/networks/locations)
|
||||
$sql_assets = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM service_assets
|
||||
LEFT JOIN assets ON service_assets.asset_id = assets.asset_id
|
||||
LEFT JOIN asset_interfaces ON interface_asset_id = assets.asset_id AND interface_primary = 1
|
||||
LEFT JOIN logins ON service_assets.asset_id = logins.login_asset_id
|
||||
LEFT JOIN networks ON interface_network_id = networks.network_id
|
||||
LEFT JOIN locations ON assets.asset_location_id = locations.location_id
|
||||
WHERE service_id = $service_id"
|
||||
);
|
||||
|
||||
// Associated logins
|
||||
$sql_logins = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM service_logins
|
||||
LEFT JOIN logins ON service_logins.login_id = logins.login_id
|
||||
WHERE service_id = $service_id"
|
||||
);
|
||||
|
||||
// Associated Domains
|
||||
$sql_domains = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM service_domains
|
||||
LEFT JOIN domains ON service_domains.domain_id = domains.domain_id
|
||||
WHERE service_id = $service_id"
|
||||
);
|
||||
// Associated Certificates
|
||||
$sql_certificates = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM service_certificates
|
||||
LEFT JOIN certificates ON service_certificates.certificate_id = certificates.certificate_id
|
||||
WHERE service_id = $service_id"
|
||||
);
|
||||
|
||||
// Associated URLs ---- REMOVED for now
|
||||
//$sql_urls = mysqli_query($mysqli, "SELECT * FROM service_urls
|
||||
//WHERE service_id = '$service_id'");
|
||||
|
||||
// Associated Vendors
|
||||
$sql_vendors = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM service_vendors
|
||||
LEFT JOIN vendors ON service_vendors.vendor_id = vendors.vendor_id
|
||||
WHERE service_id = $service_id"
|
||||
);
|
||||
|
||||
// Associated Contacts
|
||||
$sql_contacts = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM service_contacts
|
||||
LEFT JOIN contacts ON service_contacts.contact_id = contacts.contact_id
|
||||
WHERE service_id = $service_id"
|
||||
);
|
||||
|
||||
// Associated Documents
|
||||
$sql_docs = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM service_documents
|
||||
LEFT JOIN documents ON service_documents.document_id = documents.document_id
|
||||
WHERE service_id = $service_id"
|
||||
);
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title text-white"><i class="fa fa-fw fa-stream mr-2"></i><?php echo $service_name; ?></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body bg-white">
|
||||
<div class="row">
|
||||
|
||||
<!-- Main/Left side -->
|
||||
<div class="col-8 border-right">
|
||||
<div class="col-12">
|
||||
<h4>Service Overview: <?php echo "$service_name $service_importance_display"; ?></h4>
|
||||
<b>Description:</b> <?php echo $service_description; ?> <br>
|
||||
<b>Backup Info:</b> <?php echo $service_backup; ?> <br><br>
|
||||
|
||||
<h5><i class="fas fa-fw fa-sticky-note mr-2"></i>Notes</h5>
|
||||
<div style="white-space: pre-line"><?php echo $service_notes; ?></div>
|
||||
<hr>
|
||||
|
||||
<!-- Assets -->
|
||||
<?php
|
||||
if (mysqli_num_rows($sql_assets) > 0) { ?>
|
||||
<h5><i class="fas fa-fw fa-desktop mr-2"></i>Assets</h5>
|
||||
<ul>
|
||||
<?php
|
||||
// Reset the $sql_assets pointer to the start - as we've already cycled through once
|
||||
mysqli_data_seek($sql_assets, 0);
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||
if (!empty($row['interface_ip'])) {
|
||||
$ip = '('.nullable_htmlentities($row["interface_ip"]).')';
|
||||
} else {
|
||||
$ip = '';
|
||||
}
|
||||
echo "<li><a href=\"client_assets.php?client_id=$client_id&q=$row[asset_name]\">$row[asset_name] </a>$ip</li>";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Networks -->
|
||||
<?php
|
||||
if ($sql_assets) {
|
||||
|
||||
$networks = [];
|
||||
|
||||
// Reset the $sql_assets pointer to the start
|
||||
mysqli_data_seek($sql_assets, 0);
|
||||
|
||||
// Get networks linked to assets - push name to array
|
||||
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||
if (!empty($row['network_name'])) {
|
||||
$network_data = nullable_htmlentities("$row[network_name]:$row[network_vlan]");
|
||||
array_push($networks, $network_data);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove duplicates
|
||||
$networks = array_unique($networks);
|
||||
|
||||
// Display
|
||||
if (!empty($networks)) { ?>
|
||||
<h5><i class="fas fa-fw fa-network-wired mr-2"></i>Networks</h5>
|
||||
<ul>
|
||||
<?php
|
||||
}
|
||||
foreach($networks as $network) {
|
||||
$network = explode(":", $network);
|
||||
echo "<li><a href=\"client_networks.php?client_id=$client_id&q=$network[0]\">$network[0] </a>(VLAN $network[1])</li>";
|
||||
}
|
||||
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Locations -->
|
||||
<?php
|
||||
if ($sql_assets) {
|
||||
|
||||
$location_names = [];
|
||||
|
||||
// Reset the $sql_assets pointer to the start - as we've already cycled through once
|
||||
mysqli_data_seek($sql_assets, 0);
|
||||
|
||||
// Get locations linked to assets - push their name and vlan to arrays
|
||||
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||
if (!empty($row['location_name'])) {
|
||||
array_push($location_names, $row['location_name']);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove duplicates
|
||||
$location_names = array_unique($location_names);
|
||||
|
||||
// Display
|
||||
if (!empty($location_names)) { ?>
|
||||
<h5><i class="fas fa-fw fa-map-marker-alt mr-2"></i>Locations</h5>
|
||||
<ul>
|
||||
<?php
|
||||
}
|
||||
foreach($location_names as $location) {
|
||||
echo "<li><a href=\"client_locations.php?client_id=$client_id&q=$location\">$location</a></li>";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Domains -->
|
||||
<?php
|
||||
if (mysqli_num_rows($sql_domains) > 0) { ?>
|
||||
<h5><i class="fas fa-fw fa-globe mr-2"></i>Domains</h5>
|
||||
<ul>
|
||||
<?php
|
||||
// Reset the $sql_domains pointer to the start
|
||||
mysqli_data_seek($sql_domains, 0);
|
||||
|
||||
// Showing linked domains
|
||||
while ($row = mysqli_fetch_array($sql_domains)) {
|
||||
if (!empty($row['domain_name'])) {
|
||||
echo "<li><a href=\"client_domains.php?client_id=$client_id&q=$row[domain_name]\">$row[domain_name]</a></li>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Certificates -->
|
||||
<?php
|
||||
if (mysqli_num_rows($sql_certificates) > 0) { ?>
|
||||
<h5><i class="fas fa-fw fa-lock mr-2"></i>Certificates</h5>
|
||||
<ul>
|
||||
<?php
|
||||
// Reset the $sql_certificates pointer to the start
|
||||
mysqli_data_seek($sql_certificates, 0);
|
||||
|
||||
// Showing linked certs
|
||||
while ($row = mysqli_fetch_array($sql_certificates)) {
|
||||
if (!empty($row['certificate_name'])) {
|
||||
echo "<li><a href=\"client_certificates.php?client_id=$client_id&q=$row[certificate_name]\">$row[certificate_name] ($row[certificate_domain])</a></li>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Right side -->
|
||||
<div class="col-4">
|
||||
<div class="col-12">
|
||||
<h4>Additional Related Items</h4>
|
||||
<br>
|
||||
|
||||
<!-- Vendors -->
|
||||
<?php
|
||||
// Reset the $sql_vendors pointer to the start
|
||||
mysqli_data_seek($sql_vendors, 0);
|
||||
|
||||
if (mysqli_num_rows($sql_vendors) > 0) { ?>
|
||||
<h5><i class="fas fa-fw fa-building mr-2"></i>Vendors</h5>
|
||||
<ul>
|
||||
<?php
|
||||
while ($row = mysqli_fetch_array($sql_vendors)) {
|
||||
echo "<li><a href=\"client_vendors.php?client_id=$client_id&q=$row[vendor_name]\">$row[vendor_name]</a></li>";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Contacts -->
|
||||
<?php
|
||||
if (mysqli_num_rows($sql_contacts) > 0) { ?>
|
||||
<h5><i class="fas fa-fw fa-users mr-2"></i>Contacts</h5>
|
||||
<ul>
|
||||
<?php
|
||||
// Reset the $sql_contacts pointer to the start
|
||||
mysqli_data_seek($sql_contacts, 0);
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_contacts)) {
|
||||
echo "<li><a href=\"client_contact_details.php?client_id=$client_id&contact_id=$row[contact_id]\">$row[contact_name]</a></li>";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Logins -->
|
||||
<?php
|
||||
if (mysqli_num_rows($sql_assets) > 0 || mysqli_num_rows($sql_logins) > 0) { ?>
|
||||
<h5><i class="fas fa-fw fa-key mr-2"></i>Logins</h5>
|
||||
<ul>
|
||||
<?php
|
||||
// Reset the $sql_assets/logins pointer to the start
|
||||
mysqli_data_seek($sql_assets, 0);
|
||||
mysqli_data_seek($sql_logins, 0);
|
||||
|
||||
// Showing logins linked to assets
|
||||
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||
if (!empty($row['login_name'])) {
|
||||
echo "<li><a href=\"client_logins.php?client_id=$client_id&q=$row[login_name]\">$row[login_name]</a></li>";
|
||||
}
|
||||
}
|
||||
|
||||
// Showing explicitly linked logins
|
||||
while ($row = mysqli_fetch_array($sql_logins)) {
|
||||
if (!empty($row['login_name'])) {
|
||||
echo "<li><a href=\"client_logins.php?client_id=$client_id&q=$row[login_name]\">$row[login_name]</a></li>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- URLs -->
|
||||
<?php
|
||||
if ($sql_logins || $sql_assets) { ?>
|
||||
<h5><i class="fas fa-fw fa-link mr-2"></i>URLs</h5>
|
||||
<ul>
|
||||
<?php
|
||||
// Reset the $sql_logins pointer to the start
|
||||
mysqli_data_seek($sql_logins, 0);
|
||||
|
||||
// Showing URLs linked to logins
|
||||
while ($row = mysqli_fetch_array($sql_logins)) {
|
||||
if (!empty($row['login_uri'])) {
|
||||
echo "<li><a href=\"https://$row[login_uri]\">$row[login_uri]</a></li>";
|
||||
}
|
||||
}
|
||||
|
||||
// Reset the $sql_assets pointer to the start
|
||||
mysqli_data_seek($sql_assets, 0);
|
||||
|
||||
// Show URLs linked to assets, that also have logins
|
||||
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||
if (!empty($row['login_uri'])) {
|
||||
echo "<li><a href=\"https://$row[login_uri]\">$row[login_uri]</a></li>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Documents -->
|
||||
<?php
|
||||
if (mysqli_num_rows($sql_docs) > 0) { ?>
|
||||
<h5><i class="fas fa-fw fa-file-alt mr-2"></i>Documents</h5>
|
||||
<ul>
|
||||
<?php
|
||||
// Reset the $sql_docs pointer to the start
|
||||
mysqli_data_seek($sql_docs, 0);
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_docs)) {
|
||||
echo "<li><a href=\"client_document_details.php?client_id=$client_id&document_id=$row[document_id]\">$row[document_name]</a></li>";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- <h5><i class="nav-icon fas fa-file-alt"></i> Services</h5>-->
|
||||
<!-- <ul>-->
|
||||
<!-- <li>Related Service - Coming soon!</li>-->
|
||||
<!-- </ul>-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
require_once "../includes/ajax_footer.php";
|
||||
|
|
@ -0,0 +1,358 @@
|
|||
<?php
|
||||
|
||||
require_once '../includes/ajax_header.php';
|
||||
|
||||
$service_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM services WHERE service_id = $service_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$service_name = nullable_htmlentities($row['service_name']);
|
||||
$service_description = nullable_htmlentities($row['service_description']);
|
||||
$service_category = nullable_htmlentities($row['service_category']);
|
||||
$service_importance = nullable_htmlentities($row['service_importance']);
|
||||
$service_backup = nullable_htmlentities($row['service_backup']);
|
||||
$service_notes = nullable_htmlentities($row['service_notes']);
|
||||
$service_created_at = nullable_htmlentities($row['service_created_at']);
|
||||
$service_updated_at = nullable_htmlentities($row['service_updated_at']);
|
||||
$service_review_due = nullable_htmlentities($row['service_review_due']);
|
||||
$client_id = intval($row['service_client_id']);
|
||||
|
||||
// Associated Assets (and their logins/networks/locations)
|
||||
$sql_assets = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM service_assets
|
||||
LEFT JOIN assets ON service_assets.asset_id = assets.asset_id
|
||||
LEFT JOIN asset_interfaces ON interface_asset_id = assets.asset_id AND interface_primary = 1
|
||||
LEFT JOIN logins ON service_assets.asset_id = logins.login_asset_id
|
||||
LEFT JOIN networks ON interface_network_id = networks.network_id
|
||||
LEFT JOIN locations ON assets.asset_location_id = locations.location_id
|
||||
WHERE service_id = $service_id"
|
||||
);
|
||||
|
||||
// Associated logins
|
||||
$sql_logins = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM service_logins
|
||||
LEFT JOIN logins ON service_logins.login_id = logins.login_id
|
||||
WHERE service_id = $service_id"
|
||||
);
|
||||
|
||||
// Associated Domains
|
||||
$sql_domains = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM service_domains
|
||||
LEFT JOIN domains ON service_domains.domain_id = domains.domain_id
|
||||
WHERE service_id = $service_id"
|
||||
);
|
||||
// Associated Certificates
|
||||
$sql_certificates = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM service_certificates
|
||||
LEFT JOIN certificates ON service_certificates.certificate_id = certificates.certificate_id
|
||||
WHERE service_id = $service_id"
|
||||
);
|
||||
|
||||
// Associated URLs ---- REMOVED for now
|
||||
//$sql_urls = mysqli_query($mysqli, "SELECT * FROM service_urls
|
||||
//WHERE service_id = '$service_id'");
|
||||
|
||||
// Associated Vendors
|
||||
$sql_vendors = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM service_vendors
|
||||
LEFT JOIN vendors ON service_vendors.vendor_id = vendors.vendor_id
|
||||
WHERE service_id = $service_id"
|
||||
);
|
||||
|
||||
// Associated Contacts
|
||||
$sql_contacts = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM service_contacts
|
||||
LEFT JOIN contacts ON service_contacts.contact_id = contacts.contact_id
|
||||
WHERE service_id = $service_id"
|
||||
);
|
||||
|
||||
// Associated Documents
|
||||
$sql_docs = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM service_documents
|
||||
LEFT JOIN documents ON service_documents.document_id = documents.document_id
|
||||
WHERE service_id = $service_id"
|
||||
);
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title text-white"><i class="fa fa-fw fa-stream mr-2"></i>Editing service: <strong><?php echo $service_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id ?>">
|
||||
<input type="hidden" name="service_id" value="<?php echo $service_id ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-overview<?php echo $service_id ?>">Overview</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-general<?php echo $service_id ?>">General</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-assets<?php echo $service_id ?>">Assets</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-overview<?php echo $service_id ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-stream"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name of Service" maxlength="200" value="<?php echo $service_name ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-info-circle"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="description" placeholder="Description of Service" maxlength="200" value="<?php echo $service_description ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- //TODO: Integrate with company wide categories: /categories.php -->
|
||||
<div class="form-group">
|
||||
<label>Category</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-info"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="category" placeholder="Category" maxlength="20" value="<?php echo $service_category ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Importance</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-thermometer-half"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="importance" required>
|
||||
<option <?php if ($service_importance == 'Low') { echo "selected"; } ?> >Low</option>
|
||||
<option <?php if ($service_importance == 'Medium') { echo "selected"; } ?> >Medium</option>
|
||||
<option <?php if ($service_importance == 'High') { echo "selected"; } ?> >High</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Backup</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-hdd"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="backup" placeholder="Backup strategy" maxlength="200" value="<?php echo $service_backup ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Notes</label>
|
||||
<textarea class="form-control" rows="3" placeholder="Enter some notes" name="note"><?php echo $service_notes ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-general<?php echo $service_id ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="contacts">Contacts</label>
|
||||
<select multiple class="form-control select2" name="contacts[]">
|
||||
<?php
|
||||
// Get just the currently selected contact IDs
|
||||
$selected_ids = array_column(mysqli_fetch_all($sql_contacts, MYSQLI_ASSOC), "contact_id");
|
||||
|
||||
// Get all contacts
|
||||
// NOTE: These are called $sql_all and $row_all for a reason - anything overwriting $sql or $row will break the current while loop we are in from client_services.php
|
||||
|
||||
$sql_all = mysqli_query($mysqli, "SELECT * FROM contacts WHERE (contact_archived_at > '$service_created_at' OR contact_archived_at IS NULL) AND contact_client_id = $client_id");
|
||||
|
||||
while ($row_all = mysqli_fetch_array($sql_all)) {
|
||||
$contact_id = intval($row_all['contact_id']);
|
||||
$contact_name = nullable_htmlentities($row_all['contact_name']);
|
||||
|
||||
if (in_array($contact_id, $selected_ids)) {
|
||||
echo "<option value=\"$contact_id\" selected>$contact_name</option>";
|
||||
}
|
||||
else{
|
||||
echo "<option value=\"$contact_id\">$contact_name</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="vendors">Vendors</label>
|
||||
<select multiple class="form-control select2" name="vendors[]">
|
||||
<?php
|
||||
$selected_ids = array_column(mysqli_fetch_all($sql_vendors, MYSQLI_ASSOC), "vendor_id");
|
||||
|
||||
$sql_all = mysqli_query($mysqli, "SELECT * FROM vendors WHERE (vendor_archived_at > '$service_created_at' OR vendor_archived_at IS NULL) AND vendor_template = 0 AND vendor_client_id = $client_id");
|
||||
while ($row_all = mysqli_fetch_array($sql_all)) {
|
||||
$vendor_id = intval($row_all['vendor_id']);
|
||||
$vendor_name = nullable_htmlentities($row_all['vendor_name']);
|
||||
|
||||
if (in_array($vendor_id, $selected_ids)) {
|
||||
echo "<option value=\"$vendor_id\" selected>$vendor_name</option>";
|
||||
}
|
||||
else{
|
||||
echo "<option value=\"$vendor_id\">$vendor_name</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="documents">Documents</label>
|
||||
<select multiple class="form-control select2" name="documents[]">
|
||||
<?php
|
||||
$selected_ids = array_column(mysqli_fetch_all($sql_docs, MYSQLI_ASSOC), "document_id");
|
||||
|
||||
$sql_all = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_archived_at IS NULL AND document_client_id = $client_id");
|
||||
while ($row_all = mysqli_fetch_array($sql_all)) {
|
||||
$document_id = intval($row_all['document_id']);
|
||||
$document_name = nullable_htmlentities($row_all['document_name']);
|
||||
|
||||
if (in_array($document_id, $selected_ids)) {
|
||||
echo "<option value=\"$document_id\" selected>$document_name</option>";
|
||||
}
|
||||
else{
|
||||
echo "<option value=\"$document_id\">$document_name</option>";
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- TODO: Services related to other services -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tab-pane fade" id="pills-assets<?php echo $service_id ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="assets">Assets</label>
|
||||
<select multiple class="form-control select2" name="assets[]">
|
||||
<?php
|
||||
$selected_ids = array_column(mysqli_fetch_all($sql_assets, MYSQLI_ASSOC), "asset_id");
|
||||
|
||||
$sql_all = mysqli_query($mysqli, "SELECT * FROM assets WHERE (asset_archived_at > '$service_created_at' OR asset_archived_at IS NULL) AND asset_client_id = $client_id");
|
||||
while ($row_all = mysqli_fetch_array($sql_all)) {
|
||||
$asset_id = intval($row_all['asset_id']);
|
||||
$asset_name = nullable_htmlentities($row_all['asset_name']);
|
||||
|
||||
if (in_array($asset_id, $selected_ids)) {
|
||||
echo "<option value=\"$asset_id\" selected>$asset_name</option>";
|
||||
}
|
||||
else{
|
||||
echo "<option value=\"$asset_id\">$asset_name</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="logins">Logins</label>
|
||||
<select multiple class="form-control select2" name="logins[]">
|
||||
<?php
|
||||
$selected_ids = array_column(mysqli_fetch_all($sql_logins, MYSQLI_ASSOC), "login_id");
|
||||
|
||||
$sql_all = mysqli_query($mysqli, "SELECT * FROM logins WHERE (login_archived_at > '$service_created_at' OR login_archived_at IS NULL) AND login_client_id = $client_id");
|
||||
while ($row_all = mysqli_fetch_array($sql_all)) {
|
||||
$login_id = intval($row_all['login_id']);
|
||||
$login_name = nullable_htmlentities($row_all['login_name']);
|
||||
|
||||
if (in_array($login_id, $selected_ids)) {
|
||||
echo "<option value=\"$login_id\" selected>$login_name</option>";
|
||||
}
|
||||
else{
|
||||
echo "<option value=\"$login_id\">$login_name</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="domains">Domains</label>
|
||||
<select multiple class="form-control select2" name="domains[]">
|
||||
<?php
|
||||
$selected_ids = array_column(mysqli_fetch_all($sql_domains, MYSQLI_ASSOC), "domain_id");
|
||||
|
||||
$sql_all = mysqli_query($mysqli, "SELECT * FROM domains WHERE (domain_archived_at > '$service_created_at' OR domain_archived_at IS NULL) AND domain_client_id = $client_id");
|
||||
while ($row_all = mysqli_fetch_array($sql_all)) {
|
||||
$domain_id = intval($row_all['domain_id']);
|
||||
$domain_name = nullable_htmlentities($row_all['domain_name']);
|
||||
|
||||
if (in_array($domain_id, $selected_ids)) {
|
||||
echo "<option value=\"$domain_id\" selected>$domain_name</option>";
|
||||
}
|
||||
else{
|
||||
echo "<option value=\"$domain_id\">$domain_name</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="certificates">Certificates</label>
|
||||
<select multiple class="form-control select2" name="certificates[]">
|
||||
<?php
|
||||
$selected_ids = array_column(mysqli_fetch_all($sql_certificates, MYSQLI_ASSOC), "certificate_id");
|
||||
|
||||
$sql_all = mysqli_query($mysqli, "SELECT * FROM certificates WHERE (certificate_archived_at > '$service_created_at' OR certificate_archived_at IS NULL) AND certificate_client_id = $client_id");
|
||||
while ($row_all = mysqli_fetch_array($sql_all)) {
|
||||
$cert_id = intval($row_all['certificate_id']);
|
||||
$cert_name = nullable_htmlentities($row_all['certificate_name']);
|
||||
|
||||
if (in_array($cert_id, $selected_ids)) {
|
||||
echo "<option value=\"$cert_id\" selected>$cert_name</option>";
|
||||
}
|
||||
else{
|
||||
echo "<option value=\"$cert_id\">$cert_name</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_service" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
require_once "../includes/ajax_footer.php";
|
||||
|
|
@ -0,0 +1,283 @@
|
|||
<?php
|
||||
|
||||
require_once '../includes/ajax_header.php';
|
||||
|
||||
$software_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM software WHERE software_id = $software_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$software_name = nullable_htmlentities($row['software_name']);
|
||||
$software_description = nullable_htmlentities($row['software_description']);
|
||||
$software_version = nullable_htmlentities($row['software_version']);
|
||||
$software_type = nullable_htmlentities($row['software_type']);
|
||||
$software_license_type = nullable_htmlentities($row['software_license_type']);
|
||||
$software_key = nullable_htmlentities($row['software_key']);
|
||||
$software_seats = nullable_htmlentities($row['software_seats']);
|
||||
$software_purchase = nullable_htmlentities($row['software_purchase']);
|
||||
$software_expire = nullable_htmlentities($row['software_expire']);
|
||||
$software_notes = nullable_htmlentities($row['software_notes']);
|
||||
$software_created_at = nullable_htmlentities($row['software_created_at']);
|
||||
$client_id = intval($row['software_client_id']);
|
||||
$seat_count = 0;
|
||||
|
||||
// Device Licenses
|
||||
$asset_licenses_sql = mysqli_query($mysqli, "SELECT asset_id FROM software_assets WHERE software_id = $software_id");
|
||||
$asset_licenses_array = array();
|
||||
while ($row = mysqli_fetch_array($asset_licenses_sql)) {
|
||||
$asset_licenses_array[] = intval($row['asset_id']);
|
||||
$seat_count = $seat_count + 1;
|
||||
}
|
||||
$asset_licenses = implode(',', $asset_licenses_array);
|
||||
|
||||
// User Licenses
|
||||
$contact_licenses_sql = mysqli_query($mysqli, "SELECT contact_id FROM software_contacts WHERE software_id = $software_id");
|
||||
$contact_licenses_array = array();
|
||||
while ($row = mysqli_fetch_array($contact_licenses_sql)) {
|
||||
$contact_licenses_array[] = intval($row['contact_id']);
|
||||
$seat_count = $seat_count + 1;
|
||||
}
|
||||
$contact_licenses = implode(',', $contact_licenses_array);
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-cube mr-2"></i>Editing license: <strong><?php echo $software_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="software_id" value="<?php echo $software_id; ?>">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-details<?php echo $software_id; ?>">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-license<?php echo $software_id; ?>">License</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-device-licenses<?php echo $software_id; ?>">Devices</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-user-licenses<?php echo $software_id; ?>">Users</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-notes<?php echo $software_id; ?>">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-details<?php echo $software_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Software Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-cube"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Software name" maxlength="200" value="<?php echo $software_name; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Version</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-cube"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="version" placeholder="Software version" maxlength="200" value="<?php echo $software_version; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="description" placeholder="Short description" value="<?php echo $software_description; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Type <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="type" required>
|
||||
<?php foreach($software_types_array as $software_type_select) { ?>
|
||||
<option <?php if ($software_type == $software_type_select) { echo "selected"; } ?>><?php echo $software_type_select; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-license<?php echo $software_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>License Type</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-cube"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="license_type">
|
||||
<option value="">- Select a License Type -</option>
|
||||
<?php foreach($license_types_array as $license_type_select) { ?>
|
||||
<option <?php if ($license_type_select == $software_license_type) { echo "selected"; } ?>><?php echo $license_type_select; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Seats</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-cube"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*" name="seats" placeholder="Number of seats" value="<?php echo $software_seats; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>License Key</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-key"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="key" placeholder="License key" maxlength="200" value="<?php echo $software_key; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Purchase Date</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar-check"></i></span>
|
||||
</div>
|
||||
<input type="date" class="form-control" name="purchase" max="2999-12-31" value="<?php echo $software_purchase; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Expire</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar-times"></i></span>
|
||||
</div>
|
||||
<input type="date" class="form-control" name="expire" max="2999-12-31" value="<?php echo $software_expire; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-device-licenses<?php echo $software_id; ?>">
|
||||
|
||||
<ul class="list-group">
|
||||
|
||||
<li class="list-group-item bg-dark">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input"
|
||||
onclick="this.closest('.tab-pane').querySelectorAll('.asset-checkbox').forEach(checkbox => checkbox.checked = this.checked);"
|
||||
>
|
||||
<label class="form-check-label ml-3"><strong>Licensed Devices</strong></label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<?php
|
||||
$sql_assets_select = mysqli_query($mysqli, "SELECT * FROM assets LEFT JOIN contacts ON asset_contact_id = contact_id WHERE (asset_archived_at > '$software_created_at' OR asset_archived_at IS NULL) AND asset_client_id = $client_id ORDER BY asset_archived_at ASC, asset_name ASC");
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_assets_select)) {
|
||||
$asset_id_select = intval($row['asset_id']);
|
||||
$asset_name_select = nullable_htmlentities($row['asset_name']);
|
||||
$asset_type_select = nullable_htmlentities($row['asset_type']);
|
||||
$asset_archived_at = nullable_htmlentities($row['asset_archived_at']);
|
||||
if (empty($asset_archived_at)) {
|
||||
$asset_archived_display = "";
|
||||
} else {
|
||||
$asset_archived_display = "Archived - ";
|
||||
}
|
||||
$contact_name_select = nullable_htmlentities($row['contact_name']);
|
||||
|
||||
?>
|
||||
<li class="list-group-item">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input asset-checkbox" name="assets[]" value="<?php echo $asset_id_select; ?>" <?php if (in_array($asset_id_select, $asset_licenses_array)) { echo "checked"; } ?>>
|
||||
<label class="form-check-label ml-2"><?php echo "$asset_archived_display$asset_name_select - $contact_name_select"; ?></label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-user-licenses<?php echo $software_id; ?>">
|
||||
|
||||
<ul class="list-group">
|
||||
|
||||
<li class="list-group-item bg-dark">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" onclick="this.closest('.tab-pane').querySelectorAll('.user-checkbox').forEach(checkbox => checkbox.checked = this.checked);">
|
||||
<label class="form-check-label ml-3"><strong>Licensed Users</strong></label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php
|
||||
$sql_contacts_select = mysqli_query($mysqli, "SELECT * FROM contacts WHERE (contact_archived_at > '$software_created_at' OR contact_archived_at IS NULL) AND contact_client_id = $client_id ORDER BY contact_archived_at ASC, contact_name ASC");
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_contacts_select)) {
|
||||
$contact_id_select = intval($row['contact_id']);
|
||||
$contact_name_select = nullable_htmlentities($row['contact_name']);
|
||||
$contact_email_select = nullable_htmlentities($row['contact_email']);
|
||||
$contact_archived_at = nullable_htmlentities($row['contact_archived_at']);
|
||||
if (empty($contact_archived_at)) {
|
||||
$contact_archived_display = "";
|
||||
} else {
|
||||
$contact_archived_display = "Archived - ";
|
||||
}
|
||||
|
||||
?>
|
||||
<li class="list-group-item">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input user-checkbox" name="contacts[]" value="<?php echo $contact_id_select; ?>" <?php if (in_array("$contact_id_select", $contact_licenses_array)) { echo "checked"; } ?>>
|
||||
<label class="form-check-label ml-2"><?php echo "$contact_archived_display$contact_name_select - $contact_email_select"; ?></label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-notes<?php echo $software_id; ?>">
|
||||
|
||||
<textarea class="form-control" rows="12" placeholder="Enter some notes" name="notes"><?php echo $software_notes; ?></textarea>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_software" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
require_once "../includes/ajax_footer.php";
|
||||
|
|
@ -0,0 +1,312 @@
|
|||
<?php
|
||||
|
||||
require_once '../includes/ajax_header.php';
|
||||
|
||||
$ticket_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM tickets LEFT JOIN clients ON client_id = ticket_client_id WHERE ticket_id = $ticket_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$client_id = intval($row['client_id']);
|
||||
$client_name = nullable_htmlentities($row['client_name']);
|
||||
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
|
||||
$ticket_number = intval($row['ticket_number']);
|
||||
$ticket_category = intval($row['ticket_category']);
|
||||
$ticket_subject = nullable_htmlentities($row['ticket_subject']);
|
||||
$ticket_details = nullable_htmlentities($row['ticket_details']);
|
||||
$ticket_priority = nullable_htmlentities($row['ticket_priority']);
|
||||
$ticket_billable = intval($row['ticket_billable']);
|
||||
$ticket_vendor_ticket_number = nullable_htmlentities($row['ticket_vendor_ticket_number']);
|
||||
$ticket_created_at = nullable_htmlentities($row['ticket_created_at']);
|
||||
$contact_id = intval($row['ticket_contact_id']);
|
||||
$asset_id = intval($row['ticket_asset_id']);
|
||||
$location_id = intval($row['ticket_location_id']);
|
||||
$vendor_id = intval($row['ticket_vendor_id']);
|
||||
$project_id = intval($row['ticket_project_id']);
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-life-ring mr-2"></i>Editing ticket: <strong><?php echo "$ticket_prefix$ticket_number"; ?></strong> - <?php echo $client_name; ?></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="ticket_id" value="<?php echo $ticket_id; ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-details<?php echo $ticket_id; ?>"><i class="fa fa-fw fa-life-ring mr-2"></i>Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-contacts<?php echo $ticket_id; ?>"><i class="fa fa-fw fa-users mr-2"></i>Contact</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-assignment<?php echo $ticket_id; ?>"><i class="fa fa-fw fa-desktop mr-2"></i>Assignment</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-details<?php echo $ticket_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Subject <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="subject" maxlength="500" value="<?php echo $ticket_subject; ?>" placeholder="Subject" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control tinymce" rows="8" name="details"><?php echo $ticket_details; ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label>Priority <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-thermometer-half"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="priority" required>
|
||||
<option <?php if ($ticket_priority == 'Low') { echo "selected"; } ?> >Low</option>
|
||||
<option <?php if ($ticket_priority == 'Medium') { echo "selected"; } ?> >Medium</option>
|
||||
<option <?php if ($ticket_priority == 'High') { echo "selected"; } ?> >High</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label>Category</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-layer-group"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="category">
|
||||
<option value="0">- Uncategorized -</option>
|
||||
<?php
|
||||
$sql_categories = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Ticket' AND category_archived_at IS NULL");
|
||||
while ($row = mysqli_fetch_array($sql_categories)) {
|
||||
$category_id = intval($row['category_id']);
|
||||
$category_name = nullable_htmlentities($row['category_name']);
|
||||
|
||||
?>
|
||||
<option <?php if ($ticket_category == $category_id) {echo "selected";} ?> value="<?php echo $category_id; ?>"><?php echo $category_name; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($config_module_enable_accounting && lookupUserPermission("module_sales") >= 2) { ?>
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" name="billable" <?php if ($ticket_billable == 1) { echo "checked"; } ?> value="1" id="billableSwitch<?php echo $ticket_id; ?>">
|
||||
<label class="custom-control-label" for="billableSwitch<?php echo $ticket_id; ?>">Mark Billable</label>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-contacts<?php echo $ticket_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Contact</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="contact">
|
||||
<option value="0">No One</option>
|
||||
<?php
|
||||
$sql_client_contacts_select = mysqli_query($mysqli, "SELECT contact_id, contact_name, contact_title, contact_primary, contact_technical FROM contacts WHERE contact_client_id = $client_id AND contact_archived_at IS NULL ORDER BY contact_primary DESC, contact_technical DESC, contact_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_client_contacts_select)) {
|
||||
$contact_id_select = intval($row['contact_id']);
|
||||
$contact_name_select = nullable_htmlentities($row['contact_name']);
|
||||
$contact_primary_select = intval($row['contact_primary']);
|
||||
if($contact_primary_select == 1) {
|
||||
$contact_primary_display_select = " (Primary)";
|
||||
} else {
|
||||
$contact_primary_display_select = "";
|
||||
}
|
||||
$contact_technical_select = intval($row['contact_technical']);
|
||||
if($contact_technical_select == 1) {
|
||||
$contact_technical_display_select = " (Technical)";
|
||||
} else {
|
||||
$contact_technical_display_select = "";
|
||||
}
|
||||
$contact_title_select = nullable_htmlentities($row['contact_title']);
|
||||
if(!empty($contact_title_select)) {
|
||||
$contact_title_display_select = " - $contact_title_select";
|
||||
} else {
|
||||
$contact_title_display_select = "";
|
||||
}
|
||||
|
||||
?>
|
||||
<option value="<?php echo $contact_id_select; ?>" <?php if ($contact_id_select == $contact_id) { echo "selected"; } ?>><?php echo "$contact_name_select$contact_title_display_select$contact_primary_display_select$contact_technical_display_select"; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($config_smtp_host)) { ?>
|
||||
<div class="form-group">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="contact_notify" value="1" id="checkNotifyContact">
|
||||
<label class="form-check-label" for="checkNotifyContact">
|
||||
Send email notification
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-assignment<?php echo $ticket_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Asset</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-desktop"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="asset">
|
||||
<option value="0">- None -</option>
|
||||
<?php
|
||||
|
||||
$sql_assets = mysqli_query($mysqli, "SELECT asset_id, asset_name, contact_name FROM assets LEFT JOIN contacts ON contact_id = asset_contact_id WHERE asset_client_id = $client_id AND asset_archived_at IS NULL ORDER BY asset_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||
$asset_id_select = intval($row['asset_id']);
|
||||
$asset_name_select = nullable_htmlentities($row['asset_name']);
|
||||
$asset_contact_name_select = nullable_htmlentities($row['contact_name']);
|
||||
?>
|
||||
<option <?php if ($asset_id == $asset_id_select) { echo "selected"; } ?> value="<?php echo $asset_id_select; ?>"><?php echo "$asset_name_select - $asset_contact_name_select"; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Location</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="location">
|
||||
<option value="0">- None -</option>
|
||||
<?php
|
||||
|
||||
$sql_locations = mysqli_query($mysqli, "SELECT location_id, location_name FROM locations WHERE location_client_id = $client_id AND location_archived_at IS NULL ORDER BY location_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_locations)) {
|
||||
$location_id_select = intval($row['location_id']);
|
||||
$location_name_select = nullable_htmlentities($row['location_name']);
|
||||
?>
|
||||
<option <?php if ($location_id == $location_id_select) { echo "selected"; } ?> value="<?php echo $location_id_select; ?>"><?php echo $location_name_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Vendor</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-building"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="vendor">
|
||||
<option value="0">- None -</option>
|
||||
<?php
|
||||
|
||||
$sql_vendors = mysqli_query($mysqli, "SELECT vendor_id, vendor_name FROM vendors WHERE vendor_client_id = $client_id AND vendor_template = 0 AND vendor_archived_at IS NULL ORDER BY vendor_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_vendors)) {
|
||||
$vendor_id_select = intval($row['vendor_id']);
|
||||
$vendor_name_select = nullable_htmlentities($row['vendor_name']);
|
||||
?>
|
||||
<option <?php if ($vendor_id == $vendor_id_select) { echo "selected"; } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Vendor Ticket Number</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="vendor_ticket_number" placeholder="Vendor ticket number" value="<?php echo $ticket_vendor_ticket_number; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Project</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-project-diagram"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="project">
|
||||
<option value="0">- None -</option>
|
||||
<?php
|
||||
|
||||
$sql_projects = mysqli_query($mysqli, "SELECT project_id, project_name FROM projects WHERE (project_client_id = $client_id OR project_client_id = 0) AND project_completed_at IS NULL AND project_archived_at IS NULL ORDER BY project_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_projects)) {
|
||||
$project_id_select = intval($row['project_id']);
|
||||
$project_name_select = nullable_htmlentities($row['project_name']); ?>
|
||||
<option <?php if ($project_id == $project_id_select) { echo "selected"; } ?> value="<?php echo $project_id_select; ?>"><?php echo $project_name_select; ?></option>
|
||||
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_ticket" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<?php
|
||||
require_once "../includes/ajax_footer.php";
|
||||
|
|
@ -0,0 +1,168 @@
|
|||
<?php
|
||||
|
||||
require_once '../includes/ajax_header.php';
|
||||
|
||||
$trip_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM trips WHERE trip_id = $trip_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$trip_date = nullable_htmlentities($row['trip_date']);
|
||||
$trip_purpose = nullable_htmlentities($row['trip_purpose']);
|
||||
$trip_source = nullable_htmlentities($row['trip_source']);
|
||||
$trip_destination = nullable_htmlentities($row['trip_destination']);
|
||||
$trip_miles = number_format(floatval($row['trip_miles']),1);
|
||||
$trip_user_id = intval($row['trip_user_id']);
|
||||
$trip_created_at = nullable_htmlentities($row['trip_created_at']);
|
||||
$trip_archived_at = nullable_htmlentities($row['trip_archived_at']);
|
||||
$round_trip = nullable_htmlentities($row['round_trip']);
|
||||
$client_id = intval($row['client_id']);
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fas fa-fw fa-copy mr-2"></i>Copying Trip</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col">
|
||||
<label>Date <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||
</div>
|
||||
<input type="date" class="form-control" name="date" max="2999-12-31" value="<?php echo date("Y-m-d"); ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col">
|
||||
<label>Miles <strong class="text-danger">*</strong> / <span class="text-secondary">Roundtrip</span></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-bicycle"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,1}" name="miles" value="<?php echo $trip_miles; ?>" placeholder="0.0" required>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="roundtrip" value="1" <?php if ($round_trip == 1) { echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Location <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-map-marker-alt"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="source" maxlength="200" value="<?php echo $trip_source; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-arrow-right"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="destination" data-tags="true" data-placeholder="- Select / Input Destination -" required>
|
||||
<option><?php echo $trip_destination; ?></option>
|
||||
<?php
|
||||
|
||||
$sql_locations_select = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_archived_at IS NULL AND location_client_id = $client_id ORDER BY location_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_locations_select)) {
|
||||
$location_name = nullable_htmlentities($row['location_name']);
|
||||
$location_address = nullable_htmlentities($row['location_address']);
|
||||
$location_city = nullable_htmlentities($row['location_city']);
|
||||
$location_state = nullable_htmlentities($row['location_state']);
|
||||
$location_zip = nullable_htmlentities($row['location_zip']);
|
||||
$location_full_address = "$location_address $location_city $location_state $location_zip";
|
||||
|
||||
?>
|
||||
<option><?php echo $location_full_address; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Purpose <strong class="text-danger">*</strong></label>
|
||||
<textarea rows="4" class="form-control" placeholder="Enter a purpose" name="purpose" maxlength="200" required><?php echo $trip_purpose; ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Driver</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="user" required>
|
||||
<option value="">- Driver -</option>
|
||||
<?php
|
||||
|
||||
$sql_users = mysqli_query($mysqli, "SELECT users.user_id, user_name FROM users
|
||||
LEFT JOIN user_settings on users.user_id = user_settings.user_id
|
||||
WHERE user_role > 1 AND user_archived_at IS NULL ORDER BY user_name ASC"
|
||||
);
|
||||
while ($row = mysqli_fetch_array($sql_users)) {
|
||||
$user_id_select = intval($row['user_id']);
|
||||
$user_name_select = nullable_htmlentities($row['user_name']);
|
||||
?>
|
||||
<option <?php if ($trip_user_id == $user_id_select) { echo "selected"; } ?> value="<?php echo $user_id_select; ?>"><?php echo $user_name_select; ?></option>
|
||||
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (isset($_GET['client_id'])) { ?>
|
||||
<input type="hidden" name="client" value="<?php echo $client_id; ?>">
|
||||
<?php } else { ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Client</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="client">
|
||||
<option value="">- Client (Optional) -</option>
|
||||
<?php
|
||||
|
||||
$sql_clients = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at IS NULL ORDER BY client_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_clients)) {
|
||||
$client_id_select = intval($row['client_id']);
|
||||
$client_name_select = nullable_htmlentities($row['client_name']);
|
||||
?>
|
||||
<option <?php if ($client_id == $client_id_select) { echo "selected"; } ?> value="<?php echo $client_id_select; ?>"><?php echo $client_name_select; ?></option>
|
||||
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_trip" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Copy</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
require_once "../includes/ajax_footer.php";
|
||||
|
|
@ -0,0 +1,179 @@
|
|||
<?php
|
||||
|
||||
require_once '../includes/ajax_header.php';
|
||||
|
||||
$trip_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM trips WHERE trip_id = $trip_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$trip_date = nullable_htmlentities($row['trip_date']);
|
||||
$trip_purpose = nullable_htmlentities($row['trip_purpose']);
|
||||
$trip_source = nullable_htmlentities($row['trip_source']);
|
||||
$trip_destination = nullable_htmlentities($row['trip_destination']);
|
||||
$trip_miles = number_format(floatval($row['trip_miles']),1);
|
||||
$trip_user_id = intval($row['trip_user_id']);
|
||||
$trip_created_at = nullable_htmlentities($row['trip_created_at']);
|
||||
$trip_archived_at = nullable_htmlentities($row['trip_archived_at']);
|
||||
$round_trip = nullable_htmlentities($row['round_trip']);
|
||||
$client_id = intval($row['client_id']);
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-route mr-2"></i>Editing Trip</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<div class="modal-body bg-white">
|
||||
<input type="hidden" name="trip_id" value="<?php echo $trip_id; ?>">
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col">
|
||||
<label>Date <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||
</div>
|
||||
<input type="date" class="form-control" name="date" max="2999-12-31" value="<?php echo $trip_date; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col">
|
||||
<label>Miles <strong class="text-danger">*</strong> / <span class="text-secondary">Roundtrip</span></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-bicycle"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,1}" name="miles" value="<?php echo $trip_miles; ?>" placeholder="0.0" required>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="roundtrip" value="1" <?php if ($round_trip == 1) { echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Location <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-map-marker-alt"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="source" maxlength="200" value="<?php echo $trip_source; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-arrow-right"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="destination" data-tags="true" data-placeholder="- Select / Input Destination -" required>
|
||||
<option><?php echo $trip_destination; ?></option>
|
||||
<?php
|
||||
|
||||
$sql_locations_select = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_archived_at IS NULL AND location_client_id = $client_id ORDER BY location_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_locations_select)) {
|
||||
$location_name = nullable_htmlentities($row['location_name']);
|
||||
$location_address = nullable_htmlentities($row['location_address']);
|
||||
$location_city = nullable_htmlentities($row['location_city']);
|
||||
$location_state = nullable_htmlentities($row['location_state']);
|
||||
$location_zip = nullable_htmlentities($row['location_zip']);
|
||||
$location_full_address = "$location_address $location_city $location_state $location_zip";
|
||||
|
||||
?>
|
||||
<option><?php echo $location_full_address; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Purpose <strong class="text-danger">*</strong></label>
|
||||
<textarea rows="4" class="form-control" name="purpose" placeholder="Enter a purpose" maxlength="200" required><?php echo $trip_purpose; ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Driver</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="user" required>
|
||||
<option value="">- Driver -</option>
|
||||
<?php
|
||||
|
||||
$sql_users = mysqli_query($mysqli, "SELECT * FROM users
|
||||
LEFT JOIN user_settings on users.user_id = user_settings.user_id
|
||||
WHERE (users.user_id = $trip_user_id) OR (user_archived_at IS NULL AND user_status = 1) ORDER BY user_name ASC"
|
||||
);
|
||||
while ($row = mysqli_fetch_array($sql_users)) {
|
||||
$user_id_select = intval($row['user_id']);
|
||||
$user_name_select = nullable_htmlentities($row['user_name']);
|
||||
?>
|
||||
<option <?php if ($trip_user_id == $user_id_select) { echo "selected"; } ?> value="<?php echo $user_id_select; ?>"><?php echo $user_name_select; ?></option>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (isset($_GET['client_id'])) { ?>
|
||||
<input type="hidden" name="client" value="<?php echo $client_id; ?>">
|
||||
<?php } else { ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Client</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="client">
|
||||
<option value="">- Client (Optional) -</option>
|
||||
<?php
|
||||
|
||||
$sql_clients = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at > '$trip_created_at' OR client_archived_at IS NULL ORDER BY client_archived_at ASC, client_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_clients)) {
|
||||
$client_id_select = intval($row['client_id']);
|
||||
$client_name_select = nullable_htmlentities($row['client_name']);
|
||||
$client_archived_at = nullable_htmlentities($row['client_archived_at']);
|
||||
if (empty($client_archived_at)) {
|
||||
$client_archived_display = "";
|
||||
} else {
|
||||
$client_archived_display = "Archived - ";
|
||||
}
|
||||
?>
|
||||
<option <?php if ($client_id == $client_id_select) { echo "selected"; } ?> value="<?php echo $client_id_select; ?>"><?php echo "$client_archived_display$client_name_select"; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_trip" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
require_once "../includes/ajax_footer.php";
|
||||
|
|
@ -0,0 +1,211 @@
|
|||
<?php
|
||||
|
||||
require_once '../includes/ajax_header.php';
|
||||
|
||||
$vendor_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_id = $vendor_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$vendor_name = nullable_htmlentities($row['vendor_name']);
|
||||
$vendor_description = nullable_htmlentities($row['vendor_description']);
|
||||
$vendor_account_number = nullable_htmlentities($row['vendor_account_number']);
|
||||
$vendor_contact_name = nullable_htmlentities($row['vendor_contact_name']);
|
||||
$vendor_phone = formatPhoneNumber($row['vendor_phone']);
|
||||
$vendor_extension = nullable_htmlentities($row['vendor_extension']);
|
||||
$vendor_email = nullable_htmlentities($row['vendor_email']);
|
||||
$vendor_website = nullable_htmlentities($row['vendor_website']);
|
||||
$vendor_hours = nullable_htmlentities($row['vendor_hours']);
|
||||
$vendor_sla = nullable_htmlentities($row['vendor_sla']);
|
||||
$vendor_code = nullable_htmlentities($row['vendor_code']);
|
||||
$vendor_notes = nullable_htmlentities($row['vendor_notes']);
|
||||
$vendor_template_id = intval($row['vendor_template_id']);
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fas fa-fw fa-building mr-2"></i>Editing vendor: <strong><?php echo $vendor_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="vendor_id" value="<?php echo $vendor_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-details<?php echo $vendor_id; ?>">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-support<?php echo $vendor_id; ?>">Support</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-notes<?php echo $vendor_id; ?>">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-details<?php echo $vendor_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Vendor Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-building"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Vendor Name" maxlength="200" value="<?php echo "$vendor_name"; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="description" placeholder="Description" maxlength="200" value="<?php echo $vendor_description; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Account Number</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-fingerprint"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="account_number" placeholder="Account number" maxlength="200" value="<?php echo $vendor_account_number; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Account Manager</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="contact_name" maxlength="200" value="<?php echo $vendor_contact_name; ?>" placeholder="Vendor contact name">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Template Base</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-puzzle-piece"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="vendor_template_id">
|
||||
<option value="0">- None -</option>
|
||||
<?php
|
||||
|
||||
$sql_vendor_templates = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_template = 1 AND vendor_archived_at IS NULL ORDER BY vendor_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_vendor_templates)) {
|
||||
$vendor_template_id_select = $row['vendor_id'];
|
||||
$vendor_template_name_select = nullable_htmlentities($row['vendor_name']); ?>
|
||||
<option <?php if ($vendor_template_id == $vendor_template_id_select) { echo "selected"; } ?> value="<?php echo $vendor_template_id_select; ?>"><?php echo $vendor_template_name_select; ?></option>
|
||||
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-support<?php echo $vendor_id; ?>">
|
||||
|
||||
<label>Support Phone</label>
|
||||
<div class="form-row">
|
||||
<div class="col-8">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-phone"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="phone" placeholder="Phone Number" maxlength="200" value="<?php echo $vendor_phone; ?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="text" class="form-control" name="extension" placeholder="Prompts" maxlength="200" value="<?php echo $vendor_extension; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Support Hours</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="hours" placeholder="Support Hours" maxlength="200" value="<?php echo $vendor_hours; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Support Email</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-envelope"></i></span>
|
||||
</div>
|
||||
<input type="email" class="form-control" name="email" placeholder="Support Email" maxlength="200" value="<?php echo $vendor_email; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Support Website URL</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-globe"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="website" placeholder="Do not include http(s)://" maxlength="200" value="<?php echo $vendor_website; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>SLA</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-handshake"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="sla" placeholder="SLA Response Time" maxlength="200" value="<?php echo $vendor_sla; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Pin/Code</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-key"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="code" placeholder="Access Code or Pin" maxlength="200" value="<?php echo $vendor_code; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-notes<?php echo $vendor_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="12" placeholder="Enter some notes" name="notes"><?php echo $vendor_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
<p class="text-muted text-right">Vendor ID: <?= $vendor_id ?></p>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_vendor" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
require_once "../includes/ajax_footer.php";
|
||||
|
|
@ -87,395 +87,401 @@ while ($folder_id > 0) {
|
|||
|
||||
?>
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2">
|
||||
<i class="fa fa-fw fa-folder mr-2"></i>Documents
|
||||
</h3>
|
||||
<div class="card-tools">
|
||||
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2">
|
||||
<i class="fa fa-fw fa-folder mr-2"></i>Documents
|
||||
</h3>
|
||||
<div class="card-tools">
|
||||
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addDocumentModal">
|
||||
<i class="fas fa-plus mr-2"></i>New Document
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#createFolderModal">
|
||||
<i class="fa fa-fw fa-folder-plus mr-2"></i>New Folder
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addDocumentFromTemplateModal">From Template</a>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addDocumentModal">
|
||||
<i class="fas fa-plus mr-2"></i>New Document
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#createFolderModal">
|
||||
<i class="fa fa-fw fa-folder-plus mr-2"></i>New Folder
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addDocumentFromTemplateModal">From Template</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<input type="hidden" name="folder_id" value="<?php echo $get_folder_id; ?>">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="input-group mb-3 mb-md-0">
|
||||
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search documents in <?php if($get_folder_id == 0) { echo "all folders"; } else { echo "current folder"; } ?>">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<input type="hidden" name="folder_id" value="<?php echo $get_folder_id; ?>">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="input-group mb-3 mb-md-0">
|
||||
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search documents in <?php if($get_folder_id == 0) { echo "all folders"; } else { echo "current folder"; } ?>">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="btn-group float-right">
|
||||
<div class="dropdown ml-2" id="bulkActionButton" hidden>
|
||||
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown">
|
||||
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>)
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkMoveDocumentModal">
|
||||
<i class="fas fa-fw fa-exchange-alt mr-2"></i>Move
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<button class="dropdown-item text-danger text-bold"
|
||||
type="submit" form="bulkActions" name="bulk_delete_documents">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="btn-group float-right">
|
||||
<div class="dropdown ml-2" id="bulkActionButton" hidden>
|
||||
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown">
|
||||
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>)
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<hr>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3 border-right mb-3">
|
||||
<h4>Folders</h4>
|
||||
<hr>
|
||||
<ul class="nav nav-pills flex-column bg-light">
|
||||
<li class="nav-item">
|
||||
<div class="row">
|
||||
<div class="col-10">
|
||||
<?php
|
||||
// Get a count of documents that have no folder
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('document_id') AS num FROM documents WHERE document_folder_id = 0 AND document_client_id = $client_id AND document_archived_at IS NULL"));
|
||||
$num_documents = intval($row['num']);
|
||||
?>
|
||||
<a class="nav-link <?php if ($get_folder_id == 0) { echo "active"; } ?>" href="?client_id=<?php echo $client_id; ?>&folder_id=0">
|
||||
/ <?php if ($num_documents > 0) { echo "<span class='badge badge-pill badge-dark float-right mt-1'>$num_documents</span>"; } ?>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
// Function to check if a folder is an ancestor of the current folder
|
||||
function is_ancestor_folder($folder_id, $current_folder_id, $client_id) {
|
||||
global $mysqli;
|
||||
|
||||
// Base case: if current_folder_id is 0 or equal to folder_id
|
||||
if ($current_folder_id == 0) {
|
||||
return false;
|
||||
}
|
||||
if ($current_folder_id == $folder_id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get the parent folder of the current folder
|
||||
$result = mysqli_query($mysqli, "SELECT parent_folder FROM folders WHERE folder_id = $current_folder_id AND folder_client_id = $client_id");
|
||||
if ($row = mysqli_fetch_assoc($result)) {
|
||||
$parent_folder_id = intval($row['parent_folder']);
|
||||
// Recursive call to check the parent folder
|
||||
return is_ancestor_folder($folder_id, $parent_folder_id, $client_id);
|
||||
} else {
|
||||
// Folder not found
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Recursive function to display folders and subfolders
|
||||
function display_folders($parent_folder_id, $client_id, $indent = 0) {
|
||||
global $mysqli, $get_folder_id, $session_user_role;
|
||||
|
||||
$sql_folders = mysqli_query($mysqli, "SELECT * FROM folders WHERE parent_folder = $parent_folder_id AND folder_location = 0 AND folder_client_id = $client_id ORDER BY folder_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_folders)) {
|
||||
$folder_id = intval($row['folder_id']);
|
||||
$folder_name = nullable_htmlentities($row['folder_name']);
|
||||
|
||||
// Get the number of documents in the folder
|
||||
$row2 = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('document_id') AS num FROM documents WHERE document_folder_id = $folder_id AND document_archived_at IS NULL"));
|
||||
$num_documents = intval($row2['num']);
|
||||
|
||||
// Get the number of subfolders
|
||||
$subfolder_result = mysqli_query($mysqli, "SELECT COUNT(*) AS count FROM folders WHERE parent_folder = $folder_id AND folder_client_id = $client_id");
|
||||
$subfolder_count = intval(mysqli_fetch_assoc($subfolder_result)['count']);
|
||||
|
||||
echo '<li class="nav-item">';
|
||||
echo '<div class="row">';
|
||||
echo '<div class="col-10">';
|
||||
echo '<a class="nav-link ';
|
||||
if ($get_folder_id == $folder_id) { echo "active"; }
|
||||
echo '" href="?client_id=' . $client_id . '&folder_id=' . $folder_id . '">';
|
||||
|
||||
// Indentation for subfolders
|
||||
echo str_repeat(' ', $indent * 4);
|
||||
|
||||
// Determine if the folder is open
|
||||
if ($get_folder_id == $folder_id || is_ancestor_folder($folder_id, $get_folder_id, $client_id)) {
|
||||
echo '<i class="fas fa-fw fa-folder-open"></i>';
|
||||
} else {
|
||||
echo '<i class="fas fa-fw fa-folder"></i>';
|
||||
}
|
||||
|
||||
echo ' ' . $folder_name;
|
||||
|
||||
if ($num_documents > 0) {
|
||||
echo "<span class='badge badge-pill badge-dark float-right mt-1'>$num_documents</span>";
|
||||
}
|
||||
|
||||
echo '</a>';
|
||||
echo '</div>';
|
||||
echo '<div class="col-2">';
|
||||
?>
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-sm" type="button" data-toggle="dropdown">
|
||||
<i class="fas fa-ellipsis-v"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkMoveDocumentModal">
|
||||
<i class="fas fa-fw fa-exchange-alt mr-2"></i>Move
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_folder_rename.php"
|
||||
data-ajax-id="<?php echo $folder_id; ?>"
|
||||
>
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Rename
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<button class="dropdown-item text-danger text-bold"
|
||||
type="submit" form="bulkActions" name="bulk_delete_documents">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<hr>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3 border-right mb-3">
|
||||
<h4>Folders</h4>
|
||||
<hr>
|
||||
<ul class="nav nav-pills flex-column bg-light">
|
||||
<li class="nav-item">
|
||||
<div class="row">
|
||||
<div class="col-10">
|
||||
<?php
|
||||
// Get a count of documents that have no folder
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('document_id') AS num FROM documents WHERE document_folder_id = 0 AND document_client_id = $client_id AND document_archived_at IS NULL"));
|
||||
$num_documents = intval($row['num']);
|
||||
?>
|
||||
<a class="nav-link <?php if ($get_folder_id == 0) { echo "active"; } ?>" href="?client_id=<?php echo $client_id; ?>&folder_id=0">
|
||||
/ <?php if ($num_documents > 0) { echo "<span class='badge badge-pill badge-dark float-right mt-1'>$num_documents</span>"; } ?>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
// Only show delete option if user is admin, folder has no documents, and no subfolders
|
||||
if ($session_user_role == 3 && $num_documents == 0 && $subfolder_count == 0) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_folder=<?php echo $folder_id; ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
|
||||
if ($subfolder_count > 0) {
|
||||
// Display subfolders
|
||||
echo '<ul class="nav nav-pills flex-column bg-light">';
|
||||
display_folders($folder_id, $client_id, $indent + 1);
|
||||
echo '</ul>';
|
||||
}
|
||||
|
||||
echo '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
// Start displaying folders from the root (parent_folder = 0)
|
||||
display_folders(0, $client_id);
|
||||
?>
|
||||
</ul>
|
||||
<?php require_once "modals/folder_create_modal.php"; ?>
|
||||
</div>
|
||||
|
||||
<div class="col-md-9">
|
||||
|
||||
<nav>
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="?client_id=<?php echo $client_id; ?>&folder_id=0">
|
||||
<i class="fas fa-fw fa-folder mr-2"></i>Root
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
// Function to check if a folder is an ancestor of the current folder
|
||||
function is_ancestor_folder($folder_id, $current_folder_id, $client_id) {
|
||||
global $mysqli;
|
||||
// Output breadcrumb items for each folder in the path
|
||||
foreach ($folder_path as $folder) {
|
||||
$bread_crumb_folder_id = $folder['folder_id']; // Already Sanitized before it was pushed into array
|
||||
$bread_crumb_folder_name = $folder['folder_name']; // Already Sanitized before it was pushed into array
|
||||
|
||||
// Base case: if current_folder_id is 0 or equal to folder_id
|
||||
if ($current_folder_id == 0) {
|
||||
return false;
|
||||
}
|
||||
if ($current_folder_id == $folder_id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get the parent folder of the current folder
|
||||
$result = mysqli_query($mysqli, "SELECT parent_folder FROM folders WHERE folder_id = $current_folder_id AND folder_client_id = $client_id");
|
||||
if ($row = mysqli_fetch_assoc($result)) {
|
||||
$parent_folder_id = intval($row['parent_folder']);
|
||||
// Recursive call to check the parent folder
|
||||
return is_ancestor_folder($folder_id, $parent_folder_id, $client_id);
|
||||
} else {
|
||||
// Folder not found
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Recursive function to display folders and subfolders
|
||||
function display_folders($parent_folder_id, $client_id, $indent = 0) {
|
||||
global $mysqli, $get_folder_id, $session_user_role;
|
||||
|
||||
$sql_folders = mysqli_query($mysqli, "SELECT * FROM folders WHERE parent_folder = $parent_folder_id AND folder_location = 0 AND folder_client_id = $client_id ORDER BY folder_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_folders)) {
|
||||
$folder_id = intval($row['folder_id']);
|
||||
$folder_name = nullable_htmlentities($row['folder_name']);
|
||||
|
||||
// Get the number of documents in the folder
|
||||
$row2 = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('document_id') AS num FROM documents WHERE document_folder_id = $folder_id AND document_archived_at IS NULL"));
|
||||
$num_documents = intval($row2['num']);
|
||||
|
||||
// Get the number of subfolders
|
||||
$subfolder_result = mysqli_query($mysqli, "SELECT COUNT(*) AS count FROM folders WHERE parent_folder = $folder_id AND folder_client_id = $client_id");
|
||||
$subfolder_count = intval(mysqli_fetch_assoc($subfolder_result)['count']);
|
||||
|
||||
echo '<li class="nav-item">';
|
||||
echo '<div class="row">';
|
||||
echo '<div class="col-10">';
|
||||
echo '<a class="nav-link ';
|
||||
if ($get_folder_id == $folder_id) { echo "active"; }
|
||||
echo '" href="?client_id=' . $client_id . '&folder_id=' . $folder_id . '">';
|
||||
|
||||
// Indentation for subfolders
|
||||
echo str_repeat(' ', $indent * 4);
|
||||
|
||||
// Determine if the folder is open
|
||||
if ($get_folder_id == $folder_id || is_ancestor_folder($folder_id, $get_folder_id, $client_id)) {
|
||||
echo '<i class="fas fa-fw fa-folder-open"></i>';
|
||||
} else {
|
||||
echo '<i class="fas fa-fw fa-folder"></i>';
|
||||
}
|
||||
|
||||
echo ' ' . $folder_name;
|
||||
|
||||
if ($num_documents > 0) {
|
||||
echo "<span class='badge badge-pill badge-dark float-right mt-1'>$num_documents</span>";
|
||||
}
|
||||
|
||||
echo '</a>';
|
||||
echo '</div>';
|
||||
echo '<div class="col-2">';
|
||||
?>
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-sm" type="button" data-toggle="dropdown">
|
||||
<i class="fas fa-ellipsis-v"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#renameFolderModal<?php echo $folder_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Rename
|
||||
</a>
|
||||
<?php
|
||||
// Only show delete option if user is admin, folder has no documents, and no subfolders
|
||||
if ($session_user_role == 3 && $num_documents == 0 && $subfolder_count == 0) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_folder=<?php echo $folder_id; ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
|
||||
// Include the rename and create subfolder modals
|
||||
require "modals/folder_rename_modal.php";
|
||||
|
||||
if ($subfolder_count > 0) {
|
||||
// Display subfolders
|
||||
echo '<ul class="nav nav-pills flex-column bg-light">';
|
||||
display_folders($folder_id, $client_id, $indent + 1);
|
||||
echo '</ul>';
|
||||
}
|
||||
|
||||
echo '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
// Start displaying folders from the root (parent_folder = 0)
|
||||
display_folders(0, $client_id);
|
||||
?>
|
||||
</ul>
|
||||
<?php require_once "modals/folder_create_modal.php"; ?>
|
||||
</div>
|
||||
|
||||
<div class="col-md-9">
|
||||
|
||||
<nav>
|
||||
<ol class="breadcrumb">
|
||||
?>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="?client_id=<?php echo $client_id; ?>&folder_id=0">
|
||||
<i class="fas fa-fw fa-folder mr-2"></i>Root
|
||||
<a href="?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $bread_crumb_folder_id; ?>">
|
||||
<i class="fas fa-fw fa-folder-open mr-2"></i><?php echo $bread_crumb_folder_name; ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
// Output breadcrumb items for each folder in the path
|
||||
foreach ($folder_path as $folder) {
|
||||
$bread_crumb_folder_id = $folder['folder_id']; // Already Sanitized before it was pushed into array
|
||||
$bread_crumb_folder_name = $folder['folder_name']; // Already Sanitized before it was pushed into array
|
||||
}
|
||||
?>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<form id="bulkActions" action="post.php" method="post">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table table-border">
|
||||
<thead class="thead-light <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<td class="bg-light pr-0">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
|
||||
</div>
|
||||
</td>
|
||||
<th>
|
||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_name&order=<?php echo $disp; ?>">
|
||||
Name <?php if ($sort == 'document_name') { echo $order_icon; } ?>
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_created_at&order=<?php echo $disp; ?>">
|
||||
Created <?php if ($sort == 'document_created_at') { echo $order_icon; } ?>
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_updated_at&order=<?php echo $disp; ?>">
|
||||
Last Update <?php if ($sort == 'document_updated_at') { echo $order_icon; } ?>
|
||||
</a>
|
||||
</th>
|
||||
<th></th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$document_id = intval($row['document_id']);
|
||||
$document_name = nullable_htmlentities($row['document_name']);
|
||||
$document_description = nullable_htmlentities($row['document_description']);
|
||||
$document_content = nullable_htmlentities($row['document_content']);
|
||||
$document_created_by_name = nullable_htmlentities($row['user_name']);
|
||||
$document_created_at = date("m/d/Y",strtotime($row['document_created_at']));
|
||||
$document_updated_at = date("m/d/Y",strtotime($row['document_updated_at']));
|
||||
$document_folder_id = intval($row['document_folder_id']);
|
||||
|
||||
// Check if shared
|
||||
$sql_shared = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM shared_items
|
||||
WHERE item_client_id = $client_id
|
||||
AND item_active = 1
|
||||
AND item_views != item_view_limit
|
||||
AND item_expire_at > NOW()
|
||||
AND item_type = 'Document'
|
||||
AND item_related_id = $document_id
|
||||
LIMIT 1"
|
||||
);
|
||||
$row = mysqli_fetch_array($sql_shared);
|
||||
$item_id = intval($row['item_id']);
|
||||
$item_active = nullable_htmlentities($row['item_active']);
|
||||
$item_key = nullable_htmlentities($row['item_key']);
|
||||
$item_type = nullable_htmlentities($row['item_type']);
|
||||
$item_related_id = intval($row['item_related_id']);
|
||||
$item_note = nullable_htmlentities($row['item_note']);
|
||||
$item_recipient = nullable_htmlentities($row['item_recipient']);
|
||||
$item_views = nullable_htmlentities($row['item_views']);
|
||||
$item_view_limit = nullable_htmlentities($row['item_view_limit']);
|
||||
$item_created_at = nullable_htmlentities($row['item_created_at']);
|
||||
$item_expire_at = nullable_htmlentities($row['item_expire_at']);
|
||||
$item_expire_at_human = timeAgo($row['item_expire_at']);
|
||||
|
||||
?>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $bread_crumb_folder_id; ?>">
|
||||
<i class="fas fa-fw fa-folder-open mr-2"></i><?php echo $bread_crumb_folder_name; ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<form id="bulkActions" action="post.php" method="post">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table table-border">
|
||||
<thead class="thead-light <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<td class="bg-light pr-0">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
|
||||
<input class="form-check-input bulk-select" type="checkbox" name="document_ids[]" value="<?php echo $document_id ?>">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<a href="client_document_details.php?client_id=<?php echo $client_id; ?>&document_id=<?php echo $document_id; ?>"><i class="fas fa-fw fa-file-alt"></i> <?php echo $document_name; ?></a>
|
||||
<div class="text-secondary mt-1"><?php echo $document_description; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $document_created_at; ?>
|
||||
<div class="text-secondary mt-1"><?php echo $document_created_by_name; ?>
|
||||
</td>
|
||||
<td><?php echo $document_updated_at; ?></td>
|
||||
<td>
|
||||
<?php if (mysqli_num_rows($sql_shared) > 0) { ?>
|
||||
<div class="media" title="Expires <?php echo $item_expire_at_human; ?>">
|
||||
<i class="fas fa-link mr-2 mt-1"></i>
|
||||
<div class="media-body">Shared
|
||||
<br>
|
||||
<small class="text-secondary"><?php echo $item_recipient; ?></small>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
||||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-modal-size="lg"
|
||||
data-ajax-url="ajax/ajax_document_view.php"
|
||||
data-ajax-id="<?php echo $document_id; ?>"
|
||||
>
|
||||
<i class="fas fa-fw fa-eye mr-2"></i>Quick View
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#shareModal" onclick="populateShareModal(<?php echo "$client_id, 'Document', $document_id"; ?>)">
|
||||
<i class="fas fa-fw fa-share mr-2"></i>Share
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_document_rename.php"
|
||||
data-ajax-id="<?php echo $document_id; ?>"
|
||||
>
|
||||
<i class="fas fa-fw fa-pencil-alt mr-2"></i>Rename
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_document_move.php"
|
||||
data-ajax-id="<?php echo $document_id; ?>"
|
||||
>
|
||||
<i class="fas fa-fw fa-exchange-alt mr-2"></i>Move
|
||||
</a>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_document=<?php echo $document_id; ?>">
|
||||
<i class="fas fa-fw fa-archive mr-2"></i>Archive
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_document=<?php echo $document_id; ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<th>
|
||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_name&order=<?php echo $disp; ?>">
|
||||
Name <?php if ($sort == 'document_name') { echo $order_icon; } ?>
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_created_at&order=<?php echo $disp; ?>">
|
||||
Created <?php if ($sort == 'document_created_at') { echo $order_icon; } ?>
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_updated_at&order=<?php echo $disp; ?>">
|
||||
Last Update <?php if ($sort == 'document_updated_at') { echo $order_icon; } ?>
|
||||
</a>
|
||||
</th>
|
||||
<th></th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$document_id = intval($row['document_id']);
|
||||
$document_name = nullable_htmlentities($row['document_name']);
|
||||
$document_description = nullable_htmlentities($row['document_description']);
|
||||
$document_content = nullable_htmlentities($row['document_content']);
|
||||
$document_created_by_name = nullable_htmlentities($row['user_name']);
|
||||
$document_created_at = date("m/d/Y",strtotime($row['document_created_at']));
|
||||
$document_updated_at = date("m/d/Y",strtotime($row['document_updated_at']));
|
||||
$document_folder_id = intval($row['document_folder_id']);
|
||||
<?php
|
||||
|
||||
// Check if shared
|
||||
$sql_shared = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM shared_items
|
||||
WHERE item_client_id = $client_id
|
||||
AND item_active = 1
|
||||
AND item_views != item_view_limit
|
||||
AND item_expire_at > NOW()
|
||||
AND item_type = 'Document'
|
||||
AND item_related_id = $document_id
|
||||
LIMIT 1"
|
||||
);
|
||||
$row = mysqli_fetch_array($sql_shared);
|
||||
$item_id = intval($row['item_id']);
|
||||
$item_active = nullable_htmlentities($row['item_active']);
|
||||
$item_key = nullable_htmlentities($row['item_key']);
|
||||
$item_type = nullable_htmlentities($row['item_type']);
|
||||
$item_related_id = intval($row['item_related_id']);
|
||||
$item_note = nullable_htmlentities($row['item_note']);
|
||||
$item_recipient = nullable_htmlentities($row['item_recipient']);
|
||||
$item_views = nullable_htmlentities($row['item_views']);
|
||||
$item_view_limit = nullable_htmlentities($row['item_view_limit']);
|
||||
$item_created_at = nullable_htmlentities($row['item_created_at']);
|
||||
$item_expire_at = nullable_htmlentities($row['item_expire_at']);
|
||||
$item_expire_at_human = timeAgo($row['item_expire_at']);
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td class="bg-light pr-0">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input bulk-select" type="checkbox" name="document_ids[]" value="<?php echo $document_id ?>">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<a href="client_document_details.php?client_id=<?php echo $client_id; ?>&document_id=<?php echo $document_id; ?>"><i class="fas fa-fw fa-file-alt"></i> <?php echo $document_name; ?></a>
|
||||
<div class="text-secondary mt-1"><?php echo $document_description; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $document_created_at; ?>
|
||||
<div class="text-secondary mt-1"><?php echo $document_created_by_name; ?>
|
||||
</td>
|
||||
<td><?php echo $document_updated_at; ?></td>
|
||||
<td>
|
||||
<?php if (mysqli_num_rows($sql_shared) > 0) { ?>
|
||||
<div class="media" title="Expires <?php echo $item_expire_at_human; ?>">
|
||||
<i class="fas fa-link mr-2 mt-1"></i>
|
||||
<div class="media-body">Shared
|
||||
<br>
|
||||
<small class="text-secondary"><?php echo $item_recipient; ?></small>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
||||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#shareModal" onclick="populateShareModal(<?php echo "$client_id, 'Document', $document_id"; ?>)">
|
||||
<i class="fas fa-fw fa-share mr-2"></i>Share
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#renameDocumentModal<?php echo $document_id; ?>">
|
||||
<i class="fas fa-fw fa-pencil-alt mr-2"></i>Rename
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#moveDocumentModal<?php echo $document_id; ?>">
|
||||
<i class="fas fa-fw fa-exchange-alt mr-2"></i>Move
|
||||
</a>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_document=<?php echo $document_id; ?>">
|
||||
<i class="fas fa-fw fa-archive mr-2"></i>Archive
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_document=<?php echo $document_id; ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
require "modals/client_document_move_modal.php";
|
||||
|
||||
require "modals/client_document_rename_modal.php";
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
</div>
|
||||
<?php require_once "modals/client_document_bulk_move_modal.php"; ?>
|
||||
</form>
|
||||
<?php require_once "includes/filter_footer.php";
|
||||
?>
|
||||
</div>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
</div>
|
||||
<?php require_once "modals/client_document_bulk_move_modal.php"; ?>
|
||||
</form>
|
||||
<?php require_once "includes/filter_footer.php";
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="js/bulk_actions.js"></script>
|
||||
|
||||
<?php
|
||||
require_once "modals/share_modal.php";
|
||||
|
||||
require_once "modals/client_document_add_modal.php";
|
||||
|
||||
require_once "modals/client_document_add_from_template_modal.php";
|
||||
|
||||
require_once "includes/footer.php";
|
||||
|
|
|
|||
|
|
@ -195,7 +195,11 @@ while ($folder_id > 0) {
|
|||
<i class="fas fa-ellipsis-v"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#renameFolderModal<?php echo $folder_id; ?>">
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_folder_rename.php"
|
||||
data-ajax-id="<?php echo $folder_id; ?>"
|
||||
>
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Rename
|
||||
</a>
|
||||
<?php
|
||||
|
|
@ -212,9 +216,6 @@ while ($folder_id > 0) {
|
|||
echo '</div>';
|
||||
echo '</div>';
|
||||
|
||||
// Include the rename and create subfolder modals
|
||||
require "modals/folder_rename_modal.php";
|
||||
|
||||
if ($subfolder_count > 0) {
|
||||
// Display subfolders
|
||||
echo '<ul class="nav nav-pills flex-column bg-light">';
|
||||
|
|
@ -360,10 +361,18 @@ while ($folder_id > 0) {
|
|||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#shareModal" onclick="populateShareModal(<?php echo "$client_id, 'File', $file_id"; ?>)">
|
||||
<i class="fas fa-fw fa-share mr-2"></i>Share
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#renameFileModal<?php echo $file_id; ?>">
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_file_rename.php"
|
||||
data-ajax-id="<?php echo $file_id; ?>"
|
||||
>
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Rename
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#moveFileModal<?php echo $file_id; ?>">
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_file_move.php"
|
||||
data-ajax-id="<?php echo $file_id; ?>"
|
||||
>
|
||||
<i class="fas fa-fw fa-exchange-alt mr-2"></i>Move
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#linkAssetToFileModal<?php echo $file_id; ?>">
|
||||
|
|
@ -559,10 +568,18 @@ while ($folder_id > 0) {
|
|||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#shareModal" onclick="populateShareModal(<?php echo "$client_id, 'File', $file_id"; ?>)">
|
||||
<i class="fas fa-fw fa-share mr-2"></i>Share
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#renameFileModal<?php echo $file_id; ?>">
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_file_rename.php"
|
||||
data-ajax-id="<?php echo $file_id; ?>"
|
||||
>
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Rename
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#moveFileModal<?php echo $file_id; ?>">
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_file_move.php"
|
||||
data-ajax-id="<?php echo $file_id; ?>"
|
||||
>
|
||||
<i class="fas fa-fw fa-exchange-alt mr-2"></i>Move
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#linkAssetToFileModal<?php echo $file_id; ?>">
|
||||
|
|
@ -583,8 +600,6 @@ while ($folder_id > 0) {
|
|||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
require "modals/client_file_rename_modal.php";
|
||||
require "modals/client_file_move_modal.php";
|
||||
require "modals/client_file_link_asset_modal.php";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -243,7 +243,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<a class="text-dark" href="#" data-toggle="modal" data-target="#editLocationModal<?php echo $location_id; ?>">
|
||||
<a class="text-dark" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_location_edit.php"
|
||||
data-ajax-id="<?php echo $location_id; ?>"
|
||||
>
|
||||
<div class="media">
|
||||
<i class="fa fa-fw fa-2x fa-map-marker-alt mr-3"></i>
|
||||
<div class="media-body">
|
||||
|
|
@ -272,7 +276,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editLocationModal<?php echo $location_id; ?>">
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_location_edit.php"
|
||||
data-ajax-id="<?php echo $location_id; ?>"
|
||||
>
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<?php if ($session_user_role == 3 && $location_primary == 0) { ?>
|
||||
|
|
@ -297,8 +305,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php require "modals/client_location_edit_modal.php";
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
|
@ -319,10 +325,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<?php
|
||||
|
||||
require_once "modals/client_location_add_modal.php";
|
||||
|
||||
require_once "modals/client_location_import_modal.php";
|
||||
|
||||
require_once "modals/client_location_export_modal.php";
|
||||
|
||||
require_once "includes/footer.php";
|
||||
|
||||
|
|
|
|||
|
|
@ -101,11 +101,19 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<i class="fas fa-fw fa-ellipsis-v"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addRackUnitModal<?php echo $rack_id; ?>">
|
||||
<a class="dropdown-item text-dark" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_rack_device_add.php"
|
||||
data-ajax-id="<?php echo $rack_id; ?>"
|
||||
>
|
||||
<i class="fas fa-fw fa-plus text-secondary mr-2"></i>Add Device
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#editRackModal<?php echo $rack_id; ?>">
|
||||
<a class="dropdown-item text-dark" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_rack_edit.php"
|
||||
data-ajax-id="<?php echo $rack_id; ?>"
|
||||
>
|
||||
<i class="fas fa-fw fa-edit text-secondary mr-2"></i>Edit
|
||||
</a>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
|
|
@ -333,8 +341,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
</div>
|
||||
|
||||
</div>
|
||||
<?php require "modals/client_rack_edit_modal.php"; ?>
|
||||
<?php require "modals/client_rack_unit_add_modal.php"; ?>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
|
@ -347,4 +354,3 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
|
||||
require_once "modals/client_rack_add_modal.php";
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -82,23 +82,17 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
$service_updated_at = nullable_htmlentities($row['service_updated_at']);
|
||||
$service_review_due = nullable_htmlentities($row['service_review_due']);
|
||||
|
||||
// Service Importance
|
||||
if ($service_importance == "High") {
|
||||
$service_importance_display = "<span class='p-2 badge badge-danger'>$service_importance</span>";
|
||||
} elseif ($service_importance == "Medium") {
|
||||
$service_importance_display = "<span class='p-2 badge badge-warning'>$service_importance</span>";
|
||||
} elseif ($service_importance == "Low") {
|
||||
$service_importance_display = "<span class='p-2 badge badge-info'>$service_importance</span>";
|
||||
} else {
|
||||
$service_importance_display = "-";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<!-- Name/Category/Updated/Importance from DB -->
|
||||
<td>
|
||||
<a class="text-dark" href="#" data-toggle="modal" data-target="#viewServiceModal<?php echo $service_id; ?>">
|
||||
<a class="text-dark" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-modal-size="xl"
|
||||
data-ajax-url="ajax/ajax_service_details.php"
|
||||
data-ajax-id="<?php echo $service_id; ?>"
|
||||
>
|
||||
<div class="media">
|
||||
<i class="fa fa-fw fa-2x fa-stream mr-3"></i>
|
||||
<div class="media-body">
|
||||
|
|
@ -120,7 +114,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editServiceModal<?php echo $service_id; ?>">
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_service_edit.php"
|
||||
data-ajax-id="<?php echo $service_id; ?>"
|
||||
>
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<?php if (lookupUserPermission("module_support") >= 3) { ?>
|
||||
|
|
@ -133,77 +131,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
// Associated Assets (and their logins/networks/locations)
|
||||
$sql_assets = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM service_assets
|
||||
LEFT JOIN assets ON service_assets.asset_id = assets.asset_id
|
||||
LEFT JOIN asset_interfaces ON interface_asset_id = assets.asset_id AND interface_primary = 1
|
||||
LEFT JOIN logins ON service_assets.asset_id = logins.login_asset_id
|
||||
LEFT JOIN networks ON interface_network_id = networks.network_id
|
||||
LEFT JOIN locations ON assets.asset_location_id = locations.location_id
|
||||
WHERE service_id = $service_id"
|
||||
);
|
||||
|
||||
// Associated logins
|
||||
$sql_logins = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM service_logins
|
||||
LEFT JOIN logins ON service_logins.login_id = logins.login_id
|
||||
WHERE service_id = $service_id"
|
||||
);
|
||||
|
||||
// Associated Domains
|
||||
$sql_domains = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM service_domains
|
||||
LEFT JOIN domains ON service_domains.domain_id = domains.domain_id
|
||||
WHERE service_id = $service_id"
|
||||
);
|
||||
// Associated Certificates
|
||||
$sql_certificates = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM service_certificates
|
||||
LEFT JOIN certificates ON service_certificates.certificate_id = certificates.certificate_id
|
||||
WHERE service_id = $service_id"
|
||||
);
|
||||
|
||||
// Associated URLs ---- REMOVED for now
|
||||
//$sql_urls = mysqli_query($mysqli, "SELECT * FROM service_urls
|
||||
//WHERE service_id = '$service_id'");
|
||||
|
||||
// Associated Vendors
|
||||
$sql_vendors = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM service_vendors
|
||||
LEFT JOIN vendors ON service_vendors.vendor_id = vendors.vendor_id
|
||||
WHERE service_id = $service_id"
|
||||
);
|
||||
|
||||
// Associated Contacts
|
||||
$sql_contacts = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM service_contacts
|
||||
LEFT JOIN contacts ON service_contacts.contact_id = contacts.contact_id
|
||||
WHERE service_id = $service_id"
|
||||
);
|
||||
|
||||
// Associated Documents
|
||||
$sql_docs = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM service_documents
|
||||
LEFT JOIN documents ON service_documents.document_id = documents.document_id
|
||||
WHERE service_id = $service_id"
|
||||
);
|
||||
|
||||
require "modals/client_service_edit_modal.php";
|
||||
|
||||
require "modals/client_service_view_modal.php";
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
|
@ -217,6 +145,4 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
|
||||
<?php
|
||||
require_once "modals/client_service_add_modal.php";
|
||||
|
||||
require_once "includes/footer.php";
|
||||
|
||||
|
|
|
|||
|
|
@ -174,7 +174,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
?>
|
||||
<tr class="<?php echo $tr_class; ?>">
|
||||
<td>
|
||||
<a class="text-dark" href="#" data-toggle="modal" data-target="#editSoftwareModal<?php echo $software_id; ?>">
|
||||
<a class="text-dark" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_software_edit.php"
|
||||
data-ajax-id="<?php echo $software_id; ?>"
|
||||
>
|
||||
<div class="media">
|
||||
<i class="fa fa-fw fa-2x fa-cube mr-3"></i>
|
||||
<div class="media-body">
|
||||
|
|
@ -194,7 +198,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editSoftwareModal<?php echo $software_id; ?>">
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_software_edit.php"
|
||||
data-ajax-id="<?php echo $software_id; ?>"
|
||||
>
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
|
|
@ -214,8 +222,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
|
||||
<?php
|
||||
|
||||
require "modals/client_software_edit_modal.php";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -231,9 +237,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<?php
|
||||
|
||||
require_once "modals/client_software_add_modal.php";
|
||||
|
||||
require_once "modals/client_software_add_from_template_modal.php";
|
||||
|
||||
require_once "modals/client_software_export_modal.php";
|
||||
|
||||
require_once "includes/footer.php";
|
||||
|
|
|
|||
|
|
@ -128,7 +128,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
|
||||
?>
|
||||
<tr>
|
||||
<td><a class="text-dark" href="#" data-toggle="modal" data-target="#editTripModal<?php echo $trip_id; ?>"><?php echo $trip_date; ?></a></td>
|
||||
<td>
|
||||
<a class="text-dark" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_trip_edit.php?client_id=<?php echo $client_id; ?>"
|
||||
data-ajax-id="<?php echo $trip_id; ?>"
|
||||
>
|
||||
<?php echo $trip_date; ?>
|
||||
</a>
|
||||
</td>
|
||||
<td><?php echo $user_name_display; ?></td>
|
||||
<td><?php echo $trip_purpose; ?></td>
|
||||
<td><?php echo $trip_source; ?></td>
|
||||
|
|
@ -144,10 +152,18 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<i class="fa fa-fw fa-map-marker-alt mr-2"></i>Map it
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editTripModal<?php echo $trip_id; ?>">
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_trip_edit.php?client_id=<?php echo $client_id; ?>"
|
||||
data-ajax-id="<?php echo $trip_id; ?>"
|
||||
>
|
||||
<i class="fa fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addTripCopyModal<?php echo $trip_id; ?>">
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_trip_copy.php?client_id=<?php echo $client_id; ?>"
|
||||
data-ajax-id="<?php echo $trip_id; ?>"
|
||||
>
|
||||
<i class="fa fa-fw fa-copy mr-2"></i>Copy
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
|
|
@ -161,9 +177,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
|
||||
<?php
|
||||
|
||||
require "modals/trip_copy_modal.php";
|
||||
require "modals/trip_edit_modal.php";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -184,7 +184,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<a class="text-dark" href="#" data-toggle="modal" data-target="#editVendorModal<?php echo $vendor_id; ?>">
|
||||
<a class="text-dark" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_vendor_edit.php"
|
||||
data-ajax-id="<?php echo $vendor_id; ?>"
|
||||
>
|
||||
<div class="media">
|
||||
<i class="fa fa-fw fa-2x fa-building mr-3"></i>
|
||||
<div class="media-body">
|
||||
|
|
@ -222,7 +226,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editVendorModal<?php echo $vendor_id; ?>">
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_vendor_edit.php"
|
||||
data-ajax-id="<?php echo $vendor_id; ?>"
|
||||
>
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
|
|
@ -250,10 +258,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
require "modals/vendor_edit_modal.php";
|
||||
|
||||
} ?>
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
@ -268,10 +275,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
|
||||
<?php
|
||||
require_once "modals/vendor_add_modal.php";
|
||||
|
||||
require_once "modals/vendor_add_from_template_modal.php";
|
||||
|
||||
require_once "modals/client_vendor_export_modal.php";
|
||||
|
||||
require_once "includes/footer.php";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,37 +0,0 @@
|
|||
<div class="modal" id="editAccountModal<?php echo $account_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-piggy-bank mr-2"></i>Editing account: <strong><?php echo $account_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="account_id" value="<?php echo $account_id; ?>">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<div class="modal-body bg-white">
|
||||
<div class="form-group">
|
||||
<label>Account Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-piggy-bank"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" maxlength="200" value="<?php echo $account_name; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Notes</label>
|
||||
<textarea class="form-control" rows="5" placeholder="Enter some notes" name="notes"><?php echo $account_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_account" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
<div class="modal" id="moveDocumentModal<?php echo $document_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-file-alt mr-2"></i>Moving document: <strong><?php echo $document_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="document_id" value="<?php echo $document_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Move Document to</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="folder">
|
||||
<option value="0">/</option>
|
||||
<?php
|
||||
// Fetch all folders for the client
|
||||
$sql_all_folders = mysqli_query($mysqli, "SELECT folder_id, folder_name, parent_folder FROM folders WHERE folder_location = 0 AND folder_client_id = $client_id ORDER BY folder_name ASC");
|
||||
$folders = array();
|
||||
|
||||
// Build an associative array of folders indexed by folder_id
|
||||
while ($row = mysqli_fetch_assoc($sql_all_folders)) {
|
||||
$folders[$row['folder_id']] = array(
|
||||
'folder_id' => intval($row['folder_id']),
|
||||
'folder_name' => nullable_htmlentities($row['folder_name']),
|
||||
'parent_folder' => intval($row['parent_folder']),
|
||||
'children' => array()
|
||||
);
|
||||
}
|
||||
|
||||
// Build the folder hierarchy
|
||||
foreach ($folders as $id => &$folder) {
|
||||
if ($folder['parent_folder'] != 0 && isset($folders[$folder['parent_folder']])) {
|
||||
$folders[$folder['parent_folder']]['children'][] = &$folder;
|
||||
}
|
||||
}
|
||||
unset($folder); // Break the reference
|
||||
|
||||
// Prepare a list of root folders
|
||||
$root_folders = array();
|
||||
foreach ($folders as $id => $folder) {
|
||||
if ($folder['parent_folder'] == 0) {
|
||||
$root_folders[] = $folder;
|
||||
}
|
||||
}
|
||||
|
||||
// Display the folder options iteratively
|
||||
$stack = array();
|
||||
foreach (array_reverse($root_folders) as $folder) {
|
||||
$stack[] = array('folder' => $folder, 'level' => 0);
|
||||
}
|
||||
|
||||
while (!empty($stack)) {
|
||||
$node = array_pop($stack);
|
||||
$folder = $node['folder'];
|
||||
$level = $node['level'];
|
||||
|
||||
// Indentation for subfolders
|
||||
$indentation = str_repeat(' ', $level * 4);
|
||||
|
||||
// Check if this folder is selected
|
||||
$selected = '';
|
||||
if ($folder['folder_id'] == $document_folder_id) {
|
||||
$selected = 'selected';
|
||||
}
|
||||
|
||||
echo "<option value=\"{$folder['folder_id']}\" $selected>$indentation{$folder['folder_name']}</option>";
|
||||
|
||||
// Add children to the stack
|
||||
if (!empty($folder['children'])) {
|
||||
foreach (array_reverse($folder['children']) as $child_folder) {
|
||||
$stack[] = array('folder' => $child_folder, 'level' => $level + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="move_document" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Move</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
<div class="modal" id="renameDocumentModal<?php echo $document_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-file-alt mr-2"></i>Renaming document: <strong><?php echo $document_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="document_id" value="<?php echo $document_id; ?>">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Document Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-file-alt"></i></span>
|
||||
</div>
|
||||
<input class="form-control" type="text" name="name" maxlength="200" value="<?php echo $document_name; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="rename_document" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Rename</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
<div class="modal" id="viewDocumentModal<?php echo $document_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog modal-xl">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title text-white"><i class="fa fa-fw fa-file-alt mr-2"></i><?php echo $document_name; ?></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body bg-white">
|
||||
<?php echo $document_content; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
<div class="modal" id="moveFileModal<?php echo $file_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-<?php echo $file_icon; ?> mr-2"></i>Moving File: <strong><?php echo $file_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="file_id" value="<?php echo $file_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Move File to</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="folder_id">
|
||||
<option value="0">/</option>
|
||||
<?php
|
||||
// Fetch all folders for the client
|
||||
$sql_all_folders = mysqli_query($mysqli, "SELECT folder_id, folder_name, parent_folder FROM folders WHERE folder_location = 1 AND folder_client_id = $client_id ORDER BY folder_name ASC");
|
||||
$folders = array();
|
||||
|
||||
// Build an associative array of folders indexed by folder_id
|
||||
while ($row = mysqli_fetch_assoc($sql_all_folders)) {
|
||||
$folders[$row['folder_id']] = array(
|
||||
'folder_id' => intval($row['folder_id']),
|
||||
'folder_name' => nullable_htmlentities($row['folder_name']),
|
||||
'parent_folder' => intval($row['parent_folder']),
|
||||
'children' => array()
|
||||
);
|
||||
}
|
||||
|
||||
// Build the folder hierarchy
|
||||
foreach ($folders as $id => &$folder) {
|
||||
if ($folder['parent_folder'] != 0 && isset($folders[$folder['parent_folder']])) {
|
||||
$folders[$folder['parent_folder']]['children'][] = &$folder;
|
||||
}
|
||||
}
|
||||
unset($folder); // Break the reference
|
||||
|
||||
// Prepare a list of root folders
|
||||
$root_folders = array();
|
||||
foreach ($folders as $id => $folder) {
|
||||
if ($folder['parent_folder'] == 0) {
|
||||
$root_folders[] = $folder;
|
||||
}
|
||||
}
|
||||
|
||||
// Display the folder options iteratively
|
||||
$stack = array();
|
||||
foreach (array_reverse($root_folders) as $folder) {
|
||||
$stack[] = array('folder' => $folder, 'level' => 0);
|
||||
}
|
||||
|
||||
while (!empty($stack)) {
|
||||
$node = array_pop($stack);
|
||||
$folder = $node['folder'];
|
||||
$level = $node['level'];
|
||||
|
||||
// Indentation for subfolders
|
||||
$indentation = str_repeat(' ', $level * 4);
|
||||
|
||||
// Check if this folder is selected
|
||||
$selected = '';
|
||||
if ($folder['folder_id'] == $file_folder_id) {
|
||||
$selected = 'selected';
|
||||
}
|
||||
|
||||
echo "<option value=\"{$folder['folder_id']}\" $selected>$indentation{$folder['folder_name']}</option>";
|
||||
|
||||
// Add children to the stack
|
||||
if (!empty($folder['children'])) {
|
||||
foreach (array_reverse($folder['children']) as $child_folder) {
|
||||
$stack[] = array('folder' => $child_folder, 'level' => $level + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="move_file" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Move</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
<div class="modal" id="renameFileModal<?php echo $file_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-<?php echo $file_icon; ?> mr-2"></i>Renaming file: <strong><?php echo $file_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="file_id" value="<?php echo $file_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>File Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="file_name" placeholder="File Name" maxlength="200" value="<?php echo $file_name; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="file_description" placeholder="Description" maxlength="250" value="<?php echo $file_description; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="rename_file" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Rename</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,238 +0,0 @@
|
|||
<div class="modal" id="editLocationModal<?php echo $location_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-map-marker-alt mr-2"></i>Editing location: <strong><?php echo $location_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<input type="hidden" name="location_id" value="<?php echo $location_id; ?>">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-details<?php echo $location_id; ?>">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-address<?php echo $location_id; ?>">Address</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-contact<?php echo $location_id; ?>">Contact</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-notes<?php echo $location_id; ?>">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content" <?php if (lookupUserPermission('module_client') <= 1) { echo 'inert'; } ?>>
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-details<?php echo $location_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Location Name <strong class="text-danger">*</strong> / <span class="text-secondary">Primary</span></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-map-marker"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name of location" maxlength="200" value="<?php echo $location_name; ?>" required>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="location_primary" value="1" <?php if ($location_primary == 1) { echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="description" placeholder="Short Description" value="<?php echo $location_description; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3" style="text-align: center;">
|
||||
<?php if (!empty($location_photo)) { ?>
|
||||
<img class="img-fluid" src="<?php echo "uploads/clients/$client_id/$location_photo"; ?>">
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Photo</label>
|
||||
<input type="file" class="form-control-file" name="file" accept="image/*">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-address<?php echo $location_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Address</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="address" placeholder="Street Address" maxlength="200" value="<?php echo $location_address; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>City</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-city"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="city" placeholder="City" maxlength="200" value="<?php echo $location_city; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>State / Province</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-flag"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="state" placeholder="State or Province" maxlength="200" value="<?php echo $location_state; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Postal Code</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fab fa-fw fa-usps"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="zip" placeholder="Zip or Postal Code" maxlength="200" value="<?php echo $location_zip; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Country</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-globe-americas"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="country">
|
||||
<option value="">- Country -</option>
|
||||
<?php foreach($countries_array as $country_name) { ?>
|
||||
<option <?php if ($location_country == $country_name) { echo "selected"; } ?>><?php echo $country_name; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-contact<?php echo $location_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Contact</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="contact">
|
||||
<option value="">- Contact -</option>
|
||||
<?php
|
||||
|
||||
$sql_contacts = mysqli_query($mysqli, "SELECT * FROM contacts WHERE (contact_archived_at > '$location_created_at' OR contact_archived_at IS NULL) AND contact_client_id = $client_id ORDER BY contact_archived_at ASC, contact_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_contacts)) {
|
||||
$contact_id_select = intval($row['contact_id']);
|
||||
$contact_name_select = nullable_htmlentities($row['contact_name']);
|
||||
$contact_archived_at = nullable_htmlentities($row['contact_archived_at']);
|
||||
if (empty($contact_archived_at)) {
|
||||
$contact_archived_display = "";
|
||||
} else {
|
||||
$contact_archived_display = "Archived - ";
|
||||
}
|
||||
|
||||
?>
|
||||
<option <?php if ($location_contact_id == $contact_id_select) { echo "selected"; } ?> value="<?php echo $contact_id_select; ?>"><?php echo "$contact_archived_display$contact_name_select"; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Phone</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-phone"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="phone" placeholder="Phone Number" maxlength="200" value="<?php echo $location_phone; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Fax</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-fax"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="fax" placeholder="Fax Number" maxlength="200" value="<?php echo $location_fax; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Hours</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-clock"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="hours" placeholder="Hours of operation" maxlength="200" value="<?php echo $location_hours; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-notes<?php echo $location_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" name="notes" placeholder="Notes, eg Parking Info, Building Access etc"><?php echo $location_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Tags</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-tags"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="tags[]" data-placeholder="Add some tags" multiple>
|
||||
<?php
|
||||
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 2 ORDER BY tag_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_tags_select)) {
|
||||
$tag_id_select = intval($row['tag_id']);
|
||||
$tag_name_select = nullable_htmlentities($row['tag_name']);
|
||||
?>
|
||||
<option value="<?php echo $tag_id_select; ?>" <?php if (in_array($tag_id_select, $location_tag_id_array)) { echo "selected"; } ?>><?php echo $tag_name_select; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="text-muted text-right">Location ID: <?= $location_id ?></p>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_location" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,158 +0,0 @@
|
|||
<div class="modal" id="editRackModal<?php echo $rack_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-server mr-2"></i>Editing rack: <strong><?php echo $rack_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
|
||||
<input type="hidden" name="rack_id" value="<?php echo $rack_id; ?>">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-rack-details<?php echo $rack_id; ?>">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-rack-notes<?php echo $rack_id; ?>">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-rack-details<?php echo $rack_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-server"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Rack name" maxlength="200" value="<?php echo $rack_name; ?>" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="description" placeholder="Description of the rack" value="<?php echo $rack_description; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Type <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-server"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="type" required>
|
||||
<option value="">- Type -</option>
|
||||
<?php foreach($rack_type_select_array as $rack_type_select) { ?>
|
||||
<option <?php if ($rack_type == $rack_type_select) { echo "selected"; } ?>><?php echo $rack_type_select; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Model</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="make" placeholder="ex StarTech 12U Open Frame" maxlength="200" value="<?php echo $rack_model; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Depth</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-ruler"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="depth" placeholder="Rack Depth eg 800 mm or 31.5 Inches" maxlength="50" value="<?php echo $rack_depth; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Number of Units <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-sort-numeric-up-alt"></i></span>
|
||||
</div>
|
||||
<input type="number" class="form-control" name="units" placeholder="Number of Units" min="1" max="70" value="<?php echo $rack_units; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Physical Location</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="physical_location" placeholder="Physical location eg. Floor 2, Closet B" maxlength="200" value="<?php echo $rack_physical_location; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Location</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="location">
|
||||
<option value="">- Location -</option>
|
||||
<?php
|
||||
|
||||
$sql_location_select = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_archived_at IS NULL AND location_client_id = $client_id ORDER BY location_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_location_select)) {
|
||||
$location_id_select = intval($row['location_id']);
|
||||
$location_name_select = nullable_htmlentities($row['location_name']);
|
||||
?>
|
||||
<option <?php if ($rack_location_id == $location_id_select) { echo "selected"; } ?> value="<?php echo $location_id_select; ?>"><?php echo $location_name_select; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-rack-notes<?php echo $rack_id; ?>">
|
||||
|
||||
<?php if ($rack_photo) { ?>
|
||||
<img class="img-fluid p-3" alt="rack_photo" src="<?php echo "uploads/clients/$client_id/$rack_photo"; ?>">
|
||||
<?php } ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Upload Photo</label>
|
||||
<input type="file" class="form-control-file" name="file" accept="image/*">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="notes"><?php echo $rack_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_rack" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
<div class="modal" id="addRackUnitModal<?php echo $rack_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-server mr-2"></i>Adding Device to Rack <strong><?php echo $rack_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<input type="hidden" name="rack_id" value="<?php echo $rack_id; ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Custom Device</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-server"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Device Name" maxlength="200">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Or Select a Device</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-desktop"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="asset">
|
||||
<option value="">- Asset -</option>
|
||||
<?php
|
||||
// Fetch IDs of all assets already assigned to any rack
|
||||
$assigned_assets = [];
|
||||
$assigned_sql = mysqli_query($mysqli, "SELECT unit_asset_id FROM rack_units");
|
||||
while ($assigned_row = mysqli_fetch_assoc($assigned_sql)) {
|
||||
$assigned_assets[] = intval($assigned_row['unit_asset_id']);
|
||||
}
|
||||
$assigned_assets_list = implode(',', $assigned_assets);
|
||||
$assigned_assets_list = empty($assigned_assets_list) ? '0' : $assigned_assets_list;
|
||||
|
||||
// Fetch assets not assigned to any rack
|
||||
$sql_assets = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_archived_at IS NULL AND asset_client_id = $client_id AND asset_id NOT IN ($assigned_assets_list) ORDER BY asset_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||
$asset_id = intval($row['asset_id']);
|
||||
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||
?>
|
||||
<option value="<?php echo $asset_id; ?>"><?php echo $asset_name; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Unit Number Start - End <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-sort-numeric-up-alt"></i></span>
|
||||
</div>
|
||||
<input type="number" class="form-control" name="unit_start" placeholder="Unit Start" min="1" max="<?php echo $rack_units; ?>" required>
|
||||
<input type="number" class="form-control" name="unit_end" placeholder="Unit End" min="1" max="<?php echo $rack_units; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_rack_unit" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Add to Rack</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,275 +0,0 @@
|
|||
<div class="modal" id="editServiceModal<?php echo $service_id ?>" tabindex="-1">
|
||||
<div class="modal-dialog modal-md">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title text-white"><i class="fa fa-fw fa-stream mr-2"></i>Editing service: <strong><?php echo $service_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id ?>">
|
||||
<input type="hidden" name="service_id" value="<?php echo $service_id ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-overview<?php echo $service_id ?>">Overview</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-general<?php echo $service_id ?>">General</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-assets<?php echo $service_id ?>">Assets</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-overview<?php echo $service_id ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-stream"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name of Service" maxlength="200" value="<?php echo $service_name ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-info-circle"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="description" placeholder="Description of Service" maxlength="200" value="<?php echo $service_description ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- //TODO: Integrate with company wide categories: /categories.php -->
|
||||
<div class="form-group">
|
||||
<label>Category</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-info"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="category" placeholder="Category" maxlength="20" value="<?php echo $service_category ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Importance</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-thermometer-half"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="importance" required>
|
||||
<option <?php if ($service_importance == 'Low') { echo "selected"; } ?> >Low</option>
|
||||
<option <?php if ($service_importance == 'Medium') { echo "selected"; } ?> >Medium</option>
|
||||
<option <?php if ($service_importance == 'High') { echo "selected"; } ?> >High</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Backup</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-hdd"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="backup" placeholder="Backup strategy" maxlength="200" value="<?php echo $service_backup ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Notes</label>
|
||||
<textarea class="form-control" rows="3" placeholder="Enter some notes" name="note"><?php echo $service_notes ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-general<?php echo $service_id ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="contacts">Contacts</label>
|
||||
<select multiple class="form-control select2" name="contacts[]">
|
||||
<?php
|
||||
// Get just the currently selected contact IDs
|
||||
$selected_ids = array_column(mysqli_fetch_all($sql_contacts, MYSQLI_ASSOC), "contact_id");
|
||||
|
||||
// Get all contacts
|
||||
// NOTE: These are called $sql_all and $row_all for a reason - anything overwriting $sql or $row will break the current while loop we are in from client_services.php
|
||||
|
||||
$sql_all = mysqli_query($mysqli, "SELECT * FROM contacts WHERE (contact_archived_at > '$service_created_at' OR contact_archived_at IS NULL) AND contact_client_id = $client_id");
|
||||
|
||||
while ($row_all = mysqli_fetch_array($sql_all)) {
|
||||
$contact_id = intval($row_all['contact_id']);
|
||||
$contact_name = nullable_htmlentities($row_all['contact_name']);
|
||||
|
||||
if (in_array($contact_id, $selected_ids)) {
|
||||
echo "<option value=\"$contact_id\" selected>$contact_name</option>";
|
||||
}
|
||||
else{
|
||||
echo "<option value=\"$contact_id\">$contact_name</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="vendors">Vendors</label>
|
||||
<select multiple class="form-control select2" name="vendors[]">
|
||||
<?php
|
||||
$selected_ids = array_column(mysqli_fetch_all($sql_vendors, MYSQLI_ASSOC), "vendor_id");
|
||||
|
||||
$sql_all = mysqli_query($mysqli, "SELECT * FROM vendors WHERE (vendor_archived_at > '$service_created_at' OR vendor_archived_at IS NULL) AND vendor_template = 0 AND vendor_client_id = $client_id");
|
||||
while ($row_all = mysqli_fetch_array($sql_all)) {
|
||||
$vendor_id = intval($row_all['vendor_id']);
|
||||
$vendor_name = nullable_htmlentities($row_all['vendor_name']);
|
||||
|
||||
if (in_array($vendor_id, $selected_ids)) {
|
||||
echo "<option value=\"$vendor_id\" selected>$vendor_name</option>";
|
||||
}
|
||||
else{
|
||||
echo "<option value=\"$vendor_id\">$vendor_name</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="documents">Documents</label>
|
||||
<select multiple class="form-control select2" name="documents[]">
|
||||
<?php
|
||||
$selected_ids = array_column(mysqli_fetch_all($sql_docs, MYSQLI_ASSOC), "document_id");
|
||||
|
||||
$sql_all = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_archived_at IS NULL AND document_client_id = $client_id");
|
||||
while ($row_all = mysqli_fetch_array($sql_all)) {
|
||||
$document_id = intval($row_all['document_id']);
|
||||
$document_name = nullable_htmlentities($row_all['document_name']);
|
||||
|
||||
if (in_array($document_id, $selected_ids)) {
|
||||
echo "<option value=\"$document_id\" selected>$document_name</option>";
|
||||
}
|
||||
else{
|
||||
echo "<option value=\"$document_id\">$document_name</option>";
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- TODO: Services related to other services -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tab-pane fade" id="pills-assets<?php echo $service_id ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="assets">Assets</label>
|
||||
<select multiple class="form-control select2" name="assets[]">
|
||||
<?php
|
||||
$selected_ids = array_column(mysqli_fetch_all($sql_assets, MYSQLI_ASSOC), "asset_id");
|
||||
|
||||
$sql_all = mysqli_query($mysqli, "SELECT * FROM assets WHERE (asset_archived_at > '$service_created_at' OR asset_archived_at IS NULL) AND asset_client_id = $client_id");
|
||||
while ($row_all = mysqli_fetch_array($sql_all)) {
|
||||
$asset_id = intval($row_all['asset_id']);
|
||||
$asset_name = nullable_htmlentities($row_all['asset_name']);
|
||||
|
||||
if (in_array($asset_id, $selected_ids)) {
|
||||
echo "<option value=\"$asset_id\" selected>$asset_name</option>";
|
||||
}
|
||||
else{
|
||||
echo "<option value=\"$asset_id\">$asset_name</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="logins">Logins</label>
|
||||
<select multiple class="form-control select2" name="logins[]">
|
||||
<?php
|
||||
$selected_ids = array_column(mysqli_fetch_all($sql_logins, MYSQLI_ASSOC), "login_id");
|
||||
|
||||
$sql_all = mysqli_query($mysqli, "SELECT * FROM logins WHERE (login_archived_at > '$service_created_at' OR login_archived_at IS NULL) AND login_client_id = $client_id");
|
||||
while ($row_all = mysqli_fetch_array($sql_all)) {
|
||||
$login_id = intval($row_all['login_id']);
|
||||
$login_name = nullable_htmlentities($row_all['login_name']);
|
||||
|
||||
if (in_array($login_id, $selected_ids)) {
|
||||
echo "<option value=\"$login_id\" selected>$login_name</option>";
|
||||
}
|
||||
else{
|
||||
echo "<option value=\"$login_id\">$login_name</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="domains">Domains</label>
|
||||
<select multiple class="form-control select2" name="domains[]">
|
||||
<?php
|
||||
$selected_ids = array_column(mysqli_fetch_all($sql_domains, MYSQLI_ASSOC), "domain_id");
|
||||
|
||||
$sql_all = mysqli_query($mysqli, "SELECT * FROM domains WHERE (domain_archived_at > '$service_created_at' OR domain_archived_at IS NULL) AND domain_client_id = $client_id");
|
||||
while ($row_all = mysqli_fetch_array($sql_all)) {
|
||||
$domain_id = intval($row_all['domain_id']);
|
||||
$domain_name = nullable_htmlentities($row_all['domain_name']);
|
||||
|
||||
if (in_array($domain_id, $selected_ids)) {
|
||||
echo "<option value=\"$domain_id\" selected>$domain_name</option>";
|
||||
}
|
||||
else{
|
||||
echo "<option value=\"$domain_id\">$domain_name</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="certificates">Certificates</label>
|
||||
<select multiple class="form-control select2" name="certificates[]">
|
||||
<?php
|
||||
$selected_ids = array_column(mysqli_fetch_all($sql_certificates, MYSQLI_ASSOC), "certificate_id");
|
||||
|
||||
$sql_all = mysqli_query($mysqli, "SELECT * FROM certificates WHERE (certificate_archived_at > '$service_created_at' OR certificate_archived_at IS NULL) AND certificate_client_id = $client_id");
|
||||
while ($row_all = mysqli_fetch_array($sql_all)) {
|
||||
$cert_id = intval($row_all['certificate_id']);
|
||||
$cert_name = nullable_htmlentities($row_all['certificate_name']);
|
||||
|
||||
if (in_array($cert_id, $selected_ids)) {
|
||||
echo "<option value=\"$cert_id\" selected>$cert_name</option>";
|
||||
}
|
||||
else{
|
||||
echo "<option value=\"$cert_id\">$cert_name</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_service" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,294 +0,0 @@
|
|||
<div class="modal" id="viewServiceModal<?php echo $service_id ?>" tabindex="-1">
|
||||
<div class="modal-dialog modal-xl">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title text-white"><i class="fa fa-fw fa-stream mr-2"></i><?php echo $service_name; ?></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body bg-white">
|
||||
<div class="row">
|
||||
|
||||
<!-- Main/Left side -->
|
||||
<div class="col-8 border-right">
|
||||
<div class="col-12">
|
||||
<h4>Service Overview: <?php echo "$service_name $service_importance_display"; ?></h4>
|
||||
<b>Description:</b> <?php echo $service_description; ?> <br>
|
||||
<b>Backup Info:</b> <?php echo $service_backup; ?> <br><br>
|
||||
|
||||
<h5><i class="fas fa-fw fa-sticky-note mr-2"></i>Notes</h5>
|
||||
<div style="white-space: pre-line"><?php echo $service_notes; ?></div>
|
||||
<hr>
|
||||
|
||||
<!-- Assets -->
|
||||
<?php
|
||||
if (mysqli_num_rows($sql_assets) > 0) { ?>
|
||||
<h5><i class="fas fa-fw fa-desktop mr-2"></i>Assets</h5>
|
||||
<ul>
|
||||
<?php
|
||||
// Reset the $sql_assets pointer to the start - as we've already cycled through once
|
||||
mysqli_data_seek($sql_assets, 0);
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||
if (!empty($row['interface_ip'])) {
|
||||
$ip = '('.nullable_htmlentities($row["interface_ip"]).')';
|
||||
} else {
|
||||
$ip = '';
|
||||
}
|
||||
echo "<li><a href=\"client_assets.php?client_id=$client_id&q=$row[asset_name]\">$row[asset_name] </a>$ip</li>";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Networks -->
|
||||
<?php
|
||||
if ($sql_assets) {
|
||||
|
||||
$networks = [];
|
||||
|
||||
// Reset the $sql_assets pointer to the start
|
||||
mysqli_data_seek($sql_assets, 0);
|
||||
|
||||
// Get networks linked to assets - push name to array
|
||||
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||
if (!empty($row['network_name'])) {
|
||||
$network_data = nullable_htmlentities("$row[network_name]:$row[network_vlan]");
|
||||
array_push($networks, $network_data);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove duplicates
|
||||
$networks = array_unique($networks);
|
||||
|
||||
// Display
|
||||
if (!empty($networks)) { ?>
|
||||
<h5><i class="fas fa-fw fa-network-wired mr-2"></i>Networks</h5>
|
||||
<ul>
|
||||
<?php
|
||||
}
|
||||
foreach($networks as $network) {
|
||||
$network = explode(":", $network);
|
||||
echo "<li><a href=\"client_networks.php?client_id=$client_id&q=$network[0]\">$network[0] </a>(VLAN $network[1])</li>";
|
||||
}
|
||||
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Locations -->
|
||||
<?php
|
||||
if ($sql_assets) {
|
||||
|
||||
$location_names = [];
|
||||
|
||||
// Reset the $sql_assets pointer to the start - as we've already cycled through once
|
||||
mysqli_data_seek($sql_assets, 0);
|
||||
|
||||
// Get locations linked to assets - push their name and vlan to arrays
|
||||
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||
if (!empty($row['location_name'])) {
|
||||
array_push($location_names, $row['location_name']);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove duplicates
|
||||
$location_names = array_unique($location_names);
|
||||
|
||||
// Display
|
||||
if (!empty($location_names)) { ?>
|
||||
<h5><i class="fas fa-fw fa-map-marker-alt mr-2"></i>Locations</h5>
|
||||
<ul>
|
||||
<?php
|
||||
}
|
||||
foreach($location_names as $location) {
|
||||
echo "<li><a href=\"client_locations.php?client_id=$client_id&q=$location\">$location</a></li>";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Domains -->
|
||||
<?php
|
||||
if (mysqli_num_rows($sql_domains) > 0) { ?>
|
||||
<h5><i class="fas fa-fw fa-globe mr-2"></i>Domains</h5>
|
||||
<ul>
|
||||
<?php
|
||||
// Reset the $sql_domains pointer to the start
|
||||
mysqli_data_seek($sql_domains, 0);
|
||||
|
||||
// Showing linked domains
|
||||
while ($row = mysqli_fetch_array($sql_domains)) {
|
||||
if (!empty($row['domain_name'])) {
|
||||
echo "<li><a href=\"client_domains.php?client_id=$client_id&q=$row[domain_name]\">$row[domain_name]</a></li>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Certificates -->
|
||||
<?php
|
||||
if (mysqli_num_rows($sql_certificates) > 0) { ?>
|
||||
<h5><i class="fas fa-fw fa-lock mr-2"></i>Certificates</h5>
|
||||
<ul>
|
||||
<?php
|
||||
// Reset the $sql_certificates pointer to the start
|
||||
mysqli_data_seek($sql_certificates, 0);
|
||||
|
||||
// Showing linked certs
|
||||
while ($row = mysqli_fetch_array($sql_certificates)) {
|
||||
if (!empty($row['certificate_name'])) {
|
||||
echo "<li><a href=\"client_certificates.php?client_id=$client_id&q=$row[certificate_name]\">$row[certificate_name] ($row[certificate_domain])</a></li>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Right side -->
|
||||
<div class="col-4">
|
||||
<div class="col-12">
|
||||
<h4>Additional Related Items</h4>
|
||||
<br>
|
||||
|
||||
<!-- Vendors -->
|
||||
<?php
|
||||
// Reset the $sql_vendors pointer to the start
|
||||
mysqli_data_seek($sql_vendors, 0);
|
||||
|
||||
if (mysqli_num_rows($sql_vendors) > 0) { ?>
|
||||
<h5><i class="fas fa-fw fa-building mr-2"></i>Vendors</h5>
|
||||
<ul>
|
||||
<?php
|
||||
while ($row = mysqli_fetch_array($sql_vendors)) {
|
||||
echo "<li><a href=\"client_vendors.php?client_id=$client_id&q=$row[vendor_name]\">$row[vendor_name]</a></li>";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Contacts -->
|
||||
<?php
|
||||
if (mysqli_num_rows($sql_contacts) > 0) { ?>
|
||||
<h5><i class="fas fa-fw fa-users mr-2"></i>Contacts</h5>
|
||||
<ul>
|
||||
<?php
|
||||
// Reset the $sql_contacts pointer to the start
|
||||
mysqli_data_seek($sql_contacts, 0);
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_contacts)) {
|
||||
echo "<li><a href=\"client_contact_details.php?client_id=$client_id&contact_id=$row[contact_id]\">$row[contact_name]</a></li>";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Logins -->
|
||||
<?php
|
||||
if (mysqli_num_rows($sql_assets) > 0 || mysqli_num_rows($sql_logins) > 0) { ?>
|
||||
<h5><i class="fas fa-fw fa-key mr-2"></i>Logins</h5>
|
||||
<ul>
|
||||
<?php
|
||||
// Reset the $sql_assets/logins pointer to the start
|
||||
mysqli_data_seek($sql_assets, 0);
|
||||
mysqli_data_seek($sql_logins, 0);
|
||||
|
||||
// Showing logins linked to assets
|
||||
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||
if (!empty($row['login_name'])) {
|
||||
echo "<li><a href=\"client_logins.php?client_id=$client_id&q=$row[login_name]\">$row[login_name]</a></li>";
|
||||
}
|
||||
}
|
||||
|
||||
// Showing explicitly linked logins
|
||||
while ($row = mysqli_fetch_array($sql_logins)) {
|
||||
if (!empty($row['login_name'])) {
|
||||
echo "<li><a href=\"client_logins.php?client_id=$client_id&q=$row[login_name]\">$row[login_name]</a></li>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- URLs -->
|
||||
<?php
|
||||
if ($sql_logins || $sql_assets) { ?>
|
||||
<h5><i class="fas fa-fw fa-link mr-2"></i>URLs</h5>
|
||||
<ul>
|
||||
<?php
|
||||
// Reset the $sql_logins pointer to the start
|
||||
mysqli_data_seek($sql_logins, 0);
|
||||
|
||||
// Showing URLs linked to logins
|
||||
while ($row = mysqli_fetch_array($sql_logins)) {
|
||||
if (!empty($row['login_uri'])) {
|
||||
echo "<li><a href=\"https://$row[login_uri]\">$row[login_uri]</a></li>";
|
||||
}
|
||||
}
|
||||
|
||||
// Reset the $sql_assets pointer to the start
|
||||
mysqli_data_seek($sql_assets, 0);
|
||||
|
||||
// Show URLs linked to assets, that also have logins
|
||||
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||
if (!empty($row['login_uri'])) {
|
||||
echo "<li><a href=\"https://$row[login_uri]\">$row[login_uri]</a></li>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Documents -->
|
||||
<?php
|
||||
if (mysqli_num_rows($sql_docs) > 0) { ?>
|
||||
<h5><i class="fas fa-fw fa-file-alt mr-2"></i>Documents</h5>
|
||||
<ul>
|
||||
<?php
|
||||
// Reset the $sql_docs pointer to the start
|
||||
mysqli_data_seek($sql_docs, 0);
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_docs)) {
|
||||
echo "<li><a href=\"client_document_details.php?client_id=$client_id&document_id=$row[document_id]\">$row[document_name]</a></li>";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- <h5><i class="nav-icon fas fa-file-alt"></i> Services</h5>-->
|
||||
<!-- <ul>-->
|
||||
<!-- <li>Related Service - Coming soon!</li>-->
|
||||
<!-- </ul>-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,240 +0,0 @@
|
|||
<div class="modal" id="editSoftwareModal<?php echo $software_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-cube mr-2"></i>Editing license: <strong><?php echo $software_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="software_id" value="<?php echo $software_id; ?>">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-details<?php echo $software_id; ?>">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-license<?php echo $software_id; ?>">License</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-device-licenses<?php echo $software_id; ?>">Devices</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-user-licenses<?php echo $software_id; ?>">Users</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-notes<?php echo $software_id; ?>">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-details<?php echo $software_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Software Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-cube"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Software name" maxlength="200" value="<?php echo $software_name; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Version</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-cube"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="version" placeholder="Software version" maxlength="200" value="<?php echo $software_version; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="description" placeholder="Short description" value="<?php echo $software_description; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Type <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="type" required>
|
||||
<?php foreach($software_types_array as $software_type_select) { ?>
|
||||
<option <?php if ($software_type == $software_type_select) { echo "selected"; } ?>><?php echo $software_type_select; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-license<?php echo $software_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>License Type</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-cube"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="license_type">
|
||||
<option value="">- Select a License Type -</option>
|
||||
<?php foreach($license_types_array as $license_type_select) { ?>
|
||||
<option <?php if ($license_type_select == $software_license_type) { echo "selected"; } ?>><?php echo $license_type_select; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Seats</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-cube"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*" name="seats" placeholder="Number of seats" value="<?php echo $software_seats; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>License Key</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-key"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="key" placeholder="License key" maxlength="200" value="<?php echo $software_key; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Purchase Date</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar-check"></i></span>
|
||||
</div>
|
||||
<input type="date" class="form-control" name="purchase" max="2999-12-31" value="<?php echo $software_purchase; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Expire</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar-times"></i></span>
|
||||
</div>
|
||||
<input type="date" class="form-control" name="expire" max="2999-12-31" value="<?php echo $software_expire; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-device-licenses<?php echo $software_id; ?>">
|
||||
|
||||
<ul class="list-group">
|
||||
|
||||
<li class="list-group-item bg-dark">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" onclick="this.closest('.tab-pane').querySelectorAll('.asset-checkbox').forEach(checkbox => checkbox.checked = this.checked);">
|
||||
<label class="form-check-label ml-3"><strong>Licensed Devices</strong></label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<?php
|
||||
$sql_assets_select = mysqli_query($mysqli, "SELECT * FROM assets LEFT JOIN contacts ON asset_contact_id = contact_id WHERE (asset_archived_at > '$software_created_at' OR asset_archived_at IS NULL) AND asset_client_id = $client_id ORDER BY asset_archived_at ASC, asset_name ASC");
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_assets_select)) {
|
||||
$asset_id_select = intval($row['asset_id']);
|
||||
$asset_name_select = nullable_htmlentities($row['asset_name']);
|
||||
$asset_type_select = nullable_htmlentities($row['asset_type']);
|
||||
$asset_archived_at = nullable_htmlentities($row['asset_archived_at']);
|
||||
if (empty($asset_archived_at)) {
|
||||
$asset_archived_display = "";
|
||||
} else {
|
||||
$asset_archived_display = "Archived - ";
|
||||
}
|
||||
$contact_name_select = nullable_htmlentities($row['contact_name']);
|
||||
|
||||
?>
|
||||
<li class="list-group-item">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input asset-checkbox" name="assets[]" value="<?php echo $asset_id_select; ?>" <?php if (in_array($asset_id_select, $asset_licenses_array)) { echo "checked"; } ?>>
|
||||
<label class="form-check-label ml-2"><?php echo "$asset_archived_display$asset_name_select - $contact_name_select"; ?></label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-user-licenses<?php echo $software_id; ?>">
|
||||
|
||||
<ul class="list-group">
|
||||
|
||||
<li class="list-group-item bg-dark">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" onclick="this.closest('.tab-pane').querySelectorAll('.user-checkbox').forEach(checkbox => checkbox.checked = this.checked);">
|
||||
<label class="form-check-label ml-3"><strong>Licensed Users</strong></label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php
|
||||
$sql_contacts_select = mysqli_query($mysqli, "SELECT * FROM contacts WHERE (contact_archived_at > '$software_created_at' OR contact_archived_at IS NULL) AND contact_client_id = $client_id ORDER BY contact_archived_at ASC, contact_name ASC");
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_contacts_select)) {
|
||||
$contact_id_select = intval($row['contact_id']);
|
||||
$contact_name_select = nullable_htmlentities($row['contact_name']);
|
||||
$contact_email_select = nullable_htmlentities($row['contact_email']);
|
||||
$contact_archived_at = nullable_htmlentities($row['contact_archived_at']);
|
||||
if (empty($contact_archived_at)) {
|
||||
$contact_archived_display = "";
|
||||
} else {
|
||||
$contact_archived_display = "Archived - ";
|
||||
}
|
||||
|
||||
?>
|
||||
<li class="list-group-item">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input user-checkbox" name="contacts[]" value="<?php echo $contact_id_select; ?>" <?php if (in_array("$contact_id_select", $contact_licenses_array)) { echo "checked"; } ?>>
|
||||
<label class="form-check-label ml-2"><?php echo "$contact_archived_display$contact_name_select - $contact_email_select"; ?></label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-notes<?php echo $software_id; ?>">
|
||||
|
||||
<textarea class="form-control" rows="12" placeholder="Enter some notes" name="notes"><?php echo $software_notes; ?></textarea>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_software" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,187 +0,0 @@
|
|||
<div class="modal" id="addExpenseCopyModal<?php echo $expense_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header text-white">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-copy mr-2"></i>Copying expense</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<div class="modal-body bg-white">
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md">
|
||||
<label>Date <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||
</div>
|
||||
<input type="date" class="form-control" name="date" max="2999-12-31" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md">
|
||||
<label>Amount <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-dollar-sign"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,2}" name="amount" value="<?php echo number_format($expense_amount, 2, '.', ''); ?>" placeholder="0.00" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md">
|
||||
<label>Account <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-piggy-bank"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="account" required>
|
||||
<?php
|
||||
|
||||
$sql_accounts = mysqli_query($mysqli, "SELECT account_id, account_name, opening_balance FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_accounts)) {
|
||||
$account_id_select = intval($row['account_id']);
|
||||
$account_name_select = nullable_htmlentities($row['account_name']);
|
||||
$opening_balance = floatval($row['opening_balance']);
|
||||
|
||||
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id_select");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$total_payments = floatval($row['total_payments']);
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id_select");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$total_revenues = floatval($row['total_revenues']);
|
||||
|
||||
$sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id_select");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$total_expenses = floatval($row['total_expenses']);
|
||||
|
||||
$balance = $opening_balance + $total_payments + $total_revenues - $total_expenses;
|
||||
?>
|
||||
<option <?php if ($expense_account_id == $account_id_select) { echo "selected"; } ?> value="<?php echo $account_id_select; ?>"><?php echo $account_name_select; ?> [$<?php echo number_format($balance, 2); ?>]</option>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md">
|
||||
<label>Vendor <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-building"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="vendor" required>
|
||||
<?php
|
||||
|
||||
$sql_vendors = mysqli_query($mysqli, "SELECT vendor_id, vendor_name FROM vendors WHERE vendor_client_id = 0 AND vendor_template = 0 ORDER BY vendor_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_vendors)) {
|
||||
$vendor_id_select = intval($row['vendor_id']);
|
||||
$vendor_name_select = nullable_htmlentities($row['vendor_name']);
|
||||
?>
|
||||
<option <?php if ($expense_vendor_id == $vendor_id_select) { ?> selected <?php } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description <strong class="text-danger">*</strong></label>
|
||||
<textarea class="form-control" rows="6" name="description" placeholder="Enter a description" required><?php echo $expense_description; ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Reference</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-file-alt"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="reference" placeholder="Enter a reference" maxlength="200" value="<?php echo $expense_reference; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md">
|
||||
<label>Category <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-list"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="category" required>
|
||||
<?php
|
||||
|
||||
$sql_categories = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Expense' ORDER BY category_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_categories)) {
|
||||
$category_id_select = intval($row['category_id']);
|
||||
$category_name_select = nullable_htmlentities($row['category_name']);
|
||||
?>
|
||||
<option <?php if ($expense_category_id == $category_id_select) { ?> selected <?php } ?> value="<?php echo $category_id_select; ?>"><?php echo $category_name_select; ?></option>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (isset($_GET['client_id'])) { ?>
|
||||
<input type="hidden" name="client" value="<?php echo $client_id; ?>">
|
||||
<?php } else { ?>
|
||||
|
||||
<div class="form-group col-md">
|
||||
<label>Client</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="client">
|
||||
<option value="">- Client (Optional) -</option>
|
||||
<?php
|
||||
|
||||
$sql_clients = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients ORDER BY client_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_clients)) {
|
||||
$client_id_select = intval($row['client_id']);
|
||||
$client_name_select = nullable_htmlentities($row['client_name']);
|
||||
?>
|
||||
<option <?php if ($expense_client_id == $client_id_select) { echo "selected"; } ?> value="<?php echo $client_id_select; ?>"><?php echo $client_name_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Receipt</label>
|
||||
<input type="file" class="form-control-file" name="file">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_expense" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Copy</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
<div class="modal" id="renameFolderModal<?php echo $folder_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-folder mr-2"></i>Renaming folder: <strong><?php echo $folder_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="folder_id" value="<?php echo $folder_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="folder_name" placeholder="Folder Name" maxlength="200" value="<?php echo $folder_name; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="rename_folder" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Rename</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
<div class="modal" id="editProductModal<?php echo $product_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fas fa-fw fa-box-open mr-2"></i>Editing product: <strong><?php echo $product_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="product_id" value="<?php echo $product_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-box"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" maxlength="200" value="<?php echo $product_name; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Category <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-list"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="category" required>
|
||||
<?php
|
||||
|
||||
$sql_select = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Income' AND (category_archived_at > '$product_created_at' OR category_archived_at IS NULL)");
|
||||
while ($row = mysqli_fetch_array($sql_select)) {
|
||||
$category_id_select = intval($row['category_id']);
|
||||
$category_name_select = nullable_htmlentities($row['category_name']);
|
||||
?>
|
||||
<option <?php if ($category_id == $category_id_select) { echo "selected"; } ?> value="<?php echo $category_id_select; ?>"><?php echo $category_name_select; ?></option>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<a class="btn btn-secondary" href="admin_category.php?category=Income" target="_blank"><i class="fas fa-fw fa-plus"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label>Price <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-dollar-sign"></i></span>
|
||||
</div>
|
||||
<input type="text" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,2}" class="form-control" name="price" value="<?php echo number_format($product_price, 2, '.', ''); ?>" placeholder="0.00" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label>Tax</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-balance-scale"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="tax">
|
||||
<option value="0">None</option>
|
||||
<?php
|
||||
|
||||
$taxes_sql = mysqli_query($mysqli, "SELECT * FROM taxes WHERE (tax_archived_at > '$product_created_at' OR tax_archived_at IS NULL) ORDER BY tax_name ASC");
|
||||
while ($row = mysqli_fetch_array($taxes_sql)) {
|
||||
$tax_id_select = intval($row['tax_id']);
|
||||
$tax_name = nullable_htmlentities($row['tax_name']);
|
||||
$tax_percent = floatval($row['tax_percent']);
|
||||
?>
|
||||
<option <?php if ($tax_id_select == $product_tax_id) { echo "selected"; } ?> value="<?php echo $tax_id_select; ?>"><?php echo "$tax_name $tax_percent%"; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description</label>
|
||||
<textarea class="form-control" rows="5" name="description"><?php echo $product_description; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_product" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
<div class="modal" id="editTicketContactModal<?php echo $ticket_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-user mr-2"></i>Changing contact: <strong><?php echo "$ticket_prefix$ticket_number"; ?></strong> - <?php echo $client_name; ?></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="ticket_id" value="<?php echo $ticket_id; ?>">
|
||||
<input type="hidden" name="contact_notify" value="0"> <!-- Default 0 -->
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Contact</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="contact">
|
||||
<option value="">No One</option>
|
||||
<?php
|
||||
$sql_client_contacts_select = mysqli_query($mysqli, "SELECT contact_id, contact_name, contact_title, contact_primary, contact_technical FROM contacts WHERE contact_client_id = $client_id AND contact_archived_at IS NULL ORDER BY contact_primary DESC, contact_technical DESC, contact_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_client_contacts_select)) {
|
||||
$contact_id_select = intval($row['contact_id']);
|
||||
$contact_name_select = nullable_htmlentities($row['contact_name']);
|
||||
$contact_primary_select = intval($row['contact_primary']);
|
||||
if($contact_primary_select == 1) {
|
||||
$contact_primary_display_select = " (Primary)";
|
||||
} else {
|
||||
$contact_primary_display_select = "";
|
||||
}
|
||||
$contact_technical_select = intval($row['contact_technical']);
|
||||
if($contact_technical_select == 1) {
|
||||
$contact_technical_display_select = " (Technical)";
|
||||
} else {
|
||||
$contact_technical_display_select = "";
|
||||
}
|
||||
$contact_title_select = nullable_htmlentities($row['contact_title']);
|
||||
if(!empty($contact_title_select)) {
|
||||
$contact_title_display_select = " - $contact_title_select";
|
||||
} else {
|
||||
$contact_title_display_select = "";
|
||||
}
|
||||
|
||||
?>
|
||||
<option value="<?php echo $contact_id_select; ?>" <?php if ($contact_id_select == $contact_id) { echo "selected"; } ?>><?php echo "$contact_name_select$contact_title_display_select$contact_primary_display_select$contact_technical_display_select"; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($config_smtp_host)) { ?>
|
||||
<div class="form-group">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="contact_notify" value="1" id="checkNotifyContact" <?php if ($config_ticket_client_general_notifications) { echo "checked"; } ?>>
|
||||
<label class="form-check-label" for="checkNotifyContact">
|
||||
Send email notification
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_ticket_contact" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,288 +0,0 @@
|
|||
<div class="modal" id="editTicketModal<?php echo $ticket_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-life-ring mr-2"></i>Editing ticket: <strong><?php echo "$ticket_prefix$ticket_number"; ?></strong> - <?php echo $client_name; ?></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="ticket_id" value="<?php echo $ticket_id; ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-details<?php echo $ticket_id; ?>"><i class="fa fa-fw fa-life-ring mr-2"></i>Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-contacts<?php echo $ticket_id; ?>"><i class="fa fa-fw fa-users mr-2"></i>Contact</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-assignment<?php echo $ticket_id; ?>"><i class="fa fa-fw fa-desktop mr-2"></i>Assignment</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-details<?php echo $ticket_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Subject <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="subject" maxlength="500" value="<?php echo $ticket_subject; ?>" placeholder="Subject" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control tinymce" rows="8" name="details"><?php echo $ticket_details; ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label>Priority <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-thermometer-half"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="priority" required>
|
||||
<option <?php if ($ticket_priority == 'Low') { echo "selected"; } ?> >Low</option>
|
||||
<option <?php if ($ticket_priority == 'Medium') { echo "selected"; } ?> >Medium</option>
|
||||
<option <?php if ($ticket_priority == 'High') { echo "selected"; } ?> >High</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label>Category</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-layer-group"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="category">
|
||||
<option value="0">- Uncategorized -</option>
|
||||
<?php
|
||||
$sql_categories = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Ticket' AND category_archived_at IS NULL");
|
||||
while ($row = mysqli_fetch_array($sql_categories)) {
|
||||
$category_id = intval($row['category_id']);
|
||||
$category_name = nullable_htmlentities($row['category_name']);
|
||||
|
||||
?>
|
||||
<option <?php if ($ticket_category == $category_id) {echo "selected";} ?> value="<?php echo $category_id; ?>"><?php echo $category_name; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($config_module_enable_accounting && lookupUserPermission("module_sales") >= 2) { ?>
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" name="billable" <?php if ($ticket_billable == 1) { echo "checked"; } ?> value="1" id="billableSwitch<?php echo $ticket_id; ?>">
|
||||
<label class="custom-control-label" for="billableSwitch<?php echo $ticket_id; ?>">Mark Billable</label>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-contacts<?php echo $ticket_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Contact</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="contact">
|
||||
<option value="0">No One</option>
|
||||
<?php
|
||||
$sql_client_contacts_select = mysqli_query($mysqli, "SELECT contact_id, contact_name, contact_title, contact_primary, contact_technical FROM contacts WHERE contact_client_id = $client_id AND contact_archived_at IS NULL ORDER BY contact_primary DESC, contact_technical DESC, contact_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_client_contacts_select)) {
|
||||
$contact_id_select = intval($row['contact_id']);
|
||||
$contact_name_select = nullable_htmlentities($row['contact_name']);
|
||||
$contact_primary_select = intval($row['contact_primary']);
|
||||
if($contact_primary_select == 1) {
|
||||
$contact_primary_display_select = " (Primary)";
|
||||
} else {
|
||||
$contact_primary_display_select = "";
|
||||
}
|
||||
$contact_technical_select = intval($row['contact_technical']);
|
||||
if($contact_technical_select == 1) {
|
||||
$contact_technical_display_select = " (Technical)";
|
||||
} else {
|
||||
$contact_technical_display_select = "";
|
||||
}
|
||||
$contact_title_select = nullable_htmlentities($row['contact_title']);
|
||||
if(!empty($contact_title_select)) {
|
||||
$contact_title_display_select = " - $contact_title_select";
|
||||
} else {
|
||||
$contact_title_display_select = "";
|
||||
}
|
||||
|
||||
?>
|
||||
<option value="<?php echo $contact_id_select; ?>" <?php if ($contact_id_select == $contact_id) { echo "selected"; } ?>><?php echo "$contact_name_select$contact_title_display_select$contact_primary_display_select$contact_technical_display_select"; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($config_smtp_host)) { ?>
|
||||
<div class="form-group">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="contact_notify" value="1" id="checkNotifyContact">
|
||||
<label class="form-check-label" for="checkNotifyContact">
|
||||
Send email notification
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-assignment<?php echo $ticket_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Asset</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-desktop"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="asset">
|
||||
<option value="0">- None -</option>
|
||||
<?php
|
||||
|
||||
$sql_assets = mysqli_query($mysqli, "SELECT asset_id, asset_name, contact_name FROM assets LEFT JOIN contacts ON contact_id = asset_contact_id WHERE asset_client_id = $client_id AND asset_archived_at IS NULL ORDER BY asset_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||
$asset_id_select = intval($row['asset_id']);
|
||||
$asset_name_select = nullable_htmlentities($row['asset_name']);
|
||||
$asset_contact_name_select = nullable_htmlentities($row['contact_name']);
|
||||
?>
|
||||
<option <?php if ($asset_id == $asset_id_select) { echo "selected"; } ?> value="<?php echo $asset_id_select; ?>"><?php echo "$asset_name_select - $asset_contact_name_select"; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Location</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="location">
|
||||
<option value="0">- None -</option>
|
||||
<?php
|
||||
|
||||
$sql_locations = mysqli_query($mysqli, "SELECT location_id, location_name FROM locations WHERE location_client_id = $client_id AND location_archived_at IS NULL ORDER BY location_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_locations)) {
|
||||
$location_id_select = intval($row['location_id']);
|
||||
$location_name_select = nullable_htmlentities($row['location_name']);
|
||||
?>
|
||||
<option <?php if ($location_id == $location_id_select) { echo "selected"; } ?> value="<?php echo $location_id_select; ?>"><?php echo $location_name_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Vendor</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-building"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="vendor">
|
||||
<option value="0">- None -</option>
|
||||
<?php
|
||||
|
||||
$sql_vendors = mysqli_query($mysqli, "SELECT vendor_id, vendor_name FROM vendors WHERE vendor_client_id = $client_id AND vendor_template = 0 AND vendor_archived_at IS NULL ORDER BY vendor_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_vendors)) {
|
||||
$vendor_id_select = intval($row['vendor_id']);
|
||||
$vendor_name_select = nullable_htmlentities($row['vendor_name']);
|
||||
?>
|
||||
<option <?php if ($vendor_id == $vendor_id_select) { echo "selected"; } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Vendor Ticket Number</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="vendor_ticket_number" placeholder="Vendor ticket number" value="<?php echo $ticket_vendor_ticket_number; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label>Project</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-project-diagram"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="project">
|
||||
<option value="0">- None -</option>
|
||||
<?php
|
||||
|
||||
$sql_projects = mysqli_query($mysqli, "SELECT project_id, project_name FROM projects WHERE (project_client_id = $client_id OR project_client_id = 0) AND project_completed_at IS NULL AND project_archived_at IS NULL ORDER BY project_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_projects)) {
|
||||
$project_id_select = intval($row['project_id']);
|
||||
$project_name_select = nullable_htmlentities($row['project_name']); ?>
|
||||
<option <?php if ($project_id == $project_id_select) { echo "selected"; } ?> value="<?php echo $project_id_select; ?>"><?php echo $project_name_select; ?></option>
|
||||
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_ticket" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
<div class="modal" id="replyEditTicketModal<?php echo $ticket_reply_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-edit mr-2"></i>Editing Ticket Reply</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="ticket_reply_id" value="<?php echo $ticket_reply_id; ?>">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<div class="btn-group btn-block btn-group-toggle" data-toggle="buttons">
|
||||
<label class="btn btn-outline-secondary active">
|
||||
<input type="radio" name="ticket_reply_type" value="Internal" <?php if ($ticket_reply_type == 'Internal') { echo "checked"; } ?>>Internal Note
|
||||
</label>
|
||||
<label class="btn btn-outline-secondary">
|
||||
<input type="radio" name="ticket_reply_type" value="Public" <?php if ($ticket_reply_type == 'Public') { echo "checked"; } ?>>Public Comment
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" name="ticket_reply"><?php echo nullable_htmlentities($ticket_reply); ?></textarea>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($ticket_reply_time_worked)) { ?>
|
||||
<div class="col-3">
|
||||
<div class="form-group">
|
||||
<label>Time worked</label>
|
||||
<input class="form-control timepicker" id="time_worked" name="time" type="text" placeholder="HH:MM:SS" pattern="([01]?[0-9]|2[0-3]):([0-5]?[0-9]):([0-5]?[0-9])" value="<?php echo date_format($ticket_reply_time_worked, 'H:i:s') ?>" required/>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_ticket_reply" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,146 +0,0 @@
|
|||
<div class="modal" id="addTripCopyModal<?php echo $trip_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fas fa-fw fa-copy mr-2"></i>Copying Trip</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col">
|
||||
<label>Date <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||
</div>
|
||||
<input type="date" class="form-control" name="date" max="2999-12-31" value="<?php echo date("Y-m-d"); ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col">
|
||||
<label>Miles <strong class="text-danger">*</strong> / <span class="text-secondary">Roundtrip</span></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-bicycle"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,1}" name="miles" value="<?php echo $trip_miles; ?>" placeholder="0.0" required>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="roundtrip" value="1" <?php if ($round_trip == 1) { echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Location <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-map-marker-alt"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="source" maxlength="200" value="<?php echo $trip_source; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-arrow-right"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="destination" data-tags="true" data-placeholder="- Select / Input Destination -" required>
|
||||
<option><?php echo $trip_destination; ?></option>
|
||||
<?php
|
||||
|
||||
$sql_locations_select = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_archived_at IS NULL AND location_client_id = $client_id ORDER BY location_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_locations_select)) {
|
||||
$location_name = nullable_htmlentities($row['location_name']);
|
||||
$location_address = nullable_htmlentities($row['location_address']);
|
||||
$location_city = nullable_htmlentities($row['location_city']);
|
||||
$location_state = nullable_htmlentities($row['location_state']);
|
||||
$location_zip = nullable_htmlentities($row['location_zip']);
|
||||
$location_full_address = "$location_address $location_city $location_state $location_zip";
|
||||
|
||||
?>
|
||||
<option><?php echo $location_full_address; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Purpose <strong class="text-danger">*</strong></label>
|
||||
<textarea rows="4" class="form-control" placeholder="Enter a purpose" name="purpose" maxlength="200" required><?php echo $trip_purpose; ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Driver</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="user" required>
|
||||
<option value="">- Driver -</option>
|
||||
<?php
|
||||
|
||||
$sql_users = mysqli_query($mysqli, "SELECT users.user_id, user_name FROM users
|
||||
LEFT JOIN user_settings on users.user_id = user_settings.user_id
|
||||
WHERE user_role > 1 AND user_archived_at IS NULL ORDER BY user_name ASC"
|
||||
);
|
||||
while ($row = mysqli_fetch_array($sql_users)) {
|
||||
$user_id_select = intval($row['user_id']);
|
||||
$user_name_select = nullable_htmlentities($row['user_name']);
|
||||
?>
|
||||
<option <?php if ($trip_user_id == $user_id_select) { echo "selected"; } ?> value="<?php echo $user_id_select; ?>"><?php echo $user_name_select; ?></option>
|
||||
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (isset($_GET['client_id'])) { ?>
|
||||
<input type="hidden" name="client" value="<?php echo $client_id; ?>">
|
||||
<?php } else { ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Client</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="client">
|
||||
<option value="">- Client (Optional) -</option>
|
||||
<?php
|
||||
|
||||
$sql_clients = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at IS NULL ORDER BY client_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_clients)) {
|
||||
$client_id_select = intval($row['client_id']);
|
||||
$client_name_select = nullable_htmlentities($row['client_name']);
|
||||
?>
|
||||
<option <?php if ($client_id == $client_id_select) { echo "selected"; } ?> value="<?php echo $client_id_select; ?>"><?php echo $client_name_select; ?></option>
|
||||
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_trip" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Copy</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,157 +0,0 @@
|
|||
<div class="modal" id="editTripModal<?php echo $trip_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-route mr-2"></i>Editing Trip</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<div class="modal-body bg-white">
|
||||
<input type="hidden" name="trip_id" value="<?php echo $trip_id; ?>">
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col">
|
||||
<label>Date <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||
</div>
|
||||
<input type="date" class="form-control" name="date" max="2999-12-31" value="<?php echo $trip_date; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col">
|
||||
<label>Miles <strong class="text-danger">*</strong> / <span class="text-secondary">Roundtrip</span></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-bicycle"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,1}" name="miles" value="<?php echo $trip_miles; ?>" placeholder="0.0" required>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="roundtrip" value="1" <?php if ($round_trip == 1) { echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Location <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-map-marker-alt"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="source" maxlength="200" value="<?php echo $trip_source; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-arrow-right"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="destination" data-tags="true" data-placeholder="- Select / Input Destination -" required>
|
||||
<option><?php echo $trip_destination; ?></option>
|
||||
<?php
|
||||
|
||||
$sql_locations_select = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_archived_at IS NULL AND location_client_id = $client_id ORDER BY location_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_locations_select)) {
|
||||
$location_name = nullable_htmlentities($row['location_name']);
|
||||
$location_address = nullable_htmlentities($row['location_address']);
|
||||
$location_city = nullable_htmlentities($row['location_city']);
|
||||
$location_state = nullable_htmlentities($row['location_state']);
|
||||
$location_zip = nullable_htmlentities($row['location_zip']);
|
||||
$location_full_address = "$location_address $location_city $location_state $location_zip";
|
||||
|
||||
?>
|
||||
<option><?php echo $location_full_address; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Purpose <strong class="text-danger">*</strong></label>
|
||||
<textarea rows="4" class="form-control" name="purpose" placeholder="Enter a purpose" maxlength="200" required><?php echo $trip_purpose; ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Driver</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="user" required>
|
||||
<option value="">- Driver -</option>
|
||||
<?php
|
||||
|
||||
$sql_users = mysqli_query($mysqli, "SELECT * FROM users
|
||||
LEFT JOIN user_settings on users.user_id = user_settings.user_id
|
||||
WHERE (users.user_id = $trip_user_id) OR (user_archived_at IS NULL AND user_status = 1) ORDER BY user_name ASC"
|
||||
);
|
||||
while ($row = mysqli_fetch_array($sql_users)) {
|
||||
$user_id_select = intval($row['user_id']);
|
||||
$user_name_select = nullable_htmlentities($row['user_name']);
|
||||
?>
|
||||
<option <?php if ($trip_user_id == $user_id_select) { echo "selected"; } ?> value="<?php echo $user_id_select; ?>"><?php echo $user_name_select; ?></option>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (isset($_GET['client_id'])) { ?>
|
||||
<input type="hidden" name="client" value="<?php echo $client_id; ?>">
|
||||
<?php } else { ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Client</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="client">
|
||||
<option value="">- Client (Optional) -</option>
|
||||
<?php
|
||||
|
||||
$sql_clients = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at > '$trip_created_at' OR client_archived_at IS NULL ORDER BY client_archived_at ASC, client_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_clients)) {
|
||||
$client_id_select = intval($row['client_id']);
|
||||
$client_name_select = nullable_htmlentities($row['client_name']);
|
||||
$client_archived_at = nullable_htmlentities($row['client_archived_at']);
|
||||
if (empty($client_archived_at)) {
|
||||
$client_archived_display = "";
|
||||
} else {
|
||||
$client_archived_display = "Archived - ";
|
||||
}
|
||||
?>
|
||||
<option <?php if ($client_id == $client_id_select) { echo "selected"; } ?> value="<?php echo $client_id_select; ?>"><?php echo "$client_archived_display$client_name_select"; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_trip" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,186 +0,0 @@
|
|||
<div class="modal" id="editVendorModal<?php echo $vendor_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fas fa-fw fa-building mr-2"></i>Editing vendor: <strong><?php echo $vendor_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="vendor_id" value="<?php echo $vendor_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-details<?php echo $vendor_id; ?>">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-support<?php echo $vendor_id; ?>">Support</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-notes<?php echo $vendor_id; ?>">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-details<?php echo $vendor_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Vendor Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-building"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Vendor Name" maxlength="200" value="<?php echo "$vendor_name"; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="description" placeholder="Description" maxlength="200" value="<?php echo $vendor_description; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Account Number</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-fingerprint"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="account_number" placeholder="Account number" maxlength="200" value="<?php echo $vendor_account_number; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Account Manager</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="contact_name" maxlength="200" value="<?php echo $vendor_contact_name; ?>" placeholder="Vendor contact name">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Template Base</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-puzzle-piece"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="vendor_template_id">
|
||||
<option value="0">- None -</option>
|
||||
<?php
|
||||
|
||||
$sql_vendor_templates = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_template = 1 AND vendor_archived_at IS NULL ORDER BY vendor_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_vendor_templates)) {
|
||||
$vendor_template_id_select = $row['vendor_id'];
|
||||
$vendor_template_name_select = nullable_htmlentities($row['vendor_name']); ?>
|
||||
<option <?php if ($vendor_template_id == $vendor_template_id_select) { echo "selected"; } ?> value="<?php echo $vendor_template_id_select; ?>"><?php echo $vendor_template_name_select; ?></option>
|
||||
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-support<?php echo $vendor_id; ?>">
|
||||
|
||||
<label>Support Phone</label>
|
||||
<div class="form-row">
|
||||
<div class="col-8">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-phone"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="phone" placeholder="Phone Number" maxlength="200" value="<?php echo $vendor_phone; ?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="text" class="form-control" name="extension" placeholder="Prompts" maxlength="200" value="<?php echo $vendor_extension; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Support Hours</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="hours" placeholder="Support Hours" maxlength="200" value="<?php echo $vendor_hours; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Support Email</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-envelope"></i></span>
|
||||
</div>
|
||||
<input type="email" class="form-control" name="email" placeholder="Support Email" maxlength="200" value="<?php echo $vendor_email; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Support Website URL</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-globe"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="website" placeholder="Do not include http(s)://" maxlength="200" value="<?php echo $vendor_website; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>SLA</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-handshake"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="sla" placeholder="SLA Response Time" maxlength="200" value="<?php echo $vendor_sla; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Pin/Code</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-key"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="code" placeholder="Access Code or Pin" maxlength="200" value="<?php echo $vendor_code; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-notes<?php echo $vendor_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="12" placeholder="Enter some notes" name="notes"><?php echo $vendor_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
<p class="text-muted text-right">Vendor ID: <?= $vendor_id ?></p>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_vendor" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
19
products.php
19
products.php
|
|
@ -205,7 +205,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<input class="form-check-input bulk-select" type="checkbox" name="product_ids[]" value="<?php echo $product_id ?>">
|
||||
</div>
|
||||
</td>
|
||||
<th><a class="text-dark" href="#" data-toggle="modal" data-target="#editProductModal<?php echo $product_id; ?>"><?php echo $product_name; ?></a></th>
|
||||
<td>
|
||||
<a class="text-dark text-bold" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_product_edit.php"
|
||||
data-ajax-id="<?php echo $product_id; ?>"
|
||||
>
|
||||
<?php echo $product_name; ?>
|
||||
</a>
|
||||
</td>
|
||||
<td><?php echo $category_name; ?></td>
|
||||
<td><?php echo $product_description_display; ?></td>
|
||||
<td><?php echo $tax_name_display; ?></td>
|
||||
|
|
@ -218,7 +226,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editProductModal<?php echo $product_id; ?>">
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_product_edit.php"
|
||||
data-ajax-id="<?php echo $product_id; ?>"
|
||||
>
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
|
|
@ -247,9 +259,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
|
||||
<?php
|
||||
|
||||
require "modals/product_edit_modal.php";
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ if (isset($_GET['quote_id'])) {
|
|||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle = "ajax-modal"
|
||||
data-toggle = "ajax-modal"
|
||||
data-ajax-url = "ajax/ajax_quote_edit.php"
|
||||
data-ajax-id = "<?php echo $quote_id; ?>"
|
||||
>
|
||||
|
|
@ -185,7 +185,7 @@ if (isset($_GET['quote_id'])) {
|
|||
</a>
|
||||
<?php if (lookupUserPermission("module_sales") >= 2) { ?>
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle = "ajax-modal"
|
||||
data-toggle = "ajax-modal"
|
||||
data-ajax-url = "ajax/ajax_quote_copy.php"
|
||||
data-ajax-id = "<?php echo $quote_id; ?>"
|
||||
>
|
||||
|
|
|
|||
12
ticket.php
12
ticket.php
|
|
@ -421,8 +421,13 @@ if (isset($_GET['ticket_id'])) {
|
|||
<button class="btn btn-secondary btn-sm" type="button" id="dropdownMenuButton" data-toggle="dropdown">
|
||||
<i class="fas fa-fw fa-ellipsis-v"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editTicketModal<?php echo $ticket_id; ?>">
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle = "ajax-modal"
|
||||
data-modal-size = "lg"
|
||||
data-ajax-url = "ajax/ajax_ticket_edit.php"
|
||||
data-ajax-id = "<?php echo $ticket_id; ?>"
|
||||
>
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#mergeTicketModal<?php echo $ticket_id; ?>">
|
||||
|
|
@ -1198,7 +1203,6 @@ if (isset($_GET['ticket_id'])) {
|
|||
|
||||
<?php
|
||||
if (lookupUserPermission("module_support") >= 2 && empty($ticket_closed_at)) {
|
||||
require_once "modals/ticket_edit_modal.php";
|
||||
require_once "modals/ticket_edit_asset_modal.php";
|
||||
require_once "modals/ticket_edit_vendor_modal.php";
|
||||
require_once "modals/ticket_add_watcher_modal.php";
|
||||
|
|
@ -1218,7 +1222,7 @@ require_once "includes/footer.php";
|
|||
?>
|
||||
|
||||
<!-- Summary Modal -->
|
||||
<div class="modal fade" id="summaryModal" tabindex="-1" role="dialog" aria-labelledby="summaryModalTitle" aria-hidden="true">
|
||||
<div class="modal fade" id="summaryModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
|
|
|
|||
33
trips.php
33
trips.php
|
|
@ -169,7 +169,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
|
||||
?>
|
||||
<tr>
|
||||
<td><a class="text-dark" href="#" data-toggle="modal" data-target="#editTripModal<?php echo $trip_id; ?>"><?php echo $trip_date; ?></a></td>
|
||||
<td>
|
||||
<a class="text-dark" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_trip_edit.php"
|
||||
data-ajax-id="<?php echo $trip_id; ?>"
|
||||
>
|
||||
<?php echo $trip_date; ?>
|
||||
</a>
|
||||
</td>
|
||||
<td><?php echo $client_name_display; ?></td>
|
||||
<td><?php echo $user_name_display; ?></td>
|
||||
<td><?php echo $trip_purpose; ?></td>
|
||||
|
|
@ -186,10 +194,18 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<i class="fa fa-fw fa-map-marker-alt mr-2"></i>Map it<i class="fa fa-fw fa-external-link-alt ml-2"></i>
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editTripModal<?php echo $trip_id; ?>">
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_trip_edit.php"
|
||||
data-ajax-id="<?php echo $trip_id; ?>"
|
||||
>
|
||||
<i class="fa fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addTripCopyModal<?php echo $trip_id; ?>">
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_trip_copy.php"
|
||||
data-ajax-id="<?php echo $trip_id; ?>"
|
||||
>
|
||||
<i class="fa fa-fw fa-copy mr-2"></i>Copy
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
|
|
@ -202,14 +218,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
require "modals/trip_copy_modal.php";
|
||||
|
||||
require "modals/trip_edit_modal.php";
|
||||
|
||||
require "modals/trip_export_modal.php";
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
|
@ -223,6 +231,5 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
|
||||
<?php
|
||||
require_once "modals/trip_add_modal.php";
|
||||
|
||||
require_once "modals/trip_export_modal.php";
|
||||
require_once "includes/footer.php";
|
||||
|
||||
|
|
|
|||
19
vendors.php
19
vendors.php
|
|
@ -145,7 +145,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
|
||||
<tr>
|
||||
<th>
|
||||
<a class="text-dark" href="#" data-toggle="modal" data-target="#editVendorModal<?php echo $vendor_id; ?>"><?php echo $vendor_name; ?></a>
|
||||
<a class="text-dark" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_vendor_edit.php"
|
||||
data-ajax-id="<?php echo $vendor_id; ?>"
|
||||
>
|
||||
<?php echo $vendor_name; ?>
|
||||
</a>
|
||||
<?php if (!empty($vendor_account_number)) { ?>
|
||||
<br>
|
||||
<small class="text-secondary"><?php echo $vendor_account_number; ?></small>
|
||||
|
|
@ -179,7 +185,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editVendorModal<?php echo $vendor_id; ?>">
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_vendor_edit.php"
|
||||
data-ajax-id="<?php echo $vendor_id; ?>"
|
||||
>
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
|
|
@ -193,9 +203,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
|
||||
<?php
|
||||
|
||||
require "modals/vendor_edit_modal.php";
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -210,6 +217,4 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
|
||||
<?php
|
||||
require_once "modals/vendor_add_modal.php";
|
||||
|
||||
require_once "includes/footer.php";
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue