mirror of https://github.com/itflow-org/itflow
Introduced Custom Extenal Links on main side Nav DB Structure updated Thanks @aftechno
This commit is contained in:
parent
bf69d02cba
commit
ef7bfd3c90
|
|
@ -0,0 +1,52 @@
|
|||
<div class="modal" id="addCustomLinkModal" 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-link"></i> New Custom Link</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-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-link"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Icon</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-image"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="icon" placeholder="Icon">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>URL <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">https://</span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="url" placeholder="Enter URL here" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_custom_link" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -120,7 +120,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
</td>
|
||||
<td><?php echo $login_uri_display; ?></td>
|
||||
<td><?php echo $login_username_display; ?></td>
|
||||
<td><?php echo $login_password; ?><button class="btn btn-sm" data-clipboard-text="<?php echo $login_password; ?>"><i class="far fa-copy text-secondary"></i></button></td>
|
||||
<td><?php echo $login_password; ?><button class="btn btn-sm"><i class="far fa-eye text-secondary"></i></button><button class="btn btn-sm" data-clipboard-text="<?php echo $login_password; ?>"><i class="far fa-copy text-secondary"></i></button></td>
|
||||
</td>
|
||||
<td><?php echo $otp_display; ?></td>
|
||||
<td>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,136 @@
|
|||
<?php include("header.php");
|
||||
|
||||
//Paging
|
||||
if(isset($_GET['p'])){
|
||||
$p = intval($_GET['p']);
|
||||
$record_from = (($p)-1)*$_SESSION['records_per_page'];
|
||||
$record_to = $_SESSION['records_per_page'];
|
||||
}else{
|
||||
$record_from = 0;
|
||||
$record_to = $_SESSION['records_per_page'];
|
||||
$p = 1;
|
||||
}
|
||||
|
||||
if(isset($_GET['q'])){
|
||||
$q = mysqli_real_escape_string($mysqli,$_GET['q']);
|
||||
}else{
|
||||
$q = "";
|
||||
}
|
||||
|
||||
if(!empty($_GET['sb'])){
|
||||
$sb = mysqli_real_escape_string($mysqli,$_GET['sb']);
|
||||
}else{
|
||||
$sb = "custom_link_name";
|
||||
}
|
||||
|
||||
if(isset($_GET['o'])){
|
||||
if($_GET['o'] == 'ASC'){
|
||||
$o = "ASC";
|
||||
$disp = "DESC";
|
||||
}else{
|
||||
$o = "DESC";
|
||||
$disp = "ASC";
|
||||
}
|
||||
}else{
|
||||
$o = "ASC";
|
||||
$disp = "DESC";
|
||||
}
|
||||
|
||||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM custom_links
|
||||
WHERE custom_link_name LIKE '%$q%'
|
||||
AND company_id = $session_company_id
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to"
|
||||
);
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-link"></i> Custom Links</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addCustomLinkModal"><i class="fas fa-fw fa-plus"></i> New</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<div class="row">
|
||||
<div class="col-sm-4 mb-2">
|
||||
<div class="input-group">
|
||||
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){echo stripslashes($q);} ?>" placeholder="Search custom links">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-borderless table-hover">
|
||||
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=custom_link_name&o=<?php echo $disp; ?>">Name</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=custom_link_url&o=<?php echo $disp; ?>">URL</a></th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$custom_link_id = $row['custom_link_id'];
|
||||
$custom_link_name = $row['custom_link_name'];
|
||||
$custom_link_icon = $row['custom_link_icon'];
|
||||
if(empty($custom_link_icon)){
|
||||
$custom_link_icon_display = "<i class='fa fa-fw fa-circle mr-2'></i>";
|
||||
}else{
|
||||
$custom_link_icon_display = "<i class='fa fa-fw fa-$custom_link_icon mr-2'></i>";
|
||||
}
|
||||
$custom_link_url = $row['custom_link_url'];
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><a class="text-dark" href="#" data-toggle="modal" data-target="#editCustomLinkModal<?php echo $custom_link_id; ?>"><?php echo "$custom_link_icon_display $custom_link_name"; ?></a></td>
|
||||
<td><?php echo $custom_link_url; ?></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="#editCustomLinkModal<?php echo $custom_link_id; ?>">Edit</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="post.php?delete_custom_link=<?php echo $custom_link_id; ?>">Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
include("edit_custom_link_modal.php");
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php include("pagination.php"); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
include("add_custom_link_modal.php");
|
||||
|
||||
include("footer.php");
|
||||
|
||||
?>
|
||||
21
db.sql
21
db.sql
|
|
@ -266,6 +266,25 @@ CREATE TABLE `contracts` (
|
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `custom_links`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `custom_links`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `custom_links` (
|
||||
`custom_link_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`custom_link_name` varchar(250) NOT NULL,
|
||||
`custom_link_icon` varchar(100) DEFAULT NULL,
|
||||
`custom_link_url` varchar(250) NOT NULL,
|
||||
`custom_link_order` int(11) DEFAULT NULL,
|
||||
`custom_link_created_at` datetime NOT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`custom_link_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `documents`
|
||||
--
|
||||
|
|
@ -1011,4 +1030,4 @@ CREATE TABLE `vendors` (
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2021-08-18 22:52:05
|
||||
-- Dump completed on 2021-08-19 12:24:33
|
||||
|
|
|
|||
|
|
@ -0,0 +1,53 @@
|
|||
<div class="modal" id="editCustomLinkModal<?php echo $custom_link_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-link"></i> <?php echo $custom_link_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="custom_link_id" value="<?php echo $custom_link_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-link"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name" value="<?php echo $custom_link_name; ?>" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Icon</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-image"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="icon" placeholder="Icon" value="<?php echo $custom_link_icon; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>URL <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">https://</span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="url" placeholder="Enter URL here" value="<?php echo $custom_link_url; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="edit_custom_link" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
52
post.php
52
post.php
|
|
@ -1482,6 +1482,58 @@ if(isset($_GET['delete_tax'])){
|
|||
|
||||
//End Tax
|
||||
|
||||
//Custom Link
|
||||
if(isset($_POST['add_custom_link'])){
|
||||
|
||||
$name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])));
|
||||
$icon = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['icon'])));
|
||||
$url = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['url'])));
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO custom_links SET custom_link_name = '$name', custom_link_icon = '$icon', custom_link_url = '$url', custom_link_created_at = NOW(), company_id = $session_company_id");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Custom Link', log_action = 'Created', log_description = '$name', log_created_at = NOW(), company_id = $session_company_id, user_id = $session_user_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Custom link added";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['edit_custom_link'])){
|
||||
|
||||
$custom_link_id = intval($_POST['custom_link_id']);
|
||||
$name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])));
|
||||
$icon = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['icon'])));
|
||||
$url = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['url'])));
|
||||
|
||||
mysqli_query($mysqli,"UPDATE custom_links SET custom_link_name = '$name', custom_link_icon = '$icon', custom_link_url = '$url' WHERE custom_link_id = $custom_link_id AND company_id = $session_company_id");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Custom Link', log_action = 'Modified', log_description = '$name', log_created_at = NOW(), company_id = $session_company_id, user_id = $session_user_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Custom link modified";
|
||||
|
||||
header("Location: custom_links.php");
|
||||
|
||||
}
|
||||
|
||||
if(isset($_GET['delete_custom_link'])){
|
||||
$custom_link_id = intval($_GET['delete_custom_link']);
|
||||
|
||||
mysqli_query($mysqli,"DELETE FROM custom_links WHERE custom_link_id = $custom_link_id AND company_id = $session_company_id");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Custom Link', log_action = 'Deleted', log_description = '$custom_link_id', log_created_at = NOW(), company_id = $session_company_id, user_id = $session_user_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Custom link deleted";
|
||||
$_SESSION['alert_type'] = "danger";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
}
|
||||
//End Custom Link
|
||||
|
||||
if(isset($_GET['alert_ack'])){
|
||||
|
||||
$alert_id = intval($_GET['alert_ack']);
|
||||
|
|
|
|||
47
side_nav.php
47
side_nav.php
|
|
@ -209,6 +209,12 @@
|
|||
<p>Categories</p>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="custom_links.php" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "custom_links.php") { echo "active"; } ?>">
|
||||
<i class="far fa-circle nav-icon"></i>
|
||||
<p>Custom Links</p>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="taxes.php" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "taxes.php") { echo "active"; } ?>">
|
||||
<i class="far fa-circle nav-icon"></i>
|
||||
|
|
@ -238,6 +244,47 @@
|
|||
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM custom_links WHERE company_id = $session_company_id");
|
||||
|
||||
if(mysqli_num_rows($sql) > 0){
|
||||
|
||||
?>
|
||||
|
||||
<li class="nav-header mt-3">EXTERNAL LINKS</li>
|
||||
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM custom_links WHERE company_id = $session_company_id");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
|
||||
$custom_link_id = $row['custom_link_id'];
|
||||
$custom_link_name = $row['custom_link_name'];
|
||||
$custom_link_icon = $row['custom_link_icon'];
|
||||
if(empty($custom_link_icon)){
|
||||
$custom_link_icon_display = "far fa-circle";
|
||||
}else{
|
||||
$custom_link_icon_display = $custom_link_icon;
|
||||
}
|
||||
$custom_link_url = $row['custom_link_url'];
|
||||
|
||||
?>
|
||||
|
||||
<li class="nav-item">
|
||||
<a href="//<?php echo $custom_link_url; ?>" target="_blank" class="nav-link">
|
||||
<i class="nav-icon fas fa-<?php echo $custom_link_icon_display; ?>"></i>
|
||||
<p><?php echo $custom_link_name; ?></p>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
<!-- /.sidebar-menu -->
|
||||
|
|
|
|||
Loading…
Reference in New Issue