mirror of https://github.com/itflow-org/itflow
commit
762bbecb63
Binary file not shown.
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 94 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 96 KiB |
|
|
@ -0,0 +1,27 @@
|
|||
name: Welcome New Contributor
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
pull_request_target:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
run:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/first-interaction@v1.1.1
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-message: |
|
||||
Hello & Welcome! :)
|
||||
|
||||
Thanks for taking the time to get in touch. We'll review this issue shortly.
|
||||
|
||||
Whilst you're waiting, please feel free to check out the [forum](https://forum.itflow.org).
|
||||
pr-message: |
|
||||
Hello & Welcome! :)
|
||||
|
||||
Thanks for taking the time to help improve ITFlow. We're excited to review your contributions - we'll review this PR as soon as we can!
|
||||
|
||||
Whilst you're waiting, please feel free to check out the [forum](https://forum.itflow.org).
|
||||
24
README.md
24
README.md
|
|
@ -24,7 +24,7 @@
|
|||
Username: <b>demo@demo</b> | Password: <b>demo</b>
|
||||
<br />
|
||||
<br />
|
||||
<a href="https://itflow.org/docs.php?doc=about">About</a>
|
||||
<a href="https://itflow.org/index.php?page=About">About</a>
|
||||
·
|
||||
<a href="https://itflow.org/docs.php">Docs</a>
|
||||
·
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
<!-- ABOUT THE PROJECT -->
|
||||
## About
|
||||
|
||||
<b>A free ITGlue alternative, with additional ticketing / accounting features.</b>
|
||||
<b>A comprehensive, free & open-source documentation, ticket management, and accounting platform.</b>
|
||||
|
||||
[![ITFlow][product-screenshot]](https://itflow.org)
|
||||
|
||||
|
|
@ -54,8 +54,8 @@
|
|||
- ITFlow consolidates common MSP needs (documentation, ticketing, and accounting) into one system
|
||||
|
||||
### In Beta
|
||||
* This project is still in early beta and is considered a **work in progress**. Many changes are being performed and may cause breakage upon updates.
|
||||
* Currently, we strongly recommend against storing confidential information in ITFlow; ITFlow has not undergone a third-party security assessment.
|
||||
* This project is in beta with many ongoing changes. Updates may unintentionally introduce bugs/security issues.
|
||||
* Whilst we are confident the code is safe, nothing in life is 100% safe or risk-free. Use your best judgement before deciding to store highly confidential information in ITFlow.
|
||||
* We are hoping to have a stable 1.0 release by April/May 2023.
|
||||
|
||||
<!-- BUILT WITH -->
|
||||
|
|
@ -66,6 +66,7 @@
|
|||
* MariaDB
|
||||
* PHPMailer
|
||||
* HTML Purifier
|
||||
* PHP Mime Mail Parser
|
||||
|
||||
* CSS
|
||||
* Bootstrap
|
||||
|
|
@ -84,11 +85,11 @@
|
|||
<!-- GETTING STARTED -->
|
||||
## Getting Started / Installation
|
||||
|
||||
ITFlow is self-hosted. There is a full installation guide in the [docs](https://itflow.org/docs.php?doc_id=1), but the main steps are:
|
||||
ITFlow is self-hosted. There is a full installation guide in the [docs](https://wiki.itflow.org/doku.php?id=wiki:installation), but the main steps are:
|
||||
|
||||
1. Install a LAMP stack (Linux, Apache, MariaDB, PHP)
|
||||
```sh
|
||||
sudo apt install git apache2 php libapache2-mod-php php-intl php-imap php-mysqli php-curl mariadb-server
|
||||
sudo apt install git apache2 php libapache2-mod-php php-intl php-imap php-mailparse php-mysqli php-curl mariadb-server
|
||||
```
|
||||
2. Clone the repo
|
||||
```sh
|
||||
|
|
@ -103,14 +104,13 @@ ITFlow is self-hosted. There is a full installation guide in the [docs](https://
|
|||
* Accounting / Billing - finance dashboard, quotes, invoices, accounting, expenses, etc
|
||||
* Client Portal - self service quote/invoice/ticket management for clients
|
||||
* Alerting - account balance, invoices, domain/SSL renewals
|
||||
* Completely free & open-source alternative to ITGlue and Hudu
|
||||
|
||||
<!-- ROADMAP -->
|
||||
## Roadmap / Future to-do
|
||||
|
||||
* MeshCentral (Export common software applications to Software)
|
||||
* Comprehensive API to allow custom third party integration
|
||||
* CalDAV to integrate with 3rd party calendars
|
||||
* CardDAV to integrate with 3rd party Address books
|
||||
* Stripe Integration for online payments
|
||||
* Recent caller toast alerts to click and bring up the clients account right away
|
||||
* FIDO2 WebAuthn Support for passwordless auth (TPM Fingerprint), (USB Hardware keys such as Yubikey)
|
||||
|
||||
|
|
@ -125,7 +125,7 @@ For help using ITFlow, feature requests, and general ideas / discussions please
|
|||
For bugs, please raise an [issue](https://github.com/itflow-org/itflow/issues).
|
||||
|
||||
### Contributing
|
||||
If you are able to make a contribution that would make ITFlow better, please fork the repo and create a pull request. Please make sure you're following our [code standards](https://itflow.org/docs.php?doc=coding-standards).
|
||||
If you are able to make a contribution that would make ITFlow better, please fork the repo and create a pull request. Please make sure you're following our [code standards](https://wiki.itflow.org/doku.php?id=wiki:code_standards).
|
||||
For large changes / new features, please discuss the issue with other contributors first.
|
||||
|
||||
#### Contributors
|
||||
|
|
@ -136,7 +136,7 @@ For large changes / new features, please discuss the issue with other contributo
|
|||
<!-- LICENSE -->
|
||||
## License
|
||||
|
||||
ITFlow is distributed "as is" under the GPL License, WITHOUT WARRANTY OF ANY KIND. See `LICENSE` for details.
|
||||
ITFlow is distributed "as is" under the GPL License, WITHOUT WARRANTY OF ANY KIND. See [`LICENSE`](https://github.com/itflow-org/itflow/blob/master/LICENSE) for details.
|
||||
|
||||
|
||||
<!-- MARKDOWN LINKS & IMAGES -->
|
||||
|
|
@ -153,6 +153,6 @@ ITFlow is distributed "as is" under the GPL License, WITHOUT WARRANTY OF ANY KIN
|
|||
[license-url]: https://github.com/itflow-org/itflow/blob/master/LICENSE
|
||||
[commit-shield]: https://img.shields.io/github/last-commit/itflow-org/itflow?style=for-the-badge
|
||||
[commit-url]: https://github.com/itflow-org/itflow/commits/master
|
||||
[product-screenshot]: .github/dash.png
|
||||
[product-screenshot]: .github/readme.gif
|
||||
|
||||
<!-- https://github.com/othneildrew/Best-README-Template -->
|
||||
|
|
|
|||
16
SECURITY.md
16
SECURITY.md
|
|
@ -2,26 +2,22 @@
|
|||
|
||||
## In Beta
|
||||
|
||||
ITFlow is currently in early beta and is a work in progress.
|
||||
We currently advise against storing confidential data in ITFlow for this reason.
|
||||
ITFlow is currently in beta and is a work in progress.
|
||||
|
||||
**We take security seriously.** Whilst we are confident the code is safe, nothing in life is 100% safe or risk-free. You should use your best judgment before entering confidential information into the app.
|
||||
|
||||
That said, in order to eventually be useful, ITFlow **must** be secure and take security seriously.
|
||||
We attempt to follow security best practices where possible, including [automated code scanning](https://sonarcloud.io/component_measures?id=itflow-org_itflow&metric=security_rating&view=list).
|
||||
|
||||
## Supported Versions
|
||||
|
||||
ITFlow is in Beta.
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| Beta | :white_check_mark: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
**Please do not report security vulnerabilities through public GitHub issues.**
|
||||
**<ins>Please do not report security vulnerabilities through public GitHub issues.</ins>**
|
||||
|
||||
If you have discovered a security issue, please report it to us in as much detail as possible, so we can fix it.
|
||||
You should expect to receive an initial acknowledgement within 72 hours. If you do not, please get in touch discretely via GitHub issues/Forum/Discord to ensure we received your e-mail.
|
||||
If you have discovered a security issue, please [report it](https://github.com/itflow-org/itflow/security/advisories/new) to us in as much detail as possible, so we can fix it. You should expect to receive an initial acknowledgement within 72 hours.
|
||||
|
||||
Security contact:
|
||||

|
||||
**Security contact: [GitHub Security Advisories](https://github.com/itflow-org/itflow/security/advisories/new)**
|
||||
|
|
|
|||
|
|
@ -1,61 +1,61 @@
|
|||
<div class="modal" id="addAccountModal" 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"></i> New Account</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>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" placeholder="Account name" required autofocus>
|
||||
<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>New Account</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Opening Balance</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="number" class="form-control" step="0.01" min="0" name="opening_balance" placeholder="Opening Balance" required>
|
||||
</div>
|
||||
</div>
|
||||
<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" placeholder="Account name" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Currency <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-money-bill"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="currency_code" required>
|
||||
<option value="">- Currency -</option>
|
||||
<?php foreach ($currencies_array as $currency_code => $currency_name) { ?>
|
||||
<option <?php if ($session_company_currency == $currency_code) { echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Opening Balance</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="number" class="form-control" step="0.01" min="0" name="opening_balance" placeholder="Opening Balance" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Notes</label>
|
||||
<textarea class="form-control" rows="5" placeholder="Enter some notes" name="notes"></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Currency <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-money-bill"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="currency_code" required>
|
||||
<option value="">- Currency -</option>
|
||||
<?php foreach ($currencies_array as $currency_code => $currency_name) { ?>
|
||||
<option <?php if ($session_company_currency == $currency_code) { echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Notes</label>
|
||||
<textarea class="form-control" rows="5" placeholder="Enter some notes" name="notes"></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_account" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create</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 class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_account" class="btn btn-primary text-bold"><i class="fa fa-fw fa-check"></i> Create</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,37 +1,37 @@
|
|||
<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"></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; ?>">
|
||||
<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" value="<?php echo $account_name; ?>" placeholder="Account name" required>
|
||||
<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>
|
||||
</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>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="account_id" value="<?php echo $account_id; ?>">
|
||||
<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" value="<?php echo $account_name; ?>" placeholder="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 class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="edit_account" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
56
accounts.php
56
accounts.php
|
|
@ -1,17 +1,20 @@
|
|||
<?php require_once("inc_all_settings.php");
|
||||
<?php
|
||||
|
||||
if (!empty($_GET['sb'])) {
|
||||
$sb = strip_tags(mysqli_real_escape_string($mysqli, $_GET['sb']));
|
||||
} else {
|
||||
$sb = "account_name";
|
||||
}
|
||||
// Default Column Sortby Filter
|
||||
$sb = "account_name";
|
||||
$o = "ASC";
|
||||
|
||||
require_once("inc_all.php");
|
||||
|
||||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
$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 accounts
|
||||
WHERE account_name LIKE '%$q%' AND company_id = $session_company_id
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM accounts
|
||||
WHERE account_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()"));
|
||||
|
||||
|
|
@ -19,15 +22,15 @@ $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-piggy-bank"></i> Accounts</h3>
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-piggy-bank mr-2"></i>Accounts</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addAccountModal"><i class="fas fa-fw fa-plus"></i> New Account</button>
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addAccountModal"><i class="fas fa-plus mr-2"></i>New Account</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<div class="input-group">
|
||||
<input type="search" class="form-control col-md-4" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Accounts">
|
||||
<input type="search" class="form-control col-md-4" name="q" value="<?php if (isset($q)) { echo stripslashes(htmlentities($q)); } ?>" placeholder="Search Accounts">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
|
|
@ -48,23 +51,23 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$account_id = $row['account_id'];
|
||||
$account_id = intval($row['account_id']);
|
||||
$account_name = htmlentities($row['account_name']);
|
||||
$opening_balance = $row['opening_balance'];
|
||||
$opening_balance = floatval($row['opening_balance']);
|
||||
$account_currency_code = htmlentities($row['account_currency_code']);
|
||||
$account_notes = htmlentities($row['account_notes']);
|
||||
|
||||
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$total_payments = $row['total_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");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$total_revenues = $row['total_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");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$total_expenses = $row['total_expenses'];
|
||||
$total_expenses = floatval($row['total_expenses']);
|
||||
|
||||
$balance = $opening_balance + $total_payments + $total_revenues - $total_expenses;
|
||||
?>
|
||||
|
|
@ -79,10 +82,14 @@ $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; ?>">Edit</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editAccountModal<?php echo $account_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<?php if ($balance == 0) { //Cannot Archive an Account until it reaches 0 Balance ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="post.php?archive_account=<?php echo $account_id; ?>">Archive</a>
|
||||
<a class="dropdown-item text-danger" href="post.php?archive_account=<?php echo $account_id; ?>">
|
||||
<i class="fas fa-fw fa-archive mr-2"></i>Archive
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -97,14 +104,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php include("pagination.php"); ?>
|
||||
<?php require_once("pagination.php"); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
include("account_add_modal.php");
|
||||
|
||||
include("footer.php");
|
||||
|
||||
?>
|
||||
require_once("account_add_modal.php");
|
||||
require_once("footer.php");
|
||||
|
|
|
|||
22
ajax.php
22
ajax.php
|
|
@ -141,7 +141,9 @@ if (isset($_GET['network_get_json_details'])) {
|
|||
}
|
||||
|
||||
// Lookup all client locations, as networks can be associated with any client location
|
||||
$locations_sql = mysqli_query($mysqli, "SELECT location_id, location_name FROM locations
|
||||
$locations_sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT location_id, location_name FROM locations
|
||||
WHERE location_client_id = '$client_id' AND company_id = '$session_company_id'"
|
||||
);
|
||||
while ($row = mysqli_fetch_array($locations_sql)) {
|
||||
|
|
@ -153,7 +155,7 @@ if (isset($_GET['network_get_json_details'])) {
|
|||
|
||||
if (isset($_POST['client_set_notes'])) {
|
||||
$client_id = intval($_POST['client_id']);
|
||||
$notes = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['notes'])));
|
||||
$notes = sanitizeInput($_POST['notes']);
|
||||
|
||||
// Update notes
|
||||
mysqli_query($mysqli, "UPDATE clients SET client_notes = '$notes' WHERE client_id = '$client_id'");
|
||||
|
|
@ -165,10 +167,10 @@ if (isset($_POST['client_set_notes'])) {
|
|||
|
||||
if (isset($_POST['contact_set_notes'])) {
|
||||
$contact_id = intval($_POST['contact_id']);
|
||||
$notes = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['notes'])));
|
||||
$notes = sanitizeInput($_POST['notes']);
|
||||
|
||||
// Update notes
|
||||
mysqli_query($mysqli, "UPDATE contacts SET contact_notes = '$notes' WHERE contact_id = contact_id");
|
||||
mysqli_query($mysqli, "UPDATE contacts SET contact_notes = '$notes' WHERE contact_id = $contact_id");
|
||||
|
||||
// Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Contact', log_action = 'Modify', log_description = '$session_name modified contact notes', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id, company_id = $session_company_id");
|
||||
|
|
@ -226,28 +228,28 @@ if (isset($_GET['share_generate_link'])) {
|
|||
$item_encrypted_credential = ''; // Default empty
|
||||
|
||||
$client_id = intval($_GET['client_id']);
|
||||
$item_type = trim(strip_tags(mysqli_real_escape_string($mysqli,$_GET['type'])));
|
||||
$item_type = sanitizeInput($_GET['type']);
|
||||
$item_id = intval($_GET['id']);
|
||||
$item_note = trim(strip_tags(mysqli_real_escape_string($mysqli,$_GET['note'])));
|
||||
$item_note = sanitizeInput($_GET['note']);
|
||||
$item_view_limit = intval($_GET['views']);
|
||||
$item_expires = trim(strip_tags(mysqli_real_escape_string($mysqli,$_GET['expires'])));
|
||||
$item_expires = sanitizeInput($_GET['expires']);
|
||||
$item_key = randomString(156);
|
||||
|
||||
if ($item_type == "Document") {
|
||||
$row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT document_name FROM documents WHERE document_id = '$item_id' AND document_client_id = '$client_id' LIMIT 1"));
|
||||
$item_name = strip_tags(mysqli_real_escape_string($mysqli, $row['document_name']));
|
||||
$item_name = sanitizeInput($row['document_name']);
|
||||
}
|
||||
|
||||
if ($item_type == "File") {
|
||||
$row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT file_name FROM files WHERE file_id = '$item_id' AND file_client_id = '$client_id' LIMIT 1"));
|
||||
$item_name = strip_tags(mysqli_real_escape_string($mysqli, $row['file_name']));
|
||||
$item_name = sanitizeInput($row['file_name']);
|
||||
}
|
||||
|
||||
if ($item_type == "Login") {
|
||||
$login = mysqli_query($mysqli, "SELECT login_name, login_username, login_password FROM logins WHERE login_id = '$item_id' AND login_client_id = '$client_id' LIMIT 1");
|
||||
$row = mysqli_fetch_array($login);
|
||||
|
||||
$item_name = strip_tags(mysqli_real_escape_string($mysqli, $row['login_name']));
|
||||
$item_name = sanitizeInput($row['login_name']);
|
||||
|
||||
// Decrypt & re-encrypt username/password for sharing
|
||||
$login_encryption_key = randomString();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,137 @@
|
|||
<?php
|
||||
|
||||
// Variable assignment from POST (or: blank/from DB is updating)
|
||||
if (isset($_POST['asset_name'])) {
|
||||
$name = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_name'])));
|
||||
} elseif (isset($asset_row) && isset($asset_row['asset_name'])) {
|
||||
$name = $asset_row['asset_name'];
|
||||
} else {
|
||||
$name = '';
|
||||
}
|
||||
|
||||
if (isset($_POST['asset_type'])) {
|
||||
$type = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_type'])));
|
||||
} elseif (isset($asset_row) && isset($asset_row['asset_type'])) {
|
||||
$type = $asset_row['asset_type'];
|
||||
} else {
|
||||
$type = '';
|
||||
}
|
||||
|
||||
if (isset($_POST['asset_make'])) {
|
||||
$make = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_make'])));
|
||||
} elseif (isset($asset_row) && isset($asset_row['asset_make'])) {
|
||||
$make = $asset_row['asset_make'];
|
||||
} else {
|
||||
$make = '';
|
||||
}
|
||||
if (isset($_POST['asset_model'])) {
|
||||
$model = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_model'])));
|
||||
} elseif (isset($asset_row) && isset($asset_row['asset_model'])) {
|
||||
$model = $asset_row['asset_model'];
|
||||
} else {
|
||||
$model = '';
|
||||
}
|
||||
|
||||
if (isset($_POST['asset_serial'])) {
|
||||
$serial = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_serial'])));
|
||||
} elseif (isset($asset_row) && isset($asset_row['asset_serial'])) {
|
||||
$serial = $asset_row['asset_serial'];
|
||||
} else {
|
||||
$serial = '';
|
||||
}
|
||||
|
||||
if (isset($_POST['asset_os'])) {
|
||||
$os = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_os'])));
|
||||
} elseif (isset($asset_row) && isset($asset_row['asset_os'])) {
|
||||
$os = $asset_row['asset_os'];
|
||||
} else {
|
||||
$os = '';
|
||||
}
|
||||
|
||||
if (isset($_POST['asset_ip'])) {
|
||||
$aip = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_ip'])));
|
||||
} elseif (isset($asset_row) && isset($asset_row['asset_ip'])) {
|
||||
$aip = $asset_row['asset_ip'];
|
||||
} else {
|
||||
$aip = '';
|
||||
}
|
||||
|
||||
if (isset($_POST['asset_mac'])) {
|
||||
$mac = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_mac'])));
|
||||
} elseif (isset($asset_row) && isset($asset_row['asset_mac'])) {
|
||||
$mac = $asset_row['asset_mac'];
|
||||
} else {
|
||||
$mac = '';
|
||||
}
|
||||
|
||||
if (isset($_POST['asset_status'])) {
|
||||
$status = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_status'])));
|
||||
} elseif (isset($asset_row) && isset($asset_row['asset_status'])) {
|
||||
$status = $asset_row['asset_status'];
|
||||
} else {
|
||||
$status = '';
|
||||
}
|
||||
|
||||
if (isset($_POST['asset_purchase_date']) && !empty($_POST['asset_purchase_date'])) {
|
||||
$purchase_date = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_purchase_date'])));
|
||||
} elseif (isset($asset_row) && isset($asset_row['asset_purchase_date'])) {
|
||||
$purchase_date = $asset_row['asset_purchase_date'];
|
||||
} else {
|
||||
$purchase_date = "0000-00-00";
|
||||
}
|
||||
|
||||
if (isset($_POST['asset_warranty_expire']) && !empty($_POST['asset_warranty_expire'])) {
|
||||
$warranty_expire = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_warranty_expire'])));
|
||||
} elseif (isset($asset_row) && isset($asset_row['asset_warranty_expire'])) {
|
||||
$warranty_expire = $asset_row['asset_warranty_expire'];
|
||||
} else {
|
||||
$warranty_expire = "0000-00-00";
|
||||
}
|
||||
|
||||
if (isset($_POST['asset_install_date']) && !empty($_POST['asset_install_date'])) {
|
||||
$install_date = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_install_date'])));
|
||||
} elseif (isset($asset_row) && isset($asset_row['asset_install_date'])) {
|
||||
$install_date = $asset_row['asset_install_date'];
|
||||
} else {
|
||||
$install_date = "0000-00-00";
|
||||
}
|
||||
|
||||
if (isset($_POST['asset_notes'])) {
|
||||
$notes = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_notes'])));
|
||||
} elseif (isset($asset_row) && isset($asset_row['asset_notes'])) {
|
||||
$notes = $asset_row['asset_notes'];
|
||||
} else {
|
||||
$notes = '';
|
||||
}
|
||||
|
||||
if (isset($_POST['asset_vendor_id'])) {
|
||||
$vendor = intval($_POST['asset_vendor_id']);
|
||||
} elseif (isset($asset_row) && isset($asset_row['asset_vendor_id'])) {
|
||||
$vendor = $asset_row['asset_vendor_id'];
|
||||
} else {
|
||||
$vendor = '0';
|
||||
}
|
||||
|
||||
if (isset($_POST['asset_location_id'])) {
|
||||
$location = intval($_POST['asset_location_id']);
|
||||
} elseif (isset($asset_row) && isset($asset_row['asset_location_id'])) {
|
||||
$location = $asset_row['asset_location_id'];
|
||||
} else {
|
||||
$location = '0';
|
||||
}
|
||||
|
||||
if (isset($_POST['asset_contact_id'])) {
|
||||
$contact = intval($_POST['asset_contact_id']);
|
||||
} elseif (isset($asset_row) && isset($asset_row['asset_contact_id'])) {
|
||||
$contact = $asset_row['asset_contact_id'];
|
||||
} else {
|
||||
$contact = '0';
|
||||
}
|
||||
|
||||
if (isset($_POST['asset_network_id'])) {
|
||||
$network = intval($_POST['asset_network_id']);
|
||||
} elseif (isset($asset_row) && isset($asset_row['asset_network_id'])) {
|
||||
$network = $asset_row['asset_network_id'];
|
||||
} else {
|
||||
$network = '0';
|
||||
}
|
||||
|
|
@ -3,103 +3,22 @@
|
|||
require_once('../validate_api_key.php');
|
||||
require_once('../require_post_method.php');
|
||||
|
||||
// Parse info
|
||||
|
||||
// Variable assignment - assigning blank if a value is not provided
|
||||
if (isset($_POST['asset_name'])) {
|
||||
$name = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_name'])));
|
||||
} else {
|
||||
$name = '';
|
||||
}
|
||||
if (isset($_POST['asset_type'])) {
|
||||
$type = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_type'])));
|
||||
} else {
|
||||
$type = '';
|
||||
}
|
||||
if (isset($_POST['asset_make'])) {
|
||||
$make = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_make'])));
|
||||
} else {
|
||||
$make = '';
|
||||
}
|
||||
if (isset($_POST['asset_model'])) {
|
||||
$model = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_model'])));
|
||||
} else {
|
||||
$model = '';
|
||||
}
|
||||
if (isset($_POST['asset_serial'])) {
|
||||
$serial = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_serial'])));
|
||||
} else {
|
||||
$serial = '';
|
||||
}
|
||||
if (isset($_POST['asset_os'])) {
|
||||
$os = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_os'])));
|
||||
} else {
|
||||
$os = '';
|
||||
}
|
||||
if (isset($_POST['asset_ip'])) {
|
||||
$aip = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_ip'])));
|
||||
} else {
|
||||
$aip = '';
|
||||
}
|
||||
if (isset($_POST['asset_mac'])) {
|
||||
$mac = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_mac'])));
|
||||
} else {
|
||||
$mac = '';
|
||||
}
|
||||
if (isset($_POST['asset_purchase_date'])) {
|
||||
$purchase_date = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_purchase_date'])));
|
||||
} else {
|
||||
$purchase_date = "0000-00-00";
|
||||
}
|
||||
if (isset($_POST['asset_warranty_expire'])) {
|
||||
$warranty_expire = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_warranty_expire'])));
|
||||
} else {
|
||||
$warranty_expire = "0000-00-00";
|
||||
}
|
||||
if (isset($_POST['asset_install_date'])) {
|
||||
$install_date = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_install_date'])));
|
||||
} else {
|
||||
$install_date = "0000-00-00";
|
||||
}
|
||||
if (isset($_POST['asset_notes'])) {
|
||||
$notes = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_notes'])));
|
||||
} else {
|
||||
$notes = '';
|
||||
}
|
||||
if (isset($_POST['asset_vendor_id'])) {
|
||||
$vendor = intval($_POST['asset_vendor_id']);
|
||||
} else {
|
||||
$vendor = '0';
|
||||
}
|
||||
if (isset($_POST['asset_location_id'])) {
|
||||
$location = intval($_POST['asset_location_id']);
|
||||
} else {
|
||||
$location = '0';
|
||||
}
|
||||
if (isset($_POST['asset_contact_id'])) {
|
||||
$contact = intval($_POST['asset_contact_id']);
|
||||
} else {
|
||||
$contact = '0';
|
||||
}
|
||||
if (isset($_POST['asset_network_id'])) {
|
||||
$network = intval($_POST['asset_network_id']);
|
||||
} else {
|
||||
$network = '0';
|
||||
}
|
||||
// Parse POST info
|
||||
require_once('asset_model.php');
|
||||
|
||||
// Default
|
||||
$insert_id = false;
|
||||
|
||||
if (!empty($name) && !empty($client_id)) {
|
||||
// Insert into Database
|
||||
$insert_sql = mysqli_query($mysqli, "INSERT INTO assets SET asset_name = '$name', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_ip = '$aip', asset_mac = '$mac', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_purchase_date = '$purchase_date', asset_warranty_expire = '$warranty_expire', asset_install_date = '$install_date', asset_notes = '$notes', asset_created_at = NOW(), asset_network_id = $network, asset_client_id = $client_id, company_id = '$company_id'");
|
||||
$insert_sql = mysqli_query($mysqli, "INSERT INTO assets SET asset_name = '$name', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_ip = '$aip', asset_mac = '$mac', asset_status = '$status', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_purchase_date = '$purchase_date', asset_warranty_expire = '$warranty_expire', asset_install_date = '$install_date', asset_notes = '$notes', asset_created_at = NOW(), asset_network_id = $network, asset_client_id = $client_id, company_id = '$company_id'");
|
||||
|
||||
if ($insert_sql) {
|
||||
$insert_id = mysqli_insert_id($mysqli);
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Asset', log_action = 'Created', log_description = '$name via API ($api_key_name)', log_ip = '$ip', log_created_at = NOW(), log_client_id = '$client_id', company_id = $company_id");
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'API', log_action = 'Success', log_description = 'Created asset $name via API ($api_key_name)', log_ip = '$ip', log_created_at = NOW(), log_client_id = '$client_id', company_id = $company_id");
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Asset', log_action = 'Created', log_description = '$name via API ($api_key_name)', log_ip = '$ip', log_user_agent = '$user_agent', log_created_at = NOW(), log_client_id = '$client_id', company_id = $company_id");
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'API', log_action = 'Success', log_description = 'Created asset $name via API ($api_key_name)', log_ip = '$ip', log_user_agent = '$user_agent', log_created_at = NOW(), log_client_id = '$client_id', company_id = $company_id");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ if (!empty($asset_id)) {
|
|||
$delete_count = mysqli_affected_rows($mysqli);
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Asset', log_action = 'Deleted', log_description = '$asset_name via API ($api_key_name)', log_ip = '$ip', log_client_id = $client_id, company_id = $company_id");
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Asset', log_action = 'Deleted', log_description = '$asset_name via API ($api_key_name)', log_ip = '$ip', log_user_agent = '$user_agent', log_client_id = $client_id, company_id = $company_id");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,29 +7,28 @@ require_once('../require_get_method.php');
|
|||
if (isset($_GET['asset_id'])) {
|
||||
$id = intval($_GET['asset_id']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_id = '$id' AND asset_client_id LIKE '$client_id' AND company_id = '$company_id'");
|
||||
}
|
||||
|
||||
// Asset query via type
|
||||
elseif (isset($_GET['asset_type'])) {
|
||||
} elseif (isset($_GET['asset_type'])) {
|
||||
// Asset query via type
|
||||
|
||||
$type = mysqli_real_escape_string($mysqli, ucfirst($_GET['asset_type']));
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_type = '$type' AND asset_client_id LIKE '$client_id' AND company_id = '$company_id' ORDER BY asset_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// Asset query via name
|
||||
elseif (isset($_GET['asset_name'])) {
|
||||
} elseif (isset($_GET['asset_name'])) {
|
||||
// Asset query via name
|
||||
|
||||
$name = mysqli_real_escape_string($mysqli, $_GET['asset_name']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_name = '$name' AND asset_client_id LIKE '$client_id' AND company_id = '$company_id' ORDER BY asset_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// Asset query via serial
|
||||
elseif (isset($_GET['asset_serial'])) {
|
||||
} elseif (isset($_GET['asset_serial'])) {
|
||||
// Asset query via serial
|
||||
|
||||
$serial = mysqli_real_escape_string($mysqli, $_GET['asset_serial']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_serial = '$serial' AND asset_client_id LIKE '$client_id' AND company_id = '$company_id' ORDER BY asset_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// Asset query via client ID
|
||||
elseif (isset($_GET['client_id']) && $client_id == "%") {
|
||||
$client_id = intval($_GET['client_id']);
|
||||
} elseif (isset($_GET['client_id'])) {
|
||||
// Asset query via client ID
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_client_id LIKE '$client_id' AND company_id = '$company_id' ORDER BY asset_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,106 +11,22 @@ $update_count = false;
|
|||
|
||||
if (!empty($asset_id)) {
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_id = '$asset_id' AND asset_client_id = $client_id AND company_id = '$company_id' LIMIT 1"));
|
||||
$asset_row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_id = '$asset_id' AND asset_client_id = $client_id AND company_id = '$company_id' LIMIT 1"));
|
||||
|
||||
// Variable assignment - assigning the current database value if a value is not provided
|
||||
if (isset($_POST['asset_name'])) {
|
||||
$name = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_name'])));
|
||||
} else {
|
||||
$name = $row['asset_name'];
|
||||
}
|
||||
if (isset($_POST['asset_type'])) {
|
||||
$type = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_type'])));
|
||||
} else {
|
||||
$type = $row['asset_type'];
|
||||
}
|
||||
if (isset($_POST['asset_make'])) {
|
||||
$make = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_make'])));
|
||||
} else {
|
||||
$make = $row['asset_make'];
|
||||
}
|
||||
if (isset($_POST['asset_model'])) {
|
||||
$model = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_model'])));
|
||||
} else {
|
||||
$model = $row['asset_model'];
|
||||
}
|
||||
if (isset($_POST['asset_serial'])) {
|
||||
$serial = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_serial'])));
|
||||
} else {
|
||||
$serial = $row['asset_serial'];
|
||||
}
|
||||
if (isset($_POST['asset_os'])) {
|
||||
$os = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_os'])));
|
||||
} else {
|
||||
$os = $row['asset_os'];
|
||||
}
|
||||
if (isset($_POST['asset_os'])) {
|
||||
$os = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_os'])));
|
||||
} else {
|
||||
$os = $row['asset_os'];
|
||||
}
|
||||
if (isset($_POST['asset_ip'])) {
|
||||
$aip = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_ip'])));
|
||||
} else {
|
||||
$aip = $row['asset_ip'];
|
||||
}
|
||||
if (isset($_POST['asset_mac'])) {
|
||||
$mac = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_mac'])));
|
||||
} else {
|
||||
$mac = $row['asset_mac'];
|
||||
}
|
||||
if (isset($_POST['asset_purchase_date'])) {
|
||||
$purchase_date = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_purchase_date'])));
|
||||
} else {
|
||||
$purchase_date = $row['asset_purchase_date'];
|
||||
}
|
||||
if (isset($_POST['asset_warranty_expire'])) {
|
||||
$warranty_expire = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_warranty_expire'])));
|
||||
} else {
|
||||
$warranty_expire = $row['asset_warranty_expire'];
|
||||
}
|
||||
if (isset($_POST['asset_install_date'])) {
|
||||
$install_date = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_install_date'])));
|
||||
} else {
|
||||
$install_date = $row['asset_install_date'];
|
||||
}
|
||||
if (isset($_POST['asset_notes'])) {
|
||||
$notes = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_notes'])));
|
||||
} else {
|
||||
$notes = $row['asset_notes'];
|
||||
}
|
||||
if (isset($_POST['asset_vendor_id'])) {
|
||||
$vendor = intval($_POST['asset_vendor_id']);
|
||||
} else {
|
||||
$vendor = $row['asset_vendor_id'];
|
||||
}
|
||||
if (isset($_POST['asset_location_id'])) {
|
||||
$location = intval($_POST['asset_location_id']);
|
||||
} else {
|
||||
$location = $row['asset_location_id'];
|
||||
}
|
||||
if (isset($_POST['asset_contact_id'])) {
|
||||
$contact = intval($_POST['asset_contact_id']);
|
||||
} else {
|
||||
$contact = $row['asset_contact_id'];
|
||||
}
|
||||
if (isset($_POST['asset_network_id'])) {
|
||||
$network = intval($_POST['asset_network_id']);
|
||||
} else {
|
||||
$network = $row['asset_network_id'];
|
||||
}
|
||||
// Variable assignment from POST - assigning the current database value if a value is not provided
|
||||
require_once('asset_model.php');
|
||||
|
||||
$update_sql = mysqli_query($mysqli, "UPDATE assets SET asset_name = '$name', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_ip = '$aip', asset_mac = '$mac', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_purchase_date = '$purchase_date', asset_warranty_expire = '$warranty_expire', asset_install_date = '$install_date', asset_notes = '$notes', asset_updated_at = NOW(), asset_network_id = $network WHERE asset_id = $asset_id AND asset_client_id = $client_id AND company_id = '$company_id' LIMIT 1");
|
||||
$update_sql = mysqli_query($mysqli, "UPDATE assets SET asset_name = '$name', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_ip = '$aip', asset_mac = '$mac', asset_status = '$status', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_purchase_date = '$purchase_date', asset_warranty_expire = '$warranty_expire', asset_install_date = '$install_date', asset_notes = '$notes', asset_updated_at = NOW(), asset_network_id = $network WHERE asset_id = $asset_id AND asset_client_id = $client_id AND company_id = '$company_id' LIMIT 1");
|
||||
|
||||
// Check insert & get insert ID
|
||||
if ($update_sql) {
|
||||
$update_count = mysqli_affected_rows($mysqli);
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Asset', log_action = 'Updated', log_description = '$name via API ($api_key_name)', log_ip = '$ip', log_client_id = $client_id, company_id = $company_id");
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'API', log_action = 'Success', log_description = 'Updated asset $name via API ($api_key_name)', log_ip = '$ip', log_client_id = $client_id, company_id = $company_id");
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Asset', log_action = 'Updated', log_description = '$name via API ($api_key_name)', log_ip = '$ip', log_user_agent = '$user_agent', log_client_id = $client_id, company_id = $company_id");
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'API', log_action = 'Success', log_description = 'Updated asset $name via API ($api_key_name)', log_ip = '$ip', log_user_agent = '$user_agent', log_client_id = $client_id, company_id = $company_id");
|
||||
}
|
||||
}
|
||||
|
||||
// Output
|
||||
require_once('../update_output.php');
|
||||
require_once('../update_output.php');
|
||||
|
|
|
|||
|
|
@ -7,24 +7,23 @@ require_once('../require_get_method.php');
|
|||
if (isset($_GET['certificate_id'])) {
|
||||
$id = intval($_GET['certificate_id']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM certificates WHERE certificate_id = '$id' AND certificate_client_id LIKE '$client_id' AND company_id = '$company_id'");
|
||||
}
|
||||
|
||||
// Certificate by name
|
||||
elseif (isset($_GET['certificate_name'])) {
|
||||
} elseif (isset($_GET['certificate_name'])) {
|
||||
// Certificate by name
|
||||
|
||||
$name = mysqli_real_escape_string($mysqli, $_GET['certificate_name']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM certificates WHERE certificate_name = '$name' AND certificate_client_id LIKE '$client_id' AND company_id = '$company_id' ORDER BY certificate_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// Certificate via client ID (if allowed)
|
||||
elseif (isset($_GET['client_id']) && $client_id == "%") {
|
||||
$client_id = intval($_GET['client_id']);
|
||||
} elseif (isset($_GET['client_id'])) {
|
||||
// Certificate via client ID
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM certificates WHERE certificate_client_id = '$client_id' AND company_id = '$company_id' ORDER BY certificate_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// All certificates
|
||||
else {
|
||||
} else {
|
||||
// All certificates
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM certificates WHERE certificate_client_id LIKE '$client_id' AND company_id = '$company_id' ORDER BY certificate_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// Output
|
||||
require_once("../read_output.php");
|
||||
require_once("../read_output.php");
|
||||
|
|
|
|||
|
|
@ -7,18 +7,18 @@ require_once('../require_get_method.php');
|
|||
if (isset($_GET['client_id'])) {
|
||||
$id = intval($_GET['client_id']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_id = '$id' AND client_id LIKE '$client_id' AND company_id = '$company_id'");
|
||||
}
|
||||
|
||||
// Specific client via name (single)
|
||||
elseif (isset($_GET['client_name'])) {
|
||||
} elseif (isset($_GET['client_name'])) {
|
||||
// Specific client via name (single)
|
||||
|
||||
$name = mysqli_real_escape_string($mysqli, $_GET['client_name']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_name = '$name' AND client_id LIKE '$client_id' AND company_id = '$company_id'");
|
||||
}
|
||||
|
||||
// All clients
|
||||
else {
|
||||
} else {
|
||||
// All clients
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_id LIKE '$client_id' AND company_id = '$company_id' ORDER BY client_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// Output
|
||||
require_once("../read_output.php");
|
||||
require_once("../read_output.php");
|
||||
|
|
|
|||
|
|
@ -1,16 +1,107 @@
|
|||
<?php
|
||||
define('number_regex', '/[^0-9]/');
|
||||
|
||||
$name = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['contact_name'])));
|
||||
$title = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['contact_title'])));
|
||||
$department = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['contact_department'])));
|
||||
$email = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['contact_email'])));
|
||||
$phone = preg_replace(number_regex, '', $_POST['contact_phone']);
|
||||
$extension = preg_replace(number_regex, '', $_POST['contact_extension']);
|
||||
$mobile = preg_replace(number_regex, '', $_POST['contact_mobile']);
|
||||
$notes = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['contact_notes'])));
|
||||
$auth_method = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['contact_auth_method'])));
|
||||
$important = intval($_POST['contact_important']);
|
||||
$billing = intval($_POST['contact_billing']);
|
||||
$technical = intval($_POST['contact_technical']);
|
||||
$location_id = intval($_POST['contact_location_id']);
|
||||
// Variable assignment from POST (or: blank/from DB is updating)
|
||||
if (isset($_POST['contact_name'])) {
|
||||
$name = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['contact_name'])));
|
||||
} elseif ($contact_row) {
|
||||
$name = $contact_row['contact_name'];
|
||||
} else {
|
||||
$name = '';
|
||||
}
|
||||
|
||||
if (isset($_POST['contact_title'])) {
|
||||
$title = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['contact_title'])));
|
||||
} elseif ($contact_row) {
|
||||
$title = $contact_row['contact_title'];
|
||||
} else {
|
||||
$title = '';
|
||||
}
|
||||
|
||||
if (isset($_POST['contact_department'])) {
|
||||
$department = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['contact_department'])));
|
||||
} elseif ($contact_row) {
|
||||
$department = $contact_row['contact_department'];
|
||||
} else {
|
||||
$department = '';
|
||||
}
|
||||
|
||||
if (isset($_POST['contact_email'])) {
|
||||
$email = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['contact_email'])));
|
||||
} elseif ($contact_row) {
|
||||
$email = $contact_row['contact_email'];
|
||||
} else {
|
||||
$email = '';
|
||||
}
|
||||
|
||||
if (isset($_POST['contact_phone'])) {
|
||||
$phone = preg_replace(number_regex, '', $_POST['contact_phone']);
|
||||
} elseif ($contact_row) {
|
||||
$phone = $contact_row['contact_phone'];
|
||||
} else {
|
||||
$phone = '';
|
||||
}
|
||||
|
||||
if (isset($_POST['contact_extension'])) {
|
||||
$extension = preg_replace(number_regex, '', $_POST['contact_extension']);
|
||||
} elseif ($contact_row) {
|
||||
$extension = $contact_row['contact_extension'];
|
||||
} else {
|
||||
$extension = '';
|
||||
}
|
||||
|
||||
if (isset($_POST['contact_mobile'])) {
|
||||
$mobile = preg_replace(number_regex, '', $_POST['contact_mobile']);
|
||||
} elseif ($contact_row) {
|
||||
$mobile = $contact_row['contact_mobile'];
|
||||
} else {
|
||||
$mobile = '';
|
||||
}
|
||||
|
||||
if (isset($_POST['contact_notes'])) {
|
||||
$notes = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['contact_notes'])));
|
||||
} elseif ($contact_row) {
|
||||
$notes = $contact_row['contact_notes'];
|
||||
} else {
|
||||
$notes = '';
|
||||
}
|
||||
|
||||
if (isset($_POST['contact_auth_method'])) {
|
||||
$auth_method = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['contact_auth_method'])));
|
||||
} elseif ($contact_row) {
|
||||
$auth_method = $contact_row['contact_auth_method'];
|
||||
} else {
|
||||
$auth_method = '';
|
||||
}
|
||||
|
||||
if (isset($_POST['contact_important'])) {
|
||||
$important = intval($_POST['contact_important']);
|
||||
} elseif ($contact_row) {
|
||||
$important = $contact_row['contact_important'];
|
||||
} else {
|
||||
$important = '0';
|
||||
}
|
||||
|
||||
if (isset($_POST['contact_billing'])) {
|
||||
$billing = intval($_POST['contact_billing']);
|
||||
} elseif ($contact_row) {
|
||||
$billing = $contact_row['contact_billing'];
|
||||
} else {
|
||||
$billing = '0';
|
||||
}
|
||||
|
||||
if (isset($_POST['contact_technical'])) {
|
||||
$technical = intval($_POST['contact_technical']);
|
||||
} elseif ($contact_row) {
|
||||
$technical = $contact_row['contact_technical'];
|
||||
} else {
|
||||
$technical = '0';
|
||||
}
|
||||
|
||||
if (isset($_POST['contact_location_id'])) {
|
||||
$location_id = intval($_POST['contact_location_id']);
|
||||
} elseif ($contact_row) {
|
||||
$location_id = $contact_row['contact_location_id'];
|
||||
} else {
|
||||
$location_id = '';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ require_once('../require_post_method.php');
|
|||
require_once('contact_model.php');
|
||||
|
||||
// Default
|
||||
$insert_id = FALSE;
|
||||
$insert_id = false;
|
||||
|
||||
if (!empty($name) && !empty($email) && !empty($client_id)) {
|
||||
|
||||
|
|
@ -23,8 +23,8 @@ if (!empty($name) && !empty($email) && !empty($client_id)) {
|
|||
if ($insert_sql) {
|
||||
$insert_id = mysqli_insert_id($mysqli);
|
||||
//Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Contact', log_action = 'Created', log_description = '$name via API ($api_key_name)', log_ip = '$ip', log_created_at = NOW(), log_client_id = $client_id, company_id = $company_id");
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'API', log_action = 'Success', log_description = 'Created contact $name via API ($api_key_name)', log_ip = '$ip', log_created_at = NOW(), log_client_id = $client_id, company_id = $company_id");
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Contact', log_action = 'Created', log_description = '$name via API ($api_key_name)', log_ip = '$ip', log_user_agent = '$user_agent', log_created_at = NOW(), log_client_id = $client_id, company_id = $company_id");
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'API', log_action = 'Success', log_description = 'Created contact $name via API ($api_key_name)', log_ip = '$ip', log_user_agent = '$user_agent', log_created_at = NOW(), log_client_id = $client_id, company_id = $company_id");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ require_once('../require_post_method.php');
|
|||
$contact_id = intval($_POST['contact_id']);
|
||||
|
||||
// Default
|
||||
$delete_count = FALSE;
|
||||
$delete_count = false;
|
||||
|
||||
if (!empty($contact_id)) {
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_id = $contact_id AND contact_client_id = $client_id AND company_id = '$company_id' LIMIT 1"));
|
||||
|
|
@ -20,9 +20,9 @@ if (!empty($contact_id)) {
|
|||
$delete_count = mysqli_affected_rows($mysqli);
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Contact', log_action = 'Deleted', log_description = '$contact_name via API ($api_key_name)', log_ip = '$ip', log_client_id = $client_id, company_id = $company_id");
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Contact', log_action = 'Deleted', log_description = '$contact_name via API ($api_key_name)', log_ip = '$ip', log_user_agent = '$user_agent', log_client_id = $client_id, company_id = $company_id");
|
||||
}
|
||||
}
|
||||
|
||||
// Output
|
||||
require_once('../delete_output.php');
|
||||
require_once('../delete_output.php');
|
||||
|
|
|
|||
|
|
@ -7,18 +7,18 @@ require_once('../require_get_method.php');
|
|||
if (isset($_GET['contact_id'])) {
|
||||
$id = intval($_GET['contact_id']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_id = '$id' AND contact_client_id LIKE '$client_id' AND company_id = '$company_id'");
|
||||
}
|
||||
|
||||
// Specific contact via email (single)
|
||||
elseif (isset($_GET['contact_email'])) {
|
||||
} elseif (isset($_GET['contact_email'])) {
|
||||
// Specific contact via email (single)
|
||||
|
||||
$email = mysqli_real_escape_string($mysqli, $_GET['contact_email']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_email = '$email' AND contact_client_id LIKE '$client_id' AND company_id = '$company_id'");
|
||||
}
|
||||
|
||||
// All contacts
|
||||
else {
|
||||
} else {
|
||||
// All contacts
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_client_id LIKE '$client_id' AND company_id = '$company_id' ORDER BY contact_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// Output
|
||||
require_once("../read_output.php");
|
||||
require_once("../read_output.php");
|
||||
|
|
|
|||
|
|
@ -5,12 +5,16 @@ require_once('../require_post_method.php');
|
|||
|
||||
// Parse Info
|
||||
$contact_id = intval($_POST['contact_id']);
|
||||
require_once('contact_model.php');
|
||||
|
||||
// Default
|
||||
$update_count = FALSE;
|
||||
$update_count = false;
|
||||
|
||||
if (!empty($name) && !empty($email)) {
|
||||
if (!empty($contact_id)) {
|
||||
|
||||
$contact_row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_id = '$contact_id' AND contact_client_id = $client_id AND company_id = '$company_id' LIMIT 1"));
|
||||
|
||||
// Variable assignment from POST - assigning the current database value if a value is not provided
|
||||
require_once('contact_model.php');
|
||||
|
||||
$update_sql = mysqli_query($mysqli, "UPDATE contacts SET contact_name = '$name', contact_title = '$title', contact_department = '$department', contact_email = '$email', contact_phone = '$phone', contact_extension = '$extension', contact_mobile = '$mobile', contact_notes = '$notes', contact_auth_method = '$auth_method', contact_important = '$important', contact_billing = '$billing', contact_technical = '$technical', contact_updated_at = NOW(), contact_location_id = $location_id, contact_client_id = $client_id, company_id = $company_id WHERE contact_id = $contact_id LIMIT 1");
|
||||
|
||||
|
|
@ -19,8 +23,8 @@ if (!empty($name) && !empty($email)) {
|
|||
$update_count = mysqli_affected_rows($mysqli);
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Contact', log_action = 'Updated', log_description = '$name via API ($api_key_name)', log_ip = '$ip', log_created_at = NOW(), log_client_id = $client_id, company_id = $company_id");
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'API', log_action = 'Success', log_description = 'Updated contact $name via API ($api_key_name)', log_ip = '$ip', log_created_at = NOW(), log_client_id = $client_id, company_id = $company_id");
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Contact', log_action = 'Updated', log_description = '$name via API ($api_key_name)', log_ip = '$ip', log_user_agent = '$user_agent', log_created_at = NOW(), log_client_id = $client_id, company_id = $company_id");
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'API', log_action = 'Success', log_description = 'Updated contact $name via API ($api_key_name)', log_ip = '$ip', log_user_agent = '$user_agent', log_created_at = NOW(), log_client_id = $client_id, company_id = $company_id");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,12 @@ if (isset($insert_id) && is_numeric($insert_id)) {
|
|||
else {
|
||||
$return_arr['success'] = "False";
|
||||
$return_arr['message'] = "Auth success but insert query failed, ensure ALL required variables are provided (and aren't duplicates where applicable) and database schema is up-to-date. Turn on error logging and look for 'undefined index'.";
|
||||
|
||||
// Log any database/schema related errors to the PHP Error log
|
||||
if (mysqli_error($mysqli)) {
|
||||
error_log("API Database Error: " . mysqli_error($mysqli));
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($return_arr);
|
||||
exit();
|
||||
exit();
|
||||
|
|
|
|||
|
|
@ -17,7 +17,12 @@ if (isset($delete_count) && is_numeric($delete_count) && $delete_count > 0) {
|
|||
else {
|
||||
$return_arr['success'] = "False";
|
||||
$return_arr['message'] = "Auth success but delete query failed. Ensure ALL required variables are provided and database schema is up-to-date. Most likely cause: asset/client/company ID mismatch.";
|
||||
|
||||
// Log any database/schema related errors to the PHP Error log
|
||||
if (mysqli_error($mysqli)) {
|
||||
error_log("API Database Error: " . mysqli_error($mysqli));
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($return_arr);
|
||||
exit();
|
||||
exit();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
require_once('../validate_api_key.php');
|
||||
require_once('../require_get_method.php');
|
||||
|
||||
if (isset($_GET['document_id'])) {
|
||||
// Document via ID (single)
|
||||
|
||||
$id = intval($_GET['document_id']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_id = '$id' AND document_client_id LIKE '$client_id' AND company_id = '$company_id'");
|
||||
|
||||
} else {
|
||||
// All documents
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_client_id LIKE '$client_id' AND company_id = '$company_id' ORDER BY document_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// Output
|
||||
require_once("../read_output.php");
|
||||
|
|
@ -7,24 +7,23 @@ require_once('../require_get_method.php');
|
|||
if (isset($_GET['domain_id'])) {
|
||||
$id = intval($_GET['domain_id']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM domains WHERE domain_id = '$id' AND domain_client_id LIKE '$client_id' AND company_id = '$company_id'");
|
||||
}
|
||||
|
||||
// Domain by name
|
||||
elseif (isset($_GET['domain_name'])) {
|
||||
} elseif (isset($_GET['domain_name'])) {
|
||||
// Domain by name
|
||||
|
||||
$name = mysqli_real_escape_string($mysqli, $_GET['domain_name']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM domains WHERE domain_name = '$name' AND domain_client_id LIKE '$client_id' AND company_id = '$company_id' ORDER BY asset_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// Domain via client ID (if allowed)
|
||||
elseif (isset($_GET['client_id']) && $client_id == "%") {
|
||||
$client_id = intval($_GET['client_id']);
|
||||
} elseif (isset($_GET['client_id'])) {
|
||||
// Domain via client ID
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM domains WHERE domain_client_id LIKE '$client_id' AND company_id = '$company_id' ORDER BY domain_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// All domains
|
||||
else {
|
||||
} else {
|
||||
// All domains
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM domains WHERE domain_client_id LIKE '$client_id' AND company_id = '$company_id' ORDER BY domain_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// Output
|
||||
require_once("../read_output.php");
|
||||
require_once("../read_output.php");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
require_once('../validate_api_key.php');
|
||||
require_once('../require_get_method.php');
|
||||
|
||||
// Expenses aren't stored against client IDs, so we instead validate the API key is for All Clients
|
||||
|
||||
if (isset($_GET['expense_id']) && $client_id == "%") {
|
||||
// Expense via ID (single)
|
||||
|
||||
$id = intval($_GET['expense_id']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM expenses WHERE expense_id = '$id' AND company_id = '$company_id'");
|
||||
|
||||
} elseif ($client_id == "%") {
|
||||
// All expenses
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM expenses WHERE company_id = '$company_id' ORDER BY expense_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// Output
|
||||
require_once("../read_output.php");
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
require_once('../validate_api_key.php');
|
||||
require_once('../require_get_method.php');
|
||||
|
||||
if (isset($_GET['invoice_id'])) {
|
||||
// Invoice via ID (single)
|
||||
|
||||
$id = intval($_GET['invoice_id']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_id = '$id' AND invoice_client_id LIKE '$client_id' AND company_id = '$company_id'");
|
||||
|
||||
} else {
|
||||
// All invoices
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_client_id LIKE '$client_id' AND company_id = '$company_id' ORDER BY invoice_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// Output
|
||||
require_once("../read_output.php");
|
||||
|
|
@ -7,24 +7,23 @@ require_once('../require_get_method.php');
|
|||
if (isset($_GET['network_id'])) {
|
||||
$id = intval($_GET['network_id']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM networks WHERE network_id = '$id' AND network_client_id LIKE '$client_id' AND company_id = '$company_id'");
|
||||
}
|
||||
|
||||
// Network by name
|
||||
elseif (isset($_GET['network_name'])) {
|
||||
} elseif (isset($_GET['network_name'])) {
|
||||
// Network by name
|
||||
|
||||
$name = mysqli_real_escape_string($mysqli, $_GET['network_name']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM networks WHERE network_name = '$name' AND network_client_id LIKE '$client_id' AND company_id = '$company_id' ORDER BY network_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// Network via client ID (if allowed)
|
||||
elseif (isset($_GET['client_id']) && $client_id == "%") {
|
||||
$client_id = intval($_GET['client_id']);
|
||||
} elseif (isset($_GET['client_id'])) {
|
||||
// Network via client ID
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM networks WHERE network_client_id LIKE '$client_id' AND company_id = '$company_id' ORDER BY network_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// All networks
|
||||
else {
|
||||
} else {
|
||||
// All networks
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM networks WHERE network_client_id LIKE '$client_id' AND company_id = '$company_id' ORDER BY network_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// Output
|
||||
require_once("../read_output.php");
|
||||
require_once("../read_output.php");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
require_once('../validate_api_key.php');
|
||||
require_once('../require_get_method.php');
|
||||
|
||||
// Payments aren't stored against client IDs, so we instead validate the API key is for All Clients
|
||||
|
||||
|
||||
if (isset($_GET['payment_id']) && $client_id == "%") {
|
||||
// Payment via ID (single)
|
||||
|
||||
$id = intval($_GET['payment_id']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM payments WHERE payment_id = '$id' AND company_id = '$company_id'");
|
||||
|
||||
} elseif (isset($_GET['payment_invoice_id']) && $client_id == "%") {
|
||||
// Payments for an invoice
|
||||
|
||||
$id = intval($_GET['payment_invoice_id']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM payments WHERE payment_invoice_id = '$id' AND company_id = '$company_id'");
|
||||
|
||||
} elseif ($client_id == "%") {
|
||||
// All payments
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM payments WHERE company_id = '$company_id' ORDER BY payment_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// Output
|
||||
require_once("../read_output.php");
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
require_once('../validate_api_key.php');
|
||||
require_once('../require_get_method.php');
|
||||
|
||||
// Products aren't stored against client IDs, so we instead validate the API key is for All Clients
|
||||
|
||||
if (isset($_GET['product_id']) && $client_id == "%") {
|
||||
// product via ID (single)
|
||||
|
||||
$id = intval($_GET['product_id']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM products WHERE product_id = '$id' AND company_id = '$company_id'");
|
||||
|
||||
} elseif ($client_id == "%") {
|
||||
// All products
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM products WHERE company_id = '$company_id' ORDER BY product_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// Output
|
||||
require_once("../read_output.php");
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
require_once('../validate_api_key.php');
|
||||
require_once('../require_get_method.php');
|
||||
|
||||
if (isset($_GET['quote_id'])) {
|
||||
// quote via ID (single)
|
||||
|
||||
$id = intval($_GET['quote_id']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM quotes WHERE quote_id LIKE '$id' AND quote_client_id = '$client_id' AND company_id = '$company_id'");
|
||||
|
||||
} else {
|
||||
// All quotes
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM quotes WHERE quote_client_id LIKE '$client_id' AND company_id = '$company_id' ORDER BY quote_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// Output
|
||||
require_once("../read_output.php");
|
||||
|
|
@ -21,6 +21,12 @@ if ($sql && mysqli_num_rows($sql) > 0) {
|
|||
else {
|
||||
$return_arr['success'] = "False";
|
||||
$return_arr['message'] = "No resource (for this client and company) with the specified parameter(s).";
|
||||
|
||||
// Log any database/schema related errors to the PHP Error log
|
||||
if (mysqli_error($mysqli)) {
|
||||
error_log("API Database Error: " . mysqli_error($mysqli));
|
||||
}
|
||||
|
||||
echo json_encode($return_arr);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,11 @@ if ($_SERVER['REQUEST_METHOD'] !== "GET") {
|
|||
exit();
|
||||
}
|
||||
|
||||
// Wildcard client ID for most SELECT queries
|
||||
// Wildcard client ID for most SELECT queries, unless otherwise specified (and allowed)
|
||||
if ($client_id == 0) {
|
||||
$client_id = "%";
|
||||
}
|
||||
if (isset($_GET['client_id'])) {
|
||||
$client_id = intval($_GET['client_id']);
|
||||
} else {
|
||||
$client_id = "%";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,36 +7,35 @@ require_once('../require_get_method.php');
|
|||
if (isset($_GET['software_id'])) {
|
||||
$id = intval($_GET['software_id']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM software WHERE software_id = '$id' AND software_client_id LIKE '$client_id' AND company_id = '$company_id'");
|
||||
}
|
||||
|
||||
// Specific software via key
|
||||
if (isset($_GET['software_key'])) {
|
||||
} elseif (isset($_GET['software_key'])) {
|
||||
// Specific software via key
|
||||
|
||||
$key = mysqli_real_escape_string($mysqli, $_GET['software_license']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM software WHERE software_key = '$key' AND software_client_id LIKE '$client_id' AND company_id = '$company_id' ORDER BY software_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// Software by name
|
||||
elseif (isset($_GET['software_name'])) {
|
||||
} elseif (isset($_GET['software_name'])) {
|
||||
// Software by name
|
||||
|
||||
$name = mysqli_real_escape_string($mysqli, $_GET['software_name']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM software WHERE software_name = '$name' AND software_client_id LIKE '$client_id' AND company_id = '$company_id' ORDER BY asset_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// Software via type
|
||||
elseif (isset($_GET['software_type'])) {
|
||||
} elseif (isset($_GET['software_type'])) {
|
||||
// Software via type
|
||||
|
||||
$type = intval($_GET['software_type']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM software WHERE software_type = '$type' AND software_client_id LIKE '$client_id' AND company_id = '$company_id' ORDER BY software_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// Software via client ID (if allowed)
|
||||
elseif (isset($_GET['client_id']) && $client_id == "%") {
|
||||
$client_id = intval($_GET['client_id']);
|
||||
} elseif (isset($_GET['client_id'])) {
|
||||
// Software via client ID
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM software WHERE software_client_id LIKE '$client_id' AND company_id = '$company_id' ORDER BY software_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// All software(s)
|
||||
else {
|
||||
} else {
|
||||
// All software(s)
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM software WHERE software_client_id LIKE '$client_id' AND company_id = '$company_id' ORDER BY software_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// Output
|
||||
require_once("../read_output.php");
|
||||
require_once("../read_output.php");
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ require_once('../require_get_method.php');
|
|||
if (isset($_GET['ticket_id'])) {
|
||||
$id = intval($_GET['ticket_id']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = '$id' AND ticket_client_id LIKE '$client_id' AND company_id = '$company_id'");
|
||||
}
|
||||
|
||||
// All tickets
|
||||
else {
|
||||
} else {
|
||||
// All tickets
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_client_id LIKE '$client_id' AND company_id = '$company_id' ORDER BY ticket_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// Output
|
||||
require_once("../read_output.php");
|
||||
require_once("../read_output.php");
|
||||
|
|
|
|||
|
|
@ -16,8 +16,13 @@ if (isset($update_count) && is_numeric($update_count) && $update_count > 0) {
|
|||
// Query returned false: something went wrong, or it was declined due to required variables missing
|
||||
else {
|
||||
$return_arr['success'] = "False";
|
||||
$return_arr['message'] = "Auth success but update query failed/returned no results. Ensure ALL required variables are provided and database schema is up-to-date. Most likely cause: non-existent module ID (contact ID/ticket ID/etc)";
|
||||
$return_arr['message'] = "Auth success but update query failed/returned no results. Ensure ALL required variables are provided and database schema is up-to-date. Most likely cause: non-existent module ID (i.e. bad contact ID/ticket ID/etc).";
|
||||
|
||||
// Log any database/schema related errors to the PHP Error log
|
||||
if (mysqli_error($mysqli)) {
|
||||
error_log("API Database Error: " . mysqli_error($mysqli));
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($return_arr);
|
||||
exit();
|
||||
exit();
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
// Includes
|
||||
require_once( __DIR__ . '../../../functions.php');
|
||||
require_once(__DIR__ . '../../../functions.php');
|
||||
require_once(__DIR__ . "../../../config.php");
|
||||
|
||||
// JSON header
|
||||
|
|
@ -16,9 +16,8 @@ header('Content-Type: application/json');
|
|||
// POST data
|
||||
$_POST = json_decode(file_get_contents('php://input'), true);
|
||||
|
||||
// Get user IP
|
||||
// Get IP & UA
|
||||
$ip = strip_tags(mysqli_real_escape_string($mysqli, getIP()));
|
||||
// Get user agent
|
||||
$user_agent = strip_tags(mysqli_real_escape_string($mysqli, $_SERVER['HTTP_USER_AGENT']));
|
||||
|
||||
// Setup return array
|
||||
|
|
@ -81,10 +80,10 @@ if (isset($api_key)) {
|
|||
header(WORDING_UNAUTHORIZED);
|
||||
echo json_encode($return_arr);
|
||||
exit();
|
||||
}
|
||||
|
||||
// Success
|
||||
else {
|
||||
} else {
|
||||
|
||||
// SUCCESS
|
||||
|
||||
// Set client ID, company ID & key name
|
||||
$row = mysqli_fetch_array($sql);
|
||||
|
|
@ -95,21 +94,17 @@ if (isset($api_key)) {
|
|||
// Set limit & offset for queries
|
||||
if (isset($_GET['limit'])) {
|
||||
$limit = intval($_GET['limit']);
|
||||
}
|
||||
elseif (isset($_POST['limit'])) {
|
||||
} elseif (isset($_POST['limit'])) {
|
||||
$limit = intval($_POST['limit']);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
if (isset($_GET['offset'])) {
|
||||
$offset = intval($_GET['offset']);
|
||||
}
|
||||
elseif (isset($_POST['offset'])) {
|
||||
} elseif (isset($_POST['offset'])) {
|
||||
$offset = intval($_POST['offset']);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ $key = randomString(156);
|
|||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-key"></i> New Key</h5>
|
||||
<h5 class="modal-title"><i class="fas fa-fw fa-key mr-2"></i>New Key</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
|
|
@ -63,7 +63,7 @@ $key = randomString(156);
|
|||
<?php
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE company_id = $session_company_id ORDER BY client_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$client_id = $row['client_id'];
|
||||
$client_id = intval($row['client_id']);
|
||||
$client_name = htmlentities($row['client_name']); ?>
|
||||
<option value="<?php echo $client_id; ?>"><?php echo "$client_name (Client ID: $client_id)"; ?></option>
|
||||
<?php } ?>
|
||||
|
|
@ -73,8 +73,8 @@ $key = randomString(156);
|
|||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_api_key" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Create</button>
|
||||
<button type="submit" name="add_api_key" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class Base32Static {
|
|||
$i=0;
|
||||
|
||||
while($i < count($fiveBitBinaryArray)) {
|
||||
$base32 .= self::$map[base_convert(str_pad($fiveBitBinaryArray[$i], 5,'0'), 2, 10)];
|
||||
$base32 .= self::$map[base_convert(str_pad($fiveBitBinaryArray[$i], 5, '0'), 2, 10)];
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ class Base32Static {
|
|||
substr($input, -($allowedValues[$i])) != str_repeat(self::$map[32], $allowedValues[$i])) return false;
|
||||
}
|
||||
|
||||
$input = str_replace('=','', $input);
|
||||
$input = str_replace('=', '', $input);
|
||||
$input = str_split($input);
|
||||
$binaryString = "";
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ class Base32Static {
|
|||
$eightBits = str_split($x, 8);
|
||||
|
||||
for ($z = 0; $z < count($eightBits); $z++) {
|
||||
$binaryString .= ( ($y = chr(base_convert($eightBits[$z], 2, 10))) || ord($y) == 48 ) ? $y:"";
|
||||
$binaryString .= (($y = chr(base_convert($eightBits[$z], 2, 10))) || ord($y) == 48) ? $y:"";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
19
blank.php
19
blank.php
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
<!-- Breadcrumbs-->
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="index.html">Dashboard</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active">Blank Page</li>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="index.html">Dashboard</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active">Blank Page</li>
|
||||
</ol>
|
||||
|
||||
<!-- Page Content -->
|
||||
|
|
@ -18,6 +18,17 @@
|
|||
|
||||
<?php echo randomString(100); ?>
|
||||
<br>
|
||||
<form>
|
||||
<?php
|
||||
$timezones = DateTimeZone::listIdentifiers();
|
||||
echo '<select name="timezone">';
|
||||
foreach ($timezones as $timezone) {
|
||||
echo '<option value="' . $timezone . '">' . $timezone . '</option>';
|
||||
}
|
||||
echo '</select>';
|
||||
|
||||
?>
|
||||
</form>
|
||||
|
||||
<script>toastr.success('Have Fun Wozz!!')</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,41 +1,41 @@
|
|||
<div class="modal" id="addCalendarModal" 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-calendar-plus"></i> New Calendar</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</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="name" placeholder="Name your calendar" required autofocus>
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-calendar-plus mr-2"></i>New Calendar</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Color</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-palette"></i></span>
|
||||
</div>
|
||||
<input type="color" class="form-control" name="color" required>
|
||||
</div>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name</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="name" placeholder="Name your calendar" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Color</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-palette"></i></span>
|
||||
</div>
|
||||
<input type="color" class="form-control" name="color" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_calendar" class="btn btn-primary"><i class="fa fa-check mr-2"></i>Create</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 class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_calendar" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,162 +1,156 @@
|
|||
<div class="modal" id="addCalendarEventModal" 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-calendar-plus"></i> New Event</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">
|
||||
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-event"><i class="fa fa-fw fa-calendar"></i> Event</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-more"><i class="fa fa-fw fa-info-circle"></i> More</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-attendees"><i class="fa fa-fw fa-users"></i> Attendees</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-event">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Title <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-day"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="title" placeholder="Title of the event" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Calendar <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>
|
||||
<select class="form-control select2" name="calendar" required>
|
||||
<option value="">- Calendar -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM calendars WHERE company_id = $session_company_id ORDER BY calendar_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$calendar_id = $row['calendar_id'];
|
||||
$calendar_name = htmlentities($row['calendar_name']);
|
||||
$calendar_color = htmlentities($row['calendar_color']);
|
||||
?>
|
||||
<option <?php if ($config_default_calendar == $calendar_id) { echo "selected"; } ?> data-content="<i class='fa fa-circle mr-2' style='color:<?php echo $calendar_color; ?>;'></i> <?php echo $calendar_name; ?>" value="<?php echo $calendar_id; ?>"><?php echo $calendar_name; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-dark" data-toggle="modal" data-target="#addQuickCalendarModal"><i class="fas fa-fw fa-plus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label>Start / End <strong class="text-danger">*</strong></label>
|
||||
<div class="form-row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<input type="datetime-local" class="form-control form-control-sm" id="event_add_start" name="start" required onblur="updateIncrementEndTime()">
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<input type="datetime-local" class="form-control form-control-sm" id="event_add_end" name="end" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description</label>
|
||||
<textarea class="form-control" rows="4" name="description" placeholder="Enter a description"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-calendar-plus mr-2"></i>New Event</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="tab-pane fade" id="pills-more">
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-event"><i class="fa fa-fw fa-calendar mr-2"></i>Event</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-more"><i class="fa fa-fw fa-info-circle mr-2"></i>More</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-attendees"><i class="fa fa-fw fa-users mr-2"></i>Attendees</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-event">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Title <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-day"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="title" placeholder="Title of the event" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Calendar <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>
|
||||
<select class="form-control select2" name="calendar" required>
|
||||
<option value="">- Calendar -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM calendars WHERE company_id = $session_company_id ORDER BY calendar_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$calendar_id = intval($row['calendar_id']);
|
||||
$calendar_name = htmlentities($row['calendar_name']);
|
||||
$calendar_color = htmlentities($row['calendar_color']);
|
||||
?>
|
||||
<option <?php if ($config_default_calendar == $calendar_id) { echo "selected"; } ?> data-content="<i class='fa fa-circle mr-2' style='color:<?php echo $calendar_color; ?>;'></i> <?php echo $calendar_name; ?>" value="<?php echo $calendar_id; ?>"><?php echo $calendar_name; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-dark" data-toggle="modal" data-target="#addQuickCalendarModal"><i class="fas fa-fw fa-plus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label>Start / End <strong class="text-danger">*</strong></label>
|
||||
<div class="form-row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<input type="datetime-local" class="form-control form-control-sm" id="event_add_start" name="start" required onblur="updateIncrementEndTime()">
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<input type="datetime-local" class="form-control form-control-sm" id="event_add_end" name="end" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description</label>
|
||||
<textarea class="form-control" rows="4" name="description" placeholder="Enter a description"></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-more">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Repeat</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-recycle"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="repeat">
|
||||
<option value="">Never</option>
|
||||
<option>Day</option>
|
||||
<option>Week</option>
|
||||
<option>Month</option>
|
||||
<option>Year</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-attendees">
|
||||
|
||||
<?php if (isset($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 -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN contacts ON primary_contact = contact_id WHERE clients.company_id = $session_company_id ORDER BY client_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$client_id = intval($row['client_id']);
|
||||
$client_name = htmlentities($row['client_name']);
|
||||
$contact_email = htmlentities($row['contact_email']);
|
||||
?>
|
||||
<option value="<?php echo $client_id; ?>"><?php echo $client_name; ?></option>
|
||||
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php if (!empty($config_smtp_host)) { ?>
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="emailEventCheckbox" name="email_event" value="1" >
|
||||
<label class="custom-control-label" for="emailEventCheckbox">Email Event</label>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Repeat</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-recycle"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="repeat">
|
||||
<option value="">Never</option>
|
||||
<option>Day</option>
|
||||
<option>Week</option>
|
||||
<option>Month</option>
|
||||
<option>Year</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-attendees">
|
||||
|
||||
<?php if (isset($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 -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM clients LEFT JOIN contacts ON primary_contact = contact_id WHERE clients.company_id = $session_company_id ORDER BY client_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$client_id = $row['client_id'];
|
||||
$client_name = htmlentities($row['client_name']);
|
||||
$contact_email = htmlentities($row['contact_email']);
|
||||
?>
|
||||
<option value="<?php echo $client_id; ?>"><?php echo $client_name; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_event" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php if (!empty($config_smtp_host)) { ?>
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="emailEventCheckbox" name="email_event" value="1" >
|
||||
<label class="custom-control-label" for="emailEventCheckbox">Email Event</label>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_event" class="btn btn-primary"><strong><i class="fa fa-check"></i> Create</strong></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,160 +1,155 @@
|
|||
<div class="modal" id="editEventModal<?php echo $event_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-calendar"></i> <?php echo $event_title; ?></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="event_id" value="<?php echo $event_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-event<?php echo $event_id; ?>"><i class="fa fa-fw fa-calendar"></i> Event</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-more<?php echo $event_id; ?>"><i class="fa fa-fw fa-info-circle"></i> More</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-attendees<?php echo $event_id; ?>"><i class="fa fa-fw fa-users"></i> Attendees</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-event<?php echo $event_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Title <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-day"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="title" value="<?php echo $event_title; ?>" placeholder="Title of the event" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Calendar <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-calendar"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="calendar" required>
|
||||
<?php
|
||||
|
||||
$sql_calendars_select = mysqli_query($mysqli,"SELECT * FROM calendars WHERE company_id = $session_company_id ORDER BY calendar_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_calendars_select)) {
|
||||
$calendar_id_select = $row['calendar_id'];
|
||||
$calendar_name_select = htmlentities($row['calendar_name']);
|
||||
$calendar_color_select = htmlentities($row['calendar_color']);
|
||||
?>
|
||||
<option data-content="<i class='fa fa-circle mr-2' style='color:<?php echo $calendar_color_select; ?>;'></i> <?php echo $calendar_name_select; ?>"<?php if ($calendar_id == $calendar_id_select) { echo "selected"; } ?> value="<?php echo $calendar_id_select; ?>"><?php echo $calendar_name_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label>Start / End <strong class="text-danger">*</strong></label>
|
||||
<div class="form-row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<input type="datetime-local" class="form-control form-control-sm" name="start" value="<?php echo date('Y-m-d\TH:i:s', strtotime($event_start)); ?>" required>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<input type="datetime-local" class="form-control form-control-sm" name="end" value="<?php echo date('Y-m-d\TH:i:s', strtotime($event_end)); ?>"required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description</label>
|
||||
<textarea class="form-control" rows="4" name="description" placeholder="Enter a description"><?php echo $event_description; ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-calendar mr-2"></i><?php echo $event_title; ?></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-more<?php echo $event_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Repeat</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-recycle"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="repeat">
|
||||
<option <?php if (empty($event_repeat)) { echo "selected"; } ?> value="">Never</option>
|
||||
<option <?php if ($event_repeat == "Day") { echo "selected"; } ?>>Day</option>
|
||||
<option <?php if ($event_repeat == "Week") { echo "selected"; } ?>>Week</option>
|
||||
<option <?php if ($event_repeat == "Month") { echo "selected"; } ?>>Month</option>
|
||||
<option <?php if ($event_repeat == "Year") { echo "selected"; } ?>>Year</option>
|
||||
</select>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="event_id" value="<?php echo $event_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-event<?php echo $event_id; ?>"><i class="fa fa-fw fa-calendar mr-2"></i>Event</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-more<?php echo $event_id; ?>"><i class="fa fa-fw fa-info-circle mr-2"></i>More</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-attendees<?php echo $event_id; ?>"><i class="fa fa-fw fa-users mr-2"></i>Attendees</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-event<?php echo $event_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Title <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-day"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="title" value="<?php echo $event_title; ?>" placeholder="Title of the event" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Calendar <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-calendar"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="calendar" required>
|
||||
<?php
|
||||
|
||||
$sql_calendars_select = mysqli_query($mysqli, "SELECT * FROM calendars WHERE company_id = $session_company_id ORDER BY calendar_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_calendars_select)) {
|
||||
$calendar_id_select = intval($row['calendar_id']);
|
||||
$calendar_name_select = htmlentities($row['calendar_name']);
|
||||
$calendar_color_select = htmlentities($row['calendar_color']);
|
||||
?>
|
||||
<option data-content="<i class='fa fa-circle mr-2' style='color:<?php echo $calendar_color_select; ?>;'></i> <?php echo $calendar_name_select; ?>"<?php if ($calendar_id == $calendar_id_select) { echo "selected"; } ?> value="<?php echo $calendar_id_select; ?>"><?php echo $calendar_name_select; ?></option>
|
||||
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label>Start / End <strong class="text-danger">*</strong></label>
|
||||
<div class="form-row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<input type="datetime-local" class="form-control form-control-sm" name="start" value="<?php echo date('Y-m-d\TH:i:s', strtotime($event_start)); ?>" required>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<input type="datetime-local" class="form-control form-control-sm" name="end" value="<?php echo date('Y-m-d\TH:i:s', strtotime($event_end)); ?>"required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description</label>
|
||||
<textarea class="form-control" rows="4" name="description" placeholder="Enter a description"><?php echo $event_description; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-more<?php echo $event_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Repeat</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-recycle"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="repeat">
|
||||
<option <?php if (empty($event_repeat)) { echo "selected"; } ?> value="">Never</option>
|
||||
<option <?php if ($event_repeat == "Day") { echo "selected"; } ?>>Day</option>
|
||||
<option <?php if ($event_repeat == "Week") { echo "selected"; } ?>>Week</option>
|
||||
<option <?php if ($event_repeat == "Month") { echo "selected"; } ?>>Month</option>
|
||||
<option <?php if ($event_repeat == "Year") { echo "selected"; } ?>>Year</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-attendees<?php echo $event_id; ?>">
|
||||
|
||||
<?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 -</option>
|
||||
<?php
|
||||
|
||||
$sql_clients = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN contacts ON primary_contact = contact_id WHERE clients.company_id = $session_company_id ORDER BY client_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_clients)) {
|
||||
$client_id_select = intval($row['client_id']);
|
||||
$client_name_select = htmlentities($row['client_name']);
|
||||
$contact_email_select = htmlentities($row['contact_email']);
|
||||
?>
|
||||
<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 } ?>
|
||||
|
||||
<?php if (!empty($config_smtp_host)) { ?>
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="customControlAutosizing<?php echo $event_id; ?>" name="email_event" value="1" >
|
||||
<label class="custom-control-label" for="customControlAutosizing<?php echo $event_id; ?>">Email Event</label>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-attendees<?php echo $event_id; ?>">
|
||||
|
||||
<?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 -</option>
|
||||
<?php
|
||||
|
||||
$sql_clients = mysqli_query($mysqli,"SELECT * FROM clients LEFT JOIN contacts ON primary_contact = contact_id WHERE clients.company_id = $session_company_id ORDER BY client_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_clients)) {
|
||||
$client_id_select = $row['client_id'];
|
||||
$client_name_select = htmlentities($row['client_name']);
|
||||
$contact_email_select = htmlentities($row['contact_email']);
|
||||
?>
|
||||
<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 class="modal-footer bg-white">
|
||||
<a class="btn text-danger mr-auto" href="post.php?delete_event=<?php echo $event_id; ?>"><i class="fa fa-calendar-times mr-2"></i>Delete</a>
|
||||
<button type="submit" name="edit_event" 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>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php if (!empty($config_smtp_host)) { ?>
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="customControlAutosizing<?php echo $event_id; ?>" name="email_event" value="1" >
|
||||
<label class="custom-control-label" for="customControlAutosizing<?php echo $event_id; ?>">Email Event</label>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<a href="post.php?delete_event=<?php echo $event_id; ?>" class="btn btn-danger mr-auto"><i class="fa fa-trash"></i> Delete</a>
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="edit_event" class="btn btn-primary"><strong><i class="fa fa-check"></i> Update</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,166 +1,152 @@
|
|||
<?php include("inc_all.php"); ?>
|
||||
<?php
|
||||
|
||||
<link href='plugins/fullcalendar/main.min.css' rel='stylesheet' />
|
||||
|
||||
<?php
|
||||
require_once("inc_all.php");
|
||||
|
||||
if (isset($_GET['calendar_id'])) {
|
||||
$calendar_selected_id = intval($_GET['calendar_id']);
|
||||
$calendar_selected_id = intval($_GET['calendar_id']);
|
||||
}
|
||||
|
||||
?>
|
||||
<link href='plugins/fullcalendar/main.min.css' rel='stylesheet' />
|
||||
|
||||
<div id='calendar'></div>
|
||||
|
||||
<?php
|
||||
|
||||
include("calendar_event_add_modal.php");
|
||||
include("calendar_add_modal.php");
|
||||
include("category_quick_add_modal.php");
|
||||
|
||||
?>
|
||||
|
||||
<?php
|
||||
//loop through IDs and create a modal for each
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM events LEFT JOIN calendars ON event_calendar_id = calendar_id WHERE calendars.company_id = $session_company_id");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$event_id = $row['event_id'];
|
||||
$event_title = htmlentities($row['event_title']);
|
||||
$event_description = htmlentities($row['event_description']);
|
||||
$event_start = htmlentities($row['event_start']);
|
||||
$event_end = htmlentities($row['event_end']);
|
||||
$event_repeat = htmlentities($row['event_repeat']);
|
||||
$calendar_id = $row['calendar_id'];
|
||||
$calendar_name = htmlentities($row['calendar_name']);
|
||||
$calendar_color = htmlentities($row['calendar_color']);
|
||||
$client_id = $row['event_client_id'];
|
||||
|
||||
include("calendar_event_edit_modal.php");
|
||||
require_once("calendar_event_add_modal.php");
|
||||
require_once("calendar_add_modal.php");
|
||||
require_once("category_quick_add_modal.php");
|
||||
|
||||
//loop through IDs and create a modal for each
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM events LEFT JOIN calendars ON event_calendar_id = calendar_id WHERE calendars.company_id = $session_company_id");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$event_id = $row['event_id'];
|
||||
$event_title = htmlentities($row['event_title']);
|
||||
$event_description = htmlentities($row['event_description']);
|
||||
$event_start = htmlentities($row['event_start']);
|
||||
$event_end = htmlentities($row['event_end']);
|
||||
$event_repeat = htmlentities($row['event_repeat']);
|
||||
$calendar_id = $row['calendar_id'];
|
||||
$calendar_name = htmlentities($row['calendar_name']);
|
||||
$calendar_color = htmlentities($row['calendar_color']);
|
||||
$client_id = $row['event_client_id'];
|
||||
|
||||
require("calendar_event_edit_modal.php");
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<?php include("footer.php"); ?>
|
||||
<?php require_once("footer.php"); ?>
|
||||
|
||||
<script src='plugins/fullcalendar/main.min.js'></script>
|
||||
|
||||
<script>
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var calendarEl = document.getElementById('calendar');
|
||||
var calendarEl = document.getElementById('calendar');
|
||||
|
||||
var calendar = new FullCalendar.Calendar(calendarEl, {
|
||||
themeSystem: 'bootstrap',
|
||||
defaultView: 'dayGridMonth',
|
||||
customButtons: {
|
||||
addEvent: {
|
||||
bootstrapFontAwesome: 'fa fa-plus',
|
||||
click: function() {
|
||||
$("#addCalendarEventModal").modal();
|
||||
var calendar = new FullCalendar.Calendar(calendarEl, {
|
||||
themeSystem: 'bootstrap',
|
||||
defaultView: 'dayGridMonth',
|
||||
customButtons: {
|
||||
addEvent: {
|
||||
bootstrapFontAwesome: 'fa fa-plus',
|
||||
click: function() {
|
||||
$("#addCalendarEventModal").modal();
|
||||
}
|
||||
},
|
||||
addCalendar: {
|
||||
bootstrapFontAwesome: 'fa fa-calendar-plus',
|
||||
click: function() {
|
||||
$("#addCalendarModal").modal();
|
||||
}
|
||||
}
|
||||
},
|
||||
headerToolbar: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
right: 'dayGridMonth,timeGridWeek,timeGridDay,listMonth addEvent addCalendar'
|
||||
},
|
||||
events: [
|
||||
<?php
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM events LEFT JOIN calendars ON event_calendar_id = calendar_id WHERE calendars.company_id = $session_company_id");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$event_id = intval($row['event_id']);
|
||||
$event_title = json_encode($row['event_title']);
|
||||
$event_start = json_encode($row['event_start']);
|
||||
$event_end = json_encode($row['event_end']);
|
||||
$calendar_id = intval($row['calendar_id']);
|
||||
$calendar_name = json_encode($row['calendar_name']);
|
||||
$calendar_color = json_encode($row['calendar_color']);
|
||||
|
||||
echo "{ id: $event_id, title: $event_title, start: $event_start, end: $event_end, color: $calendar_color },";
|
||||
}
|
||||
|
||||
//Invoices Created
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN invoices ON client_id = invoice_client_id WHERE clients.company_id = $session_company_id");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$event_id = intval($row['invoice_id']);
|
||||
$event_title = json_encode($row['invoice_prefix'] . $row['invoice_number'] . " " . $row['invoice_scope']);
|
||||
$event_start = json_encode($row['invoice_date']);
|
||||
|
||||
echo "{ id: $event_id, title: $event_title, start: $event_start, color: 'blue', url: 'invoice.php?invoice_id=$event_id' },";
|
||||
}
|
||||
|
||||
//Quotes Created
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN quotes ON client_id = quote_client_id WHERE clients.company_id = $session_company_id");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$event_id = intval($row['quote_id']);
|
||||
$event_title = json_encode($row['quote_prefix'] . $row['quote_number'] . " " . $row['quote_scope']);
|
||||
$event_start = json_encode($row['quote_date']);
|
||||
|
||||
echo "{ id: $event_id, title: $event_title, start: $event_start, color: 'purple', url: 'quote.php?quote_id=$event_id' },";
|
||||
}
|
||||
|
||||
//Tickets Created
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN tickets ON client_id = ticket_client_id WHERE clients.company_id = $session_company_id");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$event_id = intval($row['ticket_id']);
|
||||
$event_title = json_encode($row['ticket_prefix'] . $row['ticket_number'] . " " . $row['ticket_subject']);
|
||||
$event_start = json_encode($row['ticket_created_at']);
|
||||
|
||||
echo "{ id: $event_id, title: $event_title, start: $event_start, color: 'orange', url: 'ticket.php?ticket_id=$event_id' },";
|
||||
|
||||
}
|
||||
|
||||
//Vendors Added Created
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN vendors ON client_id = vendor_client_id WHERE vendor_template = 0 AND clients.company_id = $session_company_id");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$event_id = intval($row['vendor_id']);
|
||||
$client_id = intval($row['client_id']);
|
||||
$event_title = json_encode($row['vendor_name']);
|
||||
$event_start = json_encode($row['vendor_created_at']);
|
||||
|
||||
echo "{ id: $event_id, title: $event_title, start: $event_start, color: 'brown', url: 'client_vendors.php?client_id=$client_id' },";
|
||||
}
|
||||
|
||||
//Clients Added
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE clients.company_id = $session_company_id");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$event_id = intval($row['client_id']);
|
||||
$event_title = json_encode($row['client_name']);
|
||||
$event_start = json_encode($row['client_created_at']);
|
||||
|
||||
echo "{ id: $event_id, title: $event_title, start: $event_start, color: 'green', url: 'client_overview.php?client_id=$event_id' },";
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
],
|
||||
eventClick: function(editEvent) {
|
||||
$('#editEventModal'+editEvent.event.id).modal();
|
||||
}
|
||||
},
|
||||
addCalendar: {
|
||||
bootstrapFontAwesome: 'fa fa-calendar-plus',
|
||||
click: function() {
|
||||
$("#addCalendarModal").modal();
|
||||
}
|
||||
}
|
||||
},
|
||||
headerToolbar: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
right: 'dayGridMonth,timeGridWeek,timeGridDay,listMonth addEvent addCalendar'
|
||||
},
|
||||
events: [
|
||||
<?php
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM events LEFT JOIN calendars ON event_calendar_id = calendar_id WHERE calendars.company_id = $session_company_id");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$event_id = json_encode($row['event_id']);
|
||||
$event_title = json_encode($row['event_title']);
|
||||
$event_start = json_encode($row['event_start']);
|
||||
$event_end = json_encode($row['event_end']);
|
||||
$calendar_id = json_encode($row['calendar_id']);
|
||||
$calendar_name = json_encode($row['calendar_name']);
|
||||
$calendar_color = json_encode($row['calendar_color']);
|
||||
|
||||
echo "{ id: $event_id, title: $event_title, start: $event_start, end: $event_end, color: $calendar_color },";
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
//Invoices Created
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM clients LEFT JOIN invoices ON client_id = invoice_client_id WHERE clients.company_id = $session_company_id");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$event_id = json_encode($row['invoice_id']);
|
||||
$event_title = json_encode($row['invoice_prefix'] . $row['invoice_number'] . " " . $row['invoice_scope']);
|
||||
$event_start = json_encode($row['invoice_date']);
|
||||
|
||||
echo "{ id: $event_id, title: $event_title, start: $event_start, color: 'blue', url: 'invoice.php?invoice_id=$event_id' },";
|
||||
}
|
||||
?>
|
||||
});
|
||||
|
||||
<?php
|
||||
//Quotes Created
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM clients LEFT JOIN quotes ON client_id = quote_client_id WHERE clients.company_id = $session_company_id");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$event_id = json_encode($row['quote_id']);
|
||||
$event_title = json_encode($row['quote_prefix'] . $row['quote_number'] . " " . $row['quote_scope']);
|
||||
$event_start = json_encode($row['quote_date']);
|
||||
|
||||
echo "{ id: $event_id, title: $event_title, start: $event_start, color: 'purple', url: 'quote.php?quote_id=$event_id' },";
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
//Tickets Created
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM clients LEFT JOIN tickets ON client_id = ticket_client_id WHERE clients.company_id = $session_company_id");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$event_id = json_encode($row['ticket_id']);
|
||||
$event_title = json_encode($row['ticket_prefix'] . $row['ticket_number'] . " " . $row['ticket_subject']);
|
||||
$event_start = json_encode($row['ticket_created_at']);
|
||||
|
||||
echo "{ id: $event_id, title: $event_title, start: $event_start, color: 'orange', url: 'ticket.php?ticket_id=$event_id' },";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<?php
|
||||
//Vendors Added Created
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM clients LEFT JOIN vendors ON client_id = vendor_client_id WHERE vendor_template = 0 AND clients.company_id = $session_company_id");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$event_id = json_encode($row['vendor_id']);
|
||||
$event_title = json_encode($row['vendor_name']);
|
||||
$event_start = json_encode($row['vendor_created_at']);
|
||||
|
||||
echo "{ id: $event_id, title: $event_title, start: $event_start, color: 'brown', url: 'client_vendors.php?client_id=$event_id' },";
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
//Clients Added
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM clients WHERE clients.company_id = $session_company_id");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$event_id = json_encode($row['client_id']);
|
||||
$event_title = json_encode($row['client_name']);
|
||||
$event_start = json_encode($row['client_created_at']);
|
||||
|
||||
echo "{ id: $event_id, title: $event_title, start: $event_start, color: 'green', url: 'client.php?client_id=$event_id' },";
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
],
|
||||
eventClick: function(editEvent) {
|
||||
$('#editEventModal'+editEvent.event.id).modal();
|
||||
}
|
||||
});
|
||||
|
||||
calendar.render();
|
||||
calendar.render();
|
||||
});
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<!-- Automatically set new event end date to 1 hr after start date -->
|
||||
<script>
|
||||
|
|
@ -185,4 +171,4 @@ while ($row = mysqli_fetch_array($sql)) {
|
|||
|
||||
}
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,35 +1,41 @@
|
|||
<?php require_once("inc_all_settings.php");
|
||||
<?php
|
||||
|
||||
// Default Column Sortby Filter
|
||||
$sb = "category_name";
|
||||
$o = "ASC";
|
||||
|
||||
require_once("inc_all_settings.php");
|
||||
|
||||
if (isset($_GET['category'])) {
|
||||
$category = strip_tags(mysqli_real_escape_string($mysqli,$_GET['category']));
|
||||
$category = sanitizeInput($_GET['category']);
|
||||
} else {
|
||||
$category = "Expense";
|
||||
}
|
||||
|
||||
if (!empty($_GET['sb'])) {
|
||||
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
|
||||
} else {
|
||||
$sb = "category_name";
|
||||
}
|
||||
|
||||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
$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 categories
|
||||
WHERE category_name LIKE '%$q%'
|
||||
AND category_type = '$category'
|
||||
AND category_archived_at IS NULL
|
||||
AND company_id = $session_company_id
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to"
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM categories
|
||||
WHERE category_name LIKE '%$q%'
|
||||
AND category_type = '$category'
|
||||
AND category_archived_at IS NULL
|
||||
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()"));
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
|
||||
$colors_used_array = [];
|
||||
|
||||
//Colors Used
|
||||
$sql_colors_used = mysqli_query($mysqli,"SELECT category_color FROM categories
|
||||
WHERE category_type = '$category'
|
||||
AND category_archived_at IS NULL
|
||||
AND company_id = $session_company_id"
|
||||
$sql_colors_used = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT category_color FROM categories
|
||||
WHERE category_type = '$category'
|
||||
AND category_archived_at IS NULL
|
||||
AND company_id = $session_company_id"
|
||||
);
|
||||
|
||||
while ($color_used_row = mysqli_fetch_array($sql_colors_used)) {
|
||||
|
|
@ -42,9 +48,9 @@ $colors_diff = array_diff($colors_array, $colors_used_array);
|
|||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-list"></i> <?php echo htmlentities($category); ?> Categories</h3>
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-list mr-2"></i><?php echo htmlentities($category); ?> Categories</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addCategoryModal"><i class="fas fa-fw fa-plus"></i> New</button>
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addCategoryModal"><i class="fas fa-plus mr-2"></i>New</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
|
@ -53,7 +59,7 @@ $colors_diff = array_diff($colors_array, $colors_used_array);
|
|||
<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 strip_tags(htmlentities($q)); } ?>" placeholder="Search Categories">
|
||||
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(htmlentities($q)); } ?>" placeholder="Search Categories">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
|
|
@ -83,14 +89,14 @@ $colors_diff = array_diff($colors_array, $colors_used_array);
|
|||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$category_id = $row['category_id'];
|
||||
$category_id = intval($row['category_id']);
|
||||
$category_name = htmlentities($row['category_name']);
|
||||
$category_color = htmlentities($row['category_color']);
|
||||
//$colors_used_array[] = $row['category_color'];
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><a class="text-dark" href="#" data-toggle="modal" data-target="#editCategoryModal<?php echo $category_id; ?>"><?php echo "$category_name"; ?></a></td>
|
||||
<td><a class="text-dark" href="#" data-toggle="modal" data-target="#editCategoryModal<?php echo $category_id; ?>"><?php echo $category_name; ?></a></td>
|
||||
<td><i class="fa fa-3x fa-circle" style="color:<?php echo $category_color; ?>;"></i></td>
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
|
|
@ -98,9 +104,13 @@ $colors_diff = array_diff($colors_array, $colors_used_array);
|
|||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editCategoryModal<?php echo $category_id; ?>">Edit</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editCategoryModal<?php echo $category_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="post.php?archive_category=<?php echo $category_id; ?>">Archive</a>
|
||||
<a class="dropdown-item text-danger" href="post.php?archive_category=<?php echo $category_id; ?>">
|
||||
<i class="fas fa-fw fa-archive mr-2"></i>Archive
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
|
@ -119,14 +129,10 @@ $colors_diff = array_diff($colors_array, $colors_used_array);
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php include("pagination.php"); ?>
|
||||
<?php require_once("pagination.php"); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
include("category_add_modal.php");
|
||||
|
||||
include("footer.php");
|
||||
|
||||
?>
|
||||
require_once("category_add_modal.php");
|
||||
require_once("footer.php");
|
||||
|
|
|
|||
|
|
@ -1,49 +1,47 @@
|
|||
<div class="modal" id="addCategoryModal" 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-list"></i> New <?php echo $category; ?> Category</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="type" value="<?php echo $category; ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong></label>
|
||||
<input type="text" class="form-control" name="name" placeholder="Category name" required autofocus>
|
||||
</div>
|
||||
|
||||
<label>Color <strong class="text-danger">*</strong></label>
|
||||
<div class="form-row">
|
||||
|
||||
<?php
|
||||
|
||||
foreach ($colors_diff as $color) {
|
||||
|
||||
?>
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="color" value="<?php echo $color; ?>">
|
||||
<label class="form-check-label">
|
||||
<i class="fa fa-fw fa-3x fa-circle" style="color:<?php echo $color; ?>"></i>
|
||||
</label>
|
||||
</div>
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-list mr-2"></i>New <?php echo htmlentities($category); ?> Category</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="type" value="<?php echo htmlentities($category); ?>">
|
||||
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong></label>
|
||||
<input type="text" class="form-control" name="name" placeholder="Category name" required autofocus>
|
||||
</div>
|
||||
|
||||
<label>Color <strong class="text-danger">*</strong></label>
|
||||
<div class="form-row">
|
||||
|
||||
<?php
|
||||
|
||||
foreach ($colors_diff as $color) { ?>
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="color" value="<?php echo $color; ?>">
|
||||
<label class="form-check-label">
|
||||
<i class="fa fa-fw fa-3x fa-circle" style="color:<?php echo $color; ?>"></i>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_category" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create</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 class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_category" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Create</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,55 +1,54 @@
|
|||
<div class="modal" id="editCategoryModal<?php echo $category_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-list"></i> Editing category: <strong><?php echo $category_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="category_id" value="<?php echo $category_id; ?>">
|
||||
<input type="hidden" name="type" value="<?php echo $category; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong></label>
|
||||
<input type="text" class="form-control" name="name" value="<?php echo $category_name; ?>" required>
|
||||
</div>
|
||||
|
||||
<label>Color <strong class="text-danger">*</strong></label>
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="color" value="<?php echo $category_color; ?>" checked>
|
||||
<label class="form-check-label">
|
||||
<i class="fa fa-fw fa-4x fa-circle" style="color:<?php echo $category_color; ?>"></i>
|
||||
</label>
|
||||
</div>
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-list mr-2"></i>Editing category: <strong><?php echo $category_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="category_id" value="<?php echo $category_id; ?>">
|
||||
<input type="hidden" name="type" value="<?php echo htmlentities($category); ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<?php
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong></label>
|
||||
<input type="text" class="form-control" name="name" value="<?php echo $category_name; ?>" required>
|
||||
</div>
|
||||
|
||||
foreach($colors_diff as $color) {
|
||||
?>
|
||||
<div class="col-3 mb-3">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="color" value="<?php echo $color; ?>">
|
||||
<label class="form-check-label">
|
||||
<i class="fa fa-fw fa-3x fa-circle" style="color:<?php echo $color; ?>"></i>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<label>Color <strong class="text-danger">*</strong></label>
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="color" value="<?php echo $category_color; ?>" checked>
|
||||
<label class="form-check-label">
|
||||
<i class="fa fa-fw fa-4x fa-circle" style="color:<?php echo $category_color; ?>"></i>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
|
||||
<?php
|
||||
|
||||
foreach($colors_diff as $color) { ?>
|
||||
<div class="col-3 mb-3">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="color" value="<?php echo $color; ?>">
|
||||
<label class="form-check-label">
|
||||
<i class="fa fa-fw fa-3x fa-circle" style="color:<?php echo $color; ?>"></i>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_category" 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 class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="edit_category" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,96 +1,96 @@
|
|||
<div class="modal" id="addQuickCategoryExpenseModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-sm">
|
||||
<div class="modal-content bg-light">
|
||||
<div class="modal-body">
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="type" value="Expense">
|
||||
<input type="hidden" name="color" value="#000000">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="name" placeholder="Category name" required autofocus>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-fw fa-times"></i></button>
|
||||
<button type="submit" name="add_category" class="btn btn-primary"><i class="fa fa-fw fa-check"></i></button>
|
||||
<div class="modal-dialog modal-sm">
|
||||
<div class="modal-content bg-light">
|
||||
<div class="modal-body">
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="type" value="Expense">
|
||||
<input type="hidden" name="color" value="#000000">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="name" placeholder="Category name" required autofocus>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-fw fa-times"></i></button>
|
||||
<button type="submit" name="add_category" class="btn btn-primary"><i class="fa fa-fw fa-check"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal" id="addQuickCategoryIncomeModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-sm">
|
||||
<div class="modal-content bg-light">
|
||||
<div class="modal-body">
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="type" value="Income">
|
||||
<input type="hidden" name="color" value="#000000">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="name" placeholder="Category name" required autofocus>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-fw fa-times"></i></button>
|
||||
<button type="submit" name="add_category" class="btn btn-primary"><i class="fa fa-fw fa-check"></i></button>
|
||||
<div class="modal-dialog modal-sm">
|
||||
<div class="modal-content bg-light">
|
||||
<div class="modal-body">
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="type" value="Income">
|
||||
<input type="hidden" name="color" value="#000000">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="name" placeholder="Category name" required autofocus>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-fw fa-times"></i></button>
|
||||
<button type="submit" name="add_category" class="btn btn-primary"><i class="fa fa-fw fa-check"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal" id="addQuickVendorModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-sm">
|
||||
<div class="modal-content bg-light">
|
||||
<div class="modal-body">
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="name" placeholder="Vendor name" required autofocus>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-fw fa-times"></i></button>
|
||||
<button type="submit" name="add_vendor" class="btn btn-primary"><i class="fa fa-fw fa-check"></i></button>
|
||||
<div class="modal-dialog modal-sm">
|
||||
<div class="modal-content bg-light">
|
||||
<div class="modal-body">
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="name" placeholder="Vendor name" required autofocus>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-fw fa-times"></i></button>
|
||||
<button type="submit" name="add_vendor" class="btn btn-primary"><i class="fa fa-fw fa-check"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal" id="addQuickReferralModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-sm">
|
||||
<div class="modal-content bg-light">
|
||||
<div class="modal-body">
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="type" value="Referral">
|
||||
<input type="hidden" name="color" value="#000000">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="name" placeholder="Referral name" required autofocus>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-fw fa-times"></i></button>
|
||||
<button type="submit" name="add_category" class="btn btn-primary"><i class="fa fa-fw fa-check"></i></button>
|
||||
<div class="modal-dialog modal-sm">
|
||||
<div class="modal-content bg-light">
|
||||
<div class="modal-body">
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="type" value="Referral">
|
||||
<input type="hidden" name="color" value="#000000">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="name" placeholder="Referral name" required autofocus>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-fw fa-times"></i></button>
|
||||
<button type="submit" name="add_category" class="btn btn-primary"><i class="fa fa-fw fa-check"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal" id="addQuickCalendarModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-sm">
|
||||
<div class="modal-content bg-light">
|
||||
<div class="modal-body">
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="color" value="#000000">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="name" placeholder="Calendar name" required autofocus>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-fw fa-times"></i></button>
|
||||
<button type="submit" name="add_calendar" class="btn btn-primary"><i class="fa fa-fw fa-check"></i></button>
|
||||
<div class="modal-dialog modal-sm">
|
||||
<div class="modal-content bg-light">
|
||||
<div class="modal-body">
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="color" value="#000000">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="name" placeholder="Calendar name" required autofocus>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-fw fa-times"></i></button>
|
||||
<button type="submit" name="add_calendar" class="btn btn-primary"><i class="fa fa-fw fa-check"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,36 +1,34 @@
|
|||
<?php
|
||||
|
||||
if (!isset($_SESSION)) {
|
||||
// HTTP Only cookies
|
||||
ini_set("session.cookie_httponly", True);
|
||||
if ($config_https_only) {
|
||||
// Tell client to only send cookie(s) over HTTPS
|
||||
ini_set("session.cookie_secure", True);
|
||||
}
|
||||
session_start();
|
||||
// HTTP Only cookies
|
||||
ini_set("session.cookie_httponly", true);
|
||||
if ($config_https_only) {
|
||||
// Tell client to only send cookie(s) over HTTPS
|
||||
ini_set("session.cookie_secure", true);
|
||||
}
|
||||
session_start();
|
||||
}
|
||||
|
||||
//Check to see if setup is enabled
|
||||
if (!isset($config_enable_setup) || $config_enable_setup == 1) {
|
||||
header("Location: setup.php");
|
||||
exit;
|
||||
header("Location: setup.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check user is logged in with a valid session
|
||||
if (!isset($_SESSION['logged']) || !$_SESSION['logged']) {
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
// SESSION FINGERPRINT
|
||||
$session_ip = strip_tags(mysqli_real_escape_string($mysqli,getIP()));
|
||||
|
||||
// User agent
|
||||
$session_user_agent = strip_tags(mysqli_real_escape_string($mysqli,$_SERVER['HTTP_USER_AGENT']));
|
||||
// User IP & UA
|
||||
$session_ip = sanitizeInput(getIP());
|
||||
$session_user_agent = sanitizeInput($_SERVER['HTTP_USER_AGENT']);
|
||||
|
||||
$session_user_id = $_SESSION['user_id'];
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM users, user_settings WHERE users.user_id = user_settings.user_id AND users.user_id = $session_user_id");
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM users, user_settings WHERE users.user_id = user_settings.user_id AND users.user_id = $session_user_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$session_name = mysqli_real_escape_string($mysqli, $row['user_name']);
|
||||
$session_email = $row['user_email'];
|
||||
|
|
@ -39,29 +37,29 @@ $session_token = $row['user_token'];
|
|||
$session_company_id = $row['user_default_company'];
|
||||
$session_user_role = $row['user_role'];
|
||||
if ($session_user_role == 3) {
|
||||
$session_user_role_display = "Administrator";
|
||||
}elseif ($session_user_role == 2) {
|
||||
$session_user_role_display = "Technician";
|
||||
}else{
|
||||
$session_user_role_display = "Accountant";
|
||||
$session_user_role_display = "Administrator";
|
||||
} elseif ($session_user_role == 2) {
|
||||
$session_user_role_display = "Technician";
|
||||
} else {
|
||||
$session_user_role_display = "Accountant";
|
||||
}
|
||||
|
||||
//LOAD USER COMPANY ACCESS PERMISSIONS
|
||||
$session_user_company_access_sql = mysqli_query($mysqli,"SELECT company_id FROM user_companies WHERE user_id = $session_user_id");
|
||||
$session_user_company_access_sql = mysqli_query($mysqli, "SELECT company_id FROM user_companies WHERE user_id = $session_user_id");
|
||||
$session_user_company_access_array = array();
|
||||
while ($row = mysqli_fetch_array($session_user_company_access_sql)) {
|
||||
$session_user_company_access_array[] = $row['company_id'];
|
||||
$session_user_company_access_array[] = $row['company_id'];
|
||||
}
|
||||
$session_user_company_access = implode(',',$session_user_company_access_array);
|
||||
$session_user_company_access = implode(',', $session_user_company_access_array);
|
||||
|
||||
//Check to see if user has rights to company Prevents User from access a company he is not allowed to have access to.
|
||||
if (!in_array($session_company_id,$session_user_company_access_array)) {
|
||||
session_start();
|
||||
session_destroy();
|
||||
header('Location: login.php');
|
||||
if (!in_array($session_company_id, $session_user_company_access_array)) {
|
||||
session_start();
|
||||
session_destroy();
|
||||
header('Location: login.php');
|
||||
}
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM companies WHERE company_id = $session_company_id");
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM companies WHERE company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
|
||||
$session_company_name = $row['company_name'];
|
||||
|
|
@ -69,21 +67,21 @@ $session_company_country = $row['company_country'];
|
|||
$session_company_locale = $row['company_locale'];
|
||||
$session_company_currency = $row['company_currency'];
|
||||
|
||||
include("get_settings.php");
|
||||
require_once("get_settings.php");
|
||||
|
||||
//Detects if using an Apple device and uses Apple Maps instead of google
|
||||
$iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
|
||||
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
|
||||
$iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");
|
||||
$iPod = stripos($_SERVER['HTTP_USER_AGENT'], "iPod");
|
||||
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'], "iPhone");
|
||||
$iPad = stripos($_SERVER['HTTP_USER_AGENT'], "iPad");
|
||||
|
||||
if ($iPod || $iPhone || $iPad) {
|
||||
$session_map_source = "apple";
|
||||
}else{
|
||||
$session_map_source = "google";
|
||||
$session_map_source = "apple";
|
||||
} else {
|
||||
$session_map_source = "google";
|
||||
}
|
||||
|
||||
//Get Notification Count for the badge on the top nav
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('notification_id') AS num FROM notifications WHERE (notification_user_id = $session_user_id OR notification_user_id = 0) AND notification_dismissed_at IS NULL AND company_id = $session_company_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('notification_id') AS num FROM notifications WHERE (notification_user_id = $session_user_id OR notification_user_id = 0) AND notification_dismissed_at IS NULL AND company_id = $session_company_id"));
|
||||
$num_notifications = $row['num'];
|
||||
|
||||
//Set Currency Format
|
||||
|
|
|
|||
|
|
@ -1,317 +1,311 @@
|
|||
<div class="modal" id="addClientModal" 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-plus mr-2"></i>New Client</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">
|
||||
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-details">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-location">Location</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-contact" id="contactNavPill">Contact</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-additional">Additional</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-tag">Tag</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-details">
|
||||
|
||||
<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-user"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name or Company" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Industry</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-briefcase"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="type" placeholder="Company Type">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Referral</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-smile-wink"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="referral">
|
||||
<option value="">N/A</option>
|
||||
<?php
|
||||
|
||||
$referral_sql = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_type = 'Referral' AND category_archived_at IS NULL AND company_id = $session_company_id ORDER BY category_name ASC");
|
||||
while ($row = mysqli_fetch_array($referral_sql)) {
|
||||
$referral = htmlentities($row['category_name']);
|
||||
?>
|
||||
<option><?php echo $referral; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#addQuickReferralModal"><i class="fas fa-fw fa-plus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Website</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="ex. google.com">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<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-plus mr-2"></i>New Client</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-location">
|
||||
|
||||
<label>Location Phone</label>
|
||||
|
||||
<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="location_phone" placeholder="Location's Phone Number">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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">
|
||||
</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">
|
||||
</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">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Zip / 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">
|
||||
</div>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<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-flag"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="country">
|
||||
<option value="">- Country -</option>
|
||||
<?php foreach($countries_array as $country_name) { ?>
|
||||
<option <?php if ($session_company_country == $country_name) { echo "selected"; } ?> ><?php echo $country_name; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-details">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-location">Location</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-contact" id="contactNavPill">Contact</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-additional">Additional</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-tag">Tag</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-pane fade" id="pills-contact">
|
||||
<hr>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Primary Contact <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-user"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="primaryContact" name="contact" placeholder="Primary Contact Person" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Title</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-id-badge"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="title" placeholder="Title">
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade show active" id="pills-details">
|
||||
|
||||
<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-user"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name or Company" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Industry</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-briefcase"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="type" placeholder="Company Type">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Referral</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-smile-wink"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="referral">
|
||||
<option value="">N/A</option>
|
||||
<?php
|
||||
|
||||
$referral_sql = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Referral' AND category_archived_at IS NULL AND company_id = $session_company_id ORDER BY category_name ASC");
|
||||
while ($row = mysqli_fetch_array($referral_sql)) {
|
||||
$referral = htmlentities($row['category_name']); ?>
|
||||
<option><?php echo $referral; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#addQuickReferralModal"><i class="fas fa-fw fa-plus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Website</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="ex. google.com">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-location">
|
||||
|
||||
<label>Location Phone</label>
|
||||
|
||||
<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="location_phone" placeholder="Location's Phone Number">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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">
|
||||
</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">
|
||||
</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">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Zip / 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">
|
||||
</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-flag"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="country">
|
||||
<option value="">- Country -</option>
|
||||
<?php foreach($countries_array as $country_name) { ?>
|
||||
<option <?php if ($session_company_country == $country_name) { echo "selected"; } ?> ><?php echo $country_name; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-contact">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Primary Contact <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-user"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="primaryContact" name="contact" placeholder="Primary Contact Person" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Title</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-id-badge"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="title" placeholder="Title">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label>Contact 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="contact_phone" placeholder="Contact's Phone Number">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="text" class="form-control" name="contact_extension" placeholder="Extension">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label>Contact Mobile</label>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-mobile-alt"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="contact_mobile" placeholder="Contact's Mobile Number">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Contact 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="contact_email" placeholder="Contact's Email Address">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-additional">
|
||||
|
||||
<?php if ($config_module_enable_accounting) { ?>
|
||||
<div class="form-group">
|
||||
<label>Currency <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-money-bill"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="currency_code" required>
|
||||
<option value="">- Currency -</option>
|
||||
<?php foreach($currencies_array as $currency_code => $currency_name) { ?>
|
||||
<option <?php if ($session_company_currency == $currency_code) { echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Payment Terms</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>
|
||||
<select class="form-control select2" name="net_terms">
|
||||
<?php foreach($net_terms_array as $net_term_value => $net_term_name) { ?>
|
||||
<option <?php if ($config_default_net_terms == $net_term_value) { echo "selected"; } ?> value="<?php echo $net_term_value; ?>"><?php echo $net_term_name; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php } else { ?>
|
||||
<input type="hidden" name="currency_code" value="<?php echo $session_company_currency; ?>">
|
||||
<input type="hidden" name="net_terms" value="0">
|
||||
<?php } ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Notes</label>
|
||||
<textarea class="form-control" rows="6" name="notes" placeholder="Enter some notes"></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-tag">
|
||||
|
||||
<ul class="list-group">
|
||||
|
||||
<?php
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 1 AND company_id = $session_company_id ORDER BY tag_name ASC");
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_tags_select)) {
|
||||
$tag_id_select = intval($row['tag_id']);
|
||||
$tag_name_select = htmlentities($row['tag_name']);
|
||||
$tag_color_select = htmlentities($row['tag_color']);
|
||||
$tag_icon_select = htmlentities($row['tag_icon']);
|
||||
|
||||
?>
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="tagCheckbox<?php echo $tag_id_select; ?>" name="tags[]" value="<?php echo $tag_id_select; ?>">
|
||||
<label for="tagCheckbox<?php echo $tag_id_select; ?>" class="custom-control-label">
|
||||
<span class="badge bg-<?php echo $tag_color_select; ?>">
|
||||
<?php echo "<i class='fa fw fa-$tag_icon_select'></i>"; ?> <?php echo $tag_name_select; ?>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<label>Contact 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="contact_phone" placeholder="Contact's Phone Number">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="text" class="form-control" name="contact_extension" placeholder="Extension">
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_client" class="btn btn-primary text-bold" onclick="promptPrimaryContact()"><i class="fa fa-check mr-2"></i>Create</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label>Contact Mobile</label>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-mobile-alt"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="contact_mobile" placeholder="Contact's Mobile Number">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Contact 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="contact_email" placeholder="Contact's Email Address">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-additional">
|
||||
|
||||
<?php if ($config_module_enable_accounting) { ?>
|
||||
<div class="form-group">
|
||||
<label>Currency <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-money-bill"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="currency_code" required>
|
||||
<option value="">- Currency -</option>
|
||||
<?php foreach($currencies_array as $currency_code => $currency_name) { ?>
|
||||
<option <?php if ($session_company_currency == $currency_code) { echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Payment Terms</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>
|
||||
<select class="form-control select2" name="net_terms">
|
||||
<?php foreach($net_terms_array as $net_term_value => $net_term_name) { ?>
|
||||
<option <?php if ($config_default_net_terms == $net_term_value) { echo "selected"; } ?> value="<?php echo $net_term_value; ?>"><?php echo $net_term_name; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php }else{ ?>
|
||||
|
||||
<input type="hidden" name="currency_code" value="<?php echo $session_company_currency; ?>">
|
||||
<input type="hidden" name="net_terms" value="0">
|
||||
<?php } ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Notes</label>
|
||||
<textarea class="form-control" rows="6" name="notes" placeholder="Enter some notes"></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-tag">
|
||||
|
||||
<ul class="list-group">
|
||||
|
||||
<?php
|
||||
$sql_tags_select = mysqli_query($mysqli,"SELECT * FROM tags WHERE tag_type = 1 AND company_id = $session_company_id ORDER BY tag_name ASC");
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_tags_select)) {
|
||||
$tag_id_select = $row['tag_id'];
|
||||
$tag_name_select = htmlentities($row['tag_name']);
|
||||
$tag_color_select = htmlentities($row['tag_color']);
|
||||
$tag_icon_select = htmlentities($row['tag_icon']);
|
||||
|
||||
?>
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="tagCheckbox<?php echo $tag_id_select; ?>" name="tags[]" value="<?php echo $tag_id_select; ?>">
|
||||
<label for="tagCheckbox<?php echo $tag_id_select; ?>" class="custom-control-label">
|
||||
<span class="badge bg-<?php echo $tag_color_select; ?>">
|
||||
<?php echo "<i class='fa fw fa-$tag_icon_select'></i>"; ?> <?php echo $tag_name_select; ?>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_client" class="btn btn-primary text-bold" onclick="promptPrimaryContact()"><i class="fa fa-check"></i> Create</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
|
@ -322,4 +316,4 @@
|
|||
document.getElementById("contactNavPill").click();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,328 +1,321 @@
|
|||
<div class="modal" id="addAssetModal" 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-desktop"></i> New <?php if (!empty($_GET['type'])) { echo ucwords(strip_tags($_GET['type'])); }else{ echo "Asset"; } ?></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="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">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-assignment">Assignment</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-purchase">Purchase</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-login">Login</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-notes">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-details">
|
||||
|
||||
<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-tag"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name the asset" required autofocus>
|
||||
</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-tags"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="type" required>
|
||||
<option value="">- Type -</option>
|
||||
<?php foreach($asset_types_array as $asset_type => $asset_icon) { ?>
|
||||
<option><?php echo $asset_type; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php //Do not display Make Model or Serial if Virtual is selected
|
||||
if ($_GET['type'] !== 'virtual') { ?>
|
||||
<div class="form-group">
|
||||
<label>Make </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="Manufacturer">
|
||||
</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="model" placeholder="Model Number">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Serial Number</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-barcode"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="serial" placeholder="Serial number">
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'other') { ?>
|
||||
<div class="form-group">
|
||||
<label>Operating System</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fab fa-fw fa-windows"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="os" placeholder="ex Windows 10 Pro">
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-desktop mr-2"></i>New <?php if (!empty($_GET['type'])) { echo ucwords(strip_tags($_GET['type'])); }else{ echo "Asset"; } ?></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-assignment">
|
||||
|
||||
<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 = 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_id = $row['location_id'];
|
||||
$location_name = htmlentities($row['location_name']);
|
||||
?>
|
||||
<option value="<?php echo $location_id; ?>"><?php echo $location_name; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
|
||||
<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">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-assignment">Assignment</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-purchase">Purchase</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-login">Login</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-notes">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-details">
|
||||
|
||||
<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-tag"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name the asset" required autofocus>
|
||||
</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-tags"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="type" required>
|
||||
<option value="">- Type -</option>
|
||||
<?php foreach($asset_types_array as $asset_type => $asset_icon) { ?>
|
||||
<option><?php echo $asset_type; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php //Do not display Make Model or Serial if Virtual is selected
|
||||
if ($_GET['type'] !== 'virtual') { ?>
|
||||
<div class="form-group">
|
||||
<label>Make</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="Manufacturer">
|
||||
</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="model" placeholder="Model Number">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Serial Number</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-barcode"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="serial" placeholder="Serial number">
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'other') { ?>
|
||||
<div class="form-group">
|
||||
<label>Operating System</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fab fa-fw fa-windows"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="os" placeholder="ex Windows 10 Pro">
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-assignment">
|
||||
|
||||
<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 = 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_id = intval($row['location_id']);
|
||||
$location_name = htmlentities($row['location_name']);
|
||||
?>
|
||||
<option value="<?php echo $location_id; ?>"><?php echo $location_name; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'servers' && $_GET['type'] !== 'other') { ?>
|
||||
<div class="form-group">
|
||||
<label>Assigned To</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 = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_archived_at IS NULL AND contact_client_id = $client_id ORDER BY contact_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$contact_id = intval($row['contact_id']);
|
||||
$contact_name = htmlentities($row['contact_name']);
|
||||
?>
|
||||
<option value="<?php echo $contact_id; ?>"><?php echo $contact_name; ?></option>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Status</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>
|
||||
<select class="form-control select2" name="status">
|
||||
<option value="">- Status -</option>
|
||||
<?php foreach($asset_status_array as $asset_status) { ?>
|
||||
<option><?php echo $asset_status; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Network</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-network-wired"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="network">
|
||||
<option value="">- Network -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM networks WHERE network_archived_at IS NULL AND network_client_id = $client_id ORDER BY network_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$network_id = intval($row['network_id']);
|
||||
$network_name = htmlentities($row['network_name']);
|
||||
$network = htmlentities($row['network']);
|
||||
|
||||
?>
|
||||
<option value="<?php echo $network_id; ?>"><?php echo $network_name; ?> - <?php echo $network; ?></option>
|
||||
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>IP</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-ethernet"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="ip" placeholder="IP Address" data-inputmask="'alias': 'ip'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>MAC Address</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-ethernet"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="mac" placeholder="MAC Address" data-inputmask="'alias': 'mac'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-purchase">
|
||||
|
||||
<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="">- Vendor -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_archived_at IS NULL AND vendor_client_id = $client_id AND vendor_template = 0 ORDER BY vendor_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$vendor_id = intval($row['vendor_id']);
|
||||
$vendor_name = htmlentities($row['vendor_name']);
|
||||
?>
|
||||
<option value="<?php echo $vendor_id; ?>"><?php echo $vendor_name; ?></option>
|
||||
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Install Date</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="install_date" max="2999-12-31">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($_GET['type'] !== 'virtual') { ?>
|
||||
<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-shopping-cart"></i></span>
|
||||
</div>
|
||||
<input type="date" class="form-control" name="purchase_date" max="2999-12-31">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Warranty Expire</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="warranty_expire" max="2999-12-31">
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-login">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Username</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="username" placeholder="Username">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Password</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-lock"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="password" placeholder="Password" autocomplete="new-password">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-notes">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="notes"></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'servers' && $_GET['type'] !== 'other') { ?>
|
||||
<div class="form-group">
|
||||
<label>Assigned To</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 = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_archived_at IS NULL AND contact_client_id = $client_id ORDER BY contact_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$contact_id = $row['contact_id'];
|
||||
$contact_name = htmlentities($row['contact_name']);
|
||||
?>
|
||||
<option value="<?php echo $contact_id; ?>"><?php echo $contact_name; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_asset" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Status</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>
|
||||
<select class="form-control select2" name="status">
|
||||
<option value="">- Status -</option>
|
||||
<?php foreach($asset_status_array as $asset_status) { ?>
|
||||
<option><?php echo $asset_status; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Network</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-network-wired"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="network">
|
||||
<option value="">- Network -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM networks WHERE network_archived_at IS NULL AND network_client_id = $client_id ORDER BY network_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$network_id = $row['network_id'];
|
||||
$network_name = htmlentities($row['network_name']);
|
||||
$network = htmlentities($row['network']);
|
||||
|
||||
?>
|
||||
<option value="<?php echo $network_id; ?>"><?php echo $network_name; ?> - <?php echo $network; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>IP</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-ethernet"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="ip" placeholder="IP Address" data-inputmask="'alias': 'ip'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>MAC Address</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-ethernet"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="mac" placeholder="MAC Address" data-inputmask="'alias': 'mac'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-purchase">
|
||||
|
||||
<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="">- Vendor -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_archived_at IS NULL AND vendor_client_id = $client_id AND vendor_template = 0 ORDER BY vendor_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$vendor_id = $row['vendor_id'];
|
||||
$vendor_name = htmlentities($row['vendor_name']);
|
||||
?>
|
||||
<option value="<?php echo $vendor_id; ?>"><?php echo $vendor_name; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Install Date</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="install_date" max="2999-12-31">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($_GET['type'] !== 'virtual') { ?>
|
||||
<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-shopping-cart"></i></span>
|
||||
</div>
|
||||
<input type="date" class="form-control" name="purchase_date" max="2999-12-31">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Warranty Expire</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="warranty_expire" max="2999-12-31">
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-login">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Username</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="username" placeholder="Username">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Password</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-lock"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="password" placeholder="Password" autocomplete="new-password">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-notes">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="notes"></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_asset" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Create</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,326 +1,317 @@
|
|||
|
||||
<div class="modal" id="copyAssetModal<?php echo $asset_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 $device_icon; ?>"></i> Copying asset: <strong><?php echo $asset_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="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="#pillsDetailsCopy<?php echo $asset_id; ?>">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pillsAssignmentCopy<?php echo $asset_id; ?>">Assignment</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pillsPurchaseCopy<?php echo $asset_id; ?>">Purchase</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pillsLoginCopy<?php echo $asset_id; ?>">Login</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pillsNotesCopy<?php echo $asset_id; ?>">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pillsDetailsCopy<?php echo $asset_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-tag"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name the asset" value="<?php echo $asset_name; ?>" required>
|
||||
</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-tags"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="type" required>
|
||||
<?php foreach($asset_types_array as $asset_type_select => $asset_icon_select) { ?>
|
||||
<option <?php if ($asset_type_select == $asset_type) { echo "selected"; } ?>><?php echo $asset_type_select; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php //Do not display Make Model or Serial if Virtual is selected
|
||||
if ($asset_type !== 'virtual') { ?>
|
||||
<div class="form-group">
|
||||
<label>Make </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="Manufacturer" value="<?php echo $asset_make; ?>">
|
||||
</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="model" placeholder="Model Number" value="<?php echo $asset_model; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Serial Number</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-barcode"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="serial" placeholder="Serial number">
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($asset_type !== 'Phone' && $asset_type !== 'Mobile Phone' && $asset_type !== 'Tablet' && $asset_type !== 'Access Point' && $asset_type !== 'Printer' && $asset_type !== 'Camera' && $asset_type !== 'TV' && $asset_type !== 'Other') { ?>
|
||||
<div class="form-group">
|
||||
<label>Operating System</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fab fa-fw fa-windows"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="os" placeholder="ex Windows 10 Pro" value="<?php echo $asset_os; ?>">
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<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 $device_icon; ?> mr-2"></i>Copying asset: <strong><?php echo $asset_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="client_id" value="<?php echo $client_id; ?>">
|
||||
|
||||
<div class="tab-pane fade" id="pillsAssignmentCopy<?php echo $asset_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<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_locations = mysqli_query($mysqli,"SELECT * FROM locations WHERE location_client_id = $client_id ORDER BY location_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_locations)) {
|
||||
$location_id_select = $row['location_id'];
|
||||
$location_name_select = htmlentities($row['location_name']);
|
||||
?>
|
||||
<option <?php if ($asset_location_id == $location_id_select) { echo "selected"; } ?> value="<?php echo $location_id_select; ?>"><?php echo $location_name_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pillsDetailsCopy<?php echo $asset_id; ?>">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pillsAssignmentCopy<?php echo $asset_id; ?>">Assignment</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pillsPurchaseCopy<?php echo $asset_id; ?>">Purchase</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pillsLoginCopy<?php echo $asset_id; ?>">Login</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pillsNotesCopy<?php echo $asset_id; ?>">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pillsDetailsCopy<?php echo $asset_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-tag"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name the asset" value="<?php echo $asset_name; ?>" required>
|
||||
</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-tags"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="type" required>
|
||||
<?php foreach($asset_types_array as $asset_type_select => $asset_icon_select) { ?>
|
||||
<option <?php if ($asset_type_select == $asset_type) { echo "selected"; } ?>><?php echo $asset_type_select; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php //Do not display Make Model or Serial if Virtual is selected
|
||||
if ($asset_type !== 'virtual') { ?>
|
||||
<div class="form-group">
|
||||
<label>Make </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="Manufacturer" value="<?php echo $asset_make; ?>">
|
||||
</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="model" placeholder="Model Number" value="<?php echo $asset_model; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Serial Number</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-barcode"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="serial" placeholder="Serial number">
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($asset_type !== 'Phone' && $asset_type !== 'Mobile Phone' && $asset_type !== 'Tablet' && $asset_type !== 'Access Point' && $asset_type !== 'Printer' && $asset_type !== 'Camera' && $asset_type !== 'TV' && $asset_type !== 'Other') { ?>
|
||||
<div class="form-group">
|
||||
<label>Operating System</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fab fa-fw fa-windows"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="os" placeholder="ex Windows 10 Pro" value="<?php echo $asset_os; ?>">
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pillsAssignmentCopy<?php echo $asset_id; ?>">
|
||||
|
||||
<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_locations = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_client_id = $client_id ORDER BY location_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_locations)) {
|
||||
$location_id_select = intval($row['location_id']);
|
||||
$location_name_select = htmlentities($row['location_name']);
|
||||
?>
|
||||
<option <?php if ($asset_location_id == $location_id_select) { echo "selected"; } ?> value="<?php echo $location_id_select; ?>"><?php echo $location_name_select; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($asset_type !== 'Firewall/Router' && $asset_type !== 'Switch' && $asset_type !== 'Access Point' && $asset_type !== 'Printer' && $asset_type !== 'Server' && $asset_type !== 'Virtual Machine') { ?>
|
||||
<div class="form-group">
|
||||
<label>Assigned To</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 IS NULL AND contact_client_id = $client_id ORDER BY contact_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_contacts)) {
|
||||
$contact_id = intval($row['contact_id']);
|
||||
$contact_name = htmlentities($row['contact_name']);
|
||||
?>
|
||||
<option value="<?php echo $contact_id; ?>"><?php echo $contact_name; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Status</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>
|
||||
<select class="form-control select2" name="status">
|
||||
<?php foreach($asset_status_array as $asset_status_select) { ?>
|
||||
<option <?php if ($asset_status_select == $asset_status) { echo "selected"; } ?>><?php echo $asset_status_select; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Network</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-network-wired"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="network">
|
||||
<option value="">- Network -</option>
|
||||
<?php
|
||||
|
||||
$sql_networks = mysqli_query($mysqli, "SELECT * FROM networks WHERE (network_archived_at > '$asset_created_at' OR network_archived_at IS NULL) AND network_client_id = $client_id ORDER BY network_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_networks)) {
|
||||
$network_id_select = intval($row['network_id']);
|
||||
$network_name_select = htmlentities($row['network_name']);
|
||||
$network_select = htmlentities($row['network']);
|
||||
|
||||
?>
|
||||
<option <?php if ($asset_network_id == $network_id_select) { echo "selected"; } ?> value="<?php echo $network_id_select; ?>"><?php echo $network_name_select; ?> - <?php echo $network_select; ?></option>
|
||||
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>IP</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-ethernet"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="ip" placeholder="IP Address" data-inputmask="'alias': 'ip'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>MAC Address</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-ethernet"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="mac" placeholder="MAC Address" data-inputmask="'alias': 'mac'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pillsPurchaseCopy<?php echo $asset_id; ?>">
|
||||
|
||||
<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="">- Vendor -</option>
|
||||
<?php
|
||||
|
||||
$sql_vendors = mysqli_query($mysqli, "SELECT * FROM vendors WHERE (vendor_archived_at > '$asset_created_at' OR vendor_archived_at IS NULL) AND vendor_client_id = $client_id 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 = htmlentities($row['vendor_name']);
|
||||
?>
|
||||
<option <?php if ($asset_vendor_id == $vendor_id_select) { echo "selected"; } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
|
||||
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Install Date</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="install_date" max="2999-12-31" value="<?php echo $asset_install_date; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($asset_type !== 'Virtual Machine') { ?>
|
||||
<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-shopping-cart"></i></span>
|
||||
</div>
|
||||
<input type="date" class="form-control" name="purchase_date" max="2999-12-31" value="<?php echo $asset_purchase_date; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Warranty Expire</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="warranty_expire" max="2999-12-31" value="<?php echo $asset_warranty_expire; ?>">
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pillsLoginCopy<?php echo $asset_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Username</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="username" placeholder="Username">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Password</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-lock"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="password" placeholder="Password" autocomplete="new-password">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pillsNotesCopy<?php echo $asset_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="notes"><?php echo $asset_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($asset_type !== 'Firewall/Router' && $asset_type !== 'Switch' && $asset_type !== 'Access Point' && $asset_type !== 'Printer' && $asset_type !== 'Server' && $asset_type !== 'Virtual Machine') { ?>
|
||||
<div class="form-group">
|
||||
<label>Assigned To</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 IS NULL AND contact_client_id = $client_id ORDER BY contact_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_contacts)) {
|
||||
$contact_id = $row['contact_id'];
|
||||
$contact_name = htmlentities($row['contact_name']);
|
||||
?>
|
||||
<option value="<?php echo $contact_id; ?>"><?php echo $contact_name; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_asset" 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>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Status</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>
|
||||
<select class="form-control select2" name="status">
|
||||
<?php foreach($asset_status_array as $asset_status_select) { ?>
|
||||
<option <?php if ($asset_status_select == $asset_status) { echo "selected"; } ?>><?php echo $asset_status_select; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Network</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-network-wired"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="network">
|
||||
<option value="">- Network -</option>
|
||||
<?php
|
||||
|
||||
$sql_networks = mysqli_query($mysqli,"SELECT * FROM networks WHERE (network_archived_at > '$asset_created_at' OR network_archived_at IS NULL) AND network_client_id = $client_id ORDER BY network_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_networks)) {
|
||||
$network_id_select = $row['network_id'];
|
||||
$network_name_select = htmlentities($row['network_name']);
|
||||
$network_select = htmlentities($row['network']);
|
||||
|
||||
?>
|
||||
<option <?php if ($asset_network_id == $network_id_select) { echo "selected"; } ?> value="<?php echo $network_id_select; ?>"><?php echo $network_name_select; ?> - <?php echo $network_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>IP</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-ethernet"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="ip" placeholder="IP Address" data-inputmask="'alias': 'ip'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>MAC Address</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-ethernet"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="mac" placeholder="MAC Address" data-inputmask="'alias': 'mac'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pillsPurchaseCopy<?php echo $asset_id; ?>">
|
||||
|
||||
<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="">- Vendor -</option>
|
||||
<?php
|
||||
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE (vendor_archived_at > '$asset_created_at' OR vendor_archived_at IS NULL) AND vendor_client_id = $client_id AND vendor_template = 0 ORDER BY vendor_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_vendors)) {
|
||||
$vendor_id_select = $row['vendor_id'];
|
||||
$vendor_name_select = htmlentities($row['vendor_name']);
|
||||
?>
|
||||
<option <?php if ($asset_vendor_id == $vendor_id_select) { echo "selected"; } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Install Date</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="install_date" max="2999-12-31" value="<?php echo $asset_install_date; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($asset_type !== 'Virtual Machine') { ?>
|
||||
<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-shopping-cart"></i></span>
|
||||
</div>
|
||||
<input type="date" class="form-control" name="purchase_date" max="2999-12-31" value="<?php echo $asset_purchase_date; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Warranty Expire</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="warranty_expire" max="2999-12-31" value="<?php echo $asset_warranty_expire; ?>">
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pillsLoginCopy<?php echo $asset_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Username</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="username" placeholder="Username">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Password</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-lock"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="password" placeholder="Password" autocomplete="new-password">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pillsNotesCopy<?php echo $asset_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="notes"><?php echo $asset_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_asset" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Copy</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,31 +1,29 @@
|
|||
<div class="modal" id="assetDocumentsModal<?php echo $asset_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-<?php echo $device_icon; ?>"></i> <?php echo $asset_name; ?> Documents</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
<?php
|
||||
while ($row = mysqli_fetch_array($sql_related_documents)) {
|
||||
$related_document_id = $row['document_id'];
|
||||
$related_document_name = htmlentities($row['document_name']);
|
||||
?>
|
||||
<p>
|
||||
<i class="fas fa-fw fa-document text-secondary"></i>
|
||||
<?php echo $related_document_name; ?> <a href="client_documents.php?q=<?php echo $related_document_name; ?>"><?php echo $related_document_name; ?></a>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
</div>
|
||||
<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-<?php echo $device_icon; ?> mr-2"></i><?php echo $asset_name; ?> Documents</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
<?php
|
||||
while ($row = mysqli_fetch_array($sql_related_documents)) {
|
||||
$related_document_id = intval($row['document_id']);
|
||||
$related_document_name = htmlentities($row['document_name']);
|
||||
?>
|
||||
<p>
|
||||
<i class="fas fa-fw fa-document text-secondary"></i>
|
||||
<?php echo $related_document_name; ?> <a href="client_documents.php?q=<?php echo $related_document_name; ?>"><?php echo $related_document_name; ?></a>
|
||||
</p>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,327 +1,319 @@
|
|||
<div class="modal" id="editAssetModal<?php echo $asset_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 $device_icon; ?>"></i> Editing asset: <strong><?php echo $asset_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="asset_id" value="<?php echo $asset_id; ?>">
|
||||
<input type="hidden" name="login_id" value="<?php echo $login_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 $asset_id; ?>">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-assignment<?php echo $asset_id; ?>">Assignment</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-purchase<?php echo $asset_id; ?>">Purchase</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-login<?php echo $asset_id; ?>">Login</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-notes<?php echo $asset_id; ?>">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-details<?php echo $asset_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-tag"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name the asset" value="<?php echo $asset_name; ?>" required>
|
||||
</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-tags"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="type" required>
|
||||
<?php foreach($asset_types_array as $asset_type_select => $asset_icon_select) { ?>
|
||||
<option <?php if ($asset_type_select == $asset_type) { echo "selected"; } ?>><?php echo $asset_type_select; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php //Do not display Make Model or Serial if Virtual is selected
|
||||
if ($asset_type !== 'virtual') { ?>
|
||||
<div class="form-group">
|
||||
<label>Make </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="Manufacturer" value="<?php echo $asset_make; ?>">
|
||||
</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="model" placeholder="Model Number" value="<?php echo $asset_model; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Serial Number</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-barcode"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="serial" placeholder="Serial number" value="<?php echo $asset_serial; ?>">
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($asset_type !== 'Phone' && $asset_type !== 'Mobile Phone' && $asset_type !== 'Tablet' && $asset_type !== 'Access Point' && $asset_type !== 'Printer' && $asset_type !== 'Camera' && $asset_type !== 'TV' && $asset_type !== 'Other') { ?>
|
||||
<div class="form-group">
|
||||
<label>Operating System</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fab fa-fw fa-windows"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="os" placeholder="ex Windows 10 Pro" value="<?php echo $asset_os; ?>">
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<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 $device_icon; ?> mr-2"></i>Editing asset: <strong><?php echo $asset_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="asset_id" value="<?php echo $asset_id; ?>">
|
||||
<input type="hidden" name="login_id" value="<?php echo $login_id; ?>">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
|
||||
<div class="tab-pane fade" id="pills-assignment<?php echo $asset_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<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_locations = mysqli_query($mysqli,"SELECT * FROM locations WHERE location_client_id = $client_id ORDER BY location_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_locations)) {
|
||||
$location_id_select = $row['location_id'];
|
||||
$location_name_select = htmlentities($row['location_name']);
|
||||
?>
|
||||
<option <?php if ($asset_location_id == $location_id_select) { echo "selected"; } ?> value="<?php echo $location_id_select; ?>"><?php echo $location_name_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<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 $asset_id; ?>">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-assignment<?php echo $asset_id; ?>">Assignment</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-purchase<?php echo $asset_id; ?>">Purchase</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-login<?php echo $asset_id; ?>">Login</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-notes<?php echo $asset_id; ?>">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-details<?php echo $asset_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-tag"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name the asset" value="<?php echo $asset_name; ?>" required>
|
||||
</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-tags"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="type" required>
|
||||
<?php foreach($asset_types_array as $asset_type_select => $asset_icon_select) { ?>
|
||||
<option <?php if ($asset_type_select == $asset_type) { echo "selected"; } ?>><?php echo $asset_type_select; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php //Do not display Make Model or Serial if Virtual is selected
|
||||
if ($asset_type !== 'virtual') { ?>
|
||||
<div class="form-group">
|
||||
<label>Make </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="Manufacturer" value="<?php echo $asset_make; ?>">
|
||||
</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="model" placeholder="Model Number" value="<?php echo $asset_model; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Serial Number</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-barcode"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="serial" placeholder="Serial number" value="<?php echo $asset_serial; ?>">
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($asset_type !== 'Phone' && $asset_type !== 'Mobile Phone' && $asset_type !== 'Tablet' && $asset_type !== 'Access Point' && $asset_type !== 'Printer' && $asset_type !== 'Camera' && $asset_type !== 'TV' && $asset_type !== 'Other') { ?>
|
||||
<div class="form-group">
|
||||
<label>Operating System</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fab fa-fw fa-windows"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="os" placeholder="ex Windows 10 Pro" value="<?php echo $asset_os; ?>">
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-assignment<?php echo $asset_id; ?>">
|
||||
|
||||
<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_locations = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_client_id = $client_id ORDER BY location_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_locations)) {
|
||||
$location_id_select = intval($row['location_id']);
|
||||
$location_name_select = htmlentities($row['location_name']);
|
||||
?>
|
||||
<option <?php if ($asset_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="form-group">
|
||||
<label>Assigned To</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 > '$asset_created_at' OR contact_archived_at IS NULL) AND contact_client_id = $client_id ORDER BY contact_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_contacts)) {
|
||||
$contact_id_select = intval($row['contact_id']);
|
||||
$contact_name_select = htmlentities($row['contact_name']);
|
||||
?>
|
||||
<option <?php if ($asset_contact_id == $contact_id_select) { echo "selected"; } ?> value="<?php echo $contact_id_select; ?>">
|
||||
<?php echo $contact_name_select; ?> <?php if (!empty($row['contact_archived_at'])) { echo " (Archived " . date('Y-m-d', strtotime($row['contact_archived_at'])) .")"; } ?>
|
||||
</option>
|
||||
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Status</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>
|
||||
<select class="form-control select2" name="status">
|
||||
<?php foreach($asset_status_array as $asset_status_select) { ?>
|
||||
<option <?php if ($asset_status_select == $asset_status) { echo "selected"; } ?>><?php echo $asset_status_select; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Network</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-network-wired"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="network">
|
||||
<option value="">- Network -</option>
|
||||
<?php
|
||||
|
||||
$sql_networks = mysqli_query($mysqli, "SELECT * FROM networks WHERE (network_archived_at > '$asset_created_at' OR network_archived_at IS NULL) AND network_client_id = $client_id ORDER BY network_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_networks)) {
|
||||
$network_id_select = intval($row['network_id']);
|
||||
$network_name_select = htmlentities($row['network_name']);
|
||||
$network_select = htmlentities($row['network']);
|
||||
|
||||
?>
|
||||
<option <?php if ($asset_network_id == $network_id_select) { echo "selected"; } ?> value="<?php echo $network_id_select; ?>"><?php echo $network_name_select; ?> - <?php echo $network_select; ?></option>
|
||||
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>IP</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-ethernet"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="ip" value="<?php echo $asset_ip; ?>" placeholder="IP Address" data-inputmask="'alias': 'ip'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>MAC Address</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-ethernet"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="mac" value="<?php echo $asset_mac; ?>" placeholder="MAC Address" data-inputmask="'alias': 'mac'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-purchase<?php echo $asset_id; ?>">
|
||||
|
||||
<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="">- Vendor -</option>
|
||||
<?php
|
||||
|
||||
$sql_vendors = mysqli_query($mysqli, "SELECT * FROM vendors WHERE (vendor_archived_at > '$asset_created_at' OR vendor_archived_at IS NULL) AND vendor_client_id = $client_id ORDER BY vendor_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_vendors)) {
|
||||
$vendor_id_select = intval($row['vendor_id']);
|
||||
$vendor_name_select = htmlentities($row['vendor_name']);
|
||||
?>
|
||||
<option <?php if ($asset_vendor_id == $vendor_id_select) { echo "selected"; } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
|
||||
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Install Date</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="install_date" max="2999-12-31" value="<?php echo $asset_install_date; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($asset_type !== 'Virtual Machine') { ?>
|
||||
<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-shopping-cart"></i></span>
|
||||
</div>
|
||||
<input type="date" class="form-control" name="purchase_date" max="2999-12-31" value="<?php echo $asset_purchase_date; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Warranty Expire</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="warranty_expire" max="2999-12-31" value="<?php echo $asset_warranty_expire; ?>">
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-login<?php echo $asset_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Username</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="username" placeholder="Username" value="<?php echo $login_username; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Password</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-lock"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="password" placeholder="Password" value="<?php echo $login_password; ?>" autocomplete="new-password">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-notes<?php echo $asset_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="notes"><?php echo $asset_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Assigned To</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 > '$asset_created_at' OR contact_archived_at IS NULL) AND contact_client_id = $client_id ORDER BY contact_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_contacts)) {
|
||||
$contact_id_select = $row['contact_id'];
|
||||
$contact_name_select = htmlentities($row['contact_name']);
|
||||
?>
|
||||
<option <?php if ($asset_contact_id == $contact_id_select) { echo "selected"; } ?> value="<?php echo $contact_id_select; ?>">
|
||||
<?php echo $contact_name_select; ?> <?php if (!empty($row['contact_archived_at'])) { echo " (Archived " . date('Y-m-d',strtotime($row['contact_archived_at'])) .")"; } ?>
|
||||
</option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_asset" 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>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Status</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>
|
||||
<select class="form-control select2" name="status">
|
||||
<?php foreach($asset_status_array as $asset_status_select) { ?>
|
||||
<option <?php if ($asset_status_select == $asset_status) { echo "selected"; } ?>><?php echo $asset_status_select; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Network</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-network-wired"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="network">
|
||||
<option value="">- Network -</option>
|
||||
<?php
|
||||
|
||||
$sql_networks = mysqli_query($mysqli,"SELECT * FROM networks WHERE (network_archived_at > '$asset_created_at' OR network_archived_at IS NULL) AND network_client_id = $client_id ORDER BY network_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_networks)) {
|
||||
$network_id_select = $row['network_id'];
|
||||
$network_name_select = htmlentities($row['network_name']);
|
||||
$network_select = htmlentities($row['network']);
|
||||
|
||||
?>
|
||||
<option <?php if ($asset_network_id == $network_id_select) { echo "selected"; } ?> value="<?php echo $network_id_select; ?>"><?php echo $network_name_select; ?> - <?php echo $network_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>IP</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-ethernet"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="ip" value="<?php echo $asset_ip; ?>" placeholder="IP Address" data-inputmask="'alias': 'ip'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>MAC Address</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-ethernet"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="mac" value="<?php echo $asset_mac; ?>" placeholder="MAC Address" data-inputmask="'alias': 'mac'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-purchase<?php echo $asset_id; ?>">
|
||||
|
||||
<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="">- Vendor -</option>
|
||||
<?php
|
||||
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE (vendor_archived_at > '$asset_created_at' OR vendor_archived_at IS NULL) AND vendor_client_id = $client_id ORDER BY vendor_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_vendors)) {
|
||||
$vendor_id_select = $row['vendor_id'];
|
||||
$vendor_name_select = htmlentities($row['vendor_name']);
|
||||
?>
|
||||
<option <?php if ($asset_vendor_id == $vendor_id_select) { echo "selected"; } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Install Date</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="install_date" max="2999-12-31" value="<?php echo $asset_install_date; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($asset_type !== 'Virtual Machine') { ?>
|
||||
<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-shopping-cart"></i></span>
|
||||
</div>
|
||||
<input type="date" class="form-control" name="purchase_date" max="2999-12-31" value="<?php echo $asset_purchase_date; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Warranty Expire</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="warranty_expire" max="2999-12-31" value="<?php echo $asset_warranty_expire; ?>">
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-login<?php echo $asset_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Username</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="username" placeholder="Username" value="<?php echo $login_username; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Password</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-lock"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="password" placeholder="Password" value="<?php echo $login_password; ?>" autocomplete="new-password">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-notes<?php echo $asset_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="notes"><?php echo $asset_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="edit_asset" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,27 +1,27 @@
|
|||
<div class="modal" id="importAssetModal" 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-desktop"></i> Import Assets</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; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
<p><strong>Format csv file with headings & data:</strong><br>Name, Type, Make, Model, Serial, OS, Assigned To, Location</p>
|
||||
<hr>
|
||||
<div class="form-group my-4">
|
||||
<input type="file" class="form-control-file" name="file" accept=".csv">
|
||||
</div>
|
||||
<hr>
|
||||
<div>Download <a href="post.php?download_client_assets_csv_template=<?php echo $client_id; ?>">sample csv template</a></div>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="import_client_assets_csv" class="btn btn-primary">Import</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-desktop mr-2"></i>Import Assets</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; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
<p><strong>Format csv file with headings & data:</strong><br>Name, Type, Make, Model, Serial, OS, Assigned To, Location</p>
|
||||
<hr>
|
||||
<div class="form-group my-4">
|
||||
<input type="file" class="form-control-file" name="file" accept=".csv">
|
||||
</div>
|
||||
<hr>
|
||||
<div>Download <a href="post.php?download_client_assets_csv_template=<?php echo $client_id; ?>">sample csv template</a></div>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="import_client_assets_csv" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Import</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,125 +1,122 @@
|
|||
<div class="modal" id="addAssetInterfaceModal<?php echo $asset_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-ethernet"></i> <i class="fa fa-fw fa-<?php echo $device_icon; ?>"></i> <?php echo $asset_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="client_id" value="<?php echo $client_id; ?>">
|
||||
<input type="hidden" name="asset_id" value="<?php echo $asset_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-interfaces<?php echo $asset_id; ?>">Interfaces</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-create<?php echo $asset_id; ?>">Create</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade" id="pills-interfaces<?php echo $asset_id; ?>">
|
||||
|
||||
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-ethernet"></i> <i class="fa fa-fw fa-<?php echo $device_icon; ?>"></i> <?php echo $asset_name; ?></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-create<?php echo $asset_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Interface Number</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-ethernet"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="interface_number" placeholder="Port number">
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<input type="hidden" name="asset_id" value="<?php echo $asset_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-interfaces<?php echo $asset_id; ?>">Interfaces</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-create<?php echo $asset_id; ?>">Create</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade" id="pills-interfaces<?php echo $asset_id; ?>">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-create<?php echo $asset_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Interface Number</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-ethernet"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="interface_number" placeholder="Port number">
|
||||
</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-tag"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="interface_description" placeholder="Description">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Connected 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>
|
||||
<input type="text" class="form-control" name="interface_connected_asset" placeholder="Connected Device">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Network</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-network-wired"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="interface_network">
|
||||
<option value="">- None -</option>
|
||||
<?php
|
||||
|
||||
$sql_network_select = mysqli_query($mysqli, "SELECT * FROM networks WHERE network_archived_at IS NULL AND network_client_id = $client_id ORDER BY network_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_network_select)) {
|
||||
$network_id = $row['network_id'];
|
||||
$network_name = htmlentities($row['network_name']);
|
||||
$network = htmlentities($row['network']);
|
||||
|
||||
?>
|
||||
<option value="<?php echo $network_id; ?>"><?php echo $network_name; ?> - <?php echo $network; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>IP</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-ethernet"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="interface_ip" placeholder="IP Address" data-inputmask="'alias': 'ip'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>MAC Address</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-ethernet"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="interface_mac" placeholder="MAC Address" data-inputmask="'alias': 'mac'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</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-tag"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="interface_description" placeholder="Description">
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_asset_interface" class="btn btn-primary"><i class="fa fa-check"></i> Create</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Connected 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>
|
||||
<input type="text" class="form-control" name="interface_connected_asset" placeholder="Connected Device">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Network</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-network-wired"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="interface_network">
|
||||
<option value="">- None -</option>
|
||||
<?php
|
||||
|
||||
$sql_network_select = mysqli_query($mysqli,"SELECT * FROM networks WHERE network_archived_at IS NULL AND network_client_id = $client_id ORDER BY network_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_network_select)) {
|
||||
$network_id = $row['network_id'];
|
||||
$network_name = htmlentities($row['network_name']);
|
||||
$network = htmlentities($row['network']);
|
||||
|
||||
?>
|
||||
<option value="<?php echo $network_id; ?>"><?php echo $network_name; ?> - <?php echo $network; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>IP</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-ethernet"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="interface_ip" placeholder="IP Address" data-inputmask="'alias': 'ip'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>MAC Address</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-ethernet"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="interface_mac" placeholder="MAC Address" data-inputmask="'alias': 'mac'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_asset_interface" class="btn btn-primary"><i class="fa fa-check"></i> Create</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,37 +1,35 @@
|
|||
<div class="modal" id="assetTicketsModal<?php echo $asset_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-<?php echo $device_icon; ?>"></i> <?php echo $asset_name; ?></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
<?php
|
||||
// Query is run from client_assets.php
|
||||
while ($row = mysqli_fetch_array($sql_tickets)) {
|
||||
$ticket_id = $row['ticket_id'];
|
||||
$ticket_prefix = htmlentities($row['ticket_prefix']);
|
||||
$ticket_number = htmlentities($row['ticket_number']);
|
||||
$ticket_subject = htmlentities($row['ticket_subject']);
|
||||
$ticket_status = htmlentities($row['ticket_status']);
|
||||
$ticket_created_at = $row['ticket_created_at'];
|
||||
$ticket_updated_at = $row['ticket_updated_at'];
|
||||
?>
|
||||
<p>
|
||||
<i class="fas fa-fw fa-ticket-alt"></i>
|
||||
Ticket: <a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>"><?php echo "$ticket_prefix$ticket_number" ?></a> on <?php echo $ticket_created_at; ?> <?php echo $ticket_subject; ?>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
</div>
|
||||
<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-<?php echo $device_icon; ?>"></i> <?php echo $asset_name; ?></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
<?php
|
||||
// Query is run from client_assets.php
|
||||
while ($row = mysqli_fetch_array($sql_tickets)) {
|
||||
$ticket_id = intval($row['ticket_id']);
|
||||
$ticket_prefix = htmlentities($row['ticket_prefix']);
|
||||
$ticket_number = intval($row['ticket_number']);
|
||||
$ticket_subject = htmlentities($row['ticket_subject']);
|
||||
$ticket_status = htmlentities($row['ticket_status']);
|
||||
$ticket_created_at = htmlentities($row['ticket_created_at']);
|
||||
$ticket_updated_at = htmlentities($row['ticket_updated_at']);
|
||||
?>
|
||||
<p>
|
||||
<i class="fas fa-fw fa-ticket-alt"></i>
|
||||
Ticket: <a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>"><?php echo "$ticket_prefix$ticket_number" ?></a> on <?php echo $ticket_created_at; ?> <?php echo $ticket_subject; ?>
|
||||
</p>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,39 +1,39 @@
|
|||
<?php include("inc_all_client.php");
|
||||
<?php
|
||||
|
||||
// Default Column Sortby Filter
|
||||
$sb = "asset_name";
|
||||
$o = "ASC";
|
||||
|
||||
require_once("inc_all_client.php");
|
||||
|
||||
//Get Asset Counts
|
||||
//All Asset Count
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT(*) AS count FROM assets WHERE asset_archived_at IS NULL AND asset_client_id = $client_id"));
|
||||
$all_count = $row['count'];
|
||||
$all_count = intval($row['count']);
|
||||
//Workstation Count
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT(*) AS count FROM assets WHERE (asset_type = 'laptop' OR asset_type = 'desktop')
|
||||
AND asset_archived_at IS NULL AND asset_client_id = $client_id"));
|
||||
$workstation_count = $row['count'];
|
||||
$workstation_count = intval($row['count']);
|
||||
|
||||
//Server Count
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT(*) AS count FROM assets WHERE (asset_type = 'server')
|
||||
AND asset_archived_at IS NULL AND asset_client_id = $client_id"));
|
||||
$server_count = $row['count'];
|
||||
$server_count = intval($row['count']);
|
||||
|
||||
//Virtual Server Count
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT(*) AS count FROM assets WHERE (asset_type = 'virtual machine')
|
||||
AND asset_archived_at IS NULL AND asset_client_id = $client_id"));
|
||||
$virtual_count = $row['count'];
|
||||
$virtual_count = intval($row['count']);
|
||||
|
||||
//Network Device Count
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT(*) AS count FROM assets WHERE (asset_type = 'Firewall/Router' OR asset_type = 'switch' OR asset_type = 'access point')
|
||||
AND asset_archived_at IS NULL AND asset_client_id = $client_id"));
|
||||
$network_count = $row['count'];
|
||||
$network_count = intval($row['count']);
|
||||
|
||||
//Other Count
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT(*) AS count FROM assets WHERE (asset_type NOT LIKE 'laptop' AND asset_type NOT LIKE 'desktop' AND asset_type NOT LIKE 'server' AND asset_type NOT LIKE 'virtual machine' AND asset_type NOT LIKE 'firewall/router' AND asset_type NOT LIKE 'switch' AND asset_type NOT LIKE 'access point')
|
||||
AND asset_archived_at IS NULL AND asset_client_id = $client_id"));
|
||||
$other_count = $row['count'];
|
||||
|
||||
if (!empty($_GET['sb'])) {
|
||||
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
|
||||
} else {
|
||||
$sb = "asset_name";
|
||||
}
|
||||
$other_count = intval($row['count']);
|
||||
|
||||
//Asset Type from GET
|
||||
if (isset($_GET['type']) && ($_GET['type']) == 'workstation') {
|
||||
|
|
@ -52,17 +52,19 @@ if (isset($_GET['type']) && ($_GET['type']) == 'workstation') {
|
|||
}
|
||||
|
||||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
$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 assets
|
||||
LEFT JOIN contacts ON asset_contact_id = contact_id
|
||||
LEFT JOIN locations ON asset_location_id = location_id
|
||||
LEFT JOIN logins ON login_asset_id = asset_id
|
||||
WHERE asset_client_id = $client_id
|
||||
AND asset_archived_at IS NULL
|
||||
AND (asset_name LIKE '%$q%' OR asset_type LIKE '%$q%' OR asset_ip LIKE '%$q%' OR asset_make LIKE '%$q%' OR asset_model LIKE '%$q%' OR asset_serial LIKE '%$q%' OR asset_os LIKE '%$q%' OR contact_name LIKE '%$q%' OR location_name LIKE '%$q%')
|
||||
AND ($type_query)
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to"
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM assets
|
||||
LEFT JOIN contacts ON asset_contact_id = contact_id
|
||||
LEFT JOIN locations ON asset_location_id = location_id
|
||||
LEFT JOIN logins ON login_asset_id = asset_id
|
||||
WHERE asset_client_id = $client_id
|
||||
AND asset_archived_at IS NULL
|
||||
AND (asset_name LIKE '%$q%' OR asset_type LIKE '%$q%' OR asset_ip LIKE '%$q%' OR asset_make LIKE '%$q%' OR asset_model LIKE '%$q%' OR asset_serial LIKE '%$q%' OR asset_os LIKE '%$q%' OR contact_name LIKE '%$q%' OR location_name LIKE '%$q%')
|
||||
AND ($type_query)
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to"
|
||||
);
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
|
|
@ -71,20 +73,20 @@ $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-desktop"></i> Assets</h3>
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-desktop mr-2"></i>Assets</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addAssetModal"><i class="fas fa-fw fa-plus"></i> New <?php if (!empty($_GET['type'])) { echo ucwords(strip_tags(htmlentities($_GET['type']))); }else{ echo "Asset"; } ?></button>
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addAssetModal"><i class="fas fa-plus mr-2"></i>New <?php if (!empty($_GET['type'])) { echo ucwords(strip_tags(htmlentities($_GET['type']))); } else { echo "Asset"; } ?></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="type" value="<?php echo strip_tags(htmlentities($_GET['type'])); ?>">
|
||||
<input type="hidden" name="type" value="<?php echo stripslashes(htmlentities($_GET['type'])); ?>">
|
||||
<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 strip_tags(htmlentities($q)); } ?>" placeholder="Search <?php if (!empty($_GET['type'])) { echo ucwords(strip_tags(htmlentities($_GET['type']))); }else{ echo "Asset"; } ?>s">
|
||||
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(htmlentities($q)); } ?>" placeholder="Search <?php if (!empty($_GET['type'])) { echo ucwords(stripslashes(htmlentities($_GET['type']))); } else { echo "Asset"; } ?>s">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
|
|
@ -92,30 +94,26 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="btn-group btn-group-lg">
|
||||
<a href="?<?php echo $url_query_strings_sb; ?>&type=" class="btn <?php if ($_GET['type'] == 'all' || empty($_GET['type'])) { echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">All Assets <span class="right badge badge-light"><?php echo $all_count; ?></span></a>
|
||||
<a href="?<?php echo $url_query_strings_sb; ?>&type=" class="btn <?php if ($_GET['type'] == 'all' || empty($_GET['type'])) { echo 'btn-primary'; } else { echo 'btn-default'; } ?>">All Assets <span class="right badge badge-light"><?php echo $all_count; ?></span></a>
|
||||
<?php
|
||||
if ($workstation_count > 0) { ?>
|
||||
<a href="?<?php echo $url_query_strings_sb; ?>&type=workstation" class="btn <?php if ($_GET['type'] == 'workstation') { echo 'btn-primary'; }else{ echo 'btn-default'; } ?>"><i class="fa fa-fw fa-desktop"></i> Workstations <span class="right badge badge-light"><?php echo $workstation_count; ?></span></a>
|
||||
<a href="?<?php echo $url_query_strings_sb; ?>&type=workstation" class="btn <?php if ($_GET['type'] == 'workstation') { echo 'btn-primary'; } else { echo 'btn-default'; } ?>"><i class="fa fa-fw fa-desktop"></i> Workstations <span class="right badge badge-light"><?php echo $workstation_count; ?></span></a>
|
||||
<?php
|
||||
} ?>
|
||||
<?php
|
||||
}
|
||||
if ($server_count > 0) { ?>
|
||||
<a href="?<?php echo $url_query_strings_sb; ?>&type=server" class="btn <?php if ($_GET['type'] == 'server') { echo 'btn-primary'; }else{ echo 'btn-default'; } ?>"><i class="fa fa-fw fa-server"></i> Servers <span class="right badge badge-light"><?php echo $server_count; ?></span></a>
|
||||
<a href="?<?php echo $url_query_strings_sb; ?>&type=server" class="btn <?php if ($_GET['type'] == 'server') { echo 'btn-primary'; } else { echo 'btn-default'; } ?>"><i class="fa fa-fw fa-server"></i> Servers <span class="right badge badge-light"><?php echo $server_count; ?></span></a>
|
||||
<?php
|
||||
} ?>
|
||||
<?php
|
||||
}
|
||||
if ($virtual_count > 0) { ?>
|
||||
<a href="?<?php echo $url_query_strings_sb; ?>&type=virtual" class="btn <?php if ($_GET['type'] == 'virtual') { echo 'btn-primary'; }else{ echo 'btn-default'; } ?>"><i class="fa fa-fw fa-cloud"></i> Virtual <span class="right badge badge-light"><?php echo $virtual_count; ?></span></a>
|
||||
<a href="?<?php echo $url_query_strings_sb; ?>&type=virtual" class="btn <?php if ($_GET['type'] == 'virtual') { echo 'btn-primary'; } else { echo 'btn-default'; } ?>"><i class="fa fa-fw fa-cloud"></i> Virtual <span class="right badge badge-light"><?php echo $virtual_count; ?></span></a>
|
||||
<?php
|
||||
} ?>
|
||||
<?php
|
||||
}
|
||||
if ($network_count > 0) { ?>
|
||||
<a href="?<?php echo $url_query_strings_sb; ?>&type=network" class="btn <?php if ($_GET['type'] == 'network') { echo 'btn-primary'; }else{ echo 'btn-default'; } ?>"><i class="fa fa-fw fa-network-wired"></i> Network <span class="right badge badge-light"><?php echo $network_count; ?></span></a>
|
||||
<a href="?<?php echo $url_query_strings_sb; ?>&type=network" class="btn <?php if ($_GET['type'] == 'network') { echo 'btn-primary'; } else { echo 'btn-default'; } ?>"><i class="fa fa-fw fa-network-wired"></i> Network <span class="right badge badge-light"><?php echo $network_count; ?></span></a>
|
||||
<?php
|
||||
} ?>
|
||||
<?php
|
||||
}
|
||||
if ($network_count > 0) { ?>
|
||||
<a href="?<?php echo $url_query_strings_sb; ?>&type=other" class="btn <?php if ($_GET['type'] == 'other') { echo 'btn-primary'; }else{ echo 'btn-default'; } ?>"><i class="fa fa-fw fa-tag"></i> Other <span class="right badge badge-light"><?php echo $other_count; ?></span></a>
|
||||
<a href="?<?php echo $url_query_strings_sb; ?>&type=other" class="btn <?php if ($_GET['type'] == 'other') { echo 'btn-primary'; } else { echo 'btn-default'; } ?>"><i class="fa fa-fw fa-tag"></i> Other <span class="right badge badge-light"><?php echo $other_count; ?></span></a>
|
||||
<?php
|
||||
} ?>
|
||||
</div>
|
||||
|
|
@ -138,16 +136,17 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=asset_name&o=<?php echo $disp; ?>">Name</a></th>
|
||||
<?php if ($_GET['type'] !== 'virtual' && $_GET['type'] !== 'servers') { ?>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=asset_type&o=<?php echo $disp; ?>">Type</a></th>
|
||||
<?php } ?>
|
||||
<?php if ($_GET['type'] !== 'virtual') { ?>
|
||||
<?php }
|
||||
if ($_GET['type'] !== 'virtual') { ?>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=asset_make&o=<?php echo $disp; ?>">Make/Model</a></th>
|
||||
<?php } ?>
|
||||
<?php if ($_GET['type'] !== 'virtual') { ?>
|
||||
<?php }
|
||||
if ($_GET['type'] !== 'virtual') { ?>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=asset_serial&o=<?php echo $disp; ?>">Serial Number</a></th>
|
||||
<?php } ?>
|
||||
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'other') { ?>
|
||||
<?php }
|
||||
if ($_GET['type'] !== 'network' && $_GET['type'] !== 'other') { ?>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=asset_os&o=<?php echo $disp; ?>">Operating System</a></th>
|
||||
<?php } ?>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=asset_ip&o=<?php echo $disp; ?>">IP</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=asset_install_date&o=<?php echo $disp; ?>">Install Date</a></th>
|
||||
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'servers' && $_GET['type'] !== 'other') { ?>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=contact_name&o=<?php echo $disp; ?>">Assigned To</a></th>
|
||||
|
|
@ -161,7 +160,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$asset_id = $row['asset_id'];
|
||||
$asset_id = intval($row['asset_id']);
|
||||
$asset_type = htmlentities($row['asset_type']);
|
||||
$asset_name = htmlentities($row['asset_name']);
|
||||
$asset_make = htmlentities($row['asset_make']);
|
||||
|
|
@ -169,77 +168,51 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
$asset_serial = htmlentities($row['asset_serial']);
|
||||
if (empty($asset_serial)) {
|
||||
$asset_serial_display = "-";
|
||||
}else{
|
||||
} else {
|
||||
$asset_serial_display = $asset_serial;
|
||||
}
|
||||
$asset_os = htmlentities($row['asset_os']);
|
||||
if (empty($asset_os)) {
|
||||
$asset_os_display = "-";
|
||||
}else{
|
||||
} else {
|
||||
$asset_os_display = $asset_os;
|
||||
}
|
||||
$asset_ip = htmlentities($row['asset_ip']);
|
||||
if (empty($asset_ip)) {
|
||||
$asset_ip_display = "-";
|
||||
}else{
|
||||
$asset_ip_display = "$asset_ip<button class='btn btn-sm' data-clipboard-text='$asset_ip'><i class='far fa-copy text-secondary'></i></button>";
|
||||
} else {
|
||||
$asset_ip_display = "$asset_ip<button class='btn btn-sm' data-clipboard-text=" . $asset_ip . "><i class='far fa-copy text-secondary'></i></button>";
|
||||
}
|
||||
$asset_mac = htmlentities($row['asset_mac']);
|
||||
$asset_status = htmlentities($row['asset_status']);
|
||||
$asset_purchase_date = $row['asset_purchase_date'];
|
||||
$asset_warranty_expire = $row['asset_warranty_expire'];
|
||||
$asset_install_date = $row['asset_install_date'];
|
||||
$asset_purchase_date = htmlentities($row['asset_purchase_date']);
|
||||
$asset_warranty_expire = htmlentities($row['asset_warranty_expire']);
|
||||
$asset_install_date = htmlentities($row['asset_install_date']);
|
||||
if (empty($asset_install_date)) {
|
||||
$asset_install_date_display = "-";
|
||||
}else{
|
||||
} else {
|
||||
$asset_install_date_display = $asset_install_date;
|
||||
}
|
||||
$asset_notes = htmlentities($row['asset_notes']);
|
||||
$asset_created_at = $row['asset_created_at'];
|
||||
$asset_vendor_id = $row['asset_vendor_id'];
|
||||
$asset_location_id = $row['asset_location_id'];
|
||||
$asset_contact_id = $row['asset_contact_id'];
|
||||
$asset_network_id = $row['asset_network_id'];
|
||||
$asset_created_at = htmlentities($row['asset_created_at']);
|
||||
$asset_vendor_id = intval($row['asset_vendor_id']);
|
||||
$asset_location_id = intval($row['asset_location_id']);
|
||||
$asset_contact_id = intval($row['asset_contact_id']);
|
||||
$asset_network_id = intval($row['asset_network_id']);
|
||||
|
||||
if ($asset_type == 'Laptop') {
|
||||
$device_icon = "laptop";
|
||||
}elseif ($asset_type == 'Desktop') {
|
||||
$device_icon = "desktop";
|
||||
}elseif ($asset_type == 'Server') {
|
||||
$device_icon = "server";
|
||||
}elseif ($asset_type == 'Printer') {
|
||||
$device_icon = "print";
|
||||
}elseif ($asset_type == 'Camera') {
|
||||
$device_icon = "video";
|
||||
}elseif ($asset_type == 'Switch' || $asset_type == 'Firewall/Router') {
|
||||
$device_icon = "network-wired";
|
||||
}elseif ($asset_type == 'Access Point') {
|
||||
$device_icon = "wifi";
|
||||
}elseif ($asset_type == 'Phone') {
|
||||
$device_icon = "phone";
|
||||
}elseif ($asset_type == 'Mobile Phone') {
|
||||
$device_icon = "mobile-alt";
|
||||
}elseif ($asset_type == 'Tablet') {
|
||||
$device_icon = "tablet-alt";
|
||||
}elseif ($asset_type == 'TV') {
|
||||
$device_icon = "tv";
|
||||
}elseif ($asset_type == 'Virtual Machine') {
|
||||
$device_icon = "cloud";
|
||||
}else{
|
||||
$device_icon = "tag";
|
||||
}
|
||||
$device_icon = getAssetIcon($asset_type);
|
||||
|
||||
$contact_name = $row['contact_name'];
|
||||
$contact_name = htmlentities($row['contact_name']);
|
||||
if (empty($contact_name)) {
|
||||
$contact_name = "-";
|
||||
}
|
||||
|
||||
$location_name = $row['location_name'];
|
||||
$location_name = htmlentities($row['location_name']);
|
||||
if (empty($location_name)) {
|
||||
$location_name = "-";
|
||||
}
|
||||
|
||||
$login_id = $row['login_id'];
|
||||
$login_id = intval($row['login_id']);
|
||||
$login_username = htmlentities(decryptLoginEntry($row['login_username']));
|
||||
$login_password = htmlentities(decryptLoginEntry($row['login_password']));
|
||||
|
||||
|
|
@ -289,7 +262,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-lock"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" value="<?php echo $login_password; ?>" readonly>
|
||||
<input type="password" class="form-control" data-toggle="password" value="<?php echo $login_password; ?>" readonly autocomplete="off">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-eye"></i></span>
|
||||
</div>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-default clipboardjs" type="button" data-clipboard-text="<?php echo $login_password; ?>"><i class="fa fa-fw fa-copy"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -297,9 +276,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php } ?>
|
||||
|
||||
</th>
|
||||
<?php if ($_GET['type'] !== 'virtual' && $_GET['type'] !== 'servers') { ?>
|
||||
|
|
@ -314,6 +291,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'other') { ?>
|
||||
<td><?php echo $asset_os_display; ?></td>
|
||||
<?php } ?>
|
||||
<td><?php echo $asset_ip_display; ?></td>
|
||||
<td><?php echo $asset_install_date_display; ?></td>
|
||||
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'other' && $_GET['type'] !== 'servers') { ?>
|
||||
<td><?php echo $contact_name; ?></td>
|
||||
|
|
@ -324,19 +302,34 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<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="#addAssetInterfaceModal<?php echo $asset_id; ?>">Interfaces</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editAssetModal<?php echo $asset_id; ?>">Edit</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#copyAssetModal<?php echo $asset_id; ?>">Copy</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addAssetInterfaceModal<?php echo $asset_id; ?>">
|
||||
<i class="fas fa-fw fa-ethernet mr-2"></i>Interfaces
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editAssetModal<?php echo $asset_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#copyAssetModal<?php echo $asset_id; ?>">
|
||||
<i class="fas fa-fw fa-copy mr-2"></i>Copy
|
||||
</a>
|
||||
<?php if ($document_count > 0) { ?>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#assetDocumentsModal<?php echo $asset_id; ?>">Documents (<?php echo $document_count; ?>)</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#assetDocumentsModal<?php echo $asset_id; ?>">
|
||||
<i class="fas fa-fw fa-document mr-2"></i>Documents (<?php echo $document_count; ?>)
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if ($ticket_count > 0) { ?>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#assetTicketsModal<?php echo $asset_id; ?>">Tickets (<?php echo $ticket_count; ?>)</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#assetTicketsModal<?php echo $asset_id; ?>">
|
||||
<i class="fas fa-fw fa-life-ring mr-2"></i>Tickets (<?php echo $ticket_count; ?>)
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="post.php?archive_asset=<?php echo $asset_id; ?>">Archive</a>
|
||||
<a class="dropdown-item text-danger" href="post.php?delete_asset=<?php echo $asset_id; ?>">Delete</a>
|
||||
<a class="dropdown-item text-danger" href="post.php?archive_asset=<?php echo $asset_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" href="post.php?delete_asset=<?php echo $asset_id; ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -345,10 +338,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
|
||||
<?php
|
||||
|
||||
include("client_asset_edit_modal.php");
|
||||
include("client_asset_copy_modal.php");
|
||||
include("client_asset_tickets_modal.php");
|
||||
include("client_asset_interface_add_modal.php");
|
||||
require("client_asset_edit_modal.php");
|
||||
require("client_asset_copy_modal.php");
|
||||
require("client_asset_tickets_modal.php");
|
||||
require("client_asset_interface_add_modal.php");
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -356,13 +349,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php include("pagination.php"); ?>
|
||||
<?php require_once("pagination.php"); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include("client_asset_add_modal.php");
|
||||
include("client_asset_import_modal.php");
|
||||
?>
|
||||
|
||||
<?php include("footer.php"); ?>
|
||||
require_once("client_asset_add_modal.php");
|
||||
require_once("client_asset_import_modal.php");
|
||||
require_once("footer.php");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-lock"></i> New Certificate</h5>
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-lock mr-2"></i>New Certificate</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
<?php
|
||||
$domains_sql = mysqli_query($mysqli, "SELECT * FROM domains WHERE domain_client_id = '$client_id'");
|
||||
while ($domain_row = mysqli_fetch_array($domains_sql)) {
|
||||
$domain_id = $domain_row['domain_id'];
|
||||
$domain_id = intval($domain_row['domain_id']);
|
||||
$domain_name = htmlentities($domain_row['domain_name']);
|
||||
echo "<option value=\"$domain_id\">$domain_name</option>";
|
||||
}
|
||||
|
|
@ -86,8 +86,8 @@
|
|||
</div>
|
||||
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_certificate" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Create</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,13 +2,14 @@
|
|||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-lock"></i> Editing certificate: <span class="text-bold" id="editHeader"></span></h5>
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-lock mr-2"></i>Editing certificate: <span class="text-bold" id="editHeader"></span></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="certificate_id" value="" id="editCertificateId">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
|
|
@ -76,8 +77,8 @@
|
|||
</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_certificate" class="btn btn-primary">Save</button>
|
||||
<button type="submit" name="edit_certificate" 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>
|
||||
|
|
|
|||
|
|
@ -1,111 +1,113 @@
|
|||
<?php include("inc_all_client.php"); ?>
|
||||
<?php
|
||||
|
||||
<?php
|
||||
// Default Column Sortby Filter
|
||||
$sb = "certificate_name";
|
||||
$o = "ASC";
|
||||
|
||||
if (!empty($_GET['sb'])) {
|
||||
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
|
||||
}else{
|
||||
$sb = "certificate_name";
|
||||
}
|
||||
require_once("inc_all_client.php");
|
||||
|
||||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
$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 certificates
|
||||
$sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM certificates
|
||||
WHERE certificate_client_id = $client_id AND (certificate_name LIKE '%$q%' OR certificate_domain LIKE '%$q%' OR certificate_issued_by LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
$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-lock"></i> Certificates</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addCertificateModal"><i class="fas fa-fw fa-plus"></i> New Certificate</button>
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-lock mr-2"></i>Certificates</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addCertificateModal"><i class="fas fa-plus mr-2"></i>New Certificate</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_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 strip_tags(htmlentities($q)); } ?>" placeholder="Search Certificates">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-8">
|
||||
<div class="float-right">
|
||||
<a href="post.php?export_client_certificates_csv=<?php echo $client_id; ?>" class="btn btn-default"><i class="fa fa-fw fa-download"></i> Export</a>
|
||||
</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-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=certificate_name&o=<?php echo $disp; ?>">Name</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=certificate_domain&o=<?php echo $disp; ?>">Domain</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=certificate_issued_by&o=<?php echo $disp; ?>">Issued By</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=certificate_expire&o=<?php echo $disp; ?>">Expire</a></th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$certificate_id = $row['certificate_id'];
|
||||
$certificate_name = htmlentities($row['certificate_name']);
|
||||
$certificate_domain = htmlentities($row['certificate_domain']);
|
||||
$certificate_issued_by = htmlentities($row['certificate_issued_by']);
|
||||
$certificate_expire = htmlentities($row['certificate_expire']);
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><a class="text-dark" href="#" data-toggle="modal" onclick="populateCertificateEditModal(<?php echo $client_id, ",", $certificate_id ?>)" data-target="#editCertificateModal"><?php echo $certificate_name; ?></a></td>
|
||||
<td><?php echo $certificate_domain; ?></td>
|
||||
<td><?php echo $certificate_issued_by; ?></td>
|
||||
<td><?php echo $certificate_expire; ?></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" onclick="populateCertificateEditModal(<?php echo $client_id, ",", $certificate_id ?>)" data-target="#editCertificateModal">Edit</a>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="post.php?delete_certificate=<?php echo $certificate_id; ?>">Delete</a>
|
||||
<?php } ?>
|
||||
<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(htmlentities($q)); } ?>" placeholder="Search Certificates">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div class="col-md-8">
|
||||
<div class="float-right">
|
||||
<a href="post.php?export_client_certificates_csv=<?php echo $client_id; ?>" class="btn btn-default"><i class="fa fa-download mr-2"></i>Export</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</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-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=certificate_name&o=<?php echo $disp; ?>">Name</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=certificate_domain&o=<?php echo $disp; ?>">Domain</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=certificate_issued_by&o=<?php echo $disp; ?>">Issued By</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=certificate_expire&o=<?php echo $disp; ?>">Expire</a></th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$certificate_id = intval($row['certificate_id']);
|
||||
$certificate_name = htmlentities($row['certificate_name']);
|
||||
$certificate_domain = htmlentities($row['certificate_domain']);
|
||||
$certificate_issued_by = htmlentities($row['certificate_issued_by']);
|
||||
$certificate_expire = htmlentities($row['certificate_expire']);
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><a class="text-dark" href="#" data-toggle="modal" onclick="populateCertificateEditModal(<?php echo $client_id, ",", $certificate_id ?>)" data-target="#editCertificateModal"><?php echo $certificate_name; ?></a></td>
|
||||
<td><?php echo $certificate_domain; ?></td>
|
||||
<td><?php echo $certificate_issued_by; ?></td>
|
||||
<td><?php echo $certificate_expire; ?></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" onclick="populateCertificateEditModal(<?php echo $client_id, ",", $certificate_id ?>)" data-target="#editCertificateModal">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger text-bold" href="post.php?delete_certificate=<?php echo $certificate_id; ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php require_once("pagination.php"); ?>
|
||||
</div>
|
||||
<?php include("pagination.php"); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include("client_certificate_edit_modal.php");
|
||||
include("client_certificate_add_modal.php");
|
||||
require_once("client_certificate_edit_modal.php");
|
||||
require_once("client_certificate_add_modal.php");
|
||||
?>
|
||||
|
||||
<script>
|
||||
|
|
@ -198,4 +200,4 @@ include("client_certificate_add_modal.php");
|
|||
}
|
||||
</script>
|
||||
|
||||
<?php include("footer.php"); ?>
|
||||
<?php include("footer.php"); ?>
|
||||
|
|
|
|||
|
|
@ -1,207 +1,211 @@
|
|||
<div class="modal" id="addContactModal" 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-plus"></i> New Contact</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; ?>">
|
||||
<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">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-photo">Photo</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-portal">Portal</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-notes">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-details">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong> / <span class="text-secondary">Primary Contact</span></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="name" placeholder="Full Name" required autofocus>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="primary_contact" value="1" <?php if ($primary_contact == 0) { echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Title</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-id-badge"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="title" placeholder="Title">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Department</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="department" placeholder="Department">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label>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">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="text" class="form-control" name="extension" placeholder="Extension">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Mobile</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-mobile-alt"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="mobile" placeholder="Mobile Phone Number">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>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="Email Address">
|
||||
</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 = 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_id = $row['location_id'];
|
||||
$location_name = htmlentities($row['location_name']);
|
||||
?>
|
||||
<option value="<?php echo $location_id; ?>"><?php echo $location_name; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="contactImportantCheckbox" name="contact_important" value="1" >
|
||||
<label class="custom-control-label" for="contactImportantCheckbox">Important</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="contactBillingCheckbox" name="contact_billing" value="1" >
|
||||
<label class="custom-control-label" for="contactBillingCheckbox">Billing</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="contactTechnicalCheckbox" name="contact_technical" value="1" >
|
||||
<label class="custom-control-label" for="contactTechnicalCheckbox">Technical</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<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-plus mr-2"></i>New Contact</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">
|
||||
<!-- Prevent undefined checkbox errors on submit -->
|
||||
<input type="hidden" name="primary_contact" value="0">
|
||||
<input type="hidden" name="contact_important" value="0">
|
||||
<input type="hidden" name="contact_billing" value="0">
|
||||
<input type="hidden" name="contact_technical" value="0">
|
||||
<!-- End prevent undefined errors -->
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="tab-pane fade" id="pills-photo">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Upload Photo</label>
|
||||
<input type="file" class="form-control-file" name="file">
|
||||
</div>
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-details"><i class="fa fa-fw fa-user mr-2"></i>Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-photo"><i class="fa fa-fw fa-image mr-2"></i>Photo</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-portal"><i class="fa fa-fw fa-lock mr-2"></i>Portal</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-notes"><i class="fa fa-fw fa-edit mr-2"></i>Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<div class="tab-pane fade" id="pills-portal">
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-details">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong> / <span class="text-secondary">Primary Contact</span></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="name" placeholder="Full Name" required autofocus>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="primary_contact" value="1" <?php if ($primary_contact == 0) { echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Title</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-id-badge"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="title" placeholder="Title">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Department</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="department" placeholder="Department">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label>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">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="text" class="form-control" name="extension" placeholder="Extension">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Mobile</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-mobile-alt"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="mobile" placeholder="Mobile Phone Number">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>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="Email Address">
|
||||
</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 = 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_id = intval($row['location_id']);
|
||||
$location_name = htmlentities($row['location_name']);
|
||||
?>
|
||||
<option value="<?php echo $location_id; ?>"><?php echo $location_name; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="contactImportantCheckbox" name="contact_important" value="1" >
|
||||
<label class="custom-control-label" for="contactImportantCheckbox">Important</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="contactBillingCheckbox" name="contact_billing" value="1" >
|
||||
<label class="custom-control-label" for="contactBillingCheckbox">Billing</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="contactTechnicalCheckbox" name="contact_technical" value="1" >
|
||||
<label class="custom-control-label" for="contactTechnicalCheckbox">Technical</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-photo">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Upload Photo</label>
|
||||
<input type="file" class="form-control-file" name="file">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-portal">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Login</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user-circle"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="auth_method">
|
||||
<option value="">- None -</option>
|
||||
<option value="local">Local</option>
|
||||
<option value="azure">Azure</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-notes">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" name="notes" placeholder="Enter some notes"></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Login</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user-circle"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="auth_method">
|
||||
<option value="">- None -</option>
|
||||
<option value="local">Local</option>
|
||||
<option value="azure">Azure</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-notes">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" name="notes" placeholder="Enter some notes"></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_contact" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Create</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 class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_contact" class="btn btn-primary text-bold"><i class="fas fa-check"></i> Create</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<?php include("inc_all_client.php");
|
||||
<?php
|
||||
|
||||
require_once("inc_all_client.php");
|
||||
|
||||
if (isset($_GET['contact_id'])) {
|
||||
$contact_id = intval($_GET['contact_id']);
|
||||
|
|
@ -9,7 +11,6 @@ if (isset($_GET['contact_id'])) {
|
|||
");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$contact_id = $row['contact_id'];
|
||||
$contact_name = htmlentities($row['contact_name']);
|
||||
$contact_title = htmlentities($row['contact_title']);
|
||||
$contact_department =htmlentities($row['contact_department']);
|
||||
|
|
@ -23,18 +24,13 @@ if (isset($_GET['contact_id'])) {
|
|||
$contact_important = intval($row['contact_important']);
|
||||
$contact_billing = intval($row['contact_billing']);
|
||||
$contact_technical = intval($row['contact_technical']);
|
||||
$contact_created_at = $row['contact_created_at'];
|
||||
$contact_created_at = htmlentities($row['contact_created_at']);
|
||||
if ($contact_id == $primary_contact) {
|
||||
$primary_contact_display = "<small class='text-success'>Primary Contact</small>";
|
||||
} else {
|
||||
$primary_contact_display = FALSE;
|
||||
$primary_contact_display = false;
|
||||
}
|
||||
if (empty($contact_name)) {
|
||||
$contact_ticket_display = "-";
|
||||
} else {
|
||||
$contact_ticket_display = "$contact_name<br><small class='text-secondary'>$contact_email</small>";
|
||||
}
|
||||
$contact_location_id = $row['contact_location_id'];
|
||||
$contact_location_id = intval($row['contact_location_id']);
|
||||
$location_name = htmlentities($row['location_name']);
|
||||
if (empty($location_name)) {
|
||||
$location_name_display = "-";
|
||||
|
|
@ -44,8 +40,7 @@ if (isset($_GET['contact_id'])) {
|
|||
$auth_method = htmlentities($row['contact_auth_method']);
|
||||
|
||||
// Related Assets Query
|
||||
$sql_related_assets = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_contact_id = $contact_id AND company_id = $session_company_id ORDER BY asset_name DESC");
|
||||
|
||||
$sql_related_assets = mysqli_query($mysqli, "SELECT * FROM assets LEFT JOIN logins ON logins.login_asset_id = assets.asset_id WHERE asset_contact_id = $contact_id AND assets.company_id = $session_company_id ORDER BY asset_name DESC");
|
||||
$asset_count = mysqli_num_rows($sql_related_assets);
|
||||
|
||||
// Related Logins Query
|
||||
|
|
@ -53,7 +48,16 @@ if (isset($_GET['contact_id'])) {
|
|||
$login_count = mysqli_num_rows($sql_related_logins);
|
||||
|
||||
// Related Software Query
|
||||
$sql_related_software = mysqli_query($mysqli, "SELECT * FROM software, software_contacts WHERE software.software_id = software_contacts.software_id AND software_contacts.contact_id = $contact_id AND software.company_id = $session_company_id ORDER BY software.software_id DESC");
|
||||
//$sql_related_software = mysqli_query($mysqli, "SELECT * FROM software, software_contacts WHERE software.software_id = software_contacts.software_id AND software_contacts.contact_id = $contact_id AND software.company_id = $session_company_id ORDER BY software.software_id DESC");
|
||||
$sql_related_software = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM software_contacts
|
||||
LEFT JOIN software ON software_contacts.software_id = software.software_id
|
||||
LEFT JOIN logins on software.software_id = logins.login_software_id
|
||||
WHERE software_contacts.contact_id = $contact_id AND software.company_id = $session_company_id
|
||||
ORDER BY software.software_id DESC"
|
||||
);
|
||||
|
||||
$software_count = mysqli_num_rows($sql_related_software);
|
||||
|
||||
// Related Tickets Query
|
||||
|
|
@ -86,23 +90,23 @@ if (isset($_GET['contact_id'])) {
|
|||
<hr>
|
||||
<?php if (!empty($location_name)) { ?>
|
||||
<div class="mb-1"><i class="fa fa-fw fa-map-marker-alt text-secondary mr-3"></i><?php echo $location_name_display; ?></div>
|
||||
<?php } ?>
|
||||
<?php if (!empty($contact_email)) { ?>
|
||||
<?php }
|
||||
if (!empty($contact_email)) { ?>
|
||||
<div><i class="fa fa-fw fa-envelope text-secondary mr-3"></i><a href='mailto:<?php echo $contact_email; ?>'><?php echo $contact_email; ?></a><button class='btn btn-sm clipboardjs' data-clipboard-text='<?php echo $contact_email; ?>'><i class='far fa-copy text-secondary'></i></button></div>
|
||||
<?php } ?>
|
||||
<?php if (!empty($contact_phone)) { ?>
|
||||
<?php }
|
||||
if (!empty($contact_phone)) { ?>
|
||||
<div class="mb-2"><i class="fa fa-fw fa-phone text-secondary mr-3"></i><?php echo "$contact_phone $contact_extension"; ?></div>
|
||||
<?php } ?>
|
||||
<?php if (!empty($contact_mobile)) { ?>
|
||||
<?php }
|
||||
if (!empty($contact_mobile)) { ?>
|
||||
<div class="mb-2"><i class="fa fa-fw fa-mobile-alt text-secondary mr-3"></i><?php echo $contact_mobile; ?></div>
|
||||
<?php } ?>
|
||||
<div class="mb-2"><i class="fa fa-fw fa-clock text-secondary mr-3"></i><?php echo date('Y-m-d',strtotime($contact_created_at)); ?></div>
|
||||
<div class="mb-2"><i class="fa fa-fw fa-clock text-secondary mr-3"></i><?php echo date('Y-m-d', strtotime($contact_created_at)); ?></div>
|
||||
<hr>
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#editContactModal<?php echo $contact_id; ?>">
|
||||
<i class="fas fa-fw fa-user-edit"></i> Edit
|
||||
</button>
|
||||
|
||||
<?php include("client_contact_edit_modal.php"); ?>
|
||||
<?php require_once("client_contact_edit_modal.php"); ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -121,7 +125,7 @@ if (isset($_GET['contact_id'])) {
|
|||
<div class="col-md-9">
|
||||
|
||||
|
||||
<ol class="breadcrumb d-print-none">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="invoices.php">Home</a>
|
||||
</li>
|
||||
|
|
@ -139,7 +143,7 @@ if (isset($_GET['contact_id'])) {
|
|||
|
||||
<div class="card card-dark <?php if ($asset_count == 0) { echo "d-none"; } ?>">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title"><i class="fa fa-fw fa-desktop"></i> Assets</h3>
|
||||
<h3 class="card-title"><i class="fa fa-fw fa-desktop mr-2"></i>Assets</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
|
|
@ -160,7 +164,7 @@ if (isset($_GET['contact_id'])) {
|
|||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_related_assets)) {
|
||||
$asset_id = $row['asset_id'];
|
||||
$asset_id = intval($row['asset_id']);
|
||||
$asset_type = htmlentities($row['asset_type']);
|
||||
$asset_name = htmlentities($row['asset_name']);
|
||||
$asset_make = htmlentities($row['asset_make']);
|
||||
|
|
@ -185,47 +189,26 @@ if (isset($_GET['contact_id'])) {
|
|||
}
|
||||
$asset_mac = htmlentities($row['asset_mac']);
|
||||
$asset_status = htmlentities($row['asset_status']);
|
||||
$asset_purchase_date = $row['asset_purchase_date'];
|
||||
$asset_warranty_expire = $row['asset_warranty_expire'];
|
||||
$asset_install_date = $row['asset_install_date'];
|
||||
$asset_purchase_date = htmlentities($row['asset_purchase_date']);
|
||||
$asset_warranty_expire = htmlentities($row['asset_warranty_expire']);
|
||||
$asset_install_date = htmlentities($row['asset_install_date']);
|
||||
if (empty($asset_install_date)) {
|
||||
$asset_install_date_display = "-";
|
||||
} else {
|
||||
$asset_install_date_display = $asset_install_date;
|
||||
}
|
||||
$asset_notes = htmlentities($row['asset_notes']);
|
||||
$asset_created_at = $row['asset_created_at'];
|
||||
$asset_vendor_id = $row['asset_vendor_id'];
|
||||
$asset_location_id = $row['asset_location_id'];
|
||||
$asset_network_id = $row['asset_network_id'];
|
||||
$asset_contact_id = $row['asset_contact_id'];
|
||||
if ($asset_type == 'Laptop') {
|
||||
$device_icon = "laptop";
|
||||
} elseif ($asset_type == 'Desktop') {
|
||||
$device_icon = "desktop";
|
||||
} elseif ($asset_type == 'Server') {
|
||||
$device_icon = "server";
|
||||
} elseif ($asset_type == 'Printer') {
|
||||
$device_icon = "print";
|
||||
} elseif ($asset_type == 'Camera') {
|
||||
$device_icon = "video";
|
||||
} elseif ($asset_type == 'Switch' || $asset_type == 'Firewall/Router') {
|
||||
$device_icon = "network-wired";
|
||||
} elseif ($asset_type == 'Access Point') {
|
||||
$device_icon = "wifi";
|
||||
} elseif ($asset_type == 'Phone') {
|
||||
$device_icon = "phone";
|
||||
} elseif ($asset_type == 'Mobile Phone') {
|
||||
$device_icon = "mobile-alt";
|
||||
} elseif ($asset_type == 'Tablet') {
|
||||
$device_icon = "tablet-alt";
|
||||
} elseif ($asset_type == 'TV') {
|
||||
$device_icon = "tv";
|
||||
} elseif ($asset_type == 'Virtual Machine') {
|
||||
$device_icon = "cloud";
|
||||
} else {
|
||||
$device_icon = "tag";
|
||||
}
|
||||
$asset_created_at = htmlentities($row['asset_created_at']);
|
||||
$asset_vendor_id = intval($row['asset_vendor_id']);
|
||||
$asset_location_id = intval($row['asset_location_id']);
|
||||
$asset_network_id = intval($row['asset_network_id']);
|
||||
$asset_contact_id = intval($row['asset_contact_id']);
|
||||
|
||||
$login_id = $row['login_id'];
|
||||
$login_username = htmlentities(decryptLoginEntry($row['login_username']));
|
||||
$login_password = htmlentities(decryptLoginEntry($row['login_password']));
|
||||
|
||||
$device_icon = getAssetIcon($asset_type);
|
||||
|
||||
?>
|
||||
<tr>
|
||||
|
|
@ -244,12 +227,20 @@ if (isset($_GET['contact_id'])) {
|
|||
<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="#addAssetInterfaceModal<?php echo $asset_id; ?>">Interfaces</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editAssetModal<?php echo $asset_id; ?>">Edit</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#copyAssetModal<?php echo $asset_id; ?>">Copy</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editAssetModal<?php echo $asset_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#copyAssetModal<?php echo $asset_id; ?>">
|
||||
<i class="fas fa-fw fa-copy mr-2"></i>Copy
|
||||
</a>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="post.php?archive_asset=<?php echo $asset_id; ?>">Archive</a>
|
||||
<a class="dropdown-item text-danger" href="post.php?delete_asset=<?php echo $asset_id; ?>">Delete</a>
|
||||
<a class="dropdown-item text-danger" href="post.php?archive_asset=<?php echo $asset_id; ?>">
|
||||
<i class="fas fa-fw fa-archive mr-2"></i>Archive
|
||||
</a>
|
||||
<a class="dropdown-item text-danger text-bold" href="post.php?delete_asset=<?php echo $asset_id; ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -258,10 +249,9 @@ if (isset($_GET['contact_id'])) {
|
|||
|
||||
<?php
|
||||
|
||||
include("client_asset_edit_modal.php");
|
||||
include("client_asset_copy_modal.php");
|
||||
//include("client_asset_tickets_modal.php");
|
||||
include("client_asset_interface_add_modal.php");
|
||||
require("client_asset_edit_modal.php");
|
||||
require("client_asset_copy_modal.php");
|
||||
require("client_asset_interface_add_modal.php");
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -276,7 +266,7 @@ if (isset($_GET['contact_id'])) {
|
|||
|
||||
<div class="card card-dark <?php if ($login_count == 0) { echo "d-none"; } ?>">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title"><i class="fa fa-fw fa-key"></i> Passwords</h3>
|
||||
<h3 class="card-title"><i class="fa fa-fw fa-key mr-2"></i>Passwords</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
|
|
@ -295,7 +285,7 @@ if (isset($_GET['contact_id'])) {
|
|||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_related_logins)) {
|
||||
$login_id = $row['login_id'];
|
||||
$login_id = intval($row['login_id']);
|
||||
$login_name = htmlentities($row['login_name']);
|
||||
$login_uri = htmlentities($row['login_uri']);
|
||||
if (empty($login_uri)) {
|
||||
|
|
@ -318,10 +308,11 @@ if (isset($_GET['contact_id'])) {
|
|||
$otp_display = "<span onmouseenter='showOTP($login_id_with_secret)'><i class='far fa-clock'></i> <span id='otp_$login_id'><i>Hover..</i></span></span>";
|
||||
}
|
||||
$login_note = htmlentities($row['login_note']);
|
||||
$login_contact_id = $row['login_contact_id'];
|
||||
$login_vendor_id = $row['login_vendor_id'];
|
||||
$login_asset_id = $row['login_asset_id'];
|
||||
$login_software_id = $row['login_software_id'];
|
||||
$login_important = intval($row['login_important']);
|
||||
$login_contact_id = intval($row['login_contact_id']);
|
||||
$login_vendor_id = intval($row['login_vendor_id']);
|
||||
$login_asset_id = intval($row['login_asset_id']);
|
||||
$login_software_id = intval($row['login_software_id']);
|
||||
|
||||
?>
|
||||
<tr>
|
||||
|
|
@ -343,11 +334,17 @@ if (isset($_GET['contact_id'])) {
|
|||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editLoginModal<?php echo $login_id; ?>">Edit</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#shareModal" onclick="populateShareModal(<?php echo "$client_id, 'Login', $login_id"; ?>)">Share</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editLoginModal<?php echo $login_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#shareModal" onclick="populateShareModal(<?php echo "$client_id, 'Login', $login_id"; ?>)">
|
||||
<i class="fas fa-fw fa-share-alt mr-2"></i>Share
|
||||
</a>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="post.php?delete_login=<?php echo $login_id; ?>">Delete</a>
|
||||
<a class="dropdown-item text-danger text-bold" href="post.php?delete_login=<?php echo $login_id; ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -356,7 +353,7 @@ if (isset($_GET['contact_id'])) {
|
|||
|
||||
<?php
|
||||
|
||||
include("client_login_edit_modal.php");
|
||||
require("client_login_edit_modal.php");
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -370,56 +367,61 @@ if (isset($_GET['contact_id'])) {
|
|||
|
||||
<div class="card card-dark <?php if ($software_count == 0) { echo "d-none"; } ?>">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title"><i class="fa fa-fw fa-cube"></i> Licenses</h3>
|
||||
<h3 class="card-title"><i class="fa fa-fw fa-cube mr-2"></i>Licenses</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-borderless table-hover">
|
||||
<thead class="text-dark">
|
||||
<tr>
|
||||
<tr>
|
||||
<th>Software</th>
|
||||
<th>Type</th>
|
||||
<th>License Type</th>
|
||||
<th>Seats</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_related_software)) {
|
||||
$software_id = $row['software_id'];
|
||||
$software_id = intval($row['software_id']);
|
||||
$software_name = htmlentities($row['software_name']);
|
||||
$software_version = htmlentities($row['software_version']);
|
||||
$software_type = htmlentities($row['software_type']);
|
||||
$software_license_type = htmlentities($row['software_license_type']);
|
||||
$software_key = htmlentities($row['software_key']);
|
||||
$software_seats = htmlentities($row['software_seats']);
|
||||
$software_purchase = $row['software_purchase'];
|
||||
$software_expire = $row['software_expire'];
|
||||
$software_purchase = htmlentities($row['software_purchase']);
|
||||
$software_expire = htmlentities($row['software_expire']);
|
||||
$software_notes = htmlentities($row['software_notes']);
|
||||
|
||||
$seat_count = 0;
|
||||
|
||||
// Get Login
|
||||
$login_id = intval($row['login_id']);
|
||||
$login_username = htmlentities(decryptLoginEntry($row['login_username']));
|
||||
$login_password = htmlentities(decryptLoginEntry($row['login_password']));
|
||||
|
||||
// Asset 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[] = $row['asset_id'];
|
||||
$seat_count = $seat_count + 1;
|
||||
$asset_licenses_array[] = intval($row['asset_id']);
|
||||
$seat_count = $seat_count + 1;
|
||||
}
|
||||
$asset_licenses = implode(',',$asset_licenses_array);
|
||||
$asset_licenses = implode(',', $asset_licenses_array);
|
||||
|
||||
// Contact 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[] = $row['contact_id'];
|
||||
$seat_count = $seat_count + 1;
|
||||
$contact_licenses_array[] = intval($row['contact_id']);
|
||||
$seat_count = $seat_count + 1;
|
||||
}
|
||||
$contact_licenses = implode(',',$contact_licenses_array);
|
||||
$contact_licenses = implode(',', $contact_licenses_array);
|
||||
|
||||
?>
|
||||
?>
|
||||
<tr>
|
||||
<td><a class="text-dark" href="#" data-toggle="modal" data-target="#editSoftwareModal<?php echo $software_id; ?>"><?php echo "$software_name<br><span class='text-secondary'>$software_version</span>"; ?></a></td>
|
||||
<td><?php echo $software_type; ?></td>
|
||||
|
|
@ -431,22 +433,26 @@ if (isset($_GET['contact_id'])) {
|
|||
<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; ?>">Edit</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editSoftwareModal<?php echo $software_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="post.php?delete_software=<?php echo $software_id; ?>">Delete</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger text-bold" href="post.php?delete_software=<?php echo $software_id; ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
<?php
|
||||
|
||||
include("client_software_edit_modal.php");
|
||||
}
|
||||
require("client_software_edit_modal.php");
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
@ -456,36 +462,34 @@ if (isset($_GET['contact_id'])) {
|
|||
|
||||
<div class="card card-dark <?php if ($ticket_count == 0) { echo "d-none"; } ?>">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title"><i class="fa fa-fw fa-life-ring"></i> Tickets</h3>
|
||||
<h3 class="card-title"><i class="fa fa-fw fa-life-ring mr-2"></i>Tickets</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-borderless table-hover">
|
||||
<thead class="text-dark">
|
||||
<tr>
|
||||
<th>Number</th>
|
||||
<th>Subject</th>
|
||||
<th>Priority</th>
|
||||
<th>Status</th>
|
||||
<th>Assigned</th>
|
||||
<th>Last Response</th>
|
||||
<th>Created</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Number</th>
|
||||
<th>Subject</th>
|
||||
<th>Priority</th>
|
||||
<th>Status</th>
|
||||
<th>Assigned</th>
|
||||
<th>Last Response</th>
|
||||
<th>Created</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_related_tickets)) {
|
||||
$ticket_id = $row['ticket_id'];
|
||||
$ticket_id = intval($row['ticket_id']);
|
||||
$ticket_prefix = htmlentities($row['ticket_prefix']);
|
||||
$ticket_number = htmlentities($row['ticket_number']);
|
||||
$ticket_number = intval($row['ticket_number']);
|
||||
$ticket_subject = htmlentities($row['ticket_subject']);
|
||||
$ticket_details = $row['ticket_details'];
|
||||
$ticket_priority = htmlentities($row['ticket_priority']);
|
||||
$ticket_status = htmlentities($row['ticket_status']);
|
||||
$ticket_created_at = $row['ticket_created_at'];
|
||||
$ticket_updated_at = $row['ticket_updated_at'];
|
||||
$ticket_created_at = htmlentities($row['ticket_created_at']);
|
||||
$ticket_updated_at = htmlentities($row['ticket_updated_at']);
|
||||
if (empty($ticket_updated_at)) {
|
||||
if ($ticket_status == "Closed") {
|
||||
$ticket_updated_at_display = "<p>Never</p>";
|
||||
|
|
@ -495,7 +499,7 @@ if (isset($_GET['contact_id'])) {
|
|||
} else {
|
||||
$ticket_updated_at_display = $ticket_updated_at;
|
||||
}
|
||||
$ticket_closed_at = $row['ticket_closed_at'];
|
||||
$ticket_closed_at = htmlentities($row['ticket_closed_at']);
|
||||
|
||||
if ($ticket_status == "Open") {
|
||||
$ticket_status_display = "<span class='p-2 badge badge-primary'>$ticket_status</span>";
|
||||
|
|
@ -514,7 +518,7 @@ if (isset($_GET['contact_id'])) {
|
|||
} else {
|
||||
$ticket_priority_display = "-";
|
||||
}
|
||||
$ticket_assigned_to = $row['ticket_assigned_to'];
|
||||
$ticket_assigned_to = intval($row['ticket_assigned_to']);
|
||||
if (empty($ticket_assigned_to)) {
|
||||
if ($ticket_status == "Closed") {
|
||||
$ticket_assigned_to_display = "<p>Not Assigned</p>";
|
||||
|
|
@ -525,38 +529,20 @@ if (isset($_GET['contact_id'])) {
|
|||
$ticket_assigned_to_display = htmlentities($row['user_name']);
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td><a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>"><span class="badge badge-pill badge-secondary p-3"><?php echo "$ticket_prefix$ticket_number"; ?></span></a></td>
|
||||
<td><a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>"><?php echo $ticket_subject; ?></a></td>
|
||||
<td><?php echo $contact_ticket_display; ?></td>
|
||||
<td><?php echo $ticket_priority_display; ?></td>
|
||||
<td><?php echo $ticket_status_display; ?></td>
|
||||
<td><?php echo $ticket_assigned_to_display; ?></td>
|
||||
<td><?php echo $ticket_updated_at_display; ?></td>
|
||||
<td><?php echo $ticket_created_at; ?></td>
|
||||
<td>
|
||||
<?php if ($ticket_status !== "Closed") { ?>
|
||||
<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="#editTicketModal<?php echo $ticket_id; ?>">Edit</a>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="post.php?delete_ticket=<?php echo $ticket_id; ?>">Delete</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
<?php
|
||||
|
||||
include("ticket_edit_modal.php");
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -573,28 +559,27 @@ if (isset($_GET['contact_id'])) {
|
|||
|
||||
<?php
|
||||
|
||||
include("share_modal.php");
|
||||
require_once("share_modal.php");
|
||||
|
||||
?>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<script>
|
||||
function updateContactNotes(contact_id) {
|
||||
var notes = document.getElementById("contactNotes").value;
|
||||
function updateContactNotes(contact_id) {
|
||||
var notes = document.getElementById("contactNotes").value;
|
||||
|
||||
// Send a POST request to ajax.php as ajax.php with data client_set_notes=true, client_id=NUM, notes=NOTES
|
||||
jQuery.post(
|
||||
"ajax.php",
|
||||
{
|
||||
contact_set_notes: 'TRUE',
|
||||
contact_id: contact_id,
|
||||
notes: notes
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
}
|
||||
// Send a POST request to ajax.php as ajax.php with data contact_set_notes=true, contact_id=NUM, notes=NOTES
|
||||
jQuery.post(
|
||||
"ajax.php",
|
||||
{
|
||||
contact_set_notes: 'TRUE',
|
||||
contact_id: contact_id,
|
||||
notes: notes
|
||||
}
|
||||
)
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php include("footer.php"); ?>
|
||||
<?php
|
||||
require_once("footer.php");
|
||||
|
|
|
|||
|
|
@ -1,129 +0,0 @@
|
|||
<div class="modal" id="contactDetailsModal<?php echo $contact_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title text-white"><i class="fa fa-fw fa-user mr-2"></i><?php echo $contact_name; ?></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<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="#pillsRelatedAssets<?php echo $contact_id; ?>">Assets</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pillsRelatedLogins<?php echo $contact_id; ?>">Logins</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pillsRelatedSoftware<?php echo $contact_id; ?>">Software</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pillsRelatedTickets<?php echo $contact_id; ?>">Tickets</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade show active" id="pillsRelatedAssets<?php echo $contact_id; ?>">
|
||||
|
||||
<ul>
|
||||
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_related_assets)) {
|
||||
$asset_id = $row['asset_id'];
|
||||
$asset_type = htmlentities($row['asset_type']);
|
||||
$asset_name = htmlentities($row['asset_name']);
|
||||
$asset_make = htmlentities($row['asset_make']);
|
||||
$asset_model = htmlentities($row['asset_model']);
|
||||
$asset_serial = htmlentities($row['asset_serial']);
|
||||
|
||||
?>
|
||||
|
||||
<li><?php echo $asset_name; ?></li>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pillsRelatedLogins<?php echo $contact_id; ?>">
|
||||
<ul>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_related_logins)) {
|
||||
$login_id = $row['login_id'];
|
||||
$login_name = htmlentities($row['login_name']);
|
||||
$login_uri = htmlentities($row['login_uri']);
|
||||
$login_username = htmlentities($row['login_username']);
|
||||
$login_password = htmlentities($row['login_password']);
|
||||
$login_note = htmlentities($row['login_note']);
|
||||
$vendor_id = $row['vendor_id'];
|
||||
$asset_id = $row['asset_id'];
|
||||
$software_id = $row['software_id'];
|
||||
|
||||
?>
|
||||
|
||||
<li><?php echo "$login_name - $login_username"; ?></li>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pillsRelatedSoftware<?php echo $contact_id; ?>">
|
||||
<ul>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_related_software)) {
|
||||
$software_id = $row['software_id'];
|
||||
$software_name = htmlentities($row['software_name']);
|
||||
$software_type = htmlentities($row['software_type']);
|
||||
$software_notes = htmlentities($row['software_notes']);
|
||||
|
||||
?>
|
||||
|
||||
<li><?php echo "$software_name - $software_type"; ?></li>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pillsRelatedTickets<?php echo $contact_id; ?>">
|
||||
<ul>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_related_tickets)) {
|
||||
$ticket_id = $row['ticket_id'];
|
||||
$ticket_prefix = htmlentities($row['ticket_prefix']);
|
||||
$ticket_number = $row['ticket_number'];
|
||||
$ticket_subject = htmlentities($row['ticket_subject']);
|
||||
|
||||
?>
|
||||
|
||||
<li><a href="ticket.php?ticket_id=<?=$ticket_id ?>"><?php echo "[$ticket_prefix$ticket_number] - $ticket_subject"; ?></a></li>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,241 +1,245 @@
|
|||
<div class="modal" id="editContactModal<?php echo $contact_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-edit"></i> Editing: <strong><?php echo $contact_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="contact_id" value="<?php echo $contact_id; ?>">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<input type="hidden" name="existing_file_name" value="<?php echo $contact_photo; ?>">
|
||||
<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 $contact_id; ?>">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-photo<?php echo $contact_id; ?>">Photo</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-portal<?php echo $contact_id; ?>">Portal</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-notes<?php echo $contact_id; ?>">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-details<?php echo $contact_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong> / <span class="text-secondary">Primary Contact</span></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="name" placeholder="Full Name" value="<?php echo $contact_name; ?>" required>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="primary_contact" value="1" <?php if ($contact_id == $primary_contact) { echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Title</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-id-badge"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="title" placeholder="Title" value="<?php echo $contact_title; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Department</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="department" placeholder="Department" value="<?php echo $contact_department; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label>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" value="<?php echo $contact_phone; ?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="text" class="form-control" name="extension" placeholder="Extension" value="<?php echo $contact_extension; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Mobile</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-mobile-alt"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="mobile" placeholder="Mobile Phone Number" value="<?php echo $contact_mobile; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>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="Email Address" value="<?php echo $contact_email; ?>">
|
||||
</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_locations = mysqli_query($mysqli,"SELECT * FROM locations WHERE (location_archived_at > '$contact_created_at' OR location_archived_at IS NULL) AND location_client_id = $client_id ORDER BY location_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_locations)) {
|
||||
$location_id_select = $row['location_id'];
|
||||
$location_name_select = htmlentities($row['location_name']);
|
||||
?>
|
||||
<option <?php if ($contact_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="form-row">
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="contactImportantCheckbox<?php echo $contact_id; ?>" name="contact_important" value="1" <?php if ($contact_important == 1) { echo "checked"; } ?> >
|
||||
<label class="custom-control-label" for="contactImportantCheckbox<?php echo $contact_id; ?>">Important</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="contactBillingCheckbox<?php echo $contact_id; ?>" name="contact_billing" value="1" <?php if ($contact_billing == 1) { echo "checked"; } ?> >
|
||||
<label class="custom-control-label" for="contactBillingCheckbox<?php echo $contact_id; ?>">Billing</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="contactTechnicalCheckbox<?php echo $contact_id; ?>" name="contact_technical" value="1" <?php if ($contact_technical == 1) { echo "checked"; } ?> >
|
||||
<label class="custom-control-label" for="contactTechnicalCheckbox<?php echo $contact_id; ?>">Technical</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<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-edit mr-2"></i>Editing: <strong><?php echo $contact_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">
|
||||
<!-- Prevent undefined checkbox errors on submit -->
|
||||
<input type="hidden" name="primary_contact" value="0">
|
||||
<input type="hidden" name="contact_important" value="0">
|
||||
<input type="hidden" name="contact_billing" value="0">
|
||||
<input type="hidden" name="contact_technical" value="0">
|
||||
<!-- End prevent undefined errors -->
|
||||
<input type="hidden" name="contact_id" value="<?php echo $contact_id; ?>">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<input type="hidden" name="existing_file_name" value="<?php echo $contact_photo; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="tab-pane fade" id="pills-portal<?php echo $contact_id; ?>">
|
||||
<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 $contact_id; ?>"><i class="fa fa-fw fa-user mr-2"></i>Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-photo<?php echo $contact_id; ?>"><i class="fa fa-fw fa-image mr-2"></i>Photo</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-portal<?php echo $contact_id; ?>"><i class="fa fa-fw fa-lock mr-2"></i>Portal</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-notes<?php echo $contact_id; ?>"><i class="fa fa-fw fa-edit mr-2"></i>Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Login</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user-circle"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="auth_method">
|
||||
<option value="">- None -</option>
|
||||
<option value="local" <?php if ($auth_method == "local") {echo "selected";} ?>>Local</option>
|
||||
<option value="azure" <?php if ($auth_method == "azure") {echo "selected";} ?>>Azure</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<?php if ($auth_method == "local") { ?>
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-details<?php echo $contact_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong> / <span class="text-secondary">Primary Contact</span></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="name" placeholder="Full Name" value="<?php echo $contact_name; ?>" required>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="primary_contact" value="1" <?php if ($contact_id == $primary_contact) { echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Title</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-id-badge"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="title" placeholder="Title" value="<?php echo $contact_title; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Department</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="department" placeholder="Department" value="<?php echo $contact_department; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label>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" value="<?php echo $contact_phone; ?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="text" class="form-control" name="extension" placeholder="Extension" value="<?php echo $contact_extension; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Mobile</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-mobile-alt"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="mobile" placeholder="Mobile Phone Number" value="<?php echo $contact_mobile; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>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="Email Address" value="<?php echo $contact_email; ?>">
|
||||
</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_locations = mysqli_query($mysqli, "SELECT * FROM locations WHERE (location_archived_at > '$contact_created_at' OR location_archived_at IS NULL) AND location_client_id = $client_id ORDER BY location_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_locations)) {
|
||||
$location_id_select = intval($row['location_id']);
|
||||
$location_name_select = htmlentities($row['location_name']);
|
||||
?>
|
||||
<option <?php if ($contact_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="form-row">
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="contactImportantCheckbox<?php echo $contact_id; ?>" name="contact_important" value="1" <?php if ($contact_important == 1) { echo "checked"; } ?> >
|
||||
<label class="custom-control-label" for="contactImportantCheckbox<?php echo $contact_id; ?>">Important</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="contactBillingCheckbox<?php echo $contact_id; ?>" name="contact_billing" value="1" <?php if ($contact_billing == 1) { echo "checked"; } ?> >
|
||||
<label class="custom-control-label" for="contactBillingCheckbox<?php echo $contact_id; ?>">Billing</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="contactTechnicalCheckbox<?php echo $contact_id; ?>" name="contact_technical" value="1" <?php if ($contact_technical == 1) { echo "checked"; } ?> >
|
||||
<label class="custom-control-label" for="contactTechnicalCheckbox<?php echo $contact_id; ?>">Technical</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-portal<?php echo $contact_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Login</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user-circle"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="auth_method">
|
||||
<option value="">- None -</option>
|
||||
<option value="local" <?php if ($auth_method == "local") {echo "selected";} ?>>Local</option>
|
||||
<option value="azure" <?php if ($auth_method == "azure") {echo "selected";} ?>>Azure</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($auth_method == "local") { ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Password</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="password" class="form-control" data-toggle="password" name="contact_password" placeholder="Leave blank for no change" autocomplete="new-password">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-eye"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" name="send_email" value=""/>
|
||||
<label class="form-check-label">Send user e-mail with login details?</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-photo<?php echo $contact_id; ?>">
|
||||
|
||||
<div class="mb-3 text-center">
|
||||
<?php if (!empty($contact_photo)) { ?>
|
||||
<img class="img-fluid" alt="contact_photo" src="<?php echo "uploads/clients/$session_company_id/$client_id/$contact_photo"; ?>">
|
||||
<?php } else { ?>
|
||||
<span class="fa-stack fa-4x">
|
||||
<i class="fa fa-circle fa-stack-2x text-secondary"></i>
|
||||
<span class="fa fa-stack-1x text-white"><?php echo $contact_initials; ?></span>
|
||||
</span>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="file" class="form-control-file" name="file">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-notes<?php echo $contact_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" name="notes" placeholder="Enter some notes"><?php echo $contact_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Password</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="password" class="form-control" data-toggle="password" name="contact_password" placeholder="Leave blank for no change" autocomplete="new-password">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-eye"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" name="send_email" value=""/>
|
||||
<label class="form-check-label">Send user e-mail with login details?</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-photo<?php echo $contact_id; ?>">
|
||||
|
||||
<div class="mb-3 text-center">
|
||||
<?php if (!empty($contact_photo)) { ?>
|
||||
<img class="img-fluid" alt="contact_photo" src="<?php echo "uploads/clients/$session_company_id/$client_id/$contact_photo"; ?>">
|
||||
<?php }else{ ?>
|
||||
<span class="fa-stack fa-4x">
|
||||
<i class="fa fa-circle fa-stack-2x text-secondary"></i>
|
||||
<span class="fa fa-stack-1x text-white"><?php echo $contact_initials; ?></span>
|
||||
</span>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="file" class="form-control-file" name="file">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-notes<?php echo $contact_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" name="notes" placeholder="Enter some notes"><?php echo $contact_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_contact" 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 class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="edit_contact" class="btn btn-primary"><i class="fas fa-check"></i> Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,27 +1,28 @@
|
|||
<div class="modal" id="importContactModal" 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-users"></i> Import Contacts</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; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
<p><strong>Format csv file with headings & data:</strong><br>Name, Title, Department, Email, Phone, Extension, Mobile, Location</p>
|
||||
<hr>
|
||||
<div class="form-group my-4">
|
||||
<input type="file" class="form-control-file" name="file" accept=".csv">
|
||||
</div>
|
||||
<hr>
|
||||
<div>Download <a href="post.php?download_client_contacts_csv_template=<?php echo $client_id; ?>">sample csv template</a></div>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="import_client_contacts_csv" class="btn btn-primary">Import</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-users mr-2"></i>Import Contacts</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; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
<p><strong>Format csv file with headings & data:</strong><br>Name, Title, Department, Email, Phone, Extension, Mobile, Location</p>
|
||||
<hr>
|
||||
<div class="form-group my-4">
|
||||
<input type="file" class="form-control-file" name="file" accept=".csv">
|
||||
</div>
|
||||
<hr>
|
||||
<div>Download: <a class="text-bold" href="post.php?download_client_contacts_csv_template=<?php echo $client_id; ?>">sample csv template</a></div>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="import_client_contacts_csv" class="btn btn-primary text-strong"><i class="fas fa-upload mr-2"></i>Import</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,84 +1,84 @@
|
|||
<div class="modal" id="contactInviteModal" 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-user-plus"></i> Invite Contact</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; ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>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="Email Address">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fas fa-fw fa-user-plus mr-2"></i>Invite Contact</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Welcome Letter</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-envelope-open-text"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="welcome_letter">
|
||||
<option value="1">- Select One -</option>
|
||||
<option value="2">Standard</option>
|
||||
<option value="3">Big Wig</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" name="notes" placeholder="Enter some notes"><?php echo $contact_notes; ?></textarea>
|
||||
</div>
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>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="Email Address">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Welcome Letter</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-envelope-open-text"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="welcome_letter">
|
||||
<option value="1">- Select One -</option>
|
||||
<option value="2">Standard</option>
|
||||
<option value="3">Big Wig</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" name="notes" placeholder="Enter some notes"><?php echo $contact_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="contactInviteImportantCheckbox" name="contact_important" value="1" >
|
||||
<label class="custom-control-label" for="contactInviteImportantCheckbox">Important</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="contactInviteBillingCheckbox" name="contact_billing" value="1" >
|
||||
<label class="custom-control-label" for="contactInviteBillingCheckbox">Billing</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="contactInviteTechnicalCheckbox" name="contact_technical" value="1" >
|
||||
<label class="custom-control-label" for="contactInviteTechnicalCheckbox">Technical</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="contactInviteImportantCheckbox" name="contact_important" value="1" >
|
||||
<label class="custom-control-label" for="contactInviteImportantCheckbox">Important</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="contactInviteBillingCheckbox" name="contact_billing" value="1" >
|
||||
<label class="custom-control-label" for="contactInviteBillingCheckbox">Billing</label>
|
||||
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="invite_contact" class="btn btn-primary text-bold"><i class="fas fa-paper-plane mr-2"></i>Send Invite</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="contactInviteTechnicalCheckbox" name="contact_technical" value="1" >
|
||||
<label class="custom-control-label" for="contactInviteTechnicalCheckbox">Technical</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="invite_contact" class="btn btn-primary"><strong><i class="fas fa-paper-plane"></i> Send Invite</strong></button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,233 +1,226 @@
|
|||
<?php include("inc_all_client.php"); ?>
|
||||
<?php
|
||||
|
||||
<?php
|
||||
// Default Column Sortby Filter
|
||||
$sb = "contact_name";
|
||||
$o = "ASC";
|
||||
|
||||
if (isset($_GET['q'])) {
|
||||
$q = strip_tags(mysqli_real_escape_string($mysqli,$_GET['q']));
|
||||
//Phone Numbers
|
||||
$n = preg_replace("/[^0-9]/", '',$q);
|
||||
if (empty($n)) {
|
||||
$n = $q;
|
||||
}
|
||||
}else{
|
||||
$q = "";
|
||||
//Phone Numbers
|
||||
$n = "";
|
||||
}
|
||||
|
||||
if (!empty($_GET['sb'])) {
|
||||
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
|
||||
}else{
|
||||
$sb = "contact_name";
|
||||
}
|
||||
require_once("inc_all_client.php");
|
||||
|
||||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
$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 contacts
|
||||
LEFT JOIN locations ON location_id = contact_location_id
|
||||
WHERE contact_archived_at IS NULL
|
||||
AND (contact_name LIKE '%$q%' OR contact_title LIKE '%$q%' OR location_name LIKE '%$q%' OR contact_email LIKE '%$q%' OR contact_department LIKE '%$q%' OR contact_phone LIKE '%$n%' OR contact_extension LIKE '%$q%' OR contact_mobile LIKE '%$n%')
|
||||
AND contact_client_id = $client_id ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
$sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM contacts
|
||||
LEFT JOIN locations ON location_id = contact_location_id
|
||||
WHERE contact_archived_at IS NULL
|
||||
AND (contact_name LIKE '%$q%' OR contact_title LIKE '%$q%' OR location_name LIKE '%$q%' OR contact_email LIKE '%$q%' OR contact_department LIKE '%$q%' OR contact_phone LIKE '%$phone_query%' OR contact_extension LIKE '%$q%' OR contact_mobile LIKE '%$phone_query%')
|
||||
AND contact_client_id = $client_id
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to"
|
||||
);
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
$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-users"></i> Contacts</h3>
|
||||
<div class="card-tools">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addContactModal">
|
||||
<i class="fas fa-fw fa-plus"></i> New Contact
|
||||
</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="#contactInviteModal"><i class="fas fa-paper-plane mr-2"></i>Invite Contact</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_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 strip_tags(htmlentities($q)); } ?>" placeholder="Search Contacts">
|
||||
<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="float-right">
|
||||
<a href="post.php?export_client_contacts_csv=<?php echo $client_id; ?>" class="btn btn-default"><i class="fa fa-fw fa-download"></i> Export</a>
|
||||
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#importContactModal"><i class="fa fa-fw fa-upload"></i> Import</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
<div class="table-responsive">
|
||||
<table class="table border">
|
||||
<thead class="thead-light <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<th class="text-center"><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=contact_name&o=<?php echo $disp; ?>">Name</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=contact_department&o=<?php echo $disp; ?>">Department</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=contact_email&o=<?php echo $disp; ?>">Email</a></th>
|
||||
<th>Phone</th>
|
||||
<th>Mobile</th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=location_name&o=<?php echo $disp; ?>">Location</a></th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$contact_id = $row['contact_id'];
|
||||
$contact_name = htmlentities($row['contact_name']);
|
||||
$contact_title = htmlentities($row['contact_title']);
|
||||
if (empty($contact_title)) {
|
||||
$contact_title_display = "-";
|
||||
}else{
|
||||
$contact_title_display = "<small class='text-secondary'>$contact_title</small>";
|
||||
}
|
||||
$contact_department =htmlentities($row['contact_department']);
|
||||
if (empty($contact_department)) {
|
||||
$contact_department_display = "-";
|
||||
}else{
|
||||
$contact_department_display = $contact_department;
|
||||
}
|
||||
$contact_phone = formatPhoneNumber($row['contact_phone']);
|
||||
if (empty($contact_phone)) {
|
||||
$contact_phone_display = "-";
|
||||
}else{
|
||||
$contact_phone_display = "$contact_phone";
|
||||
}
|
||||
$contact_extension = htmlentities($row['contact_extension']);
|
||||
$contact_mobile = formatPhoneNumber($row['contact_mobile']);
|
||||
if (empty($contact_mobile)) {
|
||||
$contact_mobile_display = "-";
|
||||
}else{
|
||||
$contact_mobile_display = "$contact_mobile";
|
||||
}
|
||||
$contact_email = htmlentities($row['contact_email']);
|
||||
if (empty($contact_email)) {
|
||||
$contact_email_display = "-";
|
||||
}else{
|
||||
$contact_email_display = "<a href='mailto:$contact_email'>$contact_email</a><button class='btn btn-sm clipboardjs' data-clipboard-text='$contact_email'><i class='far fa-copy text-secondary'></i></button>";
|
||||
}
|
||||
$contact_photo = htmlentities($row['contact_photo']);
|
||||
$contact_initials = initials($contact_name);
|
||||
$contact_notes = htmlentities($row['contact_notes']);
|
||||
$contact_important = intval($row['contact_important']);
|
||||
$contact_billing = intval($row['contact_billing']);
|
||||
$contact_technical = intval($row['contact_technical']);
|
||||
$contact_created_at = $row['contact_created_at'];
|
||||
if ($contact_id == $primary_contact) {
|
||||
$primary_contact_display = "<small class='text-success'>Primary Contact</small>";
|
||||
}else{
|
||||
$primary_contact_display = FALSE;
|
||||
}
|
||||
$contact_location_id = $row['contact_location_id'];
|
||||
$location_name = htmlentities($row['location_name']);
|
||||
if (empty($location_name)) {
|
||||
$location_name_display = "-";
|
||||
}else{
|
||||
$location_name_display = $location_name;
|
||||
}
|
||||
$auth_method = htmlentities($row['contact_auth_method']);
|
||||
|
||||
// Related Assets Query
|
||||
$sql_related_assets = mysqli_query($mysqli,"SELECT * FROM assets WHERE asset_contact_id = $contact_id AND company_id = $session_company_id ORDER BY asset_id DESC");
|
||||
$asset_count = mysqli_num_rows($sql_related_assets);
|
||||
|
||||
// Related Logins Query
|
||||
$sql_related_logins = mysqli_query($mysqli,"SELECT * FROM logins WHERE login_contact_id = $contact_id AND company_id = $session_company_id ORDER BY login_id DESC");
|
||||
$login_count = mysqli_num_rows($sql_related_logins);
|
||||
|
||||
// Related Software Query
|
||||
$sql_related_software = mysqli_query($mysqli,"SELECT * FROM software, software_contacts WHERE software.software_id = software_contacts.software_id AND software_contacts.contact_id = $contact_id AND software.company_id = $session_company_id ORDER BY software.software_id DESC");
|
||||
$software_count = mysqli_num_rows($sql_related_software);
|
||||
|
||||
// Related Tickets Query
|
||||
$sql_related_tickets = mysqli_query($mysqli,"SELECT * FROM tickets WHERE ticket_contact_id = $contact_id AND company_id = $session_company_id ORDER BY ticket_id DESC");
|
||||
$ticket_count = mysqli_num_rows($sql_related_tickets);
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<th class="text-center">
|
||||
<a class="text-dark" href="client_contact_details.php?client_id=<?php echo $client_id; ?>&contact_id=<?php echo $contact_id; ?>">
|
||||
<?php if (!empty($contact_photo)) { ?>
|
||||
|
||||
<img class="img-size-50 img-circle" src="<?php echo "uploads/clients/$session_company_id/$client_id/$contact_photo"; ?>">
|
||||
|
||||
<?php }else{ ?>
|
||||
|
||||
<span class="fa-stack fa-2x">
|
||||
<i class="fa fa-circle fa-stack-2x text-secondary"></i>
|
||||
<span class="fa fa-stack-1x text-white"><?php echo $contact_initials; ?></span>
|
||||
</span>
|
||||
<br>
|
||||
|
||||
<?php } ?>
|
||||
<div class="text-dark"><?php echo $contact_name; ?></div>
|
||||
<div><?php echo $contact_title_display; ?></div>
|
||||
<div><?php echo $primary_contact_display; ?></div>
|
||||
</a>
|
||||
</th>
|
||||
|
||||
<td><?php echo $contact_department_display; ?></td>
|
||||
<td><?php echo $contact_email_display; ?></td>
|
||||
<td><?php echo $contact_phone_display; ?> <?php if (!empty($contact_extension)) { echo "x$contact_extension"; } ?></td>
|
||||
<td><?php echo $contact_mobile_display; ?></td>
|
||||
<td><?php echo $location_name_display; ?></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="client_contact_details.php?client_id=<?php echo $client_id; ?>&contact_id=<?php echo $contact_id; ?>">View Details</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editContactModal<?php echo $contact_id; ?>">Edit</a>
|
||||
<?php if ($session_user_role == 3 && $contact_id !== $primary_contact) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="post.php?archive_contact=<?php echo $contact_id; ?>">Archive</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger text-bold" href="post.php?delete_contact=<?php echo $contact_id; ?>">Delete</a>
|
||||
<?php } ?>
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-users mr-2"></i>Contacts</h3>
|
||||
<div class="card-tools">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addContactModal">
|
||||
<i class="fas fa-plus mr-2"></i>New Contact
|
||||
</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="#contactInviteModal"><i class="fas fa-paper-plane mr-2"></i>Invite Contact</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="row">
|
||||
|
||||
<?php
|
||||
|
||||
include("client_contact_edit_modal.php");
|
||||
<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(htmlentities($q)); } ?>" placeholder="Search Contacts">
|
||||
<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="float-right">
|
||||
<a href="post.php?export_client_contacts_csv=<?php echo $client_id; ?>" class="btn btn-default"><i class="fa fa-fw fa-download mr-2"></i>Export</a>
|
||||
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#importContactModal"><i class="fa fa-fw fa-upload mr-2"></i>Import</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
<div class="table-responsive">
|
||||
<table class="table border">
|
||||
<thead class="thead-light <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<th class="text-center"><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=contact_name&o=<?php echo $disp; ?>">Name</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=contact_department&o=<?php echo $disp; ?>">Department</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=contact_email&o=<?php echo $disp; ?>">Email</a></th>
|
||||
<th>Phone</th>
|
||||
<th>Mobile</th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=location_name&o=<?php echo $disp; ?>">Location</a></th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$contact_id = intval($row['contact_id']);
|
||||
$contact_name = htmlentities($row['contact_name']);
|
||||
$contact_title = htmlentities($row['contact_title']);
|
||||
if (empty($contact_title)) {
|
||||
$contact_title_display = "-";
|
||||
} else {
|
||||
$contact_title_display = "<small class='text-secondary'>$contact_title</small>";
|
||||
}
|
||||
$contact_department = htmlentities($row['contact_department']);
|
||||
if (empty($contact_department)) {
|
||||
$contact_department_display = "-";
|
||||
} else {
|
||||
$contact_department_display = $contact_department;
|
||||
}
|
||||
$contact_phone = formatPhoneNumber($row['contact_phone']);
|
||||
if (empty($contact_phone)) {
|
||||
$contact_phone_display = "-";
|
||||
} else {
|
||||
$contact_phone_display = "$contact_phone";
|
||||
}
|
||||
$contact_extension = htmlentities($row['contact_extension']);
|
||||
$contact_mobile = formatPhoneNumber($row['contact_mobile']);
|
||||
if (empty($contact_mobile)) {
|
||||
$contact_mobile_display = "-";
|
||||
} else {
|
||||
$contact_mobile_display = "$contact_mobile";
|
||||
}
|
||||
$contact_email = htmlentities($row['contact_email']);
|
||||
if (empty($contact_email)) {
|
||||
$contact_email_display = "-";
|
||||
} else {
|
||||
$contact_email_display = "<a href='mailto:$contact_email'>$contact_email</a><button class='btn btn-sm clipboardjs' data-clipboard-text='$contact_email'><i class='far fa-copy text-secondary'></i></button>";
|
||||
}
|
||||
$contact_photo = htmlentities($row['contact_photo']);
|
||||
$contact_initials = initials($contact_name);
|
||||
$contact_notes = htmlentities($row['contact_notes']);
|
||||
$contact_important = intval($row['contact_important']);
|
||||
$contact_billing = intval($row['contact_billing']);
|
||||
$contact_technical = intval($row['contact_technical']);
|
||||
$contact_created_at = htmlentities($row['contact_created_at']);
|
||||
if ($contact_id == $primary_contact) {
|
||||
$primary_contact_display = "<small class='text-success'>Primary Contact</small>";
|
||||
} else {
|
||||
$primary_contact_display = false;
|
||||
}
|
||||
$contact_location_id = intval($row['contact_location_id']);
|
||||
$location_name = htmlentities($row['location_name']);
|
||||
if (empty($location_name)) {
|
||||
$location_name_display = "-";
|
||||
} else {
|
||||
$location_name_display = $location_name;
|
||||
}
|
||||
$auth_method = htmlentities($row['contact_auth_method']);
|
||||
|
||||
// Related Assets Query
|
||||
$sql_related_assets = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_contact_id = $contact_id AND company_id = $session_company_id ORDER BY asset_id DESC");
|
||||
$asset_count = mysqli_num_rows($sql_related_assets);
|
||||
|
||||
// Related Logins Query
|
||||
$sql_related_logins = mysqli_query($mysqli, "SELECT * FROM logins WHERE login_contact_id = $contact_id AND company_id = $session_company_id ORDER BY login_id DESC");
|
||||
$login_count = mysqli_num_rows($sql_related_logins);
|
||||
|
||||
// Related Software Query
|
||||
$sql_related_software = mysqli_query($mysqli, "SELECT * FROM software, software_contacts WHERE software.software_id = software_contacts.software_id AND software_contacts.contact_id = $contact_id AND software.company_id = $session_company_id ORDER BY software.software_id DESC");
|
||||
$software_count = mysqli_num_rows($sql_related_software);
|
||||
|
||||
// Related Tickets Query
|
||||
$sql_related_tickets = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_contact_id = $contact_id AND company_id = $session_company_id ORDER BY ticket_id DESC");
|
||||
$ticket_count = mysqli_num_rows($sql_related_tickets);
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<th class="text-center">
|
||||
<a class="text-dark" href="client_contact_details.php?client_id=<?php echo $client_id; ?>&contact_id=<?php echo $contact_id; ?>">
|
||||
<?php if (!empty($contact_photo)) { ?>
|
||||
|
||||
<img class="img-size-50 img-circle" src="<?php echo "uploads/clients/$session_company_id/$client_id/$contact_photo"; ?>">
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<span class="fa-stack fa-2x">
|
||||
<i class="fa fa-circle fa-stack-2x text-secondary"></i>
|
||||
<span class="fa fa-stack-1x text-white"><?php echo $contact_initials; ?></span>
|
||||
</span>
|
||||
|
||||
<br>
|
||||
|
||||
<?php } ?>
|
||||
<div class="text-dark"><?php echo $contact_name; ?></div>
|
||||
<div><?php echo $contact_title_display; ?></div>
|
||||
<div><?php echo $primary_contact_display; ?></div>
|
||||
</a>
|
||||
</th>
|
||||
|
||||
<td><?php echo $contact_department_display; ?></td>
|
||||
<td><?php echo $contact_email_display; ?></td>
|
||||
<td><?php echo $contact_phone_display; ?> <?php if (!empty($contact_extension)) { echo "x$contact_extension"; } ?></td>
|
||||
<td><?php echo $contact_mobile_display; ?></td>
|
||||
<td><?php echo $location_name_display; ?></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="client_contact_details.php?client_id=<?php echo $client_id; ?>&contact_id=<?php echo $contact_id; ?>">
|
||||
<i class="fas fa-fw fa-eye mr-2"></i>Details
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editContactModal<?php echo $contact_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<?php if ($session_user_role == 3 && $contact_id !== $primary_contact) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="post.php?archive_contact=<?php echo $contact_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" href="post.php?delete_contact=<?php echo $contact_id; ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
require("client_contact_edit_modal.php");
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php require_once("pagination.php"); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php include("pagination.php"); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
<?php
|
||||
|
||||
include("client_contact_add_modal.php");
|
||||
include("client_contact_invite_modal.php");
|
||||
include("client_contact_import_modal.php");
|
||||
|
||||
?>
|
||||
|
||||
<?php include("footer.php"); ?>
|
||||
require_once("client_contact_add_modal.php");
|
||||
require_once("client_contact_invite_modal.php");
|
||||
require_once("client_contact_import_modal.php");
|
||||
require_once("footer.php");
|
||||
|
|
|
|||
|
|
@ -1,30 +1,20 @@
|
|||
<script>
|
||||
function validateClientNameDelete(client_id) {
|
||||
if (document.getElementById("clientNameProvided" + client_id).value === document.getElementById("clientName" + client_id).value) {
|
||||
document.getElementById("clientDeleteButton" + client_id).className = "btn btn-danger btn-lg px-5";
|
||||
}
|
||||
else{
|
||||
document.getElementById("clientDeleteButton" + client_id).className = "btn btn-danger btn-lg px-5 disabled";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="modal" id="deleteClientModal<?php echo $client_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body">
|
||||
<div class="mb-4" style="text-align: center;">
|
||||
<i class="far fa-10x fa-times-circle text-danger mb-3 mt-3"></i>
|
||||
<h2>Are you sure?</h2>
|
||||
<h6 class="mb-4 text-secondary">Do you really want to <b>delete <?php echo $client_name; ?></b> and all associated data including financial data, logs, shared links etc.? This process cannot be undone.</h6>
|
||||
<div class="form-group">
|
||||
<input type="hidden" id="clientName<?php echo $client_id ?>" value="<?php echo $client_name; ?>">
|
||||
<input class="form-control" type="text" id="clientNameProvided<?php echo $client_id ?>" onkeyup="validateClientNameDelete(<?php echo $client_id ?>)" placeholder="Please enter: '<?php echo $client_name; ?>'">
|
||||
</div>
|
||||
<button type="button" class="btn btn-outline-secondary btn-lg px-5 mr-4" data-dismiss="modal">Cancel</button>
|
||||
<a class="btn btn-danger btn-lg px-5 disabled" id="clientDeleteButton<?php echo $client_id ?>" href="post.php?delete_client=<?php echo $client_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">Yes, Delete!</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body">
|
||||
<div class="mb-4" style="text-align: center;">
|
||||
<i class="far fa-10x fa-times-circle text-danger mb-3 mt-3"></i>
|
||||
<h2>Are you sure?</h2>
|
||||
<h6 class="mb-4 text-secondary">Do you really want to <b>delete <?php echo $client_name; ?></b> and all associated data including financial data, logs, shared links etc.? This process cannot be undone.</h6>
|
||||
<div class="form-group">
|
||||
<input type="hidden" id="clientName<?php echo $client_id ?>" value="<?php echo $client_name; ?>">
|
||||
<input class="form-control" type="text" id="clientNameProvided<?php echo $client_id ?>" onkeyup="validateClientNameDelete(<?php echo $client_id ?>)" placeholder="Please enter: '<?php echo $client_name; ?>'">
|
||||
</div>
|
||||
<button type="button" class="btn btn-outline-secondary btn-lg px-5 mr-4" data-dismiss="modal">Cancel</button>
|
||||
<a class="btn btn-danger btn-lg px-5 disabled" id="clientDeleteButton<?php echo $client_id ?>" href="post.php?delete_client=<?php echo $client_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">Yes, Delete!</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="js/client_delete_confirm.js"></script>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<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"></i> New Document from Template</h5>
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-file-alt mr-2"></i>New Document from Template</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
<select class="form-control" name="document_template_id" required>
|
||||
<option value="">- Select Template -</option>
|
||||
<?php
|
||||
$sql_document_templates = mysqli_query($mysqli,"SELECT * FROM documents WHERE document_template = 1 AND company_id = $session_company_id AND document_archived_at IS NULL ORDER BY document_name ASC");
|
||||
$sql_document_templates = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_template = 1 AND company_id = $session_company_id AND document_archived_at IS NULL ORDER BY document_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_document_templates)) {
|
||||
$document_template_id = $row['document_id'];
|
||||
$document_template_id = intval($row['document_id']);
|
||||
$document_template_name = htmlentities($row['document_name']);
|
||||
|
||||
?>
|
||||
|
|
@ -54,9 +54,9 @@
|
|||
<select class="form-control" name="folder">
|
||||
<option value="0">/</option>
|
||||
<?php
|
||||
$sql_folders = mysqli_query($mysqli,"SELECT * FROM folders WHERE folder_client_id = $client_id ORDER BY folder_name ASC");
|
||||
$sql_folders = mysqli_query($mysqli, "SELECT * FROM folders WHERE folder_client_id = $client_id ORDER BY folder_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_folders)) {
|
||||
$folder_id = $row['folder_id'];
|
||||
$folder_id = intval($row['folder_id']);
|
||||
$folder_name = htmlentities($row['folder_name']);
|
||||
|
||||
?>
|
||||
|
|
@ -73,8 +73,8 @@
|
|||
|
||||
<div class="modal-footer bg-white">
|
||||
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_document_from_template" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Create & edit</button>
|
||||
<button type="submit" name="add_document_from_template" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create & edit</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<div class="modal-dialog modal-xl">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-file-alt"></i> New Document</h5>
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-file-alt mr-2"></i>New Document</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
|
|
@ -27,9 +27,9 @@
|
|||
<select class="form-control" name="folder">
|
||||
<option value="0">/</option>
|
||||
<?php
|
||||
$sql_folders = mysqli_query($mysqli,"SELECT * FROM folders WHERE folder_client_id = $client_id ORDER BY folder_name ASC");
|
||||
$sql_folders = mysqli_query($mysqli, "SELECT * FROM folders WHERE folder_client_id = $client_id ORDER BY folder_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_folders)) {
|
||||
$folder_id = $row['folder_id'];
|
||||
$folder_id = intval($row['folder_id']);
|
||||
$folder_name = htmlentities($row['folder_name']);
|
||||
|
||||
?>
|
||||
|
|
@ -43,8 +43,8 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_document" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Create</button>
|
||||
<button type="submit" name="add_document" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php include("inc_all_client.php"); ?>
|
||||
<?php require_once("inc_all_client.php"); ?>
|
||||
|
||||
<?php
|
||||
|
||||
|
|
@ -7,16 +7,16 @@ if (isset($_GET['document_id'])) {
|
|||
}
|
||||
|
||||
|
||||
$sql_document = mysqli_query($mysqli,"SELECT * FROM documents LEFT JOIN folders ON document_folder_id = folder_id WHERE document_client_id = $client_id AND document_id = $document_id AND documents.company_id = $session_company_id");
|
||||
$sql_document = mysqli_query($mysqli, "SELECT * FROM documents LEFT JOIN folders ON document_folder_id = folder_id WHERE document_client_id = $client_id AND document_id = $document_id AND documents.company_id = $session_company_id");
|
||||
|
||||
$row = mysqli_fetch_array($sql_document);
|
||||
|
||||
$folder_name = htmlentities($row['folder_name']);
|
||||
$document_name = htmlentities($row['document_name']);
|
||||
$document_content = $row['document_content'];
|
||||
$document_created_at = $row['document_created_at'];
|
||||
$document_updated_at = $row['document_updated_at'];
|
||||
$document_folder_id = $row['document_folder_id'];
|
||||
$document_created_at = htmlentities($row['document_created_at']);
|
||||
$document_updated_at = htmlentities($row['document_updated_at']);
|
||||
$document_folder_id = intval($row['document_folder_id']);
|
||||
|
||||
?>
|
||||
|
||||
|
|
@ -35,10 +35,10 @@ $document_folder_id = $row['document_folder_id'];
|
|||
</li>
|
||||
<?php if ($document_folder_id > 0) { ?>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="client_documents.php?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $document_folder_id; ?>"><i class="fas fa-folder-open"></i> <?php echo $folder_name; ?></a>
|
||||
<a href="client_documents.php?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $document_folder_id; ?>"><i class="fas fa-fw fa-folder-open mr-2"></i><?php echo $folder_name; ?></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<li class="breadcrumb-item active"><i class="fas fa-file"></i> <?php echo "$document_name"; ?></li>
|
||||
<li class="breadcrumb-item active"><i class="fas fa-file"></i> <?php echo $document_name; ?></li>
|
||||
</ol>
|
||||
|
||||
<div class="row">
|
||||
|
|
@ -55,16 +55,23 @@ $document_folder_id = $row['document_folder_id'];
|
|||
<div class="col-md-3">
|
||||
<div class="card bg-light">
|
||||
<div class="card-body">
|
||||
<button type="button" class="btn btn-success" data-toggle="modal" data-target="#editDocumentModal<?php echo $document_id; ?>"><i class="fas fa-edit"></i> Edit</button>
|
||||
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#editDocumentModal"><i class="fas fa-copy"></i> Copy</button>
|
||||
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#shareModal" onclick="populateShareModal(<?php echo "$client_id, 'Document', $document_id"; ?>)"><i class="fas fa-share"></i> Share</button>
|
||||
<button type="button" class="btn btn-success" data-toggle="modal" data-target="#editDocumentModal<?php echo $document_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</button>
|
||||
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#editDocumentModal">
|
||||
<i class="fas fa-fw fa-copy mr-2"></i>Copy
|
||||
</button>
|
||||
<button type="button" class="btn btn-secondary" 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
|
||||
</button>
|
||||
<hr>
|
||||
<h6><i class="fas fa-paperclip"></i> Files</h6>
|
||||
<h6><i class="fas fa-key"></i> Passwords</h6>
|
||||
<h6><i class="fas fa-users"></i> Contacts</h6>
|
||||
<h6><i class="fas fa-laptop"></i> Assets</h6>
|
||||
<h6><i class="fas fa-cube"></i> Software</h6>
|
||||
<h6><i class="fas fa-building"></i> Vendors</h6>
|
||||
<h6><i class="fas fa-fw fa-paperclip mr-2"></i>Files</h6>
|
||||
<h6><i class="fas fa-fw fa-key mr-2"></i>Passwords</h6>
|
||||
<h6><i class="fas fa-fw fa-users mr-2"></i>Contacts</h6>
|
||||
<h6><i class="fas fa-fw fa-laptop mr-2"></i>Assets</h6>
|
||||
<h6><i class="fas fa-fw fa-cube mr-2"></i>Software</h6>
|
||||
<h6><i class="fas fa-fw fa-building mr-2"></i>Vendors</h6>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -80,4 +87,4 @@ include("share_modal.php");
|
|||
|
||||
?>
|
||||
|
||||
<?php include("footer.php"); ?>
|
||||
<?php include("footer.php"); ?>
|
||||
|
|
|
|||
|
|
@ -1,51 +1,52 @@
|
|||
<div class="modal" id="editDocumentModal<?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"><i class="fa fa-fw fa-file-alt"></i> Editing 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">
|
||||
<input type="text" class="form-control" name="name" value="<?php echo $document_name; ?>" placeholder="Name" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control summernote" name="content"><?php echo $document_content; ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<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" name="folder">
|
||||
<option value="0">/</option>
|
||||
<?php
|
||||
$sql_folders_select = mysqli_query($mysqli,"SELECT * FROM folders WHERE folder_client_id = $client_id ORDER BY folder_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_folders_select)) {
|
||||
$folder_id_select = $row['folder_id'];
|
||||
$folder_name_select = htmlentities($row['folder_name']);
|
||||
?>
|
||||
<option <?php if ($folder_id_select == $document_folder_id) echo "selected"; ?> value="<?php echo $folder_id_select ?>"><?php echo $folder_name_select; ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<div class="modal-dialog modal-xl">
|
||||
<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>Editing document: <strong><?php echo $document_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
</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">
|
||||
<input type="text" class="form-control" name="name" value="<?php echo $document_name; ?>" placeholder="Name" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control summernote" name="content"><?php echo $document_content; ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<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" name="folder">
|
||||
<option value="0">/</option>
|
||||
<?php
|
||||
$sql_folders_select = mysqli_query($mysqli, "SELECT * FROM folders WHERE folder_client_id = $client_id ORDER BY folder_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_folders_select)) {
|
||||
$folder_id_select = intval($row['folder_id']);
|
||||
$folder_name_select = htmlentities($row['folder_name']);
|
||||
?>
|
||||
<option <?php if ($folder_id_select == $document_folder_id) echo "selected"; ?> value="<?php echo $folder_id_select ?>"><?php echo $folder_name_select; ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_document" 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 class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="edit_document" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,32 +1,32 @@
|
|||
<div class="modal" id="addFolderModal" 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-plus"></i> New Folder</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="client_id" value="<?php echo $client_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" required>
|
||||
<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-plus mr-2"></i>New Folder</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_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" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_folder" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create</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 class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_folder" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Create</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,32 +1,33 @@
|
|||
<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"></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" value="<?php echo $folder_name; ?>" required>
|
||||
<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>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="folder_id" value="<?php echo $folder_id; ?>">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_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" 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 class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="rename_folder" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Rename</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,32 +1,32 @@
|
|||
<div class="modal" id="addDocumentTemplateModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-xl">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-file-alt"></i> New Document Template</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="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
<div class="modal-dialog modal-xl">
|
||||
<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>New Document Template</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="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="name" placeholder="Template name" required autofocus>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="name" placeholder="Template name" required autofocus>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control summernote" name="content"></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<textarea class="form-control summernote" name="content"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer bg-white">
|
||||
|
||||
<button type="submit" name="add_document_template" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create</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 class="modal-footer bg-white">
|
||||
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_document_template" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Create</button>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php include("inc_all_client.php"); ?>
|
||||
<?php require_once("inc_all_client.php"); ?>
|
||||
|
||||
<?php
|
||||
|
||||
|
|
@ -8,14 +8,14 @@ if (isset($_GET['document_id'])) {
|
|||
}
|
||||
|
||||
|
||||
$sql_document = mysqli_query($mysqli,"SELECT * FROM documents WHERE document_template = 1 AND document_id = $document_id AND documents.company_id = $session_company_id");
|
||||
$sql_document = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_template = 1 AND document_id = $document_id AND documents.company_id = $session_company_id");
|
||||
|
||||
$row = mysqli_fetch_array($sql_document);
|
||||
|
||||
$document_name = htmlentities($row['document_name']);
|
||||
$document_content = $row['document_content'];
|
||||
$document_created_at = $row['document_created_at'];
|
||||
$document_updated_at = $row['document_updated_at'];
|
||||
$document_created_at = htmlentities($row['document_created_at']);
|
||||
$document_updated_at = htmlentities($row['document_updated_at']);
|
||||
|
||||
?>
|
||||
|
||||
|
|
@ -35,18 +35,22 @@ $document_updated_at = $row['document_updated_at'];
|
|||
<li class="breadcrumb-item">
|
||||
<a href="client_document_templates.php?client_id=<?php echo $client_id; ?>">Templates</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active"><i class="fas fa-file"></i> <?php echo "$document_name"; ?></li>
|
||||
<li class="breadcrumb-item active"><i class="fas fa-file"></i> <?php echo $document_name; ?></li>
|
||||
</ol>
|
||||
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header">
|
||||
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-file"></i> <?php echo $document_name; ?></h3>
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-file mr-2"></i><?php echo $document_name; ?></h3>
|
||||
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#editDocumentTemplateModal<?php echo $document_id; ?>"><i class="fas fa-edit"></i> Edit</button>
|
||||
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#editDocumentModal"><i class="fas fa-copy"></i> Copy</button>
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#editDocumentTemplateModal<?php echo $document_id; ?>">
|
||||
<i class="fas fa-edit mr-2"></i>Edit
|
||||
</button>
|
||||
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#editDocumentModal">
|
||||
<i class="fas fa-copy mr-2"></i>Copy
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
|
@ -60,4 +64,4 @@ include("client_document_template_edit_modal.php");
|
|||
|
||||
?>
|
||||
|
||||
<?php include("footer.php"); ?>
|
||||
<?php include("footer.php"); ?>
|
||||
|
|
|
|||
|
|
@ -1,30 +1,30 @@
|
|||
<div class="modal" id="editDocumentTemplateModal<?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"><i class="fa fa-fw fa-file-alt"></i> Editing template: <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">
|
||||
<input type="text" class="form-control" name="name" value="<?php echo $document_name; ?>" placeholder="Name" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control summernote" name="content"><?php echo $document_content; ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="modal-dialog modal-xl">
|
||||
<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>Editing template: <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">
|
||||
<input type="text" class="form-control" name="name" value="<?php echo $document_name; ?>" placeholder="Name" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control summernote" name="content"><?php echo $document_content; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_document_template" 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 class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="edit_document_template" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<?php include("inc_all_client.php"); ?>
|
||||
<?php require_once("inc_all_client.php"); ?>
|
||||
|
||||
<?php
|
||||
|
||||
// Sort by
|
||||
if (!empty($_GET['sb'])) {
|
||||
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
|
||||
}else{
|
||||
$sb = sanitizeInput($_GET['sb']);
|
||||
} else {
|
||||
$sb = "document_name";
|
||||
}
|
||||
|
||||
|
|
@ -17,38 +17,40 @@ if (!empty($q)) {
|
|||
}
|
||||
|
||||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
$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 documents
|
||||
WHERE document_template = 1
|
||||
AND documents.company_id = $session_company_id
|
||||
$query_snippet
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to"
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM documents
|
||||
WHERE document_template = 1
|
||||
AND documents.company_id = $session_company_id
|
||||
$query_snippet
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to"
|
||||
);
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
$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-file"></i> Document Templates</h3>
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-file mr-2"></i>Document Templates</h3>
|
||||
<button type="button" class="btn btn-dark dropdown-toggle ml-1" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item text-dark" href="client_documents.php?client_id=<?php echo $client_id; ?>">Documents</a>
|
||||
</div>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addDocumentTemplateModal">
|
||||
<i class="fas fa-fw fa-plus"></i> New Template
|
||||
<i class="fas fa-plus mr-2"></i>New Template
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
<form autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo intval($client_id); ?>">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="input-group">
|
||||
<input type="search" class="form-control " name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search templates">
|
||||
<input type="search" class="form-control " name="q" value="<?php if (isset($q)) { echo stripslashes(htmlentities($q)); } ?>" placeholder="Search templates">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-secondary"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
|
|
@ -76,14 +78,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$document_id = $row['document_id'];
|
||||
$document_id = intval($row['document_id']);
|
||||
$document_name = htmlentities($row['document_name']);
|
||||
$document_content = $row['document_content'];
|
||||
$document_created_at = $row['document_created_at'];
|
||||
$document_updated_at = $row['document_updated_at'];
|
||||
$document_folder_id = $row['document_folder_id'];
|
||||
$document_content = htmlentities($row['document_content']);
|
||||
$document_created_at = htmlentities($row['document_created_at']);
|
||||
$document_updated_at = htmlentities($row['document_updated_at']);
|
||||
$document_folder_id = intval($row['document_folder_id']);
|
||||
|
||||
?>
|
||||
|
||||
|
|
@ -99,10 +101,14 @@ $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="#editDocumentTemplateModal<?php echo $document_id; ?>">Edit</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editDocumentTemplateModal<?php echo $document_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="post.php?delete_document=<?php echo $document_id; ?>">Delete</a>
|
||||
<a class="dropdown-item text-danger text-bold" href="post.php?delete_document=<?php echo $document_id; ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -110,7 +116,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
include("client_document_template_edit_modal.php");
|
||||
}
|
||||
|
||||
|
|
@ -127,4 +133,4 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
|
||||
<?php include("client_document_template_add_modal.php"); ?>
|
||||
|
||||
<?php include("footer.php"); ?>
|
||||
<?php include("footer.php"); ?>
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
<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 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>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,227 +1,236 @@
|
|||
<?php include("inc_all_client.php"); ?>
|
||||
|
||||
<?php
|
||||
|
||||
// Default Column Sortby Filter
|
||||
$sb = "document_name";
|
||||
$o = "ASC";
|
||||
|
||||
require_once("inc_all_client.php");
|
||||
|
||||
// Folder
|
||||
if (!empty($_GET['folder_id'])) {
|
||||
$folder = intval($_GET['folder_id']);
|
||||
}else{
|
||||
$folder = 0;
|
||||
}
|
||||
|
||||
// Sort by
|
||||
if (!empty($_GET['sb'])) {
|
||||
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
|
||||
}else{
|
||||
$sb = "document_name";
|
||||
$folder = intval($_GET['folder_id']);
|
||||
} else {
|
||||
$folder = 0;
|
||||
}
|
||||
|
||||
// Search query SQL snippet
|
||||
if (!empty($q)) {
|
||||
$query_snippet = "AND (MATCH(document_content_raw) AGAINST ('$q') OR document_name LIKE '%$q%')";
|
||||
}else{
|
||||
$query_snippet = ""; // empty
|
||||
$query_snippet = "AND (MATCH(document_content_raw) AGAINST ('$q') OR document_name LIKE '%$q%')";
|
||||
} else {
|
||||
$query_snippet = ""; // empty
|
||||
}
|
||||
|
||||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET, array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
// Folder ID
|
||||
$get_folder_id = 0;
|
||||
if (!empty($_GET['folder_id'])) {
|
||||
$get_folder_id = intval($_GET['folder_id']);
|
||||
$get_folder_id = intval($_GET['folder_id']);
|
||||
}
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM documents
|
||||
WHERE document_client_id = $client_id
|
||||
AND documents.company_id = $session_company_id
|
||||
AND document_template = 0
|
||||
AND document_folder_id = $folder
|
||||
$query_snippet
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to"
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM documents
|
||||
WHERE document_client_id = $client_id
|
||||
AND documents.company_id = $session_company_id
|
||||
AND document_template = 0
|
||||
AND document_folder_id = $folder
|
||||
$query_snippet
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to"
|
||||
);
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
$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-file-alt"></i> Documents
|
||||
</h3>
|
||||
<button type="button" class="btn btn-dark dropdown-toggle ml-1" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item text-dark" href="client_document_templates.php?client_id=<?php echo $client_id; ?>">Templates</a>
|
||||
</div>
|
||||
|
||||
<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-fw fa-plus"></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="#addFolderModal"><i class="fa fa-fw fa-folder-plus"></i> 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>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-3 border-right">
|
||||
<h4>Folders</h4>
|
||||
<hr>
|
||||
<ul class="nav nav-pills flex-column bg-light">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?php if ($get_folder_id == 0) { echo "active"; } ?>" href="?client_id=<?php echo $client_id; ?>&folder_id=0">/</a>
|
||||
</li>
|
||||
<?php
|
||||
$sql_folders = mysqli_query($mysqli,"SELECT * FROM folders WHERE folder_client_id = $client_id ORDER BY folder_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_folders)) {
|
||||
$folder_id = $row['folder_id'];
|
||||
$folder_name = htmlentities($row['folder_name']);
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('document_id') AS num FROM documents WHERE document_folder_id = $folder_id"));
|
||||
$num_documents = $row['num'];
|
||||
|
||||
?>
|
||||
|
||||
<li class="nav-item">
|
||||
<div class="row">
|
||||
<div class="col-10">
|
||||
<a class="nav-link <?php if ($get_folder_id == $folder_id) { echo "active"; } ?> " href="?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $folder_id; ?>">
|
||||
<?php
|
||||
if ($get_folder_id == $folder_id) { ?>
|
||||
<i class="fas fa-fw fa-folder-open"></i>
|
||||
<?php
|
||||
}else{
|
||||
?>
|
||||
<i class="fas fa-fw fa-folder"></i>
|
||||
<?php } ?>
|
||||
|
||||
<?php echo $folder_name; ?> <?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 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; ?>">Rename</a>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="post.php?delete_folder=<?php echo $folder_id; ?>">Delete</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2">
|
||||
<i class="fa fa-fw fa-file-alt mr-2"></i>Documents
|
||||
</h3>
|
||||
<button type="button" class="btn btn-dark dropdown-toggle ml-1" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item text-dark" href="client_document_templates.php?client_id=<?php echo $client_id; ?>">Templates</a>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php
|
||||
include("client_document_folder_rename_modal.php");
|
||||
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php include("client_document_folder_add_modal.php"); ?>
|
||||
</div>
|
||||
<div class="card-tools">
|
||||
|
||||
<div class="col-md-9">
|
||||
<form autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo intval($client_id); ?>">
|
||||
<input type="hidden" name="folder_id" value="<?php echo $get_folder_id; ?>">
|
||||
<div class="input-group">
|
||||
<input type="search" class="form-control " name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Documents">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-secondary"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-sm table-borderless table-hover">
|
||||
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<th>
|
||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=document_name&o=<?php echo $disp; ?>">Name</a>
|
||||
</th>
|
||||
<th>
|
||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=document_created_at&o=<?php echo $disp; ?>">Created</a>
|
||||
</th>
|
||||
<th>
|
||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=document_updated_at&o=<?php echo $disp; ?>">Updated</a>
|
||||
</th>
|
||||
<th class="text-center">
|
||||
Action
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$document_id = $row['document_id'];
|
||||
$document_name = htmlentities($row['document_name']);
|
||||
$document_content = $row['document_content'];
|
||||
$document_created_at = $row['document_created_at'];
|
||||
$document_updated_at = $row['document_updated_at'];
|
||||
$document_folder_id = $row['document_folder_id'];
|
||||
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<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>
|
||||
</td>
|
||||
<td><?php echo $document_created_at; ?></td>
|
||||
<td><?php echo $document_updated_at; ?></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>
|
||||
<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" href="#" data-toggle="modal" data-target="#editDocumentModal<?php echo $document_id; ?>">Edit</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#shareModal" onclick="populateShareModal(<?php echo "$client_id, 'Document', $document_id"; ?>)">Share</a>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addFolderModal">
|
||||
<i class="fa fa-fw fa-folder-plus mr-2"></i>Folder
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="post.php?delete_document=<?php echo $document_id; ?>">Delete</a>
|
||||
<?php } ?>
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addDocumentFromTemplateModal">From Template</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php include("client_document_view_modal.php"); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
include("client_document_edit_modal.php");
|
||||
}
|
||||
</div>
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
</div>
|
||||
<?php include("pagination.php"); ?>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-3 border-right">
|
||||
<h4>Folders</h4>
|
||||
<hr>
|
||||
<ul class="nav nav-pills flex-column bg-light">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?php if ($get_folder_id == 0) { echo "active"; } ?>" href="?client_id=<?php echo $client_id; ?>&folder_id=0">/</a>
|
||||
</li>
|
||||
<?php
|
||||
$sql_folders = mysqli_query($mysqli, "SELECT * FROM folders WHERE 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 = htmlentities($row['folder_name']);
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('document_id') AS num FROM documents WHERE document_folder_id = $folder_id"));
|
||||
$num_documents = intval($row['num']);
|
||||
|
||||
?>
|
||||
|
||||
<li class="nav-item">
|
||||
<div class="row">
|
||||
<div class="col-10">
|
||||
<a class="nav-link <?php if ($get_folder_id == $folder_id) { echo "active"; } ?> " href="?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $folder_id; ?>">
|
||||
<?php
|
||||
if ($get_folder_id == $folder_id) { ?>
|
||||
<i class="fas fa-fw fa-folder-open"></i>
|
||||
<?php } else { ?>
|
||||
<i class="fas fa-fw fa-folder"></i>
|
||||
<?php } ?>
|
||||
|
||||
<?php echo $folder_name; ?> <?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 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 if ($session_user_role == 3) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger text-bold" href="post.php?delete_folder=<?php echo $folder_id; ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php
|
||||
require("client_document_folder_rename_modal.php");
|
||||
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php require_once("client_document_folder_add_modal.php"); ?>
|
||||
</div>
|
||||
|
||||
<div class="col-md-9">
|
||||
<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="input-group">
|
||||
<input type="search" class="form-control " name="q" value="<?php if (isset($q)) { echo stripslashes(htmlentities($q)); } ?>" placeholder="Search Documents">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-secondary"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-sm table-borderless table-hover">
|
||||
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<th>
|
||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=document_name&o=<?php echo $disp; ?>">Name</a>
|
||||
</th>
|
||||
<th>
|
||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=document_created_at&o=<?php echo $disp; ?>">Created</a>
|
||||
</th>
|
||||
<th>
|
||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=document_updated_at&o=<?php echo $disp; ?>">Updated</a>
|
||||
</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 = htmlentities($row['document_name']);
|
||||
$document_content = htmlentities($row['document_content']);
|
||||
$document_created_at = htmlentities($row['document_created_at']);
|
||||
$document_updated_at = htmlentities($row['document_updated_at']);
|
||||
$document_folder_id = intval($row['document_folder_id']);
|
||||
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<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>
|
||||
</td>
|
||||
<td><?php echo $document_created_at; ?></td>
|
||||
<td><?php echo $document_updated_at; ?></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="#editDocumentModal<?php echo $document_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<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>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger text-bold" href="post.php?delete_document=<?php echo $document_id; ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php require("client_document_view_modal.php"); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
require("client_document_edit_modal.php");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
</div>
|
||||
<?php require_once("pagination.php"); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php include("share_modal.php"); ?>
|
||||
<?php include("client_document_add_modal.php"); ?>
|
||||
<?php include("client_document_add_from_template_modal.php"); ?>
|
||||
|
||||
<?php include("footer.php"); ?>
|
||||
<?php
|
||||
require_once("share_modal.php");
|
||||
require_once("client_document_add_modal.php");
|
||||
require_once("client_document_add_from_template_modal.php");
|
||||
require_once("footer.php");
|
||||
|
|
|
|||
|
|
@ -1,90 +1,84 @@
|
|||
<div class="modal" id="addDomainModal" 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-globe"></i> New Domain</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="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Domain 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-globe"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="example.com" required autofocus>
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-globe mr-2"></i>New Domain</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Registrar</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="registrar">
|
||||
<option value="">- Vendor -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_archived_at IS NULL AND vendor_client_id = $client_id ORDER BY vendor_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$vendor_id = $row['vendor_id'];
|
||||
$vendor_name = htmlentities($row['vendor_name']);
|
||||
?>
|
||||
<option value="<?php echo $vendor_id; ?>"><?php echo $vendor_name; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Webhost</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="webhost">
|
||||
<option value="">- Vendor -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_archived_at IS NULL AND vendor_client_id = $client_id ORDER BY vendor_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$vendor_id = $row['vendor_id'];
|
||||
$vendor_name = htmlentities($row['vendor_name']);
|
||||
?>
|
||||
<option value="<?php echo $vendor_id; ?>"><?php echo $vendor_name; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Expire Date</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="expire" max="2999-12-31">
|
||||
</div>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Domain 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-globe"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="example.com" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Registrar</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="registrar">
|
||||
<option value="">- Vendor -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_archived_at IS NULL AND vendor_client_id = $client_id ORDER BY vendor_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$vendor_id = intval($row['vendor_id']);
|
||||
$vendor_name = htmlentities($row['vendor_name']);
|
||||
?>
|
||||
<option value="<?php echo $vendor_id; ?>"><?php echo $vendor_name; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Webhost</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="webhost">
|
||||
<option value="">- Vendor -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_archived_at IS NULL AND vendor_client_id = $client_id ORDER BY vendor_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$vendor_id = intval($row['vendor_id']);
|
||||
$vendor_name = htmlentities($row['vendor_name']);
|
||||
?>
|
||||
<option value="<?php echo $vendor_id; ?>"><?php echo $vendor_name; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Expire Date</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="expire" max="2999-12-31">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_domain" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create</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 class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_domain" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Create</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,137 +1,138 @@
|
|||
<div class="modal" id="editDomainModal" 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-globe"></i> Editing domain: <span class="text-bold" id="editHeader"></span></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="domain_id" value="" id="editDomainId">
|
||||
<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">Overview</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-records">Records</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-overview">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Domain 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-globe"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" id="editDomainName" placeholder="Domain name example.com" value="" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Domain Registrar</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="registrar" id="editRegistrarId">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Webhost</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="webhost" id="editWebhostId">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Expire Date</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" id="editExpire" name="expire" max="2999-12-31">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-globe mr-2"></i>Editing domain: <span class="text-bold" id="editHeader"></span></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="domain_id" value="" id="editDomainId">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="tab-pane fade" id="pills-records">
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-overview">Overview</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-records">Records</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-overview">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Domain 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-globe"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" id="editDomainName" placeholder="Domain name example.com" value="" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Domain Registrar</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="registrar" id="editRegistrarId">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Webhost</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="webhost" id="editWebhostId">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Expire Date</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" id="editExpire" name="expire" max="2999-12-31">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-records">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Domain IP(s)</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>
|
||||
<textarea class="form-control" id="editDomainIP" name="domain_ip" rows="1" disabled></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name Servers</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-crown"></i></span>
|
||||
</div>
|
||||
<textarea class="form-control" id="editNameServers" name="name_servers" rows="1" disabled></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>MX Records</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-mail-bulk"></i></span>
|
||||
</div>
|
||||
<textarea class="form-control" id="editMailServers" name="mail_servers" rows="1" disabled></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>TXT Records</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-check-double"></i></span>
|
||||
</div>
|
||||
<textarea class="form-control" id="editTxtRecords" name="txt_records" rows="1" disabled></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Raw WHOIS</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-search-plus"></i></span>
|
||||
</div>
|
||||
<textarea class="form-control" id="editRawWhois" name="raw_whois" rows="6" disabled></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Domain IP(s)</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>
|
||||
<textarea class="form-control" id="editDomainIP" name="domain_ip" rows="1" disabled></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name Servers</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-crown"></i></span>
|
||||
</div>
|
||||
<textarea class="form-control" id="editNameServers" name="name_servers" rows="1" disabled></textarea>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_domain" 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>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>MX Records</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-mail-bulk"></i></span>
|
||||
</div>
|
||||
<textarea class="form-control" id="editMailServers" name="mail_servers" rows="1" disabled></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>TXT Records</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-check-double"></i></span>
|
||||
</div>
|
||||
<textarea class="form-control" id="editTxtRecords" name="txt_records" rows="1" disabled></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Raw WHOIS</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-search-plus"></i></span>
|
||||
</div>
|
||||
<textarea class="form-control" id="editRawWhois" name="raw_whois" rows="6" disabled></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="edit_domain" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,200 +1,124 @@
|
|||
<?php include("inc_all_client.php"); ?>
|
||||
<?php
|
||||
|
||||
<?php
|
||||
// Default Column Sortby Filter
|
||||
$sb = "domain_name";
|
||||
$o = "ASC";
|
||||
|
||||
if (!empty($_GET['sb'])) {
|
||||
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
|
||||
}else{
|
||||
$sb = "domain_name";
|
||||
}
|
||||
require_once("inc_all_client.php");
|
||||
|
||||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
$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 domains LEFT JOIN vendors ON domain_registrar = vendor_id
|
||||
$sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM domains LEFT JOIN vendors ON domain_registrar = vendor_id
|
||||
WHERE domain_client_id = $client_id AND (domain_name LIKE '%$q%' OR vendor_name LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
$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-globe"></i> Domains</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addDomainModal"><i class="fas fa-fw fa-plus"></i> New Domain</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_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 strip_tags(htmlentities($q)); } ?>" placeholder="Search Domains">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-globe mr-2"></i>Domains</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addDomainModal"><i class="fas fa-plus mr-2"></i>New Domain</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-8">
|
||||
<div class="float-right">
|
||||
<a href="post.php?export_client_domains_csv=<?php echo $client_id; ?>" class="btn btn-default"><i class="fa fa-fw fa-download"></i> Export</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="row">
|
||||
|
||||
</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-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=domain_name&o=<?php echo $disp; ?>">Domain</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=vendor_name&o=<?php echo $disp; ?>">Registrar</a></th>
|
||||
<th>Web Host</th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=domain_expire&o=<?php echo $disp; ?>">Expires</a></th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$domain_id = $row['domain_id'];
|
||||
$domain_name = htmlentities($row['domain_name']);
|
||||
$domain_registrar = htmlentities($row['domain_registrar']);
|
||||
$domain_webhost = htmlentities($row['domain_webhost']);
|
||||
$domain_expire = htmlentities($row['domain_expire']);
|
||||
$domain_registrar_name = htmlentities($row['vendor_name']);
|
||||
if (empty($domain_registrar_name)) {
|
||||
$domain_registrar_name = "-";
|
||||
}
|
||||
<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(htmlentities($q)); } ?>" placeholder="Search Domains">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
$sql_domain_webhost = mysqli_query($mysqli,"SELECT vendor_name FROM vendors WHERE vendor_id = $domain_webhost");
|
||||
$row = mysqli_fetch_array($sql_domain_webhost);
|
||||
$domain_webhost_name = htmlentities($row['vendor_name']);
|
||||
if (empty($domain_webhost_name)) {
|
||||
$domain_webhost_name = "-";
|
||||
}
|
||||
<div class="col-md-8">
|
||||
<div class="float-right">
|
||||
<a href="post.php?export_client_domains_csv=<?php echo $client_id; ?>" class="btn btn-default"><i class="fa fa-download mr-2"></i>Export</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><a class="text-dark" href="#" data-toggle="modal" onclick="populateDomainEditModal(<?php echo $client_id, ",", $domain_id ?>)" data-target="#editDomainModal"><?php echo $domain_name; ?></a></td>
|
||||
<td><?php echo $domain_registrar_name; ?></td>
|
||||
<td><?php echo $domain_webhost_name; ?></td>
|
||||
<td><?php echo $domain_expire; ?></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" onclick="populateDomainEditModal(<?php echo $client_id, ",", $domain_id ?>)" data-target="#editDomainModal">Edit</a>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="post.php?delete_domain=<?php echo $domain_id; ?>">Delete</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</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-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=domain_name&o=<?php echo $disp; ?>">Domain</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=vendor_name&o=<?php echo $disp; ?>">Registrar</a></th>
|
||||
<th>Web Host</th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=domain_expire&o=<?php echo $disp; ?>">Expires</a></th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$domain_id = intval($row['domain_id']);
|
||||
$domain_name = htmlentities($row['domain_name']);
|
||||
$domain_registrar = intval($row['domain_registrar']);
|
||||
$domain_webhost = intval($row['domain_webhost']);
|
||||
$domain_expire = htmlentities($row['domain_expire']);
|
||||
$domain_registrar_name = htmlentities($row['vendor_name']);
|
||||
if (empty($domain_registrar_name)) {
|
||||
$domain_registrar_name = "-";
|
||||
}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
$sql_domain_webhost = mysqli_query($mysqli, "SELECT vendor_name FROM vendors WHERE vendor_id = $domain_webhost");
|
||||
$row = mysqli_fetch_array($sql_domain_webhost);
|
||||
$domain_webhost_name = htmlentities($row['vendor_name']);
|
||||
if (empty($domain_webhost_name)) {
|
||||
$domain_webhost_name = "-";
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><a class="text-dark" href="#" data-toggle="modal" onclick="populateDomainEditModal(<?php echo $client_id, ",", $domain_id ?>)" data-target="#editDomainModal"><?php echo $domain_name; ?></a></td>
|
||||
<td><?php echo $domain_registrar_name; ?></td>
|
||||
<td><?php echo $domain_webhost_name; ?></td>
|
||||
<td><?php echo $domain_expire; ?></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" onclick="populateDomainEditModal(<?php echo $client_id, ",", $domain_id ?>)" data-target="#editDomainModal">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger text-bold" href="post.php?delete_domain=<?php echo $domain_id; ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php require_once("pagination.php"); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php include("pagination.php"); ?>
|
||||
</div>
|
||||
</div>
|
||||
<script src="js/domain_edit_modal.js"></script>
|
||||
|
||||
<?php
|
||||
include("client_domain_edit_modal.php");
|
||||
include("client_domain_add_modal.php");
|
||||
?>
|
||||
|
||||
<script>
|
||||
function populateDomainEditModal(client_id, domain_id) {
|
||||
|
||||
// Send a GET request to post.php as post.php?domain_get_json_details=true&client_id=NUM&domain_id=NUM
|
||||
jQuery.get(
|
||||
"ajax.php",
|
||||
{domain_get_json_details: 'true', client_id: client_id, domain_id: domain_id},
|
||||
function(data) {
|
||||
|
||||
// If we get a response from post.php, parse it as JSON
|
||||
const response = JSON.parse(data);
|
||||
|
||||
// Access the domain info (one), registrars (multiple) and webhosts (multiple)
|
||||
const domain = response.domain[0];
|
||||
const vendors = response.vendors;
|
||||
|
||||
// Populate the domain modal fields
|
||||
document.getElementById("editHeader").innerText = domain.domain_name;
|
||||
document.getElementById("editDomainId").value = domain_id;
|
||||
document.getElementById("editDomainName").value = domain.domain_name;
|
||||
document.getElementById("editExpire").value = domain.domain_expire;
|
||||
document.getElementById("editDomainIP").value = domain.domain_ip;
|
||||
document.getElementById("editNameServers").value = domain.domain_name_servers;
|
||||
document.getElementById("editMailServers").value = domain.domain_mail_servers;
|
||||
document.getElementById("editTxtRecords").value = domain.domain_txt;
|
||||
document.getElementById("editRawWhois").value = domain.domain_raw_whois;
|
||||
|
||||
/* DROPDOWNS */
|
||||
|
||||
// Registrar dropdown
|
||||
var registrarDropdown = document.getElementById("editRegistrarId");
|
||||
|
||||
// Clear registrar dropdown
|
||||
var i, L = registrarDropdown.options.length -1;
|
||||
for(i = L; i >= 0; i--) {
|
||||
registrarDropdown.remove(i);
|
||||
}
|
||||
registrarDropdown[registrarDropdown.length] = new Option('- Vendor -', '0');
|
||||
|
||||
// Populate dropdown
|
||||
vendors.forEach(vendor => {
|
||||
if (parseInt(vendor.vendor_id) == parseInt(domain.domain_registrar)) {
|
||||
// Selected domain
|
||||
registrarDropdown[registrarDropdown.length] = new Option(vendor.vendor_name, vendor.vendor_id, true, true);
|
||||
}
|
||||
else{
|
||||
registrarDropdown[registrarDropdown.length] = new Option(vendor.vendor_name, vendor.vendor_id);
|
||||
}
|
||||
});
|
||||
|
||||
// Webhost dropdown
|
||||
var webhostDropdown = document.getElementById("editWebhostId");
|
||||
|
||||
// Clear registrar dropdown
|
||||
var i, L = webhostDropdown.options.length -1;
|
||||
for(i = L; i >= 0; i--) {
|
||||
webhostDropdown.remove(i);
|
||||
}
|
||||
webhostDropdown[webhostDropdown.length] = new Option('- Vendor -', '0');
|
||||
|
||||
// Populate dropdown
|
||||
vendors.forEach(vendor => {
|
||||
if (parseInt(vendor.vendor_id) == parseInt(domain.domain_webhost)) {
|
||||
// Selected domain
|
||||
webhostDropdown[webhostDropdown.length] = new Option(vendor.vendor_name, vendor.vendor_id, true, true);
|
||||
}
|
||||
else{
|
||||
webhostDropdown[webhostDropdown.length] = new Option(vendor.vendor_name, vendor.vendor_id);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php include("footer.php"); ?>
|
||||
require_once("client_domain_edit_modal.php");
|
||||
require_once("client_domain_add_modal.php");
|
||||
require_once("footer.php");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,186 @@
|
|||
<div class="modal" id="exportClientPDFModal" 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-pdf mr-2"></i>Export PDF</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="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
<ul class="list-group">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
|
||||
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="contacts" name="export_contacts" value="1" checked>
|
||||
<label for="contacts" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-users mr-2'></i>Contacts
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="locations" name="export_locations" value="1" checked>
|
||||
<label for="locations" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-map-marker-alt mr-2'></i>Locations
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="assets" name="export_assets" value="1" checked>
|
||||
<label for="assets" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-desktop mr-2'></i>Assets
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="software" name="export_software" value="1" checked>
|
||||
<label for="software" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-cube mr-2'></i>Software / Licenses
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="logins" name="export_logins" value="1">
|
||||
<label for="logins" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-key mr-2'></i>Logins/Passwords
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="networks" name="export_networks" value="1" checked>
|
||||
<label for="networks" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-network-wired mr-2'></i>networks
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="certificates" name="export_certificates" value="1" checked>
|
||||
<label for="certificates" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-lock mr-2'></i>Certificates
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="domains" name="export_domains" value="1" checked>
|
||||
<label for="domains" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-globe mr-2'></i>Domains
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="tickets" name="export_tickets" value="1" checked>
|
||||
<label for="tickets" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-life-ring mr-2'></i>Tickets
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="scheduled_tickets" name="export_scheduled_tickets" value="1" checked>
|
||||
<label for="scheduled_tickets" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-clock mr-2'></i>Scheduled Tickets
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="vendors" name="export_vendors" value="1" checked>
|
||||
<label for="vendors" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-building mr-2'></i>Vendors
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="invoices" name="export_invoices" value="1" checked>
|
||||
<label for="invoices" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-file-invoice mr-2'></i>Invoices
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="recurring" name="export_recurring" value="1" checked>
|
||||
<label for="recurring" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-sync mr-2'></i>Recurring Invoices
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="quotes" name="export_quotes" value="1" checked>
|
||||
<label for="quotes" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-file mr-2'></i>Quotes
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="payments" name="export_payments" value="1" checked>
|
||||
<label for="payments" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-credit-card mr-2'></i>Payments
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="trips" name="export_trips" value="1" checked>
|
||||
<label for="trips" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-route mr-2'></i>Trips
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="logs" name="export_logs" value="1" checked>
|
||||
<label for="logs" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-eye mr-2'></i>Audit Log
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="export_client_pdf" class="btn btn-primary text-bold"><i class="fa fa-fw fa-download mr-2"></i>Export</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,178 +1,175 @@
|
|||
<div class="modal" id="editClientModal<?php echo $client_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-edit mr-2"></i>Editing: <strong><?php echo $client_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="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-client-details<?php echo $client_id; ?>">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-client-notes<?php echo $client_id; ?>">Notes</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-client-tag<?php echo $client_id; ?>">Tag</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-client-details<?php echo $client_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-user"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name or Company" value="<?php echo $client_name; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Industry</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-briefcase"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="type" placeholder="Industry" value="<?php echo $client_type; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Referral</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-smile-wink"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="referral">
|
||||
<option value="">N/A</option>
|
||||
<?php
|
||||
|
||||
$referral_sql = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_type = 'Referral' AND (category_archived_at > '$client_created_at' OR category_archived_at IS NULL) AND company_id = $session_company_id ORDER BY category_name ASC");
|
||||
while ($row = mysqli_fetch_array($referral_sql)) {
|
||||
$referral = htmlentities($row['category_name']);
|
||||
?>
|
||||
<option <?php if ($client_referral == $referral) { echo "selected"; } ?> > <?php echo $referral; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#addQuickReferralModal"><i class="fas fa-fw fa-plus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Website</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="ex. google.com" value="<?php echo $client_website; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($config_module_enable_accounting) { ?>
|
||||
<div class="form-group">
|
||||
<label>Currency <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-money-bill"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="currency_code" required>
|
||||
<option value="">- Currency -</option>
|
||||
<?php foreach($currencies_array as $currency_code => $currency_name) { ?>
|
||||
<option <?php if ($client_currency_code == $currency_code) { echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Invoice Net Terms</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>
|
||||
<select class="form-control select2" name="net_terms">
|
||||
<option value="">- Net Terms -</option>
|
||||
<?php foreach($net_terms_array as $net_term_value => $net_term_name) { ?>
|
||||
<option <?php if ($net_term_value == $client_net_terms) { echo "selected"; } ?> value="<?php echo $net_term_value; ?>"><?php echo $net_term_name; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php }else{ ?>
|
||||
|
||||
<input type="hidden" name="currency_code" value="<?php echo $currency_code; ?>">
|
||||
<input type="hidden" name="net_terms" value="<?php echo $net_term_value; ?>">
|
||||
<?php } ?>
|
||||
|
||||
<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-edit mr-2"></i>Editing: <strong><?php echo $client_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="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="tab-pane fade" id="pills-client-notes<?php echo $client_id; ?>">
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-client-details<?php echo $client_id; ?>">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-client-notes<?php echo $client_id; ?>">Notes</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-client-tag<?php echo $client_id; ?>">Tag</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="notes"><?php echo $client_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<div class="tab-pane fade" id="pills-client-tag<?php echo $client_id; ?>">
|
||||
<div class="tab-content">
|
||||
|
||||
<ul class="list-group">
|
||||
<div class="tab-pane fade show active" id="pills-client-details<?php echo $client_id; ?>">
|
||||
|
||||
<?php
|
||||
|
||||
$sql_tags_select = mysqli_query($mysqli,"SELECT * FROM tags WHERE tag_type = 1 AND company_id = $session_company_id ORDER BY tag_name ASC");
|
||||
<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-user"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name or Company" value="<?php echo $client_name; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_tags_select)) {
|
||||
$tag_id_select = $row['tag_id'];
|
||||
$tag_name_select = htmlentities($row['tag_name']);
|
||||
$tag_color_select = htmlentities($row['tag_color']);
|
||||
$tag_icon_select = htmlentities($row['tag_icon']);
|
||||
<div class="form-group">
|
||||
<label>Industry</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-briefcase"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="type" placeholder="Industry" value="<?php echo $client_type; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Referral</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-smile-wink"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="referral">
|
||||
<option value="">N/A</option>
|
||||
<?php
|
||||
|
||||
$referral_sql = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Referral' AND (category_archived_at > '$client_created_at' OR category_archived_at IS NULL) AND company_id = $session_company_id ORDER BY category_name ASC");
|
||||
while ($row = mysqli_fetch_array($referral_sql)) {
|
||||
$referral = htmlentities($row['category_name']);
|
||||
?>
|
||||
<option <?php if ($client_referral == $referral) { echo "selected"; } ?> > <?php echo $referral; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#addQuickReferralModal"><i class="fas fa-fw fa-plus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Website</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="ex. google.com" value="<?php echo $client_website; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($config_module_enable_accounting) { ?>
|
||||
<div class="form-group">
|
||||
<label>Currency <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-money-bill"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="currency_code" required>
|
||||
<option value="">- Currency -</option>
|
||||
<?php foreach($currencies_array as $currency_code => $currency_name) { ?>
|
||||
<option <?php if ($client_currency_code == $currency_code) { echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Invoice Net Terms</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>
|
||||
<select class="form-control select2" name="net_terms">
|
||||
<option value="">- Net Terms -</option>
|
||||
<?php foreach($net_terms_array as $net_term_value => $net_term_name) { ?>
|
||||
<option <?php if ($net_term_value == $client_net_terms) { echo "selected"; } ?> value="<?php echo $net_term_value; ?>"><?php echo $net_term_name; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php } else { ?>
|
||||
<input type="hidden" name="currency_code" value="<?php echo $currency_code; ?>">
|
||||
<input type="hidden" name="net_terms" value="<?php echo $net_term_value; ?>">
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-client-notes<?php echo $client_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="notes"><?php echo $client_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-client-tag<?php echo $client_id; ?>">
|
||||
|
||||
<ul class="list-group">
|
||||
|
||||
<?php
|
||||
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 1 AND company_id = $session_company_id ORDER BY tag_name ASC");
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_tags_select)) {
|
||||
$tag_id_select = intval($row['tag_id']);
|
||||
$tag_name_select = htmlentities($row['tag_name']);
|
||||
$tag_color_select = htmlentities($row['tag_color']);
|
||||
$tag_icon_select = htmlentities($row['tag_icon']);
|
||||
|
||||
?>
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="tagCheckbox<?php echo "$tag_id_select$client_id"; ?>" name="tags[]" value="<?php echo $tag_id_select; ?>" <?php if (in_array($tag_id_select, $client_tag_id_array)) { echo "checked"; } ?>>
|
||||
<label for="tagCheckbox<?php echo "$tag_id_select$client_id"; ?>" class="custom-control-label">
|
||||
<span class="badge bg-<?php echo $tag_color_select; ?>">
|
||||
<?php echo "<i class='fa fw fa-$tag_icon_select'></i>"; ?> <?php echo $tag_name_select; ?>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
?>
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="tagCheckbox<?php echo "$tag_id_select$client_id"; ?>" name="tags[]" value="<?php echo $tag_id_select; ?>" <?php if (in_array($tag_id_select, $client_tag_id_array)) { echo "checked"; } ?>>
|
||||
<label for="tagCheckbox<?php echo "$tag_id_select$client_id"; ?>" class="custom-control-label">
|
||||
<span class="badge bg-<?php echo $tag_color_select; ?>">
|
||||
<?php echo "<i class='fa fw fa-$tag_icon_select'></i>"; ?> <?php echo $tag_name_select; ?>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_client" 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 class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="edit_client" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,40 +1,37 @@
|
|||
<?php include("inc_all_client.php"); ?>
|
||||
|
||||
<link href='plugins/fullcalendar/main.min.css' rel='stylesheet' />
|
||||
|
||||
<?php
|
||||
|
||||
require_once("inc_all_client.php");
|
||||
|
||||
if (isset($_GET['calendar_id'])) {
|
||||
$calendar_selected_id = intval($_GET['calendar_id']);
|
||||
$calendar_selected_id = intval($_GET['calendar_id']);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<link href='plugins/fullcalendar/main.min.css' rel='stylesheet' />
|
||||
|
||||
<div class="card">
|
||||
<div id='calendar'></div>
|
||||
<div id='calendar'></div>
|
||||
</div>
|
||||
|
||||
<?php include("calendar_event_add_modal.php"); ?>
|
||||
<?php include("calendar_add_modal.php"); ?>
|
||||
|
||||
<?php
|
||||
?>
|
||||
|
||||
<?php
|
||||
//loop through IDs and create a modal for each
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM calendars LEFT JOIN events ON calendar_id = event_calendar_id WHERE event_client_id = $client_id AND calendars.company_id = $session_company_id");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$event_id = $row['event_id'];
|
||||
$event_title = htmlentities($row['event_title']);
|
||||
$event_description = htmlentities($row['event_description']);
|
||||
$event_start = htmlentities($row['event_start']);
|
||||
$event_end = htmlentities($row['event_end']);
|
||||
$event_repeat = htmlentities($row['event_repeat']);
|
||||
$calendar_id = $row['calendar_id'];
|
||||
$calendar_name = htmlentities($row['calendar_name']);
|
||||
$calendar_color = htmlentities($row['calendar_color']);
|
||||
include("calendar_event_add_modal.php");
|
||||
include("calendar_add_modal.php");
|
||||
|
||||
include("calendar_event_edit_modal.php");
|
||||
//loop through IDs and create a modal for each
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM calendars LEFT JOIN events ON calendar_id = event_calendar_id WHERE event_client_id = $client_id AND calendars.company_id = $session_company_id");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$event_id = intval($row['event_id']);
|
||||
$event_title = htmlentities($row['event_title']);
|
||||
$event_description = htmlentities($row['event_description']);
|
||||
$event_start = htmlentities($row['event_start']);
|
||||
$event_end = htmlentities($row['event_end']);
|
||||
$event_repeat = htmlentities($row['event_repeat']);
|
||||
$calendar_id = intval($row['calendar_id']);
|
||||
$calendar_name = htmlentities($row['calendar_name']);
|
||||
$calendar_color = htmlentities($row['calendar_color']);
|
||||
|
||||
require("calendar_event_edit_modal.php");
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -45,54 +42,55 @@ while ($row = mysqli_fetch_array($sql)) {
|
|||
<script>
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var calendarEl = document.getElementById('calendar');
|
||||
var calendarEl = document.getElementById('calendar');
|
||||
|
||||
var calendar = new FullCalendar.Calendar(calendarEl, {
|
||||
themeSystem: 'bootstrap',
|
||||
defaultView: 'dayGridMonth',
|
||||
customButtons: {
|
||||
addEvent: {
|
||||
bootstrapFontAwesome: 'fa fa-plus',
|
||||
click: function() {
|
||||
$("#addCalendarEventModal").modal();
|
||||
}
|
||||
},
|
||||
addCalendar: {
|
||||
bootstrapFontAwesome: 'fa fa-calendar-plus',
|
||||
click: function() {
|
||||
$("#addCalendarModal").modal();
|
||||
}
|
||||
}
|
||||
},
|
||||
headerToolbar: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
right: 'dayGridMonth,timeGridWeek,timeGridDay,listMonth addEvent addCalendar'
|
||||
},
|
||||
events: [
|
||||
<?php
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM calendars LEFT JOIN events ON calendar_id = event_calendar_id WHERE event_client_id = $client_id AND calendars.company_id = $session_company_id");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$event_id = json_encode($row['event_id']);
|
||||
$event_title = json_encode($row['event_title']);
|
||||
$event_start = json_encode($row['event_start']);
|
||||
$event_end = json_encode($row['event_end']);
|
||||
$calendar_id = json_encode($row['calendar_id']);
|
||||
$calendar_name = json_encode($row['calendar_name']);
|
||||
$calendar_color = json_encode($row['calendar_color']);
|
||||
|
||||
echo "{ id: $event_id, title: $event_title, start: $event_start, end: $event_end, color: $calendar_color },";
|
||||
}
|
||||
?>
|
||||
],
|
||||
eventClick: function(editEvent) {
|
||||
$('#editEventModal'+editEvent.event.id).modal();
|
||||
}
|
||||
});
|
||||
var calendar = new FullCalendar.Calendar(calendarEl, {
|
||||
themeSystem: 'bootstrap',
|
||||
defaultView: 'dayGridMonth',
|
||||
customButtons: {
|
||||
addEvent: {
|
||||
bootstrapFontAwesome: 'fa fa-plus',
|
||||
click: function() {
|
||||
$("#addCalendarEventModal").modal();
|
||||
}
|
||||
},
|
||||
addCalendar: {
|
||||
bootstrapFontAwesome: 'fa fa-calendar-plus',
|
||||
click: function() {
|
||||
$("#addCalendarModal").modal();
|
||||
}
|
||||
}
|
||||
},
|
||||
headerToolbar: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
right: 'dayGridMonth,timeGridWeek,timeGridDay,listMonth addEvent addCalendar'
|
||||
},
|
||||
events: [
|
||||
<?php
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM calendars LEFT JOIN events ON calendar_id = event_calendar_id WHERE event_client_id = $client_id AND calendars.company_id = $session_company_id");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$event_id = intval($row['event_id']);
|
||||
$event_title = json_encode($row['event_title']);
|
||||
$event_start = json_encode($row['event_start']);
|
||||
$event_end = json_encode($row['event_end']);
|
||||
$calendar_id = intval($row['calendar_id']);
|
||||
$calendar_name = json_encode($row['calendar_name']);
|
||||
$calendar_color = json_encode($row['calendar_color']);
|
||||
|
||||
calendar.render();
|
||||
echo "{ id: $event_id, title: $event_title, start: $event_start, end: $event_end, color: $calendar_color },";
|
||||
}
|
||||
?>
|
||||
],
|
||||
eventClick: function(editEvent) {
|
||||
$('#editEventModal'+editEvent.event.id).modal();
|
||||
}
|
||||
});
|
||||
|
||||
calendar.render();
|
||||
});
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<?php include("footer.php"); ?>
|
||||
<?php
|
||||
require("footer.php");
|
||||
|
|
|
|||
|
|
@ -1,36 +1,36 @@
|
|||
<div class="modal" id="addFileModal" 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-cloud-upload-alt"></i> Upload File</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; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>File name</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-file"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="new_name" placeholder="leave blank to use existing name">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-cloud-upload-alt mr-2"></i>Upload File</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<input type="file" class="form-control-file" name="file" accept=".jpg, .jpeg, .gif, .png, .webp, .pdf, .txt, .doc, .docx, .csv, .xls, .xlsx, .zip, .tar, .gz">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>File name</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-file"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="new_name" placeholder="leave blank to use existing name">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="file" class="form-control-file" name="file" accept=".jpg, .jpeg, .gif, .png, .webp, .pdf, .txt, .doc, .docx, .csv, .xls, .xlsx, .zip, .tar, .gz">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_file" class="btn btn-primary text-bold"><i class="fa fa-upload mr-2"></i>Upload</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 class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_file" class="btn btn-primary text-bold"><i class="fa fa-fw fa-upload"></i> Upload</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
<div class="modal" id="viewFileModal<?php echo $file_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog modal-xl ">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-image"></i> <?php echo $file_name; ?></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div style="text-align: center;">
|
||||
<img class="img-fluid" src="<?php echo "uploads/clients/$session_company_id/$client_id/$file_reference_name"; ?>">
|
||||
</div>
|
||||
|
||||
<div class="modal-dialog modal-xl ">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-image mr-2"></i><?php echo $file_name; ?></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div style="text-align: center;">
|
||||
<img class="img-fluid" src="<?php echo "uploads/clients/$session_company_id/$client_id/$file_reference_name"; ?>">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
181
client_files.php
181
client_files.php
|
|
@ -1,4 +1,6 @@
|
|||
<?php include("inc_all_client.php");
|
||||
<?php
|
||||
|
||||
require_once("inc_all_client.php");
|
||||
|
||||
$sql_files_images = mysqli_query($mysqli, "SELECT * FROM files WHERE file_client_id = $client_id AND (file_ext LIKE 'JPG' OR file_ext LIKE 'jpg' OR file_ext LIKE 'JPEG' OR file_ext LIKE 'jpeg' OR file_ext LIKE 'png' OR file_ext LIKE 'PNG') ORDER BY file_name ASC");
|
||||
|
||||
|
|
@ -8,105 +10,98 @@ $num_of_files = mysqli_num_rows($sql_files_images) + mysqli_num_rows($sql_files_
|
|||
|
||||
?>
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-paperclip"></i> Files</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addFileModal"><i class="fas fa-fw fa-cloud-upload-alt"></i> Upload File</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
<?php
|
||||
if ($num_of_files == 0) {
|
||||
|
||||
echo "<div style='text-align: center;'><h3 class='text-secondary'>No Records Here</h3></div>";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_files_images)) {
|
||||
$file_id = $row['file_id'];
|
||||
$file_name = htmlentities($row['file_name']);
|
||||
$file_reference_name = htmlentities($row['file_reference_name']);
|
||||
$file_ext = htmlentities($row['file_ext']);
|
||||
|
||||
?>
|
||||
|
||||
<div class="col-xl-3 col-lg-3 col-md-6 col-sm-6 mb-3">
|
||||
<div class="card">
|
||||
<a href="#" data-toggle="modal" data-target="#viewFileModal<?php echo $file_id; ?>">
|
||||
<img class="img-fluid" src="<?php echo "uploads/clients/$session_company_id/$client_id/$file_reference_name"; ?>">
|
||||
</a>
|
||||
<div class="card-footer bg-dark text-white p-1">
|
||||
<center>
|
||||
<a href="<?php echo "uploads/clients/$session_company_id/$client_id/$file_reference_name"; ?>" download="<?php echo $file_name; ?>" class="text-white float-left ml-1"><i class="fa fa-cloud-download-alt"></i></a>
|
||||
<a href="#" data-toggle="modal" data-target="#shareModal" onclick="populateShareModal(<?php echo "$client_id, 'File', $file_id"; ?>)" class="text-white float-left ml-1"><i class="fa fa-share"></i></a>
|
||||
|
||||
<small><?php echo $file_name; ?></small>
|
||||
|
||||
<a href="post.php?delete_file=<?php echo $file_id; ?>" class="text-white float-right mr-1"><i class="fa fa-times"></i></a>
|
||||
</center>
|
||||
</div>
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-paperclip mr-2"></i>Files</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addFileModal"><i class="fas fa-fw fa-cloud-upload-alt mr-2"></i>Upload File</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
<?php
|
||||
include("client_file_view_modal.php");
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
if ($num_of_files == 0) {
|
||||
echo "<div style='text-align: center;'><h3 class='text-secondary'>No Records Here</h3></div>";
|
||||
} ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
|
||||
<table class="table">
|
||||
<?php
|
||||
|
||||
<?php
|
||||
while ($row = mysqli_fetch_array($sql_files_other)) {
|
||||
$file_id = $row['file_id'];
|
||||
$file_name = htmlentities($row['file_name']);
|
||||
$file_reference_name = htmlentities($row['file_reference_name']);
|
||||
$file_ext = 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_icon = "file-alt";
|
||||
}elseif ($file_ext == 'doc' || $file_ext == 'docx') {
|
||||
$file_icon = "file-word";
|
||||
}elseif ($file_ext == 'xls' || $file_ext == 'xlsx' || $file_ext == 'ods') {
|
||||
$file_icon = "file-excel";
|
||||
}elseif ($file_ext == 'mp3' || $file_ext == 'wav' || $file_ext == 'ogg') {
|
||||
$file_icon = "file-audio";
|
||||
}else{
|
||||
$file_icon = "file";
|
||||
}
|
||||
?>
|
||||
while ($row = mysqli_fetch_array($sql_files_images)) {
|
||||
$file_id = intval($row['file_id']);
|
||||
$file_name = htmlentities($row['file_name']);
|
||||
$file_reference_name = htmlentities($row['file_reference_name']);
|
||||
$file_ext = htmlentities($row['file_ext']);
|
||||
|
||||
<tr>
|
||||
<td><a href="<?php echo "uploads/clients/$session_company_id/$client_id/$file_reference_name"; ?>" target="_blank" class="text-secondary"><i class="fa fa-fw fa-2x fa-<?php echo $file_icon; ?> mr-3"></i> <?php echo basename($file_name); ?></a></td>
|
||||
<td>
|
||||
<a href="<?php echo "uploads/clients/$session_company_id/$client_id/$file_reference_name"; ?>" download="<?php echo $file_name; ?>" class="text-secondary float-left ml-1"><i class="fa fa-cloud-download-alt"></i></a>
|
||||
<a href="#" data-toggle="modal" data-target="#shareModal" onclick="populateShareModal(<?php echo "$client_id, 'File', $file_id"; ?>)" class="text-secondary float-left ml-1"><i class="fa fa-share"></i></a>
|
||||
<a href="post.php?delete_file=<?php echo $file_id; ?>" class="text-secondary float-right mr-1"><i class="fa fa-times"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
<div class="col-xl-3 col-lg-3 col-md-6 col-sm-6 mb-3">
|
||||
<div class="card">
|
||||
<a href="#" data-toggle="modal" data-target="#viewFileModal<?php echo $file_id; ?>">
|
||||
<img class="img-fluid" src="<?php echo "uploads/clients/$session_company_id/$client_id/$file_reference_name"; ?>" alt="<?php echo $file_reference_name ?>">
|
||||
</a>
|
||||
<div class="card-footer bg-dark text-white p-1" style="text-align: center;">
|
||||
<a href="<?php echo "uploads/clients/$session_company_id/$client_id/$file_reference_name"; ?>" download="<?php echo $file_name; ?>" class="text-white float-left ml-1"><i class="fa fa-cloud-download-alt"></i></a>
|
||||
<a href="#" data-toggle="modal" data-target="#shareModal" onclick="populateShareModal(<?php echo "$client_id, 'File', $file_id"; ?>)" class="text-white float-left ml-1"><i class="fa fa-share"></i></a>
|
||||
|
||||
<small><?php echo $file_name; ?></small>
|
||||
|
||||
<a href="post.php?delete_file=<?php echo $file_id; ?>" class="text-white float-right mr-1"><i class="fa fa-times"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
require("client_file_view_modal.php");
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<table class="table">
|
||||
|
||||
<?php
|
||||
while ($row = mysqli_fetch_array($sql_files_other)) {
|
||||
$file_id = intval($row['file_id']);
|
||||
$file_name = htmlentities($row['file_name']);
|
||||
$file_reference_name = htmlentities($row['file_reference_name']);
|
||||
$file_ext = 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_icon = "file-alt";
|
||||
} elseif ($file_ext == 'doc' || $file_ext == 'docx') {
|
||||
$file_icon = "file-word";
|
||||
} elseif ($file_ext == 'xls' || $file_ext == 'xlsx' || $file_ext == 'ods') {
|
||||
$file_icon = "file-excel";
|
||||
} elseif ($file_ext == 'mp3' || $file_ext == 'wav' || $file_ext == 'ogg') {
|
||||
$file_icon = "file-audio";
|
||||
} else {
|
||||
$file_icon = "file";
|
||||
}
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td><a href="<?php echo "uploads/clients/$session_company_id/$client_id/$file_reference_name"; ?>" target="_blank" class="text-secondary"><i class="fa fa-fw fa-2x fa-<?php echo $file_icon; ?> mr-3"></i> <?php echo basename($file_name); ?></a></td>
|
||||
<td>
|
||||
<a href="<?php echo "uploads/clients/$session_company_id/$client_id/$file_reference_name"; ?>" download="<?php echo $file_name; ?>" class="text-secondary float-left ml-1"><i class="fa fa-cloud-download-alt"></i></a>
|
||||
<a href="#" data-toggle="modal" data-target="#shareModal" onclick="populateShareModal(<?php echo "$client_id, 'File', $file_id"; ?>)" class="text-secondary float-left ml-1"><i class="fa fa-share"></i></a>
|
||||
<a href="post.php?delete_file=<?php echo $file_id; ?>" class="text-secondary float-right mr-1"><i class="fa fa-times"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include("client_file_add_modal.php");
|
||||
include("share_modal.php");
|
||||
?>
|
||||
|
||||
<?php include("footer.php"); ?>
|
||||
require_once("client_file_add_modal.php");
|
||||
require_once("share_modal.php");
|
||||
require_once("footer.php");
|
||||
|
|
|
|||
|
|
@ -1,167 +1,170 @@
|
|||
<?php include("inc_all_client.php"); ?>
|
||||
|
||||
<?php
|
||||
|
||||
if (!empty($_GET['sb'])) {
|
||||
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
|
||||
}else{
|
||||
$sb = "invoice_number";
|
||||
}
|
||||
// Default Column Sortby Filter
|
||||
$sb = "invoice_number";
|
||||
$o = "DESC";
|
||||
|
||||
// Reverse default sort
|
||||
if (!isset($_GET['o'])) {
|
||||
$o = "DESC";
|
||||
$disp = "ASC";
|
||||
}
|
||||
require_once("inc_all_client.php");
|
||||
|
||||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
$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 invoices
|
||||
LEFT JOIN categories ON invoice_category_id = category_id
|
||||
WHERE invoice_client_id = $client_id
|
||||
AND (CONCAT(invoice_prefix,invoice_number) LIKE '%$q%' OR invoice_scope LIKE '%$q%' OR category_name LIKE '%$q%' OR invoice_status LIKE '%$q%' OR invoice_amount LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM invoices
|
||||
LEFT JOIN categories ON invoice_category_id = category_id
|
||||
WHERE invoice_client_id = $client_id
|
||||
AND (CONCAT(invoice_prefix,invoice_number) LIKE '%$q%' OR invoice_scope LIKE '%$q%' OR category_name LIKE '%$q%' OR invoice_status LIKE '%$q%' OR invoice_amount LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to"
|
||||
);
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
$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-file"></i> Invoices</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addInvoiceModal"><i class="fas fa-fw fa-plus"></i> New Invoice</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_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 strip_tags(htmlentities($q)); } ?>" placeholder="Search Invoices">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-file-invoice mr-2"></i>Invoices</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addInvoiceModal"><i class="fas fa-plus mr-2"></i>New Invoice</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-8">
|
||||
<div class="float-right">
|
||||
<a href="post.php?export_client_invoices_csv=<?php echo $client_id; ?>" class="btn btn-default"><i class="fa fa-fw fa-download"></i> Export</a>
|
||||
</div>
|
||||
</div>
|
||||
<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(htmlentities($q)); } ?>" placeholder="Search Invoices">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-dark"><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-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=invoice_number&o=<?php echo $disp; ?>">Number</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=invoice_scope&o=<?php echo $disp; ?>">Scope</a></th>
|
||||
<th class="text-right"><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=invoice_amount&o=<?php echo $disp; ?>">Amount</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=invoice_date&o=<?php echo $disp; ?>">Date</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=invoice_due&o=<?php echo $disp; ?>">Due</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=category_name&o=<?php echo $disp; ?>">Category</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=invoice_status&o=<?php echo $disp; ?>">Status</a></th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$invoice_id = $row['invoice_id'];
|
||||
$invoice_prefix = htmlentities($row['invoice_prefix']);
|
||||
$invoice_number = htmlentities($row['invoice_number']);
|
||||
$invoice_scope = htmlentities($row['invoice_scope']);
|
||||
if (empty($invoice_scope)) {
|
||||
$invoice_scope_display = "-";
|
||||
}else{
|
||||
$invoice_scope_display = $invoice_scope;
|
||||
}
|
||||
$invoice_status = htmlentities($row['invoice_status']);
|
||||
$invoice_date = $row['invoice_date'];
|
||||
$invoice_due = $row['invoice_due'];
|
||||
$invoice_amount = floatval($row['invoice_amount']);
|
||||
$invoice_currency_code = htmlentities($row['invoice_currency_code']);
|
||||
$invoice_created_at = $row['invoice_created_at'];
|
||||
$category_id = $row['category_id'];
|
||||
$category_name = htmlentities($row['category_name']);
|
||||
<div class="col-md-8">
|
||||
<div class="float-right">
|
||||
<a href="post.php?export_client_invoices_csv=<?php echo $client_id; ?>" class="btn btn-default"><i class="fa fa-download mr-2"></i>Export</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
if (($invoice_status == "Sent" || $invoice_status == "Partial" || $invoice_status == "Viewed") && strtotime($invoice_due) < time() ) {
|
||||
$overdue_color = "text-danger font-weight-bold";
|
||||
}else{
|
||||
$overdue_color = "";
|
||||
}
|
||||
|
||||
//Set Badge color based off of invoice status
|
||||
if ($invoice_status == "Sent") {
|
||||
$invoice_badge_color = "warning";
|
||||
}elseif ($invoice_status == "Viewed") {
|
||||
$invoice_badge_color = "info";
|
||||
}elseif ($invoice_status == "Partial") {
|
||||
$invoice_badge_color = "primary";
|
||||
}elseif ($invoice_status == "Paid") {
|
||||
$invoice_badge_color = "success";
|
||||
}elseif ($invoice_status == "Cancelled") {
|
||||
$invoice_badge_color = "danger";
|
||||
}else{
|
||||
$invoice_badge_color = "secondary";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td><a href="invoice.php?invoice_id=<?php echo $invoice_id; ?>"><?php echo "$invoice_prefix$invoice_number"; ?></a></td>
|
||||
<td><?php echo $invoice_scope_display; ?></td>
|
||||
<td class="text-right"><?php echo numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code); ?></td>
|
||||
<td><?php echo $invoice_date; ?></td>
|
||||
<td><div class="<?php echo $overdue_color; ?>"><?php echo $invoice_due; ?></div></td>
|
||||
<td><?php echo $category_name; ?></td>
|
||||
<td>
|
||||
<span class="p-2 badge badge-<?php echo $invoice_badge_color; ?>">
|
||||
<?php echo $invoice_status; ?>
|
||||
</span>
|
||||
</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">
|
||||
<?php if (!empty($config_smtp_host)) { ?>
|
||||
<a class="dropdown-item" href="post.php?email_invoice=<?php echo $invoice_id; ?>">Send</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<?php } ?>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editInvoiceModal<?php echo $invoice_id; ?>">Edit</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addInvoiceCopyModal<?php echo $invoice_id; ?>">Copy</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="post.php?delete_invoice=<?php echo $invoice_id; ?>">Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</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-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=invoice_number&o=<?php echo $disp; ?>">Number</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=invoice_scope&o=<?php echo $disp; ?>">Scope</a></th>
|
||||
<th class="text-right"><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=invoice_amount&o=<?php echo $disp; ?>">Amount</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=invoice_date&o=<?php echo $disp; ?>">Date</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=invoice_due&o=<?php echo $disp; ?>">Due</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=category_name&o=<?php echo $disp; ?>">Category</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=invoice_status&o=<?php echo $disp; ?>">Status</a></th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
<?php
|
||||
|
||||
include("invoice_copy_modal.php");
|
||||
include("invoice_edit_modal.php");
|
||||
}
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$invoice_id = intval($row['invoice_id']);
|
||||
$invoice_prefix = htmlentities($row['invoice_prefix']);
|
||||
$invoice_number = htmlentities($row['invoice_number']);
|
||||
$invoice_scope = htmlentities($row['invoice_scope']);
|
||||
if (empty($invoice_scope)) {
|
||||
$invoice_scope_display = "-";
|
||||
} else {
|
||||
$invoice_scope_display = $invoice_scope;
|
||||
}
|
||||
$invoice_status = htmlentities($row['invoice_status']);
|
||||
$invoice_date = htmlentities($row['invoice_date']);
|
||||
$invoice_due = htmlentities($row['invoice_due']);
|
||||
$invoice_amount = floatval($row['invoice_amount']);
|
||||
$invoice_currency_code = htmlentities($row['invoice_currency_code']);
|
||||
$invoice_created_at = htmlentities($row['invoice_created_at']);
|
||||
$category_id = intval($row['category_id']);
|
||||
$category_name = htmlentities($row['category_name']);
|
||||
|
||||
?>
|
||||
if (($invoice_status == "Sent" || $invoice_status == "Partial" || $invoice_status == "Viewed") && strtotime($invoice_due) < time()) {
|
||||
$overdue_color = "text-danger font-weight-bold";
|
||||
} else {
|
||||
$overdue_color = "";
|
||||
}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
//Set Badge color based off of invoice status
|
||||
if ($invoice_status == "Sent") {
|
||||
$invoice_badge_color = "warning";
|
||||
} elseif ($invoice_status == "Viewed") {
|
||||
$invoice_badge_color = "info";
|
||||
} elseif ($invoice_status == "Partial") {
|
||||
$invoice_badge_color = "primary";
|
||||
} elseif ($invoice_status == "Paid") {
|
||||
$invoice_badge_color = "success";
|
||||
} elseif ($invoice_status == "Cancelled") {
|
||||
$invoice_badge_color = "danger";
|
||||
} else {
|
||||
$invoice_badge_color = "secondary";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td class="text-bold"><a href="invoice.php?invoice_id=<?php echo $invoice_id; ?>"><?php echo "$invoice_prefix$invoice_number"; ?></a></td>
|
||||
<td><?php echo $invoice_scope_display; ?></td>
|
||||
<td class="text-bold text-right"><?php echo numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code); ?></td>
|
||||
<td><?php echo $invoice_date; ?></td>
|
||||
<td><div class="<?php echo $overdue_color; ?>"><?php echo $invoice_due; ?></div></td>
|
||||
<td><?php echo $category_name; ?></td>
|
||||
<td>
|
||||
<span class="p-2 badge badge-<?php echo $invoice_badge_color; ?>">
|
||||
<?php echo $invoice_status; ?>
|
||||
</span>
|
||||
</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">
|
||||
<?php if (!empty($config_smtp_host)) { ?>
|
||||
<a class="dropdown-item" href="post.php?email_invoice=<?php echo $invoice_id; ?>">
|
||||
<i class="fas fa-fw fa-paper-plane mr-2"></i>Send
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<?php } ?>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editInvoiceModal<?php echo $invoice_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addInvoiceCopyModal<?php echo $invoice_id; ?>">
|
||||
<i class="fas fa-fw fa-copy mr-2"></i>Copy
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger text-bold" href="post.php?delete_invoice=<?php echo $invoice_id; ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
require("invoice_copy_modal.php");
|
||||
require("invoice_edit_modal.php");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php require_once("pagination.php"); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php include("pagination.php"); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include("invoice_add_modal.php"); ?>
|
||||
|
||||
<?php include("footer.php"); ?>
|
||||
<?php
|
||||
require_once("invoice_add_modal.php");
|
||||
require_once("footer.php");
|
||||
|
|
|
|||
|
|
@ -1,174 +1,172 @@
|
|||
<div class="modal" id="addLocationModal" 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"></i> Creating location</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; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
<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>Creating location</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; ?>">
|
||||
<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-address">Address</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-contact">Contact</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-photo">Photo</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-address">Address</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-contact">Contact</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-photo">Photo</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-address">
|
||||
<div class="tab-pane fade show active" id="pills-address">
|
||||
|
||||
<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" required autofocus>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="primary_location" value="1" <?php if ($primary_location == 0) { echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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">
|
||||
</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">
|
||||
</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">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Zip / 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">
|
||||
</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-flag"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="country">
|
||||
<option value="">- Country -</option>
|
||||
<?php foreach($countries_array as $country_name) { ?>
|
||||
<option <?php if ($session_company_country == $country_name) { echo "selected"; } ?> ><?php echo $country_name; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-contact">
|
||||
|
||||
<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" name="contact">
|
||||
<option value="">- Contact -</option>
|
||||
<?php
|
||||
|
||||
$sql_contacts = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_archived_at IS NULL AND contact_client_id = $client_id ORDER BY contact_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_contacts)) {
|
||||
$contact_id = $row['contact_id'];
|
||||
$contact_name = htmlentities($row['contact_name']);
|
||||
?>
|
||||
<option value="<?php echo $contact_id; ?>"><?php echo $contact_name; ?></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">
|
||||
</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">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="6" name="notes" placeholder="Enter some notes"></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-photo">
|
||||
|
||||
<div class="form-group">
|
||||
<input type="file" class="form-control-file" name="file">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<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" required autofocus>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="primary_location" value="1" <?php if ($primary_location == 0) { echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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">
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_location" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</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">
|
||||
</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">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Zip / 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">
|
||||
</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-flag"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="country">
|
||||
<option value="">- Country -</option>
|
||||
<?php foreach($countries_array as $country_name) { ?>
|
||||
<option <?php if ($session_company_country == $country_name) { echo "selected"; } ?> ><?php echo $country_name; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-contact">
|
||||
|
||||
<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" name="contact">
|
||||
<option value="">- Contact -</option>
|
||||
<?php
|
||||
|
||||
$sql_contacts = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_archived_at IS NULL AND contact_client_id = $client_id ORDER BY contact_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_contacts)) {
|
||||
$contact_id = $row['contact_id'];
|
||||
$contact_name = htmlentities($row['contact_name']);
|
||||
?>
|
||||
<option value="<?php echo $contact_id; ?>"><?php echo $contact_name; ?></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">
|
||||
</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">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="6" name="notes" placeholder="Enter some notes"></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-photo">
|
||||
|
||||
<div class="form-group">
|
||||
<input type="file" class="form-control-file" name="file">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_location" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Create</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,183 +1,181 @@
|
|||
<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"></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; ?>">
|
||||
<input type="hidden" name="existing_file_name" value="<?php echo $location_photo; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
<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; ?>">
|
||||
<input type="hidden" name="existing_file_name" value="<?php echo $location_photo; ?>">
|
||||
<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-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-photo<?php echo $location_id; ?>">Photo</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" 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-photo<?php echo $location_id; ?>">Photo</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-address<?php echo $location_id; ?>">
|
||||
<div class="tab-pane fade show active" id="pills-address<?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" value="<?php echo $location_name; ?>" required>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="primary_location" value="1" <?php if ($location_id == $primary_location) { echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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" 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" 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" value="<?php echo $location_state; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Zip / 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" 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-flag"></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" 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_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_contacts)) {
|
||||
$contact_id_select = intval($row['contact_id']);
|
||||
$contact_name_select = htmlentities($row['contact_name']);
|
||||
|
||||
?>
|
||||
<option <?php if ($location_contact_id == $contact_id_select) { echo "selected"; } ?> value="<?php echo $contact_id_select; ?>"><?php echo $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" value="<?php echo $location_phone; ?>">
|
||||
</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" value="<?php echo $location_hours; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="5" name="notes" placeholder="Enter some notes"><?php echo $location_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-photo<?php echo $location_id; ?>">
|
||||
|
||||
<div class="mb-3" style="text-align: center;">
|
||||
<?php if (!empty($location_photo)) { ?>
|
||||
<img class="img-fluid" src="<?php echo "uploads/clients/$session_company_id/$client_id/$location_photo"; ?>">
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="file" class="form-control-file" name="file">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<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" value="<?php echo $location_name; ?>" required>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="primary_location" value="1" <?php if ($location_id == $primary_location) { echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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" value="<?php echo $location_address; ?>">
|
||||
<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>
|
||||
</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" 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" value="<?php echo $location_state; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Zip / 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" 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-flag"></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" 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_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_contacts)) {
|
||||
$contact_id_select = $row['contact_id'];
|
||||
$contact_name_select = htmlentities($row['contact_name']);
|
||||
|
||||
?>
|
||||
<option <?php if ($location_contact_id == $contact_id_select) { echo "selected"; } ?> value="<?php echo $contact_id_select; ?>"><?php echo $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" value="<?php echo $location_phone; ?>">
|
||||
</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" value="<?php echo $location_hours; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="5" name="notes" placeholder="Enter some notes"><?php echo $location_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-photo<?php echo $location_id; ?>">
|
||||
|
||||
<div class="mb-3" style="text-align: center;">
|
||||
<?php if (!empty($location_photo)) { ?>
|
||||
<img class="img-fluid" src="<?php echo "uploads/clients/$session_company_id/$client_id/$location_photo"; ?>">
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="file" class="form-control-file" name="file">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="edit_location" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<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"></i> Import Locations</h5>
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-map-marker-alt mr-2"></i>Import Locations</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
|
|
@ -16,10 +16,11 @@
|
|||
<input type="file" class="form-control-file" name="file" accept=".csv">
|
||||
</div>
|
||||
<hr>
|
||||
<div>Download <a href="post.php?download_client_locations_csv_template=<?php echo $client_id; ?>">sample csv template</a></div>
|
||||
<div>Download: <a class="text-bold" href="post.php?download_client_locations_csv_template=<?php echo $client_id; ?>">sample csv template</a></div>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="import_client_locations_csv" class="btn btn-primary">Import</button>
|
||||
<button type="submit" name="import_client_locations_csv" class="btn btn-primary text-bold"><i class="fa fa-upload mr-2"></i>Import</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,159 +1,148 @@
|
|||
<?php include("inc_all_client.php"); ?>
|
||||
<?php
|
||||
|
||||
<?php
|
||||
|
||||
if (isset($_GET['q'])) {
|
||||
$q = strip_tags(mysqli_real_escape_string($mysqli,$_GET['q']));
|
||||
//Phone Numbers
|
||||
$phone_query = preg_replace("/[^0-9]/", '',$q);
|
||||
if (empty($phone_query)) {
|
||||
$phone_query = $q;
|
||||
}
|
||||
}else{
|
||||
$q = "";
|
||||
$phone_query = "";
|
||||
}
|
||||
// Default Column Sortby Filter
|
||||
$sb = "location_name";
|
||||
$o = "ASC";
|
||||
|
||||
if (!empty($_GET['sb'])) {
|
||||
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
|
||||
}else{
|
||||
$sb = "location_name";
|
||||
}
|
||||
require_once("inc_all_client.php");
|
||||
|
||||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
$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 locations
|
||||
WHERE location_client_id = $client_id
|
||||
AND location_archived_at IS NULL
|
||||
AND (location_name LIKE '%$q%' OR location_address LIKE '%$q%' OR location_phone LIKE '%$phone_query%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM locations
|
||||
WHERE location_client_id = $client_id
|
||||
AND location_archived_at IS NULL
|
||||
AND (location_name LIKE '%$q%' OR location_address LIKE '%$q%' OR location_phone LIKE '%$phone_query%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to"
|
||||
);
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
$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-map-marker-alt"></i> Locations</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addLocationModal"><i class="fas fa-fw fa-plus"></i> New Location</button>
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-map-marker-alt mr-2"></i>Locations</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addLocationModal"><i class="fas fa-plus mr-2"></i>New Location</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_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 strip_tags(htmlentities($q)); } ?>" placeholder="Search Locations">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-8">
|
||||
<div class="float-right">
|
||||
<a href="post.php?export_client_locations_csv=<?php echo $client_id; ?>" class="btn btn-default"><i class="fa fa-fw fa-download"></i> Export</a>
|
||||
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#importLocationModal"><i class="fa fa-fw fa-upload"></i> Import</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-borderless table-hover">
|
||||
<thead class="<?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=location_name&o=<?php echo $disp; ?>">Name</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=location_address&o=<?php echo $disp; ?>">Address</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=location_phone&o=<?php echo $disp; ?>">Phone</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=location_hours&o=<?php echo $disp; ?>">Hours</a></th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$location_id = $row['location_id'];
|
||||
$location_name = htmlentities($row['location_name']);
|
||||
$location_country = htmlentities($row['location_country']);
|
||||
$location_address = htmlentities($row['location_address']);
|
||||
$location_city = htmlentities($row['location_city']);
|
||||
$location_state = htmlentities($row['location_state']);
|
||||
$location_zip = htmlentities($row['location_zip']);
|
||||
$location_phone = formatPhoneNumber($row['location_phone']);
|
||||
if (empty($location_phone)) {
|
||||
$location_phone_display = "-";
|
||||
}else{
|
||||
$location_phone_display = $location_phone;
|
||||
}
|
||||
$location_hours = htmlentities($row['location_hours']);
|
||||
if (empty($location_hours)) {
|
||||
$location_hours_display = "-";
|
||||
}else{
|
||||
$location_hours_display = $location_hours;
|
||||
}
|
||||
$location_photo = htmlentities($row['location_photo']);
|
||||
$location_notes = htmlentities($row['location_notes']);
|
||||
$location_created_at = $row['location_created_at'];
|
||||
$location_contact_id = $row['location_contact_id'];
|
||||
if ($location_id == $primary_location) {
|
||||
$primary_location_display = "<p class='text-success'>Primary Location</p>";
|
||||
}else{
|
||||
$primary_location_display = "";
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<th>
|
||||
<i class="fa fa-fw fa-map-marker-alt text-secondary"></i>
|
||||
<a class="text-dark" href="#" data-toggle="modal" data-target="#editLocationModal<?php echo $location_id; ?>"><?php echo $location_name; ?></a>
|
||||
<?php echo $primary_location_display; ?>
|
||||
</th>
|
||||
<td><a href="//maps.<?php echo $session_map_source; ?>.com?q=<?php echo "$location_address $location_zip"; ?>" target="_blank"><?php echo $location_address; ?><br><?php echo "$location_city $location_state $location_zip"; ?></a></td>
|
||||
<td><?php echo $location_phone_display; ?></td>
|
||||
<td><?php echo $location_hours_display; ?></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="#editLocationModal<?php echo $location_id; ?>">Edit</a>
|
||||
<?php if ($session_user_role == 3 && $location_id !== $primary_location) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="post.php?archive_location=<?php echo $location_id; ?>">Archive</a>
|
||||
<a class="dropdown-item text-danger" href="post.php?delete_location=<?php echo $location_id; ?>">Delete</a>
|
||||
<?php } ?>
|
||||
<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(htmlentities($q)); } ?>" placeholder="Search Locations">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include("client_location_edit_modal.php"); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="col-md-8">
|
||||
<div class="float-right">
|
||||
<a href="post.php?export_client_locations_csv=<?php echo $client_id; ?>" class="btn btn-default"><i class="fa fa-fw fa-download mr-2"></i>Export</a>
|
||||
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#importLocationModal"><i class="fa fa-fw fa-upload mr-2"></i>Import</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-borderless table-hover">
|
||||
<thead class="<?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=location_name&o=<?php echo $disp; ?>">Name</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=location_address&o=<?php echo $disp; ?>">Address</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=location_phone&o=<?php echo $disp; ?>">Phone</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=location_hours&o=<?php echo $disp; ?>">Hours</a></th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$location_id = intval($row['location_id']);
|
||||
$location_name = htmlentities($row['location_name']);
|
||||
$location_country = htmlentities($row['location_country']);
|
||||
$location_address = htmlentities($row['location_address']);
|
||||
$location_city = htmlentities($row['location_city']);
|
||||
$location_state = htmlentities($row['location_state']);
|
||||
$location_zip = htmlentities($row['location_zip']);
|
||||
$location_phone = formatPhoneNumber($row['location_phone']);
|
||||
if (empty($location_phone)) {
|
||||
$location_phone_display = "-";
|
||||
} else {
|
||||
$location_phone_display = $location_phone;
|
||||
}
|
||||
$location_hours = htmlentities($row['location_hours']);
|
||||
if (empty($location_hours)) {
|
||||
$location_hours_display = "-";
|
||||
} else {
|
||||
$location_hours_display = $location_hours;
|
||||
}
|
||||
$location_photo = htmlentities($row['location_photo']);
|
||||
$location_notes = htmlentities($row['location_notes']);
|
||||
$location_created_at = htmlentities($row['location_created_at']);
|
||||
$location_contact_id = intval($row['location_contact_id']);
|
||||
if ($location_id == $primary_location) {
|
||||
$primary_location_display = "<p class='text-success'>Primary Location</p>";
|
||||
} else {
|
||||
$primary_location_display = "";
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<th>
|
||||
<i class="fa fa-fw fa-map-marker-alt text-secondary"></i>
|
||||
<a class="text-dark" href="#" data-toggle="modal" data-target="#editLocationModal<?php echo $location_id; ?>"><?php echo $location_name; ?></a>
|
||||
<?php echo $primary_location_display; ?>
|
||||
</th>
|
||||
<td><a href="//maps.<?php echo $session_map_source; ?>.com?q=<?php echo "$location_address $location_zip"; ?>" target="_blank"><?php echo $location_address; ?><br><?php echo "$location_city $location_state $location_zip"; ?></a></td>
|
||||
<td><?php echo $location_phone_display; ?></td>
|
||||
<td><?php echo $location_hours_display; ?></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="#editLocationModal<?php echo $location_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<?php if ($session_user_role == 3 && $location_id !== $primary_location) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="post.php?archive_location=<?php echo $location_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" href="post.php?delete_location=<?php echo $location_id; ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php require("client_location_edit_modal.php"); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php require_once("pagination.php"); ?>
|
||||
</div>
|
||||
<?php include("pagination.php"); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
<?php
|
||||
|
||||
include("client_location_add_modal.php");
|
||||
include("client_location_import_modal.php");
|
||||
|
||||
?>
|
||||
|
||||
<?php include("footer.php"); ?>
|
||||
require_once("client_location_add_modal.php");
|
||||
require_once("client_location_import_modal.php");
|
||||
require_once("footer.php");
|
||||
|
|
|
|||
|
|
@ -1,215 +1,215 @@
|
|||
<div class="modal" id="addLoginModal" 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-key"></i> New Login</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="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-key mr-2"></i>New Login</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="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">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-relation">Relation</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-notes">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-details">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-relation">Relation</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-notes">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
<hr>
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-details">
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-details">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong> / <span class="text-secondary">Important?</span></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="name" placeholder="Name of Login" required autofocus>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="important" value="1">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Username</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="username" placeholder="Username">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Password <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-lock"></i></span>
|
||||
</div>
|
||||
<input type="password" class="form-control" data-toggle="password" id="password" name="password" placeholder="Password" required autocomplete="new-password">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-eye"></i></span>
|
||||
</div>
|
||||
<div class="input-group-append">
|
||||
<span class="btn btn-default"><i class="fa fa-fw fa-question" onclick="generatePassword()"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>OTP</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="password" class="form-control" data-toggle="password" name="otp_secret" placeholder="Insert secret key">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-eye"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>URL/Host</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="uri" placeholder="ex. google.com">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-relation">
|
||||
|
||||
<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" name="contact">
|
||||
<option value="">- Contact -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_client_id = $client_id ORDER BY contact_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$contact_id = intval($row['contact_id']);
|
||||
$contact_name = htmlentities($row['contact_name']);
|
||||
?>
|
||||
<option value="<?php echo $contact_id; ?>"><?php echo $contact_name; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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" name="vendor">
|
||||
<option value="">- Vendor -</option>
|
||||
<?php
|
||||
|
||||
$sql_vendors = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_client_id = $client_id ORDER BY vendor_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_vendors)) {
|
||||
$vendor_id = intval($row['vendor_id']);
|
||||
$vendor_name = htmlentities($row['vendor_name']);
|
||||
?>
|
||||
<option value="<?php echo $vendor_id; ?>"><?php echo $vendor_name; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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-tag"></i></span>
|
||||
</div>
|
||||
<select class="form-control" name="asset">
|
||||
<option value="">- Asset -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_client_id = $client_id ORDER BY asset_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$asset_id = intval($row['asset_id']);
|
||||
$asset_name = htmlentities($row['asset_name']);
|
||||
?>
|
||||
<option value="<?php echo $asset_id; ?>"><?php echo $asset_name; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>software</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-box"></i></span>
|
||||
</div>
|
||||
<select class="form-control" name="software">
|
||||
<option value="">- software -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM software WHERE software_client_id = $client_id ORDER BY software_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$software_id = intval($row['software_id']);
|
||||
$software_name = htmlentities($row['software_name']);
|
||||
?>
|
||||
<option value="<?php echo $software_id; ?>"><?php echo $software_name; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-notes">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="note"></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong> / <span class="text-secondary">Important?</span></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="name" placeholder="Name of Login" required autofocus>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="important" value="1">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Username</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="username" placeholder="Username">
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_login" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Password <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-lock"></i></span>
|
||||
</div>
|
||||
<input type="password" class="form-control" data-toggle="password" id="password" name="password" placeholder="Password" required autocomplete="new-password">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-eye"></i></span>
|
||||
</div>
|
||||
<div class="input-group-append">
|
||||
<span class="btn btn-default"><i class="fa fa-fw fa-question" onclick="generatePassword()"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>OTP</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="password" class="form-control" data-toggle="password" name="otp_secret" placeholder="Insert secret key">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-eye"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>URL/Host</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="uri" placeholder="ex. google.com">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-relation">
|
||||
|
||||
<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" name="contact">
|
||||
<option value="">- Contact -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_client_id = $client_id ORDER BY contact_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$contact_id = $row['contact_id'];
|
||||
$contact_name = htmlentities($row['contact_name']);
|
||||
?>
|
||||
<option value="<?php echo $contact_id; ?>"><?php echo $contact_name; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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" name="vendor">
|
||||
<option value="">- Vendor -</option>
|
||||
<?php
|
||||
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_client_id = $client_id ORDER BY vendor_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_vendors)) {
|
||||
$vendor_id = $row['vendor_id'];
|
||||
$vendor_name = htmlentities($row['vendor_name']);
|
||||
?>
|
||||
<option value="<?php echo $vendor_id; ?>"><?php echo $vendor_name; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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-tag"></i></span>
|
||||
</div>
|
||||
<select class="form-control" name="asset">
|
||||
<option value="">- Asset -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM assets WHERE asset_client_id = $client_id ORDER BY asset_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$asset_id = $row['asset_id'];
|
||||
$asset_name = htmlentities($row['asset_name']);
|
||||
?>
|
||||
<option value="<?php echo $asset_id; ?>"><?php echo $asset_name; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>software</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-box"></i></span>
|
||||
</div>
|
||||
<select class="form-control" name="software">
|
||||
<option value="">- software -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM software WHERE software_client_id = $client_id ORDER BY software_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$software_id = $row['software_id'];
|
||||
$software_name = htmlentities($row['software_name']);
|
||||
?>
|
||||
<option value="<?php echo $software_id; ?>"><?php echo $software_name; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-notes">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="note"></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_login" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Create</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,222 +1,214 @@
|
|||
<div class="modal" id="editLoginModal<?php echo $login_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-key"></i> Editing password: <strong><?php echo $login_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="login_id" value="<?php echo $login_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-key mr-2"></i>Editing password: <strong><?php echo $login_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="login_id" value="<?php echo $login_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 $login_id; ?>">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-relation<?php echo $login_id; ?>">Relation</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-notes<?php echo $login_id; ?>">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
<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 $login_id; ?>">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-relation<?php echo $login_id; ?>">Relation</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-notes<?php echo $login_id; ?>">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
<hr>
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-details<?php echo $login_id; ?>">
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-details<?php echo $login_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong> / <span class="text-secondary">Important?</span></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="name" placeholder="Name of Login" value="<?php echo $login_name; ?>" required>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="important" value="1" <?php if ($login_important == 1) { echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Username</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="username" placeholder="Username" value="<?php echo $login_username; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Password <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-lock"></i></span>
|
||||
</div>
|
||||
<input type="password" class="form-control" data-toggle="password" name="password" placeholder="Password" value="<?php echo $login_password; ?>" required autocomplete="new-password">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-eye"></i></span>
|
||||
</div>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-default clipboardjs" type="button" data-clipboard-text="<?php echo $login_password; ?>"><i class="fa fa-fw fa-copy"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>OTP</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="password" class="form-control" data-toggle="password" name="otp_secret" value="<?php echo $login_otp_secret; ?>" placeholder="Insert secret key">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-eye"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>URL/Host</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="uri" placeholder="ex. google.com" value="<?php echo $login_uri; ?>">
|
||||
<div class="input-group-append">
|
||||
|
||||
<a href="<?php echo $login_uri; ?>" class="input-group-text"><i class="fa fa-fw fa-link"></i></a>
|
||||
</div>
|
||||
<div class="input-group-append">
|
||||
<button class="input-group-text clipboardjs" type="button" data-clipboard-text="<?php echo $login_uri; ?>"><i class="fa fa-fw fa-copy"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-relation<?php echo $login_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" name="contact">
|
||||
<option value="">- Contact -</option>
|
||||
<?php
|
||||
|
||||
$sql_contacts = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_client_id = $client_id ORDER BY contact_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_contacts)) {
|
||||
$contact_id_select = intval($row['contact_id']);
|
||||
$contact_name_select = htmlentities($row['contact_name']);
|
||||
?>
|
||||
<option <?php if ($login_contact_id == $contact_id_select) { echo "selected"; } ?> value="<?php echo $contact_id_select; ?>"><?php echo $contact_name_select; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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 * FROM vendors WHERE vendor_client_id = $client_id ORDER BY vendor_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_vendors)) {
|
||||
$vendor_id_select = intval($row['vendor_id']);
|
||||
$vendor_name_select = htmlentities($row['vendor_name']);
|
||||
?>
|
||||
<option <?php if ($login_vendor_id == $vendor_id_select) { echo "selected"; } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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-tag"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="asset">
|
||||
<option value="0">- None -</option>
|
||||
<?php
|
||||
|
||||
$sql_assets = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_client_id = $client_id ORDER BY asset_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||
$asset_id_select = intval($row['asset_id']);
|
||||
$asset_name_select = htmlentities($row['asset_name']);
|
||||
?>
|
||||
<option <?php if ($login_asset_id == $asset_id_select) { echo "selected"; } ?> value="<?php echo $asset_id_select; ?>"><?php echo $asset_name_select; ?></option>
|
||||
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Software</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-box"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="software">
|
||||
<option value="0">- None -</option>
|
||||
<?php
|
||||
|
||||
$sql_software = mysqli_query($mysqli, "SELECT * FROM software WHERE software_client_id = $client_id ORDER BY software_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_software)) {
|
||||
$software_id_select = intval($row['software_id']);
|
||||
$software_name_select = htmlentities($row['software_name']);
|
||||
?>
|
||||
<option <?php if ($login_software_id == $software_id_select) { echo "selected"; } ?> value="<?php echo $software_id_select; ?>"><?php echo $software_name_select; ?></option>
|
||||
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-notes<?php echo $login_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="note"><?php echo $login_note; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong> / <span class="text-secondary">Important?</span></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="name" placeholder="Name of Login" value="<?php echo $login_name; ?>" required>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="important" value="1" <?php if ($login_important == 1) { echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Username</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="username" placeholder="Username" value="<?php echo $login_username; ?>">
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_login" 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>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Password <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-lock"></i></span>
|
||||
</div>
|
||||
<input type="password" class="form-control" data-toggle="password" name="password" placeholder="Password" value="<?php echo $login_password; ?>" required autocomplete="new-password">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-eye"></i></span>
|
||||
</div>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-default clipboardjs" type="button" data-clipboard-text="<?php echo $login_password; ?>"><i class="fa fa-fw fa-copy"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>OTP</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="password" class="form-control" data-toggle="password" name="otp_secret" value="<?php echo $login_otp_secret; ?>" placeholder="Insert secret key">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-eye"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>URL/Host</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="uri" placeholder="ex. google.com" value="<?php echo $login_uri; ?>">
|
||||
<div class="input-group-append">
|
||||
|
||||
<a href="<?php echo $login_uri; ?>" class="input-group-text"><i class="fa fa-fw fa-link"></i></a>
|
||||
</div>
|
||||
<div class="input-group-append">
|
||||
<button class="input-group-text clipboardjs" type="button" data-clipboard-text="<?php echo $login_uri; ?>"><i class="fa fa-fw fa-copy"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-relation<?php echo $login_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" name="contact">
|
||||
<option value="">- Contact -</option>
|
||||
<?php
|
||||
|
||||
$sql_contacts = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_client_id = $client_id ORDER BY contact_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_contacts)) {
|
||||
$contact_id_select = $row['contact_id'];
|
||||
$contact_name_select = htmlentities($row['contact_name']);
|
||||
?>
|
||||
<option <?php if ($login_contact_id == $contact_id_select) { echo "selected"; } ?> value="<?php echo $contact_id_select; ?>"><?php echo $contact_name_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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 * FROM vendors WHERE vendor_client_id = $client_id ORDER BY vendor_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_vendors)) {
|
||||
$vendor_id_select = $row['vendor_id'];
|
||||
$vendor_name_select = htmlentities($row['vendor_name']);
|
||||
?>
|
||||
<option <?php if ($login_vendor_id == $vendor_id_select) { echo "selected"; } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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-tag"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="asset">
|
||||
<option value="0">- None -</option>
|
||||
<?php
|
||||
|
||||
$sql_assets = mysqli_query($mysqli,"SELECT * FROM assets WHERE asset_client_id = $client_id ORDER BY asset_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||
$asset_id_select = $row['asset_id'];
|
||||
$asset_name_select = htmlentities($row['asset_name']);
|
||||
?>
|
||||
<option <?php if ($login_asset_id == $asset_id_select) { echo "selected"; } ?> value="<?php echo $asset_id_select; ?>"><?php echo $asset_name_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Software</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-box"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="software">
|
||||
<option value="0">- None -</option>
|
||||
<?php
|
||||
|
||||
$sql_software = mysqli_query($mysqli,"SELECT * FROM software WHERE software_client_id = $client_id ORDER BY software_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_software)) {
|
||||
$software_id_select = $row['software_id'];
|
||||
$software_name_select = htmlentities($row['software_name']);
|
||||
?>
|
||||
<option <?php if ($login_software_id == $software_id_select) { echo "selected"; } ?> value="<?php echo $software_id_select; ?>"><?php echo $software_name_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-notes<?php echo $login_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="note"><?php echo $login_note; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="edit_login" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -16,10 +16,11 @@
|
|||
<input type="file" class="form-control-file" name="file" accept=".csv">
|
||||
</div>
|
||||
<hr>
|
||||
<div>Download <a href="post.php?download_client_logins_csv_template=<?php echo $client_id; ?>">sample csv template</a></div>
|
||||
<div>Download <a class="text-bold" href="post.php?download_client_logins_csv_template=<?php echo $client_id; ?>">sample csv template</a></div>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="import_client_logins_csv" class="btn btn-primary">Import</button>
|
||||
<button type="submit" name="import_client_logins_csv" class="btn btn-primary"><i class="fa fa-upload mr-2"></i>Import</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,173 +1,177 @@
|
|||
<?php include("inc_all_client.php"); ?>
|
||||
|
||||
<?php
|
||||
|
||||
if (!empty($_GET['sb'])) {
|
||||
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
|
||||
}else{
|
||||
$sb = "login_name";
|
||||
}
|
||||
// Default Column Sortby Filter
|
||||
$sb = "login_name";
|
||||
$o = "ASC";
|
||||
|
||||
require_once("inc_all_client.php");
|
||||
|
||||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
$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 logins
|
||||
WHERE login_client_id = $client_id
|
||||
AND (login_name LIKE '%$q%' OR login_uri LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM logins
|
||||
WHERE login_client_id = $client_id
|
||||
AND (login_name LIKE '%$q%' OR login_uri LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to"
|
||||
);
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
|
||||
?>
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-key"></i> Passwords</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addLoginModal"><i class="fas fa-fw fa-plus"></i> New Login</button>
|
||||
</div>
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-key mr-2"></i>Passwords</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addLoginModal"><i class="fas fa-plus mr-2"></i>New Login</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="row">
|
||||
<form autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_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 strip_tags(htmlentities($q)); } ?>" placeholder="Search Passwords">
|
||||
<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="float-right">
|
||||
<a href="post.php?export_client_logins_csv=<?php echo $client_id; ?>" class="btn btn-default"><i class="fa fa-fw fa-download"></i> Export</a>
|
||||
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#importLoginModal"><i class="fa fa-fw fa-upload"></i> Import</button>
|
||||
</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-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=login_name&o=<?php echo $disp; ?>">Name</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=login_username&o=<?php echo $disp; ?>">Username</a></th>
|
||||
<th>Password</th>
|
||||
<th>OTP</th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=login_uri&o=<?php echo $disp; ?>">URI</a></th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$login_id = $row['login_id'];
|
||||
$login_name = htmlentities($row['login_name']);
|
||||
$login_uri = htmlentities($row['login_uri']);
|
||||
if (empty($login_uri)) {
|
||||
$login_uri_display = "-";
|
||||
}else{
|
||||
$login_uri_display = "$login_uri<button class='btn btn-sm clipboardjs' data-clipboard-text='$login_uri'><i class='far fa-copy text-secondary'></i></button><a href='https://$login_uri' target='_blank'><i class='fa fa-external-link-alt text-secondary'></i></a>";
|
||||
}
|
||||
$login_username = htmlentities(decryptLoginEntry($row['login_username']));
|
||||
if (empty($login_username)) {
|
||||
$login_username_display = "-";
|
||||
}else{
|
||||
$login_username_display = "$login_username<button class='btn btn-sm clipboardjs' data-clipboard-text='$login_username'><i class='far fa-copy text-secondary'></i></button>";
|
||||
}
|
||||
$login_password = htmlentities(decryptLoginEntry($row['login_password']));
|
||||
$login_otp_secret = htmlentities($row['login_otp_secret']);
|
||||
$login_id_with_secret = '"' . $row['login_id'] . '","' . $row['login_otp_secret'] . '"';
|
||||
if (empty($login_otp_secret)) {
|
||||
$otp_display = "-";
|
||||
}else{
|
||||
$otp_display = "<span onmouseenter='showOTP($login_id_with_secret)'><i class='far fa-clock'></i> <span id='otp_$login_id'><i>Hover..</i></span></span>";
|
||||
}
|
||||
$login_note = htmlentities($row['login_note']);
|
||||
$login_important = $row['login_important'];
|
||||
$login_contact_id = $row['login_contact_id'];
|
||||
$login_vendor_id = $row['login_vendor_id'];
|
||||
$login_asset_id = $row['login_asset_id'];
|
||||
$login_software_id = $row['login_software_id'];
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<i class="fa fa-fw fa-key text-secondary"></i>
|
||||
<a class="text-dark" href="#" data-toggle="modal" data-target="#editLoginModal<?php echo $login_id; ?>">
|
||||
<?php echo $login_name; ?>
|
||||
</a>
|
||||
</td>
|
||||
<td><?php echo $login_username_display; ?></td>
|
||||
<td>
|
||||
<a tabindex="0" href="#" data-toggle="popover" data-trigger="focus" data-placement="top" data-content="<?php echo $login_password; ?>"><i class="fas fa-2x fa-ellipsis-h text-secondary"></i><i class="fas fa-2x fa-ellipsis-h text-secondary"></i></a><button class="btn btn-sm clipboardjs" data-clipboard-text="<?php echo $login_password; ?>"><i class="far fa-copy text-secondary"></i></button>
|
||||
</td>
|
||||
<td><?php echo $otp_display; ?></td>
|
||||
<td><?php echo $login_uri_display; ?></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="#editLoginModal<?php echo $login_id; ?>">Edit</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#shareModal" onclick="populateShareModal(<?php echo "$client_id, 'Login', $login_id"; ?>)">Share</a>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="post.php?delete_login=<?php echo $login_id; ?>">Delete</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<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(htmlentities($q)); } ?>" placeholder="Search Passwords">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
<div class="col-md-8">
|
||||
<div class="float-right">
|
||||
<a href="post.php?export_client_logins_csv=<?php echo $client_id; ?>" class="btn btn-default"><i class="fa fa-fw fa-download mr-2"></i>Export</a>
|
||||
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#importLoginModal"><i class="fa fa-fw fa-upload mr-2"></i>Import</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
include("client_login_edit_modal.php");
|
||||
}
|
||||
</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-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=login_name&o=<?php echo $disp; ?>">Name</a></th>
|
||||
<th>Username</th>
|
||||
<th>Password</th>
|
||||
<th>OTP</th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=login_uri&o=<?php echo $disp; ?>">URI</a></th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
?>
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$login_id = intval($row['login_id']);
|
||||
$login_name = htmlentities($row['login_name']);
|
||||
$login_uri = htmlentities($row['login_uri']);
|
||||
if (empty($login_uri)) {
|
||||
$login_uri_display = "-";
|
||||
} else {
|
||||
$login_uri_display = "$login_uri<button class='btn btn-sm clipboardjs' data-clipboard-text='$login_uri'><i class='far fa-copy text-secondary'></i></button><a href='https://$login_uri' target='_blank'><i class='fa fa-external-link-alt text-secondary'></i></a>";
|
||||
}
|
||||
$login_username = htmlentities(decryptLoginEntry($row['login_username']));
|
||||
if (empty($login_username)) {
|
||||
$login_username_display = "-";
|
||||
} else {
|
||||
$login_username_display = "$login_username<button class='btn btn-sm clipboardjs' data-clipboard-text='$login_username'><i class='far fa-copy text-secondary'></i></button>";
|
||||
}
|
||||
$login_password = htmlentities(decryptLoginEntry($row['login_password']));
|
||||
$login_otp_secret = htmlentities($row['login_otp_secret']);
|
||||
$login_id_with_secret = '"' . $row['login_id'] . '","' . $row['login_otp_secret'] . '"';
|
||||
if (empty($login_otp_secret)) {
|
||||
$otp_display = "-";
|
||||
} else {
|
||||
$otp_display = "<span onmouseenter='showOTP($login_id_with_secret)'><i class='far fa-clock'></i> <span id='otp_$login_id'><i>Hover..</i></span></span>";
|
||||
}
|
||||
$login_note = htmlentities($row['login_note']);
|
||||
$login_important = intval($row['login_important']);
|
||||
$login_contact_id = intval($row['login_contact_id']);
|
||||
$login_vendor_id = intval($row['login_vendor_id']);
|
||||
$login_asset_id = intval($row['login_asset_id']);
|
||||
$login_software_id = intval($row['login_software_id']);
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php include("pagination.php"); ?>
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<i class="fa fa-fw fa-key text-secondary"></i>
|
||||
<a class="text-dark" href="#" data-toggle="modal" data-target="#editLoginModal<?php echo $login_id; ?>">
|
||||
<?php echo $login_name; ?>
|
||||
</a>
|
||||
</td>
|
||||
<td><?php echo $login_username_display; ?></td>
|
||||
<td>
|
||||
<a tabindex="0" href="#" data-toggle="popover" data-trigger="focus" data-placement="top" data-content="<?php echo $login_password; ?>"><i class="fas fa-2x fa-ellipsis-h text-secondary"></i><i class="fas fa-2x fa-ellipsis-h text-secondary"></i></a><button class="btn btn-sm clipboardjs" data-clipboard-text="<?php echo $login_password; ?>"><i class="far fa-copy text-secondary"></i></button>
|
||||
</td>
|
||||
<td><?php echo $otp_display; ?></td>
|
||||
<td><?php echo $login_uri_display; ?></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="#editLoginModal<?php echo $login_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#shareModal" onclick="populateShareModal(<?php echo "$client_id, 'Login', $login_id"; ?>)">
|
||||
<i class="fas fa-fw fa-share mr-2"></i>Share
|
||||
</a>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger text-bold" href="post.php?delete_login=<?php echo $login_id; ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
require("client_login_edit_modal.php");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php require_once("pagination.php"); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function showOTP(id, secret) {
|
||||
//Send a GET request to ajax.php as ajax.php?get_totp_token=true&totp_secret=SECRET
|
||||
jQuery.get(
|
||||
"ajax.php",
|
||||
{get_totp_token: 'true', totp_secret: secret},
|
||||
function(data) {
|
||||
//If we get a response from post.php, parse it as JSON
|
||||
const token = JSON.parse(data);
|
||||
<script>
|
||||
function showOTP(id, secret) {
|
||||
//Send a GET request to ajax.php as ajax.php?get_totp_token=true&totp_secret=SECRET
|
||||
jQuery.get(
|
||||
"ajax.php",
|
||||
{get_totp_token: 'true', totp_secret: secret},
|
||||
function(data) {
|
||||
//If we get a response from post.php, parse it as JSON
|
||||
const token = JSON.parse(data);
|
||||
|
||||
document.getElementById("otp_" + id).innerText = token
|
||||
document.getElementById("otp_" + id).innerText = token
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function generatePassword() {
|
||||
document.getElementById("password").value = "<?php echo randomString(); ?>"
|
||||
}
|
||||
</script>
|
||||
function generatePassword() {
|
||||
document.getElementById("password").value = "<?php echo randomString(); ?>"
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
||||
include("client_login_add_modal.php");
|
||||
include("share_modal.php");
|
||||
include("client_login_import_modal.php");
|
||||
|
||||
?>
|
||||
|
||||
<?php include("footer.php"); ?>
|
||||
require_once("client_login_add_modal.php");
|
||||
require_once("share_modal.php");
|
||||
require_once("client_login_import_modal.php");
|
||||
require_once("footer.php");
|
||||
|
|
|
|||
196
client_logs.php
196
client_logs.php
|
|
@ -1,113 +1,111 @@
|
|||
<?php include("inc_all_client.php"); ?>
|
||||
<?php
|
||||
|
||||
<?php
|
||||
// Default Column Sortby Filter
|
||||
$sb = "log_id";
|
||||
$o = "DESC";
|
||||
|
||||
if (!empty($_GET['sb'])) {
|
||||
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
|
||||
}else{
|
||||
$sb = "log_id";
|
||||
}
|
||||
|
||||
// Reverse default sort
|
||||
if (!isset($_GET['o'])) {
|
||||
$o = "DESC";
|
||||
$disp = "ASC";
|
||||
}
|
||||
require_once("inc_all_client.php");
|
||||
|
||||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
$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 logs
|
||||
LEFT JOIN users ON log_user_id = user_id
|
||||
WHERE (log_type LIKE '%$q%' OR log_action LIKE '%$q%' OR log_description LIKE '%$q%' OR log_ip LIKE '%$q%' OR log_user_agent LIKE '%$q%' OR user_name LIKE '%$q%')
|
||||
AND log_client_id = $client_id
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to"
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM logs
|
||||
LEFT JOIN users ON log_user_id = user_id
|
||||
WHERE (log_type LIKE '%$q%' OR log_action LIKE '%$q%' OR log_description LIKE '%$q%' OR log_ip LIKE '%$q%' OR log_user_agent LIKE '%$q%' OR user_name LIKE '%$q%')
|
||||
AND log_client_id = $client_id
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to"
|
||||
);
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
|
||||
?>
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-3">
|
||||
<h3 class="card-title"><i class="fa fa-fw fa-eye"></i> Audit Logs</h3>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_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 strip_tags(htmlentities($q)); } ?>" placeholder="Search Logs">
|
||||
<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>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
<div class="table-responsive border">
|
||||
<table class="table 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=log_created_at&o=<?php echo $disp; ?>">Timestamp</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=user_name&o=<?php echo $disp; ?>">User</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=log_type&o=<?php echo $disp; ?>">Type</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=log_action&o=<?php echo $disp; ?>">Action</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=log_description&o=<?php echo $disp; ?>">Description</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=log_ip&o=<?php echo $disp; ?>">IP Address</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=log_user_agent&o=<?php echo $disp; ?>">User Agent</a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$log_id = $row['log_id'];
|
||||
$log_type = htmlentities($row['log_type']);
|
||||
$log_action = htmlentities($row['log_action']);
|
||||
$log_description = htmlentities($row['log_description']);
|
||||
$log_ip = htmlentities($row['log_ip']);
|
||||
$log_user_agent = htmlentities($row['log_user_agent']);
|
||||
$log_user_os = getOS($log_user_agent);
|
||||
$log_user_browser = getWebBrowser($log_user_agent);
|
||||
$log_created_at = $row['log_created_at'];
|
||||
$user_id = $row['user_id'];
|
||||
$user_name = htmlentities($row['user_name']);
|
||||
if (empty($user_name)) {
|
||||
$user_name_display = "-";
|
||||
}else{
|
||||
$user_name_display = $user_name;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $log_created_at; ?></td>
|
||||
<td><?php echo $user_name_display; ?></td>
|
||||
<td><?php echo $log_type; ?></td>
|
||||
<td><?php echo $log_action; ?></td>
|
||||
<td><?php echo $log_description; ?></td>
|
||||
<td><?php echo $log_ip; ?></td>
|
||||
<td><?php echo "$log_user_os<br>$log_user_browser"; ?></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="card-header py-3">
|
||||
<h3 class="card-title"><i class="fa fa-fw fa-eye mr-2"></i>Audit Logs</h3>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_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(htmlentities($q)); } ?>" placeholder="Search Logs">
|
||||
<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>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
<div class="table-responsive border">
|
||||
<table class="table 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=log_created_at&o=<?php echo $disp; ?>">Timestamp</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=user_name&o=<?php echo $disp; ?>">User</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=log_type&o=<?php echo $disp; ?>">Type</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=log_action&o=<?php echo $disp; ?>">Action</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=log_description&o=<?php echo $disp; ?>">Description</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=log_ip&o=<?php echo $disp; ?>">IP Address</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=log_user_agent&o=<?php echo $disp; ?>">User Agent</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=log_entity_id&o=<?php echo $disp; ?>">Entity ID</a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$log_id = intval($row['log_id']);
|
||||
$log_type = htmlentities($row['log_type']);
|
||||
$log_action = htmlentities($row['log_action']);
|
||||
$log_description = htmlentities($row['log_description']);
|
||||
$log_ip = htmlentities($row['log_ip']);
|
||||
$log_user_agent = htmlentities($row['log_user_agent']);
|
||||
$log_user_os = getOS($log_user_agent);
|
||||
$log_user_browser = getWebBrowser($log_user_agent);
|
||||
$log_created_at = htmlentities($row['log_created_at']);
|
||||
$user_id = intval($row['user_id']);
|
||||
$user_name = htmlentities($row['user_name']);
|
||||
if (empty($user_name)) {
|
||||
$user_name_display = "-";
|
||||
} else {
|
||||
$user_name_display = $user_name;
|
||||
}
|
||||
$log_entity_id = intval($row['log_entity_id']);
|
||||
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $log_created_at; ?></td>
|
||||
<td><?php echo $user_name_display; ?></td>
|
||||
<td><?php echo $log_type; ?></td>
|
||||
<td><?php echo $log_action; ?></td>
|
||||
<td><?php echo $log_description; ?></td>
|
||||
<td><?php echo $log_ip; ?></td>
|
||||
<td><?php echo "$log_user_os<br>$log_user_browser"; ?></td>
|
||||
<td><?php echo $log_entity_id; ?></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php require_once("pagination.php"); ?>
|
||||
</div>
|
||||
<?php include("pagination.php"); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include("footer.php"); ?>
|
||||
<?php
|
||||
require_once("footer.php");
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue