mirror of
https://github.com/itflow-org/itflow
synced 2026-03-10 07:44:50 +00:00
Compare commits
350 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34397fe468 | ||
|
|
2f82647f5e | ||
|
|
7d7854424c | ||
|
|
eaeadbe933 | ||
|
|
cf3f0cee6c | ||
|
|
9f7c289e94 | ||
|
|
c2bba7a919 | ||
|
|
4bb37a7198 | ||
|
|
231694aabe | ||
|
|
2fb75e6d67 | ||
|
|
810af638a3 | ||
|
|
9223b8cfb1 | ||
|
|
b7df21a663 | ||
|
|
7d47ed4dbd | ||
|
|
65eaf92862 | ||
|
|
8a01bc0d7d | ||
|
|
1a8a3781dc | ||
|
|
eadfdc41c4 | ||
|
|
421abd4c5b | ||
|
|
ae1a0dcc73 | ||
|
|
63b8804e2d | ||
|
|
634afcc089 | ||
|
|
90f5c8ad57 | ||
|
|
12fd45c144 | ||
|
|
382258a27c | ||
|
|
b5fa8ab4de | ||
|
|
bbb0db2f4f | ||
|
|
5b89e3dbee | ||
|
|
07b29a7bdc | ||
|
|
3286343026 | ||
|
|
6a26b611fa | ||
|
|
218fd2dcdc | ||
|
|
4c85db5e49 | ||
|
|
85ae42190a | ||
|
|
df8a755462 | ||
|
|
53713a0318 | ||
|
|
61aa477cbf | ||
|
|
c2adb92d28 | ||
|
|
19b2b08eac | ||
|
|
504346256f | ||
|
|
34e92d2223 | ||
|
|
573953704c | ||
|
|
0b9f10985d | ||
|
|
8e3dd42a32 | ||
|
|
0647933df7 | ||
|
|
93f4da3962 | ||
|
|
f72351ea88 | ||
|
|
d3c4c8c846 | ||
|
|
cf047024a1 | ||
|
|
ad3ed68932 | ||
|
|
62b8ee9d30 | ||
|
|
eedd92c894 | ||
|
|
622d5e5a44 | ||
|
|
475d653979 | ||
|
|
19a6f8f422 | ||
|
|
e69d69760d | ||
|
|
06de349fac | ||
|
|
c3ec83f640 | ||
|
|
37c20e4e0d | ||
|
|
400ba5bb20 | ||
|
|
a1ea5214a9 | ||
|
|
aae633c4ac | ||
|
|
ec8d7a36a8 | ||
|
|
21dc26b06f | ||
|
|
6a8d2cf1d4 | ||
|
|
b803ba4c55 | ||
|
|
4378fc2719 | ||
|
|
244e1290b4 | ||
|
|
5a64bd3a32 | ||
|
|
cc0b2126ba | ||
|
|
97f92e508e | ||
|
|
09fbe4e4ad | ||
|
|
508af6a80f | ||
|
|
073f816dbd | ||
|
|
bf327afd19 | ||
|
|
8fb8ce319e | ||
|
|
eabfef22be | ||
|
|
06c31e0808 | ||
|
|
509fb5cfed | ||
|
|
f1aa66119a | ||
|
|
7150b1545a | ||
|
|
59bbbe4a8d | ||
|
|
f64641cfdd | ||
|
|
f1783a6110 | ||
|
|
c8c1155c9c | ||
|
|
338a08da6c | ||
|
|
15aed891f4 | ||
|
|
c1c54780cb | ||
|
|
e93704bbdb | ||
|
|
c0db914213 | ||
|
|
b78e31e518 | ||
|
|
2533f0ced1 | ||
|
|
c7f4e48a27 | ||
|
|
87c1a95b06 | ||
|
|
4efb39358a | ||
|
|
619b93a545 | ||
|
|
a0598997d7 | ||
|
|
d0b8095bba | ||
|
|
daab1bca3d | ||
|
|
a0a2fddd90 | ||
|
|
f61c30bd5a | ||
|
|
4921d1eb19 | ||
|
|
28c8b1a6da | ||
|
|
3f0a6df717 | ||
|
|
07c8398e0d | ||
|
|
82c7a64a25 | ||
|
|
164a6a5604 | ||
|
|
9b6ea851e7 | ||
|
|
3804e18e53 | ||
|
|
244a47efad | ||
|
|
89e59b2448 | ||
|
|
bf9c2f6de7 | ||
|
|
ff80a3db3f | ||
|
|
c7d00d7b0d | ||
|
|
1c6e74b08e | ||
|
|
f8d054f8aa | ||
|
|
e5dc50ec35 | ||
|
|
e0dfaf2d22 | ||
|
|
757a62c35b | ||
|
|
52a62fc23c | ||
|
|
44b70d7161 | ||
|
|
ad9e4b4fb4 | ||
|
|
4fdd5ae769 | ||
|
|
9f2b9e3b3e | ||
|
|
2c074e9dc4 | ||
|
|
0fad31d683 | ||
|
|
b154930a4c | ||
|
|
359b04e7d1 | ||
|
|
cc00e3bf75 | ||
|
|
0454685039 | ||
|
|
b5eb325c5e | ||
|
|
ed6276a3e4 | ||
|
|
5da1310e34 | ||
|
|
a69b09c9e6 | ||
|
|
8da3bb15e9 | ||
|
|
8488445bf4 | ||
|
|
546d21adac | ||
|
|
580f50b187 | ||
|
|
4744276f2a | ||
|
|
6106b8aebb | ||
|
|
dd2b203321 | ||
|
|
7994c9c7a8 | ||
|
|
ae59aa3326 | ||
|
|
0ab9a1c97d | ||
|
|
2908568e2a | ||
|
|
2b673a1b6c | ||
|
|
bece8abfe2 | ||
|
|
ac2b355399 | ||
|
|
7e658ee1f2 | ||
|
|
bbee81c3bb | ||
|
|
45b61ba335 | ||
|
|
32e6345cbc | ||
|
|
afff46972a | ||
|
|
d197995226 | ||
|
|
09fa23519d | ||
|
|
9da736daee | ||
|
|
410d1e0f86 | ||
|
|
12ad7962c0 | ||
|
|
397ebc5112 | ||
|
|
d48823925a | ||
|
|
6f49f16f6b | ||
|
|
c2664a2888 | ||
|
|
4529a56d7b | ||
|
|
fded8177c5 | ||
|
|
e670a9847a | ||
|
|
8aada99f06 | ||
|
|
04e624cc14 | ||
|
|
55ebe70808 | ||
|
|
f23afdd85c | ||
|
|
bac76871c1 | ||
|
|
56cbcf2921 | ||
|
|
f2dc25aedb | ||
|
|
2367ca2255 | ||
|
|
f28c1ce398 | ||
|
|
6cc6e80f92 | ||
|
|
9aeda2ce53 | ||
|
|
a08393b4d4 | ||
|
|
02c1446cb8 | ||
|
|
8e66434ec4 | ||
|
|
66d43d8a95 | ||
|
|
6c7052ea0d | ||
|
|
a994bb7e8c | ||
|
|
9b109c7abd | ||
|
|
95855fc22e | ||
|
|
3218ea85b2 | ||
|
|
a1831c7406 | ||
|
|
c022e5fe32 | ||
|
|
2cddda5062 | ||
|
|
daeb71abb3 | ||
|
|
915161d812 | ||
|
|
0e3959ce00 | ||
|
|
8d05633d7d | ||
|
|
2d39f21b51 | ||
|
|
69850f83d3 | ||
|
|
7e041d52df | ||
|
|
58a8f08bd2 | ||
|
|
8eea19d03d | ||
|
|
5d18e85d62 | ||
|
|
8a13207327 | ||
|
|
2a974c28b0 | ||
|
|
9b5eb86cac | ||
|
|
86212ee088 | ||
|
|
e0a1e45928 | ||
|
|
5c3e0f0c31 | ||
|
|
25db6c6e03 | ||
|
|
87779e5c10 | ||
|
|
94ff910564 | ||
|
|
1b59eef9e2 | ||
|
|
b10d757b77 | ||
|
|
4dd55df7a8 | ||
|
|
554c4d99bb | ||
|
|
17920e3cda | ||
|
|
073713a6a2 | ||
|
|
43c8e0785a | ||
|
|
22cd28de98 | ||
|
|
c1548ce83d | ||
|
|
64f3df6baf | ||
|
|
ab3ffdf7fc | ||
|
|
162ce8261a | ||
|
|
fe68a1f641 | ||
|
|
713bd0dab7 | ||
|
|
fc00b5e78f | ||
|
|
2795b4e15e | ||
|
|
7628fc2643 | ||
|
|
15d7875369 | ||
|
|
a5d69d47ee | ||
|
|
d76d405d5a | ||
|
|
70495ef298 | ||
|
|
7f5893a627 | ||
|
|
4c02a4e8c2 | ||
|
|
afdb4c06da | ||
|
|
2fe8adcfca | ||
|
|
a2c77cf0c2 | ||
|
|
eab441da06 | ||
|
|
19daa289b2 | ||
|
|
d228c30b03 | ||
|
|
a5ff978a77 | ||
|
|
78cfda1dbc | ||
|
|
78ae44c334 | ||
|
|
e6e30dcd7c | ||
|
|
17489e60c8 | ||
|
|
f723450d51 | ||
|
|
f8e4163c2f | ||
|
|
1dee1b4abb | ||
|
|
6f8cc40167 | ||
|
|
88ee9b60e7 | ||
|
|
a9e3e4744d | ||
|
|
b9f6871bae | ||
|
|
f920b8fac9 | ||
|
|
d8955f1f2d | ||
|
|
43b50c44b1 | ||
|
|
f6e33d5892 | ||
|
|
206dfc2426 | ||
|
|
2467274f7b | ||
|
|
e02d45db3e | ||
|
|
650b8754e8 | ||
|
|
64a6b7dc39 | ||
|
|
7aa773b336 | ||
|
|
a8b63ed429 | ||
|
|
08f2a307d3 | ||
|
|
72a84af1a7 | ||
|
|
a8f682286a | ||
|
|
b0a79c1b6f | ||
|
|
ccec330ceb | ||
|
|
093fd69415 | ||
|
|
3cf33afac4 | ||
|
|
5f7b297cf1 | ||
|
|
b6ffa0595d | ||
|
|
4a3154baca | ||
|
|
ca0b1a1fb7 | ||
|
|
5f02bc07aa | ||
|
|
7c070e3929 | ||
|
|
ed0b192f5b | ||
|
|
36e1df93bb | ||
|
|
615604661c | ||
|
|
9458c1cc7a | ||
|
|
298a584377 | ||
|
|
74a1603943 | ||
|
|
117861034a | ||
|
|
7452e8f08e | ||
|
|
5ed5473b36 | ||
|
|
2e9e49a203 | ||
|
|
c81b430318 | ||
|
|
33beae68e5 | ||
|
|
1b8cd5630a | ||
|
|
b8d17be015 | ||
|
|
fe762ef926 | ||
|
|
8d8b0f4a48 | ||
|
|
a2e16f918c | ||
|
|
228a457518 | ||
|
|
f0cc9412bb | ||
|
|
7509301f5c | ||
|
|
d97da07cb1 | ||
|
|
2ec38606e0 | ||
|
|
2c85922788 | ||
|
|
fc24bcb24f | ||
|
|
08ebedef03 | ||
|
|
eac46d0da0 | ||
|
|
a69b60703b | ||
|
|
4ed0767f1c | ||
|
|
72ae7843f6 | ||
|
|
d92b803526 | ||
|
|
506783f022 | ||
|
|
2fe7bf6870 | ||
|
|
c36fb6ae12 | ||
|
|
55c761b11e | ||
|
|
a769993fa8 | ||
|
|
6df3a35766 | ||
|
|
abd985d0f4 | ||
|
|
db5cfed96f | ||
|
|
9ce502c1b9 | ||
|
|
0172895e3c | ||
|
|
a29bfc3cb5 | ||
|
|
341ff69c58 | ||
|
|
66ab0d3f11 | ||
|
|
b147bc46cf | ||
|
|
11203f1ad2 | ||
|
|
ee2e4b671d | ||
|
|
65bb1b4007 | ||
|
|
cdc0422d31 | ||
|
|
1bbf7c7662 | ||
|
|
1ca31662f8 | ||
|
|
3de97fcd15 | ||
|
|
9218d828b0 | ||
|
|
4ed9c5cfb8 | ||
|
|
17cd1fd0c1 | ||
|
|
c7b9c95d0d | ||
|
|
c0360f4e68 | ||
|
|
571ed4818e | ||
|
|
04226101af | ||
|
|
b50c2295a6 | ||
|
|
75e002a054 | ||
|
|
e6c18970b3 | ||
|
|
00a9c53fc4 | ||
|
|
942f5bff52 | ||
|
|
e3ae8df4d8 | ||
|
|
f4eaba4384 | ||
|
|
9ee159c458 | ||
|
|
180635f318 | ||
|
|
e498cc6036 | ||
|
|
b6e0990a78 | ||
|
|
04fac54987 | ||
|
|
b31d1eba6a | ||
|
|
dec91d116a | ||
|
|
1fb243df11 | ||
|
|
c02b267d44 | ||
|
|
ed5aa9a0c2 | ||
|
|
3e0e72dedc | ||
|
|
3aa26226e5 | ||
|
|
bb787cdc70 |
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -1 +1 @@
|
|||||||
custom: ["https://donate.itflow.org"]
|
custom: ["https://services.itflow.org"]
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -26,3 +26,4 @@ xcustom/*
|
|||||||
!xcustom/readme.php
|
!xcustom/readme.php
|
||||||
post/xcustom
|
post/xcustom
|
||||||
!post/xcustom/readme.php
|
!post/xcustom/readme.php
|
||||||
|
.zed
|
||||||
|
|||||||
134
CHANGELOG.md
134
CHANGELOG.md
@@ -2,6 +2,140 @@
|
|||||||
|
|
||||||
This file documents all notable changes made to ITFlow.
|
This file documents all notable changes made to ITFlow.
|
||||||
|
|
||||||
|
## [25.03]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Resolved missing attachments in ticket replies processed via the email parser.
|
||||||
|
- Fixed issue where the top half of portrait image uploads appeared cut off at the bottom.
|
||||||
|
- Ensured all tables and fields use `CHARACTER SET utf8mb4` and `COLLATE utf8mb4_general_ci` for updates and new installations.
|
||||||
|
- Converted `service_domains` table to use InnoDB instead of MyISAM.
|
||||||
|
- Fixed the initials function to properly handle UTF-8 characters, preventing contact-related issues.
|
||||||
|
- Interfaces can now start with `0`.
|
||||||
|
- Adjusted AI prompt handling to focus solely on content, avoiding unnecessary additions.
|
||||||
|
|
||||||
|
### Added / Changed
|
||||||
|
- Introduced bulk delete functionality for assets.
|
||||||
|
- Added the ability to redact ticket replies after a ticket is closed.
|
||||||
|
- Added support for redacting specific text while a ticket is open.
|
||||||
|
- Switched file upload hashing from SHA256 to MD5 to significantly improve performance.
|
||||||
|
- Enabled assigning multiple assets to a single ticket.
|
||||||
|
- Updated all many-to-many tables to support cascading deletes using foreign key associations, improving efficiency, performance, and data integrity.
|
||||||
|
- Enabled caching for AJAX modals to reduce repeated reloads and enhance browser performance.
|
||||||
|
- Upgraded DataTables from 2.2.1 to 2.2.2.
|
||||||
|
- Upgraded TinyMCE from 7.6.1 to 7.7.1, providing a significant performance boost.
|
||||||
|
- Added “Copy Credentials to Clipboard” button in AJAX asset and contact views.
|
||||||
|
- Renamed and reorganized several tables.
|
||||||
|
- Improved theme color organization by grouping primary colors and their related shades.
|
||||||
|
- Displayed a user icon next to contacts who have user accounts.
|
||||||
|
- New image uploads are now converted to optimized `.webp` format by default; original files are no longer saved. Existing images remain unchanged.
|
||||||
|
- Added international phone number support throughout the system.
|
||||||
|
- Introduced user signatures in preferences, which are now appended to all ticket replies.
|
||||||
|
- Optimized search filters to only display defined tags.
|
||||||
|
- Added “Projects” to the client-side navigation.
|
||||||
|
- Enabled “Create New Ticket” from within project details.
|
||||||
|
- Reintroduced batch payment functionality in client invoices.
|
||||||
|
- Included client abbreviations in both client and global search options.
|
||||||
|
- Added assigned software license details (User/Asset) to the client PDF export.
|
||||||
|
- Replaced client-side `pdfMake` with the PHP-based `TCPDF` library for generating client export runbooks.
|
||||||
|
- Introduced the ability to download documents as PDFs.
|
||||||
|
- Added a “Reference” field to tickets and invoices generated from recurring templates (not yet in active use).
|
||||||
|
|
||||||
|
### Breaking Changes
|
||||||
|
> **Important:** To update to this version, you **must** run the following commands from the command line from the scripts directory:
|
||||||
|
>
|
||||||
|
> ```bash
|
||||||
|
> php update_cli.php
|
||||||
|
> php update_cli.php --db_update
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> Repeat `--db_update` until no further updates are found.
|
||||||
|
>
|
||||||
|
> **Back up your system before upgrading.**
|
||||||
|
> This version includes numerous backend changes critical for future development.
|
||||||
|
|
||||||
|
## [25.02.4]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Resolved issue preventing the addition or editing of licenses when no vendor was selected.
|
||||||
|
- Fixed several undeclared variables in AJAX contact details.
|
||||||
|
- Corrected the contact ticket count display.
|
||||||
|
- Addressed an issue where clicking "More Details" in AJAX contact/asset details failed to include the `client_id` in the URL.
|
||||||
|
- Fixed an issue with recurring invoices in the client URL: clicking "Inactive" or "Active" would unexpectedly navigate away from the client section.
|
||||||
|
- Added new php function getFieldById() to return a record using just an id and sanitized as well.
|
||||||
|
|
||||||
|
## [25.02.3]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Fixed notifications being reversed as dismissed notifications.
|
||||||
|
|
||||||
|
## [25.02.2]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Corrected some edit modals not showing notes correctly.
|
||||||
|
- Bugfix: When exporting to CSV, the first asset wasn't being shown.
|
||||||
|
- Fix broken create / edit credentials.
|
||||||
|
- Fixed missing Notificatons link.
|
||||||
|
- Fixed a few dead links.
|
||||||
|
- Fixed Overdue count also counting Non-Billable Invoices.
|
||||||
|
- Fix Edit Client Notes.
|
||||||
|
|
||||||
|
### Added / Changed
|
||||||
|
- Implemented SSL certificate history tracking.
|
||||||
|
- Added Inactive / Active Filter to Recurring Invoices.
|
||||||
|
- Merged Dismissed notifications and notification in one.
|
||||||
|
- Added Link Button to addd / edit Document WYSIWYG.
|
||||||
|
- Added Physical location to the asset export / import.
|
||||||
|
|
||||||
|
## [25.02.1]
|
||||||
|
### Fixed
|
||||||
|
- Resolved broken links in the client overview, project and client listings, and rack details.
|
||||||
|
- Corrected asset transfer functionality to clients.
|
||||||
|
- Fixed the ticket scheduling redirect.
|
||||||
|
- Corrected the ticket link in the Scheduled Ticket Agent Notification email.
|
||||||
|
- Addressed issues with credentials and ticket actions in the Contact Detail Modal.
|
||||||
|
- Fixed text wrapping in notifications.
|
||||||
|
- Adjusted notifications so that they are sorted with the newest first.
|
||||||
|
- Fixed drag-and-drop functionality for tickets in the Kanban view on mobile devices.
|
||||||
|
- Resolved a weird issue with TinyMCE that prevented using links referencing your ITFlow instance url.
|
||||||
|
- Corrected image orientation issues during upload and the preview optimization process.
|
||||||
|
|
||||||
|
### Added / Changed
|
||||||
|
- Introduced entity link indicator icons and counts in the contacts and credentials section.
|
||||||
|
- Implemented a fade animation for the new AJAX modal.
|
||||||
|
- Removed the Client Overview Expire Day Select and replaced it with simplified 1, 7, or 45-day options.
|
||||||
|
- Added the ability to link and unlink entities within asset details.
|
||||||
|
- Introduced quick tag/category creation across the app.
|
||||||
|
- Added a Vendor Quick Details Modal.
|
||||||
|
- Enabled vendor linking and added a License Purchase Reference in the Software Licenses section.
|
||||||
|
- Added download original, optimized and thumbnail option for images.
|
||||||
|
- Added Paid status to the top corner of Invoice PDFs.
|
||||||
|
|
||||||
|
## [25.02]
|
||||||
|
### Fixed
|
||||||
|
- Migrated several reports to the new permissions/roles system.
|
||||||
|
- Resolved issue with empty task box showing for closed/resolved tickets.
|
||||||
|
- Corrected ticket priority sorting.
|
||||||
|
- Cloned asset interfaces when transferring assets between clients.
|
||||||
|
|
||||||
|
### Added / Changed
|
||||||
|
- Restored max number of records per page option back to 500 since we dont have repeating modals.
|
||||||
|
- Bulk Categorize Tickets feature.
|
||||||
|
- Renamed "Interface port" to "Interface Description." "Interface Name" should now refer to port name and/or number.
|
||||||
|
- Changed "Transfer Asset to Client" from a single action to a bulk action.
|
||||||
|
- Updated Filter Footer UI to show "Showing x to x of x records" instead of just the total records.
|
||||||
|
- Added Client Overview section to view client assets, contacts, licenses, credentials, etc.
|
||||||
|
- Introduced Quick Peek for asset details, contact information, and document viewing throughout the ITFlow App, all made possible by AJAX.
|
||||||
|
- Enabled Simple Drag-and-Drop Ordering for Invoices, Recurring Invoices, Quotes, Ticket Tasks, and Ticket Template Tasks.
|
||||||
|
- Added new Ticket View options: Kanban and Simple View.
|
||||||
|
- Migrated all repeating modals to the new AJAX modal function for faster loading times and quicker development.
|
||||||
|
- Allowed clients to upload PDF documents to accepted quotes.
|
||||||
|
- Client Portal now shows ticket category.
|
||||||
|
- Custom links can now be added to the Client Portal navbar.
|
||||||
|
- Lots of little tweaks to UI, performance, bugs, etc.
|
||||||
|
|
||||||
|
### Breaking Changes
|
||||||
|
- Cron scripts have officially been moved to the /scripts folder and are no longer in the root directory; they must be updated to function properly.
|
||||||
|
|
||||||
## [25.01.3]
|
## [25.01.3]
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fixed ticket assignment modal showing client contacts.
|
- Fixed ticket assignment modal showing client contacts.
|
||||||
|
|||||||
17
accounts.php
17
accounts.php
@@ -85,7 +85,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><a class="text-dark" href="#" data-toggle="modal" data-target="#editAccountModal<?php echo $account_id; ?>"><?php echo $account_name; ?></a></td>
|
<td>
|
||||||
|
<a class="text-dark" href="#"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-ajax-url="ajax/ajax_account_edit.php"
|
||||||
|
data-ajax-id="<?php echo $account_id; ?>"
|
||||||
|
>
|
||||||
|
<?php echo $account_name; ?>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
<td><?php echo $account_currency_code; ?></td>
|
<td><?php echo $account_currency_code; ?></td>
|
||||||
<td class="text-right"><?php echo numfmt_format_currency($currency_format, $balance, $account_currency_code); ?></td>
|
<td class="text-right"><?php echo numfmt_format_currency($currency_format, $balance, $account_currency_code); ?></td>
|
||||||
<td>
|
<td>
|
||||||
@@ -94,7 +102,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<i class="fas fa-ellipsis-h"></i>
|
<i class="fas fa-ellipsis-h"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editAccountModal<?php echo $account_id; ?>">
|
<a class="dropdown-item" href="#"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-ajax-url="ajax/ajax_account_edit.php"
|
||||||
|
data-ajax-id="<?php echo $account_id; ?>"
|
||||||
|
>
|
||||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||||
</a>
|
</a>
|
||||||
<?php if ($balance == 0 && $account_id != $config_stripe_account) { //Cannot Archive an Account until it reaches 0 Balance and cant be selected as an online account ?>
|
<?php if ($balance == 0 && $account_id != $config_stripe_account) { //Cannot Archive an Account until it reaches 0 Balance and cant be selected as an online account ?>
|
||||||
@@ -109,7 +121,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require "modals/account_edit_modal.php";
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@@ -1,153 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once "includes/inc_all_admin.php";
|
|
||||||
|
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
|
||||||
LEFT JOIN clients ON client_id = contact_client_id
|
|
||||||
WHERE client_archived_at IS NULL
|
|
||||||
AND contact_archived_at IS NULL
|
|
||||||
AND contact_email != ''
|
|
||||||
AND (contact_primary = 1 OR
|
|
||||||
contact_important = 1 OR
|
|
||||||
contact_billing = 1 OR
|
|
||||||
contact_technical = 1)
|
|
||||||
ORDER BY client_name ASC, contact_primary DESC,
|
|
||||||
contact_important DESC"
|
|
||||||
);
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title mt-2 mb-2"><i class="fa fa-fw fa-envelope-open mr-2"></i>Bulk Mail</h3>
|
|
||||||
<div class="card-tools">
|
|
||||||
<button id="bulkActionButton" hidden class="btn btn-primary" type="submit" form='bulkActions' name="send_bulk_mail_now">
|
|
||||||
<i class="fas fa-fw fa-paper-plane mr-2"></i>Send (<span id="selectedCount">0</span>)
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<form id="bulkActions" action="post.php" method="post">
|
|
||||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
|
|
||||||
<div class="col">
|
|
||||||
|
|
||||||
<h5>Email Message</h5>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<select type="text" class="form-control select2" name="mail_from">
|
|
||||||
<option value="<?php echo nullable_htmlentities($config_mail_from_email); ?>">
|
|
||||||
<?php echo nullable_htmlentities("$config_mail_from_name - $config_mail_from_email"); ?></option>
|
|
||||||
<option value="<?php echo nullable_htmlentities($config_invoice_from_email); ?>">
|
|
||||||
<?php echo nullable_htmlentities("$config_invoice_from_name - $config_invoice_from_email"); ?></option>
|
|
||||||
<option value="<?php echo nullable_htmlentities($config_quote_from_email); ?>">
|
|
||||||
<?php echo nullable_htmlentities("$config_quote_from_name - $config_quote_from_email"); ?></option>
|
|
||||||
<option value="<?php echo nullable_htmlentities($config_ticket_from_email); ?>">
|
|
||||||
<?php echo nullable_htmlentities("$config_ticket_from_name - $config_ticket_from_email"); ?></option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<input type="text" class="form-control" name="mail_from_name" placeholder="From Name" value="<?php echo nullable_htmlentities($config_mail_from_name); ?>" required>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<input type="text" class="form-control" name="subject" placeholder="Subject" required>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<textarea class="form-control tinymce" name="body" placeholder="Type an email in here"></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-calendar"></i></span>
|
|
||||||
</div>
|
|
||||||
<input type="datetime-local" class="form-control" name="queued_at">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col">
|
|
||||||
|
|
||||||
<h5>Select Contacts</h5>
|
|
||||||
<hr>
|
|
||||||
<div class="card">
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<div class="form-check">
|
|
||||||
<input type="checkbox" class="form-check-input" id="selectAllCheckbox" onclick="checkAll(this)">
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<th>Client</th>
|
|
||||||
<th>Name</th>
|
|
||||||
<th>Title</th>
|
|
||||||
<th>Email</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
|
||||||
$contact_id = intval($row['contact_id']);
|
|
||||||
$contact_name = nullable_htmlentities($row['contact_name']);
|
|
||||||
$contact_title = nullable_htmlentities($row['contact_title']);
|
|
||||||
if (empty($contact_title)) {
|
|
||||||
$contact_title_display = "-";
|
|
||||||
} else {
|
|
||||||
$contact_title_display = "$contact_title";
|
|
||||||
}
|
|
||||||
$contact_email = nullable_htmlentities($row['contact_email']);
|
|
||||||
$contact_primary = intval($row['contact_primary']);
|
|
||||||
$contact_important = intval($row['contact_important']);
|
|
||||||
$contact_billing = intval($row['contact_billing']);
|
|
||||||
$contact_technical = intval($row['contact_technical']);
|
|
||||||
$contact_client_id = intval($row['contact_client_id']);
|
|
||||||
$client_name = nullable_htmlentities($row['client_name']);
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<div class="form-check">
|
|
||||||
<input type="checkbox" class="form-check-input bulk-select" name="contact_ids[]" value="<?php echo $contact_id; ?>">
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td><?php echo $client_name; ?></td>
|
|
||||||
<td>
|
|
||||||
<a href="client_contact_details.php?client_id=<?php echo $contact_client_id; ?>&contact_id=<?php echo $contact_id; ?>" target="_blank">
|
|
||||||
<?php echo $contact_name; ?>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td><?php echo $contact_title_display; ?></td>
|
|
||||||
<td><?php echo $contact_email; ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php } ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<script src="js/bulk_actions.js"></script>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
require_once "includes/footer.php";
|
|
||||||
@@ -33,7 +33,6 @@ if (isset($_GET['archived'])) {
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
<div class="card card-dark">
|
<div class="card card-dark">
|
||||||
<div class="card-header py-2">
|
<div class="card-header py-2">
|
||||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-list-ul mr-2"></i>
|
<h3 class="card-title mt-2"><i class="fa fa-fw fa-list-ul mr-2"></i>
|
||||||
@@ -134,10 +133,15 @@ if (isset($_GET['archived'])) {
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a class="text-dark" href="#" data-toggle="modal"
|
<td>
|
||||||
data-target="#editCategoryModal<?php echo $category_id; ?>">
|
<a class="text-dark" href="#"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-ajax-url="ajax/ajax_category_edit.php"
|
||||||
|
data-ajax-id="<?php echo $category_id; ?>"
|
||||||
|
>
|
||||||
<?php echo $category_name; ?>
|
<?php echo $category_name; ?>
|
||||||
</a></td>
|
</a>
|
||||||
|
</td>
|
||||||
<td><i class="fa fa-3x fa-circle" style="color:<?php echo $category_color; ?>;"></i></td>
|
<td><i class="fa fa-3x fa-circle" style="color:<?php echo $category_color; ?>;"></i></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="dropdown dropleft text-center">
|
<div class="dropdown dropleft text-center">
|
||||||
@@ -159,8 +163,11 @@ if (isset($_GET['archived'])) {
|
|||||||
<?php
|
<?php
|
||||||
} else {
|
} else {
|
||||||
?>
|
?>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal"
|
<a class="dropdown-item" href="#"
|
||||||
data-target="#editCategoryModal<?php echo $category_id; ?>">
|
data-toggle="ajax-modal"
|
||||||
|
data-ajax-url="ajax/ajax_category_edit.php"
|
||||||
|
data-ajax-id="<?php echo $category_id; ?>"
|
||||||
|
>
|
||||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item text-danger confirm-link"
|
<a class="dropdown-item text-danger confirm-link"
|
||||||
@@ -177,8 +184,6 @@ if (isset($_GET['archived'])) {
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require "modals/admin_category_edit_modal.php";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -193,5 +198,4 @@ if (isset($_GET['archived'])) {
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/admin_category_add_modal.php";
|
require_once "modals/admin_category_add_modal.php";
|
||||||
|
|
||||||
require_once "includes/footer.php";
|
require_once "includes/footer.php";
|
||||||
|
|||||||
@@ -96,16 +96,21 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$custom_link_location = intval($row['custom_link_location']);
|
$custom_link_location = intval($row['custom_link_location']);
|
||||||
if ($custom_link_location == 1) {
|
if ($custom_link_location == 1) {
|
||||||
$custom_link_location_display = "Main Side Nav";
|
$custom_link_location_display = "Main Side Nav";
|
||||||
} else {
|
} elseif ($custom_link_location == 2) {
|
||||||
$custom_link_location_display = "Top Nav";
|
$custom_link_location_display = "Top Nav";
|
||||||
|
} elseif ($custom_link_location == 3) {
|
||||||
|
$custom_link_location_display = "Client Portal Nav";
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="#" data-toggle="modal" data-target="#editLinkModal<?php echo $custom_link_id; ?>">
|
<a href="#"
|
||||||
<i class="fa fa-fw fa-<?php echo $custom_link_icon; ?> mr-2"></i>
|
data-toggle="ajax-modal"
|
||||||
<?php echo $custom_link_name;?>
|
data-ajax-url="ajax/ajax_custom_link_edit.php"
|
||||||
|
data-ajax-id="<?php echo $custom_link_id; ?>"
|
||||||
|
>
|
||||||
|
<i class="fa fa-fw fa-<?php echo $custom_link_icon; ?> mr-2"></i><?php echo $custom_link_name;?>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td><?php echo $custom_link_order_display; ?></td>
|
<td><?php echo $custom_link_order_display; ?></td>
|
||||||
@@ -117,7 +122,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<i class="fas fa-ellipsis-h"></i>
|
<i class="fas fa-ellipsis-h"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editLinkModal<?php echo $custom_link_id; ?>">
|
<a class="dropdown-item" href="#" data-toggle="ajax-modal" data-ajax-url="ajax/ajax_custom_link_edit.php" data-ajax-id="<?php echo $custom_link_id; ?>">
|
||||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
@@ -130,10 +135,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require "modals/admin_custom_link_edit_modal.php";
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -148,6 +149,4 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/admin_custom_link_add_modal.php";
|
require_once "modals/admin_custom_link_add_modal.php";
|
||||||
|
|
||||||
require_once "includes/footer.php";
|
require_once "includes/footer.php";
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,12 @@
|
|||||||
<i class="fas fa-ellipsis-h"></i>
|
<i class="fas fa-ellipsis-h"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editDocumentTemplateModal<?php echo $document_id; ?>">
|
<a class="dropdown-item" href="#"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-modal-size="xl"
|
||||||
|
data-ajax-url="ajax/ajax_document_template_edit.php"
|
||||||
|
data-ajax-id="<?php echo $document_id; ?>"
|
||||||
|
>
|
||||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
@@ -119,8 +124,6 @@
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require "modals/admin_document_template_edit_modal.php";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -41,12 +41,17 @@ $document_updated_at = nullable_htmlentities($row['document_updated_at']);
|
|||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<div class="card card-dark">
|
<div class="card card-dark">
|
||||||
<div class="card-header">
|
<div class="card-header py-2">
|
||||||
|
|
||||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-file mr-2"></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">
|
<div class="card-tools">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#editDocumentTemplateModal<?php echo $document_id; ?>">
|
<button type="button" class="btn btn-primary"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-modal-size="xl"
|
||||||
|
data-ajax-url="ajax/ajax_document_template_edit.php"
|
||||||
|
data-ajax-id="<?php echo $document_id; ?>"
|
||||||
|
>
|
||||||
<i class="fas fa-edit mr-2"></i>Edit
|
<i class="fas fa-edit mr-2"></i>Edit
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -59,8 +64,4 @@ $document_updated_at = nullable_htmlentities($row['document_updated_at']);
|
|||||||
<script src="js/pretty_content.js"></script>
|
<script src="js/pretty_content.js"></script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "modals/admin_document_template_edit_modal.php";
|
|
||||||
|
|
||||||
require_once "includes/footer.php";
|
require_once "includes/footer.php";
|
||||||
|
|
||||||
|
|||||||
@@ -177,7 +177,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<td><?php echo $email_status_display; ?></td>
|
<td><?php echo $email_status_display; ?></td>
|
||||||
<td><?php echo $email_attempts; ?></td>
|
<td><?php echo $email_attempts; ?></td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<a class="btn btn-sm btn-secondary" href="admin_mail_queue_message_view.php?email_id=<?php echo $email_id; ?>">
|
<a class="btn btn-sm btn-secondary" href="#"
|
||||||
|
data-toggle = "ajax-modal"
|
||||||
|
data-modal-size = "lg"
|
||||||
|
data-ajax-url = "ajax/ajax_admin_mail_queue_message_view.php"
|
||||||
|
data-ajax-id = "<?php echo $email_id; ?>"
|
||||||
|
>
|
||||||
<i class="fas fa-fw fa-eye"></i>
|
<i class="fas fa-fw fa-eye"></i>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Default Column Sortby Filter
|
// Default Column Sortby Filter
|
||||||
$sort = "user_role_is_admin";
|
$sort = "role_is_admin";
|
||||||
$order = "DESC";
|
$order = "DESC";
|
||||||
|
|
||||||
require_once "includes/inc_all_admin.php";
|
require_once "includes/inc_all_admin.php";
|
||||||
@@ -13,8 +13,8 @@ $url_query_strings_sort = http_build_query($get_copy);
|
|||||||
$sql = mysqli_query(
|
$sql = mysqli_query(
|
||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT SQL_CALC_FOUND_ROWS * FROM user_roles
|
"SELECT SQL_CALC_FOUND_ROWS * FROM user_roles
|
||||||
WHERE (user_roles.user_role_name LIKE '%$q%' OR user_roles.user_role_description LIKE '%$q%')
|
WHERE (role_name LIKE '%$q%' OR role_description LIKE '%$q%')
|
||||||
AND user_roles.user_role_archived_at IS NULL
|
AND role_archived_at IS NULL
|
||||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -53,14 +53,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_role_name&order=<?php echo $disp; ?>">
|
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=role_name&order=<?php echo $disp; ?>">
|
||||||
Role <?php if ($sort == 'user_role_name') { echo $order_icon; } ?>
|
Role <?php if ($sort == 'role_name') { echo $order_icon; } ?>
|
||||||
</a>
|
</a>
|
||||||
</th>
|
</th>
|
||||||
<th>Members</th>
|
<th>Members</th>
|
||||||
<th>
|
<th>
|
||||||
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_role_is_admin&order=<?php echo $disp; ?>">
|
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=role_is_admin&order=<?php echo $disp; ?>">
|
||||||
Admin <?php if ($sort == 'user_role_is_admin') { echo $order_icon; } ?>
|
Admin <?php if ($sort == 'role_is_admin') { echo $order_icon; } ?>
|
||||||
</a>
|
</a>
|
||||||
</th>
|
</th>
|
||||||
<th class="text-center">Action</th>
|
<th class="text-center">Action</th>
|
||||||
@@ -70,17 +70,17 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
$role_id = intval($row['user_role_id']);
|
$role_id = intval($row['role_id']);
|
||||||
$role_name = nullable_htmlentities($row['user_role_name']);
|
$role_name = nullable_htmlentities($row['role_name']);
|
||||||
$role_description = nullable_htmlentities($row['user_role_description']);
|
$role_description = nullable_htmlentities($row['role_description']);
|
||||||
$role_admin = intval($row['user_role_is_admin']);
|
$role_admin = intval($row['role_is_admin']);
|
||||||
$role_archived_at = nullable_htmlentities($row['user_role_archived_at']);
|
$role_archived_at = nullable_htmlentities($row['role_archived_at']);
|
||||||
|
|
||||||
// Count number of users that have each role
|
// Count number of users that have each role
|
||||||
$sql_role_user_count = mysqli_query($mysqli, "SELECT COUNT(users.user_id) FROM users LEFT JOIN user_settings on users.user_id = user_settings.user_id WHERE user_role = $role_id AND user_archived_at IS NULL");
|
$sql_role_user_count = mysqli_query($mysqli, "SELECT COUNT(user_id) FROM users WHERE user_role_id = $role_id AND user_archived_at IS NULL");
|
||||||
$role_user_count = mysqli_fetch_row($sql_role_user_count)[0];
|
$role_user_count = mysqli_fetch_row($sql_role_user_count)[0];
|
||||||
|
|
||||||
$sql_users = mysqli_query($mysqli, "SELECT * FROM users LEFT JOIN user_settings on users.user_id = user_settings.user_id WHERE user_role = $role_id AND user_archived_at IS NULL");
|
$sql_users = mysqli_query($mysqli, "SELECT * FROM users WHERE user_role_id = $role_id AND user_archived_at IS NULL");
|
||||||
// Initialize an empty array to hold user names
|
// Initialize an empty array to hold user names
|
||||||
$user_names = [];
|
$user_names = [];
|
||||||
|
|
||||||
@@ -114,7 +114,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
|
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editRoleModal<?php echo $role_id; ?>">
|
<a class="dropdown-item" href="#"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-ajax-url="ajax/ajax_role_edit.php"
|
||||||
|
data-ajax-id="<?php echo $role_id; ?>"
|
||||||
|
>
|
||||||
<i class="fas fa-fw fa-user-edit mr-2"></i>Edit
|
<i class="fas fa-fw fa-user-edit mr-2"></i>Edit
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
@@ -133,9 +137,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require "modals/admin_role_edit_modal.php";
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -151,6 +152,4 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "modals/admin_role_add_modal.php";
|
require_once "modals/admin_role_add_modal.php";
|
||||||
|
|
||||||
require_once "includes/footer.php";
|
require_once "includes/footer.php";
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ $company_address = nullable_htmlentities($row['company_address']);
|
|||||||
$company_city = nullable_htmlentities($row['company_city']);
|
$company_city = nullable_htmlentities($row['company_city']);
|
||||||
$company_state = nullable_htmlentities($row['company_state']);
|
$company_state = nullable_htmlentities($row['company_state']);
|
||||||
$company_zip = nullable_htmlentities($row['company_zip']);
|
$company_zip = nullable_htmlentities($row['company_zip']);
|
||||||
$company_phone = formatPhoneNumber($row['company_phone']);
|
$company_phone_country_code = formatPhoneNumber($row['company_phone_country_code']);
|
||||||
|
$company_phone = nullable_htmlentities(formatPhoneNumber($row['company_phone'], $company_phone_country_code));
|
||||||
$company_email = nullable_htmlentities($row['company_email']);
|
$company_email = nullable_htmlentities($row['company_email']);
|
||||||
$company_website = nullable_htmlentities($row['company_website']);
|
$company_website = nullable_htmlentities($row['company_website']);
|
||||||
$company_logo = nullable_htmlentities($row['company_logo']);
|
$company_logo = nullable_htmlentities($row['company_logo']);
|
||||||
@@ -110,13 +111,18 @@ $company_initials = nullable_htmlentities(initials($company_name));
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Phone</label>
|
<label>Phone</label>
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="col-9">
|
||||||
|
<div class="form-group">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-phone"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-phone"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="phone" placeholder="Phone Number" value="<?php echo $company_phone; ?>">
|
<input type="tel" class="form-control col-2" name="phone_country_code" value="+<?php echo $company_phone_country_code; ?>" placeholder="Code" maxlength="4">
|
||||||
|
<input type="tel" class="form-control" name="phone" value="<?php echo $company_phone; ?>" placeholder="Phone Number" maxlength="200">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -152,4 +158,3 @@ $company_initials = nullable_htmlentities(initials($company_name));
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "includes/footer.php";
|
require_once "includes/footer.php";
|
||||||
|
|
||||||
|
|||||||
@@ -218,28 +218,6 @@ require_once "includes/inc_all_admin.php";
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Phone Mask</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-phone"></i></span>
|
|
||||||
</div>
|
|
||||||
<select class="form-control select2" name="phone_mask">
|
|
||||||
<?php
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT config_phone_mask FROM settings WHERE company_id = 1");
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
|
||||||
$phone_mask = intval($row['config_phone_mask']);
|
|
||||||
} ?>
|
|
||||||
<option <?php if ($phone_mask == 1) { echo "selected"; }?> value=1>
|
|
||||||
US Format - e.g. (412) 888-9999
|
|
||||||
</option>
|
|
||||||
<option <?php if ($phone_mask == 0) { echo "selected"; }?> value=0>
|
|
||||||
Non-US Format - e.g. 4128889999
|
|
||||||
</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<button type="submit" name="edit_default_settings" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
<button type="submit" name="edit_default_settings" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ require_once "includes/inc_all_admin.php";
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-barcode"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-barcode"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="config_recurring_prefix" placeholder="Recurring Prefix" value="<?php echo nullable_htmlentities($config_recurring_prefix); ?>" required>
|
<input type="text" class="form-control" name="config_recurring_invoice_prefix" placeholder="Recurring Invoice Prefix" value="<?php echo nullable_htmlentities($config_recurring_invoice_prefix); ?>" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ require_once "includes/inc_all_admin.php";
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-barcode"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-barcode"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="number" min="0" class="form-control" name="config_recurring_next_number" placeholder="Next Recurring Number" value="<?php echo intval($config_recurring_next_number); ?>" required>
|
<input type="number" min="0" class="form-control" name="config_recurring_invoice_next_number" placeholder="Next Recurring Invoice Number" value="<?php echo intval($config_recurring_invoice_next_number); ?>" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ require_once "includes/inc_all_admin.php";
|
|||||||
<th>
|
<th>
|
||||||
<div><i class="fas fa-fw fa-globe mr-2"></i>Domain Expiration Notice</div>
|
<div><i class="fas fa-fw fa-globe mr-2"></i>Domain Expiration Notice</div>
|
||||||
<small class="text-muted">
|
<small class="text-muted">
|
||||||
(This setting triggers a notification when a domain is approaching its expiration date, specifically at 1, 7, 14, 30 and 90 days prior to expiry.)
|
(This setting triggers a notification when a domain is approaching its expiration date, specifically at 1, 7 and 45 days prior to expiry.)
|
||||||
</small>
|
</small>
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
@@ -54,7 +54,7 @@ require_once "includes/inc_all_admin.php";
|
|||||||
<th>
|
<th>
|
||||||
<div><i class="fas fa-fw fa-lock mr-2"></i>Certificate Expiration Notice</div>
|
<div><i class="fas fa-fw fa-lock mr-2"></i>Certificate Expiration Notice</div>
|
||||||
<small class="text-muted">
|
<small class="text-muted">
|
||||||
(This setting triggers a notification when a certificate is approaching its expiration date, specifically at 1, 7, 14, 30 and 90 days prior to expiry.)
|
(This setting triggers a notification when a certificate is approaching its expiration date, specifically at 1, 7 and 45 days prior to expiry.)
|
||||||
</small>
|
</small>
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
@@ -67,7 +67,7 @@ require_once "includes/inc_all_admin.php";
|
|||||||
<th>
|
<th>
|
||||||
<div><i class="fas fa-fw fa-desktop mr-2"></i>Asset Warranty Expiration Notice</div>
|
<div><i class="fas fa-fw fa-desktop mr-2"></i>Asset Warranty Expiration Notice</div>
|
||||||
<small class="text-muted">
|
<small class="text-muted">
|
||||||
(This setting triggers a notification when an asset is approaching its expiration date, specifically at 1, 7, 14, 30 and 90 days prior to expiry.)
|
(This setting triggers a notification when an asset is approaching its expiration date, specifically at 1, 7 and 45 days prior to expiry.)
|
||||||
</small>
|
</small>
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ require_once "includes/inc_all_admin.php";
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="col-3 text-center mb-3">
|
<div class="col-4 text-center mb-3">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="custom-control custom-radio">
|
<div class="custom-control custom-radio">
|
||||||
<input class="custom-control-input" type="radio" onchange="this.form.submit()" id="customRadio<?php echo $theme_color; ?>" name="edit_theme_settings" value="<?php echo $theme_color; ?>" <?php if ($config_theme == $theme_color) { echo "checked"; } ?>>
|
<input class="custom-control-input" type="radio" onchange="this.form.submit()" id="customRadio<?php echo $theme_color; ?>" name="edit_theme_settings" value="<?php echo $theme_color; ?>" <?php if ($config_theme == $theme_color) { echo "checked"; } ?>>
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a class="text-dark" href="#" data-toggle="modal" data-target="#editSoftwareTemplateModal<?php echo $software_id; ?>">
|
<a class="text-dark" href="#" data-toggle="ajax-modal" data-ajax-url="ajax/ajax_software_template_edit.php" data-ajax-id="<?php echo $software_id; ?>">
|
||||||
<div class="media">
|
<div class="media">
|
||||||
<i class="fa fa-fw fa-2x fa-cube mr-3"></i>
|
<i class="fa fa-fw fa-2x fa-cube mr-3"></i>
|
||||||
<div class="media-body">
|
<div class="media-body">
|
||||||
@@ -103,7 +103,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<i class="fas fa-ellipsis-h"></i>
|
<i class="fas fa-ellipsis-h"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editSoftwareTemplateModal<?php echo $software_id; ?>">
|
<a class="dropdown-item" href="#" data-toggle="ajax-modal" data-ajax-url="ajax/ajax_software_template_edit.php" data-ajax-id="<?php echo $software_id; ?>">
|
||||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||||
</a>
|
</a>
|
||||||
<?php if($session_user_role == 3) { ?>
|
<?php if($session_user_role == 3) { ?>
|
||||||
@@ -119,8 +119,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require "modals/admin_software_template_edit_modal.php";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -135,6 +133,4 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/admin_software_template_add_modal.php";
|
require_once "modals/admin_software_template_add_modal.php";
|
||||||
|
|
||||||
require_once "includes/footer.php";
|
require_once "includes/footer.php";
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="#" data-toggle="modal" data-target="#editTagModal<?php echo $tag_id; ?>">
|
<a href="#"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-ajax-url="ajax/ajax_tag_edit.php"
|
||||||
|
data-ajax-id="<?php echo $tag_id; ?>"
|
||||||
|
>
|
||||||
<span class='badge text-light p-2 mr-1' style="background-color: <?php echo $tag_color; ?>"><i class="fa fa-fw fa-<?php echo $tag_icon; ?> mr-2"></i><?php echo $tag_name; ?></span>
|
<span class='badge text-light p-2 mr-1' style="background-color: <?php echo $tag_color; ?>"><i class="fa fa-fw fa-<?php echo $tag_icon; ?> mr-2"></i><?php echo $tag_name; ?></span>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
@@ -98,7 +102,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<i class="fas fa-ellipsis-h"></i>
|
<i class="fas fa-ellipsis-h"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editTagModal<?php echo $tag_id; ?>">
|
<a class="dropdown-item" href="#"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-ajax-url="ajax/ajax_tag_edit.php"
|
||||||
|
data-ajax-id="<?php echo $tag_id; ?>"
|
||||||
|
>
|
||||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
@@ -112,9 +120,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require "modals/admin_tag_edit_modal.php";
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -56,7 +56,15 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a class="text-dark text-bold" href="#" data-toggle="modal" data-target="#editTaxModal<?php echo $tax_id; ?>"><?php echo $tax_name; ?></a></td>
|
<td>
|
||||||
|
<a class="text-dark text-bold" href="#"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-ajax-url="ajax/ajax_tax_edit.php"
|
||||||
|
data-ajax-id="<?php echo $tax_id; ?>"
|
||||||
|
>
|
||||||
|
<?php echo $tax_name; ?>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
<td><?php echo "$tax_percent%"; ?></td>
|
<td><?php echo "$tax_percent%"; ?></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="dropdown dropleft text-center">
|
<div class="dropdown dropleft text-center">
|
||||||
@@ -64,7 +72,11 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
<i class="fas fa-ellipsis-h"></i>
|
<i class="fas fa-ellipsis-h"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editTaxModal<?php echo $tax_id; ?>">
|
<a class="dropdown-item" href="#"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-ajax-url="ajax/ajax_tax_edit.php"
|
||||||
|
data-ajax-id="<?php echo $tax_id; ?>"
|
||||||
|
>
|
||||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
@@ -78,8 +90,6 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require "modals/admin_tax_edit_modal.php";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($num_rows == 0) {
|
if ($num_rows == 0) {
|
||||||
|
|||||||
@@ -85,7 +85,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="#" data-toggle="modal" data-target="#editTicketStatusModal<?php echo $ticket_status_id; ?>">
|
<a href="#"
|
||||||
|
<?php if ( $ticket_status_id > 5 ) { ?>
|
||||||
|
data-toggle="ajax-modal" data-ajax-url="ajax/ajax_custom_ticket_status_edit.php" data-ajax-id="<?php echo $ticket_status_id; ?>"
|
||||||
|
<?php } ?>
|
||||||
|
>
|
||||||
<?php echo $ticket_status_name; ?>
|
<?php echo $ticket_status_name; ?>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
@@ -99,7 +103,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<i class="fas fa-ellipsis-h"></i>
|
<i class="fas fa-ellipsis-h"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editTicketStatusModal<?php echo $ticket_status_id; ?>">
|
<a class="dropdown-item" href="#" data-toggle="ajax-modal" data-ajax-url="ajax/ajax_custom_ticket_status_edit.php" data-ajax-id="<?php echo $ticket_status_id; ?>">
|
||||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
@@ -113,9 +117,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ( $ticket_status_id > 5 ) {
|
|
||||||
require "modals/admin_ticket_status_edit_modal.php";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ $ticket_template_updated_at = nullable_htmlentities($row['ticket_template_update
|
|||||||
$sql_task_templates = mysqli_query($mysqli, "SELECT * FROM task_templates WHERE task_template_ticket_template_id = $ticket_template_id ORDER BY task_template_order ASC, task_template_id ASC");
|
$sql_task_templates = mysqli_query($mysqli, "SELECT * FROM task_templates WHERE task_template_ticket_template_id = $ticket_template_id ORDER BY task_template_order ASC, task_template_id ASC");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
<link rel="stylesheet" href="plugins/dragula/dragula.min.css">
|
||||||
|
|
||||||
<ol class="breadcrumb d-print-none">
|
<ol class="breadcrumb d-print-none">
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
@@ -98,13 +99,17 @@ $sql_task_templates = mysqli_query($mysqli, "SELECT * FROM task_templates WHERE
|
|||||||
while($row = mysqli_fetch_array($sql_task_templates)){
|
while($row = mysqli_fetch_array($sql_task_templates)){
|
||||||
$task_id = intval($row['task_template_id']);
|
$task_id = intval($row['task_template_id']);
|
||||||
$task_name = nullable_htmlentities($row['task_template_name']);
|
$task_name = nullable_htmlentities($row['task_template_name']);
|
||||||
$task_order = intval($row['task_template_order']);
|
|
||||||
$task_completion_estimate = intval($row['task_template_completion_estimate']);
|
$task_completion_estimate = intval($row['task_template_completion_estimate']);
|
||||||
$task_description = nullable_htmlentities($row['task_template_description']);
|
$task_description = nullable_htmlentities($row['task_template_description']);
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr data-task-id="<?php echo $task_id; ?>">
|
||||||
<td><i class="far fa-fw fa-square text-secondary"></i></td>
|
<td><i class="far fa-fw fa-square text-secondary"></i></td>
|
||||||
<td><span class="text-secondary"><?php echo $task_completion_estimate; ?>m</span> - <?php echo $task_name; ?></td>
|
<td>
|
||||||
|
<a href="#" class="grab-cursor">
|
||||||
|
<span class="text-secondary"><?php echo $task_completion_estimate; ?>m</span>
|
||||||
|
<span class="text-dark"> - <?php echo $task_name; ?></span>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<div class="float-right">
|
<div class="float-right">
|
||||||
<div class="dropdown dropleft text-center">
|
<div class="dropdown dropleft text-center">
|
||||||
@@ -112,7 +117,11 @@ $sql_task_templates = mysqli_query($mysqli, "SELECT * FROM task_templates WHERE
|
|||||||
<i class="fas fa-fw fa-ellipsis-v"></i>
|
<i class="fas fa-fw fa-ellipsis-v"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editTaskModal<?php echo $task_id; ?>">
|
<a class="dropdown-item" href="#"
|
||||||
|
data-toggle = "ajax-modal"
|
||||||
|
data-ajax-url = "ajax/ajax_ticket_template_task_edit.php"
|
||||||
|
data-ajax-id = "<?php echo $task_id; ?>"
|
||||||
|
>
|
||||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
@@ -125,7 +134,6 @@ $sql_task_templates = mysqli_query($mysqli, "SELECT * FROM task_templates WHERE
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
require "modals/task_edit_modal.php";
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</table>
|
</table>
|
||||||
@@ -137,6 +145,41 @@ $sql_task_templates = mysqli_query($mysqli, "SELECT * FROM task_templates WHERE
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="js/pretty_content.js"></script>
|
<script src="js/pretty_content.js"></script>
|
||||||
|
<script src="plugins/dragula/dragula.min.js"></script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
var container = $('.table tbody')[0];
|
||||||
|
|
||||||
|
dragula([container])
|
||||||
|
.on('drop', function (el, target, source, sibling) {
|
||||||
|
// Handle the drop event to update the order in the database
|
||||||
|
var rows = $(container).children();
|
||||||
|
var positions = rows.map(function(index, row) {
|
||||||
|
return {
|
||||||
|
id: $(row).data('taskId'),
|
||||||
|
order: index
|
||||||
|
};
|
||||||
|
}).get();
|
||||||
|
|
||||||
|
// Send the new order to the server
|
||||||
|
$.ajax({
|
||||||
|
url: 'ajax.php',
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
update_task_templates_order: true, // Adjust the parameter name if needed
|
||||||
|
ticket_template_id: <?php echo $ticket_template_id; ?>,
|
||||||
|
positions: positions
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
// Handle success
|
||||||
|
},
|
||||||
|
error: function(error) {
|
||||||
|
console.error('Error updating order:', error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|||||||
@@ -6,16 +6,13 @@ $order = "ASC";
|
|||||||
|
|
||||||
require_once "includes/inc_all_admin.php";
|
require_once "includes/inc_all_admin.php";
|
||||||
|
|
||||||
|
|
||||||
//Rebuild URL
|
|
||||||
$url_query_strings_sort = http_build_query($get_copy);
|
|
||||||
|
|
||||||
$sql = mysqli_query(
|
$sql = mysqli_query(
|
||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT SQL_CALC_FOUND_ROWS * FROM users, user_settings, user_roles
|
"SELECT SQL_CALC_FOUND_ROWS * FROM users
|
||||||
WHERE users.user_id = user_settings.user_id
|
LEFT JOIN user_roles ON user_role_id = role_id
|
||||||
AND user_settings.user_role = user_roles.user_role_id
|
LEFT JOIN user_settings ON users.user_id = user_settings.user_id
|
||||||
AND (user_name LIKE '%$q%' OR user_email LIKE '%$q%')
|
WHERE (user_name LIKE '%$q%' OR user_email LIKE '%$q%')
|
||||||
|
AND user_type = 1
|
||||||
AND user_archived_at IS NULL
|
AND user_archived_at IS NULL
|
||||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||||
);
|
);
|
||||||
@@ -36,6 +33,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<!--<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#userInviteModal"><i class="fas fa-paper-plane mr-2"></i>Invite User</a>-->
|
<!--<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#userInviteModal"><i class="fas fa-paper-plane mr-2"></i>Invite User</a>-->
|
||||||
<?php if ($num_rows[0] > 1) { ?>
|
<?php if ($num_rows[0] > 1) { ?>
|
||||||
|
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportUserModal"><i class="fa fa-fw fa-download mr-2"></i>Export</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item text-danger" href="#" data-toggle="modal" data-target="#resetAllUserPassModal"><i class="fas fa-skull-crossbones mr-2"></i>IR</a>
|
<a class="dropdown-item text-danger" href="#" data-toggle="modal" data-target="#resetAllUserPassModal"><i class="fas fa-skull-crossbones mr-2"></i>IR</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@@ -55,9 +53,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<div class="float-right">
|
|
||||||
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#exportUserModal"><i class="fa fa-fw fa-download mr-2"></i>Export</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@@ -77,8 +72,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</a>
|
</a>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_role&order=<?php echo $disp; ?>">
|
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=role_name&order=<?php echo $disp; ?>">
|
||||||
Role <?php if ($sort == 'user_role') { echo $order_icon; } ?>
|
Role <?php if ($sort == 'role_name') { echo $order_icon; } ?>
|
||||||
</a>
|
</a>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
@@ -116,8 +111,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$mfa_status_display = "<i class='fas fa-fw fa-lock text-success'></i>";
|
$mfa_status_display = "<i class='fas fa-fw fa-lock text-success'></i>";
|
||||||
}
|
}
|
||||||
$user_config_force_mfa = intval($row['user_config_force_mfa']);
|
$user_config_force_mfa = intval($row['user_config_force_mfa']);
|
||||||
$user_role = $row['user_role'];
|
$user_role = intval($row['user_role_id']);
|
||||||
$user_role_display = nullable_htmlentities($row['user_role_name']);
|
$user_role_display = nullable_htmlentities($row['role_name']);
|
||||||
$user_initials = nullable_htmlentities(initials($user_name));
|
$user_initials = nullable_htmlentities(initials($user_name));
|
||||||
|
|
||||||
$sql_last_login = mysqli_query(
|
$sql_last_login = mysqli_query(
|
||||||
@@ -139,7 +134,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get User Client Access Permissions
|
// Get User Client Access Permissions
|
||||||
$user_client_access_sql = mysqli_query($mysqli,"SELECT client_id FROM user_permissions WHERE user_id = $user_id");
|
$user_client_access_sql = mysqli_query($mysqli,"SELECT client_id FROM user_client_permissions WHERE user_id = $user_id");
|
||||||
$client_access_array = [];
|
$client_access_array = [];
|
||||||
while ($row = mysqli_fetch_assoc($user_client_access_sql)) {
|
while ($row = mysqli_fetch_assoc($user_client_access_sql)) {
|
||||||
$client_access_array[] = intval($row['client_id']);
|
$client_access_array[] = intval($row['client_id']);
|
||||||
@@ -153,7 +148,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<a class="text-dark" href="#" <?php if ($user_id !== $session_user_id) { // Prevent modifying self ?> data-toggle="modal" data-target="#editUserModal<?php echo $user_id; ?>" <?php } ?>>
|
<a class="text-dark" href="#"
|
||||||
|
<?php if ($user_id !== $session_user_id) { // Prevent modifying self ?>
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-ajax-url="ajax/ajax_user_edit.php"
|
||||||
|
data-ajax-id="<?php echo $user_id; ?>"
|
||||||
|
<?php } ?>
|
||||||
|
>
|
||||||
<?php if (!empty($user_avatar)) { ?>
|
<?php if (!empty($user_avatar)) { ?>
|
||||||
<img class="img-size-50 img-circle" src="<?php echo "uploads/users/$user_id/$user_avatar"; ?>">
|
<img class="img-size-50 img-circle" src="<?php echo "uploads/users/$user_id/$user_avatar"; ?>">
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
@@ -179,7 +180,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<i class="fas fa-ellipsis-h"></i>
|
<i class="fas fa-ellipsis-h"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editUserModal<?php echo $user_id; ?>">
|
<a class="dropdown-item" href="#"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-ajax-url="ajax/ajax_user_edit.php"
|
||||||
|
data-ajax-id="<?php echo $user_id; ?>"
|
||||||
|
>
|
||||||
<i class="fas fa-fw fa-user-edit mr-2"></i>Edit
|
<i class="fas fa-fw fa-user-edit mr-2"></i>Edit
|
||||||
</a>
|
</a>
|
||||||
<?php if ($remember_token_count > 0) { ?>
|
<?php if ($remember_token_count > 0) { ?>
|
||||||
@@ -207,11 +212,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require "modals/admin_user_edit_modal.php";
|
|
||||||
|
|
||||||
require "modals/admin_user_archive_modal.php";
|
require "modals/admin_user_archive_modal.php";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -230,14 +232,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "modals/admin_user_add_modal.php";
|
require_once "modals/admin_user_add_modal.php";
|
||||||
|
|
||||||
require_once "modals/admin_user_invite_modal.php";
|
require_once "modals/admin_user_invite_modal.php";
|
||||||
|
|
||||||
require_once "modals/admin_user_export_modal.php";
|
require_once "modals/admin_user_export_modal.php";
|
||||||
|
|
||||||
require_once "modals/admin_user_all_reset_password_modal.php";
|
require_once "modals/admin_user_all_reset_password_modal.php";
|
||||||
|
|
||||||
require_once "includes/footer.php";
|
require_once "includes/footer.php";
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
<a class="text-dark" href="#" data-toggle="modal" data-target="#editVendorTemplateModal<?php echo $vendor_id; ?>">
|
<a class="text-dark" href="#"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-ajax-url="ajax/ajax_vendor_template_edit.php"
|
||||||
|
data-ajax-id="<?php echo $vendor_id; ?>"
|
||||||
|
>
|
||||||
<i class="fa fa-fw fa-building text-secondary mr-2"></i><?php echo $vendor_name; ?>
|
<i class="fa fa-fw fa-building text-secondary mr-2"></i><?php echo $vendor_name; ?>
|
||||||
</a>
|
</a>
|
||||||
<?php
|
<?php
|
||||||
@@ -139,7 +143,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<i class="fas fa-ellipsis-h"></i>
|
<i class="fas fa-ellipsis-h"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editVendorTemplateModal<?php echo $vendor_id; ?>">
|
<a class="dropdown-item" href="#"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-ajax-url="ajax/ajax_vendor_template_edit.php"
|
||||||
|
data-ajax-id="<?php echo $vendor_id; ?>"
|
||||||
|
>
|
||||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||||
</a>
|
</a>
|
||||||
<?php if ($session_user_role == 3) { ?>
|
<?php if ($session_user_role == 3) { ?>
|
||||||
@@ -155,8 +163,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require "modals/admin_vendor_template_edit_modal.php";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -171,6 +177,4 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/admin_vendor_template_add_modal.php";
|
require_once "modals/admin_vendor_template_add_modal.php";
|
||||||
|
|
||||||
require_once "includes/footer.php";
|
require_once "includes/footer.php";
|
||||||
|
|
||||||
|
|||||||
484
ajax.php
484
ajax.php
@@ -8,13 +8,14 @@
|
|||||||
|
|
||||||
require_once "config.php";
|
require_once "config.php";
|
||||||
require_once "functions.php";
|
require_once "functions.php";
|
||||||
require_once "check_login.php";
|
require_once "includes/check_login.php";
|
||||||
require_once "plugins/totp/totp.php";
|
require_once "plugins/totp/totp.php";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fetches SSL certificates from remote hosts & returns the relevant info (issuer, expiry, public key)
|
* Fetches SSL certificates from remote hosts & returns the relevant info (issuer, expiry, public key)
|
||||||
*/
|
*/
|
||||||
if (isset($_GET['certificate_fetch_parse_json_details'])) {
|
if (isset($_GET['certificate_fetch_parse_json_details'])) {
|
||||||
|
enforceUserPermission('module_support');
|
||||||
|
|
||||||
// PHP doesn't appreciate attempting SSL sockets to non-existent domains
|
// PHP doesn't appreciate attempting SSL sockets to non-existent domains
|
||||||
if (empty($_GET['domain'])) {
|
if (empty($_GET['domain'])) {
|
||||||
@@ -39,77 +40,11 @@ if (isset($_GET['certificate_fetch_parse_json_details'])) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Looks up info for a given certificate ID from the database, used to dynamically populate modal fields
|
|
||||||
*/
|
|
||||||
if (isset($_GET['certificate_get_json_details'])) {
|
|
||||||
validateTechRole();
|
|
||||||
|
|
||||||
$certificate_id = intval($_GET['certificate_id']);
|
|
||||||
$client_id = intval($_GET['client_id']);
|
|
||||||
|
|
||||||
// Individual certificate lookup
|
|
||||||
$cert_sql = mysqli_query($mysqli, "SELECT * FROM certificates WHERE certificate_id = $certificate_id AND certificate_client_id = $client_id");
|
|
||||||
while ($row = mysqli_fetch_array($cert_sql)) {
|
|
||||||
$response['certificate'][] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get all domains for this client that could be linked to this certificate
|
|
||||||
$domains_sql = mysqli_query($mysqli, "SELECT domain_id, domain_name FROM domains WHERE domain_client_id = $client_id");
|
|
||||||
while ($row = mysqli_fetch_array($domains_sql)) {
|
|
||||||
$response['domains'][] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo json_encode($response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Looks up info for a given domain ID from the database, used to dynamically populate modal fields
|
|
||||||
*/
|
|
||||||
if (isset($_GET['domain_get_json_details'])) {
|
|
||||||
enforceUserPermission('module_support');
|
|
||||||
|
|
||||||
$domain_id = intval($_GET['domain_id']);
|
|
||||||
$client_id = intval($_GET['client_id']);
|
|
||||||
|
|
||||||
// Individual domain lookup
|
|
||||||
$cert_sql = mysqli_query($mysqli, "SELECT * FROM domains WHERE domain_id = $domain_id AND domain_client_id = $client_id");
|
|
||||||
while ($row = mysqli_fetch_array($cert_sql)) {
|
|
||||||
$response['domain'][] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get all registrars/webhosts (vendors) for this client that could be linked to this domain
|
|
||||||
$vendor_sql = mysqli_query($mysqli, "SELECT vendor_id, vendor_name FROM vendors WHERE vendor_client_id = $client_id AND vendor_archived_at IS NULL ORDER BY vendor_name ASC");
|
|
||||||
while ($row = mysqli_fetch_array($vendor_sql)) {
|
|
||||||
$response['vendors'][] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get domain history
|
|
||||||
$history_sql = mysqli_query($mysqli, "SELECT * FROM domain_history WHERE domain_history_domain_id = $domain_id");
|
|
||||||
$history_html = "<table class='table table-sm table-striped border table-hover'>";
|
|
||||||
$history_html .= "<thead class='thead-dark'><tr><th>Date</th><th>Field</th><th>Before</th><th>After</th></tr></thead><tbody>";
|
|
||||||
while ($row = mysqli_fetch_array($history_sql)) {
|
|
||||||
// Fetch data from the query and create table rows
|
|
||||||
$history_html .= "<tr>";
|
|
||||||
$history_html .= "<td>" . htmlspecialchars(date('Y-m-d', strtotime($row['domain_history_modified_at']))) . "</td>";
|
|
||||||
$history_html .= "<td>" . htmlspecialchars($row['domain_history_column']) . "</td>";
|
|
||||||
$history_html .= "<td>" . htmlspecialchars($row['domain_history_old_value']) . "</td>";
|
|
||||||
$history_html .= "<td>" . htmlspecialchars($row['domain_history_new_value']) . "</td>";
|
|
||||||
$history_html .= "</tr>";
|
|
||||||
}
|
|
||||||
$history_html .= "</tbody></table>";
|
|
||||||
|
|
||||||
// Return the HTML content to JavaScript
|
|
||||||
$response['history'] = $history_html;
|
|
||||||
|
|
||||||
echo json_encode($response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Looks up info on the ticket number provided, used to populate the ticket merge modal
|
* Looks up info on the ticket number provided, used to populate the ticket merge modal
|
||||||
*/
|
*/
|
||||||
if (isset($_GET['merge_ticket_get_json_details'])) {
|
if (isset($_GET['merge_ticket_get_json_details'])) {
|
||||||
validateTechRole();
|
enforceUserPermission('module_support');
|
||||||
|
|
||||||
$merge_into_ticket_number = intval($_GET['merge_into_ticket_number']);
|
$merge_into_ticket_number = intval($_GET['merge_into_ticket_number']);
|
||||||
|
|
||||||
@@ -130,35 +65,9 @@ if (isset($_GET['merge_ticket_get_json_details'])) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Looks up info for a given network ID from the database, used to dynamically populate modal fields
|
|
||||||
*/
|
|
||||||
if (isset($_GET['network_get_json_details'])) {
|
|
||||||
validateTechRole();
|
|
||||||
|
|
||||||
$network_id = intval($_GET['network_id']);
|
|
||||||
$client_id = intval($_GET['client_id']);
|
|
||||||
|
|
||||||
// Individual network lookup
|
|
||||||
$network_sql = mysqli_query($mysqli, "SELECT * FROM networks WHERE network_id = $network_id AND network_client_id = $client_id");
|
|
||||||
while ($row = mysqli_fetch_array($network_sql)) {
|
|
||||||
$response['network'][] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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
|
|
||||||
WHERE location_client_id = '$client_id'"
|
|
||||||
);
|
|
||||||
while ($row = mysqli_fetch_array($locations_sql)) {
|
|
||||||
$response['locations'][] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo json_encode($response);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_POST['client_set_notes'])) {
|
if (isset($_POST['client_set_notes'])) {
|
||||||
|
enforceUserPermission('module_client', 2);
|
||||||
|
|
||||||
$client_id = intval($_POST['client_id']);
|
$client_id = intval($_POST['client_id']);
|
||||||
$notes = sanitizeInput($_POST['notes']);
|
$notes = sanitizeInput($_POST['notes']);
|
||||||
|
|
||||||
@@ -171,6 +80,8 @@ if (isset($_POST['client_set_notes'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['contact_set_notes'])) {
|
if (isset($_POST['contact_set_notes'])) {
|
||||||
|
enforceUserPermission('module_client', 2);
|
||||||
|
|
||||||
$contact_id = intval($_POST['contact_id']);
|
$contact_id = intval($_POST['contact_id']);
|
||||||
$notes = sanitizeInput($_POST['notes']);
|
$notes = sanitizeInput($_POST['notes']);
|
||||||
|
|
||||||
@@ -191,6 +102,8 @@ if (isset($_POST['contact_set_notes'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['asset_set_notes'])) {
|
if (isset($_POST['asset_set_notes'])) {
|
||||||
|
enforceUserPermission('module_support', 2);
|
||||||
|
|
||||||
$asset_id = intval($_POST['asset_id']);
|
$asset_id = intval($_POST['asset_id']);
|
||||||
$notes = sanitizeInput($_POST['notes']);
|
$notes = sanitizeInput($_POST['notes']);
|
||||||
|
|
||||||
@@ -211,7 +124,7 @@ if (isset($_POST['asset_set_notes'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Collision Detection/Avoidance
|
* Ticketing Collision Detection/Avoidance
|
||||||
* Called upon loading a ticket, and every 2 mins thereafter
|
* Called upon loading a ticket, and every 2 mins thereafter
|
||||||
* Is used in conjunction with ticket_query_views to show who is currently viewing a ticket
|
* Is used in conjunction with ticket_query_views to show who is currently viewing a ticket
|
||||||
*/
|
*/
|
||||||
@@ -222,7 +135,7 @@ if (isset($_GET['ticket_add_view'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Collision Detection/Avoidance
|
* Ticketing Collision Detection/Avoidance
|
||||||
* Returns formatted text of the agents currently viewing a ticket
|
* Returns formatted text of the agents currently viewing a ticket
|
||||||
* Called upon loading a ticket, and every 2 mins thereafter
|
* Called upon loading a ticket, and every 2 mins thereafter
|
||||||
*/
|
*/
|
||||||
@@ -252,10 +165,10 @@ if (isset($_GET['ticket_query_views'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generates public/guest links for sharing logins/docs
|
* Generates public/guest links for sharing credentials/docs
|
||||||
*/
|
*/
|
||||||
if (isset($_GET['share_generate_link'])) {
|
if (isset($_GET['share_generate_link'])) {
|
||||||
validateTechRole();
|
enforceUserPermission('module_support', 2);
|
||||||
|
|
||||||
$item_encrypted_username = ''; // Default empty
|
$item_encrypted_username = ''; // Default empty
|
||||||
$item_encrypted_credential = ''; // Default empty
|
$item_encrypted_credential = ''; // Default empty
|
||||||
@@ -294,23 +207,23 @@ if (isset($_GET['share_generate_link'])) {
|
|||||||
$item_name = sanitizeInput($row['file_name']);
|
$item_name = sanitizeInput($row['file_name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($item_type == "Login") {
|
if ($item_type == "Credential") {
|
||||||
$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");
|
$credential = mysqli_query($mysqli, "SELECT credential_name, credential_username, credential_password FROM credentials WHERE credential_id = $item_id AND credential_client_id = $client_id LIMIT 1");
|
||||||
$row = mysqli_fetch_array($login);
|
$row = mysqli_fetch_array($credential);
|
||||||
|
|
||||||
$item_name = sanitizeInput($row['login_name']);
|
$item_name = sanitizeInput($row['credential_name']);
|
||||||
|
|
||||||
// Decrypt & re-encrypt username/password for sharing
|
// Decrypt & re-encrypt username/password for sharing
|
||||||
$login_encryption_key = randomString();
|
$credential_encryption_key = randomString();
|
||||||
|
|
||||||
$login_username_cleartext = decryptLoginEntry($row['login_username']);
|
$credential_username_cleartext = decryptCredentialEntry($row['credential_username']);
|
||||||
$iv = randomString();
|
$iv = randomString();
|
||||||
$username_ciphertext = openssl_encrypt($login_username_cleartext, 'aes-128-cbc', $login_encryption_key, 0, $iv);
|
$username_ciphertext = openssl_encrypt($credential_username_cleartext, 'aes-128-cbc', $credential_encryption_key, 0, $iv);
|
||||||
$item_encrypted_username = $iv . $username_ciphertext;
|
$item_encrypted_username = $iv . $username_ciphertext;
|
||||||
|
|
||||||
$login_password_cleartext = decryptLoginEntry($row['login_password']);
|
$credential_password_cleartext = decryptCredentialEntry($row['credential_password']);
|
||||||
$iv = randomString();
|
$iv = randomString();
|
||||||
$password_ciphertext = openssl_encrypt($login_password_cleartext, 'aes-128-cbc', $login_encryption_key, 0, $iv);
|
$password_ciphertext = openssl_encrypt($credential_password_cleartext, 'aes-128-cbc', $credential_encryption_key, 0, $iv);
|
||||||
$item_encrypted_credential = $iv . $password_ciphertext;
|
$item_encrypted_credential = $iv . $password_ciphertext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,8 +232,8 @@ if (isset($_GET['share_generate_link'])) {
|
|||||||
$share_id = $mysqli->insert_id;
|
$share_id = $mysqli->insert_id;
|
||||||
|
|
||||||
// Return URL
|
// Return URL
|
||||||
if ($item_type == "Login") {
|
if ($item_type == "Credential") {
|
||||||
$url = "https://$config_base_url/guest/guest_view_item.php?id=$share_id&key=$item_key&ek=$login_encryption_key";
|
$url = "https://$config_base_url/guest/guest_view_item.php?id=$share_id&key=$item_key&ek=$credential_encryption_key";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$url = "https://$config_base_url/guest/guest_view_item.php?id=$share_id&key=$item_key";
|
$url = "https://$config_base_url/guest/guest_view_item.php?id=$share_id&key=$item_key";
|
||||||
@@ -329,7 +242,7 @@ if (isset($_GET['share_generate_link'])) {
|
|||||||
$sql = mysqli_query($mysqli,"SELECT * FROM companies WHERE company_id = 1");
|
$sql = mysqli_query($mysqli,"SELECT * FROM companies WHERE company_id = 1");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_array($sql);
|
||||||
$company_name = sanitizeInput($row['company_name']);
|
$company_name = sanitizeInput($row['company_name']);
|
||||||
$company_phone = sanitizeInput(formatPhoneNumber($row['company_phone']));
|
$company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code']));
|
||||||
|
|
||||||
// Sanitize Config vars from get_settings.php
|
// Sanitize Config vars from get_settings.php
|
||||||
$config_ticket_from_name = sanitizeInput($config_ticket_from_name);
|
$config_ticket_from_name = sanitizeInput($config_ticket_from_name);
|
||||||
@@ -371,97 +284,11 @@ if (isset($_GET['share_generate_link'])) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Looks up info for a given recurring (was scheduled) ticket ID from the database, used to dynamically populate modal edit fields
|
|
||||||
*/
|
|
||||||
if (isset($_GET['recurring_ticket_get_json_details'])) {
|
|
||||||
validateTechRole();
|
|
||||||
|
|
||||||
$client_id = intval($_GET['client_id']);
|
|
||||||
$ticket_id = intval($_GET['ticket_id']);
|
|
||||||
|
|
||||||
// Get all contacts, to allow tickets to be raised under a specific contact
|
|
||||||
$contact_sql = mysqli_query($mysqli, "SELECT contact_id, contact_name FROM contacts
|
|
||||||
WHERE contact_client_id = $client_id
|
|
||||||
AND contact_archived_at IS NULL
|
|
||||||
ORDER BY contact_primary DESC, contact_technical DESC, contact_name ASC"
|
|
||||||
);
|
|
||||||
while ($row = mysqli_fetch_array($contact_sql)) {
|
|
||||||
$response['contacts'][] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get ticket details
|
|
||||||
$ticket_sql = mysqli_query($mysqli, "SELECT * FROM scheduled_tickets
|
|
||||||
WHERE scheduled_ticket_id = $ticket_id
|
|
||||||
AND scheduled_ticket_client_id = $client_id LIMIT 1");
|
|
||||||
while ($row = mysqli_fetch_array($ticket_sql)) {
|
|
||||||
$response['ticket'][] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get assets
|
|
||||||
$asset_sql = mysqli_query($mysqli, "SELECT asset_id, asset_name FROM assets WHERE asset_client_id = $client_id AND asset_archived_at IS NULL");
|
|
||||||
while ($row = mysqli_fetch_array($asset_sql)) {
|
|
||||||
$response['assets'][] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get technicians to auto assign the ticket to
|
|
||||||
$sql_agents = mysqli_query(
|
|
||||||
$mysqli,
|
|
||||||
"SELECT users.user_id, user_name FROM users
|
|
||||||
LEFT JOIN user_settings on users.user_id = user_settings.user_id
|
|
||||||
WHERE user_role > 1
|
|
||||||
AND user_status = 1
|
|
||||||
AND user_archived_at IS NULL
|
|
||||||
ORDER BY user_name ASC"
|
|
||||||
);
|
|
||||||
while ($row = mysqli_fetch_array($sql_agents)) {
|
|
||||||
$response['agents'][] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo json_encode($response);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Looks up info for a given quote ID from the database, used to dynamically populate modal fields
|
|
||||||
*/
|
|
||||||
if (isset($_GET['quote_get_json_details'])) {
|
|
||||||
$quote_id = intval($_GET['quote_id']);
|
|
||||||
|
|
||||||
// Get quote details
|
|
||||||
$quote_sql = mysqli_query(
|
|
||||||
$mysqli,
|
|
||||||
"SELECT * FROM quotes
|
|
||||||
LEFT JOIN clients ON quote_client_id = client_id
|
|
||||||
WHERE quote_id = $quote_id LIMIT 1"
|
|
||||||
);
|
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($quote_sql)) {
|
|
||||||
$response['quote'][] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Get all income-related categories for quoting
|
|
||||||
$quote_created_at = $response['quote'][0]['quote_created_at'];
|
|
||||||
$category_sql = mysqli_query(
|
|
||||||
$mysqli,
|
|
||||||
"SELECT category_id, category_name FROM categories
|
|
||||||
WHERE category_type = 'Income' AND (category_archived_at > '$quote_created_at' OR category_archived_at IS NULL)
|
|
||||||
ORDER BY category_name"
|
|
||||||
);
|
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($category_sql)) {
|
|
||||||
$response['categories'][] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo json_encode($response);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns sorted list of active clients
|
* Returns sorted list of active clients
|
||||||
*/
|
*/
|
||||||
if (isset($_GET['get_active_clients'])) {
|
if (isset($_GET['get_active_clients'])) {
|
||||||
|
enforceUserPermission('module_client');
|
||||||
|
|
||||||
$client_sql = mysqli_query(
|
$client_sql = mysqli_query(
|
||||||
$mysqli,
|
$mysqli,
|
||||||
@@ -481,6 +308,8 @@ if (isset($_GET['get_active_clients'])) {
|
|||||||
* Returns ordered list of active contacts for a specified client
|
* Returns ordered list of active contacts for a specified client
|
||||||
*/
|
*/
|
||||||
if (isset($_GET['get_client_contacts'])) {
|
if (isset($_GET['get_client_contacts'])) {
|
||||||
|
enforceUserPermission('module_client');
|
||||||
|
|
||||||
$client_id = intval($_GET['client_id']);
|
$client_id = intval($_GET['client_id']);
|
||||||
|
|
||||||
$contact_sql = mysqli_query(
|
$contact_sql = mysqli_query(
|
||||||
@@ -502,26 +331,26 @@ if (isset($_GET['get_client_contacts'])) {
|
|||||||
* When provided with a login ID, checks permissions and returns the 6-digit code
|
* When provided with a login ID, checks permissions and returns the 6-digit code
|
||||||
*/
|
*/
|
||||||
if (isset($_GET['get_totp_token_via_id'])) {
|
if (isset($_GET['get_totp_token_via_id'])) {
|
||||||
validateTechRole();
|
enforceUserPermission('module_credential');
|
||||||
|
|
||||||
$login_id = intval($_GET['login_id']);
|
$credential_id = intval($_GET['credential_id']);
|
||||||
|
|
||||||
$sql = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT login_name, login_otp_secret, login_client_id FROM logins WHERE login_id = $login_id"));
|
$sql = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT credential_name, credential_otp_secret, credential_client_id FROM credentials WHERE credential_id = $credential_id"));
|
||||||
$name = sanitizeInput($sql['login_name']);
|
$name = sanitizeInput($sql['credential_name']);
|
||||||
$totp_secret = $sql['login_otp_secret'];
|
$totp_secret = $sql['credential_otp_secret'];
|
||||||
$client_id = intval($sql['login_client_id']);
|
$client_id = intval($sql['credential_client_id']);
|
||||||
|
|
||||||
$otp = TokenAuth6238::getTokenCode(strtoupper($totp_secret));
|
$otp = TokenAuth6238::getTokenCode(strtoupper($totp_secret));
|
||||||
echo json_encode($otp);
|
echo json_encode($otp);
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
// Only log the TOTP view if the user hasn't already viewed this specific login entry recently, this prevents logs filling if a user hovers across an entry a few times
|
// Only log the TOTP view if the user hasn't already viewed this specific login entry recently, this prevents logs filling if a user hovers across an entry a few times
|
||||||
$check_recent_totp_view_logged_sql = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT(log_id) AS recent_totp_view FROM logs WHERE log_type = 'Login' AND log_action = 'View TOTP' AND log_user_id = $session_user_id AND log_entity_id = $login_id AND log_client_id = $client_id AND log_created_at > (NOW() - INTERVAL 5 MINUTE)"));
|
$check_recent_totp_view_logged_sql = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT(log_id) AS recent_totp_view FROM logs WHERE log_type = 'Credential' AND log_action = 'View TOTP' AND log_user_id = $session_user_id AND log_entity_id = $credential_id AND log_client_id = $client_id AND log_created_at > (NOW() - INTERVAL 5 MINUTE)"));
|
||||||
$recent_totp_view_logged_count = intval($check_recent_totp_view_logged_sql['recent_totp_view']);
|
$recent_totp_view_logged_count = intval($check_recent_totp_view_logged_sql['recent_totp_view']);
|
||||||
|
|
||||||
if ($recent_totp_view_logged_count == 0) {
|
if ($recent_totp_view_logged_count == 0) {
|
||||||
// Logging
|
// Logging
|
||||||
logAction("Credential", "View TOTP", "$session_name viewed credential TOTP code for $name", $client_id, $login_id);
|
logAction("Credential", "View TOTP", "$session_name viewed credential TOTP code for $name", $client_id, $credential_id);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -529,3 +358,244 @@ if (isset($_GET['get_totp_token_via_id'])) {
|
|||||||
if (isset($_GET['get_readable_pass'])) {
|
if (isset($_GET['get_readable_pass'])) {
|
||||||
echo json_encode(GenerateReadablePassword(4));
|
echo json_encode(GenerateReadablePassword(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ITFlow - POST request handler for client tickets
|
||||||
|
*/
|
||||||
|
if (isset($_POST['update_kanban_status_position'])) {
|
||||||
|
// Update multiple ticket status kanban orders
|
||||||
|
enforceUserPermission('module_support', 2);
|
||||||
|
|
||||||
|
$positions = $_POST['positions'];
|
||||||
|
|
||||||
|
foreach ($positions as $position) {
|
||||||
|
$status_id = intval($position['status_id']);
|
||||||
|
$kanban = intval($position['status_kanban']);
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "UPDATE ticket_statuses SET ticket_status_order = $kanban WHERE ticket_status_id = $status_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
// return a response
|
||||||
|
echo json_encode(['status' => 'success']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['update_kanban_ticket'])) {
|
||||||
|
// Update ticket kanban order and status
|
||||||
|
enforceUserPermission('module_support', 2);
|
||||||
|
|
||||||
|
// all tickets on the column
|
||||||
|
$positions = $_POST['positions'];
|
||||||
|
|
||||||
|
foreach ($positions as $position) {
|
||||||
|
$ticket_id = intval($position['ticket_id']);
|
||||||
|
$kanban = intval($position['ticket_order']); // ticket kanban position
|
||||||
|
$status = intval($position['ticket_status']); // ticket statuses
|
||||||
|
$oldStatus = intval($position['ticket_oldStatus']); // ticket old status if moved
|
||||||
|
|
||||||
|
$statuses['Closed'] = 5;
|
||||||
|
$statuses['Resolved'] = 4;
|
||||||
|
|
||||||
|
// Continue if status is null / Closed
|
||||||
|
if ($status === null || $status === $statuses['Closed']) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($oldStatus === false) {
|
||||||
|
// if ticket was not moved, just uptdate the order on kanban
|
||||||
|
mysqli_query($mysqli, "UPDATE tickets SET ticket_order = $kanban WHERE ticket_id = $ticket_id");
|
||||||
|
customAction('ticket_update', $ticket_id);
|
||||||
|
} else {
|
||||||
|
// If the ticket was moved from a resolved status to another status, we need to update ticket_resolved_at
|
||||||
|
if ($oldStatus === $statuses['Resolved']) {
|
||||||
|
mysqli_query($mysqli, "UPDATE tickets SET ticket_order = $kanban, ticket_status = $status, ticket_resolved_at = NULL WHERE ticket_id = $ticket_id");
|
||||||
|
customAction('ticket_update', $ticket_id);
|
||||||
|
} elseif ($status === $statuses['Resolved']) {
|
||||||
|
// If the ticket was moved to a resolved status, we need to update ticket_resolved_at
|
||||||
|
mysqli_query($mysqli, "UPDATE tickets SET ticket_order = $kanban, ticket_status = $status, ticket_resolved_at = NOW() WHERE ticket_id = $ticket_id");
|
||||||
|
customAction('ticket_update', $ticket_id);
|
||||||
|
|
||||||
|
// Client notification email
|
||||||
|
if (!empty($config_smtp_host) && $config_ticket_client_general_notifications == 1) {
|
||||||
|
|
||||||
|
// Get details
|
||||||
|
$ticket_sql = mysqli_query($mysqli, "SELECT contact_name, contact_email, ticket_prefix, ticket_number, ticket_subject, ticket_status_name, ticket_assigned_to, ticket_url_key, ticket_client_id FROM tickets
|
||||||
|
LEFT JOIN clients ON ticket_client_id = client_id
|
||||||
|
LEFT JOIN contacts ON ticket_contact_id = contact_id
|
||||||
|
LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
|
||||||
|
WHERE ticket_id = $ticket_id
|
||||||
|
");
|
||||||
|
$row = mysqli_fetch_array($ticket_sql);
|
||||||
|
|
||||||
|
$contact_name = sanitizeInput($row['contact_name']);
|
||||||
|
$contact_email = sanitizeInput($row['contact_email']);
|
||||||
|
$ticket_prefix = sanitizeInput($row['ticket_prefix']);
|
||||||
|
$ticket_number = intval($row['ticket_number']);
|
||||||
|
$ticket_subject = sanitizeInput($row['ticket_subject']);
|
||||||
|
$client_id = intval($row['ticket_client_id']);
|
||||||
|
$ticket_assigned_to = intval($row['ticket_assigned_to']);
|
||||||
|
$ticket_status = sanitizeInput($row['ticket_status_name']);
|
||||||
|
$url_key = sanitizeInput($row['ticket_url_key']);
|
||||||
|
|
||||||
|
// Sanitize Config vars from get_settings.php
|
||||||
|
$config_ticket_from_name = sanitizeInput($config_ticket_from_name);
|
||||||
|
$config_ticket_from_email = sanitizeInput($config_ticket_from_email);
|
||||||
|
$config_base_url = sanitizeInput($config_base_url);
|
||||||
|
|
||||||
|
// Get Company Info
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT company_name, company_phone, company_phone_country_code FROM companies WHERE company_id = 1");
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$company_name = sanitizeInput($row['company_name']);
|
||||||
|
$company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code']));
|
||||||
|
|
||||||
|
// EMAIL
|
||||||
|
$subject = "Ticket resolved - [$ticket_prefix$ticket_number] - $ticket_subject | (pending closure)";
|
||||||
|
$body = "<i style=\'color: #808080\'>##- Please type your reply above this line -##</i><br><br>Hello $contact_name,<br><br>Your ticket regarding $ticket_subject has been marked as solved and is pending closure.<br><br>If your request/issue is resolved, you can simply ignore this email. If you need further assistance, please reply or <a href=\'https://$config_base_url/guest/guest_view_ticket.php?ticket_id=$ticket_id&url_key=$url_key\'>re-open</a> to let us know! <br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Status: $ticket_status<br>Portal: <a href=\'https://$config_base_url/guest/guest_view_ticket.php?ticket_id=$ticket_id&url_key=$url_key\'>View ticket</a><br><br>--<br>$company_name - Support<br>$config_ticket_from_email<br>$company_phone";
|
||||||
|
|
||||||
|
// Check email valid
|
||||||
|
if (filter_var($contact_email, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
// Email Ticket Contact
|
||||||
|
// Queue Mail
|
||||||
|
|
||||||
|
$data[] = [
|
||||||
|
'from' => $config_ticket_from_email,
|
||||||
|
'from_name' => $config_ticket_from_name,
|
||||||
|
'recipient' => $contact_email,
|
||||||
|
'recipient_name' => $contact_name,
|
||||||
|
'subject' => $subject,
|
||||||
|
'body' => $body
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Also Email all the watchers
|
||||||
|
$sql_watchers = mysqli_query($mysqli, "SELECT watcher_email FROM ticket_watchers WHERE watcher_ticket_id = $ticket_id");
|
||||||
|
$body .= "<br><br>----------------------------------------<br>YOU ARE A COLLABORATOR ON THIS TICKET";
|
||||||
|
while ($row = mysqli_fetch_array($sql_watchers)) {
|
||||||
|
$watcher_email = sanitizeInput($row['watcher_email']);
|
||||||
|
|
||||||
|
// Queue Mail
|
||||||
|
$data[] = [
|
||||||
|
'from' => $config_ticket_from_email,
|
||||||
|
'from_name' => $config_ticket_from_name,
|
||||||
|
'recipient' => $watcher_email,
|
||||||
|
'recipient_name' => $watcher_email,
|
||||||
|
'subject' => $subject,
|
||||||
|
'body' => $body
|
||||||
|
];
|
||||||
|
}
|
||||||
|
addToMailQueue($data);
|
||||||
|
}
|
||||||
|
//End Mail IF
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// If the ticket was moved from any status to another status
|
||||||
|
mysqli_query($mysqli, "UPDATE tickets SET ticket_order = $kanban, ticket_status = $status WHERE ticket_id = $ticket_id");
|
||||||
|
customAction('ticket_update', $ticket_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// return a response
|
||||||
|
echo json_encode(['status' => 'success','payload' => $positions]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['update_ticket_tasks_order'])) {
|
||||||
|
// Update multiple ticket tasks order
|
||||||
|
enforceUserPermission('module_support', 2);
|
||||||
|
|
||||||
|
$positions = $_POST['positions'];
|
||||||
|
$ticket_id = intval($_POST['ticket_id']);
|
||||||
|
|
||||||
|
foreach ($positions as $position) {
|
||||||
|
$id = intval($position['id']);
|
||||||
|
$order = intval($position['order']);
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "UPDATE tasks SET task_order = $order WHERE task_ticket_id = $ticket_id AND task_id = $id");
|
||||||
|
}
|
||||||
|
|
||||||
|
// return a response
|
||||||
|
echo json_encode(['status' => 'success']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['update_task_templates_order'])) {
|
||||||
|
// Update multiple task templates order
|
||||||
|
enforceUserPermission('module_support', 2);
|
||||||
|
|
||||||
|
$positions = $_POST['positions'];
|
||||||
|
$ticket_template_id = intval($_POST['ticket_template_id']);
|
||||||
|
|
||||||
|
foreach ($positions as $position) {
|
||||||
|
$id = intval($position['id']);
|
||||||
|
$order = intval($position['order']);
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "UPDATE task_templates SET task_template_order = $order WHERE task_template_ticket_template_id = $ticket_template_id AND task_template_id = $id");
|
||||||
|
}
|
||||||
|
|
||||||
|
// return a response
|
||||||
|
echo json_encode(['status' => 'success']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['update_quote_items_order'])) {
|
||||||
|
// Update multiple quote items order
|
||||||
|
enforceUserPermission('module_sales', 2);
|
||||||
|
|
||||||
|
$positions = $_POST['positions'];
|
||||||
|
$quote_id = intval($_POST['quote_id']);
|
||||||
|
|
||||||
|
foreach ($positions as $position) {
|
||||||
|
$id = intval($position['id']);
|
||||||
|
$order = intval($position['order']);
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "UPDATE invoice_items SET item_order = $order WHERE item_quote_id = $quote_id AND item_id = $id");
|
||||||
|
}
|
||||||
|
|
||||||
|
// return a response
|
||||||
|
echo json_encode(['status' => 'success']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['update_invoice_items_order'])) {
|
||||||
|
// Update multiple invoice items order
|
||||||
|
enforceUserPermission('module_sales', 2);
|
||||||
|
|
||||||
|
$positions = $_POST['positions'];
|
||||||
|
$invoice_id = intval($_POST['invoice_id']);
|
||||||
|
|
||||||
|
foreach ($positions as $position) {
|
||||||
|
$id = intval($position['id']);
|
||||||
|
$order = intval($position['order']);
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "UPDATE invoice_items SET item_order = $order WHERE item_invoice_id = $invoice_id AND item_id = $id");
|
||||||
|
}
|
||||||
|
|
||||||
|
// return a response
|
||||||
|
echo json_encode(['status' => 'success']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['update_recurring_invoice_items_order'])) {
|
||||||
|
// Update multiple recurring invoice items order
|
||||||
|
enforceUserPermission('module_sales', 2);
|
||||||
|
|
||||||
|
$positions = $_POST['positions'];
|
||||||
|
$recurring_id = intval($_POST['recurring_id']);
|
||||||
|
|
||||||
|
foreach ($positions as $position) {
|
||||||
|
$id = intval($position['id']);
|
||||||
|
$order = intval($position['order']);
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "UPDATE invoice_items SET item_order = $order WHERE item_recurring_id = $recurring_id AND item_id = $id");
|
||||||
|
}
|
||||||
|
|
||||||
|
// return a response
|
||||||
|
echo json_encode(['status' => 'success']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|||||||
51
ajax/ajax_account_edit.php
Normal file
51
ajax/ajax_account_edit.php
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$account_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_id = $account_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$account_name = nullable_htmlentities($row['account_name']);
|
||||||
|
$account_notes = nullable_htmlentities($row['account_notes']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-piggy-bank mr-2"></i>Editing account: <strong><?php echo $account_name; ?></strong></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="account_id" value="<?php echo $account_id; ?>">
|
||||||
|
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Account Name <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-piggy-bank"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="name" maxlength="200" value="<?php echo $account_name; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Notes</label>
|
||||||
|
<textarea class="form-control" rows="5" placeholder="Enter some notes" name="notes"><?php echo $account_notes; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_account" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
@@ -1,24 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "includes/inc_all_admin.php";
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
if (!isset($session_is_admin) || !$session_is_admin) {
|
||||||
|
exit(WORDING_ROLECHECK_FAILED . "<br>Tell your admin: Your role does not have admin access.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$email_id = intval($_GET['id']);
|
||||||
|
|
||||||
//Initialize the HTML Purifier to prevent XSS
|
//Initialize the HTML Purifier to prevent XSS
|
||||||
require "plugins/htmlpurifier/HTMLPurifier.standalone.php";
|
require "../plugins/htmlpurifier/HTMLPurifier.standalone.php";
|
||||||
|
|
||||||
$purifier_config = HTMLPurifier_Config::createDefault();
|
$purifier_config = HTMLPurifier_Config::createDefault();
|
||||||
$purifier_config->set('Cache.DefinitionImpl', null); // Disable cache by setting a non-existent directory or an invalid one
|
$purifier_config->set('Cache.DefinitionImpl', null); // Disable cache by setting a non-existent directory or an invalid one
|
||||||
$purifier_config->set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'http' => true, 'https' => true]);
|
$purifier_config->set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'http' => true, 'https' => true]);
|
||||||
$purifier = new HTMLPurifier($purifier_config);
|
$purifier = new HTMLPurifier($purifier_config);
|
||||||
|
|
||||||
if (isset($_GET['email_id'])) {
|
$sql = mysqli_query($mysqli, "SELECT * FROM email_queue WHERE email_id = $email_id LIMIT 1");
|
||||||
$email_id = intval($_GET['email_id']);
|
|
||||||
} else {
|
|
||||||
echo "You dont belong here";
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM email_queue WHERE email_id = $email_id");
|
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_array($sql);
|
||||||
|
|
||||||
$email_from = nullable_htmlentities($row['email_from']);
|
$email_from = nullable_htmlentities($row['email_from']);
|
||||||
@@ -42,37 +40,40 @@ if ($email_status == 0) {
|
|||||||
$email_status_display = "<div class='text-success'>Sent</div><small class='text-secondary'>$email_sent_at</small>";
|
$email_status_display = "<div class='text-success'>Sent</div><small class='text-secondary'>$email_sent_at</small>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
?>
|
?>
|
||||||
|
<div class="modal-header">
|
||||||
<ol class="breadcrumb d-print-none">
|
<h5 class="modal-title"><i class='fas fa-fw fa-envelope-open mr-2'></i><strong><?php echo $email_subject; ?></strong></h5>
|
||||||
<li class="breadcrumb-item">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
<a href="admin_user.php"><i class="fas fa-fw fa-user-shield mr-2"></i>Admin</a>
|
<span>×</span>
|
||||||
</li>
|
</button>
|
||||||
<li class="breadcrumb-item">
|
|
||||||
<a href="admin_mail_queue.php"><i class="fas fa-fw fa-mail-bulk mr-2"></i>Mail Queue</a>
|
|
||||||
</li>
|
|
||||||
<li class="breadcrumb-item active"><i class="fas fa-fw fa-envelope-open mr-2"></i><?php echo $email_subject; ?></li>
|
|
||||||
</ol>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
|
|
||||||
<div class="col-md-12">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header bg-dark">
|
|
||||||
<div>From: <?php echo "$email_from_name <small>($email_from)</small>"; ?></div>
|
|
||||||
<div>To: <?php echo "$email_recipient_name <small>($email_recipient)</small>"; ?></div>
|
|
||||||
<div>Subject: <?php echo $email_subject; ?></div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body prettyContent">
|
<div class="modal-body bg-white">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<span class="text-secondary">From:</span>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<?php echo "<strong>$email_from_name</strong> ($email_from)"; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr class="my-2">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<span class="text-secondary">To:</span>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<?php echo "<strong>$email_recipient_name</strong> ($email_recipient)"; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr class="my-2">
|
||||||
|
<div class="prettyContent">
|
||||||
<?php echo $email_content; ?>
|
<?php echo $email_content; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
<script src="../js/pretty_content.js"></script>
|
||||||
|
|
||||||
<script src="js/pretty_content.js"></script>
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
require_once "includes/footer.php";
|
|
||||||
436
ajax/ajax_asset_copy.php
Normal file
436
ajax/ajax_asset_copy.php
Normal file
@@ -0,0 +1,436 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$asset_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM assets
|
||||||
|
LEFT JOIN asset_interfaces ON interface_asset_id = asset_id AND interface_primary = 1
|
||||||
|
WHERE asset_id = $asset_id LIMIT 1"
|
||||||
|
);
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$client_id = intval($row['asset_client_id']);
|
||||||
|
$asset_id = intval($row['asset_id']);
|
||||||
|
$asset_type = nullable_htmlentities($row['asset_type']);
|
||||||
|
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||||
|
$asset_description = nullable_htmlentities($row['asset_description']);
|
||||||
|
$asset_make = nullable_htmlentities($row['asset_make']);
|
||||||
|
$asset_model = nullable_htmlentities($row['asset_model']);
|
||||||
|
$asset_serial = nullable_htmlentities($row['asset_serial']);
|
||||||
|
$asset_os = nullable_htmlentities($row['asset_os']);
|
||||||
|
$asset_ip = nullable_htmlentities($row['interface_ip']);
|
||||||
|
$asset_ipv6 = nullable_htmlentities($row['interface_ipv6']);
|
||||||
|
$asset_nat_ip = nullable_htmlentities($row['interface_nat_ip']);
|
||||||
|
$asset_mac = nullable_htmlentities($row['interface_mac']);
|
||||||
|
$asset_uri = nullable_htmlentities($row['asset_uri']);
|
||||||
|
$asset_uri_2 = nullable_htmlentities($row['asset_uri_2']);
|
||||||
|
$asset_status = nullable_htmlentities($row['asset_status']);
|
||||||
|
$asset_purchase_date = nullable_htmlentities($row['asset_purchase_date']);
|
||||||
|
$asset_warranty_expire = nullable_htmlentities($row['asset_warranty_expire']);
|
||||||
|
$asset_install_date = nullable_htmlentities($row['asset_install_date']);
|
||||||
|
$asset_photo = nullable_htmlentities($row['asset_photo']);
|
||||||
|
$asset_physical_location = nullable_htmlentities($row['asset_physical_location']);
|
||||||
|
$asset_notes = nullable_htmlentities($row['asset_notes']);
|
||||||
|
$asset_created_at = nullable_htmlentities($row['asset_created_at']);
|
||||||
|
$asset_archived_at = nullable_htmlentities($row['asset_archived_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['interface_network_id']);
|
||||||
|
$device_icon = getAssetIcon($asset_type);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class='fa fa-fw fa-<?php echo $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" enctype="multipart/form-data" autocomplete="off">
|
||||||
|
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||||
|
<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="#pillsNetworkCopy<?php echo $asset_id; ?>">Network</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>Description</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="description" placeholder="Description of the asset" value="<?php echo $asset_description; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Type <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-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="pillsNetworkCopy<?php echo $asset_id; ?>">
|
||||||
|
|
||||||
|
<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="">- Select Network -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_networks = 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_networks)) {
|
||||||
|
$network_id_select = intval($row['network_id']);
|
||||||
|
$network_name_select = nullable_htmlentities($row['network_name']);
|
||||||
|
$network_select = nullable_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 Address or DHCP</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="192.168.10.250" data-inputmask="'alias': 'ip'" data-mask>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<div class="input-group-text">
|
||||||
|
<input type="checkbox" name="dhcp" value="1" <?php if($asset_ip == 'DHCP'){ echo "checked"; } ?>>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>NAT IP</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-random"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="nat_ip" placeholder="10.52.4.55" data-inputmask="'alias': 'ip'" data-mask>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>IPv6 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="ipv6" value="<?php echo $asset_ipv6; ?>" placeholder="ex. 2001:0db8:0000:0000:0000:ff00:0042:8329">
|
||||||
|
</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 class="form-group">
|
||||||
|
<label>URI</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="uri" placeholder="URI http:// ftp:// ssh: etc">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>URI 2</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="uri_2" placeholder="URI http:// ftp:// ssh: etc">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pillsAssignmentCopy<?php echo $asset_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Physical Location</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="physical_location" placeholder="Physical location eg. Floor 2, Closet B">
|
||||||
|
</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="">- Select Location -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_locations = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_archived_at IS NULL AND location_client_id = $client_id ORDER BY location_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_locations)) {
|
||||||
|
$location_id_select = intval($row['location_id']);
|
||||||
|
$location_name_select = nullable_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>Assign 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="">- Select 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_select = intval($row['contact_id']);
|
||||||
|
$contact_name_select = nullable_htmlentities($row['contact_name']);
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $contact_id_select; ?>"><?php echo $contact_name_select; ?></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>
|
||||||
|
|
||||||
|
<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="">- Select Vendor -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_vendors = 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_vendors)) {
|
||||||
|
$vendor_id_select = intval($row['vendor_id']);
|
||||||
|
$vendor_name_select = nullable_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-check"></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-times"></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="off">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pillsNotesCopy<?php echo $asset_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Upload Photo</label>
|
||||||
|
<input type="file" class="form-control-file" name="file">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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 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>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
865
ajax/ajax_asset_details.php
Normal file
865
ajax/ajax_asset_details.php
Normal file
@@ -0,0 +1,865 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$asset_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM assets
|
||||||
|
LEFT JOIN clients ON client_id = asset_client_id
|
||||||
|
LEFT JOIN contacts ON asset_contact_id = contact_id
|
||||||
|
LEFT JOIN locations ON asset_location_id = location_id
|
||||||
|
LEFT JOIN asset_interfaces ON interface_asset_id = asset_id AND interface_primary = 1
|
||||||
|
WHERE asset_id = $asset_id
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$client_id = intval($row['client_id']);
|
||||||
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
|
$asset_id = intval($row['asset_id']);
|
||||||
|
$asset_type = nullable_htmlentities($row['asset_type']);
|
||||||
|
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||||
|
$asset_description = nullable_htmlentities($row['asset_description']);
|
||||||
|
$asset_make = nullable_htmlentities($row['asset_make']);
|
||||||
|
$asset_model = nullable_htmlentities($row['asset_model']);
|
||||||
|
$asset_serial = nullable_htmlentities($row['asset_serial']);
|
||||||
|
$asset_os = nullable_htmlentities($row['asset_os']);
|
||||||
|
$asset_uri = nullable_htmlentities($row['asset_uri']);
|
||||||
|
$asset_uri_2 = nullable_htmlentities($row['asset_uri_2']);
|
||||||
|
$asset_status = nullable_htmlentities($row['asset_status']);
|
||||||
|
$asset_purchase_reference = nullable_htmlentities($row['asset_purchase_reference']);
|
||||||
|
$asset_purchase_date = nullable_htmlentities($row['asset_purchase_date']);
|
||||||
|
$asset_warranty_expire = nullable_htmlentities($row['asset_warranty_expire']);
|
||||||
|
$asset_install_date = nullable_htmlentities($row['asset_install_date']);
|
||||||
|
$asset_photo = nullable_htmlentities($row['asset_photo']);
|
||||||
|
$asset_physical_location = nullable_htmlentities($row['asset_physical_location']);
|
||||||
|
$asset_notes = nullable_htmlentities($row['asset_notes']);
|
||||||
|
$asset_created_at = nullable_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_ip = nullable_htmlentities($row['interface_ip']);
|
||||||
|
$asset_ipv6 = nullable_htmlentities($row['interface_ipv6']);
|
||||||
|
$asset_nat_ip = nullable_htmlentities($row['interface_nat_ip']);
|
||||||
|
$asset_mac = nullable_htmlentities($row['interface_mac']);
|
||||||
|
$asset_network_id = intval($row['interface_network_id']);
|
||||||
|
|
||||||
|
$device_icon = getAssetIcon($asset_type);
|
||||||
|
|
||||||
|
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||||
|
$contact_email = nullable_htmlentities($row['contact_email']);
|
||||||
|
$contact_phone = nullable_htmlentities($row['contact_phone']);
|
||||||
|
$contact_extension = nullable_htmlentities($row['contact_extension']);
|
||||||
|
$contact_mobile = nullable_htmlentities($row['contact_mobile']);
|
||||||
|
$contact_archived_at = nullable_htmlentities($row['contact_archived_at']);
|
||||||
|
if ($contact_archived_at) {
|
||||||
|
$contact_name_display = "<span class='text-danger' title='Archived'><s>$contact_name</s></span>";
|
||||||
|
} else {
|
||||||
|
$contact_name_display = $contact_name;
|
||||||
|
}
|
||||||
|
$location_name = nullable_htmlentities($row['location_name']);
|
||||||
|
if (empty($location_name)) {
|
||||||
|
$location_name = "-";
|
||||||
|
}
|
||||||
|
$location_archived_at = nullable_htmlentities($row['location_archived_at']);
|
||||||
|
if ($location_archived_at) {
|
||||||
|
$location_name_display = "<span class='text-danger' title='Archived'><s>$location_name</s></span>";
|
||||||
|
} else {
|
||||||
|
$location_name_display = $location_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Network Interfaces
|
||||||
|
$sql_related_interfaces = mysqli_query($mysqli, "
|
||||||
|
SELECT
|
||||||
|
ai.interface_id,
|
||||||
|
ai.interface_name,
|
||||||
|
ai.interface_description,
|
||||||
|
ai.interface_type,
|
||||||
|
ai.interface_mac,
|
||||||
|
ai.interface_ip,
|
||||||
|
ai.interface_nat_ip,
|
||||||
|
ai.interface_ipv6,
|
||||||
|
ai.interface_primary,
|
||||||
|
ai.interface_notes,
|
||||||
|
n.network_name,
|
||||||
|
n.network_id,
|
||||||
|
connected_interfaces.interface_id AS connected_interface_id,
|
||||||
|
connected_interfaces.interface_name AS connected_interface_name,
|
||||||
|
connected_assets.asset_name AS connected_asset_name,
|
||||||
|
connected_assets.asset_id AS connected_asset_id,
|
||||||
|
connected_assets.asset_type AS connected_asset_type
|
||||||
|
FROM asset_interfaces AS ai
|
||||||
|
LEFT JOIN networks AS n
|
||||||
|
ON n.network_id = ai.interface_network_id
|
||||||
|
LEFT JOIN asset_interface_links AS ail
|
||||||
|
ON (ail.interface_a_id = ai.interface_id OR ail.interface_b_id = ai.interface_id)
|
||||||
|
LEFT JOIN asset_interfaces AS connected_interfaces
|
||||||
|
ON (
|
||||||
|
(ail.interface_a_id = ai.interface_id AND ail.interface_b_id = connected_interfaces.interface_id)
|
||||||
|
OR
|
||||||
|
(ail.interface_b_id = ai.interface_id AND ail.interface_a_id = connected_interfaces.interface_id)
|
||||||
|
)
|
||||||
|
LEFT JOIN assets AS connected_assets
|
||||||
|
ON connected_assets.asset_id = connected_interfaces.interface_asset_id
|
||||||
|
WHERE
|
||||||
|
ai.interface_asset_id = $asset_id
|
||||||
|
AND ai.interface_archived_at IS NULL
|
||||||
|
ORDER BY ai.interface_name ASC
|
||||||
|
");
|
||||||
|
$interface_count = mysqli_num_rows($sql_related_interfaces);
|
||||||
|
|
||||||
|
// Related Credentials Query
|
||||||
|
$sql_related_credentials = mysqli_query($mysqli, "
|
||||||
|
SELECT
|
||||||
|
credentials.credential_id AS credential_id,
|
||||||
|
credentials.credential_name,
|
||||||
|
credentials.credential_description,
|
||||||
|
credentials.credential_uri,
|
||||||
|
credentials.credential_username,
|
||||||
|
credentials.credential_password,
|
||||||
|
credentials.credential_otp_secret,
|
||||||
|
credentials.credential_note,
|
||||||
|
credentials.credential_important,
|
||||||
|
credentials.credential_contact_id,
|
||||||
|
credentials.credential_asset_id
|
||||||
|
FROM credentials
|
||||||
|
LEFT JOIN credential_tags ON credential_tags.credential_id = credentials.credential_id
|
||||||
|
LEFT JOIN tags ON tags.tag_id = credential_tags.tag_id
|
||||||
|
WHERE credential_asset_id = $asset_id
|
||||||
|
AND credential_archived_at IS NULL
|
||||||
|
GROUP BY credentials.credential_id
|
||||||
|
ORDER BY credential_name DESC
|
||||||
|
");
|
||||||
|
$credential_count = mysqli_num_rows($sql_related_credentials);
|
||||||
|
|
||||||
|
// Related Tickets Query
|
||||||
|
$sql_related_tickets = mysqli_query($mysqli, "
|
||||||
|
SELECT tickets.*, users.*, ticket_statuses.*
|
||||||
|
FROM tickets
|
||||||
|
LEFT JOIN users ON ticket_assigned_to = user_id
|
||||||
|
LEFT JOIN ticket_statuses ON ticket_status_id = ticket_status
|
||||||
|
LEFT JOIN ticket_assets ON tickets.ticket_id = ticket_assets.ticket_id
|
||||||
|
WHERE ticket_asset_id = $asset_id OR ticket_assets.asset_id = $asset_id
|
||||||
|
GROUP BY tickets.ticket_id
|
||||||
|
ORDER BY ticket_number DESC
|
||||||
|
");
|
||||||
|
$ticket_count = mysqli_num_rows($sql_related_tickets);
|
||||||
|
|
||||||
|
// Related Recurring Tickets Query
|
||||||
|
$sql_related_recurring_tickets = mysqli_query($mysqli, "SELECT * FROM recurring_tickets
|
||||||
|
LEFT JOIN recurring_ticket_assets ON recurring_tickets.recurring_ticket_id = recurring_ticket_assets.recurring_ticket_id
|
||||||
|
WHERE recurring_ticket_asset_id = $asset_id OR recurring_ticket_assets.asset_id = $asset_id
|
||||||
|
GROUP BY recurring_tickets.recurring_ticket_id
|
||||||
|
ORDER BY recurring_ticket_next_run DESC"
|
||||||
|
);
|
||||||
|
$recurring_ticket_count = mysqli_num_rows($sql_related_recurring_tickets);
|
||||||
|
|
||||||
|
// Related Documents
|
||||||
|
$sql_related_documents = mysqli_query($mysqli, "SELECT * FROM asset_documents
|
||||||
|
LEFT JOIN documents ON asset_documents.document_id = documents.document_id
|
||||||
|
LEFT JOIN users ON user_id = document_created_by
|
||||||
|
WHERE asset_documents.asset_id = $asset_id
|
||||||
|
AND document_archived_at IS NULL
|
||||||
|
ORDER BY document_name DESC"
|
||||||
|
);
|
||||||
|
$document_count = mysqli_num_rows($sql_related_documents);
|
||||||
|
|
||||||
|
// Related Files
|
||||||
|
$sql_related_files = mysqli_query($mysqli, "SELECT * FROM asset_files
|
||||||
|
LEFT JOIN files ON asset_files.file_id = files.file_id
|
||||||
|
WHERE asset_files.asset_id = $asset_id
|
||||||
|
AND file_archived_at IS NULL
|
||||||
|
ORDER BY file_name DESC"
|
||||||
|
);
|
||||||
|
$file_count = mysqli_num_rows($sql_related_files);
|
||||||
|
|
||||||
|
// Related Software Query
|
||||||
|
$sql_related_software = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT * FROM software_assets
|
||||||
|
LEFT JOIN software ON software_assets.software_id = software.software_id
|
||||||
|
WHERE software_assets.asset_id = $asset_id
|
||||||
|
AND software_archived_at IS NULL
|
||||||
|
ORDER BY software_name DESC"
|
||||||
|
);
|
||||||
|
|
||||||
|
$software_count = mysqli_num_rows($sql_related_software);
|
||||||
|
|
||||||
|
if (isset($_GET['client_id'])) {
|
||||||
|
$client_url = "client_id=$client_id&";
|
||||||
|
} else {
|
||||||
|
$client_url = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-<?php echo $device_icon; ?> mr-2"></i><strong><?php echo $asset_name; ?></strong></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="#pills-asset-details<?php echo $asset_id; ?>"><i class="fas fa-fw fa-<?php echo $device_icon; ?> fa-2x"></i><br>Details</a>
|
||||||
|
</li>
|
||||||
|
<?php if ($interface_count) { ?>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-asset-interfaces<?php echo $asset_id; ?>"><i class="fas fa-fw fa-ethernet fa-2x"></i><br>Interfaces (<?php echo $interface_count; ?>)</a>
|
||||||
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if ($credential_count) { ?>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-asset-credentials<?php echo $asset_id; ?>"><i class="fas fa-fw fa-key fa-2x"></i><br>Credentials (<?php echo $credential_count; ?>)</a>
|
||||||
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if ($ticket_count) { ?>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-asset-tickets<?php echo $asset_id; ?>"><i class="fas fa-fw fa-life-ring fa-2x"></i><br>Tickets (<?php echo $ticket_count; ?>)</a>
|
||||||
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if ($recurring_ticket_count) { ?>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-asset-recurring-tickets<?php echo $asset_id; ?>"><i class="fas fa-fw fa-redo-alt fa-2x"></i><br>Recurring Tickets (<?php echo $recurring_ticket_count; ?>)</a>
|
||||||
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if ($software_count) { ?>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-asset-licenses<?php echo $asset_id; ?>"><i class="fas fa-fw fa-cube fa-2x"></i><br>Licenses (<?php echo $software_count; ?>)</a>
|
||||||
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if ($document_count) { ?>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-asset-documents<?php echo $asset_id; ?>"><i class="fas fa-fw fa-file-alt fa-2x"></i><br>Documents (<?php echo $document_count; ?>)</a>
|
||||||
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if ($file_count) { ?>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-asset-files<?php echo $asset_id; ?>"><i class="fas fa-fw fa-briefcase fa-2x"></i><br>Files (<?php echo $file_count; ?>)</a>
|
||||||
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="tab-content">
|
||||||
|
|
||||||
|
<div class="tab-pane fade show active" id="pills-asset-details<?php echo $asset_id; ?>">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="text-bold"><i class="fa fa-fw text-secondary fa-<?php echo $device_icon; ?> mr-3"></i><?php echo $asset_name; ?></h3>
|
||||||
|
<?php if ($asset_photo) { ?>
|
||||||
|
<img class="img-fluid img-circle p-3" alt="asset_photo" src="<?php echo "uploads/clients/$client_id/$asset_photo"; ?>">
|
||||||
|
<?php } ?>
|
||||||
|
<?php if ($asset_description) { ?>
|
||||||
|
<div class="text-secondary"><?php echo $asset_description; ?></div>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<?php if ($asset_type) { ?>
|
||||||
|
<div><i class="fa fa-fw fa-tag text-secondary mr-3"></i><?php echo $asset_type; ?></div>
|
||||||
|
<?php }
|
||||||
|
if ($asset_make) { ?>
|
||||||
|
<div class="mt-2"><i class="fa fa-fw fa-circle text-secondary mr-3"></i><?php echo "$asset_make $asset_model"; ?></div>
|
||||||
|
<?php }
|
||||||
|
if ($asset_os) { ?>
|
||||||
|
<div class="mt-2"><i class="fab fa-fw fa-windows text-secondary mr-3"></i><?php echo "$asset_os"; ?></div>
|
||||||
|
<?php }
|
||||||
|
if ($asset_serial) { ?>
|
||||||
|
<div class="mt-2"><i class="fa fa-fw fa-barcode text-secondary mr-3"></i><?php echo $asset_serial; ?></div>
|
||||||
|
<?php }
|
||||||
|
if ($asset_purchase_date) { ?>
|
||||||
|
<div class="mt-2"><i class="fa fa-fw fa-shopping-cart text-secondary mr-3"></i><?php echo date('Y-m-d', strtotime($asset_purchase_date)); ?></div>
|
||||||
|
<?php }
|
||||||
|
if ($asset_install_date) { ?>
|
||||||
|
<div class="mt-2"><i class="fa fa-fw fa-calendar-check text-secondary mr-3"></i><?php echo date('Y-m-d', strtotime($asset_install_date)); ?></div>
|
||||||
|
<?php }
|
||||||
|
if ($asset_warranty_expire) { ?>
|
||||||
|
<div class="mt-2"><i class="fa fa-fw fa-exclamation-triangle text-secondary mr-3"></i><?php echo date('Y-m-d', strtotime($asset_warranty_expire)); ?></div>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card card-dark">
|
||||||
|
<div class="card-header">
|
||||||
|
<h5 class="card-title">Primary Network Interface</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<?php if ($asset_ip) { ?>
|
||||||
|
<div><i class="fa fa-fw fa-globe text-secondary mr-3"></i><?php echo $asset_ip; ?></div>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if ($asset_nat_ip) { ?>
|
||||||
|
<div class="mt-2"><i class="fa fa-fw fa-random text-secondary mr-3"></i><?php echo $asset_nat_ip; ?></div>
|
||||||
|
<?php }
|
||||||
|
if ($asset_mac) { ?>
|
||||||
|
<div class="mt-2"><i class="fa fa-fw fa-ethernet text-secondary mr-3"></i><?php echo $asset_mac; ?></div>
|
||||||
|
<?php }
|
||||||
|
if ($asset_uri) { ?>
|
||||||
|
<div class="mt-2"><i class="fa fa-fw fa-link text-secondary mr-3"></i><a href="<?php echo $asset_uri; ?>" target="_blank">Link</a></div>
|
||||||
|
<?php }
|
||||||
|
if ($asset_uri_2) { ?>
|
||||||
|
<div class="mt-2"><i class="fa fa-fw fa-link text-secondary mr-3"></i><a href="<?php echo $asset_uri_2; ?>" target="_blank">Link 2</a></div>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="card card-dark">
|
||||||
|
<div class="card-header">
|
||||||
|
<h5 class="card-title">Assignment</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<?php if ($location_name) { ?>
|
||||||
|
<div><i class="fa fa-fw fa-map-marker-alt text-secondary mr-3"></i><?php echo $location_name_display; ?></div>
|
||||||
|
<?php }
|
||||||
|
if ($contact_name) { ?>
|
||||||
|
<div class="mt-2"><i class="fa fa-fw fa-user text-secondary mr-3"></i><?php echo $contact_name_display; ?></div>
|
||||||
|
<?php }
|
||||||
|
if ($contact_email) { ?>
|
||||||
|
<div class="mt-2"><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 }
|
||||||
|
if ($contact_phone) { ?>
|
||||||
|
<div class="mt-2"><i class="fa fa-fw fa-phone text-secondary mr-3"></i><?php echo formatPhoneNumber($contact_phone); echo " $contact_extension"; ?></div>
|
||||||
|
<?php }
|
||||||
|
if ($contact_mobile) { ?>
|
||||||
|
<div class="mt-2"><i class="fa fa-fw fa-mobile-alt text-secondary mr-3"></i><?php echo formatPhoneNumber($contact_mobile); ?></div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card card-dark mb-3">
|
||||||
|
<div class="card-header">
|
||||||
|
<h5 class="card-title">Additional Notes</h5>
|
||||||
|
</div>
|
||||||
|
<textarea class="form-control" rows=6 id="assetNotes" placeholder="Enter quick notes here" onblur="updateAssetNotes(<?php echo $asset_id ?>)"><?php echo $asset_notes ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function updateAssetNotes(asset_id) {
|
||||||
|
var notes = document.getElementById("assetNotes").value;
|
||||||
|
|
||||||
|
// 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",
|
||||||
|
{
|
||||||
|
asset_set_notes: 'TRUE',
|
||||||
|
asset_id: asset_id,
|
||||||
|
notes: notes
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?php if ($interface_count) { ?>
|
||||||
|
<div class="tab-pane fade" id="pills-asset-interfaces<?php echo $asset_id; ?>">
|
||||||
|
|
||||||
|
<div class="table-responsive-sm">
|
||||||
|
<table class="table table-striped table-borderless table-hover table-sm">
|
||||||
|
<thead class="<?php if ($interface_count == 0) { echo "d-none"; } ?>">
|
||||||
|
<tr>
|
||||||
|
<th>Name / Port</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>MAC</th>
|
||||||
|
<th>IP</th>
|
||||||
|
<th>Network</th>
|
||||||
|
<th>Connected To</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php while ($row = mysqli_fetch_array($sql_related_interfaces)) { ?>
|
||||||
|
<?php
|
||||||
|
$interface_id = intval($row['interface_id']);
|
||||||
|
$interface_name = nullable_htmlentities($row['interface_name']);
|
||||||
|
$interface_description = nullable_htmlentities($row['interface_description']);
|
||||||
|
$interface_type = nullable_htmlentities($row['interface_type']);
|
||||||
|
$interface_mac = nullable_htmlentities($row['interface_mac']);
|
||||||
|
$interface_ip = nullable_htmlentities($row['interface_ip']);
|
||||||
|
$interface_nat_ip = nullable_htmlentities($row['interface_nat_ip']);
|
||||||
|
$interface_ipv6 = nullable_htmlentities($row['interface_ipv6']);
|
||||||
|
$interface_primary = intval($row['interface_primary']);
|
||||||
|
$network_id = intval($row['network_id']);
|
||||||
|
$network_name = nullable_htmlentities($row['network_name']);
|
||||||
|
$interface_notes = nullable_htmlentities($row['interface_notes']);
|
||||||
|
|
||||||
|
// Prepare display text
|
||||||
|
$interface_mac_display = $interface_mac ?: '-';
|
||||||
|
$interface_ip_display = $interface_ip ?: '-';
|
||||||
|
$interface_type_display = $interface_type ?: '-';
|
||||||
|
$network_name_display = $network_name
|
||||||
|
? "<i class='fas fa-fw fa-network-wired mr-1'></i>$network_name"
|
||||||
|
: '-';
|
||||||
|
|
||||||
|
// Connected interface details
|
||||||
|
$connected_asset_id = intval($row['connected_asset_id']);
|
||||||
|
$connected_asset_name = nullable_htmlentities($row['connected_asset_name']);
|
||||||
|
$connected_asset_type = nullable_htmlentities($row['connected_asset_type']);
|
||||||
|
$connected_asset_icon = getAssetIcon($connected_asset_type);
|
||||||
|
$connected_interface_name = nullable_htmlentities($row['connected_interface_name']);
|
||||||
|
|
||||||
|
|
||||||
|
// Show either "-" or "AssetName - Port"
|
||||||
|
if ($connected_asset_name) {
|
||||||
|
$connected_to_display =
|
||||||
|
"<a href='#' data-toggle='ajax-modal'
|
||||||
|
data-modal-size='lg'
|
||||||
|
data-ajax-url='ajax/ajax_asset_details.php'
|
||||||
|
data-ajax-id='$connected_asset_id'>
|
||||||
|
<strong><i class='fa fa-fw fa-$connected_asset_icon mr-1'></i>$connected_asset_name</strong> - $connected_interface_name
|
||||||
|
</a>
|
||||||
|
";
|
||||||
|
} else {
|
||||||
|
$connected_to_display = "-";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<i class="fa fa-fw fa-ethernet text-secondary mr-1"></i>
|
||||||
|
<?php echo $interface_name; ?> <?php if($interface_primary) { echo "<small class='text-primary'>(Primary)</small>"; } ?>
|
||||||
|
</td>
|
||||||
|
<td><?php echo $interface_type_display; ?></td>
|
||||||
|
<td><?php echo $interface_mac_display; ?></td>
|
||||||
|
<td><?php echo $interface_ip_display; ?></td>
|
||||||
|
<td><?php echo $network_name_display; ?></td>
|
||||||
|
<td><?php echo $connected_to_display; ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ($credential_count) { ?>
|
||||||
|
<div class="tab-pane fade" id="pills-asset-credentials<?php echo $asset_id; ?>">
|
||||||
|
<div class="table-responsive-sm-sm">
|
||||||
|
<table class="table table-sm table-striped table-borderless table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Username</th>
|
||||||
|
<th>Password</th>
|
||||||
|
<th>OTP</th>
|
||||||
|
<th>URI</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_array($sql_related_credentials)) {
|
||||||
|
$credential_id = intval($row['credential_id']);
|
||||||
|
$credential_name = nullable_htmlentities($row['credential_name']);
|
||||||
|
$credential_description = nullable_htmlentities($row['credential_description']);
|
||||||
|
$credential_uri = nullable_htmlentities($row['credential_uri']);
|
||||||
|
if (empty($credential_uri)) {
|
||||||
|
$credential_uri_display = "-";
|
||||||
|
} else {
|
||||||
|
$credential_uri_display = "$credential_uri";
|
||||||
|
}
|
||||||
|
$credential_username = nullable_htmlentities(decryptCredentialEntry($row['credential_username']));
|
||||||
|
if (empty($credential_username)) {
|
||||||
|
$credential_username_display = "-";
|
||||||
|
} else {
|
||||||
|
$credential_username_display = "$credential_username <button type='button' class='btn btn-sm clipboardjs' data-clipboard-text='$credential_username'><i class='far fa-copy text-secondary'></i></button>";
|
||||||
|
}
|
||||||
|
$credential_password = nullable_htmlentities(decryptCredentialEntry($row['credential_password']));
|
||||||
|
$credential_otp_secret = nullable_htmlentities($row['credential_otp_secret']);
|
||||||
|
$credential_id_with_secret = '"' . $row['credential_id'] . '","' . $row['credential_otp_secret'] . '"';
|
||||||
|
if (empty($credential_otp_secret)) {
|
||||||
|
$otp_display = "-";
|
||||||
|
} else {
|
||||||
|
$otp_display = "<span onmouseenter='showOTPViaCredentialID($credential_id)'><i class='far fa-clock'></i> <span id='otp_$credential_id'><i>Hover..</i></span></span>";
|
||||||
|
}
|
||||||
|
$credential_note = nullable_htmlentities($row['credential_note']);
|
||||||
|
$credential_important = intval($row['credential_important']);
|
||||||
|
$credential_contact_id = intval($row['credential_contact_id']);
|
||||||
|
$credential_asset_id = intval($row['credential_asset_id']);
|
||||||
|
|
||||||
|
// Tags
|
||||||
|
$credential_tag_name_display_array = array();
|
||||||
|
$credential_tag_id_array = array();
|
||||||
|
$sql_credential_tags = mysqli_query($mysqli, "SELECT * FROM credential_tags LEFT JOIN tags ON credential_tags.tag_id = tags.tag_id WHERE credential_id = $credential_id ORDER BY tag_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_credential_tags)) {
|
||||||
|
|
||||||
|
$credential_tag_id = intval($row['tag_id']);
|
||||||
|
$credential_tag_name = nullable_htmlentities($row['tag_name']);
|
||||||
|
$credential_tag_color = nullable_htmlentities($row['tag_color']);
|
||||||
|
if (empty($credential_tag_color)) {
|
||||||
|
$credential_tag_color = "dark";
|
||||||
|
}
|
||||||
|
$credential_tag_icon = nullable_htmlentities($row['tag_icon']);
|
||||||
|
if (empty($credential_tag_icon)) {
|
||||||
|
$credential_tag_icon = "tag";
|
||||||
|
}
|
||||||
|
|
||||||
|
$credential_tag_id_array[] = $credential_tag_id;
|
||||||
|
$credential_tag_name_display_array[] = "<a href='credentials.php?client_id=$client_id&tags[]=$credential_tag_id'><span class='badge text-light p-1 mr-1' style='background-color: $credential_tag_color;'><i class='fa fa-fw fa-$credential_tag_icon mr-2'></i>$credential_tag_name</span></a>";
|
||||||
|
}
|
||||||
|
$credential_tags_display = implode('', $credential_tag_name_display_array);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<i class="fa fa-fw fa-key text-secondary"></i>
|
||||||
|
<?php echo $credential_name; ?>
|
||||||
|
</td>
|
||||||
|
<td><?php echo $credential_username_display; ?></td>
|
||||||
|
<td>
|
||||||
|
<button class="btn p-0" type="button" data-toggle="popover" data-trigger="focus" data-placement="top" data-content="<?php echo $credential_password; ?>"><i class="fas fa-2x fa-ellipsis-h text-secondary"></i><i class="fas fa-2x fa-ellipsis-h text-secondary"></i></button>
|
||||||
|
<button type='button' class='btn btn-sm clipboardjs' data-clipboard-text='<?php echo $credential_password; ?>'><i class='far fa-copy text-secondary'></i></button>
|
||||||
|
</td>
|
||||||
|
<td><?php echo $otp_display; ?></td>
|
||||||
|
<td><?php echo $credential_uri_display; ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Include script to get TOTP code via the credentials ID -->
|
||||||
|
<script src="js/credential_show_otp_via_id.js"></script>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ($ticket_count) { ?>
|
||||||
|
<div class="tab-pane fade" id="pills-asset-tickets<?php echo $asset_id; ?>">
|
||||||
|
<div class="table-responsive-sm">
|
||||||
|
<table class="table table-sm 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>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_array($sql_related_tickets)) {
|
||||||
|
$ticket_id = intval($row['ticket_id']);
|
||||||
|
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
|
||||||
|
$ticket_number = intval($row['ticket_number']);
|
||||||
|
$ticket_subject = nullable_htmlentities($row['ticket_subject']);
|
||||||
|
$ticket_priority = nullable_htmlentities($row['ticket_priority']);
|
||||||
|
$ticket_status_id = intval($row['ticket_status_id']);
|
||||||
|
$ticket_status_name = nullable_htmlentities($row['ticket_status_name']);
|
||||||
|
$ticket_status_color = nullable_htmlentities($row['ticket_status_color']);
|
||||||
|
$ticket_created_at = nullable_htmlentities($row['ticket_created_at']);
|
||||||
|
$ticket_updated_at = nullable_htmlentities($row['ticket_updated_at']);
|
||||||
|
if (empty($ticket_updated_at)) {
|
||||||
|
if ($ticket_status_name == "Closed") {
|
||||||
|
$ticket_updated_at_display = "<p>Never</p>";
|
||||||
|
} else {
|
||||||
|
$ticket_updated_at_display = "<p class='text-danger'>Never</p>";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$ticket_updated_at_display = $ticket_updated_at;
|
||||||
|
}
|
||||||
|
$ticket_closed_at = nullable_htmlentities($row['ticket_closed_at']);
|
||||||
|
|
||||||
|
if ($ticket_priority == "High") {
|
||||||
|
$ticket_priority_display = "<span class='p-2 badge badge-danger'>$ticket_priority</span>";
|
||||||
|
} elseif ($ticket_priority == "Medium") {
|
||||||
|
$ticket_priority_display = "<span class='p-2 badge badge-warning'>$ticket_priority</span>";
|
||||||
|
} elseif ($ticket_priority == "Low") {
|
||||||
|
$ticket_priority_display = "<span class='p-2 badge badge-info'>$ticket_priority</span>";
|
||||||
|
} else {
|
||||||
|
$ticket_priority_display = "-";
|
||||||
|
}
|
||||||
|
$ticket_assigned_to = intval($row['ticket_assigned_to']);
|
||||||
|
if (empty($ticket_assigned_to)) {
|
||||||
|
if ($ticket_status_id == 5) {
|
||||||
|
$ticket_assigned_to_display = "<p>Not Assigned</p>";
|
||||||
|
} else {
|
||||||
|
$ticket_assigned_to_display = "<p class='text-danger'>Not Assigned</p>";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$ticket_assigned_to_display = nullable_htmlentities($row['user_name']);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="ticket.php?client_id=<?php echo $client_id; ?>&ticket_id=<?php echo $ticket_id; ?>">
|
||||||
|
<?php echo "$ticket_prefix$ticket_number"; ?>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td><a href="ticket.php?client_id=<?php echo $client_id; ?>&ticket_id=<?php echo $ticket_id; ?>"><?php echo $ticket_subject; ?></a></td>
|
||||||
|
<td><?php echo $ticket_priority_display; ?></td>
|
||||||
|
<td>
|
||||||
|
<span class='badge badge-pill text-light p-2' style="background-color: <?php echo $ticket_status_color; ?>"><?php echo $ticket_status_name; ?></span>
|
||||||
|
</td>
|
||||||
|
<td><?php echo $ticket_assigned_to_display; ?></td>
|
||||||
|
<td><?php echo $ticket_updated_at_display; ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ($recurring_ticket_count) { ?>
|
||||||
|
<div class="tab-pane fade" id="pills-asset-recurring-tickets<?php echo $asset_id; ?>">
|
||||||
|
|
||||||
|
<div class="table-responsive-sm">
|
||||||
|
<table class="table table-sm table-striped table-borderless table-hover">
|
||||||
|
<thead class="text-dark">
|
||||||
|
<tr>
|
||||||
|
<th>Subject</th>
|
||||||
|
<th>Priority</th>
|
||||||
|
<th>Frequency</th>
|
||||||
|
<th>Next Run</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_array($sql_related_recurring_tickets)) {
|
||||||
|
$recurring_ticket_id = intval($row['recurring_ticket_id']);
|
||||||
|
$recurring_ticket_subject = nullable_htmlentities($row['recurring_ticket_subject']);
|
||||||
|
$recurring_ticket_priority = nullable_htmlentities($row['recurring_ticket_priority']);
|
||||||
|
$recurring_ticket_frequency = nullable_htmlentities($row['recurring_ticket_frequency']);
|
||||||
|
$recurring_ticket_next_run = nullable_htmlentities($row['recurring_ticket_next_run']);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="text-bold"><?php echo $recurring_ticket_subject ?></td>
|
||||||
|
<td><?php echo $recurring_ticket_priority ?></td>
|
||||||
|
<td><?php echo $recurring_ticket_frequency ?></td>
|
||||||
|
<td><?php echo $recurring_ticket_next_run ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ($software_count) { ?>
|
||||||
|
<div class="tab-pane fade" id="pills-asset-licenses<?php echo $asset_id; ?>">
|
||||||
|
<div class="table-responsive-sm">
|
||||||
|
<table class="table table-striped table-borderless table-hover">
|
||||||
|
<thead class="text-dark">
|
||||||
|
<tr>
|
||||||
|
<th>Software</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Key</th>
|
||||||
|
<th>Seats</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_array($sql_related_software)) {
|
||||||
|
$software_id = intval($row['software_id']);
|
||||||
|
$software_name = nullable_htmlentities($row['software_name']);
|
||||||
|
$software_version = nullable_htmlentities($row['software_version']);
|
||||||
|
$software_type = nullable_htmlentities($row['software_type']);
|
||||||
|
$software_license_type = nullable_htmlentities($row['software_license_type']);
|
||||||
|
$software_key = nullable_htmlentities($row['software_key']);
|
||||||
|
$software_seats = nullable_htmlentities($row['software_seats']);
|
||||||
|
$software_purchase = nullable_htmlentities($row['software_purchase']);
|
||||||
|
$software_expire = nullable_htmlentities($row['software_expire']);
|
||||||
|
$software_notes = nullable_htmlentities($row['software_notes']);
|
||||||
|
|
||||||
|
$seat_count = 0;
|
||||||
|
|
||||||
|
// 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[] = intval($row['asset_id']);
|
||||||
|
$seat_count = $seat_count + 1;
|
||||||
|
}
|
||||||
|
$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[] = intval($row['contact_id']);
|
||||||
|
$seat_count = $seat_count + 1;
|
||||||
|
}
|
||||||
|
$contact_licenses = implode(',', $contact_licenses_array);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo "$software_name<br><span class='text-secondary'>$software_version</span>"; ?></td>
|
||||||
|
<td><?php echo $software_type; ?></td>
|
||||||
|
<td><?php echo $software_key; ?></td>
|
||||||
|
<td><?php echo "$seat_count / $software_seats"; ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ($document_count) { ?>
|
||||||
|
<div class="tab-pane fade" id="pills-asset-documents<?php echo $asset_id; ?>">
|
||||||
|
|
||||||
|
<div class="table-responsive-sm">
|
||||||
|
<table class="table table-sm table-striped table-borderless table-hover">
|
||||||
|
<thead class="text-dark">
|
||||||
|
<tr>
|
||||||
|
<th>Document Title</th>
|
||||||
|
<th>By</th>
|
||||||
|
<th>Created</th>
|
||||||
|
<th>Updated</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_array($sql_related_documents)) {
|
||||||
|
$document_id = intval($row['document_id']);
|
||||||
|
$document_name = nullable_htmlentities($row['document_name']);
|
||||||
|
$document_description = nullable_htmlentities($row['document_description']);
|
||||||
|
$document_created_by = nullable_htmlentities($row['user_name']);
|
||||||
|
$document_created_at = nullable_htmlentities($row['document_created_at']);
|
||||||
|
$document_updated_at = nullable_htmlentities($row['document_updated_at']);
|
||||||
|
|
||||||
|
$linked_documents[] = $document_id;
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="#"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-modal-size="lg"
|
||||||
|
data-ajax-url="ajax/ajax_document_view.php"
|
||||||
|
data-ajax-id="<?php echo $document_id; ?>"
|
||||||
|
>
|
||||||
|
<?php echo $document_name; ?>
|
||||||
|
</a>
|
||||||
|
<div class="text-secondary"><?php echo $document_description; ?></div>
|
||||||
|
</td>
|
||||||
|
<td><?php echo $document_created_by; ?></td>
|
||||||
|
<td><?php echo $document_created_at; ?></td>
|
||||||
|
<td><?php echo $document_updated_at; ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ($file_count) { ?>
|
||||||
|
<div class="tab-pane fade" id="pills-asset-files<?php echo $asset_id; ?>">
|
||||||
|
<div class="table-responsive-sm">
|
||||||
|
<table class="table table-sm table-striped table-borderless table-hover">
|
||||||
|
<thead class="text-dark">
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Uploaded</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_array($sql_related_files)) {
|
||||||
|
$file_id = intval($row['file_id']);
|
||||||
|
$file_name = nullable_htmlentities($row['file_name']);
|
||||||
|
$file_mime_type = nullable_htmlentities($row['file_mime_type']);
|
||||||
|
$file_description = nullable_htmlentities($row['file_description']);
|
||||||
|
$file_reference_name = nullable_htmlentities($row['file_reference_name']);
|
||||||
|
$file_ext = nullable_htmlentities($row['file_ext']);
|
||||||
|
if ($file_ext == 'pdf') {
|
||||||
|
$file_icon = "file-pdf";
|
||||||
|
} elseif ($file_ext == 'gz' || $file_ext == 'tar' || $file_ext == 'zip' || $file_ext == '7z' || $file_ext == 'rar') {
|
||||||
|
$file_icon = "file-archive";
|
||||||
|
} elseif ($file_ext == 'txt' || $file_ext == 'md') {
|
||||||
|
$file_icon = "file-alt";
|
||||||
|
} elseif ($file_ext == 'msg') {
|
||||||
|
$file_icon = "envelope";
|
||||||
|
} elseif ($file_ext == 'doc' || $file_ext == 'docx' || $file_ext == 'odt') {
|
||||||
|
$file_icon = "file-word";
|
||||||
|
} elseif ($file_ext == 'xls' || $file_ext == 'xlsx' || $file_ext == 'ods') {
|
||||||
|
$file_icon = "file-excel";
|
||||||
|
} elseif ($file_ext == 'pptx' || $file_ext == 'odp') {
|
||||||
|
$file_icon = "file-powerpoint";
|
||||||
|
} elseif ($file_ext == 'mp3' || $file_ext == 'wav' || $file_ext == 'ogg') {
|
||||||
|
$file_icon = "file-audio";
|
||||||
|
} elseif ($file_ext == 'mov' || $file_ext == 'mp4' || $file_ext == 'av1') {
|
||||||
|
$file_icon = "file-video";
|
||||||
|
} elseif ($file_ext == 'jpg' || $file_ext == 'jpeg' || $file_ext == 'png' || $file_ext == 'gif' || $file_ext == 'webp' || $file_ext == 'bmp' || $file_ext == 'tif') {
|
||||||
|
$file_icon = "file-image";
|
||||||
|
} else {
|
||||||
|
$file_icon = "file";
|
||||||
|
}
|
||||||
|
$file_created_at = nullable_htmlentities($row['file_created_at']);
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td><a class="text-dark" href="<?php echo "uploads/clients/$client_id/$file_reference_name"; ?>" target="_blank" ><?php echo "$file_name<br><span class='text-secondary'>$file_description</span>"; ?></a></td>
|
||||||
|
<td><?php echo $file_mime_type; ?></td>
|
||||||
|
<td><?php echo $file_created_at; ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<a href="asset_details.php?client_id=<?php echo $client_id; ?>&asset_id=<?php echo $asset_id; ?>" class="btn btn-primary text-bold"><span class="text-white"><i class="fas fa-info-circle mr-2"></i>More Details</span></a>
|
||||||
|
<a href="#" class="btn btn-secondary"
|
||||||
|
data-toggle="ajax-modal" data-ajax-url="ajax/ajax_asset_edit.php" data-ajax-id="<?php echo $asset_id; ?>">
|
||||||
|
<span class="text-white"><i class="fas fa-edit mr-2"></i>Edit</span>
|
||||||
|
</a>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Close</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
486
ajax/ajax_asset_edit.php
Normal file
486
ajax/ajax_asset_edit.php
Normal file
@@ -0,0 +1,486 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$asset_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM assets
|
||||||
|
LEFT JOIN asset_interfaces ON interface_asset_id = asset_id AND interface_primary = 1
|
||||||
|
WHERE asset_id = $asset_id LIMIT 1"
|
||||||
|
);
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$client_id = intval($row['asset_client_id']);
|
||||||
|
$asset_id = intval($row['asset_id']);
|
||||||
|
$asset_type = nullable_htmlentities($row['asset_type']);
|
||||||
|
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||||
|
$asset_description = nullable_htmlentities($row['asset_description']);
|
||||||
|
$asset_make = nullable_htmlentities($row['asset_make']);
|
||||||
|
$asset_model = nullable_htmlentities($row['asset_model']);
|
||||||
|
$asset_serial = nullable_htmlentities($row['asset_serial']);
|
||||||
|
$asset_os = nullable_htmlentities($row['asset_os']);
|
||||||
|
$asset_ip = nullable_htmlentities($row['interface_ip']);
|
||||||
|
$asset_ipv6 = nullable_htmlentities($row['interface_ipv6']);
|
||||||
|
$asset_nat_ip = nullable_htmlentities($row['interface_nat_ip']);
|
||||||
|
$asset_mac = nullable_htmlentities($row['interface_mac']);
|
||||||
|
$asset_uri = nullable_htmlentities($row['asset_uri']);
|
||||||
|
$asset_uri_2 = nullable_htmlentities($row['asset_uri_2']);
|
||||||
|
$asset_status = nullable_htmlentities($row['asset_status']);
|
||||||
|
$asset_purchase_reference = nullable_htmlentities($row['asset_purchase_reference']);
|
||||||
|
$asset_purchase_date = nullable_htmlentities($row['asset_purchase_date']);
|
||||||
|
$asset_warranty_expire = nullable_htmlentities($row['asset_warranty_expire']);
|
||||||
|
$asset_install_date = nullable_htmlentities($row['asset_install_date']);
|
||||||
|
$asset_photo = nullable_htmlentities($row['asset_photo']);
|
||||||
|
$asset_physical_location = nullable_htmlentities($row['asset_physical_location']);
|
||||||
|
$asset_notes = nullable_htmlentities($row['asset_notes']);
|
||||||
|
$asset_created_at = nullable_htmlentities($row['asset_created_at']);
|
||||||
|
$asset_archived_at = nullable_htmlentities($row['asset_archived_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['interface_network_id']);
|
||||||
|
|
||||||
|
$device_icon = getAssetIcon($asset_type);
|
||||||
|
|
||||||
|
// Asset History Query
|
||||||
|
$sql_asset_history = mysqli_query($mysqli, "SELECT * FROM asset_history
|
||||||
|
WHERE asset_history_asset_id = $asset_id
|
||||||
|
ORDER BY asset_history_id
|
||||||
|
DESC LIMIT 10"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class='fa fa-fw fa-<?php echo $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" enctype="multipart/form-data" autocomplete="off">
|
||||||
|
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||||
|
<input type="hidden" name="asset_id" value="<?php echo $asset_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-network<?php echo $asset_id; ?>">Network</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-notes<?php echo $asset_id; ?>">Notes</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-history<?php echo $asset_id; ?>">History</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="tab-content" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
|
||||||
|
|
||||||
|
<div class="tab-pane fade show active" id="pills-details<?php echo $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" maxlength="200" value="<?php echo $asset_name; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="description" placeholder="Description of the asset" maxlength="255" value="<?php echo $asset_description; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Type <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-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" maxlength="200" 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" maxlength="200" 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" maxlength="200" 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" maxlength="200" value="<?php echo $asset_os; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-network<?php echo $asset_id; ?>">
|
||||||
|
|
||||||
|
<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="">- Select Network -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_networks = mysqli_query($mysqli, "SELECT * FROM networks WHERE network_id = $asset_network_id 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 = nullable_htmlentities($row['network_name']);
|
||||||
|
$network_select = nullable_htmlentities($row['network']);
|
||||||
|
$network_archived_at = nullable_htmlentities($row['network_archived_at']);
|
||||||
|
if ($network_archived_at) {
|
||||||
|
$network_name_select_display = "($network_name_select - $network_select) - ARCHIVED";
|
||||||
|
} else {
|
||||||
|
$network_name_select_display = "$network_name_select - $network_select";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<option <?php if ($asset_network_id == $network_id_select) { echo "selected"; } ?> value="<?php echo $network_id_select; ?>"><?php echo $network_name_select_display; ?></option>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>IP Address or DHCP</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="192.168.10.250" data-inputmask="'alias': 'ip'" maxlength="200" data-mask>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<div class="input-group-text">
|
||||||
|
<input type="checkbox" name="dhcp" value="1" <?php if($asset_ip == 'DHCP'){ echo "checked"; } ?>>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>NAT IP</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-random"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="nat_ip" value="<?php echo $asset_nat_ip; ?>" placeholder="10.52.4.55" data-inputmask="'alias': 'ip'" maxlength="200" data-mask>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>IPv6 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="ipv6" value="<?php echo $asset_ipv6; ?>" placeholder="ex. 2001:0db8:0000:0000:0000:ff00:0042:8329" maxlength="200">
|
||||||
|
</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'" maxlength="200" data-mask>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>URI</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="uri" placeholder="URI http:// ftp:// ssh: etc" maxlength="500" value="<?php echo $asset_uri; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>URI 2</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="uri_2" placeholder="URI http:// ftp:// ssh: etc" maxlength="500" value="<?php echo $asset_uri_2; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-assignment<?php echo $asset_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Physical Location</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="physical_location" placeholder="Physical location eg. Floor 2, Closet B" maxlength="200" value="<?php echo $asset_physical_location; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Location</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="location">
|
||||||
|
<option value="">- Select Location -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_locations = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_id = $asset_location_id 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 = nullable_htmlentities($row['location_name']);
|
||||||
|
$location_archived_at = nullable_htmlentities($row['location_archived_at']);
|
||||||
|
if ($location_archived_at) {
|
||||||
|
$location_name_select_display = "($location_name_select) - ARCHIVED";
|
||||||
|
} else {
|
||||||
|
$location_name_select_display = $location_name_select;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<option <?php if ($asset_location_id == $location_id_select) { echo "selected"; } ?> value="<?php echo $location_id_select; ?>"><?php echo $location_name_select_display; ?></option>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Assign 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="">- Select Contact -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_contacts = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_id = $asset_contact_id 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 = nullable_htmlentities($row['contact_name']);
|
||||||
|
$contact_archived_at = nullable_htmlentities($row['contact_archived_at']);
|
||||||
|
if ($contact_archived_at) {
|
||||||
|
$contact_name_select_display = "($contact_name_select) - ARCHIVED";
|
||||||
|
} else {
|
||||||
|
$contact_name_select_display = $contact_name_select;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<option <?php if ($asset_contact_id == $contact_id_select) { echo "selected"; } ?> value="<?php echo $contact_id_select; ?>">
|
||||||
|
<?php echo $contact_name_select_display; ?>
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<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="">- Select Vendor -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_vendors = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_id = $asset_vendor_id 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 = nullable_htmlentities($row['vendor_name']);
|
||||||
|
$vendor_archived_at = nullable_htmlentities($row['vendor_archived_at']);
|
||||||
|
if ($vendor_archived_at) {
|
||||||
|
$vendor_name_select_display = "($vendor_name_select) - ARCHIVED";
|
||||||
|
} else {
|
||||||
|
$vendor_name_select_display = $vendor_name_select;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<option <?php if ($asset_vendor_id == $vendor_id_select) { echo "selected"; } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select_display; ?></option>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if ($asset_type !== 'Virtual Machine') { ?>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Purchase Reference</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="text" class="form-control" name="purchase_reference" placeholder="eg. Invoice, PO Number" value="<?php echo $asset_purchase_reference; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Purchase Date</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="date" class="form-control" name="purchase_date" max="2999-12-31" value="<?php echo $asset_purchase_date; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<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-check"></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>Warranty Expire</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar-times"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="date" class="form-control" name="warranty_expire" max="2999-12-31" value="<?php echo $asset_warranty_expire; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-notes<?php echo $asset_id; ?>">
|
||||||
|
|
||||||
|
<div class="mb-3 text-center">
|
||||||
|
<?php if ($asset_photo) { ?>
|
||||||
|
<img class="img-fluid" alt="asset_photo" src="<?php echo "uploads/clients/$client_id/$asset_photo"; ?>">
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Upload / Replace Photo</label>
|
||||||
|
<input type="file" class="form-control-file" name="file" accept="image/*">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="notes"><?php echo $asset_notes; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="text-muted text-right">Asset ID: <?= $asset_id ?></p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-history<?php echo $asset_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Asset History</label>
|
||||||
|
<ul>
|
||||||
|
<?php
|
||||||
|
while ($row = mysqli_fetch_array($sql_asset_history)) {
|
||||||
|
$asset_history_description = nullable_htmlentities(($row['asset_history_description']));
|
||||||
|
$asset_history_created_at = nullable_htmlentities(($row['asset_history_created_at']));
|
||||||
|
echo "<li><small class='text-secondary'>$asset_history_created_at</small><br>$asset_history_description</li>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<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>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
333
ajax/ajax_asset_interface_edit.php
Normal file
333
ajax/ajax_asset_interface_edit.php
Normal file
@@ -0,0 +1,333 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$interface_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM asset_interfaces
|
||||||
|
LEFT JOIN assets ON asset_id = interface_asset_id
|
||||||
|
LEFT JOIN clients ON client_id = asset_client_id
|
||||||
|
WHERE interface_id = $interface_id LIMIT 1"
|
||||||
|
);
|
||||||
|
|
||||||
|
$interface_count = mysqli_num_rows($sql);
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
|
||||||
|
$client_id = intval($row['asset_client_id']);
|
||||||
|
$asset_id = intval($row['interface_asset_id']);
|
||||||
|
$network_id = intval($row['interface_network_id']);
|
||||||
|
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||||
|
$interface_id = intval($row['interface_id']);
|
||||||
|
$interface_name = nullable_htmlentities($row['interface_name']);
|
||||||
|
$interface_description = nullable_htmlentities($row['interface_description']);
|
||||||
|
$interface_type = nullable_htmlentities($row['interface_type']);
|
||||||
|
$interface_mac = nullable_htmlentities($row['interface_mac']);
|
||||||
|
$interface_ip = nullable_htmlentities($row['interface_ip']);
|
||||||
|
$interface_nat_ip = nullable_htmlentities($row['interface_nat_ip']);
|
||||||
|
$interface_ipv6 = nullable_htmlentities($row['interface_ipv6']);
|
||||||
|
$interface_primary = intval($row['interface_primary']);
|
||||||
|
$interface_notes = nullable_htmlentities($row['interface_notes']);
|
||||||
|
|
||||||
|
// Determine the linked interface for $interface_id
|
||||||
|
$linked_interface_id = null;
|
||||||
|
$sql_link = mysqli_query($mysqli, "
|
||||||
|
SELECT interface_a_id, interface_b_id
|
||||||
|
FROM asset_interface_links
|
||||||
|
WHERE interface_a_id = $interface_id
|
||||||
|
OR interface_b_id = $interface_id
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
if ($link_row = mysqli_fetch_assoc($sql_link)) {
|
||||||
|
if ($link_row['interface_a_id'] == $interface_id) {
|
||||||
|
$linked_interface_id = intval($link_row['interface_b_id']);
|
||||||
|
} else {
|
||||||
|
$linked_interface_id = intval($link_row['interface_a_id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class='fa fa-fw fa-ethernet mr-2'></i>Editing Interface: <?php echo $asset_name; ?> - <strong><?php echo $interface_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="csrf_token" value="<?php echo $_SESSION['csrf_token']; ?>">
|
||||||
|
<input type="hidden" name="interface_id" value="<?php echo $interface_id; ?>">
|
||||||
|
|
||||||
|
<div class="modal-body bg-white" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
|
||||||
|
|
||||||
|
<ul class="nav nav-pills nav-justified mb-3">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" data-toggle="pill" href="#pills-interface-details<?php echo $interface_id; ?>">Details</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-interface-network<?php echo $interface_id; ?>">Network</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-interface-notes<?php echo $interface_id; ?>">Notes</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="tab-content">
|
||||||
|
|
||||||
|
<div class="tab-pane fade show active" id="pills-interface-details<?php echo $interface_id; ?>">
|
||||||
|
|
||||||
|
<!-- Interface Name -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Interface Name or Port / <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-ethernet"></i></span>
|
||||||
|
</div>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
class="form-control"
|
||||||
|
name="name"
|
||||||
|
placeholder="Interface name or port number"
|
||||||
|
maxlength="200"
|
||||||
|
value="<?php echo $interface_name; ?>"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<div class="input-group-text">
|
||||||
|
<input type="checkbox" name="primary_interface" value="1" <?php if($interface_primary) { echo "checked"; } ?> title="Mark Interface as primary">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Interface Description -->
|
||||||
|
<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="description"
|
||||||
|
placeholder="Short Description"
|
||||||
|
maxlength="200"
|
||||||
|
value="<?php echo $interface_description; ?>"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Type -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="network">Type</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-plug"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="type">
|
||||||
|
<option value="">- Select Type -</option>
|
||||||
|
<?php foreach($interface_types_array as $interface_type_select) { ?>
|
||||||
|
<option <?php if($interface_type == $interface_type_select) { echo "selected"; } ?>>
|
||||||
|
<?php echo $interface_type_select; ?>
|
||||||
|
</option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div> <!-- End Details -->
|
||||||
|
|
||||||
|
<!-- Network Section -->
|
||||||
|
<div class="tab-pane fade" id="pills-interface-network<?php echo $interface_id; ?>">
|
||||||
|
|
||||||
|
<!-- MAC Address -->
|
||||||
|
<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"
|
||||||
|
maxlength="200"
|
||||||
|
value="<?php echo $interface_mac; ?>"
|
||||||
|
data-inputmask="'alias': 'mac'"
|
||||||
|
data-mask
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- IPv4 or DHCP -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label>IPv4 or DHCP</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"
|
||||||
|
maxlength="200"
|
||||||
|
value="<?php echo $interface_ip; ?>"
|
||||||
|
data-inputmask="'alias': 'ip'"
|
||||||
|
data-mask
|
||||||
|
>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<div class="input-group-text">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
name="dhcp"
|
||||||
|
value="1"
|
||||||
|
title="Check to mark address as DHCP controlled"
|
||||||
|
<?php if ($interface_ip === 'DHCP') echo "checked"; ?>
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- NAT IP -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label>NAT 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="nat_ip"
|
||||||
|
placeholder="Nat IP"
|
||||||
|
maxlength="200"
|
||||||
|
value="<?php echo $interface_nat_ip; ?>"
|
||||||
|
data-inputmask="'alias': 'ip'"
|
||||||
|
data-mask
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- IPv6 -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label>IPv6</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="ipv6"
|
||||||
|
placeholder="IPv6 Address"
|
||||||
|
maxlength="200"
|
||||||
|
value="<?php echo $interface_ipv6; ?>"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Network -->
|
||||||
|
<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="">- Select Network -</option>
|
||||||
|
<?php
|
||||||
|
$sql_network_select = mysqli_query($mysqli, "
|
||||||
|
SELECT network_id, network_name, network
|
||||||
|
FROM networks
|
||||||
|
WHERE network_archived_at IS NULL
|
||||||
|
AND network_client_id = $client_id
|
||||||
|
ORDER BY network_name ASC
|
||||||
|
");
|
||||||
|
while ($net_row = mysqli_fetch_array($sql_network_select)) {
|
||||||
|
$network_id_select = intval($net_row['network_id']);
|
||||||
|
$network_name_select = nullable_htmlentities($net_row['network_name']);
|
||||||
|
$network_select = nullable_htmlentities($net_row['network']);
|
||||||
|
|
||||||
|
$selected = ($network_id == $network_id_select) ? 'selected' : '';
|
||||||
|
echo "<option value='$network_id_select' $selected>$network_name_select - $network_select</option>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Connected to (One-to-One) -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Connected to</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-desktop"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="connected_to">
|
||||||
|
<option value="">- Select Asset and Interface -</option>
|
||||||
|
<?php
|
||||||
|
$sql_interfaces_select = mysqli_query($mysqli, "
|
||||||
|
SELECT i.interface_id, i.interface_name, a.asset_name
|
||||||
|
FROM asset_interfaces i
|
||||||
|
LEFT JOIN assets a ON a.asset_id = i.interface_asset_id
|
||||||
|
WHERE a.asset_archived_at IS NULL
|
||||||
|
AND a.asset_client_id = $client_id
|
||||||
|
AND i.interface_id != $interface_id
|
||||||
|
AND a.asset_id != $asset_id
|
||||||
|
AND (
|
||||||
|
(
|
||||||
|
i.interface_id NOT IN (SELECT interface_a_id FROM asset_interface_links)
|
||||||
|
AND i.interface_id NOT IN (SELECT interface_b_id FROM asset_interface_links)
|
||||||
|
)
|
||||||
|
OR i.interface_id = " . (int)$linked_interface_id . "
|
||||||
|
)
|
||||||
|
ORDER BY a.asset_name ASC, i.interface_name ASC
|
||||||
|
");
|
||||||
|
while ($row_if = mysqli_fetch_array($sql_interfaces_select)) {
|
||||||
|
$iface_id_select = intval($row_if['interface_id']);
|
||||||
|
$iface_name_select = nullable_htmlentities($row_if['interface_name']);
|
||||||
|
$iface_asset_name_select = nullable_htmlentities($row_if['asset_name']);
|
||||||
|
|
||||||
|
$selected = ($linked_interface_id === $iface_id_select) ? 'selected' : '';
|
||||||
|
echo "<option value='$iface_id_select' $selected>";
|
||||||
|
echo "$iface_asset_name_select - $iface_name_select";
|
||||||
|
echo "</option>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div> <!-- End Network Section -->
|
||||||
|
|
||||||
|
<!-- Notes Section -->
|
||||||
|
<div class="tab-pane fade" id="pills-interface-notes<?php echo $interface_id; ?>">
|
||||||
|
<!-- Notes -->
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="notes"><?php echo $interface_notes; ?></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- End Notes Section -->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- End Footer Section -->
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_asset_interface" class="btn btn-primary text-bold">
|
||||||
|
<i class="fas fa-check mr-2"></i>Save
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal">
|
||||||
|
<i class="fas fa-times mr-2"></i>Close
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
55
ajax/ajax_calendar_edit.php
Normal file
55
ajax/ajax_calendar_edit.php
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$calendar_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM calendars WHERE calendar_id = $calendar_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$calendar_name = nullable_htmlentities($row['calendar_name']);
|
||||||
|
$calendar_color = nullable_htmlentities($row['calendar_color']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fas fa-fw fa-circle mr-2" style="color:<?php echo $calendar_color; ?>"></i><?php echo $calendar_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="calendar_id" value="<?php echo $calendar_id; ?>">
|
||||||
|
<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" maxlength="200" value="<?php echo $calendar_name; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Color <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-paint-brush"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="color" class="form-control col-3" name="color" value="<?php echo $calendar_color; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_calendar" class="btn btn-primary"><i class="fa fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
194
ajax/ajax_calendar_event_edit.php
Normal file
194
ajax/ajax_calendar_event_edit.php
Normal file
@@ -0,0 +1,194 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$event_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM calendar_events LEFT JOIN calendars ON event_calendar_id = calendar_id WHERE event_id = $event_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$event_title = nullable_htmlentities($row['event_title']);
|
||||||
|
$event_description = nullable_htmlentities($row['event_description']);
|
||||||
|
$event_location = nullable_htmlentities($row['event_location']);
|
||||||
|
$event_start = nullable_htmlentities($row['event_start']);
|
||||||
|
$event_end = nullable_htmlentities($row['event_end']);
|
||||||
|
$event_repeat = nullable_htmlentities($row['event_repeat']);
|
||||||
|
$calendar_id = intval($row['calendar_id']);
|
||||||
|
$calendar_name = nullable_htmlentities($row['calendar_name']);
|
||||||
|
$calendar_color = nullable_htmlentities($row['calendar_color']);
|
||||||
|
$client_id = intval($row['event_client_id']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-calendar mr-2" style="color:<?php echo $calendar_color; ?>"></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 mr-2"></i>Event</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-details<?php echo $event_id; ?>"><i class="fa fa-fw fa-info-circle mr-2"></i>Details</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" maxlength="200" 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 ORDER BY calendar_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_calendars_select)) {
|
||||||
|
$calendar_id_select = intval($row['calendar_id']);
|
||||||
|
$calendar_name_select = nullable_htmlentities($row['calendar_name']);
|
||||||
|
$calendar_color_select = nullable_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>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Start / End <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar-check"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="datetime-local" class="form-control" name="start" value="<?php echo date('Y-m-d\TH:i:s', strtotime($event_start)); ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar-day"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="datetime-local" class="form-control" name="end" value="<?php echo date('Y-m-d\TH:i:s', strtotime($event_end)); ?>"required>
|
||||||
|
</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" disabled>
|
||||||
|
<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-details<?php echo $event_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>
|
||||||
|
<input type="text" class="form-control" name="location" value="<?php echo $event_location; ?>" placeholder="Location of the event">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description</label>
|
||||||
|
<textarea class="form-control" rows="8" name="description" placeholder="Enter a description"><?php echo $event_description; ?></textarea>
|
||||||
|
</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 clients.client_id = contacts.contact_client_id AND contact_primary = 1 ORDER BY client_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_clients)) {
|
||||||
|
$client_id_select = intval($row['client_id']);
|
||||||
|
$client_name_select = nullable_htmlentities($row['client_name']);
|
||||||
|
$contact_email_select = nullable_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 class="modal-footer bg-white">
|
||||||
|
<a class="btn btn-default 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>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
43
ajax/ajax_category_add.php
Normal file
43
ajax/ajax_category_add.php
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$category = nullable_htmlentities($_GET['category']);
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-list-ul mr-2"></i>New 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-row">
|
||||||
|
|
||||||
|
<div class="form-group col-sm-9">
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="text" class="form-control" name="name" placeholder="Category name" maxlength="200" required autofocus>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-sm-3">
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="color" class="form-control" name="color" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
56
ajax/ajax_category_edit.php
Normal file
56
ajax/ajax_category_edit.php
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$category_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_id = $category_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$category_name = nullable_htmlentities($row['category_name']);
|
||||||
|
$category_color = nullable_htmlentities($row['category_color']);
|
||||||
|
$category_type = nullable_htmlentities($row['category_type']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-list-ul 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>
|
||||||
|
<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_type; ?>">
|
||||||
|
<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-list-ul"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="name" maxlength="200" value="<?php echo $category_name; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Color <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-paint-brush"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="color" class="form-control col-3" name="color" value="<?php echo $category_color; ?>" required>
|
||||||
|
</div>
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
197
ajax/ajax_certificate_edit.php
Normal file
197
ajax/ajax_certificate_edit.php
Normal file
@@ -0,0 +1,197 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$certificate_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM certificates WHERE certificate_id = $certificate_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$certificate_name = nullable_htmlentities($row['certificate_name']);
|
||||||
|
$certificate_description = nullable_htmlentities($row['certificate_description']);
|
||||||
|
$certificate_domain = nullable_htmlentities($row['certificate_domain']);
|
||||||
|
$certificate_domain_id = intval($row['certificate_domain_id']);
|
||||||
|
$certificate_issued_by = nullable_htmlentities($row['certificate_issued_by']);
|
||||||
|
$certificate_public_key = nullable_htmlentities($row['certificate_public_key']);
|
||||||
|
$certificate_notes = nullable_htmlentities($row['certificate_notes']);
|
||||||
|
$certificate_expire = nullable_htmlentities($row['certificate_expire']);
|
||||||
|
$certificate_created_at = nullable_htmlentities($row['certificate_created_at']);
|
||||||
|
$client_id = intval($row['certificate_client_id']);
|
||||||
|
|
||||||
|
$history_sql = mysqli_query($mysqli, "SELECT * FROM certificate_history WHERE certificate_history_certificate_id = $certificate_id");
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-lock mr-2"></i>Editing certificate: <span class="text-bold"><?php echo $certificate_name; ?></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="<?php echo $certificate_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="#pillsEditDetails<?php echo $certificate_id; ?>">Details</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pillsEditCertificate<?php echo $certificate_id; ?>">Certificate</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pillsEditNotes<?php echo $certificate_id; ?>">Notes</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pillsEditHistory<?php echo $certificate_id; ?>">History</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="tab-content" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
|
||||||
|
|
||||||
|
<div class="tab-pane fade show active" id="pillsEditDetails<?php echo $certificate_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Certificate 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-lock"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="name" placeholder="Certificate name" maxlength="200" value="<?php echo $certificate_name; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="description" placeholder="Short Description" value="<?php echo $certificate_description; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Domain</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>
|
||||||
|
<select class="form-control select2" name="domain_id">
|
||||||
|
<option value="">- Select Domain -</option>
|
||||||
|
<?php
|
||||||
|
$domains_sql = mysqli_query($mysqli, "SELECT domain_id, domain_name FROM domains WHERE domain_client_id = $client_id");
|
||||||
|
while ($row = mysqli_fetch_array($domains_sql)) {
|
||||||
|
$domain_id = intval($row['domain_id']);
|
||||||
|
$domain_name = nullable_htmlentities($row['domain_name']);
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $domain_id; ?>" <?php if ($certificate_domain_id == $domain_id) { echo "selected"; } ?>><?php echo $domain_name; ?></option>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pillsEditCertificate<?php echo $certificate_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Domain <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> https://</span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="domain" id="editCertificateDomain" placeholder="Domain" maxlength="200" value="<?php echo $certificate_domain; ?>" required>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button type="button" class="btn btn-secondary" onclick="fetchSSL('edit')"><i class="fas fa-fw fa-sync-alt"></i></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Issued By</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="issued_by" id="editCertificateIssuedBy" maxlength="200" placeholder="Issued By" value="<?php echo $certificate_issued_by; ?>">
|
||||||
|
</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-times"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="date" class="form-control" name="expire" id="editCertificateExpire" max="2999-12-31" value="<?php echo $certificate_expire; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Public Key </label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-key"></i></span>
|
||||||
|
</div>
|
||||||
|
<textarea class="form-control" rows="8" name="public_key" id="editCertificatePublicKey"><?php echo $certificate_public_key; ?></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pillsEditNotes<?php echo $certificate_id; ?>">
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="form-control" name="notes" rows="12" placeholder="Enter some notes"><?php echo $certificate_notes; ?></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pillsEditHistory<?php echo $certificate_id; ?>">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class='table table-sm table-striped border table-hover'>
|
||||||
|
<thead class='thead-dark'>
|
||||||
|
<tr>
|
||||||
|
<th>Date</th>
|
||||||
|
<th>Field</th>
|
||||||
|
<th>Before</th>
|
||||||
|
<th>After</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
while ($row = mysqli_fetch_array($history_sql)) {
|
||||||
|
$certificate_modified_at = nullable_htmlentities($row['certificate_history_modified_at']);
|
||||||
|
$certificate_field = nullable_htmlentities($row['certificate_history_column']);
|
||||||
|
$certificate_before_value = nullable_htmlentities($row['certificate_history_old_value']);
|
||||||
|
$certificate_after_value = nullable_htmlentities($row['certificate_history_new_value']);
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $certificate_modified_at; ?></td>
|
||||||
|
<td><?php echo $certificate_field; ?></td>
|
||||||
|
<td><?php echo $certificate_before_value; ?></td>
|
||||||
|
<td><?php echo $certificate_after_value; ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
268
ajax/ajax_client_edit.php
Normal file
268
ajax/ajax_client_edit.php
Normal file
@@ -0,0 +1,268 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$client_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_id = $client_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
|
$client_is_lead = intval($row['client_lead']);
|
||||||
|
$client_type = nullable_htmlentities($row['client_type']);
|
||||||
|
$client_website = nullable_htmlentities($row['client_website']);
|
||||||
|
$client_referral = nullable_htmlentities($row['client_referral']);
|
||||||
|
$client_currency_code = nullable_htmlentities($row['client_currency_code']);
|
||||||
|
$client_net_terms = intval($row['client_net_terms']);
|
||||||
|
$client_tax_id_number = nullable_htmlentities($row['client_tax_id_number']);
|
||||||
|
$client_abbreviation = nullable_htmlentities($row['client_abbreviation']);
|
||||||
|
$client_rate = floatval($row['client_rate']);
|
||||||
|
$client_notes = nullable_htmlentities($row['client_notes']);
|
||||||
|
$client_created_at = nullable_htmlentities($row['client_created_at']);
|
||||||
|
$client_archived_at = nullable_htmlentities($row['client_archived_at']);
|
||||||
|
|
||||||
|
// Client Tags
|
||||||
|
$client_tag_id_array = array();
|
||||||
|
$sql_client_tags = mysqli_query($mysqli, "SELECT tag_id FROM client_tags WHERE client_id = $client_id");
|
||||||
|
while ($row = mysqli_fetch_array($sql_client_tags)) {
|
||||||
|
$client_tag_id = intval($row['tag_id']);
|
||||||
|
$client_tag_id_array[] = $client_tag_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class='fa fa-fw fa-user-edit mr-2'></i>Editing Client: <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>
|
||||||
|
<?php if ($config_module_enable_accounting) { ?>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-client-billing<?php echo $client_id; ?>">Billing</a>
|
||||||
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-client-notes<?php echo $client_id; ?>">Notes</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> / <span class="text-secondary">Is Lead</span></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="name" placeholder="Name or Company" maxlength="200"
|
||||||
|
value="<?php echo $client_name; ?>" required>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<div class="input-group-text">
|
||||||
|
<input type="checkbox" name="lead" value="1" <?php if($client_is_lead == 1){ echo "checked"; } ?>>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Shortened Name</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="abbreviation" placeholder="Shortned name for client - Max chars 6" value="<?php echo $client_abbreviation; ?>" maxlength="6" oninput="this.value = this.value.toUpperCase()">
|
||||||
|
</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-link"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" data-tags="true" name="referral">
|
||||||
|
<option value="">- Select Referral -</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) ORDER BY category_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($referral_sql)) {
|
||||||
|
$referral = nullable_htmlentities($row['category_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($client_referral == $referral) {
|
||||||
|
echo "selected";
|
||||||
|
} ?>>
|
||||||
|
<?php echo $referral; ?>
|
||||||
|
</option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-secondary" type="button"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-modal-size="sm"
|
||||||
|
data-ajax-url="ajax/ajax_category_add.php?category=Referral">
|
||||||
|
<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" maxlength="200"
|
||||||
|
value="<?php echo $client_website; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Tags</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-tags"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="tags[]" data-placeholder="Add some tags" multiple>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 1 ORDER BY tag_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_tags_select)) {
|
||||||
|
$tag_id_select = intval($row['tag_id']);
|
||||||
|
$tag_name_select = nullable_htmlentities($row['tag_name']);
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $tag_id_select; ?>" <?php if (in_array($tag_id_select, $client_tag_id_array)) { echo "selected"; } ?>><?php echo $tag_name_select; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-secondary" type="button"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-modal-size="sm"
|
||||||
|
data-ajax-url="ajax/ajax_tag_add.php"
|
||||||
|
data-ajax-id="1">
|
||||||
|
<i class="fas fa-fw fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if ($config_module_enable_accounting) { ?>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-client-billing<?php echo $client_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Hourly Rate</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" inputmode="numeric"
|
||||||
|
pattern="[0-9]*\.?[0-9]{0,2}" name="rate" placeholder="0.00"
|
||||||
|
value="<?php echo number_format($client_rate, 2, '.', ''); ?>">
|
||||||
|
</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 ($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>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Tax ID</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-balance-scale"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="tax_id_number" maxlength="255"
|
||||||
|
placeholder="Tax ID Number" value="<?php echo $client_tax_id_number; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-client-notes<?php echo $client_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="form-control" rows="10" placeholder="Enter some notes" name="notes"><?php echo $client_notes; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
859
ajax/ajax_contact_details.php
Normal file
859
ajax/ajax_contact_details.php
Normal file
@@ -0,0 +1,859 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$contact_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||||
|
LEFT JOIN clients ON client_id = contact_client_id
|
||||||
|
LEFT JOIN locations ON location_id = contact_location_id
|
||||||
|
LEFT JOIN users ON user_id = contact_user_id
|
||||||
|
WHERE contact_id = $contact_id
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$client_id = intval($row['client_id']);
|
||||||
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
|
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||||
|
$contact_title = nullable_htmlentities($row['contact_title']);
|
||||||
|
$contact_department =nullable_htmlentities($row['contact_department']);
|
||||||
|
$contact_phone_country_code = nullable_htmlentities($row['contact_phone_country_code']);
|
||||||
|
$contact_phone = nullable_htmlentities(formatPhoneNumber($row['contact_phone'], $contact_phone_country_code));
|
||||||
|
$contact_extension = nullable_htmlentities($row['contact_extension']);
|
||||||
|
$contact_mobile_country_code = nullable_htmlentities($row['contact_mobile_country_code']);
|
||||||
|
$contact_mobile = nullable_htmlentities(formatPhoneNumber($row['contact_phone'], $contact_mobile_country_code));
|
||||||
|
$contact_email = nullable_htmlentities($row['contact_email']);
|
||||||
|
$contact_photo = nullable_htmlentities($row['contact_photo']);
|
||||||
|
$contact_pin = nullable_htmlentities($row['contact_pin']);
|
||||||
|
$contact_initials = initials($contact_name);
|
||||||
|
$contact_notes = nullable_htmlentities($row['contact_notes']);
|
||||||
|
$contact_primary = intval($row['contact_primary']);
|
||||||
|
$contact_important = intval($row['contact_important']);
|
||||||
|
$contact_billing = intval($row['contact_billing']);
|
||||||
|
$contact_technical = intval($row['contact_technical']);
|
||||||
|
$contact_created_at = nullable_htmlentities($row['contact_created_at']);
|
||||||
|
$contact_location_id = intval($row['contact_location_id']);
|
||||||
|
$location_name = nullable_htmlentities($row['location_name']);
|
||||||
|
$auth_method = nullable_htmlentities($row['user_auth_method']);
|
||||||
|
$contact_client_id = intval($row['contact_client_id']);
|
||||||
|
|
||||||
|
// Related Assets Query - 1 to 1 relationship
|
||||||
|
$sql_related_assets = mysqli_query($mysqli, "SELECT * FROM assets LEFT JOIN asset_interfaces ON interface_asset_id = asset_id AND interface_primary = 1 WHERE asset_contact_id = $contact_id ORDER BY asset_name DESC");
|
||||||
|
$asset_count = mysqli_num_rows($sql_related_assets);
|
||||||
|
|
||||||
|
// Linked Software Licenses
|
||||||
|
$sql_linked_software = mysqli_query($mysqli, "SELECT * FROM software_contacts, software
|
||||||
|
WHERE software_contacts.contact_id = $contact_id
|
||||||
|
AND software_contacts.software_id = software.software_id
|
||||||
|
AND software_archived_at IS NULL
|
||||||
|
ORDER BY software_name ASC"
|
||||||
|
);
|
||||||
|
$software_count = mysqli_num_rows($sql_linked_software);
|
||||||
|
|
||||||
|
$linked_software = array();
|
||||||
|
|
||||||
|
// Related Credentials Query 1 to 1 relationship
|
||||||
|
$sql_related_credentials = mysqli_query($mysqli, "
|
||||||
|
SELECT
|
||||||
|
credentials.credential_id AS credentials_credential_id, -- Alias for credentials.credential_id
|
||||||
|
credentials.*, -- All other columns from credentials
|
||||||
|
credential_tags.*, -- All columns from credential_tags
|
||||||
|
tags.* -- All columns from tags
|
||||||
|
FROM credentials
|
||||||
|
LEFT JOIN credential_tags ON credential_tags.credential_id = credentials.credential_id
|
||||||
|
LEFT JOIN tags ON tags.tag_id = credential_tags.tag_id
|
||||||
|
WHERE credential_contact_id = $contact_id
|
||||||
|
GROUP BY credentials.credential_id
|
||||||
|
ORDER BY credential_name DESC
|
||||||
|
");
|
||||||
|
$credential_count = mysqli_num_rows($sql_related_credentials);
|
||||||
|
|
||||||
|
// Related Tickets Query - 1 to 1 relationship
|
||||||
|
$sql_related_tickets = mysqli_query($mysqli, "SELECT * FROM tickets
|
||||||
|
LEFT JOIN users ON ticket_assigned_to = user_id
|
||||||
|
LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
|
||||||
|
WHERE ticket_contact_id = $contact_id ORDER BY ticket_id DESC");
|
||||||
|
$ticket_count = mysqli_num_rows($sql_related_tickets);
|
||||||
|
|
||||||
|
// Related Recurring Tickets Query
|
||||||
|
$sql_related_recurring_tickets = mysqli_query($mysqli, "SELECT * FROM recurring_tickets
|
||||||
|
WHERE recurring_ticket_contact_id = $contact_id
|
||||||
|
ORDER BY recurring_ticket_next_run DESC"
|
||||||
|
);
|
||||||
|
$recurring_ticket_count = mysqli_num_rows($sql_related_recurring_tickets);
|
||||||
|
|
||||||
|
|
||||||
|
// Tags - many to many relationship
|
||||||
|
$contact_tag_name_display_array = array();
|
||||||
|
$contact_tag_id_array = array();
|
||||||
|
$sql_contact_tags = mysqli_query($mysqli, "SELECT * FROM contact_tags LEFT JOIN tags ON contact_tags.tag_id = tags.tag_id WHERE contact_id = $contact_id ORDER BY tag_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_contact_tags)) {
|
||||||
|
|
||||||
|
$contact_tag_id = intval($row['tag_id']);
|
||||||
|
$contact_tag_name = nullable_htmlentities($row['tag_name']);
|
||||||
|
$contact_tag_color = nullable_htmlentities($row['tag_color']);
|
||||||
|
if (empty($contact_tag_color)) {
|
||||||
|
$contact_tag_color = "dark";
|
||||||
|
}
|
||||||
|
$contact_tag_icon = nullable_htmlentities($row['tag_icon']);
|
||||||
|
if (empty($contact_tag_icon)) {
|
||||||
|
$contact_tag_icon = "tag";
|
||||||
|
}
|
||||||
|
|
||||||
|
$contact_tag_id_array[] = $contact_tag_id;
|
||||||
|
$contact_tag_name_display_array[] = "<a href='client_contacts.php?client_id=$client_id&q=$contact_tag_name'><span class='badge text-light p-1 mr-1' style='background-color: $contact_tag_color;'><i class='fa fa-fw fa-$contact_tag_icon mr-2'></i>$contact_tag_name</span></a>";
|
||||||
|
}
|
||||||
|
$contact_tags_display = implode('', $contact_tag_name_display_array);
|
||||||
|
|
||||||
|
// Notes - 1 to 1 relationship
|
||||||
|
$sql_related_notes = mysqli_query($mysqli, "SELECT * FROM contact_notes LEFT JOIN users ON contact_note_created_by = user_id WHERE contact_note_contact_id = $contact_id AND contact_note_archived_at IS NULL ORDER BY contact_note_created_at DESC");
|
||||||
|
$note_count = mysqli_num_rows($sql_related_notes);
|
||||||
|
|
||||||
|
// Linked Services
|
||||||
|
$sql_linked_services = mysqli_query($mysqli, "SELECT * FROM service_contacts, services
|
||||||
|
WHERE service_contacts.contact_id = $contact_id
|
||||||
|
AND service_contacts.service_id = services.service_id
|
||||||
|
ORDER BY service_name ASC"
|
||||||
|
);
|
||||||
|
$services_count = mysqli_num_rows($sql_linked_services);
|
||||||
|
|
||||||
|
$linked_services = array();
|
||||||
|
|
||||||
|
// Linked Documents
|
||||||
|
$sql_linked_documents = mysqli_query($mysqli, "SELECT * FROM contact_documents, documents
|
||||||
|
LEFT JOIN users ON document_created_by = user_id
|
||||||
|
WHERE contact_documents.contact_id = $contact_id
|
||||||
|
AND contact_documents.document_id = documents.document_id
|
||||||
|
AND document_template = 0
|
||||||
|
AND document_archived_at IS NULL
|
||||||
|
ORDER BY document_name ASC"
|
||||||
|
);
|
||||||
|
$document_count = mysqli_num_rows($sql_linked_documents);
|
||||||
|
|
||||||
|
$linked_documents = array();
|
||||||
|
|
||||||
|
// Linked Files
|
||||||
|
$sql_linked_files = mysqli_query($mysqli, "SELECT * FROM contact_files, files
|
||||||
|
WHERE contact_files.contact_id = $contact_id
|
||||||
|
AND contact_files.file_id = files.file_id
|
||||||
|
AND file_archived_at IS NULL
|
||||||
|
ORDER BY file_name ASC"
|
||||||
|
);
|
||||||
|
$file_count = mysqli_num_rows($sql_linked_files);
|
||||||
|
|
||||||
|
$linked_files = array();
|
||||||
|
|
||||||
|
if (isset($_GET['client_id'])) {
|
||||||
|
$client_url = "client_id=$client_id&";
|
||||||
|
} else {
|
||||||
|
$client_url = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-user mr-2"></i><strong><?php echo $contact_name; ?></strong></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="#pills-contact-details<?php echo $contact_id; ?>"><i class="fas fa-fw fa-user fa-2x"></i><br>Details</a>
|
||||||
|
</li>
|
||||||
|
<?php if ($asset_count) { ?>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-contact-assets<?php echo $contact_id; ?>"><i class="fas fa-fw fa-desktop fa-2x"></i><br>Assets (<?php echo $asset_count; ?>)</a>
|
||||||
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if ($credential_count) { ?>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-contact-credentials<?php echo $contact_id; ?>"><i class="fas fa-fw fa-key fa-2x"></i><br>Credentials (<?php echo $credential_count; ?>)</a>
|
||||||
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if ($software_count) { ?>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-contact-licenses<?php echo $contact_id; ?>"><i class="fas fa-fw fa-cube fa-2x"></i><br>Licenses (<?php echo $software_count; ?>)</a>
|
||||||
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if ($ticket_count) { ?>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-contact-tickets<?php echo $contact_id; ?>"><i class="fas fa-fw fa-life-ring fa-2x"></i><br>Tickets (<?php echo $ticket_count; ?>)</a>
|
||||||
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if ($recurring_ticket_count) { ?>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-contact-recurring-tickets<?php echo $contact_id; ?>"><i class="fas fa-fw fa-redo-alt fa-2x"></i><br>Rcr Tickets (<?php echo $recurring_ticket_count; ?>)</a>
|
||||||
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if ($document_count) { ?>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-contact-documents<?php echo $contact_id; ?>"><i class="fas fa-fw fa-file-alt fa-2x"></i><br>Documents (<?php echo $document_count; ?>)</a>
|
||||||
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if ($file_count) { ?>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-contact-files<?php echo $contact_id; ?>"><i class="fas fa-fw fa-briefcase fa-2x"></i><br>Files (<?php echo $file_count; ?>)</a>
|
||||||
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if ($note_count) { ?>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-contact-notes<?php echo $contact_id; ?>"><i class="fas fa-fw fa-edit fa-2x"></i><br>Notes (<?php echo $note_count; ?>)</a>
|
||||||
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="tab-content">
|
||||||
|
|
||||||
|
<div class="tab-pane fade show active" id="pills-contact-details<?php echo $contact_id; ?>">
|
||||||
|
<div class="card card-dark">
|
||||||
|
<div class="card-body">
|
||||||
|
<h3 class="text-bold"><?php echo $contact_name; ?></h3>
|
||||||
|
<?php if ($contact_title) { ?>
|
||||||
|
<div class="text-secondary"><?php echo $contact_title; ?></div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
<?php if ($contact_photo) { ?>
|
||||||
|
<img class="img-thumbnail img-circle col-3" alt="contact_photo" src="<?php echo "uploads/clients/$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>
|
||||||
|
<?php
|
||||||
|
if (!empty($contact_tags_display)) { ?>
|
||||||
|
<div class="mt-1">
|
||||||
|
<?php echo $contact_tags_display; ?>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
<hr>
|
||||||
|
<?php if ($location_name) { ?>
|
||||||
|
<div><i class="fa fa-fw fa-map-marker-alt text-secondary mr-2"></i><?php echo $location_name; ?></div>
|
||||||
|
<?php }
|
||||||
|
if ($contact_email) { ?>
|
||||||
|
<div class="mt-2"><i class="fa fa-fw fa-envelope text-secondary mr-2"></i><a href='mailto:<?php echo $contact_email; ?>'><?php echo $contact_email; ?></a><button type="button" class='btn btn-sm clipboardjs' data-clipboard-text='<?php echo $contact_email; ?>'><i class='far fa-copy text-secondary'></i></button></div>
|
||||||
|
<?php }
|
||||||
|
if ($contact_phone) { ?>
|
||||||
|
<div class="mt-2"><i class="fa fa-fw fa-phone text-secondary mr-2"></i><a href="tel:<?php echo "$contact_phone"?>"><?php echo $contact_phone; ?></a></div>
|
||||||
|
<?php }
|
||||||
|
if ($contact_extension) { ?>
|
||||||
|
<div class="ml-4">x<?php echo $contact_extension; ?></div>
|
||||||
|
<?php }
|
||||||
|
if ($contact_mobile) { ?>
|
||||||
|
<div class="mt-l"><i class="fa fa-fw fa-mobile-alt text-secondary mr-2"></i><a href="tel:<?php echo $contact_mobile; ?>"><?php echo $contact_mobile; ?></a></div>
|
||||||
|
<?php }
|
||||||
|
if ($contact_pin) { ?>
|
||||||
|
<div class="mt-2"><i class="fa fa-fw fa-key text-secondary mr-2"></i><?php echo $contact_pin; ?></div>
|
||||||
|
<?php }
|
||||||
|
if ($contact_primary) { ?>
|
||||||
|
<div class="mt-2 text-success"><i class="fa fa-fw fa-check mr-2"></i>Primary Contact</div>
|
||||||
|
<?php }
|
||||||
|
if ($contact_important) { ?>
|
||||||
|
<div class="mt-2 text-dark text-bold"><i class="fa fa-fw fa-check mr-2"></i>Important</div>
|
||||||
|
<?php }
|
||||||
|
if ($contact_technical) { ?>
|
||||||
|
<div class="mt-2"><i class="fa fa-fw fa-check text-secondary mr-2"></i>Technical</div>
|
||||||
|
<?php }
|
||||||
|
if ($contact_billing) { ?>
|
||||||
|
<div class="mt-2"><i class="fa fa-fw fa-check text-secondary mr-2"></i>Billing</div>
|
||||||
|
<?php } ?>
|
||||||
|
<div class="mt-2"><i class="fa fa-fw fa-clock text-secondary mr-2"></i><?php echo date('Y-m-d', strtotime($contact_created_at)); ?></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card mb-3">
|
||||||
|
<div class="card-header">
|
||||||
|
<h5 class="card-title">Notes</h5>
|
||||||
|
</div>
|
||||||
|
<textarea class="form-control" rows=6 id="contactNotes" placeholder="Notes, eg Personal tidbits to spark convo, temperment, etc" onblur="updateContactNotes(<?php echo $contact_id ?>)"><?php echo $contact_notes ?></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function updateContactNotes(contact_id) {
|
||||||
|
var notes = document.getElementById("contactNotes").value;
|
||||||
|
|
||||||
|
// 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 if ($asset_count) { ?>
|
||||||
|
<div class="tab-pane fade" id="pills-contact-assets<?php echo $contact_id; ?>">
|
||||||
|
|
||||||
|
<div class="table-responsive-sm">
|
||||||
|
<table class="table table-striped table-borderless table-hover table-sm">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name/Description</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Make/Model</th>
|
||||||
|
<th>Serial Number</th>
|
||||||
|
<th>Install Date</th>
|
||||||
|
<th>Status</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_array($sql_related_assets)) {
|
||||||
|
$asset_id = intval($row['asset_id']);
|
||||||
|
$asset_type = nullable_htmlentities($row['asset_type']);
|
||||||
|
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||||
|
$asset_description = nullable_htmlentities($row['asset_description']);
|
||||||
|
$asset_make = nullable_htmlentities($row['asset_make']);
|
||||||
|
$asset_model = nullable_htmlentities($row['asset_model']);
|
||||||
|
$asset_serial = nullable_htmlentities($row['asset_serial']);
|
||||||
|
if (empty($asset_serial)) {
|
||||||
|
$asset_serial_display = "-";
|
||||||
|
} else {
|
||||||
|
$asset_serial_display = $asset_serial;
|
||||||
|
}
|
||||||
|
$asset_os = nullable_htmlentities($row['asset_os']);
|
||||||
|
if (empty($asset_os)) {
|
||||||
|
$asset_os_display = "-";
|
||||||
|
} else {
|
||||||
|
$asset_os_display = $asset_os;
|
||||||
|
}
|
||||||
|
$asset_ip = nullable_htmlentities($row['interface_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>";
|
||||||
|
}
|
||||||
|
$asset_nat_ip = nullable_htmlentities($row['interface_nat_ip']);
|
||||||
|
$asset_ipv6 = nullable_htmlentities($row['interface_ipv6']);
|
||||||
|
$asset_mac = nullable_htmlentities($row['interface_mac']);
|
||||||
|
$asset_status = nullable_htmlentities($row['asset_status']);
|
||||||
|
$asset_purchase_date = nullable_htmlentities($row['asset_purchase_date']);
|
||||||
|
$asset_warranty_expire = nullable_htmlentities($row['asset_warranty_expire']);
|
||||||
|
$asset_install_date = nullable_htmlentities($row['asset_install_date']);
|
||||||
|
if (empty($asset_install_date)) {
|
||||||
|
$asset_install_date_display = "-";
|
||||||
|
} else {
|
||||||
|
$asset_install_date_display = $asset_install_date;
|
||||||
|
}
|
||||||
|
$asset_uri = nullable_htmlentities($row['asset_uri']);
|
||||||
|
$asset_uri_2 = nullable_htmlentities($row['asset_uri_2']);
|
||||||
|
$asset_photo = nullable_htmlentities($row['asset_photo']);
|
||||||
|
$asset_physical_location = nullable_htmlentities($row['asset_physical_location']);
|
||||||
|
$asset_notes = nullable_htmlentities($row['asset_notes']);
|
||||||
|
$asset_created_at = nullable_htmlentities($row['asset_created_at']);
|
||||||
|
$device_icon = getAssetIcon($asset_type);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<i class="fa fa-fw text-secondary fa-<?php echo $device_icon; ?> mr-2"></i>
|
||||||
|
<a class="text-secondary" href="#"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-modal-size="lg"
|
||||||
|
data-ajax-url="ajax/ajax_asset_details.php"
|
||||||
|
data-ajax-id="<?php echo $asset_id; ?>">
|
||||||
|
<?php echo $asset_name; ?>
|
||||||
|
</a>
|
||||||
|
<div class="mt-0">
|
||||||
|
<small class="text-muted"><?php echo $asset_description; ?></small>
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
<td><?php echo $asset_type; ?></td>
|
||||||
|
<td>
|
||||||
|
<?php echo $asset_make; ?>
|
||||||
|
<div class="mt-0">
|
||||||
|
<small class="text-muted"><?php echo $asset_model; ?></small>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td><?php echo $asset_serial_display; ?></td>
|
||||||
|
<td><?php echo $asset_install_date_display; ?></td>
|
||||||
|
<td><?php echo $asset_status; ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ($credential_count) { ?>
|
||||||
|
<div class="tab-pane fade" id="pills-contact-credentials<?php echo $contact_id; ?>">
|
||||||
|
<div class="table-responsive-sm">
|
||||||
|
<table class="table table-striped table-borderless table-hover table-sm dataTables" style="width:100%">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Description</th>
|
||||||
|
<th>Username</th>
|
||||||
|
<th>Password</th>
|
||||||
|
<th>OTP</th>
|
||||||
|
<th>URI</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_array($sql_related_credentials)) {
|
||||||
|
$credential_id = intval($row['credentials_credential_id']);
|
||||||
|
$credential_name = nullable_htmlentities($row['credential_name']);
|
||||||
|
$credential_description = nullable_htmlentities($row['credential_description']);
|
||||||
|
$credential_uri = nullable_htmlentities($row['credential_uri']);
|
||||||
|
if (empty($credential_uri)) {
|
||||||
|
$credential_uri_display = "-";
|
||||||
|
} else {
|
||||||
|
$credential_uri_display = "$credential_uri";
|
||||||
|
}
|
||||||
|
$credential_uri_2 = nullable_htmlentities($row['credential_uri_2']);
|
||||||
|
$credential_username = nullable_htmlentities(decryptCredentialEntry($row['credential_username']));
|
||||||
|
if (empty($credential_username)) {
|
||||||
|
$credential_username_display = "-";
|
||||||
|
} else {
|
||||||
|
$credential_username_display = "$credential_username <button type='button' class='btn btn-sm clipboardjs' data-clipboard-text='$credential_username'><i class='far fa-copy text-secondary'></i></button>";
|
||||||
|
}
|
||||||
|
$credential_password = nullable_htmlentities(decryptCredentialEntry($row['credential_password']));
|
||||||
|
$credential_otp_secret = nullable_htmlentities($row['credential_otp_secret']);
|
||||||
|
$credential_id_with_secret = '"' . $row['credential_id'] . '","' . $row['credential_otp_secret'] . '"';
|
||||||
|
if (empty($credential_otp_secret)) {
|
||||||
|
$otp_display = "-";
|
||||||
|
} else {
|
||||||
|
$otp_display = "<span onmouseenter='showOTPViaCredentialID($credential_id)'><i class='far fa-clock'></i> <span id='otp_$credential_id'><i>Hover..</i></span></span>";
|
||||||
|
}
|
||||||
|
$credential_note = nullable_htmlentities($row['credential_note']);
|
||||||
|
$credential_important = intval($row['credential_important']);
|
||||||
|
$credential_contact_id = intval($row['credential_contact_id']);
|
||||||
|
$credential_asset_id = intval($row['credential_asset_id']);
|
||||||
|
|
||||||
|
// Tags
|
||||||
|
$credential_tag_name_display_array = array();
|
||||||
|
$credential_tag_id_array = array();
|
||||||
|
$sql_credential_tags = mysqli_query($mysqli, "SELECT * FROM credential_tags LEFT JOIN tags ON credential_tags.tag_id = tags.tag_id WHERE credential_id = $credential_id ORDER BY tag_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_credential_tags)) {
|
||||||
|
|
||||||
|
$credential_tag_id = intval($row['tag_id']);
|
||||||
|
$credential_tag_name = nullable_htmlentities($row['tag_name']);
|
||||||
|
$credential_tag_color = nullable_htmlentities($row['tag_color']);
|
||||||
|
if (empty($credential_tag_color)) {
|
||||||
|
$credential_tag_color = "dark";
|
||||||
|
}
|
||||||
|
$credential_tag_icon = nullable_htmlentities($row['tag_icon']);
|
||||||
|
if (empty($credential_tag_icon)) {
|
||||||
|
$credential_tag_icon = "tag";
|
||||||
|
}
|
||||||
|
|
||||||
|
$credential_tag_id_array[] = $credential_tag_id;
|
||||||
|
$credential_tag_name_display_array[] = "<a href='credentials.php?client_id=$client_id&tags[]=$credential_tag_id'><span class='badge text-light p-1 mr-1' style='background-color: $credential_tag_color;'><i class='fa fa-fw fa-$credential_tag_icon mr-2'></i>$credential_tag_name</span></a>";
|
||||||
|
}
|
||||||
|
$credential_tags_display = implode('', $credential_tag_name_display_array);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td><i class="fa fa-fw fa-key text-secondary mr-2"></i><?php echo $credential_name; ?></td>
|
||||||
|
<td><?php echo $credential_description; ?></td>
|
||||||
|
<td><?php echo $credential_username_display; ?></td>
|
||||||
|
<td>
|
||||||
|
<button class="btn p-0" type="button" data-toggle="popover" data-trigger="focus" data-placement="top" data-content="<?php echo $credential_password; ?>"><i class="fas fa-2x fa-ellipsis-h text-secondary"></i><i class="fas fa-2x fa-ellipsis-h text-secondary"></i></button>
|
||||||
|
|
||||||
|
<button type="button" class='btn btn-sm clipboardjs' data-clipboard-text='<?php echo $credential_password; ?>'><i class='far fa-copy text-secondary'></i></button>
|
||||||
|
</td>
|
||||||
|
<td><?php echo $otp_display; ?></td>
|
||||||
|
<td><?php echo $credential_uri_display; ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Include script to get TOTP code via the credential ID -->
|
||||||
|
<script src="js/credential_show_otp_via_id.js"></script>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ($ticket_count) { ?>
|
||||||
|
<div class="tab-pane fade" id="pills-contact-tickets<?php echo $contact_id; ?>">
|
||||||
|
<div class="table-responsive-sm">
|
||||||
|
<table class="table table-striped table-borderless table-hover table-sm">
|
||||||
|
<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>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_array($sql_related_tickets)) {
|
||||||
|
$ticket_id = intval($row['ticket_id']);
|
||||||
|
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
|
||||||
|
$ticket_number = intval($row['ticket_number']);
|
||||||
|
$ticket_subject = nullable_htmlentities($row['ticket_subject']);
|
||||||
|
$ticket_priority = nullable_htmlentities($row['ticket_priority']);
|
||||||
|
$ticket_status = nullable_htmlentities($row['ticket_status']);
|
||||||
|
$ticket_status_name = nullable_htmlentities($row['ticket_status_name']);
|
||||||
|
$ticket_status_color = nullable_htmlentities($row['ticket_status_color']);
|
||||||
|
$ticket_created_at = nullable_htmlentities($row['ticket_created_at']);
|
||||||
|
$ticket_updated_at = nullable_htmlentities($row['ticket_updated_at']);
|
||||||
|
if (empty($ticket_updated_at)) {
|
||||||
|
if ($ticket_status == "Closed") {
|
||||||
|
$ticket_updated_at_display = "<p>Never</p>";
|
||||||
|
} else {
|
||||||
|
$ticket_updated_at_display = "<p class='text-danger'>Never</p>";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$ticket_updated_at_display = $ticket_updated_at;
|
||||||
|
}
|
||||||
|
$ticket_closed_at = nullable_htmlentities($row['ticket_closed_at']);
|
||||||
|
|
||||||
|
if ($ticket_priority == "High") {
|
||||||
|
$ticket_priority_display = "<span class='p-2 badge badge-danger'>$ticket_priority</span>";
|
||||||
|
} elseif ($ticket_priority == "Medium") {
|
||||||
|
$ticket_priority_display = "<span class='p-2 badge badge-warning'>$ticket_priority</span>";
|
||||||
|
} elseif ($ticket_priority == "Low") {
|
||||||
|
$ticket_priority_display = "<span class='p-2 badge badge-info'>$ticket_priority</span>";
|
||||||
|
} else {
|
||||||
|
$ticket_priority_display = "-";
|
||||||
|
}
|
||||||
|
$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>";
|
||||||
|
} else {
|
||||||
|
$ticket_assigned_to_display = "<p class='text-danger'>Not Assigned</p>";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$ticket_assigned_to_display = nullable_htmlentities($row['user_name']);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><a href="ticket.php?client_id=<?php echo $client_id; ?>&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?client_id=<?php echo $client_id; ?>&ticket_id=<?php echo $ticket_id; ?>"><?php echo $ticket_subject; ?></a></td>
|
||||||
|
<td><?php echo $ticket_priority_display; ?></td>
|
||||||
|
<td><span class='badge badge-pill text-light p-2' style="background-color: <?php echo $ticket_status_color; ?>"><?php echo $ticket_status_name; ?></span></td>
|
||||||
|
<td><?php echo $ticket_assigned_to_display; ?></td>
|
||||||
|
<td><?php echo $ticket_updated_at_display; ?></td>
|
||||||
|
<td><?php echo $ticket_created_at; ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ($recurring_ticket_count) { ?>
|
||||||
|
<div class="tab-pane fade" id="pills-contact-recurring-tickets<?php echo $contact_id; ?>">
|
||||||
|
|
||||||
|
<div class="table-responsive-sm">
|
||||||
|
<table class="table table-striped table-borderless table-hover table-sm">
|
||||||
|
<thead class="text-dark">
|
||||||
|
<tr>
|
||||||
|
<th>Subject</th>
|
||||||
|
<th>Priority</th>
|
||||||
|
<th>Frequency</th>
|
||||||
|
<th>Next Run</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_array($sql_related_recurring_tickets)) {
|
||||||
|
$recurring_ticket_id = intval($row['recurring_ticket_id']);
|
||||||
|
$recurring_ticket_subject = nullable_htmlentities($row['recurring_ticket_subject']);
|
||||||
|
$recurring_ticket_priority = nullable_htmlentities($row['recurring_ticket_priority']);
|
||||||
|
$recurring_ticket_frequency = nullable_htmlentities($row['recurring_ticket_frequency']);
|
||||||
|
$recurring_ticket_next_run = nullable_htmlentities($row['recurring_ticket_next_run']);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="text-bold"><?php echo $recurring_ticket_subject ?></td>
|
||||||
|
<td><?php echo $recurring_ticket_priority ?></td>
|
||||||
|
<td><?php echo $recurring_ticket_frequency ?></td>
|
||||||
|
<td><?php echo $recurring_ticket_next_run ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ($software_count) { ?>
|
||||||
|
<div class="tab-pane fade" id="pills-contact-licenses<?php echo $contact_id; ?>">
|
||||||
|
<div class="table-responsive-sm">
|
||||||
|
<table class="table table-striped table-borderless table-hover table-sm">
|
||||||
|
<thead class="text-dark">
|
||||||
|
<tr>
|
||||||
|
<th>Software</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Key</th>
|
||||||
|
<th>Seats</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_array($sql_linked_software)) {
|
||||||
|
$software_id = intval($row['software_id']);
|
||||||
|
$software_name = nullable_htmlentities($row['software_name']);
|
||||||
|
$software_version = nullable_htmlentities($row['software_version']);
|
||||||
|
$software_type = nullable_htmlentities($row['software_type']);
|
||||||
|
$software_license_type = nullable_htmlentities($row['software_license_type']);
|
||||||
|
$software_key = nullable_htmlentities($row['software_key']);
|
||||||
|
$software_seats = nullable_htmlentities($row['software_seats']);
|
||||||
|
$software_purchase = nullable_htmlentities($row['software_purchase']);
|
||||||
|
$software_expire = nullable_htmlentities($row['software_expire']);
|
||||||
|
$software_notes = nullable_htmlentities($row['software_notes']);
|
||||||
|
|
||||||
|
$seat_count = 0;
|
||||||
|
|
||||||
|
// 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[] = intval($row['asset_id']);
|
||||||
|
$seat_count = $seat_count + 1;
|
||||||
|
}
|
||||||
|
$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[] = intval($row['contact_id']);
|
||||||
|
$seat_count = $seat_count + 1;
|
||||||
|
}
|
||||||
|
$contact_licenses = implode(',', $contact_licenses_array);
|
||||||
|
|
||||||
|
$linked_software[] = $software_id;
|
||||||
|
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo "$software_name $software_version"; ?></td>
|
||||||
|
<td><?php echo $software_type; ?></td>
|
||||||
|
<td><?php echo $software_key; ?></td>
|
||||||
|
<td><?php echo "$seat_count / $software_seats"; ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ($document_count) { ?>
|
||||||
|
<div class="tab-pane fade" id="pills-contact-documents<?php echo $contact_id; ?>">
|
||||||
|
|
||||||
|
<div class="table-responsive-sm">
|
||||||
|
<table class="table table-striped table-borderless table-hover table-sm">
|
||||||
|
<thead class="text-dark">
|
||||||
|
<tr>
|
||||||
|
<th>Document Title</th>
|
||||||
|
<th>By</th>
|
||||||
|
<th>Created</th>
|
||||||
|
<th>Updated</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_array($sql_linked_documents)) {
|
||||||
|
$document_id = intval($row['document_id']);
|
||||||
|
$document_name = nullable_htmlentities($row['document_name']);
|
||||||
|
$document_description = nullable_htmlentities($row['document_description']);
|
||||||
|
$document_created_by = nullable_htmlentities($row['user_name']);
|
||||||
|
$document_created_at = nullable_htmlentities($row['document_created_at']);
|
||||||
|
$document_updated_at = nullable_htmlentities($row['document_updated_at']);
|
||||||
|
|
||||||
|
$linked_documents[] = $document_id;
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="#"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-modal-size="lg"
|
||||||
|
data-ajax-url="ajax/ajax_document_view.php"
|
||||||
|
data-ajax-id="<?php echo $document_id; ?>">
|
||||||
|
<?php echo $document_name; ?>
|
||||||
|
</a>
|
||||||
|
<div class="text-secondary"><?php echo $document_description; ?></div>
|
||||||
|
</td>
|
||||||
|
<td><?php echo $document_created_by; ?></td>
|
||||||
|
<td><?php echo $document_created_at; ?></td>
|
||||||
|
<td><?php echo $document_updated_at; ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ($file_count) { ?>
|
||||||
|
<div class="tab-pane fade" id="pills-contact-files<?php echo $contact_id; ?>">
|
||||||
|
<div class="table-responsive-sm">
|
||||||
|
<table class="table table-striped table-borderless table-hover table-sm">
|
||||||
|
<thead class="text-dark">
|
||||||
|
<tr>
|
||||||
|
<th>File Name</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Size</th>
|
||||||
|
<th>Uploaded</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_array($sql_linked_files)) {
|
||||||
|
$file_id = intval($row['file_id']);
|
||||||
|
$file_name = nullable_htmlentities($row['file_name']);
|
||||||
|
$file_description = nullable_htmlentities($row['file_description']);
|
||||||
|
$file_size = nullable_htmlentities($row['file_size']);
|
||||||
|
$file_size_KB = round($file_size / 1024);
|
||||||
|
$file_reference_name = nullable_htmlentities($row['file_reference_name']);
|
||||||
|
$file_mime_type = nullable_htmlentities($row['file_mime_type']);
|
||||||
|
$file_created_at = nullable_htmlentities($row['file_created_at']);
|
||||||
|
|
||||||
|
$linked_files[] = $file_id;
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div><a href="uploads/clients/<?php echo $client_id; ?>/<?php echo $file_reference_name; ?>"><?php echo $file_name; ?></a></div>
|
||||||
|
<div class="text-secondary"><?php echo $file_description; ?></div>
|
||||||
|
</td>
|
||||||
|
<td><?php echo $file_mime_type; ?></td>
|
||||||
|
<td><?php echo $file_size_KB; ?> KB</td>
|
||||||
|
<td><?php echo $file_created_at; ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ($note_count) { ?>
|
||||||
|
<div class="tab-pane fade" id="pills-contact-notes<?php echo $contact_id; ?>">
|
||||||
|
<div class="table-responsive-sm">
|
||||||
|
<table class="table table-striped table-borderless table-hover table-sm">
|
||||||
|
<thead class="text-dark">
|
||||||
|
<tr>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Note</th>
|
||||||
|
<th>By</th>
|
||||||
|
<th>Created</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_array($sql_related_notes)) {
|
||||||
|
$contact_note_id = intval($row['contact_note_id']);
|
||||||
|
$contact_note_type = nullable_htmlentities($row['contact_note_type']);
|
||||||
|
$contact_note = nullable_htmlentities($row['contact_note']);
|
||||||
|
$note_by = nullable_htmlentities($row['user_name']);
|
||||||
|
$contact_note_created_at = nullable_htmlentities($row['contact_note_created_at']);
|
||||||
|
|
||||||
|
// Get the corresponding icon for the note type
|
||||||
|
$note_type_icon = isset($note_types_array[$contact_note_type]) ? $note_types_array[$contact_note_type] : 'fa-fw fa-sticky-note'; // default icon if not found
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><i class="fa fa-fw <?php echo $note_type_icon; ?> mr-2"></i><?php echo $contact_note_type; ?></td>
|
||||||
|
<td><?php echo $contact_note; ?></td>
|
||||||
|
<td><?php echo $note_by; ?></td>
|
||||||
|
<td><?php echo $contact_note_created_at; ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<a href="contact_details.php?client_id=<?php echo $client_id; ?>&contact_id=<?php echo $contact_id; ?>" class="btn btn-primary text-bold">
|
||||||
|
<span class="text-white"><i class="fas fa-info-circle mr-2"></i>More Details</span>
|
||||||
|
</a>
|
||||||
|
<a href="#" class="btn btn-secondary"
|
||||||
|
data-toggle="ajax-modal" data-ajax-url="ajax/ajax_contact_edit.php" data-ajax-id="<?php echo $contact_id; ?>">
|
||||||
|
<span class="text-white"><i class="fas fa-edit mr-2"></i>Edit</span>
|
||||||
|
</a>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Close</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
391
ajax/ajax_contact_edit.php
Normal file
391
ajax/ajax_contact_edit.php
Normal file
@@ -0,0 +1,391 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$contact_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||||
|
LEFT JOIN users ON user_id = contact_user_id
|
||||||
|
WHERE contact_id = $contact_id
|
||||||
|
LIMIT 1"
|
||||||
|
);
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$client_id = intval($row['contact_client_id']);
|
||||||
|
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||||
|
$contact_title = nullable_htmlentities($row['contact_title']);
|
||||||
|
$contact_department = nullable_htmlentities($row['contact_department']);
|
||||||
|
$contact_extension = nullable_htmlentities($row['contact_extension']);
|
||||||
|
$contact_phone_country_code = nullable_htmlentities($row['contact_phone_country_code']);
|
||||||
|
$contact_phone = nullable_htmlentities(formatPhoneNumber($row['contact_phone'], $contact_phone_country_code));
|
||||||
|
$contact_mobile_country_code = nullable_htmlentities($row['contact_mobile_country_code']);
|
||||||
|
$contact_mobile = nullable_htmlentities(formatPhoneNumber($row['contact_phone'], $contact_mobile_country_code));
|
||||||
|
$contact_email = nullable_htmlentities($row['contact_email']);
|
||||||
|
$contact_pin = nullable_htmlentities($row['contact_pin']);
|
||||||
|
$contact_photo = nullable_htmlentities($row['contact_photo']);
|
||||||
|
$contact_initials = initials($contact_name);
|
||||||
|
$contact_notes = nullable_htmlentities($row['contact_notes']);
|
||||||
|
$contact_primary = intval($row['contact_primary']);
|
||||||
|
$contact_important = intval($row['contact_important']);
|
||||||
|
$contact_billing = intval($row['contact_billing']);
|
||||||
|
$contact_technical = intval($row['contact_technical']);
|
||||||
|
$contact_created_at = nullable_htmlentities($row['contact_created_at']);
|
||||||
|
$contact_archived_at = nullable_htmlentities($row['contact_archived_at']);
|
||||||
|
$contact_location_id = intval($row['contact_location_id']);
|
||||||
|
$auth_method = nullable_htmlentities($row['user_auth_method']);
|
||||||
|
$contact_user_id = intval($row['contact_user_id']);
|
||||||
|
|
||||||
|
// Tags
|
||||||
|
$contact_tag_id_array = array();
|
||||||
|
$sql_contact_tags = mysqli_query($mysqli, "SELECT tag_id FROM contact_tags WHERE contact_id = $contact_id");
|
||||||
|
while ($row = mysqli_fetch_array($sql_contact_tags)) {
|
||||||
|
$contact_tag_id = intval($row['tag_id']);
|
||||||
|
$contact_tag_id_array[] = $contact_tag_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class='fas fa-user-edit mr-2'></i>Editing Contact: <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; ?>">
|
||||||
|
<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; ?>"><i class="fa fa-fw fa-id-badge 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-access<?php echo $contact_id; ?>"><i class="fa fa-fw fa-lock mr-2"></i>Access</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>
|
||||||
|
|
||||||
|
<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" maxlength="200" value="<?php echo $contact_name; ?>" required>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<div class="input-group-text">
|
||||||
|
<input type="checkbox" name="contact_primary" value="1" <?php if ($contact_primary == 1) { 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" maxlength="200" value="<?php echo $contact_title; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Department / Group</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-users"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="department" placeholder="Department or group" maxlength="200" value="<?php echo $contact_department; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label>Phone / <span class="text-secondary">Extension</span></label>
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="col-9">
|
||||||
|
<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="tel" class="form-control col-2" name="phone_country_code" value="<?php echo "+$contact_phone_country_code"; ?>" placeholder="Code" maxlength="4">
|
||||||
|
<input type="tel" class="form-control" name="phone" value="<?php echo $contact_phone; ?>" placeholder="Phone Number" maxlength="200">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="text" class="form-control" name="extension" value="<?php echo $contact_extension; ?>" placeholder="ext." maxlength="200">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label>Mobile</label>
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="col-9">
|
||||||
|
<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="tel" class="form-control col-2" name="mobile_country_code" value="<?php echo "+$contact_mobile_country_code"; ?>" placeholder="Code" maxlength="4">
|
||||||
|
<input type="tel" class="form-control" name="mobile" value="<?php echo $contact_mobile; ?>" placeholder="Phone Number">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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" maxlength="200" 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="">- Select Location -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_locations = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_id = $contact_location_id 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 = nullable_htmlentities($row['location_name']);
|
||||||
|
$location_archived_at = nullable_htmlentities($row['location_archived_at']);
|
||||||
|
if ($location_archived_at) {
|
||||||
|
$location_name_select_display = "($location_name_select) - ARCHIVED";
|
||||||
|
} else {
|
||||||
|
$location_name_select_display = $location_name_select;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<option <?php if ($contact_location_id == $location_id_select) {
|
||||||
|
echo "selected";
|
||||||
|
} ?> value="<?php echo $location_id_select; ?>"><?php echo $location_name_select_display; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-access<?php echo $contact_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Pin</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="pin" placeholder="Security code or pin" maxlength="255" value="<?php echo $contact_pin; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if ($config_client_portal_enable == 1) { ?>
|
||||||
|
<div class="authForm">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Client Portal</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 authMethod" name="auth_method">
|
||||||
|
<option value="">- No Access -</option>
|
||||||
|
<option value="local" <?php if ($auth_method == "local") { echo "selected"; } ?>>Using Set Password</option>
|
||||||
|
<option value="azure" <?php if ($auth_method == "azure") { echo "selected"; } ?>>Using Azure Credentials</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group passwordGroup" style="display: none;">
|
||||||
|
<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-edit-<?php echo $contact_id; ?>" name="contact_password" placeholder="Password" 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 type="button" class="btn btn-default" onclick="generatePassword('edit', <?php echo $contact_id; ?>)">
|
||||||
|
<i class="fa fa-fw fa-question"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="checkbox" class="form-check-input" name="send_email" value="1" />
|
||||||
|
<label class="form-check-label">Send user e-mail with login details?</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<label>Roles:</label>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
<p class="text-secondary"><small>Pin Top</small></p>
|
||||||
|
</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>
|
||||||
|
<p class="text-secondary"><small>Receives Invoices</small></p>
|
||||||
|
</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-photo<?php echo $contact_id; ?>">
|
||||||
|
|
||||||
|
<div class="mb-3 text-center">
|
||||||
|
<?php if ($contact_photo) { ?>
|
||||||
|
<img class="img-fluid" alt="contact_photo" src="<?php echo "uploads/clients/$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" accept="image/*">
|
||||||
|
</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="Notes, eg Personal tidbits to spark convo, temperment, etc"><?php echo $contact_notes; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Tags</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-tags"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="tags[]" data-placeholder="Add some tags" multiple>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 3 ORDER BY tag_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_tags_select)) {
|
||||||
|
$tag_id_select = intval($row['tag_id']);
|
||||||
|
$tag_name_select = nullable_htmlentities($row['tag_name']);
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $tag_id_select; ?>" <?php if (in_array($tag_id_select, $contact_tag_id_array)) { echo "selected"; } ?>><?php echo $tag_name_select; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-secondary" type="button"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-modal-size="sm"
|
||||||
|
data-ajax-url="ajax/ajax_tag_add.php"
|
||||||
|
data-ajax-id="3">
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="text-muted text-right">Contact ID: <?= $contact_id ?></p>
|
||||||
|
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<!-- JavaScript to Show/Hide Password Form Group -->
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function generatePassword(type, id) {
|
||||||
|
// Send a GET request to ajax.php as ajax.php?get_readable_pass=true
|
||||||
|
jQuery.get(
|
||||||
|
"../ajax.php", {
|
||||||
|
get_readable_pass: 'true'
|
||||||
|
},
|
||||||
|
function(data) {
|
||||||
|
//If we get a response from post.php, parse it as JSON
|
||||||
|
const password = JSON.parse(data);
|
||||||
|
|
||||||
|
// Set the password value to the correct modal, based on the type
|
||||||
|
if (type == "add") {
|
||||||
|
document.getElementById("password-add").value = password;
|
||||||
|
} else if (type == "edit") {
|
||||||
|
document.getElementById("password-edit-"+id.toString()).value = password;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('.authMethod').on('change', function() {
|
||||||
|
var $form = $(this).closest('.authForm');
|
||||||
|
if ($(this).val() === 'local') {
|
||||||
|
$form.find('.passwordGroup').show();
|
||||||
|
} else {
|
||||||
|
$form.find('.passwordGroup').hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('.authMethod').trigger('change');
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
54
ajax/ajax_contact_note_create.php
Normal file
54
ajax/ajax_contact_note_create.php
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$contact_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT contact_name FROM contacts WHERE contact_id = $contact_id LIMIT 1");
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class='fa fa-fw fa-sticky-note mr-2'></i>Creating note: <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" autocomplete="off">
|
||||||
|
<input type="hidden" name="contact_id" value="<?php echo $contact_id; ?>">
|
||||||
|
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Type</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-comment"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="type">
|
||||||
|
<?php foreach ($note_types_array as $note_type => $note_type_icon) { ?>
|
||||||
|
<option><?php echo nullable_htmlentities($note_type); ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="form-control" rows="6" name="note" placeholder="Notes, eg Personal tidbits to spark convo, temperment, etc"></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="add_contact_note" 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>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
267
ajax/ajax_credential_edit.php
Normal file
267
ajax/ajax_credential_edit.php
Normal file
@@ -0,0 +1,267 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$credential_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM credentials WHERE credential_id = $credential_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$client_id = intval($row['credential_client_id']);
|
||||||
|
$credential_name = nullable_htmlentities($row['credential_name']);
|
||||||
|
$credential_description = nullable_htmlentities($row['credential_description']);
|
||||||
|
$credential_uri = nullable_htmlentities($row['credential_uri']);
|
||||||
|
$credential_uri_2 = nullable_htmlentities($row['credential_uri_2']);
|
||||||
|
$credential_username = nullable_htmlentities(decryptCredentialEntry($row['credential_username']));
|
||||||
|
$credential_password = nullable_htmlentities(decryptCredentialEntry($row['credential_password']));
|
||||||
|
$credential_otp_secret = nullable_htmlentities($row['credential_otp_secret']);
|
||||||
|
$credential_note = nullable_htmlentities($row['credential_note']);
|
||||||
|
$credential_created_at = nullable_htmlentities($row['credential_created_at']);
|
||||||
|
$credential_archived_at = nullable_htmlentities($row['credential_archived_at']);
|
||||||
|
$credential_important = intval($row['credential_important']);
|
||||||
|
$credential_contact_id = intval($row['credential_contact_id']);
|
||||||
|
$credential_asset_id = intval($row['credential_asset_id']);
|
||||||
|
|
||||||
|
// Tags
|
||||||
|
$credential_tag_id_array = array();
|
||||||
|
$sql_credential_tags = mysqli_query($mysqli, "SELECT tag_id FROM credential_tags WHERE credential_id = $credential_id");
|
||||||
|
while ($row = mysqli_fetch_array($sql_credential_tags)) {
|
||||||
|
$credential_tag_id = intval($row['tag_id']);
|
||||||
|
$credential_tag_id_array[] = $credential_tag_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class='fas fa-fw fa-key mr-2'></i>Editing credential: <strong><?php echo $credential_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="credential_id" value="<?php echo $credential_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-credential-details<?php echo $credential_id; ?>">Details</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-credential-relation<?php echo $credential_id; ?>">Relation</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-credential-notes<?php echo $credential_id; ?>">Notes</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="tab-content" <?php if (lookupUserPermission('module_credential') <= 1) { echo 'inert'; } ?>>
|
||||||
|
|
||||||
|
<div class="tab-pane fade show active" id="pills-credential-details<?php echo $credential_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 Credential" maxlength="200" value="<?php echo $credential_name; ?>" required>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<div class="input-group-text">
|
||||||
|
<input type="checkbox" name="important" value="1" <?php if ($credential_important == 1) { echo "checked"; } ?>>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="description" placeholder="Description" value="<?php echo $credential_description; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Username / ID</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 or ID" maxlength="350" value="<?php echo $credential_username; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Password / Key <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 or Key" maxlength="350" value="<?php echo $credential_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 $credential_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" maxlength="200" value="<?php echo $credential_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>URI</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. http://192.168.1.1" maxlength="500" value="<?php echo $credential_uri; ?>">
|
||||||
|
<div class="input-group-append">
|
||||||
|
|
||||||
|
<a href="<?php echo $credential_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 $credential_uri; ?>"><i class="fa fa-fw fa-copy"></i></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>URI 2</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_2" placeholder="ex. https://server.company.com:5001" maxlength="500" value="<?php echo $credential_uri_2; ?>">
|
||||||
|
<div class="input-group-append">
|
||||||
|
<a href="<?php echo $credential_uri_2; ?>" 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 $credential_uri_2; ?>"><i class="fa fa-fw fa-copy"></i></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-credential-relation<?php echo $credential_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Contact</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="contact">
|
||||||
|
<option value="">- Select Contact -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_contacts = mysqli_query($mysqli, "SELECT contact_id, contact_name 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 = nullable_htmlentities($row['contact_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($credential_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>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">- Select Asset -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_assets = mysqli_query($mysqli, "SELECT asset_id, asset_name, location_name FROM assets LEFT JOIN locations on asset_location_id = location_id WHERE asset_client_id = $client_id AND asset_archived_at IS NULL ORDER BY asset_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||||
|
$asset_id_select = intval($row['asset_id']);
|
||||||
|
$asset_name_select = nullable_htmlentities($row['asset_name']);
|
||||||
|
$asset_location_select = nullable_htmlentities($row['location_name']);
|
||||||
|
|
||||||
|
$asset_select_display_string = $asset_name_select;
|
||||||
|
if (!empty($asset_location_select)) {
|
||||||
|
$asset_select_display_string = "$asset_name_select ($asset_location_select)";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<option <?php if ($credential_asset_id == $asset_id_select) { echo "selected"; } ?> value="<?php echo $asset_id_select; ?>"><?php echo $asset_select_display_string; ?></option>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-credential-notes<?php echo $credential_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="form-control" rows="12" placeholder="Enter some notes" name="note"><?php echo $credential_note; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Tags</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-tags"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="tags[]" data-placeholder="Add some tags" multiple>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_tags_select = mysqli_query($mysqli, "SELECT tag_id, tag_name FROM tags WHERE tag_type = 4 ORDER BY tag_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_tags_select)) {
|
||||||
|
$tag_id_select = intval($row['tag_id']);
|
||||||
|
$tag_name_select = nullable_htmlentities($row['tag_name']);
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $tag_id_select; ?>" <?php if (in_array($tag_id_select, $credential_tag_id_array)) { echo "selected"; } ?>><?php echo $tag_name_select; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-secondary" type="button"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-modal-size="sm"
|
||||||
|
data-ajax-url="ajax/ajax_tag_add.php"
|
||||||
|
data-ajax-id="4">
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_credential" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
94
ajax/ajax_credential_view.php
Normal file
94
ajax/ajax_credential_view.php
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$credential_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM credentials WHERE credential_id = $credential_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$credential_name = nullable_htmlentities($row['credential_name']);
|
||||||
|
$credential_description = nullable_htmlentities($row['credential_description']);
|
||||||
|
$credential_uri = nullable_htmlentities($row['credential_uri']);
|
||||||
|
$credential_uri_2 = nullable_htmlentities($row['credential_uri_2']);
|
||||||
|
$credential_username = nullable_htmlentities(decryptLoginEntry($row['credential_username']));
|
||||||
|
$credential_password = nullable_htmlentities(decryptLoginEntry($row['credential_password']));
|
||||||
|
$credential_otp_secret = nullable_htmlentities($row['credential_otp_secret']);
|
||||||
|
$credential_id_with_secret = '"' . $row['credential_id'] . '","' . $row['credential_otp_secret'] . '"';
|
||||||
|
if (empty($credential_otp_secret)) {
|
||||||
|
$otp_display = "-";
|
||||||
|
} else {
|
||||||
|
$otp_display = "<span onmouseenter='showOTPViaCredentialID($credential_id)'><i class='far fa-clock'></i> <span id='otp_$credential_id'><i>Hover..</i></span></span>";
|
||||||
|
}
|
||||||
|
$credential_note = nullable_htmlentities($row['credential_note']);
|
||||||
|
$credential_created_at = nullable_htmlentities($row['credential_created_at']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header bg-dark text-white">
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
<i class="fas fa-fw fa-building fa-2x mr-3"></i>
|
||||||
|
<div>
|
||||||
|
<h5 class="modal-title mb-0"><?php echo $name; ?></h5>
|
||||||
|
<div class="text-muted"><?php echo getFallback($description); ?></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-body bg-light">
|
||||||
|
|
||||||
|
<!-- Vendor Info Card -->
|
||||||
|
<div class="card mb-3 shadow-sm rounded">
|
||||||
|
<div class="card-body">
|
||||||
|
<h6 class="text-secondary"><i class="fas fa-info-circle mr-2"></i>Vendor Details</h6>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div><strong>Account Number:</strong> <?php echo getFallback($account_number); ?></div>
|
||||||
|
<div><strong>Hours:</strong> <?php echo getFallback($hours); ?></div>
|
||||||
|
<div><strong>SLA:</strong> <?php echo getFallback($sla); ?></div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div><strong>Code:</strong> <?php echo getFallback($code); ?></div>
|
||||||
|
<div><strong>Website:</strong> <?php echo !empty($website) ? '<a href="' . $website . '" target="_blank" class="text-primary">' . $website . '</a>' : '<span class="text-muted">Not Available</span>'; ?></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Contact Info Card -->
|
||||||
|
<div class="card mb-3 shadow-sm rounded">
|
||||||
|
<div class="card-body">
|
||||||
|
<h6 class="text-secondary"><i class="fas fa-user mr-2"></i>Contact Information</h6>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div><strong>Contact Name:</strong> <?php echo getFallback($contact_name); ?></div>
|
||||||
|
<div><strong>Phone:</strong> <?php echo getFallback($phone); ?></div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div><strong>Email:</strong> <?php echo !empty($email) ? '<a href="mailto:' . $email . '" class="text-primary">' . $email . '</a>' : '<span class="text-muted">Not Available</span>'; ?></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Notes Card -->
|
||||||
|
<div class="card mb-3 shadow-sm rounded">
|
||||||
|
<div class="card-body">
|
||||||
|
<h6 class="text-secondary"><i class="fas fa-sticky-note mr-2"></i>Notes</h6>
|
||||||
|
<div>
|
||||||
|
<?php echo getFallback($notes); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="js/credential_show_otp_via_id.js"></script>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
99
ajax/ajax_custom_link_edit.php
Normal file
99
ajax/ajax_custom_link_edit.php
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$custom_link_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM custom_links WHERE custom_link_id = $custom_link_id LIMIT 1");
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$custom_link_name = nullable_htmlentities($row['custom_link_name']);
|
||||||
|
$custom_link_uri = nullable_htmlentities($row['custom_link_uri']);
|
||||||
|
$custom_link_icon = nullable_htmlentities($row['custom_link_icon']);
|
||||||
|
$custom_link_new_tab = intval($row['custom_link_new_tab']);
|
||||||
|
$custom_link_order = intval($row['custom_link_order']);
|
||||||
|
$custom_link_location = intval($row['custom_link_location']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fas fa-fw fa-external-link-alt mr-2"></i>Editing link: <strong><?php echo $custom_link_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="custom_link_id" value="<?php echo $custom_link_id; ?>">
|
||||||
|
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Name <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-list-ul"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="name" value="<?php echo $custom_link_name; ?>" maxlength="200" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Order</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-sort-numeric-down"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="number" class="form-control" name="order" placeholder="Leave blank for no order" value="<?php echo $custom_link_order; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>URI <strong class="text-danger">*</strong></label> / <span class="text-secondary">Open New Tab</span>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-external-link-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="uri" placeholder="Enter Link" maxlength="500" value="<?php echo $custom_link_uri; ?>" required>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<div class="input-group-text">
|
||||||
|
<input type="checkbox" name="new_tab" value="1" <?php if ($custom_link_new_tab == 1) { echo "checked"; } ?>>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Icon</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-image"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="icon" placeholder="Icon ex handshake" maxlength="200" value="<?php echo $custom_link_icon; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Location <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-home"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="location" required>
|
||||||
|
<option value="1" <?php if ($custom_link_location == 1) { echo "selected"; } ?> >Main Side Nav</option>
|
||||||
|
<option value="2" <?php if ($custom_link_location == 2) { echo "selected"; } ?> >Top Nav (Icon Required)</option>
|
||||||
|
<option value="3" <?php if ($custom_link_location == 3) { echo "selected"; } ?> >Client Portal Nav</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_custom_link" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
68
ajax/ajax_custom_ticket_status_edit.php
Normal file
68
ajax/ajax_custom_ticket_status_edit.php
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$ticket_status_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM ticket_statuses WHERE ticket_status_id = $ticket_status_id LIMIT 1");
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$ticket_status_name = nullable_htmlentities($row['ticket_status_name']);
|
||||||
|
$ticket_status_color = nullable_htmlentities($row['ticket_status_color']);
|
||||||
|
$ticket_status_active = intval($row['ticket_status_active']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fas fa-fw fa-info-circle mr-2"></i>Editing Ticket Status: <strong><?php echo $ticket_status_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="ticket_status_id" value="<?php echo $ticket_status_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-tag"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="name" maxlength="200" value="<?php echo $ticket_status_name; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Color <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-paint-brush"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="color" class="form-control col-3" name="color" value="<?php echo $ticket_status_color; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Status <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-info-circle"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="status" required>
|
||||||
|
<option <?php if ($ticket_status_active == 1) { echo "selected"; } ?> value="1">Active</option>
|
||||||
|
<option <?php if ($ticket_status_active == 0) { echo "selected"; } ?> value="0">Disabled</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_ticket_status" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
80
ajax/ajax_document_edit.php
Normal file
80
ajax/ajax_document_edit.php
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$document_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_id = $document_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$document_name = nullable_htmlentities($row['document_name']);
|
||||||
|
$document_description = nullable_htmlentities($row['document_description']);
|
||||||
|
$document_content = nullable_htmlentities($row['document_content']);
|
||||||
|
$document_created_by_id = intval($row['document_created_by']);
|
||||||
|
$document_created_at = nullable_htmlentities($row['document_created_at']);
|
||||||
|
$document_updated_at = nullable_htmlentities($row['document_updated_at']);
|
||||||
|
$document_archived_at = nullable_htmlentities($row['document_archived_at']);
|
||||||
|
$document_folder_id = intval($row['document_folder_id']);
|
||||||
|
$document_parent = intval($row['document_parent']);
|
||||||
|
$document_client_visible = intval($row['document_client_visible']);
|
||||||
|
$client_id = intval($row['document_client_id']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-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>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="document_id" value="<?php if($document_parent == 0){ echo $document_id; } else { echo $document_parent; } ?>">
|
||||||
|
<input type="hidden" name="document_parent" value="<?php echo $document_parent; ?>">
|
||||||
|
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||||
|
<input type="hidden" name="created_by" value="<?php echo $document_created_by_id; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="text" class="form-control" name="name" maxlength="200" value="<?php echo $document_name; ?>" placeholder="Name" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="form-control tinymce" 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 select2" name="folder">
|
||||||
|
<option value="0">/</option>
|
||||||
|
<?php
|
||||||
|
$sql_folders_select = mysqli_query($mysqli, "SELECT * FROM folders WHERE folder_location = 0 AND 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 = nullable_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 class="form-group">
|
||||||
|
<input type="text" class="form-control" name="description" value="<?php echo $document_description; ?>" placeholder="Short summary of changes">
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
109
ajax/ajax_document_move.php
Normal file
109
ajax/ajax_document_move.php
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$document_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_id = $document_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$client_id = intval($row['document_client_id']);
|
||||||
|
$document_folder_id = nullable_htmlentities($row['document_folder_id']);
|
||||||
|
$document_name = nullable_htmlentities($row['document_name']);
|
||||||
|
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-file-alt mr-2"></i>Moving document: <strong><?php echo $document_name; ?></strong></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="document_id" value="<?php echo $document_id; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Move Document to</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="folder">
|
||||||
|
<option value="0">/</option>
|
||||||
|
<?php
|
||||||
|
// Fetch all folders for the client
|
||||||
|
$sql_all_folders = mysqli_query($mysqli, "SELECT folder_id, folder_name, parent_folder FROM folders WHERE folder_location = 0 AND folder_client_id = $client_id ORDER BY folder_name ASC");
|
||||||
|
$folders = array();
|
||||||
|
|
||||||
|
// Build an associative array of folders indexed by folder_id
|
||||||
|
while ($row = mysqli_fetch_assoc($sql_all_folders)) {
|
||||||
|
$folders[$row['folder_id']] = array(
|
||||||
|
'folder_id' => intval($row['folder_id']),
|
||||||
|
'folder_name' => nullable_htmlentities($row['folder_name']),
|
||||||
|
'parent_folder' => intval($row['parent_folder']),
|
||||||
|
'children' => array()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build the folder hierarchy
|
||||||
|
foreach ($folders as $id => &$folder) {
|
||||||
|
if ($folder['parent_folder'] != 0 && isset($folders[$folder['parent_folder']])) {
|
||||||
|
$folders[$folder['parent_folder']]['children'][] = &$folder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($folder); // Break the reference
|
||||||
|
|
||||||
|
// Prepare a list of root folders
|
||||||
|
$root_folders = array();
|
||||||
|
foreach ($folders as $id => $folder) {
|
||||||
|
if ($folder['parent_folder'] == 0) {
|
||||||
|
$root_folders[] = $folder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display the folder options iteratively
|
||||||
|
$stack = array();
|
||||||
|
foreach (array_reverse($root_folders) as $folder) {
|
||||||
|
$stack[] = array('folder' => $folder, 'level' => 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!empty($stack)) {
|
||||||
|
$node = array_pop($stack);
|
||||||
|
$folder = $node['folder'];
|
||||||
|
$level = $node['level'];
|
||||||
|
|
||||||
|
// Indentation for subfolders
|
||||||
|
$indentation = str_repeat(' ', $level * 4);
|
||||||
|
|
||||||
|
// Check if this folder is selected
|
||||||
|
$selected = '';
|
||||||
|
if ($folder['folder_id'] == $document_folder_id) {
|
||||||
|
$selected = 'selected';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<option value=\"{$folder['folder_id']}\" $selected>$indentation{$folder['folder_name']}</option>";
|
||||||
|
|
||||||
|
// Add children to the stack
|
||||||
|
if (!empty($folder['children'])) {
|
||||||
|
foreach (array_reverse($folder['children']) as $child_folder) {
|
||||||
|
$stack[] = array('folder' => $child_folder, 'level' => $level + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="move_document" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Move</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
46
ajax/ajax_document_rename.php
Normal file
46
ajax/ajax_document_rename.php
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$document_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_id = $document_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$client_id = intval($row['document_client_id']);
|
||||||
|
$document_name = nullable_htmlentities($row['document_name']);
|
||||||
|
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-file-alt mr-2"></i>Renaming document: <strong><?php echo $document_name; ?></strong></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="document_id" value="<?php echo $document_id; ?>">
|
||||||
|
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Document Name <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-file-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<input class="form-control" type="text" name="name" maxlength="200" value="<?php echo $document_name; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="rename_document" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Rename</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
47
ajax/ajax_document_template_edit.php
Normal file
47
ajax/ajax_document_template_edit.php
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$document_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_id = $document_id LIMIT 1");
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$document_name = nullable_htmlentities($row['document_name']);
|
||||||
|
$document_description = nullable_htmlentities($row['document_description']);
|
||||||
|
$document_content = nullable_htmlentities($row['document_content']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-file-alt mr-2"></i>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" maxlength="200" value="<?php echo $document_name; ?>" placeholder="Name" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="form-control tinymce" name="content"><?php echo $document_content; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="text" class="form-control" name="description" value="<?php echo $document_description; ?>" placeholder="Short summary">
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
37
ajax/ajax_document_view.php
Normal file
37
ajax/ajax_document_view.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
// Initialize the HTML Purifier to prevent XSS
|
||||||
|
require_once "../plugins/htmlpurifier/HTMLPurifier.standalone.php";
|
||||||
|
|
||||||
|
$purifier_config = HTMLPurifier_Config::createDefault();
|
||||||
|
$purifier_config->set('Cache.DefinitionImpl', null); // Disable cache by setting a non-existent directory or an invalid one
|
||||||
|
$purifier_config->set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'http' => true, 'https' => true]);
|
||||||
|
$purifier = new HTMLPurifier($purifier_config);
|
||||||
|
|
||||||
|
$document_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_id = $document_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$document_name = nullable_htmlentities($row['document_name']);
|
||||||
|
$document_content = $purifier->purify($row['document_content']);
|
||||||
|
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title text-white"><i class="fa fa-fw fa-file-alt mr-2"></i><?php echo $document_name; ?></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body bg-white prettyContent">
|
||||||
|
<?php echo $document_content; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
286
ajax/ajax_domain_edit.php
Normal file
286
ajax/ajax_domain_edit.php
Normal file
@@ -0,0 +1,286 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$domain_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM domains WHERE domain_id = $domain_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$domain_name = nullable_htmlentities($row['domain_name']);
|
||||||
|
$domain_description = nullable_htmlentities($row['domain_description']);
|
||||||
|
$domain_expire = nullable_htmlentities($row['domain_expire']);
|
||||||
|
$domain_registrar = intval($row['domain_registrar']);
|
||||||
|
$domain_webhost = intval($row['domain_webhost']);
|
||||||
|
$domain_dnshost = intval($row['domain_dnshost']);
|
||||||
|
$domain_mailhost = intval($row['domain_mailhost']);
|
||||||
|
$domain_ip = nullable_htmlentities($row['domain_ip']);
|
||||||
|
$domain_name_servers = nullable_htmlentities($row['domain_name_servers']);
|
||||||
|
$domain_mail_servers = nullable_htmlentities($row['domain_mail_servers']);
|
||||||
|
$domain_txt = nullable_htmlentities($row['domain_txt']);
|
||||||
|
$domain_raw_whois = nullable_htmlentities($row['domain_raw_whois']);
|
||||||
|
$domain_notes = nullable_htmlentities($row['domain_notes']);
|
||||||
|
$domain_created_at = nullable_htmlentities($row['domain_created_at']);
|
||||||
|
$domain_archived_at = nullable_htmlentities($row['domain_archived_at']);
|
||||||
|
$client_id = intval($row['domain_client_id']);
|
||||||
|
|
||||||
|
$history_sql = mysqli_query($mysqli, "SELECT * FROM domain_history WHERE domain_history_domain_id = $domain_id");
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-globe mr-2"></i>Editing domain: <span class="text-bold"><?php echo $domain_name; ?></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="<?php echo $domain_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-overview<?php echo $domain_id; ?>">Overview</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-records<?php echo $domain_id; ?>">Records</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pillsEditNotes<?php echo $domain_id; ?>">Notes</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pillsEditHistory<?php echo $domain_id; ?>">History</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="tab-content" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
|
||||||
|
|
||||||
|
<div class="tab-pane fade show active" id="pills-overview<?php echo $domain_id; ?>">
|
||||||
|
|
||||||
|
<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="Domain name example.com" maxlength="200" value="<?php echo $domain_name; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="description" placeholder="Short Description" value="<?php echo $domain_description; ?>">
|
||||||
|
</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">
|
||||||
|
<option value="">- Select Vendor -</option>
|
||||||
|
<?php
|
||||||
|
$vendor_sql = mysqli_query($mysqli, "SELECT vendor_id, vendor_name FROM vendors WHERE vendor_client_id = $client_id AND vendor_archived_at IS NULL ORDER BY vendor_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($vendor_sql)) {
|
||||||
|
$vendor_id = $row['vendor_id'];
|
||||||
|
$vendor_name = $row['vendor_name'];
|
||||||
|
?>
|
||||||
|
<option <?php if ($domain_registrar == $vendor_id) { echo "selected"; } ?> 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="">- Select Vendor -</option>
|
||||||
|
<?php
|
||||||
|
$vendor_sql = mysqli_query($mysqli, "SELECT vendor_id, vendor_name FROM vendors WHERE vendor_client_id = $client_id AND vendor_archived_at IS NULL ORDER BY vendor_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($vendor_sql)) {
|
||||||
|
$vendor_id = $row['vendor_id'];
|
||||||
|
$vendor_name = $row['vendor_name'];
|
||||||
|
?>
|
||||||
|
<option <?php if ($domain_webhost == $vendor_id) { echo "selected"; } ?> value="<?php echo $vendor_id; ?>"><?php echo $vendor_name; ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>DNS Host</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="dnshost">
|
||||||
|
<option value="">- Select Vendor -</option>
|
||||||
|
<?php
|
||||||
|
$vendor_sql = mysqli_query($mysqli, "SELECT vendor_id, vendor_name FROM vendors WHERE vendor_client_id = $client_id AND vendor_archived_at IS NULL ORDER BY vendor_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($vendor_sql)) {
|
||||||
|
$vendor_id = $row['vendor_id'];
|
||||||
|
$vendor_name = $row['vendor_name'];
|
||||||
|
?>
|
||||||
|
<option <?php if ($domain_dnshost == $vendor_id) { echo "selected"; } ?> value="<?php echo $vendor_id; ?>"><?php echo $vendor_name; ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Mail Host</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>
|
||||||
|
<select class="form-control select2" name="mailhost">
|
||||||
|
<option value="">- Select Vendor -</option>
|
||||||
|
<?php
|
||||||
|
$vendor_sql = mysqli_query($mysqli, "SELECT vendor_id, vendor_name FROM vendors WHERE vendor_client_id = $client_id AND vendor_archived_at IS NULL ORDER BY vendor_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($vendor_sql)) {
|
||||||
|
$vendor_id = $row['vendor_id'];
|
||||||
|
$vendor_name = $row['vendor_name'];
|
||||||
|
?>
|
||||||
|
<option <?php if ($domain_mailhost == $vendor_id) { echo "selected"; } ?> 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-times"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="date" class="form-control" name="expire" max="2999-12-31" value="<?php echo $domain_expire; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-records<?php echo $domain_id; ?>">
|
||||||
|
|
||||||
|
<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" rows="1" name="domain_ip" disabled><?php echo $domain_ip; ?></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" rows="1" name="name_servers" disabled><?php echo $domain_name_servers; ?></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" rows="1" name="mail_servers" disabled><?php echo $domain_mail_servers; ?></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" rows="1" name="txt_records" disabled><?php echo $domain_txt; ?></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" rows="6" name="raw_whois" disabled><?php echo $domain_raw_whois; ?></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pillsEditNotes<?php echo $domain_id; ?>">
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="form-control" name="notes" rows="12" placeholder="Enter some notes"><?php echo $domain_notes; ?></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pillsEditHistory<?php echo $domain_id; ?>">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class='table table-sm table-striped border table-hover'>
|
||||||
|
<thead class='thead-dark'>
|
||||||
|
<tr>
|
||||||
|
<th>Date</th>
|
||||||
|
<th>Field</th>
|
||||||
|
<th>Before</th>
|
||||||
|
<th>After</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
while ($row = mysqli_fetch_array($history_sql)) {
|
||||||
|
$domain_modified_at = nullable_htmlentities($row['domain_history_modified_at']);
|
||||||
|
$domain_field = nullable_htmlentities($row['domain_history_column']);
|
||||||
|
$domain_before_value = nullable_htmlentities($row['domain_history_old_value']);
|
||||||
|
$domain_after_value = nullable_htmlentities($row['domain_history_new_value']);
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $domain_modified_at; ?></td>
|
||||||
|
<td><?php echo $domain_field; ?></td>
|
||||||
|
<td><?php echo $domain_before_value; ?></td>
|
||||||
|
<td><?php echo $domain_after_value; ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<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>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
214
ajax/ajax_expense_copy.php
Normal file
214
ajax/ajax_expense_copy.php
Normal file
@@ -0,0 +1,214 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$expense_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM expenses WHERE expense_id = $expense_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$expense_date = nullable_htmlentities($row['expense_date']);
|
||||||
|
$expense_amount = floatval($row['expense_amount']);
|
||||||
|
$expense_currency_code = nullable_htmlentities($row['expense_currency_code']);
|
||||||
|
$expense_description = nullable_htmlentities($row['expense_description']);
|
||||||
|
$expense_receipt = nullable_htmlentities($row['expense_receipt']);
|
||||||
|
$expense_reference = nullable_htmlentities($row['expense_reference']);
|
||||||
|
$expense_created_at = nullable_htmlentities($row['expense_created_at']);
|
||||||
|
$expense_vendor_id = intval($row['expense_vendor_id']);
|
||||||
|
$expense_category_id = intval($row['expense_category_id']);
|
||||||
|
$expense_account_id = intval($row['expense_account_id']);
|
||||||
|
$expense_client_id = intval($row['expense_client_id']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class='fas fa-fw fa-copy mr-2'></i>Copying expense</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">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
<div class="form-row">
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Date <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="date" class="form-control" name="date" max="2999-12-31" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Amount <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-dollar-sign"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,2}" name="amount" value="<?php echo number_format($expense_amount, 2, '.', ''); ?>" placeholder="0.00" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Account <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-piggy-bank"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="account" required>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_accounts = mysqli_query($mysqli, "SELECT account_id, account_name, opening_balance FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_accounts)) {
|
||||||
|
$account_id_select = intval($row['account_id']);
|
||||||
|
$account_name_select = nullable_htmlentities($row['account_name']);
|
||||||
|
$opening_balance = floatval($row['opening_balance']);
|
||||||
|
|
||||||
|
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id_select");
|
||||||
|
$row = mysqli_fetch_array($sql_payments);
|
||||||
|
$total_payments = floatval($row['total_payments']);
|
||||||
|
|
||||||
|
$sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id_select");
|
||||||
|
$row = mysqli_fetch_array($sql_revenues);
|
||||||
|
$total_revenues = floatval($row['total_revenues']);
|
||||||
|
|
||||||
|
$sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id_select");
|
||||||
|
$row = mysqli_fetch_array($sql_expenses);
|
||||||
|
$total_expenses = floatval($row['total_expenses']);
|
||||||
|
|
||||||
|
$balance = $opening_balance + $total_payments + $total_revenues - $total_expenses;
|
||||||
|
?>
|
||||||
|
<option <?php if ($expense_account_id == $account_id_select) { echo "selected"; } ?> value="<?php echo $account_id_select; ?>"><?php echo $account_name_select; ?> [$<?php echo number_format($balance, 2); ?>]</option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Vendor <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-building"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="vendor" required>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_vendors = mysqli_query($mysqli, "SELECT vendor_id, vendor_name FROM vendors WHERE vendor_client_id = 0 AND vendor_template = 0 ORDER BY vendor_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_vendors)) {
|
||||||
|
$vendor_id_select = intval($row['vendor_id']);
|
||||||
|
$vendor_name_select = nullable_htmlentities($row['vendor_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($expense_vendor_id == $vendor_id_select) { ?> selected <?php } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description <strong class="text-danger">*</strong></label>
|
||||||
|
<textarea class="form-control" rows="6" name="description" placeholder="Enter a description" required><?php echo $expense_description; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Reference</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-file-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="reference" placeholder="Enter a reference" maxlength="200" value="<?php echo $expense_reference; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Category <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-list"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="category" required>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_categories = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Expense' ORDER BY category_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_categories)) {
|
||||||
|
$category_id_select = intval($row['category_id']);
|
||||||
|
$category_name_select = nullable_htmlentities($row['category_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($expense_category_id == $category_id_select) { ?> selected <?php } ?> value="<?php echo $category_id_select; ?>"><?php echo $category_name_select; ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if (isset($_GET['client_id'])) { ?>
|
||||||
|
<input type="hidden" name="client" value="<?php echo $client_id; ?>">
|
||||||
|
<?php } else { ?>
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Client</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="client">
|
||||||
|
<option value="">- Select Client -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_clients = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients ORDER BY client_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_clients)) {
|
||||||
|
$client_id_select = intval($row['client_id']);
|
||||||
|
$client_name_select = nullable_htmlentities($row['client_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($expense_client_id == $client_id_select) { echo "selected"; } ?> value="<?php echo $client_id_select; ?>"><?php echo $client_name_select; ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Receipt</label>
|
||||||
|
<input type="file" class="form-control-file" name="file">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="add_expense" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Copy</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
251
ajax/ajax_expense_edit.php
Normal file
251
ajax/ajax_expense_edit.php
Normal file
@@ -0,0 +1,251 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$expense_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM expenses
|
||||||
|
LEFT JOIN vendors ON expense_vendor_id = vendor_id
|
||||||
|
LEFT JOIN categories ON expense_category_id = category_id
|
||||||
|
WHERE expense_id = $expense_id LIMIT 1"
|
||||||
|
);
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$expense_date = nullable_htmlentities($row['expense_date']);
|
||||||
|
$expense_amount = floatval($row['expense_amount']);
|
||||||
|
$expense_currency_code = nullable_htmlentities($row['expense_currency_code']);
|
||||||
|
$expense_description = nullable_htmlentities($row['expense_description']);
|
||||||
|
$expense_receipt = nullable_htmlentities($row['expense_receipt']);
|
||||||
|
$expense_reference = nullable_htmlentities($row['expense_reference']);
|
||||||
|
$expense_created_at = nullable_htmlentities($row['expense_created_at']);
|
||||||
|
$expense_vendor_id = intval($row['expense_vendor_id']);
|
||||||
|
$expense_category_id = intval($row['expense_category_id']);
|
||||||
|
$expense_account_id = intval($row['expense_account_id']);
|
||||||
|
$expense_client_id = intval($row['expense_client_id']);
|
||||||
|
$vendor_name = nullable_htmlentities($row['vendor_name']);
|
||||||
|
$category_name = nullable_htmlentities($row['category_name']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class='fas fa-fw fa-shopping-cart mr-2'></i>Editing expense</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">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
<input type="hidden" name="expense_id" value="<?php echo $expense_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Date <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="date" class="form-control" name="date" max="2999-12-31" value="<?php echo $expense_date; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Amount <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-dollar-sign"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" inputmode="numeric" pattern="-?[0-9]*\.?[0-9]{0,2}" name="amount" value="<?php echo number_format($expense_amount, 2, '.', ''); ?>" placeholder="0.00" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Account <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-piggy-bank"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="account" required>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_accounts = mysqli_query($mysqli, "SELECT account_id, account_name, opening_balance, account_archived_at FROM accounts WHERE (account_archived_at > '$expense_created_at' OR account_archived_at IS NULL) ORDER BY account_archived_at ASC, account_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_accounts)) {
|
||||||
|
$account_id_select = intval($row['account_id']);
|
||||||
|
$account_name_select = nullable_htmlentities($row['account_name']);
|
||||||
|
$opening_balance = floatval($row['opening_balance']);
|
||||||
|
$account_archived_at = nullable_htmlentities($row['account_archived_at']);
|
||||||
|
if (empty($account_archived_at)) {
|
||||||
|
$account_archived_display = "";
|
||||||
|
} else {
|
||||||
|
$account_archived_display = "Archived - ";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id_select");
|
||||||
|
$row = mysqli_fetch_array($sql_payments);
|
||||||
|
$total_payments = floatval($row['total_payments']);
|
||||||
|
|
||||||
|
$sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id_select");
|
||||||
|
$row = mysqli_fetch_array($sql_revenues);
|
||||||
|
$total_revenues = floatval($row['total_revenues']);
|
||||||
|
|
||||||
|
$sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id_select");
|
||||||
|
$row = mysqli_fetch_array($sql_expenses);
|
||||||
|
$total_expenses = floatval($row['total_expenses']);
|
||||||
|
|
||||||
|
$balance = $opening_balance + $total_payments + $total_revenues - $total_expenses;
|
||||||
|
|
||||||
|
?>
|
||||||
|
<option <?php if ($expense_account_id == $account_id_select) { ?> selected <?php } ?> value="<?php echo $account_id_select; ?>"><?php echo "$account_archived_display$account_name_select"; ?> [$<?php echo number_format($balance, 2); ?>]</option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Vendor <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-building"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="vendor" required>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_select = mysqli_query($mysqli, "SELECT vendor_id, vendor_name FROM vendors WHERE vendor_client_id = 0 AND vendor_template = 0 AND (vendor_archived_at > '$expense_created_at' OR vendor_archived_at IS NULL) ORDER BY vendor_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_select)) {
|
||||||
|
$vendor_id_select = intval($row['vendor_id']);
|
||||||
|
$vendor_name_select = nullable_htmlentities($row['vendor_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($expense_vendor_id == $vendor_id_select) { ?> selected <?php } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-secondary" type="button"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-modal-size="sm"
|
||||||
|
data-ajax-url="ajax/ajax_category_add.php?category=Expense">
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description <strong class="text-danger">*</strong></label>
|
||||||
|
<textarea class="form-control" rows="6" name="description" placeholder="Enter a description" required><?php echo $expense_description; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Reference</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-file-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="reference" placeholder="Enter a reference" maxlength="200" value="<?php echo $expense_reference; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Category <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-list"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="category" required>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_select = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Expense' AND (category_archived_at > '$expense_created_at' OR category_archived_at IS NULL) ORDER BY category_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_select)) {
|
||||||
|
$category_id_select = intval($row['category_id']);
|
||||||
|
$category_name_select = nullable_htmlentities($row['category_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($expense_category_id == $category_id_select) { ?> selected <?php } ?> value="<?php echo $category_id_select; ?>"><?php echo $category_name_select; ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-secondary" type="button"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-modal-size="sm"
|
||||||
|
data-ajax-url="ajax/ajax_category_add.php?category=Expense">
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if (isset($_GET['client_id'])) { ?>
|
||||||
|
<input type="hidden" name="client" value="<?php echo $client_id; ?>">
|
||||||
|
<?php } else { ?>
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Client</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="client">
|
||||||
|
<option value="">- Select Client -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_clients = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients ORDER BY client_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_clients)) {
|
||||||
|
$client_id_select = intval($row['client_id']);
|
||||||
|
$client_name_select = nullable_htmlentities($row['client_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($expense_client_id == $client_id_select) { echo "selected"; } ?> value="<?php echo $client_id_select; ?>"><?php echo $client_name_select; ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Receipt</label>
|
||||||
|
<input type="file" class="form-control-file" name="file" accept="image/*, application/pdf">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if (!empty($expense_receipt)) { ?>
|
||||||
|
<hr>
|
||||||
|
<a class="text-secondary" href="<?php echo "uploads/expenses/$expense_receipt"; ?>"
|
||||||
|
download="<?php echo "$expense_date-$vendor_name-$category_name-$expense_id.pdf" ?>">
|
||||||
|
<i class="fa fa-fw fa-2x fa-file-pdf text-secondary"></i> <?php echo "$expense_date-$vendor_name-$category_name-$expense_id.pdf" ?>
|
||||||
|
</a>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_expense" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
94
ajax/ajax_expense_refund.php
Normal file
94
ajax/ajax_expense_refund.php
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$expense_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM expenses WHERE expense_id = $expense_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$expense_date = nullable_htmlentities($row['expense_date']);
|
||||||
|
$expense_amount = floatval($row['expense_amount']);
|
||||||
|
$expense_currency_code = nullable_htmlentities($row['expense_currency_code']);
|
||||||
|
$expense_description = nullable_htmlentities($row['expense_description']);
|
||||||
|
$expense_receipt = nullable_htmlentities($row['expense_receipt']);
|
||||||
|
$expense_reference = nullable_htmlentities($row['expense_reference']);
|
||||||
|
$expense_created_at = nullable_htmlentities($row['expense_created_at']);
|
||||||
|
$expense_vendor_id = intval($row['expense_vendor_id']);
|
||||||
|
$expense_category_id = intval($row['expense_category_id']);
|
||||||
|
$expense_account_id = intval($row['expense_account_id']);
|
||||||
|
$expense_client_id = intval($row['expense_client_id']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class='fas fa-fw fa-undo mr-2'></i>Refunding expense</h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
<input type="hidden" name="account" value="<?php echo $expense_account_id; ?>">
|
||||||
|
<input type="hidden" name="vendor" value="<?php echo $expense_vendor_id; ?>">
|
||||||
|
<input type="hidden" name="category" value="<?php echo $expense_category_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Refund 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="date" max="2999-12-31" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Refund Amount</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-dollar-sign"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" inputmode="numeric" pattern="-?[0-9]*\.?[0-9]{0,2}" name="amount" value="-<?php echo number_format($expense_amount, 2, '.', ''); ?>" placeholder="-0.00" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description</label>
|
||||||
|
<textarea class="form-control" rows="6" name="description" placeholder="Enter a description" required>Refund: <?php echo $expense_description; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Reference</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-file-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="reference" placeholder="Enter a reference" maxlength="200" value="<?php echo $expense_reference; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Receipt</label>
|
||||||
|
<input type="file" class="form-control-file" name="file">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="add_expense" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Refund</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
132
ajax/ajax_file_move.php
Normal file
132
ajax/ajax_file_move.php
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$file_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM files WHERE file_id = $file_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$client_id = intval($row['file_client_id']);
|
||||||
|
$file_folder_id = nullable_htmlentities($row['file_folder_id']);
|
||||||
|
$file_name = nullable_htmlentities($row['file_name']);
|
||||||
|
$file_ext = nullable_htmlentities($row['file_ext']);
|
||||||
|
if ($file_ext == 'pdf') {
|
||||||
|
$file_icon = "file-pdf";
|
||||||
|
} elseif ($file_ext == 'gz' || $file_ext == 'tar' || $file_ext == 'zip' || $file_ext == '7z' || $file_ext == 'rar') {
|
||||||
|
$file_icon = "file-archive";
|
||||||
|
} elseif ($file_ext == 'txt' || $file_ext == 'md') {
|
||||||
|
$file_icon = "file-alt";
|
||||||
|
} elseif ($file_ext == 'msg') {
|
||||||
|
$file_icon = "envelope";
|
||||||
|
} elseif ($file_ext == 'doc' || $file_ext == 'docx' || $file_ext == 'odt') {
|
||||||
|
$file_icon = "file-word";
|
||||||
|
} elseif ($file_ext == 'xls' || $file_ext == 'xlsx' || $file_ext == 'ods') {
|
||||||
|
$file_icon = "file-excel";
|
||||||
|
} elseif ($file_ext == 'pptx' || $file_ext == 'odp') {
|
||||||
|
$file_icon = "file-powerpoint";
|
||||||
|
} elseif ($file_ext == 'mp3' || $file_ext == 'wav' || $file_ext == 'ogg') {
|
||||||
|
$file_icon = "file-audio";
|
||||||
|
} elseif ($file_ext == 'mov' || $file_ext == 'mp4' || $file_ext == 'av1') {
|
||||||
|
$file_icon = "file-video";
|
||||||
|
} elseif ($file_ext == 'jpg' || $file_ext == 'jpeg' || $file_ext == 'png' || $file_ext == 'gif' || $file_ext == 'webp' || $file_ext == 'bmp' || $file_ext == 'tif') {
|
||||||
|
$file_icon = "file-image";
|
||||||
|
} else {
|
||||||
|
$file_icon = "file";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-<?php echo $file_icon; ?> mr-2"></i>Moving File: <strong><?php echo $file_name; ?></strong></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="file_id" value="<?php echo $file_id; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Move File to</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="folder_id">
|
||||||
|
<option value="0">/</option>
|
||||||
|
<?php
|
||||||
|
// Fetch all folders for the client
|
||||||
|
$sql_all_folders = mysqli_query($mysqli, "SELECT folder_id, folder_name, parent_folder FROM folders WHERE folder_location = 1 AND folder_client_id = $client_id ORDER BY folder_name ASC");
|
||||||
|
$folders = array();
|
||||||
|
|
||||||
|
// Build an associative array of folders indexed by folder_id
|
||||||
|
while ($row = mysqli_fetch_assoc($sql_all_folders)) {
|
||||||
|
$folders[$row['folder_id']] = array(
|
||||||
|
'folder_id' => intval($row['folder_id']),
|
||||||
|
'folder_name' => nullable_htmlentities($row['folder_name']),
|
||||||
|
'parent_folder' => intval($row['parent_folder']),
|
||||||
|
'children' => array()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build the folder hierarchy
|
||||||
|
foreach ($folders as $id => &$folder) {
|
||||||
|
if ($folder['parent_folder'] != 0 && isset($folders[$folder['parent_folder']])) {
|
||||||
|
$folders[$folder['parent_folder']]['children'][] = &$folder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($folder); // Break the reference
|
||||||
|
|
||||||
|
// Prepare a list of root folders
|
||||||
|
$root_folders = array();
|
||||||
|
foreach ($folders as $id => $folder) {
|
||||||
|
if ($folder['parent_folder'] == 0) {
|
||||||
|
$root_folders[] = $folder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display the folder options iteratively
|
||||||
|
$stack = array();
|
||||||
|
foreach (array_reverse($root_folders) as $folder) {
|
||||||
|
$stack[] = array('folder' => $folder, 'level' => 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!empty($stack)) {
|
||||||
|
$node = array_pop($stack);
|
||||||
|
$folder = $node['folder'];
|
||||||
|
$level = $node['level'];
|
||||||
|
|
||||||
|
// Indentation for subfolders
|
||||||
|
$indentation = str_repeat(' ', $level * 4);
|
||||||
|
|
||||||
|
// Check if this folder is selected
|
||||||
|
$selected = '';
|
||||||
|
if ($folder['folder_id'] == $file_folder_id) {
|
||||||
|
$selected = 'selected';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<option value=\"{$folder['folder_id']}\" $selected>$indentation{$folder['folder_name']}</option>";
|
||||||
|
|
||||||
|
// Add children to the stack
|
||||||
|
if (!empty($folder['children'])) {
|
||||||
|
foreach (array_reverse($folder['children']) as $child_folder) {
|
||||||
|
$stack[] = array('folder' => $child_folder, 'level' => $level + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="move_file" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Move</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
55
ajax/ajax_file_rename.php
Normal file
55
ajax/ajax_file_rename.php
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$file_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM files WHERE file_id = $file_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$client_id = intval($row['file_client_id']);
|
||||||
|
$file_name = nullable_htmlentities($row['file_name']);
|
||||||
|
$file_description = nullable_htmlentities($row['file_description']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-<?php echo $file_icon; ?> mr-2"></i>Renaming file: <strong><?php echo $file_name; ?></strong></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="file_id" value="<?php echo $file_id; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>File Name <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="file_name" placeholder="File Name" maxlength="200" value="<?php echo $file_name; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="file_description" placeholder="Description" maxlength="250" value="<?php echo $file_description; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="rename_file" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Rename</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
44
ajax/ajax_folder_rename.php
Normal file
44
ajax/ajax_folder_rename.php
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$folder_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM folders WHERE folder_id = $folder_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$folder_name = nullable_htmlentities($row['folder_name']);
|
||||||
|
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-folder mr-2"></i>Renaming folder: <strong><?php echo $folder_name; ?></strong></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="folder_id" value="<?php echo $folder_id; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Name <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="folder_name" placeholder="Folder Name" maxlength="200" value="<?php echo $folder_name; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="rename_folder" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Rename</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
48
ajax/ajax_invoice_copy.php
Normal file
48
ajax/ajax_invoice_copy.php
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$invoice_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM invoices LEFT JOIN clients ON invoice_client_id = client_id WHERE invoice_id = $invoice_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$invoice_prefix = nullable_htmlentities($row['invoice_prefix']);
|
||||||
|
$invoice_number = intval($row['invoice_number']);
|
||||||
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fas fa-fw fa-copy mr-2"></i>Copying invoice: <strong><?php echo "$invoice_prefix$invoice_number"; ?></strong> - <?php echo $client_name; ?></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="invoice_id" value="<?php echo $invoice_id; ?>">
|
||||||
|
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Invoice Date <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="date" class="form-control" name="date" max="2999-12-31" value="<?php echo date("Y-m-d"); ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="add_invoice_copy" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Copy</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
119
ajax/ajax_invoice_edit.php
Normal file
119
ajax/ajax_invoice_edit.php
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$invoice_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM invoices LEFT JOIN clients ON invoice_client_id = client_id WHERE invoice_id = $invoice_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$invoice_prefix = nullable_htmlentities($row['invoice_prefix']);
|
||||||
|
$invoice_number = intval($row['invoice_number']);
|
||||||
|
$invoice_scope = nullable_htmlentities($row['invoice_scope']);
|
||||||
|
$invoice_date = nullable_htmlentities($row['invoice_date']);
|
||||||
|
$invoice_due = nullable_htmlentities($row['invoice_due']);
|
||||||
|
$invoice_discount = floatval($row['invoice_discount_amount']);
|
||||||
|
$invoice_created_at = nullable_htmlentities($row['invoice_created_at']);
|
||||||
|
$category_id = intval($row['invoice_category_id']);
|
||||||
|
$client_id = intval($row['client_id']);
|
||||||
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fas fa-fw fa-file-invoice mr-2"></i>Editing invoice: <strong><?php echo "$invoice_prefix$invoice_number"; ?></strong> - <?php echo $client_name; ?></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="invoice_id" value="<?php echo $invoice_id; ?>">
|
||||||
|
|
||||||
|
<div class="modal-body bg-white" <?php if (lookupUserPermission('module_sales') <= 1) { echo 'inert'; } ?>>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Invoice Date <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="date" class="form-control" name="date" max="2999-12-31" value="<?php echo $invoice_date; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Invoice Due <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-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="date" class="form-control" name="due" max="2999-12-31" value="<?php echo $invoice_due; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Income Category <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="category" required>
|
||||||
|
<option value="">- Category -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_income_category = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Income' AND (category_archived_at > '$invoice_created_at' OR category_archived_at IS NULL) ORDER BY category_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_income_category)) {
|
||||||
|
$category_id_select = intval($row['category_id']);
|
||||||
|
$category_name_select = nullable_htmlentities($row['category_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($category_id == $category_id_select) {
|
||||||
|
echo "selected";
|
||||||
|
} ?> value="<?php echo $category_id_select; ?>"><?php echo $category_name_select; ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-secondary" type="button"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-modal-size="sm"
|
||||||
|
data-ajax-url="ajax/ajax_category_add.php?category=Income">
|
||||||
|
<i class="fas fa-fw fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class='form-group'>
|
||||||
|
<label>Discount Amount</label>
|
||||||
|
<div class='input-group'>
|
||||||
|
<div class='input-group-prepend'>
|
||||||
|
<span class='input-group-text'><i class='fa fa-fw fa-dollar-sign'></i></span>
|
||||||
|
</div>
|
||||||
|
<input type='text' class='form-control' inputmode="numeric" pattern="-?[0-9]*\.?[0-9]{0,2}" name='invoice_discount' placeholder='0.00' value="<?php echo number_format($invoice_discount, 2, '.', ''); ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Scope</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-comment"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="scope" placeholder="Quick description" maxlength="255" value="<?php echo $invoice_scope; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_invoice" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
104
ajax/ajax_item_edit.php
Normal file
104
ajax/ajax_item_edit.php
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$item_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM invoice_items WHERE item_id = $item_id LIMIT 1");
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$item_name = nullable_htmlentities($row['item_name']);
|
||||||
|
$item_description = nullable_htmlentities($row['item_description']);
|
||||||
|
$item_quantity = floatval($row['item_quantity']);
|
||||||
|
$item_price = floatval($row['item_price']);
|
||||||
|
$item_created_at = nullable_htmlentities($row['item_created_at']);
|
||||||
|
$tax_id = intval($row['item_tax_id']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fas fa-fw fa-edit mr-2"></i>Editing Line Item: <strong><?php echo $item_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="item_id" value="<?php echo $item_id; ?>">
|
||||||
|
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Item <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-box"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="name" maxlength="200" value="<?php echo $item_name; ?>" placeholder="Enter item name" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="col-sm">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Quantity <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-balance-scale"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,2}" name="qty" value="<?php echo number_format($item_quantity, 2); ?>" placeholder="0.00" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Price <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-dollar-sign"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" inputmode="numeric" pattern="-?[0-9]*\.?[0-9]{0,2}" name="price" value="<?php echo number_format($item_price, 2, '.', ''); ?>" placeholder="0.00" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<textarea class="form-control" rows="5" name="description" placeholder="Enter a description"><?php echo $item_description; ?></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Tax <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-piggy-bank"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="tax_id" required>
|
||||||
|
<option value="0">No Tax</option>
|
||||||
|
<?php
|
||||||
|
$taxes_sql = mysqli_query($mysqli, "SELECT * FROM taxes WHERE (tax_archived_at > '$item_created_at' OR tax_archived_at IS NULL) ORDER BY tax_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($taxes_sql)) {
|
||||||
|
$tax_id_select = intval($row['tax_id']);
|
||||||
|
$tax_name = nullable_htmlentities($row['tax_name']);
|
||||||
|
$tax_percent = floatval($row['tax_percent']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($tax_id_select == $tax_id) { echo "selected"; } ?> value="<?php echo $tax_id_select; ?>"><?php echo "$tax_name $tax_percent%"; ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_item" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
302
ajax/ajax_location_edit.php
Normal file
302
ajax/ajax_location_edit.php
Normal file
@@ -0,0 +1,302 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$location_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_id = $location_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$location_name = nullable_htmlentities($row['location_name']);
|
||||||
|
$location_description = nullable_htmlentities($row['location_description']);
|
||||||
|
$location_country = nullable_htmlentities($row['location_country']);
|
||||||
|
$location_address = nullable_htmlentities($row['location_address']);
|
||||||
|
$location_city = nullable_htmlentities($row['location_city']);
|
||||||
|
$location_state = nullable_htmlentities($row['location_state']);
|
||||||
|
$location_zip = nullable_htmlentities($row['location_zip']);
|
||||||
|
$location_phone_country_code = nullable_htmlentities($row['location_phone_country_code']);
|
||||||
|
$location_phone = nullable_htmlentities(formatPhoneNumber($row['location_phone'], $location_phone_country_code));
|
||||||
|
$location_extension = formatPhoneNumber($row['location_extension']);
|
||||||
|
$location_fax_country_code = nullable_htmlentities($row['location_fax_country_code']);
|
||||||
|
$location_fax = nullable_htmlentities(formatPhoneNumber($row['location_fax'], $location_fax_country_code));
|
||||||
|
$location_hours = nullable_htmlentities($row['location_hours']);
|
||||||
|
$location_photo = nullable_htmlentities($row['location_photo']);
|
||||||
|
$location_notes = nullable_htmlentities($row['location_notes']);
|
||||||
|
$location_created_at = nullable_htmlentities($row['location_created_at']);
|
||||||
|
$location_archived_at = nullable_htmlentities($row['location_archived_at']);
|
||||||
|
$location_contact_id = intval($row['location_contact_id']);
|
||||||
|
$client_id = intval($row['location_client_id']);
|
||||||
|
$location_primary = intval($row['location_primary']);
|
||||||
|
|
||||||
|
// Tags
|
||||||
|
$location_tag_id_array = array();
|
||||||
|
$sql_location_tags = mysqli_query($mysqli, "SELECT * FROM location_tags WHERE location_id = $location_id");
|
||||||
|
while ($row = mysqli_fetch_array($sql_location_tags)) {
|
||||||
|
$location_tag_id = intval($row['tag_id']);
|
||||||
|
$location_tag_id_array[] = $location_tag_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-map-marker-alt mr-2"></i>Editing location: <strong><?php echo $location_name; ?></strong></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||||
|
<input type="hidden" name="location_id" value="<?php echo $location_id; ?>">
|
||||||
|
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||||
|
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<ul class="nav nav-pills nav-justified mb-3">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" data-toggle="pill" href="#pills-details<?php echo $location_id; ?>">Details</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-address<?php echo $location_id; ?>">Address</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-contact<?php echo $location_id; ?>">Contact</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-notes<?php echo $location_id; ?>">Notes</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="tab-content" <?php if (lookupUserPermission('module_client') <= 1) { echo 'inert'; } ?>>
|
||||||
|
|
||||||
|
<div class="tab-pane fade show active" id="pills-details<?php echo $location_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Location Name <strong class="text-danger">*</strong> / <span class="text-secondary">Primary</span></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-map-marker"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="name" placeholder="Name of location" maxlength="200" value="<?php echo $location_name; ?>" required>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<div class="input-group-text">
|
||||||
|
<input type="checkbox" name="location_primary" value="1" <?php if ($location_primary == 1) { echo "checked"; } ?>>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="description" placeholder="Short Description" value="<?php echo $location_description; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3" style="text-align: center;">
|
||||||
|
<?php if (!empty($location_photo)) { ?>
|
||||||
|
<img class="img-fluid" src="<?php echo "uploads/clients/$client_id/$location_photo"; ?>">
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Photo</label>
|
||||||
|
<input type="file" class="form-control-file" name="file" accept="image/*">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-address<?php echo $location_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Address</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="address" placeholder="Street Address" maxlength="200" value="<?php echo $location_address; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>City</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-city"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="city" placeholder="City" maxlength="200" value="<?php echo $location_city; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>State / Province</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-flag"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="state" placeholder="State or Province" maxlength="200" value="<?php echo $location_state; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Postal Code</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fab fa-fw fa-usps"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="zip" placeholder="Zip or Postal Code" maxlength="200" value="<?php echo $location_zip; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Country</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-globe-americas"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="country">
|
||||||
|
<option value="">- Country -</option>
|
||||||
|
<?php foreach($countries_array as $country_name) { ?>
|
||||||
|
<option <?php if ($location_country == $country_name) { echo "selected"; } ?>><?php echo $country_name; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-contact<?php echo $location_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Contact</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="contact">
|
||||||
|
<option value="">- Contact -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_contacts = mysqli_query($mysqli, "SELECT * FROM contacts WHERE (contact_archived_at > '$location_created_at' OR contact_archived_at IS NULL) AND contact_client_id = $client_id ORDER BY contact_archived_at ASC, contact_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_contacts)) {
|
||||||
|
$contact_id_select = intval($row['contact_id']);
|
||||||
|
$contact_name_select = nullable_htmlentities($row['contact_name']);
|
||||||
|
$contact_archived_at = nullable_htmlentities($row['contact_archived_at']);
|
||||||
|
if (empty($contact_archived_at)) {
|
||||||
|
$contact_archived_display = "";
|
||||||
|
} else {
|
||||||
|
$contact_archived_display = "Archived - ";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<option <?php if ($location_contact_id == $contact_id_select) { echo "selected"; } ?> value="<?php echo $contact_id_select; ?>"><?php echo "$contact_archived_display$contact_name_select"; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label>Phone / <span class="text-secondary">Extension</span></label>
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="col-9">
|
||||||
|
<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="tel" class="form-control col-2" name="phone_country_code" value="<?php echo "+$location_phone_country_code"; ?>" placeholder="Code" maxlength="4">
|
||||||
|
<input type="tel" class="form-control" name="phone" value="<?php echo $location_phone; ?>" placeholder="Phone Number" maxlength="200">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="text" class="form-control" name="extension" value="<?php echo $location_extension; ?>" placeholder="ext." maxlength="200">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label>Fax</label>
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="col-9">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-fax"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="tel" class="form-control col-2" name="fax_country_code" value="<?php echo "+$location_fax_country_code"; ?>" placeholder="Code" maxlength="4">
|
||||||
|
<input type="tel" class="form-control" name="fax" value="<?php echo $location_fax; ?>" placeholder="Phone Number" maxlength="200">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Hours</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-clock"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="hours" placeholder="Hours of operation" maxlength="200" value="<?php echo $location_hours; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-notes<?php echo $location_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="form-control" rows="8" name="notes" placeholder="Notes, eg Parking Info, Building Access etc"><?php echo $location_notes; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Tags</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-tags"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="tags[]" data-placeholder="Add some tags" multiple>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 2 ORDER BY tag_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_tags_select)) {
|
||||||
|
$tag_id_select = intval($row['tag_id']);
|
||||||
|
$tag_name_select = nullable_htmlentities($row['tag_name']);
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $tag_id_select; ?>" <?php if (in_array($tag_id_select, $location_tag_id_array)) { echo "selected"; } ?>><?php echo $tag_name_select; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-secondary" type="button"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-modal-size="sm"
|
||||||
|
data-ajax-url="ajax/ajax_tag_add.php"
|
||||||
|
data-ajax-id="2">
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="text-muted text-right">Location ID: <?= $location_id ?></p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_location" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
202
ajax/ajax_network_edit.php
Normal file
202
ajax/ajax_network_edit.php
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$network_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM networks WHERE network_id = $network_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$network_name = nullable_htmlentities($row['network_name']);
|
||||||
|
$network_description = nullable_htmlentities($row['network_description']);
|
||||||
|
$network_vlan = intval($row['network_vlan']);
|
||||||
|
$network = nullable_htmlentities($row['network']);
|
||||||
|
$network_subnet = nullable_htmlentities($row['network_subnet']);
|
||||||
|
$network_gateway = nullable_htmlentities($row['network_gateway']);
|
||||||
|
$network_primary_dns = nullable_htmlentities($row['network_primary_dns']);
|
||||||
|
$network_secondary_dns = nullable_htmlentities($row['network_secondary_dns']);
|
||||||
|
$network_dhcp_range = nullable_htmlentities($row['network_dhcp_range']);
|
||||||
|
$network_notes = nullable_htmlentities($row['network_notes']);
|
||||||
|
$network_location_id = intval($row['network_location_id']);
|
||||||
|
$client_id = intval($row['network_client_id']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-network-wired mr-2"></i>Editing network: <span class="text-bold"><?php echo $network_name; ?></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="network_id" value="<?php echo $network_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="#pillsEditDetails<?php echo $network_id; ?>">Details</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pillsEditNetwork<?php echo $network_id; ?>">Network</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pillsEditDNS<?php echo $network_id; ?>">DNS</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pillsEditNotes<?php echo $network_id; ?>">Notes</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="tab-content" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
|
||||||
|
|
||||||
|
<div class="tab-pane fade show active" id="pillsEditDetails<?php echo $network_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-ethernet"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="name" placeholder="Network name (VLAN, WAN, LAN2 etc)" value="<?php echo $network_name; ?>" maxlength="200" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="description" placeholder="Short Description" value="<?php echo $network_description; ?>">
|
||||||
|
</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="">- Select Location -</option>
|
||||||
|
<?php
|
||||||
|
$locations_sql = mysqli_query($mysqli, "SELECT location_id, location_name FROM locations WHERE location_client_id = $client_id");
|
||||||
|
while ($row = mysqli_fetch_array($locations_sql)) {
|
||||||
|
$location_id = intval($row['location_id']);
|
||||||
|
$location_name = nullable_htmlentities($row['location_name']);
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $location_id; ?>" <?php if ($location_id = $network_location_id) { echo "selected"; } ?>>
|
||||||
|
<?php echo $location_name; ?>
|
||||||
|
</option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pillsEditNetwork<?php echo $network_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>vLAN</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" inputmode="numeric" pattern="[0-9]*" name="vlan" placeholder="ex. 20" value="<?php echo $network_vlan; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>IP / Network <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-network-wired"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="network" placeholder="Network or IP ex 192.168.1.0/24" maxlength="200" value="<?php echo $network; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Subnet Mask</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-mask"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="subnet" placeholder="ex 255.255.255.0" maxlength="200" data-inputmask="'alias': 'ip'" data-mask value="<?php echo $network_subnet; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Gateway <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-route"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="gateway" placeholder="ex 192.168.1.1" maxlength="200" data-inputmask="'alias': 'ip'" data-mask value="<?php echo $network_gateway; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>DHCP Range / IPs</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-list"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="dhcp_range" placeholder="ex 192.168.1.11-199" maxlength="200" value="<?php echo $network_dhcp_range; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pillsEditDNS<?php echo $network_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Primary DNS</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-server"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="primary_dns" placeholder="ex 9.9.9.9" maxlength="200" data-inputmask="'alias': 'ip'" data-mask value="<?php echo $network_primary_dns; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Secondary DNS</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-server"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="secondary_dns" placeholder="ex 1.1.1.1" maxlength="200" data-inputmask="'alias': 'ip'" data-mask value="<?php echo $network_secondary_dns; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pillsEditNotes<?php echo $network_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="form-control" rows="12" name="notes" placeholder="Enter some notes"><?php echo $network_notes; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="text-muted text-right"><?php echo $network_id; ?></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_network" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
88
ajax/ajax_notifications.php
Normal file
88
ajax/ajax_notifications.php
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_header.php";
|
||||||
|
|
||||||
|
$sql = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT * FROM notifications
|
||||||
|
WHERE notification_user_id = $session_user_id
|
||||||
|
AND notification_dismissed_at IS NULL
|
||||||
|
ORDER BY notification_id DESC"
|
||||||
|
);
|
||||||
|
|
||||||
|
$num_notifications = mysqli_num_rows($sql);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class='fas fa-bell mr-2'></i>Notifications<span class='badge badge-secondary badge-pill px-3 ml-3'><?php echo $num_notifications; ?><span></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
<?php if ($num_notifications) { ?>
|
||||||
|
|
||||||
|
<?php while ($row = mysqli_fetch_array($sql)) {
|
||||||
|
|
||||||
|
$notification_id = intval($row["notification_id"]);
|
||||||
|
$notification_type = nullable_htmlentities($row["notification_type"]);
|
||||||
|
$notification_details = nullable_htmlentities($row["notification"]);
|
||||||
|
$notification_action = nullable_htmlentities(
|
||||||
|
$row["notification_action"]
|
||||||
|
);
|
||||||
|
$notification_timestamp_formated = date(
|
||||||
|
"M d g:ia",
|
||||||
|
strtotime($row["notification_timestamp"])
|
||||||
|
);
|
||||||
|
$notification_client_id = intval($row["notification_client_id"]);
|
||||||
|
if (empty($notification_action)) {
|
||||||
|
$notification_action = "#";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<a class="text-dark dropdown-item px-1" href="<?php echo $notification_action; ?>">
|
||||||
|
<div>
|
||||||
|
<span class="text-bold">
|
||||||
|
<i class="fas fa-bullhorn mr-2"></i><?php echo $notification_type; ?>
|
||||||
|
</span>
|
||||||
|
<small class="text-muted float-right">
|
||||||
|
<?php echo $notification_timestamp_formated; ?>
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
<small class="text-secondary text-wrap"><?php echo $notification_details; ?></small>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}} else { ?>
|
||||||
|
<div class="text-center text-secondary py-5">
|
||||||
|
<i class='far fa-6x fa-bell-slash'></i>
|
||||||
|
<h3 class="mt-3">No Notifications</h3>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white justify-content-end">
|
||||||
|
<?php if ($num_notifications) { ?>
|
||||||
|
|
||||||
|
<a href="post.php?dismiss_all_notifications&csrf_token=<?php echo $_SESSION[
|
||||||
|
"csrf_token"
|
||||||
|
]; ?>" class="btn btn-primary">
|
||||||
|
<span class="text-white text-bold"><i class="fas fa-check mr-2"></i>Dismiss all</span>
|
||||||
|
</a>
|
||||||
|
<a href="notifications.php" class="btn btn-secondary">
|
||||||
|
<span class="text-white">See all Notifications</span>
|
||||||
|
</a>
|
||||||
|
<?php } else { ?>
|
||||||
|
<a href="notifications.php?dismissed" class="btn btn-dark">
|
||||||
|
<span class="text-white text-bold">See Dismissed Notifications</span>
|
||||||
|
</a>
|
||||||
|
<?php } ?>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal">
|
||||||
|
<i class="fas fa-times mr-2"></i>Close
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php require_once "../includes/ajax_footer.php";
|
||||||
127
ajax/ajax_product_edit.php
Normal file
127
ajax/ajax_product_edit.php
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$product_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM products WHERE product_id = $product_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$product_name = nullable_htmlentities($row['product_name']);
|
||||||
|
$product_description = nullable_htmlentities($row['product_description']);
|
||||||
|
$product_price = floatval($row['product_price']);
|
||||||
|
$product_created_at = nullable_htmlentities($row['product_created_at']);
|
||||||
|
$category_id = intval($row['product_category_id']);
|
||||||
|
$product_tax_id = intval($row['product_tax_id']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fas fa-fw fa-box-open mr-2"></i>Editing product: <strong><?php echo $product_name; ?></strong></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="product_id" value="<?php echo $product_id; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Name <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fas fa-fw fa-box"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="name" maxlength="200" value="<?php echo $product_name; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Category <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-list"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="category" required>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_select = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Income' AND (category_archived_at > '$product_created_at' OR category_archived_at IS NULL)");
|
||||||
|
while ($row = mysqli_fetch_array($sql_select)) {
|
||||||
|
$category_id_select = intval($row['category_id']);
|
||||||
|
$category_name_select = nullable_htmlentities($row['category_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($category_id == $category_id_select) { echo "selected"; } ?> value="<?php echo $category_id_select; ?>"><?php echo $category_name_select; ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-secondary" type="button"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-modal-size="sm"
|
||||||
|
data-ajax-url="ajax/ajax_category_add.php?category=Income">
|
||||||
|
<i class="fas fa-fw fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="col">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Price <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-dollar-sign"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,2}" class="form-control" name="price" value="<?php echo number_format($product_price, 2, '.', ''); ?>" placeholder="0.00" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Tax</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-balance-scale"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="tax">
|
||||||
|
<option value="0">None</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$taxes_sql = mysqli_query($mysqli, "SELECT * FROM taxes WHERE (tax_archived_at > '$product_created_at' OR tax_archived_at IS NULL) ORDER BY tax_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($taxes_sql)) {
|
||||||
|
$tax_id_select = intval($row['tax_id']);
|
||||||
|
$tax_name = nullable_htmlentities($row['tax_name']);
|
||||||
|
$tax_percent = floatval($row['tax_percent']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($tax_id_select == $product_tax_id) { echo "selected"; } ?> value="<?php echo $tax_id_select; ?>"><?php echo "$tax_name $tax_percent%"; ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description</label>
|
||||||
|
<textarea class="form-control" rows="5" name="description"><?php echo $product_description; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_product" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
101
ajax/ajax_project_edit.php
Normal file
101
ajax/ajax_project_edit.php
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$project_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM projects WHERE project_id = $project_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$project_prefix = nullable_htmlentities($row['project_prefix']);
|
||||||
|
$project_number = intval($row['project_number']);
|
||||||
|
$project_name = nullable_htmlentities($row['project_name']);
|
||||||
|
$project_description = nullable_htmlentities($row['project_description']);
|
||||||
|
$project_due = nullable_htmlentities($row['project_due']);
|
||||||
|
$project_created_at = nullable_htmlentities($row['project_created_at']);
|
||||||
|
$project_created_at_display = date("Y-m-d", strtotime($project_created_at));
|
||||||
|
$project_updated_at = nullable_htmlentities($row['project_updated_at']);
|
||||||
|
$project_completed_at = nullable_htmlentities($row['project_completed_at']);
|
||||||
|
$project_completed_at_display = date("Y-m-d", strtotime($project_completed_at));
|
||||||
|
$project_archived_at = nullable_htmlentities($row['project_archived_at']);
|
||||||
|
$client_id = intval($row['project_client_id']);
|
||||||
|
$project_manager = intval($row['project_manager']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">
|
||||||
|
<i class="fas fa-fw fa-project-diagram mr-2"></i>Editing Project: <strong><?php echo $project_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="project_id" value="<?php echo $project_id; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Project 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-project-diagram"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="name" placeholder="Project Name" maxlength="255" value="<?php echo $project_name; ?>" required autofocus>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="description" placeholder="Description" value="<?php echo $project_description; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Date Due <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="date" class="form-control" name="due_date" value="<?php echo $project_due; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Manager</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-user-tie"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="project_manager">
|
||||||
|
<option value="0">No Manager</option>
|
||||||
|
<?php
|
||||||
|
$sql_project_managers_select = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT user_id, user_name FROM users
|
||||||
|
WHERE user_role_id > 1 AND user_status = 1 AND user_archived_at IS NULL ORDER BY user_name ASC"
|
||||||
|
);
|
||||||
|
while ($row = mysqli_fetch_array($sql_project_managers_select)) {
|
||||||
|
$user_id_select = intval($row['user_id']);
|
||||||
|
$user_name_select = nullable_htmlentities($row['user_name']); ?>
|
||||||
|
<option <?php if ($project_manager == $user_id_select) { echo "selected"; } ?> value="<?php echo $user_id_select; ?>"><?php echo $user_name_select; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_project" class="btn btn-primary text-bold">
|
||||||
|
<i class="fas fa-check mr-2"></i>Save
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal">
|
||||||
|
<i class="fa fa-times mr-2"></i>Cancel
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
81
ajax/ajax_quote_copy.php
Normal file
81
ajax/ajax_quote_copy.php
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$quote_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM quotes LEFT JOIN clients ON quote_client_id = client_id WHERE quote_id = $quote_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$quote_prefix = nullable_htmlentities($row['quote_prefix']);
|
||||||
|
$quote_number = intval($row['quote_number']);
|
||||||
|
$client_id = intval($row['client_id']);
|
||||||
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fas fa-fw fa-copy mr-2"></i>Copying quote: <strong><?php echo "$quote_prefix$quote_number"; ?></strong> - <?php echo $client_name; ?></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="quote_id" value="<?php echo $quote_id; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
<?php if (isset($_GET['client_id'])) { ?>
|
||||||
|
<input type="hidden" name="client" value="<?php echo $client_id; ?>">
|
||||||
|
<?php } else { ?>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Client <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-users"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="client" required>
|
||||||
|
<?php
|
||||||
|
$sql_client_select = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at IS NULL ORDER BY client_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_client_select)) {
|
||||||
|
$client_id_select = intval($row['client_id']);
|
||||||
|
$client_name_select = nullable_htmlentities($row['client_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($client_id == $client_id_select) { echo "selected"; } ?> value="<?php echo $client_id_select; ?>"><?php echo $client_name_select; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Set Date for New Quote <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="date" class="form-control" name="date" max="2999-12-31" value="<?php echo date("Y-m-d"); ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Expire <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="date" class="form-control" name="expire" min="<?php echo date("Y-m-d"); ?>" max="2999-12-31" value="<?php echo date("Y-m-d", strtotime("+30 days")); ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="add_quote_copy" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Copy</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
116
ajax/ajax_quote_edit.php
Normal file
116
ajax/ajax_quote_edit.php
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$quote_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM quotes LEFT JOIN clients ON quote_client_id = client_id WHERE quote_id = $quote_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$quote_id = intval($row['quote_id']);
|
||||||
|
$quote_prefix = nullable_htmlentities($row['quote_prefix']);
|
||||||
|
$quote_number = intval($row['quote_number']);
|
||||||
|
$quote_scope = nullable_htmlentities($row['quote_scope']);
|
||||||
|
$quote_date = nullable_htmlentities($row['quote_date']);
|
||||||
|
$quote_expire = nullable_htmlentities($row['quote_expire']);
|
||||||
|
$quote_discount = floatval($row['quote_discount_amount']);
|
||||||
|
$quote_created_at = nullable_htmlentities($row['quote_created_at']);
|
||||||
|
$quote_category_id = intval($row['quote_category_id']);
|
||||||
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title text-white"><i class="fas fa-fw fa-comment-dollar mr-2"></i>Editing quote: <span class="text-bold"><?php echo "$quote_prefix$quote_number"; ?></span> - <span class="text"><?php echo $client_name; ?></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="quote_id" value="<?php echo $quote_id; ?>">
|
||||||
|
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Quote 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="date" max="2999-12-31" value="<?php echo $quote_date; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Expire <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="date" class="form-control" name="expire" max="2999-12-31" value="<?php echo $quote_expire; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Income Category</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="category" required>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Income' AND (category_archived_at > '$quote_created_at' OR category_archived_at IS NULL) ORDER BY category_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
|
$category_id = intval($row['category_id']);
|
||||||
|
$category_name = nullable_htmlentities($row['category_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($quote_category_id == $category_id) { echo "selected"; } ?> value="<?php echo $category_id; ?>"><?php echo $category_name; ?></option>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-secondary" type="button"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-modal-size="sm"
|
||||||
|
data-ajax-url="ajax/ajax_category_add.php?category=Income">
|
||||||
|
<i class="fas fa-fw fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class='form-group'>
|
||||||
|
<label>Discount Amount</label>
|
||||||
|
<div class='input-group'>
|
||||||
|
<div class='input-group-prepend'>
|
||||||
|
<span class='input-group-text'><i class='fa fa-fw fa-dollar-sign'></i></span>
|
||||||
|
</div>
|
||||||
|
<input type='text' class='form-control' inputmode="numeric" pattern="-?[0-9]*\.?[0-9]{0,2}" name='quote_discount' placeholder='0.00' value="<?php echo number_format($quote_discount, 2, '.', ''); ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Scope</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-comment"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="scope" placeholder="Quick description" value="<?php echo $quote_scope; ?>" maxlength="255">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_quote" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
90
ajax/ajax_rack_device_add.php
Normal file
90
ajax/ajax_rack_device_add.php
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$rack_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM racks WHERE rack_id = $rack_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$rack_name = nullable_htmlentities($row['rack_name']);
|
||||||
|
$client_id = intval($row['rack_client_id']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-server mr-2"></i>Adding Device to Rack <strong><?php echo $rack_name; ?></strong></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||||
|
|
||||||
|
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||||
|
<input type="hidden" name="rack_id" value="<?php echo $rack_id; ?>">
|
||||||
|
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Custom Device</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-server"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="name" placeholder="Device Name" maxlength="200">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Or Select a Device</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-desktop"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="asset">
|
||||||
|
<option value="">- Select Asset -</option>
|
||||||
|
<?php
|
||||||
|
// Fetch IDs of all assets already assigned to any rack
|
||||||
|
$assigned_assets = [];
|
||||||
|
$assigned_sql = mysqli_query($mysqli, "SELECT unit_asset_id FROM rack_units");
|
||||||
|
while ($assigned_row = mysqli_fetch_assoc($assigned_sql)) {
|
||||||
|
$assigned_assets[] = intval($assigned_row['unit_asset_id']);
|
||||||
|
}
|
||||||
|
$assigned_assets_list = implode(',', $assigned_assets);
|
||||||
|
$assigned_assets_list = empty($assigned_assets_list) ? '0' : $assigned_assets_list;
|
||||||
|
|
||||||
|
// Fetch assets not assigned to any rack
|
||||||
|
$sql_assets = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_archived_at IS NULL AND asset_client_id = $client_id AND asset_id NOT IN ($assigned_assets_list) ORDER BY asset_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||||
|
$asset_id = intval($row['asset_id']);
|
||||||
|
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $asset_id; ?>"><?php echo $asset_name; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Unit Number Start - End <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-sort-numeric-up-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="number" class="form-control" name="unit_start" placeholder="Unit Start" min="1" max="<?php echo $rack_units; ?>" required>
|
||||||
|
<input type="number" class="form-control" name="unit_end" placeholder="Unit End" min="1" max="<?php echo $rack_units; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="add_rack_unit" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Add to Rack</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
180
ajax/ajax_rack_edit.php
Normal file
180
ajax/ajax_rack_edit.php
Normal file
@@ -0,0 +1,180 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$rack_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM racks WHERE rack_id = $rack_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$rack_name = nullable_htmlentities($row['rack_name']);
|
||||||
|
$rack_description = nullable_htmlentities($row['rack_description']);
|
||||||
|
$rack_model = nullable_htmlentities($row['rack_model']);
|
||||||
|
$rack_depth = nullable_htmlentities($row['rack_depth']);
|
||||||
|
$rack_type = nullable_htmlentities($row['rack_type']);
|
||||||
|
$rack_units = intval($row['rack_units']);
|
||||||
|
$rack_photo = nullable_htmlentities($row['rack_photo']);
|
||||||
|
$rack_physical_location = nullable_htmlentities($row['rack_physical_location']);
|
||||||
|
$rack_notes = nullable_htmlentities($row['rack_notes']);
|
||||||
|
$rack_location_id = nullable_htmlentities($row['rack_location_id']);
|
||||||
|
$rack_created_at = nullable_htmlentities($row['rack_created_at']);
|
||||||
|
$client_id = intval($row['rack_client_id']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-server mr-2"></i>Editing rack: <strong><?php echo $rack_name; ?></strong></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||||
|
|
||||||
|
<input type="hidden" name="rack_id" value="<?php echo $rack_id; ?>">
|
||||||
|
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||||
|
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<ul class="nav nav-pills nav-justified mb-3">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" data-toggle="pill" href="#pills-rack-details<?php echo $rack_id; ?>">Details</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-rack-notes<?php echo $rack_id; ?>">Notes</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="tab-content" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
|
||||||
|
|
||||||
|
<div class="tab-pane fade show active" id="pills-rack-details<?php echo $rack_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Name <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-server"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="name" placeholder="Rack name" maxlength="200" value="<?php echo $rack_name; ?>" required autofocus>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="description" placeholder="Description of the rack" value="<?php echo $rack_description; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Type <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-server"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="type" required>
|
||||||
|
<option value="">- Type -</option>
|
||||||
|
<?php foreach($rack_type_select_array as $rack_type_select) { ?>
|
||||||
|
<option <?php if ($rack_type == $rack_type_select) { echo "selected"; } ?>><?php echo $rack_type_select; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Model</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="make" placeholder="ex StarTech 12U Open Frame" maxlength="200" value="<?php echo $rack_model; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Depth</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-ruler"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="depth" placeholder="Rack Depth eg 800 mm or 31.5 Inches" maxlength="50" value="<?php echo $rack_depth; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Number of Units <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-sort-numeric-up-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="number" class="form-control" name="units" placeholder="Number of Units" min="1" max="70" value="<?php echo $rack_units; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Physical Location</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="physical_location" placeholder="Physical location eg. Floor 2, Closet B" maxlength="200" value="<?php echo $rack_physical_location; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Location</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="location">
|
||||||
|
<option value="">- Location -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_location_select = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_archived_at IS NULL AND location_client_id = $client_id ORDER BY location_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_location_select)) {
|
||||||
|
$location_id_select = intval($row['location_id']);
|
||||||
|
$location_name_select = nullable_htmlentities($row['location_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($rack_location_id == $location_id_select) { echo "selected"; } ?> value="<?php echo $location_id_select; ?>"><?php echo $location_name_select; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-rack-notes<?php echo $rack_id; ?>">
|
||||||
|
|
||||||
|
<?php if ($rack_photo) { ?>
|
||||||
|
<img class="img-fluid p-3" alt="rack_photo" src="<?php echo "uploads/clients/$client_id/$rack_photo"; ?>">
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Upload Photo</label>
|
||||||
|
<input type="file" class="form-control-file" name="file" accept="image/*">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="notes"><?php echo $rack_notes; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_rack" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
268
ajax/ajax_recurring_expense_edit.php
Normal file
268
ajax/ajax_recurring_expense_edit.php
Normal file
@@ -0,0 +1,268 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$recurring_expense_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM recurring_expenses WHERE recurring_expense_id = $recurring_expense_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$recurring_expense_frequency = intval($row['recurring_expense_frequency']);
|
||||||
|
$recurring_expense_day = intval($row['recurring_expense_day']);
|
||||||
|
$recurring_expense_month = intval($row['recurring_expense_month']);
|
||||||
|
$recurring_expense_last_sent = nullable_htmlentities($row['recurring_expense_last_sent']);
|
||||||
|
$recurring_expense_next_date = nullable_htmlentities($row['recurring_expense_next_date']);
|
||||||
|
$recurring_expense_next_month = date('n', strtotime($row['recurring_expense_next_date']));
|
||||||
|
$recurring_expense_status = intval($row['recurring_expense_status']);
|
||||||
|
$recurring_expense_description = nullable_htmlentities($row['recurring_expense_description']);
|
||||||
|
$recurring_expense_amount = floatval($row['recurring_expense_amount']);
|
||||||
|
$recurring_expense_payment_method = nullable_htmlentities($row['recurring_expense_payment_method']);
|
||||||
|
$recurring_expense_reference = nullable_htmlentities($row['recurring_expense_reference']);
|
||||||
|
$recurring_expense_currency_code = nullable_htmlentities($row['recurring_expense_currency_code']);
|
||||||
|
$recurring_expense_created_at = nullable_htmlentities($row['recurring_expense_created_at']);
|
||||||
|
$recurring_expense_vendor_id = intval($row['recurring_expense_vendor_id']);
|
||||||
|
$recurring_expense_category_id = intval($row['recurring_expense_category_id']);
|
||||||
|
$recurring_expense_account_id = intval($row['recurring_expense_account_id']);
|
||||||
|
$recurring_expense_client_id = intval($row['recurring_expense_client_id']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title text-white"><i class="fa fa-fw fa-clock mr-2"></i>Editing recurring expense</h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
<input type="hidden" name="recurring_expense_id" value="<?php echo $recurring_expense_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Frequency <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-sync-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="frequency" required>
|
||||||
|
<option value="1" <?php if($recurring_expense_frequency == 1) { echo "selected"; } ?>>Monthly</option>
|
||||||
|
<option value="2" <?php if($recurring_expense_frequency == 2) { echo "selected"; } ?>>Annually</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Month <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="month" required>
|
||||||
|
<option value="">- Select a Month -</option>
|
||||||
|
<option value="1" <?php if($recurring_expense_next_month == 1) { echo "selected"; } ?>>01 - January</option>
|
||||||
|
<option value="2" <?php if($recurring_expense_next_month == 2) { echo "selected"; } ?>>02 - February</option>
|
||||||
|
<option value="3" <?php if($recurring_expense_next_month == 3) { echo "selected"; } ?>>03 - March</option>
|
||||||
|
<option value="4" <?php if($recurring_expense_next_month == 4) { echo "selected"; } ?>>04 - April</option>
|
||||||
|
<option value="5" <?php if($recurring_expense_next_month == 5) { echo "selected"; } ?>>05 - May</option>
|
||||||
|
<option value="6" <?php if($recurring_expense_next_month == 6) { echo "selected"; } ?>>06 - June</option>
|
||||||
|
<option value="7" <?php if($recurring_expense_next_month == 7) { echo "selected"; } ?>>07 - July</option>
|
||||||
|
<option value="8" <?php if($recurring_expense_next_month == 8) { echo "selected"; } ?>>08 - August</option>
|
||||||
|
<option value="9" <?php if($recurring_expense_next_month == 9) { echo "selected"; } ?>>09 - September</option>
|
||||||
|
<option value="10" <?php if($recurring_expense_next_month == 10) { echo "selected"; } ?>>10 - October</option>
|
||||||
|
<option value="11" <?php if($recurring_expense_next_month == 11) { echo "selected"; } ?>>11 - November</option>
|
||||||
|
<option value="12" <?php if($recurring_expense_next_month == 12) { echo "selected"; } ?>>12 - December</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Day <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" inputmode="numeric" pattern="(1[0-9]|2[0-8]|[1-9])" name="day" placeholder="Enter a day (1-28)" value="<?php echo $recurring_expense_day; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Amount <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-dollar-sign"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" inputmode="numeric" pattern="-?[0-9]*\.?[0-9]{0,2}" name="amount" value="<?php echo number_format($recurring_expense_amount, 2, '.', ''); ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Account <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-piggy-bank"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="account" required>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_accounts = mysqli_query($mysqli, "SELECT account_id, account_name, opening_balance, account_archived_at FROM accounts WHERE (account_archived_at > '$recurring_expense_created_at' OR account_archived_at IS NULL) ORDER BY account_archived_at ASC, account_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_accounts)) {
|
||||||
|
$account_id_select = intval($row['account_id']);
|
||||||
|
$account_name_select = nullable_htmlentities($row['account_name']);
|
||||||
|
$opening_balance = floatval($row['opening_balance']);
|
||||||
|
$account_archived_at = nullable_htmlentities($row['account_archived_at']);
|
||||||
|
if (empty($account_archived_at)) {
|
||||||
|
$account_archived_display = "";
|
||||||
|
} else {
|
||||||
|
$account_archived_display = "Archived - ";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id_select");
|
||||||
|
$row = mysqli_fetch_array($sql_payments);
|
||||||
|
$total_payments = floatval($row['total_payments']);
|
||||||
|
|
||||||
|
$sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id_select");
|
||||||
|
$row = mysqli_fetch_array($sql_revenues);
|
||||||
|
$total_revenues = floatval($row['total_revenues']);
|
||||||
|
|
||||||
|
$sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id_select");
|
||||||
|
$row = mysqli_fetch_array($sql_expenses);
|
||||||
|
$total_expenses = floatval($row['total_expenses']);
|
||||||
|
|
||||||
|
$balance = $opening_balance + $total_payments + $total_revenues - $total_expenses;
|
||||||
|
|
||||||
|
?>
|
||||||
|
<option <?php if ($recurring_expense_account_id == $account_id_select) { ?> selected <?php } ?> value="<?php echo $account_id_select; ?>"><?php echo "$account_archived_display$account_name_select"; ?> [$<?php echo number_format($balance, 2); ?>]</option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Vendor <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-building"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="vendor" required>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_select = mysqli_query($mysqli, "SELECT vendor_id, vendor_name FROM vendors WHERE vendor_client_id = 0 AND vendor_template = 0 AND (vendor_archived_at > '$recurring_expense_created_at' OR vendor_archived_at IS NULL) ORDER BY vendor_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_select)) {
|
||||||
|
$vendor_id_select = intval($row['vendor_id']);
|
||||||
|
$vendor_name_select = nullable_htmlentities($row['vendor_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($recurring_expense_vendor_id == $vendor_id_select) { ?> selected <?php } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<a class="btn btn-secondary" href="vendors.php" target="_blank"><i class="fas fa-fw fa-plus"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description <strong class="text-danger">*</strong></label>
|
||||||
|
<textarea class="form-control" rows="6" name="description" placeholder="Enter a description" required><?php echo $recurring_expense_description; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Reference</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-file-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="reference" placeholder="Enter a reference" maxlength="200" value="<?php echo $recurring_expense_reference; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Category <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-list"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="category" required>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_select = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Expense' AND (category_archived_at > '$recurring_expense_created_at' OR category_archived_at IS NULL) ORDER BY category_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_select)) {
|
||||||
|
$category_id_select = intval($row['category_id']);
|
||||||
|
$category_name_select = nullable_htmlentities($row['category_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($recurring_expense_category_id == $category_id_select) { ?> selected <?php } ?> value="<?php echo $category_id_select; ?>"><?php echo $category_name_select; ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-secondary" type="button"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-modal-size="sm"
|
||||||
|
data-ajax-url="ajax/ajax_category_add.php?category=Expense">
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if (isset($_GET['client_id'])) { ?>
|
||||||
|
<input type="hidden" name="client" value="<?php echo $client_id; ?>">
|
||||||
|
<?php } else { ?>
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Client</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="client">
|
||||||
|
<option value="">- Select Client -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_clients = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients ORDER BY client_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_clients)) {
|
||||||
|
$client_id_select = intval($row['client_id']);
|
||||||
|
$client_name_select = nullable_htmlentities($row['client_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($recurring_expense_client_id == $client_id_select) { echo "selected"; } ?> value="<?php echo $client_id_select; ?>"><?php echo $client_name_select; ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_recurring_expense" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
137
ajax/ajax_recurring_invoice_edit.php
Normal file
137
ajax/ajax_recurring_invoice_edit.php
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$recurring_invoice_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM recurring_invoices WHERE recurring_invoice_id = $recurring_invoice_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$recurring_invoice_prefix = nullable_htmlentities($row['recurring_invoice_prefix']);
|
||||||
|
$recurring_invoice_number = intval($row['recurring_invoice_number']);
|
||||||
|
$recurring_invoice_scope = nullable_htmlentities($row['recurring_invoice_scope']);
|
||||||
|
$recurring_invoice_frequency = nullable_htmlentities($row['recurring_invoice_frequency']);
|
||||||
|
$recurring_invoice_status = nullable_htmlentities($row['recurring_invoice_status']);
|
||||||
|
$recurring_invoice_created_at = date('Y-m-d', strtotime($row['recurring_invoice_created_at']));
|
||||||
|
$recurring_invoice_next_date = nullable_htmlentities($row['recurring_invoice_next_date']);
|
||||||
|
$recurring_invoice_discount = floatval($row['recurring_invoice_discount_amount']);
|
||||||
|
$category_id = intval($row['recurring_invoice_category_id']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fas fa-fw fa-redo-alt mr-2"></i>Editing Recur Invoice: <strong><?php echo "$recurring_invoice_prefix$recurring_invoice_number"; ?></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="recurring_invoice_id" value="<?php echo $recurring_invoice_id; ?>">
|
||||||
|
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Scope</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-comment"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="scope" placeholder="Quick description" maxlength="255" value="<?php echo $recurring_invoice_scope; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Frequency <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-clock"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="frequency" required>
|
||||||
|
<option value="">- Frequency -</option>
|
||||||
|
<option <?php if ($recurring_invoice_frequency == 'month') { echo "selected"; } ?> value="month">Monthly</option>
|
||||||
|
<option <?php if ($recurring_invoice_frequency == 'year') { echo "selected"; } ?> value="year">Yearly</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Next Date <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="date" class="form-control" name="next_date" max="2999-12-31" value="<?php echo $recurring_invoice_next_date; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Income Category <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="category" required>
|
||||||
|
<option value="">- Category -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_income_category = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Income' AND (category_archived_at > '$recurring_invoice_created_at' OR category_archived_at IS NULL) ORDER BY category_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_income_category)) {
|
||||||
|
$category_id_select = intval($row['category_id']);
|
||||||
|
$category_name_select = nullable_htmlentities($row['category_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($category_id == $category_id_select) { ?> selected <?php } ?> value="<?php echo $category_id_select; ?>"><?php echo $category_name_select; ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-secondary" type="button"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-modal-size="sm"
|
||||||
|
data-ajax-url="ajax/ajax_category_add.php?category=Income">
|
||||||
|
<i class="fas fa-fw fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class='form-group'>
|
||||||
|
<label>Discount Amount</label>
|
||||||
|
<div class='input-group'>
|
||||||
|
<div class='input-group-prepend'>
|
||||||
|
<span class='input-group-text'><i class='fa fa-fw fa-dollar-sign'></i></span>
|
||||||
|
</div>
|
||||||
|
<input type='text' class='form-control' inputmode="numeric" pattern="-?[0-9]*\.?[0-9]{0,2}" name='recurring_invoice_discount' placeholder='0.00' value="<?php echo number_format($recurring_invoice_discount, 2, '.', ''); ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Status <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-clock"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="status" required>
|
||||||
|
<option <?php if ($recurring_invoice_status == 1) {
|
||||||
|
echo "selected";
|
||||||
|
} ?> value="1">Active</option>
|
||||||
|
<option <?php if ($recurring_invoice_status == 0) {
|
||||||
|
echo "selected";
|
||||||
|
} ?> value="0">InActive</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_recurring_invoice" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
266
ajax/ajax_recurring_ticket_edit.php
Normal file
266
ajax/ajax_recurring_ticket_edit.php
Normal file
@@ -0,0 +1,266 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$recurring_ticket_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM recurring_tickets WHERE recurring_ticket_id = $recurring_ticket_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$client_id = intval($row['recurring_ticket_client_id']);
|
||||||
|
$recurring_ticket_subject = nullable_htmlentities($row['recurring_ticket_subject']);
|
||||||
|
$recurring_ticket_details = nullable_htmlentities($row['recurring_ticket_details']);
|
||||||
|
$recurring_ticket_priority = nullable_htmlentities($row['recurring_ticket_priority']);
|
||||||
|
$recurring_ticket_frequency = nullable_htmlentities($row['recurring_ticket_frequency']);
|
||||||
|
$recurring_ticket_next_run = nullable_htmlentities($row['recurring_ticket_next_run']);
|
||||||
|
$recurring_ticket_assigned_to = intval($row['recurring_ticket_assigned_to']);
|
||||||
|
$recurring_ticket_contact_id = intval($row['recurring_ticket_contact_id']);
|
||||||
|
$recurring_ticket_asset_id = intval($row['recurring_ticket_asset_id']);
|
||||||
|
$recurring_ticket_billable = intval($row['recurring_ticket_billable']);
|
||||||
|
|
||||||
|
// Additional Assets Selected
|
||||||
|
$additional_assets_array = array();
|
||||||
|
$sql_additional_assets = mysqli_query($mysqli, "SELECT asset_id FROM recurring_ticket_assets WHERE recurring_ticket_id = $recurring_ticket_id");
|
||||||
|
while ($row = mysqli_fetch_array($sql_additional_assets)) {
|
||||||
|
$additional_asset_id = intval($row['asset_id']);
|
||||||
|
$additional_assets_array[] = $additional_asset_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fas fa-fw fa-calendar-check mr-2"></i>Editing Recurring Ticket: <strong><?php echo $recurring_ticket_subject; ?></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="recurring_ticket_id" value="<?php echo $recurring_ticket_id; ?>">
|
||||||
|
<input type="hidden" name="client" 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-edit-details<?php echo $recurring_ticket_id; ?>"><i class="fa fa-fw fa-life-ring mr-2"></i>Details</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-edit-contacts<?php echo $recurring_ticket_id; ?>"><i class="fa fa-fw fa-users mr-2"></i>Contact</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-edit-schedule<?php echo $recurring_ticket_id; ?>"><i class="fa fa-fw fa-building mr-2"></i>Schedule</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-edit-assets<?php echo $recurring_ticket_id; ?>"><i class="fa fa-fw fa-desktop mr-2"></i>Assets</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="tab-content" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
|
||||||
|
|
||||||
|
<div class="tab-pane fade show active" id="pills-edit-details<?php echo $recurring_ticket_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Subject <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="subject" placeholder="Subject" maxlength="500" value="<?php echo $recurring_ticket_subject; ?>" required >
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="form-control tinymce" name="details"><?php echo $recurring_ticket_details; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Priority <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-thermometer-half"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="priority" required>
|
||||||
|
<option <?php if ($recurring_ticket_priority == "Low") { echo "selected"; } ?> >Low</option>
|
||||||
|
<option <?php if ($recurring_ticket_priority == "Medium") { echo "selected"; } ?> >Medium</option>
|
||||||
|
<option <?php if ($recurring_ticket_priority == "High") { echo "selected"; } ?> >High</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Assign To</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-user-check"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="assigned_to">
|
||||||
|
<option value="0">- Select Agent -</option>
|
||||||
|
<?php
|
||||||
|
$sql_users_select = mysqli_query($mysqli, "SELECT user_id, user_name FROM users
|
||||||
|
WHERE user_type = 1
|
||||||
|
AND user_archived_at IS NULL
|
||||||
|
ORDER BY user_name DESC"
|
||||||
|
);
|
||||||
|
while ($row = mysqli_fetch_array($sql_users_select)) {
|
||||||
|
$user_id_select = intval($row['user_id']);
|
||||||
|
$user_name_select = nullable_htmlentities($row['user_name']);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $user_id_select; ?>" <?php if ($recurring_ticket_assigned_to == $user_id_select) { echo "selected"; } ?>><?php echo $user_name_select; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group <?php if (!$config_module_enable_accounting) { echo 'd-none'; } ?>">
|
||||||
|
<div class="custom-control custom-switch">
|
||||||
|
<input type="checkbox" class="custom-control-input" id="editTicketBillable" name="billable"
|
||||||
|
<?php if ($recurring_ticket_billable == 1) { echo "checked"; } ?> value="1"
|
||||||
|
>
|
||||||
|
<label class="custom-control-label" for="editTicketBillable">Mark Billable</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-edit-contacts<?php echo $recurring_ticket_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Contact</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="contact">
|
||||||
|
<option value="0">- Select Contact -</option>
|
||||||
|
<?php
|
||||||
|
$sql_client_contacts_select = mysqli_query($mysqli, "SELECT contact_id, contact_name, contact_title, contact_primary, contact_technical FROM contacts WHERE contact_client_id = $client_id AND contact_archived_at IS NULL ORDER BY contact_primary DESC, contact_technical DESC, contact_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_client_contacts_select)) {
|
||||||
|
$contact_id_select = intval($row['contact_id']);
|
||||||
|
$contact_name_select = nullable_htmlentities($row['contact_name']);
|
||||||
|
$contact_primary_select = intval($row['contact_primary']);
|
||||||
|
if($contact_primary_select == 1) {
|
||||||
|
$contact_primary_display_select = " (Primary)";
|
||||||
|
} else {
|
||||||
|
$contact_primary_display_select = "";
|
||||||
|
}
|
||||||
|
$contact_technical_select = intval($row['contact_technical']);
|
||||||
|
if($contact_technical_select == 1) {
|
||||||
|
$contact_technical_display_select = " (Technical)";
|
||||||
|
} else {
|
||||||
|
$contact_technical_display_select = "";
|
||||||
|
}
|
||||||
|
$contact_title_select = nullable_htmlentities($row['contact_title']);
|
||||||
|
if(!empty($contact_title_select)) {
|
||||||
|
$contact_title_display_select = " - $contact_title_select";
|
||||||
|
} else {
|
||||||
|
$contact_title_display_select = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $contact_id_select; ?>" <?php if ($contact_id_select == $recurring_ticket_contact_id) { echo "selected"; } ?>><?php echo "$contact_name_select$contact_title_display_select$contact_primary_display_select$contact_technical_display_select"; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-edit-schedule<?php echo $recurring_ticket_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Frequency <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-recycle"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="frequency">
|
||||||
|
<option <?php if ($recurring_ticket_frequency == "Weekly") { echo "selected"; } ?>>Weekly</option>
|
||||||
|
<option <?php if ($recurring_ticket_frequency == "Monthly") { echo "selected"; } ?>>Monthly</option>
|
||||||
|
<option <?php if ($recurring_ticket_frequency == "Quarterly") { echo "selected"; } ?>>Quarterly</option>
|
||||||
|
<option <?php if ($recurring_ticket_frequency == "Biannually") { echo "selected"; } ?>>Biannually</option>
|
||||||
|
<option <?php if ($recurring_ticket_frequency == "Annually") { echo "selected"; } ?>>Annually</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Next run date <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar-day"></i></span>
|
||||||
|
</div>
|
||||||
|
<input class="form-control" type="date" name="next_date" max="2999-12-31" value="<?php echo $recurring_ticket_next_run; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-edit-assets<?php echo $recurring_ticket_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Asset</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-desktop"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="asset">
|
||||||
|
<option value="0">- Select Asset -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_assets = mysqli_query($mysqli, "SELECT asset_id, asset_name, contact_name FROM assets LEFT JOIN contacts ON contact_id = asset_contact_id WHERE asset_client_id = $client_id AND asset_archived_at IS NULL ORDER BY asset_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||||
|
$asset_id_select = intval($row['asset_id']);
|
||||||
|
$asset_name_select = nullable_htmlentities($row['asset_name']);
|
||||||
|
$asset_contact_name_select = nullable_htmlentities($row['contact_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($recurring_ticket_asset_id == $asset_id_select) { echo "selected"; } ?> value="<?php echo $asset_id_select; ?>"><?php echo "$asset_name_select - $asset_contact_name_select"; ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Additional Assets</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-desktop"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="additional_assets[]" data-tags="true" data-placeholder="- Select Additional Assets -" multiple>
|
||||||
|
<option value=""></option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_assets = mysqli_query($mysqli, "SELECT asset_id, asset_name, contact_name FROM assets LEFT JOIN contacts ON contact_id = asset_contact_id WHERE asset_client_id = $client_id AND asset_id != $recurring_ticket_asset_id AND asset_archived_at IS NULL ORDER BY asset_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||||
|
$asset_id_select = intval($row['asset_id']);
|
||||||
|
$asset_name_select = nullable_htmlentities($row['asset_name']);
|
||||||
|
$asset_contact_name_select = nullable_htmlentities($row['contact_name']);
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $asset_id_select; ?>"
|
||||||
|
<?php if (in_array($asset_id_select, $additional_assets_array)) { echo "selected"; } ?>
|
||||||
|
><?php echo "$asset_name_select - $asset_contact_name_select"; ?></option>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_recurring_ticket" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
191
ajax/ajax_revenue_edit.php
Normal file
191
ajax/ajax_revenue_edit.php
Normal file
@@ -0,0 +1,191 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$revenue_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM revenues WHERE revenue_id = $revenue_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$revenue_description = nullable_htmlentities($row['revenue_description']);
|
||||||
|
$revenue_reference = nullable_htmlentities($row['revenue_reference']);
|
||||||
|
$revenue_date = nullable_htmlentities($row['revenue_date']);
|
||||||
|
$revenue_payment_method = nullable_htmlentities($row['revenue_payment_method']);
|
||||||
|
$revenue_amount = floatval($row['revenue_amount']);
|
||||||
|
$revenue_currency_code = nullable_htmlentities($row['revenue_currency_code']);
|
||||||
|
$revenue_created_at = nullable_htmlentities($row['revenue_created_at']);
|
||||||
|
$account_id = intval($row['revenue_account_id']);
|
||||||
|
$category_id = intval($row['revenue_category_id']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fas fa-fw fa-hand-holding-usd mr-2"></i>Edit Revenue</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="revenue_id" value="<?php echo $revenue_id; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Date <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="date" class="form-control" name="date" max="2999-12-31" value="<?php echo $revenue_date; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Amount <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-dollar-sign"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,2}" name="amount" value="<?php echo number_format($revenue_amount, 2, '.', ''); ?>" placeholder="0.00" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Account <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-piggy-bank"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="account" required>
|
||||||
|
<option value="">- Select Account -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_accounts = mysqli_query($mysqli, "SELECT * FROM accounts WHERE (account_archived_at > '$revenue_created_at' OR account_archived_at IS NULL) ORDER BY account_archived_at ASC, account_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_accounts)) {
|
||||||
|
$account_id_select = intval($row['account_id']);
|
||||||
|
$account_name_select = nullable_htmlentities($row['account_name']);
|
||||||
|
$account_currency_code_select = nullable_htmlentities($row['account_currency_code']);
|
||||||
|
$opening_balance = floatval($row['opening_balance']);
|
||||||
|
$account_archived_at = nullable_htmlentities($row['account_archived_at']);
|
||||||
|
if (empty($account_archived_at)) {
|
||||||
|
$account_archived_display = "";
|
||||||
|
} else {
|
||||||
|
$account_archived_display = "Archived - ";
|
||||||
|
}
|
||||||
|
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id_select");
|
||||||
|
$row = mysqli_fetch_array($sql_payments);
|
||||||
|
$total_payments = floatval($row['total_payments']);
|
||||||
|
|
||||||
|
$sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id_select");
|
||||||
|
$row = mysqli_fetch_array($sql_revenues);
|
||||||
|
$total_revenues = floatval($row['total_revenues']);
|
||||||
|
|
||||||
|
$sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id_select");
|
||||||
|
$row = mysqli_fetch_array($sql_expenses);
|
||||||
|
$total_expenses = floatval($row['total_expenses']);
|
||||||
|
|
||||||
|
$balance = $opening_balance + $total_payments + $total_revenues - $total_expenses;
|
||||||
|
|
||||||
|
?>
|
||||||
|
<option <?php if ($account_id == $account_id_select) { echo "selected"; } ?> value="<?php echo $account_id_select; ?>"><?php echo $account_archived_display; ?> <?php echo $account_name_select; ?> [ <?php echo numfmt_format_currency($currency_format, $balance, $account_currency_code_select); ?> ]</option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Category <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-money-check-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="category" required>
|
||||||
|
<option value="">- Select Category -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_category = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Income' AND (category_archived_at > '$revenue_created_at' OR category_archived_at IS NULL) ORDER BY category_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_category)) {
|
||||||
|
$category_id_select = intval($row['category_id']);
|
||||||
|
$category_name = nullable_htmlentities($row['category_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($category_id_select == $category_id) { echo "selected"; } ?> value="<?php echo $category_id_select; ?>"><?php echo $category_name; ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-secondary" type="button"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-modal-size="sm"
|
||||||
|
data-ajax-url="ajax/ajax_category_add.php?category=Income">
|
||||||
|
<i class="fas fa-fw fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description</label>
|
||||||
|
<textarea class="form-control" rows="8" name="description"><?php echo $revenue_description; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Payment Method <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-check-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="payment_method" required>
|
||||||
|
<option value="">- Select Method of Payment -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_categories = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Payment Method' AND (category_archived_at > '$revenue_created_at' OR category_archived_at IS NULL) ORDER BY category_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_categories)) {
|
||||||
|
$category_name_select = nullable_htmlentities($row['category_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($revenue_payment_method == $category_name_select) { echo "selected"; } ?>><?php echo "$category_name_select"; ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md">
|
||||||
|
<label>Reference</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-file-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="reference" placeholder="Check #, trans #, etc" maxlength="200" value="<?php echo $revenue_reference; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_revenue" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
153
ajax/ajax_role_edit.php
Normal file
153
ajax/ajax_role_edit.php
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$role_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM user_roles WHERE role_id = $role_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$role_name = nullable_htmlentities($row['role_name']);
|
||||||
|
$role_description = nullable_htmlentities($row['role_description']);
|
||||||
|
$role_admin = intval($row['role_is_admin']);
|
||||||
|
|
||||||
|
// Count number of users that have each role
|
||||||
|
$sql_role_user_count = mysqli_query($mysqli, "SELECT COUNT(user_id) FROM users WHERE user_role_id = $role_id AND user_archived_at IS NULL");
|
||||||
|
$role_user_count = mysqli_fetch_row($sql_role_user_count)[0];
|
||||||
|
|
||||||
|
$sql_users = mysqli_query($mysqli, "SELECT * FROM users WHERE user_role_id = $role_id AND user_archived_at IS NULL");
|
||||||
|
// Initialize an empty array to hold user names
|
||||||
|
$user_names = [];
|
||||||
|
|
||||||
|
// Fetch each row and store the user_name in the array
|
||||||
|
while($row = mysqli_fetch_assoc($sql_users)) {
|
||||||
|
$user_names[] = nullable_htmlentities($row['user_name']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert the array of user names to a comma-separated string
|
||||||
|
$user_names_string = implode(",", $user_names) ;
|
||||||
|
|
||||||
|
if (empty($user_names_string)) {
|
||||||
|
$user_names_string = "-";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fas fa-fw fa-user-shield mr-2"></i>Editing role:
|
||||||
|
<strong><?php echo $role_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="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||||
|
<input type="hidden" name="role_id" value="<?php echo $role_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-role-details<?php echo $role_id; ?>">Details</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-role-access<?php echo $role_id; ?>">Access</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="tab-content">
|
||||||
|
|
||||||
|
<div class="tab-pane fade show active" id="pills-role-details<?php echo $role_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-shield"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="role_name" placeholder="Role Name" maxlength="200" value="<?php echo $role_name; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-chevron-right"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="role_description" placeholder="Role Description" maxlength="200" value="<?php echo $role_description; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Admin Access <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-tools"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="role_is_admin" required>
|
||||||
|
<option value="1" <?php if ($role_admin) { echo 'selected'; } ?> >Yes - this role should have full admin access</option>
|
||||||
|
<option value="0" <?php if (!$role_admin) { echo 'selected'; } ?>>No - use permissions on the next tab</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-role-access<?php echo $role_id; ?>">
|
||||||
|
|
||||||
|
<?php if ($role_admin) { ?>
|
||||||
|
<div class="alert alert-warning"><strong>Module permissions do not apply to Admins.</strong></div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Enumerate modules
|
||||||
|
$sql_modules = mysqli_query($mysqli, "SELECT * FROM modules");
|
||||||
|
while ($row_modules = mysqli_fetch_array($sql_modules)) {
|
||||||
|
$module_id = intval($row_modules['module_id']);
|
||||||
|
$module_name = nullable_htmlentities($row_modules['module_name']);
|
||||||
|
$module_name_display = ucfirst(str_replace("module_","",$module_name));
|
||||||
|
$module_description = nullable_htmlentities($row_modules['module_description']);
|
||||||
|
|
||||||
|
// Get permission level for module
|
||||||
|
$module_permission_row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT user_role_permission_level FROM user_role_permissions WHERE module_id = $module_id AND user_role_id = $role_id LIMIT 1"));
|
||||||
|
$module_permission = 0;
|
||||||
|
if ($module_permission_row) {
|
||||||
|
$module_permission = $module_permission_row['user_role_permission_level'];
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label> <?php echo $module_name_display ?> <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<select class="form-control select2" name="<?php echo "$module_id##$module_name" ?>" required>
|
||||||
|
<option value="0" <?php if ($module_permission == 0) { echo 'selected'; } ?> >None</option>
|
||||||
|
<option value="1" <?php if ($module_permission == 1) { echo 'selected'; } ?> >Read</option>
|
||||||
|
<option value="2" <?php if ($module_permission == 2) { echo 'selected'; } ?>>Modify (Read, Edit, Archive)</option>
|
||||||
|
<option value="3" <?php if ($module_permission == 3) { echo 'selected'; } ?>>Full (Read, Edit, Archive, Delete)</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<small class="form-text text-muted"><?php echo $module_description ?></small>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php } // End while ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_role" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
418
ajax/ajax_service_details.php
Normal file
418
ajax/ajax_service_details.php
Normal file
@@ -0,0 +1,418 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$service_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM services WHERE service_id = $service_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$service_name = nullable_htmlentities($row['service_name']);
|
||||||
|
$service_description = nullable_htmlentities($row['service_description']);
|
||||||
|
$service_category = nullable_htmlentities($row['service_category']);
|
||||||
|
$service_importance = nullable_htmlentities($row['service_importance']);
|
||||||
|
$service_backup = nullable_htmlentities($row['service_backup']);
|
||||||
|
$service_notes = nullable_htmlentities($row['service_notes']);
|
||||||
|
$service_created_at = nullable_htmlentities($row['service_created_at']);
|
||||||
|
$service_updated_at = nullable_htmlentities($row['service_updated_at']);
|
||||||
|
$service_review_due = nullable_htmlentities($row['service_review_due']);
|
||||||
|
$client_id = intval($row['service_client_id']);
|
||||||
|
// Service Importance
|
||||||
|
if ($service_importance == "High") {
|
||||||
|
$service_importance_display = "<span class='p-2 badge badge-danger'>$service_importance</span>";
|
||||||
|
} elseif ($service_importance == "Medium") {
|
||||||
|
$service_importance_display = "<span class='p-2 badge badge-warning'>$service_importance</span>";
|
||||||
|
} elseif ($service_importance == "Low") {
|
||||||
|
$service_importance_display = "<span class='p-2 badge badge-info'>$service_importance</span>";
|
||||||
|
} else {
|
||||||
|
$service_importance_display = "-";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Associated Assets (and their credentials/networks/locations)
|
||||||
|
$sql_assets = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT * FROM service_assets
|
||||||
|
LEFT JOIN assets ON service_assets.asset_id = assets.asset_id
|
||||||
|
LEFT JOIN asset_interfaces ON interface_asset_id = assets.asset_id AND interface_primary = 1
|
||||||
|
LEFT JOIN credentials ON service_assets.asset_id = credentials.credential_asset_id
|
||||||
|
LEFT JOIN networks ON interface_network_id = networks.network_id
|
||||||
|
LEFT JOIN locations ON assets.asset_location_id = locations.location_id
|
||||||
|
WHERE service_id = $service_id"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Associated credentials
|
||||||
|
$sql_credentials = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT * FROM service_credentials
|
||||||
|
LEFT JOIN credentials ON service_credentials.credential_id = credentials.credential_id
|
||||||
|
WHERE service_id = $service_id"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Associated Domains
|
||||||
|
$sql_domains = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT * FROM service_domains
|
||||||
|
LEFT JOIN domains ON service_domains.domain_id = domains.domain_id
|
||||||
|
WHERE service_id = $service_id"
|
||||||
|
);
|
||||||
|
// Associated Certificates
|
||||||
|
$sql_certificates = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT * FROM service_certificates
|
||||||
|
LEFT JOIN certificates ON service_certificates.certificate_id = certificates.certificate_id
|
||||||
|
WHERE service_id = $service_id"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Associated URLs ---- REMOVED for now
|
||||||
|
//$sql_urls = mysqli_query($mysqli, "SELECT * FROM service_urls
|
||||||
|
//WHERE service_id = '$service_id'");
|
||||||
|
|
||||||
|
// Associated Vendors
|
||||||
|
$sql_vendors = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT * FROM service_vendors
|
||||||
|
LEFT JOIN vendors ON service_vendors.vendor_id = vendors.vendor_id
|
||||||
|
WHERE service_id = $service_id"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Associated Contacts
|
||||||
|
$sql_contacts = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT * FROM service_contacts
|
||||||
|
LEFT JOIN contacts ON service_contacts.contact_id = contacts.contact_id
|
||||||
|
WHERE service_id = $service_id"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Associated Documents
|
||||||
|
$sql_docs = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT * FROM service_documents
|
||||||
|
LEFT JOIN documents ON service_documents.document_id = documents.document_id
|
||||||
|
WHERE service_id = $service_id"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title text-white"><i class="fa fa-fw fa-stream mr-2"></i><?php echo $service_name; ?></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<!-- Main/Left side -->
|
||||||
|
<div class="col-8 border-right">
|
||||||
|
<div class="col-12">
|
||||||
|
<h4>Service Overview: <?php echo "$service_name $service_importance_display"; ?></h4>
|
||||||
|
<b>Description:</b> <?php echo $service_description; ?> <br>
|
||||||
|
<b>Backup Info:</b> <?php echo $service_backup; ?> <br><br>
|
||||||
|
|
||||||
|
<h5><i class="fas fa-fw fa-sticky-note mr-2"></i>Notes</h5>
|
||||||
|
<div style="white-space: pre-line"><?php echo $service_notes; ?></div>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<!-- Assets -->
|
||||||
|
<?php
|
||||||
|
if (mysqli_num_rows($sql_assets) > 0) { ?>
|
||||||
|
<h5><i class="fas fa-fw fa-desktop mr-2"></i>Assets</h5>
|
||||||
|
<ul>
|
||||||
|
<?php
|
||||||
|
// Reset the $sql_assets pointer to the start - as we've already cycled through once
|
||||||
|
mysqli_data_seek($sql_assets, 0);
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||||
|
$asset_id = intval($row['asset_id']);
|
||||||
|
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||||
|
if (!empty($row['interface_ip'])) {
|
||||||
|
$ip = '('.nullable_htmlentities($row["interface_ip"]).')';
|
||||||
|
} else {
|
||||||
|
$ip = '';
|
||||||
|
}
|
||||||
|
echo "<li><a href='#' data-toggle='ajax-modal'
|
||||||
|
data-modal-size='lg'
|
||||||
|
data-ajax-url='ajax/ajax_asset_details.php'
|
||||||
|
data-ajax-id='$asset_id'>$asset_name</a>$ip</li>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</ul>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- Networks -->
|
||||||
|
<?php
|
||||||
|
if ($sql_assets) {
|
||||||
|
|
||||||
|
$networks = [];
|
||||||
|
|
||||||
|
// Reset the $sql_assets pointer to the start
|
||||||
|
mysqli_data_seek($sql_assets, 0);
|
||||||
|
|
||||||
|
// Get networks linked to assets - push name to array
|
||||||
|
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||||
|
if (!empty($row['network_name'])) {
|
||||||
|
$network_data = nullable_htmlentities("$row[network_name]:$row[network_vlan]");
|
||||||
|
array_push($networks, $network_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove duplicates
|
||||||
|
$networks = array_unique($networks);
|
||||||
|
|
||||||
|
// Display
|
||||||
|
if (!empty($networks)) { ?>
|
||||||
|
<h5><i class="fas fa-fw fa-network-wired mr-2"></i>Networks</h5>
|
||||||
|
<ul>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
foreach($networks as $network) {
|
||||||
|
$network = explode(":", $network);
|
||||||
|
echo "<li><a href=\"networks.php?client_id=$client_id&q=$network[0]\">$network[0] </a>(VLAN $network[1])</li>";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
</ul>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- Locations -->
|
||||||
|
<?php
|
||||||
|
if ($sql_assets) {
|
||||||
|
|
||||||
|
$location_names = [];
|
||||||
|
|
||||||
|
// Reset the $sql_assets pointer to the start - as we've already cycled through once
|
||||||
|
mysqli_data_seek($sql_assets, 0);
|
||||||
|
|
||||||
|
// Get locations linked to assets - push their name and vlan to arrays
|
||||||
|
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||||
|
if (!empty($row['location_name'])) {
|
||||||
|
array_push($location_names, $row['location_name']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove duplicates
|
||||||
|
$location_names = array_unique($location_names);
|
||||||
|
|
||||||
|
// Display
|
||||||
|
if (!empty($location_names)) { ?>
|
||||||
|
<h5><i class="fas fa-fw fa-map-marker-alt mr-2"></i>Locations</h5>
|
||||||
|
<ul>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
foreach($location_names as $location) {
|
||||||
|
echo "<li><a href=\"locations.php?client_id=$client_id&q=$location\">$location</a></li>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</ul>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- Domains -->
|
||||||
|
<?php
|
||||||
|
if (mysqli_num_rows($sql_domains) > 0) { ?>
|
||||||
|
<h5><i class="fas fa-fw fa-globe mr-2"></i>Domains</h5>
|
||||||
|
<ul>
|
||||||
|
<?php
|
||||||
|
// Reset the $sql_domains pointer to the start
|
||||||
|
mysqli_data_seek($sql_domains, 0);
|
||||||
|
|
||||||
|
// Showing linked domains
|
||||||
|
while ($row = mysqli_fetch_array($sql_domains)) {
|
||||||
|
if (!empty($row['domain_name'])) {
|
||||||
|
echo "<li><a href=\"domains.php?client_id=$client_id&q=$row[domain_name]\">$row[domain_name]</a></li>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</ul>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- Certificates -->
|
||||||
|
<?php
|
||||||
|
if (mysqli_num_rows($sql_certificates) > 0) { ?>
|
||||||
|
<h5><i class="fas fa-fw fa-lock mr-2"></i>Certificates</h5>
|
||||||
|
<ul>
|
||||||
|
<?php
|
||||||
|
// Reset the $sql_certificates pointer to the start
|
||||||
|
mysqli_data_seek($sql_certificates, 0);
|
||||||
|
|
||||||
|
// Showing linked certs
|
||||||
|
while ($row = mysqli_fetch_array($sql_certificates)) {
|
||||||
|
if (!empty($row['certificate_name'])) {
|
||||||
|
echo "<li><a href=\"certificates.php?client_id=$client_id&q=$row[certificate_name]\">$row[certificate_name] ($row[certificate_domain])</a></li>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</ul>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Right side -->
|
||||||
|
<div class="col-4">
|
||||||
|
<div class="col-12">
|
||||||
|
<h4>Additional Related Items</h4>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<!-- Vendors -->
|
||||||
|
<?php
|
||||||
|
// Reset the $sql_vendors pointer to the start
|
||||||
|
mysqli_data_seek($sql_vendors, 0);
|
||||||
|
|
||||||
|
if (mysqli_num_rows($sql_vendors) > 0) { ?>
|
||||||
|
<h5><i class="fas fa-fw fa-building mr-2"></i>Vendors</h5>
|
||||||
|
<ul>
|
||||||
|
<?php
|
||||||
|
while ($row = mysqli_fetch_array($sql_vendors)) {
|
||||||
|
|
||||||
|
$vendor_id = intval($row['vendor_id']);
|
||||||
|
$vendor_name = nullable_htmlentities($row['vendor_name']);
|
||||||
|
echo "<li><a href='#' data-toggle='ajax-modal'
|
||||||
|
data-modal-size='lg'
|
||||||
|
data-ajax-url='ajax/ajax_vendor_details.php'
|
||||||
|
data-ajax-id='$vendor_id'>
|
||||||
|
$vendor_name
|
||||||
|
</a>
|
||||||
|
</li>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</ul>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- Contacts -->
|
||||||
|
<?php
|
||||||
|
if (mysqli_num_rows($sql_contacts) > 0) { ?>
|
||||||
|
<h5><i class="fas fa-fw fa-users mr-2"></i>Contacts</h5>
|
||||||
|
<ul>
|
||||||
|
<?php
|
||||||
|
// Reset the $sql_contacts pointer to the start
|
||||||
|
mysqli_data_seek($sql_contacts, 0);
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_array($sql_contacts)) {
|
||||||
|
$contact_id = intval($row['contact_id']);
|
||||||
|
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||||
|
echo "<li><a href='#' data-toggle='ajax-modal'
|
||||||
|
data-modal-size='lg'
|
||||||
|
data-ajax-url='ajax/ajax_contact_details.php'
|
||||||
|
data-ajax-id='$contact_id'>
|
||||||
|
$contact_name
|
||||||
|
</a>
|
||||||
|
</li>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</ul>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- Credentials -->
|
||||||
|
<?php
|
||||||
|
if (mysqli_num_rows($sql_assets) > 0 || mysqli_num_rows($sql_credentials) > 0) { ?>
|
||||||
|
<h5><i class="fas fa-fw fa-key mr-2"></i>Credentials</h5>
|
||||||
|
<ul>
|
||||||
|
<?php
|
||||||
|
// Reset the $sql_assets/credentials pointer to the start
|
||||||
|
mysqli_data_seek($sql_assets, 0);
|
||||||
|
mysqli_data_seek($sql_credentials, 0);
|
||||||
|
|
||||||
|
// Showing credentials linked to assets
|
||||||
|
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||||
|
if (!empty($row['credential_name'])) {
|
||||||
|
echo "<li><a href=\"credentials.php?client_id=$client_id&q=$row[credential_name]\">$row[credential_name]</a></li>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Showing explicitly linked credentials
|
||||||
|
while ($row = mysqli_fetch_array($sql_credentials)) {
|
||||||
|
if (!empty($row['credential_name'])) {
|
||||||
|
echo "<li><a href=\"credentials.php?client_id=$client_id&q=$row[credential_name]\">$row[credential_name]</a></li>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</ul>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- URLs -->
|
||||||
|
<?php
|
||||||
|
if ($sql_credentials || $sql_assets) { ?>
|
||||||
|
<h5><i class="fas fa-fw fa-link mr-2"></i>URLs</h5>
|
||||||
|
<ul>
|
||||||
|
<?php
|
||||||
|
// Reset the $sql_credentials pointer to the start
|
||||||
|
mysqli_data_seek($sql_credentials, 0);
|
||||||
|
|
||||||
|
// Showing URLs linked to credentials
|
||||||
|
while ($row = mysqli_fetch_array($sql_credentials)) {
|
||||||
|
if (!empty($row['credential_uri'])) {
|
||||||
|
echo "<li><a href=\"https://$row[credential_uri]\">$row[credential_uri]</a></li>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset the $sql_assets pointer to the start
|
||||||
|
mysqli_data_seek($sql_assets, 0);
|
||||||
|
|
||||||
|
// Show URLs linked to assets, that also have credentials
|
||||||
|
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||||
|
if (!empty($row['credential_uri'])) {
|
||||||
|
echo "<li><a href=\"https://$row[credential_uri]\">$row[credential_uri]</a></li>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</ul>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- Documents -->
|
||||||
|
<?php
|
||||||
|
if (mysqli_num_rows($sql_docs) > 0) { ?>
|
||||||
|
<h5><i class="fas fa-fw fa-file-alt mr-2"></i>Documents</h5>
|
||||||
|
<ul>
|
||||||
|
<?php
|
||||||
|
// Reset the $sql_docs pointer to the start
|
||||||
|
mysqli_data_seek($sql_docs, 0);
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_array($sql_docs)) {
|
||||||
|
$document_id = intval($row['document_id']);
|
||||||
|
$document_name = nullable_htmlentities($row['document_name']);
|
||||||
|
echo "<li><a href='#' data-toggle='ajax-modal'
|
||||||
|
data-modal-size='lg'
|
||||||
|
data-ajax-url='ajax/ajax_document_view.php'
|
||||||
|
data-ajax-id='$document_id'>
|
||||||
|
$document_name
|
||||||
|
</a>
|
||||||
|
</li>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</ul>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- <h5><i class="nav-icon fas fa-file-alt"></i> Services</h5>-->
|
||||||
|
<!-- <ul>-->
|
||||||
|
<!-- <li>Related Service - Coming soon!</li>-->
|
||||||
|
<!-- </ul>-->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
358
ajax/ajax_service_edit.php
Normal file
358
ajax/ajax_service_edit.php
Normal file
@@ -0,0 +1,358 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$service_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM services WHERE service_id = $service_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$service_name = nullable_htmlentities($row['service_name']);
|
||||||
|
$service_description = nullable_htmlentities($row['service_description']);
|
||||||
|
$service_category = nullable_htmlentities($row['service_category']);
|
||||||
|
$service_importance = nullable_htmlentities($row['service_importance']);
|
||||||
|
$service_backup = nullable_htmlentities($row['service_backup']);
|
||||||
|
$service_notes = nullable_htmlentities($row['service_notes']);
|
||||||
|
$service_created_at = nullable_htmlentities($row['service_created_at']);
|
||||||
|
$service_updated_at = nullable_htmlentities($row['service_updated_at']);
|
||||||
|
$service_review_due = nullable_htmlentities($row['service_review_due']);
|
||||||
|
$client_id = intval($row['service_client_id']);
|
||||||
|
|
||||||
|
// Associated Assets (and their credentials/networks/locations)
|
||||||
|
$sql_assets = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT * FROM service_assets
|
||||||
|
LEFT JOIN assets ON service_assets.asset_id = assets.asset_id
|
||||||
|
LEFT JOIN asset_interfaces ON interface_asset_id = assets.asset_id AND interface_primary = 1
|
||||||
|
LEFT JOIN credentials ON service_assets.asset_id = credentials.credential_asset_id
|
||||||
|
LEFT JOIN networks ON interface_network_id = networks.network_id
|
||||||
|
LEFT JOIN locations ON assets.asset_location_id = locations.location_id
|
||||||
|
WHERE service_id = $service_id"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Associated credentials
|
||||||
|
$sql_credentials = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT * FROM service_credentials
|
||||||
|
LEFT JOIN credentials ON service_credentials.credential_id = credentials.credential_id
|
||||||
|
WHERE service_id = $service_id"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Associated Domains
|
||||||
|
$sql_domains = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT * FROM service_domains
|
||||||
|
LEFT JOIN domains ON service_domains.domain_id = domains.domain_id
|
||||||
|
WHERE service_id = $service_id"
|
||||||
|
);
|
||||||
|
// Associated Certificates
|
||||||
|
$sql_certificates = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT * FROM service_certificates
|
||||||
|
LEFT JOIN certificates ON service_certificates.certificate_id = certificates.certificate_id
|
||||||
|
WHERE service_id = $service_id"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Associated URLs ---- REMOVED for now
|
||||||
|
//$sql_urls = mysqli_query($mysqli, "SELECT * FROM service_urls
|
||||||
|
//WHERE service_id = '$service_id'");
|
||||||
|
|
||||||
|
// Associated Vendors
|
||||||
|
$sql_vendors = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT * FROM service_vendors
|
||||||
|
LEFT JOIN vendors ON service_vendors.vendor_id = vendors.vendor_id
|
||||||
|
WHERE service_id = $service_id"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Associated Contacts
|
||||||
|
$sql_contacts = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT * FROM service_contacts
|
||||||
|
LEFT JOIN contacts ON service_contacts.contact_id = contacts.contact_id
|
||||||
|
WHERE service_id = $service_id"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Associated Documents
|
||||||
|
$sql_docs = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT * FROM service_documents
|
||||||
|
LEFT JOIN documents ON service_documents.document_id = documents.document_id
|
||||||
|
WHERE service_id = $service_id"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title text-white"><i class="fa fa-fw fa-stream mr-2"></i>Editing service: <strong><?php echo $service_name; ?></strong></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="client_id" value="<?php echo $client_id ?>">
|
||||||
|
<input type="hidden" name="service_id" value="<?php echo $service_id ?>">
|
||||||
|
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<ul class="nav nav-pills nav-justified mb-3">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" data-toggle="pill" href="#pills-overview<?php echo $service_id ?>">Overview</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-general<?php echo $service_id ?>">General</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-assets<?php echo $service_id ?>">Assets</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="tab-content" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
|
||||||
|
|
||||||
|
<div class="tab-pane fade show active" id="pills-overview<?php echo $service_id ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Name <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-stream"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="name" placeholder="Name of Service" maxlength="200" value="<?php echo $service_name ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-info-circle"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="description" placeholder="Description of Service" maxlength="200" value="<?php echo $service_description ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- //TODO: Integrate with company wide categories: /categories.php -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Category</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-info"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="category" placeholder="Category" maxlength="20" value="<?php echo $service_category ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Importance</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-thermometer-half"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="importance" required>
|
||||||
|
<option <?php if ($service_importance == 'Low') { echo "selected"; } ?> >Low</option>
|
||||||
|
<option <?php if ($service_importance == 'Medium') { echo "selected"; } ?> >Medium</option>
|
||||||
|
<option <?php if ($service_importance == 'High') { echo "selected"; } ?> >High</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Backup</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-hdd"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="backup" placeholder="Backup strategy" maxlength="200" value="<?php echo $service_backup ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Notes</label>
|
||||||
|
<textarea class="form-control" rows="3" placeholder="Enter some notes" name="note"><?php echo $service_notes ?></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-general<?php echo $service_id ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="contacts">Contacts</label>
|
||||||
|
<select multiple class="form-control select2" name="contacts[]">
|
||||||
|
<?php
|
||||||
|
// Get just the currently selected contact IDs
|
||||||
|
$selected_ids = array_column(mysqli_fetch_all($sql_contacts, MYSQLI_ASSOC), "contact_id");
|
||||||
|
|
||||||
|
// Get all contacts
|
||||||
|
// NOTE: These are called $sql_all and $row_all for a reason - anything overwriting $sql or $row will break the current while loop we are in from client_services.php
|
||||||
|
|
||||||
|
$sql_all = mysqli_query($mysqli, "SELECT * FROM contacts WHERE (contact_archived_at > '$service_created_at' OR contact_archived_at IS NULL) AND contact_client_id = $client_id");
|
||||||
|
|
||||||
|
while ($row_all = mysqli_fetch_array($sql_all)) {
|
||||||
|
$contact_id = intval($row_all['contact_id']);
|
||||||
|
$contact_name = nullable_htmlentities($row_all['contact_name']);
|
||||||
|
|
||||||
|
if (in_array($contact_id, $selected_ids)) {
|
||||||
|
echo "<option value=\"$contact_id\" selected>$contact_name</option>";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
echo "<option value=\"$contact_id\">$contact_name</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="vendors">Vendors</label>
|
||||||
|
<select multiple class="form-control select2" name="vendors[]">
|
||||||
|
<?php
|
||||||
|
$selected_ids = array_column(mysqli_fetch_all($sql_vendors, MYSQLI_ASSOC), "vendor_id");
|
||||||
|
|
||||||
|
$sql_all = mysqli_query($mysqli, "SELECT * FROM vendors WHERE (vendor_archived_at > '$service_created_at' OR vendor_archived_at IS NULL) AND vendor_template = 0 AND vendor_client_id = $client_id");
|
||||||
|
while ($row_all = mysqli_fetch_array($sql_all)) {
|
||||||
|
$vendor_id = intval($row_all['vendor_id']);
|
||||||
|
$vendor_name = nullable_htmlentities($row_all['vendor_name']);
|
||||||
|
|
||||||
|
if (in_array($vendor_id, $selected_ids)) {
|
||||||
|
echo "<option value=\"$vendor_id\" selected>$vendor_name</option>";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
echo "<option value=\"$vendor_id\">$vendor_name</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="documents">Documents</label>
|
||||||
|
<select multiple class="form-control select2" name="documents[]">
|
||||||
|
<?php
|
||||||
|
$selected_ids = array_column(mysqli_fetch_all($sql_docs, MYSQLI_ASSOC), "document_id");
|
||||||
|
|
||||||
|
$sql_all = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_archived_at IS NULL AND document_client_id = $client_id");
|
||||||
|
while ($row_all = mysqli_fetch_array($sql_all)) {
|
||||||
|
$document_id = intval($row_all['document_id']);
|
||||||
|
$document_name = nullable_htmlentities($row_all['document_name']);
|
||||||
|
|
||||||
|
if (in_array($document_id, $selected_ids)) {
|
||||||
|
echo "<option value=\"$document_id\" selected>$document_name</option>";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
echo "<option value=\"$document_id\">$document_name</option>";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- TODO: Services related to other services -->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-assets<?php echo $service_id ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="assets">Assets</label>
|
||||||
|
<select multiple class="form-control select2" name="assets[]">
|
||||||
|
<?php
|
||||||
|
$selected_ids = array_column(mysqli_fetch_all($sql_assets, MYSQLI_ASSOC), "asset_id");
|
||||||
|
|
||||||
|
$sql_all = mysqli_query($mysqli, "SELECT * FROM assets WHERE (asset_archived_at > '$service_created_at' OR asset_archived_at IS NULL) AND asset_client_id = $client_id");
|
||||||
|
while ($row_all = mysqli_fetch_array($sql_all)) {
|
||||||
|
$asset_id = intval($row_all['asset_id']);
|
||||||
|
$asset_name = nullable_htmlentities($row_all['asset_name']);
|
||||||
|
|
||||||
|
if (in_array($asset_id, $selected_ids)) {
|
||||||
|
echo "<option value=\"$asset_id\" selected>$asset_name</option>";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
echo "<option value=\"$asset_id\">$asset_name</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="credentials">Credentials</label>
|
||||||
|
<select multiple class="form-control select2" name="credentials[]">
|
||||||
|
<?php
|
||||||
|
$selected_ids = array_column(mysqli_fetch_all($sql_credentials, MYSQLI_ASSOC), "credential_id");
|
||||||
|
|
||||||
|
$sql_all = mysqli_query($mysqli, "SELECT * FROM credentials WHERE (credential_archived_at > '$service_created_at' OR credential_archived_at IS NULL) AND credential_client_id = $client_id");
|
||||||
|
while ($row_all = mysqli_fetch_array($sql_all)) {
|
||||||
|
$credential_id = intval($row_all['credential_id']);
|
||||||
|
$credential_name = nullable_htmlentities($row_all['credential_name']);
|
||||||
|
|
||||||
|
if (in_array($credential_id, $selected_ids)) {
|
||||||
|
echo "<option value=\"$credential_id\" selected>$credential_name</option>";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
echo "<option value=\"$credential_id\">$credential_name</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="domains">Domains</label>
|
||||||
|
<select multiple class="form-control select2" name="domains[]">
|
||||||
|
<?php
|
||||||
|
$selected_ids = array_column(mysqli_fetch_all($sql_domains, MYSQLI_ASSOC), "domain_id");
|
||||||
|
|
||||||
|
$sql_all = mysqli_query($mysqli, "SELECT * FROM domains WHERE (domain_archived_at > '$service_created_at' OR domain_archived_at IS NULL) AND domain_client_id = $client_id");
|
||||||
|
while ($row_all = mysqli_fetch_array($sql_all)) {
|
||||||
|
$domain_id = intval($row_all['domain_id']);
|
||||||
|
$domain_name = nullable_htmlentities($row_all['domain_name']);
|
||||||
|
|
||||||
|
if (in_array($domain_id, $selected_ids)) {
|
||||||
|
echo "<option value=\"$domain_id\" selected>$domain_name</option>";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
echo "<option value=\"$domain_id\">$domain_name</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="certificates">Certificates</label>
|
||||||
|
<select multiple class="form-control select2" name="certificates[]">
|
||||||
|
<?php
|
||||||
|
$selected_ids = array_column(mysqli_fetch_all($sql_certificates, MYSQLI_ASSOC), "certificate_id");
|
||||||
|
|
||||||
|
$sql_all = mysqli_query($mysqli, "SELECT * FROM certificates WHERE (certificate_archived_at > '$service_created_at' OR certificate_archived_at IS NULL) AND certificate_client_id = $client_id");
|
||||||
|
while ($row_all = mysqli_fetch_array($sql_all)) {
|
||||||
|
$cert_id = intval($row_all['certificate_id']);
|
||||||
|
$cert_name = nullable_htmlentities($row_all['certificate_name']);
|
||||||
|
|
||||||
|
if (in_array($cert_id, $selected_ids)) {
|
||||||
|
echo "<option value=\"$cert_id\" selected>$cert_name</option>";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
echo "<option value=\"$cert_id\">$cert_name</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_service" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
317
ajax/ajax_software_edit.php
Normal file
317
ajax/ajax_software_edit.php
Normal file
@@ -0,0 +1,317 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$software_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM software WHERE software_id = $software_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$software_name = nullable_htmlentities($row['software_name']);
|
||||||
|
$software_description = nullable_htmlentities($row['software_description']);
|
||||||
|
$software_version = nullable_htmlentities($row['software_version']);
|
||||||
|
$software_type = nullable_htmlentities($row['software_type']);
|
||||||
|
$software_license_type = nullable_htmlentities($row['software_license_type']);
|
||||||
|
$software_key = nullable_htmlentities($row['software_key']);
|
||||||
|
$software_seats = nullable_htmlentities($row['software_seats']);
|
||||||
|
$software_purchase_reference = nullable_htmlentities($row['software_purchase_reference']);
|
||||||
|
$software_purchase = nullable_htmlentities($row['software_purchase']);
|
||||||
|
$software_expire = nullable_htmlentities($row['software_expire']);
|
||||||
|
$software_notes = nullable_htmlentities($row['software_notes']);
|
||||||
|
$software_created_at = nullable_htmlentities($row['software_created_at']);
|
||||||
|
$software_vendor_id = intval($row['software_vendor_id']);
|
||||||
|
$client_id = intval($row['software_client_id']);
|
||||||
|
$seat_count = 0;
|
||||||
|
|
||||||
|
// Device Licenses
|
||||||
|
$asset_licenses_sql = mysqli_query($mysqli, "SELECT asset_id FROM software_assets WHERE software_id = $software_id");
|
||||||
|
$asset_licenses_array = array();
|
||||||
|
while ($row = mysqli_fetch_array($asset_licenses_sql)) {
|
||||||
|
$asset_licenses_array[] = intval($row['asset_id']);
|
||||||
|
$seat_count = $seat_count + 1;
|
||||||
|
}
|
||||||
|
$asset_licenses = implode(',', $asset_licenses_array);
|
||||||
|
|
||||||
|
// User Licenses
|
||||||
|
$contact_licenses_sql = mysqli_query($mysqli, "SELECT contact_id FROM software_contacts WHERE software_id = $software_id");
|
||||||
|
$contact_licenses_array = array();
|
||||||
|
while ($row = mysqli_fetch_array($contact_licenses_sql)) {
|
||||||
|
$contact_licenses_array[] = intval($row['contact_id']);
|
||||||
|
$seat_count = $seat_count + 1;
|
||||||
|
}
|
||||||
|
$contact_licenses = implode(',', $contact_licenses_array);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-cube mr-2"></i>Editing license: <strong><?php echo $software_name; ?></strong></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="software_id" value="<?php echo $software_id; ?>">
|
||||||
|
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<ul class="nav nav-pills nav-justified mb-3">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" data-toggle="pill" href="#pills-details<?php echo $software_id; ?>">Details</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-license<?php echo $software_id; ?>">License</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-device-licenses<?php echo $software_id; ?>">Devices</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-user-licenses<?php echo $software_id; ?>">Users</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-notes<?php echo $software_id; ?>">Notes</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="tab-content" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
|
||||||
|
|
||||||
|
<div class="tab-pane fade show active" id="pills-details<?php echo $software_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Software Name <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-cube"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="name" placeholder="Software name" maxlength="200" value="<?php echo $software_name; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Version</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-cube"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="version" placeholder="Software version" maxlength="200" value="<?php echo $software_version; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="description" placeholder="Short description" value="<?php echo $software_description; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>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="">- Select Vendor -</option>
|
||||||
|
<?php
|
||||||
|
$vendor_sql = mysqli_query($mysqli, "SELECT vendor_id, vendor_name FROM vendors WHERE vendor_client_id = $client_id AND vendor_archived_at IS NULL ORDER BY vendor_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($vendor_sql)) {
|
||||||
|
$vendor_id = $row['vendor_id'];
|
||||||
|
$vendor_name = $row['vendor_name'];
|
||||||
|
?>
|
||||||
|
<option <?php if ($software_vendor_id == $vendor_id) { echo "selected"; } ?> value="<?php echo $vendor_id; ?>"><?php echo $vendor_name; ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Type <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="type" required>
|
||||||
|
<?php foreach($software_types_array as $software_type_select) { ?>
|
||||||
|
<option <?php if ($software_type == $software_type_select) { echo "selected"; } ?>><?php echo $software_type_select; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-license<?php echo $software_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>License Type</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-cube"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="license_type">
|
||||||
|
<option value="">- Select a License Type -</option>
|
||||||
|
<?php foreach($license_types_array as $license_type_select) { ?>
|
||||||
|
<option <?php if ($license_type_select == $software_license_type) { echo "selected"; } ?>><?php echo $license_type_select; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Seats</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-cube"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*" name="seats" placeholder="Number of seats" value="<?php echo $software_seats; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>License Key</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-key"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="key" placeholder="License key" maxlength="200" value="<?php echo $software_key; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Purchase Reference</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="text" class="form-control" name="purchase_reference" placeholder="eg. Invoice, PO Number" value="<?php echo $software_purchase_reference; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Purchase Date</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar-check"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="date" class="form-control" name="purchase" max="2999-12-31" value="<?php echo $software_purchase; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Expire</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar-times"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="date" class="form-control" name="expire" max="2999-12-31" value="<?php echo $software_expire; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-device-licenses<?php echo $software_id; ?>">
|
||||||
|
|
||||||
|
<ul class="list-group">
|
||||||
|
|
||||||
|
<li class="list-group-item bg-dark">
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="checkbox" class="form-check-input"
|
||||||
|
onclick="this.closest('.tab-pane').querySelectorAll('.asset-checkbox').forEach(checkbox => checkbox.checked = this.checked);"
|
||||||
|
>
|
||||||
|
<label class="form-check-label ml-3"><strong>Licensed Devices</strong></label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$sql_assets_select = mysqli_query($mysqli, "SELECT * FROM assets LEFT JOIN contacts ON asset_contact_id = contact_id WHERE (asset_archived_at > '$software_created_at' OR asset_archived_at IS NULL) AND asset_client_id = $client_id ORDER BY asset_archived_at ASC, asset_name ASC");
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_array($sql_assets_select)) {
|
||||||
|
$asset_id_select = intval($row['asset_id']);
|
||||||
|
$asset_name_select = nullable_htmlentities($row['asset_name']);
|
||||||
|
$asset_type_select = nullable_htmlentities($row['asset_type']);
|
||||||
|
$asset_archived_at = nullable_htmlentities($row['asset_archived_at']);
|
||||||
|
if (empty($asset_archived_at)) {
|
||||||
|
$asset_archived_display = "";
|
||||||
|
} else {
|
||||||
|
$asset_archived_display = "Archived - ";
|
||||||
|
}
|
||||||
|
$contact_name_select = nullable_htmlentities($row['contact_name']);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="checkbox" class="form-check-input asset-checkbox" name="assets[]" value="<?php echo $asset_id_select; ?>" <?php if (in_array($asset_id_select, $asset_licenses_array)) { echo "checked"; } ?>>
|
||||||
|
<label class="form-check-label ml-2"><?php echo "$asset_archived_display$asset_name_select - $contact_name_select"; ?></label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-user-licenses<?php echo $software_id; ?>">
|
||||||
|
|
||||||
|
<ul class="list-group">
|
||||||
|
|
||||||
|
<li class="list-group-item bg-dark">
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="checkbox" class="form-check-input" onclick="this.closest('.tab-pane').querySelectorAll('.user-checkbox').forEach(checkbox => checkbox.checked = this.checked);">
|
||||||
|
<label class="form-check-label ml-3"><strong>Licensed Users</strong></label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$sql_contacts_select = mysqli_query($mysqli, "SELECT * FROM contacts WHERE (contact_archived_at > '$software_created_at' OR contact_archived_at IS NULL) AND contact_client_id = $client_id ORDER BY contact_archived_at ASC, contact_name ASC");
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_array($sql_contacts_select)) {
|
||||||
|
$contact_id_select = intval($row['contact_id']);
|
||||||
|
$contact_name_select = nullable_htmlentities($row['contact_name']);
|
||||||
|
$contact_email_select = nullable_htmlentities($row['contact_email']);
|
||||||
|
$contact_archived_at = nullable_htmlentities($row['contact_archived_at']);
|
||||||
|
if (empty($contact_archived_at)) {
|
||||||
|
$contact_archived_display = "";
|
||||||
|
} else {
|
||||||
|
$contact_archived_display = "Archived - ";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="checkbox" class="form-check-input user-checkbox" name="contacts[]" value="<?php echo $contact_id_select; ?>" <?php if (in_array("$contact_id_select", $contact_licenses_array)) { echo "checked"; } ?>>
|
||||||
|
<label class="form-check-label ml-2"><?php echo "$contact_archived_display$contact_name_select - $contact_email_select"; ?></label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-notes<?php echo $software_id; ?>">
|
||||||
|
|
||||||
|
<textarea class="form-control" rows="12" placeholder="Enter some notes" name="notes"><?php echo $software_notes; ?></textarea>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_software" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
99
ajax/ajax_software_template_edit.php
Normal file
99
ajax/ajax_software_template_edit.php
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$software_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM software WHERE software_id = $software_id LIMIT 1");
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$software_name = nullable_htmlentities($row['software_name']);
|
||||||
|
$software_version = nullable_htmlentities($row['software_version']);
|
||||||
|
$software_description = nullable_htmlentities($row['software_description']);
|
||||||
|
$software_type = nullable_htmlentities($row['software_type']);
|
||||||
|
$software_license_type = nullable_htmlentities($row['software_license_type']);
|
||||||
|
$software_notes = nullable_htmlentities($row['software_notes']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-cube mr-2"></i>Editing template: <strong><?php echo $software_name; ?></strong></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="software_id" value="<?php echo $software_id; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Template Name <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-cube"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="name" placeholder="Software name" maxlength="200" value="<?php echo $software_name; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Version</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-cube"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="version" placeholder="Software version" maxlength="200" value="<?php echo $software_version; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="description" placeholder="Short description" value="<?php echo $software_description; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Type <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="type" required>
|
||||||
|
<?php foreach($software_types_array as $software_type_select) { ?>
|
||||||
|
<option <?php if($software_type == $software_type_select) { echo "selected"; } ?>><?php echo $software_type_select; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>License Type</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-cube"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="license_type">
|
||||||
|
<option value="">- Select a License Type -</option>
|
||||||
|
<?php foreach($license_types_array as $license_type_select) { ?>
|
||||||
|
<option <?php if($license_type_select == $software_license_type){ echo "selected"; } ?>><?php echo $license_type_select; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="notes"><?php echo $software_notes; ?></textarea>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_software_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>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
49
ajax/ajax_tag_add.php
Normal file
49
ajax/ajax_tag_add.php
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$type = intval($_GET['id']);
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- <option value="1">Client Tag</option> -->
|
||||||
|
<!-- <option value="2">Location Tag</option> -->
|
||||||
|
<!-- <option value="3">Contact Tag</option> -->
|
||||||
|
<!-- <option value="4">Credential Tag</option> -->
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fas fa-fw fa-tag mr-2"></i>New Tag</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 $type; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="text" class="form-control" name="name" placeholder="Tag name" maxlength="200" required autofocus>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="color" class="form-control col-3" name="color" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="text" class="form-control" name="icon" placeholder="Icon ex handshake">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="add_tag" 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="fas fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
82
ajax/ajax_tag_edit.php
Normal file
82
ajax/ajax_tag_edit.php
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$tag_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_id = $tag_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$tag_name = nullable_htmlentities($row['tag_name']);
|
||||||
|
$tag_type = intval($row['tag_type']);
|
||||||
|
$tag_color = nullable_htmlentities($row['tag_color']);
|
||||||
|
$tag_icon = nullable_htmlentities($row['tag_icon']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fas fa-fw fa-tag mr-2"></i>Editing tag: <strong><?php echo $tag_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="tag_id" value="<?php echo $tag_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-tag"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="name" maxlength="200" value="<?php echo $tag_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-th"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="type" required>
|
||||||
|
<option value="">- Type -</option>
|
||||||
|
<option value="1" <?php if ($tag_type == 1) { echo "selected"; } ?>>Client Tag</option>
|
||||||
|
<option value="2" <?php if ($tag_type == 2) { echo "selected"; } ?>>Location Tag</option>
|
||||||
|
<option value="3" <?php if ($tag_type == 3) { echo "selected"; } ?>>Contact Tag</option>
|
||||||
|
<option value="4" <?php if ($tag_type == 4) { echo "selected"; } ?>>Credential Tag</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Color <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-paint-brush"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="color" class="form-control col-3" name="color" value="<?php echo $tag_color; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Icon</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-image"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="icon" placeholder="Icon ex handshake" value="<?php echo $tag_icon; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_tag" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
46
ajax/ajax_tax_edit.php
Normal file
46
ajax/ajax_tax_edit.php
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$tax_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM taxes WHERE tax_id = $tax_id LIMIT 1");
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$tax_name = nullable_htmlentities($row['tax_name']);
|
||||||
|
$tax_percent = floatval($row['tax_percent']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fas fa-fw fa-balance-scale mr-2"></i>Editing tax: <strong><?php echo $tax_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="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||||
|
<input type="hidden" name="tax_id" value="<?php echo $tax_id; ?>">
|
||||||
|
|
||||||
|
<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" maxlength="200" value="<?php echo $tax_name; ?>" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Percent <strong class="text-danger">*</strong></label>
|
||||||
|
<input type="number" min="0" step="any" class="form-control col-md-4" name="percent" value="<?php echo $tax_percent; ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_tax" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
79
ajax/ajax_ticket_assign.php
Normal file
79
ajax/ajax_ticket_assign.php
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$ticket_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM tickets
|
||||||
|
LEFT JOIN clients ON client_id = ticket_client_id
|
||||||
|
WHERE ticket_id = $ticket_id
|
||||||
|
LIMIT 1"
|
||||||
|
);
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
|
||||||
|
$ticket_number = intval($row['ticket_number']);
|
||||||
|
$ticket_assigned_to = intval($row['ticket_assigned_to']);
|
||||||
|
$ticket_status = intval($row['ticket_status']);
|
||||||
|
$ticket_closed_at = nullable_htmlentities($row['ticket_closed_at']);
|
||||||
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class='fa fa-fw fa-user-check mr-2'></i>Assigning Ticket: <strong><?php echo "$ticket_prefix$ticket_number"; ?></strong> - <?php echo $client_name; ?></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="ticket_id" value="<?php echo $ticket_id; ?>">
|
||||||
|
<input type="hidden" name="ticket_status" value="<?php echo $ticket_status; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Assign to</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-user-check"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="assigned_to">
|
||||||
|
<option value="0">Not Assigned</option>
|
||||||
|
<?php
|
||||||
|
$sql_users_select = mysqli_query($mysqli, "SELECT users.user_id, user_name FROM users
|
||||||
|
LEFT JOIN user_settings on users.user_id = user_settings.user_id
|
||||||
|
WHERE user_type = 1
|
||||||
|
AND user_archived_at IS NULL
|
||||||
|
ORDER BY user_name DESC"
|
||||||
|
);
|
||||||
|
while ($row = mysqli_fetch_array($sql_users_select)) {
|
||||||
|
$user_id_select = intval($row['user_id']);
|
||||||
|
$user_name_select = nullable_htmlentities($row['user_name']);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $user_id_select; ?>" <?php if ($user_id_select == $ticket_assigned_to) { echo "selected"; } ?>><?php echo $user_name_select; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="assign_ticket" class="btn btn-primary text-bold">
|
||||||
|
<i class="fa fa-check mr-2"></i>Assign
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal">
|
||||||
|
<i class="fa fa-times mr-2"></i>Cancel
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
59
ajax/ajax_ticket_billable.php
Normal file
59
ajax/ajax_ticket_billable.php
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$ticket_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
|
||||||
|
$ticket_number = intval($row['ticket_number']);
|
||||||
|
$ticket_billable = intval($row['ticket_billable']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">
|
||||||
|
<i class="fa fa-fw fa-user mr-2"></i>
|
||||||
|
Edit Billable Status for <strong><?php echo "$ticket_prefix$ticket_number"; ?></strong>
|
||||||
|
</h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
<input type="hidden" name="ticket_id" value="<?php echo $ticket_id; ?>">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Billable</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" name="billable_status">
|
||||||
|
<option <?php if ($ticket_billable == 1) { echo "selected"; } ?> value="1">Yes</option>
|
||||||
|
<option <?php if ($ticket_billable == 0) { echo "selected"; } ?> value="0">No</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_ticket_billable_status" class="btn btn-primary text-bold">
|
||||||
|
<i class="fa fa-check mr-2"></i>Save
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal">
|
||||||
|
<i class="fa fa-times mr-2"></i>Cancel
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
101
ajax/ajax_ticket_contact.php
Normal file
101
ajax/ajax_ticket_contact.php
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$ticket_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM tickets
|
||||||
|
LEFT JOIN clients ON client_id = ticket_client_id
|
||||||
|
WHERE ticket_id = $ticket_id
|
||||||
|
LIMIT 1"
|
||||||
|
);
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
|
||||||
|
$ticket_number = intval($row['ticket_number']);
|
||||||
|
$contact_id = intval($row['ticket_contact_id']);
|
||||||
|
$client_id = intval($row['ticket_client_id']);
|
||||||
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-user mr-2"></i>Changing contact: <strong><?php echo "$ticket_prefix$ticket_number"; ?></strong> - <?php echo $client_name; ?></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="ticket_id" value="<?php echo $ticket_id; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Contact</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="contact">
|
||||||
|
<option value="">No One</option>
|
||||||
|
<?php
|
||||||
|
$sql_client_contacts_select = mysqli_query($mysqli, "SELECT contact_id, contact_name, contact_title, contact_primary, contact_technical FROM contacts WHERE contact_client_id = $client_id AND contact_archived_at IS NULL ORDER BY contact_primary DESC, contact_technical DESC, contact_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_client_contacts_select)) {
|
||||||
|
$contact_id_select = intval($row['contact_id']);
|
||||||
|
$contact_name_select = nullable_htmlentities($row['contact_name']);
|
||||||
|
$contact_primary_select = intval($row['contact_primary']);
|
||||||
|
if($contact_primary_select == 1) {
|
||||||
|
$contact_primary_display_select = " (Primary)";
|
||||||
|
} else {
|
||||||
|
$contact_primary_display_select = "";
|
||||||
|
}
|
||||||
|
$contact_technical_select = intval($row['contact_technical']);
|
||||||
|
if($contact_technical_select == 1) {
|
||||||
|
$contact_technical_display_select = " (Technical)";
|
||||||
|
} else {
|
||||||
|
$contact_technical_display_select = "";
|
||||||
|
}
|
||||||
|
$contact_title_select = nullable_htmlentities($row['contact_title']);
|
||||||
|
if(!empty($contact_title_select)) {
|
||||||
|
$contact_title_display_select = " - $contact_title_select";
|
||||||
|
} else {
|
||||||
|
$contact_title_display_select = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<option
|
||||||
|
value="<?php echo $contact_id_select; ?>"
|
||||||
|
<?php if ($contact_id_select == $contact_id) { echo "selected"; } ?>
|
||||||
|
>
|
||||||
|
<?php echo "$contact_name_select$contact_title_display_select$contact_primary_display_select$contact_technical_display_select"; ?>
|
||||||
|
</option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if (!empty($config_smtp_host)) { ?>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" type="checkbox" name="contact_notify" value="1" id="checkNotifyContact" <?php if ($config_ticket_client_general_notifications) { echo "checked"; } ?>>
|
||||||
|
<label class="form-check-label" for="checkNotifyContact">
|
||||||
|
Send email notification
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_ticket_contact" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
353
ajax/ajax_ticket_edit.php
Normal file
353
ajax/ajax_ticket_edit.php
Normal file
@@ -0,0 +1,353 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$ticket_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM tickets LEFT JOIN clients ON client_id = ticket_client_id WHERE ticket_id = $ticket_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$client_id = intval($row['client_id']);
|
||||||
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
|
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
|
||||||
|
$ticket_number = intval($row['ticket_number']);
|
||||||
|
$ticket_category = intval($row['ticket_category']);
|
||||||
|
$ticket_subject = nullable_htmlentities($row['ticket_subject']);
|
||||||
|
$ticket_details = nullable_htmlentities($row['ticket_details']);
|
||||||
|
$ticket_priority = nullable_htmlentities($row['ticket_priority']);
|
||||||
|
$ticket_billable = intval($row['ticket_billable']);
|
||||||
|
$ticket_vendor_ticket_number = nullable_htmlentities($row['ticket_vendor_ticket_number']);
|
||||||
|
$ticket_created_at = nullable_htmlentities($row['ticket_created_at']);
|
||||||
|
$contact_id = intval($row['ticket_contact_id']);
|
||||||
|
$asset_id = intval($row['ticket_asset_id']);
|
||||||
|
$location_id = intval($row['ticket_location_id']);
|
||||||
|
$vendor_id = intval($row['ticket_vendor_id']);
|
||||||
|
$project_id = intval($row['ticket_project_id']);
|
||||||
|
|
||||||
|
// Additional Assets Selected
|
||||||
|
$additional_assets_array = array();
|
||||||
|
$sql_additional_assets = mysqli_query($mysqli, "SELECT asset_id FROM ticket_assets WHERE ticket_id = $ticket_id");
|
||||||
|
while ($row = mysqli_fetch_array($sql_additional_assets)) {
|
||||||
|
$additional_asset_id = intval($row['asset_id']);
|
||||||
|
$additional_assets_array[] = $additional_asset_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-life-ring mr-2"></i>Editing ticket: <strong><?php echo "$ticket_prefix$ticket_number"; ?></strong> - <?php echo $client_name; ?></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="ticket_id" value="<?php echo $ticket_id; ?>">
|
||||||
|
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<ul class="nav nav-pills nav-justified mb-3">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" data-toggle="pill" href="#pills-details<?php echo $ticket_id; ?>"><i class="fa fa-fw fa-life-ring mr-2"></i>Details</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-contacts<?php echo $ticket_id; ?>"><i class="fa fa-fw fa-users mr-2"></i>Contact</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-assignment<?php echo $ticket_id; ?>"><i class="fa fa-fw fa-desktop mr-2"></i>Assignment</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="tab-content" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
|
||||||
|
|
||||||
|
<div class="tab-pane fade show active" id="pills-details<?php echo $ticket_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Subject <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="subject" maxlength="500" value="<?php echo $ticket_subject; ?>" placeholder="Subject" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="form-control tinymceTicket" rows="8" name="details"><?php echo $ticket_details; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Priority <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-thermometer-half"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="priority" required>
|
||||||
|
<option <?php if ($ticket_priority == 'Low') { echo "selected"; } ?> >Low</option>
|
||||||
|
<option <?php if ($ticket_priority == 'Medium') { echo "selected"; } ?> >Medium</option>
|
||||||
|
<option <?php if ($ticket_priority == 'High') { echo "selected"; } ?> >High</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Category</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-layer-group"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="category">
|
||||||
|
<option value="0">- Uncategorized -</option>
|
||||||
|
<?php
|
||||||
|
$sql_categories = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Ticket' AND category_archived_at IS NULL");
|
||||||
|
while ($row = mysqli_fetch_array($sql_categories)) {
|
||||||
|
$category_id = intval($row['category_id']);
|
||||||
|
$category_name = nullable_htmlentities($row['category_name']);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<option <?php if ($ticket_category == $category_id) {echo "selected";} ?> value="<?php echo $category_id; ?>"><?php echo $category_name; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-secondary" type="button"
|
||||||
|
data-toggle="ajax-modal"
|
||||||
|
data-modal-size="sm"
|
||||||
|
data-ajax-url="ajax/ajax_category_add.php?category=Ticket">
|
||||||
|
<i class="fas fa-fw fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if ($config_module_enable_accounting && lookupUserPermission("module_sales") >= 2) { ?>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="custom-control custom-switch">
|
||||||
|
<input type="checkbox" class="custom-control-input" name="billable" <?php if ($ticket_billable == 1) { echo "checked"; } ?> value="1" id="billableSwitch<?php echo $ticket_id; ?>">
|
||||||
|
<label class="custom-control-label" for="billableSwitch<?php echo $ticket_id; ?>">Mark Billable</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-contacts<?php echo $ticket_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Contact</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="contact">
|
||||||
|
<option value="0">No One</option>
|
||||||
|
<?php
|
||||||
|
$sql_client_contacts_select = mysqli_query($mysqli, "SELECT contact_id, contact_name, contact_title, contact_primary, contact_technical FROM contacts WHERE contact_client_id = $client_id AND contact_archived_at IS NULL ORDER BY contact_primary DESC, contact_technical DESC, contact_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_client_contacts_select)) {
|
||||||
|
$contact_id_select = intval($row['contact_id']);
|
||||||
|
$contact_name_select = nullable_htmlentities($row['contact_name']);
|
||||||
|
$contact_primary_select = intval($row['contact_primary']);
|
||||||
|
if($contact_primary_select == 1) {
|
||||||
|
$contact_primary_display_select = " (Primary)";
|
||||||
|
} else {
|
||||||
|
$contact_primary_display_select = "";
|
||||||
|
}
|
||||||
|
$contact_technical_select = intval($row['contact_technical']);
|
||||||
|
if($contact_technical_select == 1) {
|
||||||
|
$contact_technical_display_select = " (Technical)";
|
||||||
|
} else {
|
||||||
|
$contact_technical_display_select = "";
|
||||||
|
}
|
||||||
|
$contact_title_select = nullable_htmlentities($row['contact_title']);
|
||||||
|
if(!empty($contact_title_select)) {
|
||||||
|
$contact_title_display_select = " - $contact_title_select";
|
||||||
|
} else {
|
||||||
|
$contact_title_display_select = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $contact_id_select; ?>" <?php if ($contact_id_select == $contact_id) { echo "selected"; } ?>><?php echo "$contact_name_select$contact_title_display_select$contact_primary_display_select$contact_technical_display_select"; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if (!empty($config_smtp_host)) { ?>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" type="checkbox" name="contact_notify" value="1" id="checkNotifyContact">
|
||||||
|
<label class="form-check-label" for="checkNotifyContact">
|
||||||
|
Send email notification
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-assignment<?php echo $ticket_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Asset</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-desktop"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="asset">
|
||||||
|
<option value="0">- None -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_assets = mysqli_query($mysqli, "SELECT asset_id, asset_name, contact_name FROM assets LEFT JOIN contacts ON contact_id = asset_contact_id WHERE asset_client_id = $client_id AND asset_archived_at IS NULL ORDER BY asset_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||||
|
$asset_id_select = intval($row['asset_id']);
|
||||||
|
$asset_name_select = nullable_htmlentities($row['asset_name']);
|
||||||
|
$asset_contact_name_select = nullable_htmlentities($row['contact_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($asset_id == $asset_id_select) { echo "selected"; } ?> value="<?php echo $asset_id_select; ?>"><?php echo "$asset_name_select - $asset_contact_name_select"; ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Additional Assets</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-desktop"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="additional_assets[]" data-tags="true" data-placeholder="- Select Additional Assets -" multiple>
|
||||||
|
<option value=""></option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_assets = mysqli_query($mysqli, "SELECT asset_id, asset_name, contact_name FROM assets LEFT JOIN contacts ON contact_id = asset_contact_id WHERE asset_client_id = $client_id AND asset_id != $asset_id AND asset_archived_at IS NULL ORDER BY asset_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||||
|
$asset_id_select = intval($row['asset_id']);
|
||||||
|
$asset_name_select = nullable_htmlentities($row['asset_name']);
|
||||||
|
$asset_contact_name_select = nullable_htmlentities($row['contact_name']);
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $asset_id_select; ?>"
|
||||||
|
<?php if (in_array($asset_id_select, $additional_assets_array)) { echo "selected"; } ?>
|
||||||
|
><?php echo "$asset_name_select - $asset_contact_name_select"; ?></option>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Location</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="location">
|
||||||
|
<option value="0">- None -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_locations = mysqli_query($mysqli, "SELECT location_id, location_name FROM locations WHERE location_client_id = $client_id AND location_archived_at IS NULL ORDER BY location_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_locations)) {
|
||||||
|
$location_id_select = intval($row['location_id']);
|
||||||
|
$location_name_select = nullable_htmlentities($row['location_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($location_id == $location_id_select) { echo "selected"; } ?> value="<?php echo $location_id_select; ?>"><?php echo $location_name_select; ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Vendor</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-building"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="vendor">
|
||||||
|
<option value="0">- None -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_vendors = mysqli_query($mysqli, "SELECT vendor_id, vendor_name FROM vendors WHERE vendor_client_id = $client_id AND vendor_template = 0 AND vendor_archived_at IS NULL ORDER BY vendor_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_vendors)) {
|
||||||
|
$vendor_id_select = intval($row['vendor_id']);
|
||||||
|
$vendor_name_select = nullable_htmlentities($row['vendor_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($vendor_id == $vendor_id_select) { echo "selected"; } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Vendor Ticket Number</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="vendor_ticket_number" placeholder="Vendor ticket number" value="<?php echo $ticket_vendor_ticket_number; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Project</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-project-diagram"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="project">
|
||||||
|
<option value="0">- None -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_projects = mysqli_query($mysqli, "SELECT project_id, project_name FROM projects WHERE (project_client_id = $client_id OR project_client_id = 0) AND project_completed_at IS NULL AND project_archived_at IS NULL ORDER BY project_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_projects)) {
|
||||||
|
$project_id_select = intval($row['project_id']);
|
||||||
|
$project_name_select = nullable_htmlentities($row['project_name']); ?>
|
||||||
|
<option <?php if ($project_id == $project_id_select) { echo "selected"; } ?> value="<?php echo $project_id_select; ?>"><?php echo $project_name_select; ?></option>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_ticket" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
62
ajax/ajax_ticket_priority.php
Normal file
62
ajax/ajax_ticket_priority.php
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$ticket_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM tickets
|
||||||
|
LEFT JOIN clients ON client_id = ticket_client_id
|
||||||
|
WHERE ticket_id = $ticket_id
|
||||||
|
LIMIT 1"
|
||||||
|
);
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
|
||||||
|
$ticket_number = intval($row['ticket_number']);
|
||||||
|
$ticket_priority = nullable_htmlentities($row['ticket_priority']);
|
||||||
|
$client_id = intval($row['ticket_client_id']);
|
||||||
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-thermometer-half mr-2"></i>Editing ticket priority: <strong><?php echo "$ticket_prefix$ticket_number"; ?></strong> - <?php echo $client_name; ?></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="ticket_id" value="<?php echo $ticket_id; ?>">
|
||||||
|
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||||
|
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Priority</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-thermometer-half"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="priority" required>
|
||||||
|
<option <?php if ($ticket_priority == 'Low') { echo "selected"; } ?> >Low</option>
|
||||||
|
<option <?php if ($ticket_priority == 'Medium') { echo "selected"; } ?> >Medium</option>
|
||||||
|
<option <?php if ($ticket_priority == 'High') { echo "selected"; } ?> >High</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_ticket_priority" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
70
ajax/ajax_ticket_reply_edit.php
Normal file
70
ajax/ajax_ticket_reply_edit.php
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$ticket_reply_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM ticket_replies
|
||||||
|
LEFT JOIN tickets ON ticket_id = ticket_reply_ticket_id
|
||||||
|
WHERE ticket_reply_id = $ticket_reply_id
|
||||||
|
LIMIT 1"
|
||||||
|
);
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$ticket_reply_type = nullable_htmlentities($row['ticket_reply_type']);
|
||||||
|
$ticket_reply_time_worked = date_create($row['ticket_reply_time_worked']);
|
||||||
|
$ticket_reply_time_worked_formatted = date_format($ticket_reply_time_worked, 'H:i:s');
|
||||||
|
$ticket_reply = nullable_htmlentities($row['ticket_reply']);
|
||||||
|
$client_id = intval($row['ticket_client_id']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-edit mr-2"></i>Editing Ticket Reply</h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="ticket_reply_id" value="<?php echo $ticket_reply_id; ?>">
|
||||||
|
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||||
|
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="btn-group btn-block btn-group-toggle" data-toggle="buttons">
|
||||||
|
<label class="btn btn-outline-secondary <?php if ($ticket_reply_type == 'Internal') { echo "active"; } ?>">
|
||||||
|
<input type="radio" name="ticket_reply_type" value="Internal" <?php if ($ticket_reply_type == 'Internal') { echo "checked"; } ?>>Internal Note
|
||||||
|
</label>
|
||||||
|
<label class="btn btn-outline-secondary <?php if ($ticket_reply_type == 'Public') { echo "active"; } ?>">
|
||||||
|
<input type="radio" name="ticket_reply_type" value="Public" <?php if ($ticket_reply_type == 'Public') { echo "checked"; } ?>>Public Comment
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="form-control tinymce" name="ticket_reply"><?php echo $ticket_reply; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if (!empty($ticket_reply_time_worked)) { ?>
|
||||||
|
<div class="col-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Time worked</label>
|
||||||
|
<input class="form-control" name="time" type="text" placeholder="HH:MM:SS" pattern="([01]?[0-9]|2[0-3]):([0-5]?[0-9]):([0-5]?[0-9])" value="<?php echo $ticket_reply_time_worked_formatted; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_ticket_reply" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
54
ajax/ajax_ticket_reply_redact.php
Normal file
54
ajax/ajax_ticket_reply_redact.php
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$ticket_reply_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM ticket_replies
|
||||||
|
LEFT JOIN tickets ON ticket_id = ticket_reply_ticket_id
|
||||||
|
WHERE ticket_reply_id = $ticket_reply_id
|
||||||
|
LIMIT 1"
|
||||||
|
);
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$ticket_reply_type = nullable_htmlentities($row['ticket_reply_type']);
|
||||||
|
$ticket_reply_time_worked = date_create($row['ticket_reply_time_worked']);
|
||||||
|
$ticket_reply_time_worked_formatted = date_format($ticket_reply_time_worked, 'H:i:s');
|
||||||
|
$ticket_reply = nullable_htmlentities($row['ticket_reply']);
|
||||||
|
$client_id = intval($row['ticket_client_id']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-edit mr-2"></i>Redacting Ticket Reply</h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="ticket_reply_id" value="<?php echo $ticket_reply_id; ?>">
|
||||||
|
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||||
|
<input type="hidden" name="ticket_reply_type" value="<?php echo $ticket_reply_type; ?>">
|
||||||
|
<?php if (!empty($ticket_reply_time_worked)) { ?>
|
||||||
|
<input type="hidden" name="time" value="<?php echo $ticket_reply_time_worked_formatted; ?>">
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="form-control tinymceRedact" name="ticket_reply"><?php echo $ticket_reply; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_ticket_reply" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
64
ajax/ajax_ticket_task_edit.php
Normal file
64
ajax/ajax_ticket_task_edit.php
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$task_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM tasks
|
||||||
|
WHERE task_id = $task_id
|
||||||
|
LIMIT 1"
|
||||||
|
);
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$task_name = nullable_htmlentities($row['task_name']);
|
||||||
|
$task_completion_estimate = intval($row['task_completion_estimate']);
|
||||||
|
$task_completed_at = nullable_htmlentities($row['task_completed_at']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-tasks mr-2"></i>Editing task</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="task_id" value="<?php echo $task_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-tag"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="name" placeholder="Name the task" maxlength="255" value="<?php echo $task_name; ?>" required autofocus>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Estimated Completion Time <span class="text-secondary">(Minutes)</span></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="number" class="form-control" name="completion_estimate" placeholder="Estimated time to complete task in mins" value="<?php echo $task_completion_estimate; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_ticket_task" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
62
ajax/ajax_ticket_template_task_edit.php
Normal file
62
ajax/ajax_ticket_template_task_edit.php
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$task_template_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM task_templates WHERE task_template_id = $task_template_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$task_template_name = nullable_htmlentities($row['task_template_name']);
|
||||||
|
$task_template_order = intval($row['task_template_order']);
|
||||||
|
$task_template_completion_estimate = intval($row['task_template_completion_estimate']);
|
||||||
|
$task_template_description = nullable_htmlentities($row['task_template_description']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-tasks mr-2"></i>Editing task</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="task_template_id" value="<?php echo $task_template_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-tag"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="name" placeholder="Name the task" maxlength="255" value="<?php echo $task_template_name; ?>" required autofocus>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Estimated Completion Time <span class="text-secondary">(Minutes)</span></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="number" class="form-control" name="completion_estimate" placeholder="Estimated time to complete task in mins" value="<?php echo $task_template_completion_estimate; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_ticket_template_task" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
192
ajax/ajax_transfer_edit.php
Normal file
192
ajax/ajax_transfer_edit.php
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$transfer_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT transfer_created_at, expense_date AS transfer_date, expense_amount AS transfer_amount, expense_account_id AS transfer_account_from, revenue_account_id AS transfer_account_to, transfer_expense_id, transfer_revenue_id, transfer_id, transfer_method, transfer_notes FROM transfers, expenses, revenues
|
||||||
|
WHERE transfer_expense_id = expense_id
|
||||||
|
AND transfer_revenue_id = revenue_id
|
||||||
|
AND transfer_id = $transfer_id
|
||||||
|
LIMIT 1"
|
||||||
|
);
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$transfer_date = nullable_htmlentities($row['transfer_date']);
|
||||||
|
$transfer_account_from = intval($row['transfer_account_from']);
|
||||||
|
$transfer_account_to = intval($row['transfer_account_to']);
|
||||||
|
$transfer_amount = floatval($row['transfer_amount']);
|
||||||
|
$transfer_method = nullable_htmlentities($row['transfer_method']);
|
||||||
|
$transfer_notes = nullable_htmlentities($row['transfer_notes']);
|
||||||
|
$transfer_created_at = nullable_htmlentities($row['transfer_created_at']);
|
||||||
|
$expense_id = intval($row['transfer_expense_id']);
|
||||||
|
$revenue_id = intval($row['transfer_revenue_id']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fas fa-fw fa-exchange-alt mr-2"></i>Editing Transfer</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="transfer_id" value="<?php echo $transfer_id; ?>">
|
||||||
|
<input type="hidden" name="expense_id" value="<?php echo $expense_id; ?>">
|
||||||
|
<input type="hidden" name="revenue_id" value="<?php echo $revenue_id; ?>">
|
||||||
|
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
|
||||||
|
<div class="form-group col-sm">
|
||||||
|
<label>Date <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="date" class="form-control" name="date" max="2999-12-31" value="<?php echo $transfer_date; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-sm">
|
||||||
|
<label>Amount <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-dollar-sign"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,2}" name="amount" placeholder="0.00" value="<?php echo number_format($transfer_amount, 2, '.', ''); ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Transfer <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-piggy-bank"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="account_from" required>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_accounts = mysqli_query($mysqli, "SELECT * FROM accounts WHERE (account_archived_at > '$transfer_created_at' OR account_archived_at IS NULL) ORDER BY account_archived_at ASC, account_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_accounts)) {
|
||||||
|
$account_id_select = intval($row['account_id']);
|
||||||
|
$account_name_select = nullable_htmlentities($row['account_name']);
|
||||||
|
$opening_balance = floatval($row['opening_balance']);
|
||||||
|
$account_archived_at = nullable_htmlentities($row['account_archived_at']);
|
||||||
|
if (empty($account_archived_at)) {
|
||||||
|
$account_archived_display = "";
|
||||||
|
} else {
|
||||||
|
$account_archived_display = "Archived - ";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id_select");
|
||||||
|
$row = mysqli_fetch_array($sql_payments);
|
||||||
|
$total_payments = floatval($row['total_payments']);
|
||||||
|
|
||||||
|
$sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id_select");
|
||||||
|
$row = mysqli_fetch_array($sql_revenues);
|
||||||
|
$total_revenues = floatval($row['total_revenues']);
|
||||||
|
|
||||||
|
$sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id_select");
|
||||||
|
$row = mysqli_fetch_array($sql_expenses);
|
||||||
|
$total_expenses = floatval($row['total_expenses']);
|
||||||
|
|
||||||
|
$balance = $opening_balance + $total_payments + $total_revenues - $total_expenses;
|
||||||
|
|
||||||
|
?>
|
||||||
|
<option <?php if ($transfer_account_from == $account_id_select) { echo "selected"; } ?> value="<?php echo $account_id_select; ?>"><?php echo "$account_archived_display$account_name_select"; ?> [$<?php echo number_format($balance, 2); ?>]</option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</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-arrow-right"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="account_to" required>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql2 = mysqli_query($mysqli, "SELECT * FROM accounts WHERE (account_archived_at > '$transfer_created_at' OR account_archived_at IS NULL) ORDER BY account_archived_at ASC, account_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql2)) {
|
||||||
|
$account_id2 = intval($row['account_id']);
|
||||||
|
$account_name = nullable_htmlentities($row['account_name']);
|
||||||
|
$opening_balance = floatval($row['opening_balance']);
|
||||||
|
$account_archived_at = nullable_htmlentities($row['account_archived_at']);
|
||||||
|
if (empty($account_archived_at)) {
|
||||||
|
$account_archived_display = "";
|
||||||
|
} else {
|
||||||
|
$account_archived_display = "Archived - ";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id2");
|
||||||
|
$row = mysqli_fetch_array($sql_payments);
|
||||||
|
$total_payments = floatval($row['total_payments']);
|
||||||
|
|
||||||
|
$sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id2");
|
||||||
|
$row = mysqli_fetch_array($sql_revenues);
|
||||||
|
$total_revenues = floatval($row['total_revenues']);
|
||||||
|
|
||||||
|
$sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id2");
|
||||||
|
$row = mysqli_fetch_array($sql_expenses);
|
||||||
|
$total_expenses = floatval($row['total_expenses']);
|
||||||
|
|
||||||
|
$balance = $opening_balance + $total_payments + $total_revenues - $total_expenses;
|
||||||
|
|
||||||
|
?>
|
||||||
|
<option <?php if ($transfer_account_to == $account_id2) { echo "selected"; } ?> value="<?php echo $account_id2; ?>"><?php echo "$account_archived_display$account_name"; ?> [$<?php echo number_format($balance, 2); ?>]</option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="form-control" rows="5" name="notes" placeholder="Enter some notes"><?php echo $transfer_notes; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Transfer Method</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-money-check-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="transfer_method">
|
||||||
|
<option value="">- Method of Transfer -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_transfer_method_select = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Payment Method' AND category_archived_at IS NULL ORDER BY category_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_transfer_method_select)) {
|
||||||
|
$category_name_select = nullable_htmlentities($row['category_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if($transfer_method == $category_name_select) { echo "selected"; } ?> ><?php echo $category_name_select; ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_transfer" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
168
ajax/ajax_trip_copy.php
Normal file
168
ajax/ajax_trip_copy.php
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$trip_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM trips WHERE trip_id = $trip_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$trip_date = nullable_htmlentities($row['trip_date']);
|
||||||
|
$trip_purpose = nullable_htmlentities($row['trip_purpose']);
|
||||||
|
$trip_source = nullable_htmlentities($row['trip_source']);
|
||||||
|
$trip_destination = nullable_htmlentities($row['trip_destination']);
|
||||||
|
$trip_miles = number_format(floatval($row['trip_miles']),1);
|
||||||
|
$trip_user_id = intval($row['trip_user_id']);
|
||||||
|
$trip_created_at = nullable_htmlentities($row['trip_created_at']);
|
||||||
|
$trip_archived_at = nullable_htmlentities($row['trip_archived_at']);
|
||||||
|
$round_trip = nullable_htmlentities($row['round_trip']);
|
||||||
|
$client_id = intval($row['trip_client_id']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fas fa-fw fa-copy mr-2"></i>Copying Trip</h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
|
||||||
|
<div class="form-group col">
|
||||||
|
<label>Date <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="date" class="form-control" name="date" max="2999-12-31" value="<?php echo date("Y-m-d"); ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col">
|
||||||
|
<label>Miles <strong class="text-danger">*</strong> / <span class="text-secondary">Roundtrip</span></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-bicycle"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,1}" name="miles" value="<?php echo $trip_miles; ?>" placeholder="0.0" required>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<div class="input-group-text">
|
||||||
|
<input type="checkbox" name="roundtrip" value="1" <?php if ($round_trip == 1) { echo "checked"; } ?>>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Location <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-map-marker-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="source" maxlength="200" value="<?php echo $trip_source; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-arrow-right"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="destination" data-tags="true" data-placeholder="- Select / Input Destination -" required>
|
||||||
|
<option><?php echo $trip_destination; ?></option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_locations_select = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_archived_at IS NULL AND location_client_id = $client_id ORDER BY location_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_locations_select)) {
|
||||||
|
$location_name = nullable_htmlentities($row['location_name']);
|
||||||
|
$location_address = nullable_htmlentities($row['location_address']);
|
||||||
|
$location_city = nullable_htmlentities($row['location_city']);
|
||||||
|
$location_state = nullable_htmlentities($row['location_state']);
|
||||||
|
$location_zip = nullable_htmlentities($row['location_zip']);
|
||||||
|
$location_full_address = "$location_address $location_city $location_state $location_zip";
|
||||||
|
|
||||||
|
?>
|
||||||
|
<option><?php echo $location_full_address; ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Purpose <strong class="text-danger">*</strong></label>
|
||||||
|
<textarea rows="4" class="form-control" placeholder="Enter a purpose" name="purpose" maxlength="200" required><?php echo $trip_purpose; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Driver</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="user" required>
|
||||||
|
<option value="">- Driver -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_users = mysqli_query($mysqli, "SELECT users.user_id, user_name FROM users
|
||||||
|
LEFT JOIN user_settings on users.user_id = user_settings.user_id
|
||||||
|
WHERE user_role > 1 AND user_archived_at IS NULL ORDER BY user_name ASC"
|
||||||
|
);
|
||||||
|
while ($row = mysqli_fetch_array($sql_users)) {
|
||||||
|
$user_id_select = intval($row['user_id']);
|
||||||
|
$user_name_select = nullable_htmlentities($row['user_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($trip_user_id == $user_id_select) { echo "selected"; } ?> value="<?php echo $user_id_select; ?>"><?php echo $user_name_select; ?></option>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if (isset($_GET['client_id'])) { ?>
|
||||||
|
<input type="hidden" name="client" value="<?php echo $client_id; ?>">
|
||||||
|
<?php } else { ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Client</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="client">
|
||||||
|
<option value="">- Client (Optional) -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_clients = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at IS NULL ORDER BY client_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_clients)) {
|
||||||
|
$client_id_select = intval($row['client_id']);
|
||||||
|
$client_name_select = nullable_htmlentities($row['client_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($client_id == $client_id_select) { echo "selected"; } ?> value="<?php echo $client_id_select; ?>"><?php echo $client_name_select; ?></option>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="add_trip" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Copy</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
179
ajax/ajax_trip_edit.php
Normal file
179
ajax/ajax_trip_edit.php
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$trip_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM trips WHERE trip_id = $trip_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$trip_date = nullable_htmlentities($row['trip_date']);
|
||||||
|
$trip_purpose = nullable_htmlentities($row['trip_purpose']);
|
||||||
|
$trip_source = nullable_htmlentities($row['trip_source']);
|
||||||
|
$trip_destination = nullable_htmlentities($row['trip_destination']);
|
||||||
|
$trip_miles = number_format(floatval($row['trip_miles']),1);
|
||||||
|
$trip_user_id = intval($row['trip_user_id']);
|
||||||
|
$trip_created_at = nullable_htmlentities($row['trip_created_at']);
|
||||||
|
$trip_archived_at = nullable_htmlentities($row['trip_archived_at']);
|
||||||
|
$round_trip = nullable_htmlentities($row['round_trip']);
|
||||||
|
$client_id = intval($row['trip_client_id']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-route mr-2"></i>Editing Trip</h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
<input type="hidden" name="trip_id" value="<?php echo $trip_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
|
||||||
|
<div class="form-group col">
|
||||||
|
<label>Date <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="date" class="form-control" name="date" max="2999-12-31" value="<?php echo $trip_date; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col">
|
||||||
|
<label>Miles <strong class="text-danger">*</strong> / <span class="text-secondary">Roundtrip</span></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-bicycle"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,1}" name="miles" value="<?php echo $trip_miles; ?>" placeholder="0.0" required>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<div class="input-group-text">
|
||||||
|
<input type="checkbox" name="roundtrip" value="1" <?php if ($round_trip == 1) { echo "checked"; } ?>>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Location <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-map-marker-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="source" maxlength="200" value="<?php echo $trip_source; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-arrow-right"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="destination" data-tags="true" data-placeholder="- Select / Input Destination -" required>
|
||||||
|
<option><?php echo $trip_destination; ?></option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_locations_select = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_archived_at IS NULL AND location_client_id = $client_id ORDER BY location_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_locations_select)) {
|
||||||
|
$location_name = nullable_htmlentities($row['location_name']);
|
||||||
|
$location_address = nullable_htmlentities($row['location_address']);
|
||||||
|
$location_city = nullable_htmlentities($row['location_city']);
|
||||||
|
$location_state = nullable_htmlentities($row['location_state']);
|
||||||
|
$location_zip = nullable_htmlentities($row['location_zip']);
|
||||||
|
$location_full_address = "$location_address $location_city $location_state $location_zip";
|
||||||
|
|
||||||
|
?>
|
||||||
|
<option><?php echo $location_full_address; ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Purpose <strong class="text-danger">*</strong></label>
|
||||||
|
<textarea rows="4" class="form-control" name="purpose" placeholder="Enter a purpose" maxlength="200" required><?php echo $trip_purpose; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Driver</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="user" required>
|
||||||
|
<option value="">- Driver -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_users = mysqli_query($mysqli, "SELECT * FROM users
|
||||||
|
LEFT JOIN user_settings on users.user_id = user_settings.user_id
|
||||||
|
WHERE (users.user_id = $trip_user_id) OR (user_archived_at IS NULL AND user_status = 1) ORDER BY user_name ASC"
|
||||||
|
);
|
||||||
|
while ($row = mysqli_fetch_array($sql_users)) {
|
||||||
|
$user_id_select = intval($row['user_id']);
|
||||||
|
$user_name_select = nullable_htmlentities($row['user_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($trip_user_id == $user_id_select) { echo "selected"; } ?> value="<?php echo $user_id_select; ?>"><?php echo $user_name_select; ?></option>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if (isset($_GET['client_id'])) { ?>
|
||||||
|
<input type="hidden" name="client" value="<?php echo $client_id; ?>">
|
||||||
|
<?php } else { ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Client</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="client">
|
||||||
|
<option value="">- Client (Optional) -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_clients = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at > '$trip_created_at' OR client_archived_at IS NULL ORDER BY client_archived_at ASC, client_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_clients)) {
|
||||||
|
$client_id_select = intval($row['client_id']);
|
||||||
|
$client_name_select = nullable_htmlentities($row['client_name']);
|
||||||
|
$client_archived_at = nullable_htmlentities($row['client_archived_at']);
|
||||||
|
if (empty($client_archived_at)) {
|
||||||
|
$client_archived_display = "";
|
||||||
|
} else {
|
||||||
|
$client_archived_display = "Archived - ";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<option <?php if ($client_id == $client_id_select) { echo "selected"; } ?> value="<?php echo $client_id_select; ?>"><?php echo "$client_archived_display$client_name_select"; ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_trip" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
204
ajax/ajax_user_edit.php
Normal file
204
ajax/ajax_user_edit.php
Normal file
@@ -0,0 +1,204 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$user_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM users
|
||||||
|
LEFT JOIN user_settings ON users.user_id = user_settings.user_id
|
||||||
|
WHERE users.user_id = $user_id LIMIT 1"
|
||||||
|
);
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$user_name = nullable_htmlentities($row['user_name']);
|
||||||
|
$user_email = nullable_htmlentities($row['user_email']);
|
||||||
|
$user_avatar = nullable_htmlentities($row['user_avatar']);
|
||||||
|
$user_token = nullable_htmlentities($row['user_token']);
|
||||||
|
$user_config_force_mfa = intval($row['user_config_force_mfa']);
|
||||||
|
$user_role_id = intval($row['user_role_id']);
|
||||||
|
$user_initials = nullable_htmlentities(initials($user_name));
|
||||||
|
|
||||||
|
// Get User Client Access Permissions
|
||||||
|
$user_client_access_sql = mysqli_query($mysqli,"SELECT client_id FROM user_client_permissions WHERE user_id = $user_id");
|
||||||
|
$client_access_array = [];
|
||||||
|
while ($row = mysqli_fetch_assoc($user_client_access_sql)) {
|
||||||
|
$client_access_array[] = intval($row['client_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fas fa-fw fa-user-edit mr-2"></i>Editing user:
|
||||||
|
<strong><?php echo $user_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="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||||
|
<input type="hidden" name="user_id" value="<?php echo $user_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-user-details<?php echo $user_id; ?>">Details</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-user-access<?php echo $user_id; ?>">Restrict Access</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="tab-content">
|
||||||
|
|
||||||
|
<div class="tab-pane fade show active" id="pills-user-details<?php echo $user_id; ?>">
|
||||||
|
|
||||||
|
<center class="mb-3">
|
||||||
|
<?php if (!empty($user_avatar)) { ?>
|
||||||
|
<img class="img-fluid" src="<?php echo "uploads/users/$user_id/$user_avatar"; ?>">
|
||||||
|
<?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 $user_initials; ?></span>
|
||||||
|
</span>
|
||||||
|
<?php } ?>
|
||||||
|
</center>
|
||||||
|
|
||||||
|
<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="Full Name" maxlength="200"
|
||||||
|
value="<?php echo $user_name; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Email <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-envelope"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="email" class="form-control" name="email" placeholder="Email Address" maxlength="200"
|
||||||
|
value="<?php echo $user_email; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>New 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="password" class="form-control" data-toggle="password" name="new_password"
|
||||||
|
placeholder="Leave Blank For No Password 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>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Role <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-shield"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="role" required>
|
||||||
|
<?php
|
||||||
|
$sql_user_roles = mysqli_query($mysqli, "SELECT * FROM user_roles WHERE role_archived_at IS NULL");
|
||||||
|
while ($row = mysqli_fetch_array($sql_user_roles)) {
|
||||||
|
$role_id = intval($row['role_id']);
|
||||||
|
$role_name = nullable_htmlentities($row['role_name']);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<option <?php if ($role_id == $user_role_id) {echo "selected";} ?> value="<?php echo $role_id; ?>"><?php echo $role_name; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Avatar</label>
|
||||||
|
<input type="file" class="form-control-file" accept="image/*" name="file">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="custom-control custom-checkbox">
|
||||||
|
<input class="custom-control-input" type="checkbox" id="forceMFACheckBox<?php echo $user_id; ?>" name="force_mfa" value="1" <?php if($user_config_force_mfa == 1){ echo "checked"; } ?>>
|
||||||
|
<label for="forceMFACheckBox<?php echo $user_id; ?>" class="custom-control-label">
|
||||||
|
Force MFA
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if (!empty($user_token)) { ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>2FA</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-id-card"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control" name="2fa">
|
||||||
|
<option value="">Keep enabled</option>
|
||||||
|
<option value="disable">Disable</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-user-access<?php echo $user_id; ?>">
|
||||||
|
|
||||||
|
<div class="alert alert-info">
|
||||||
|
Check boxes to authorize user client access. No boxes grant full client access. Admin users are unaffected.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="list-group">
|
||||||
|
<li class="list-group-item bg-dark">
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="checkbox" class="form-check-input" onclick="this.closest('.tab-pane').querySelectorAll('.client-checkbox').forEach(checkbox => checkbox.checked = this.checked);">
|
||||||
|
<label class="form-check-label ml-3"><strong>Restrict Access to Clients</strong></label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_client_select = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at IS NULL ORDER BY client_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_client_select)) {
|
||||||
|
$client_id_select = intval($row['client_id']);
|
||||||
|
$client_name_select = nullable_htmlentities($row['client_name']);
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<li class="list-group-item">
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="checkbox" class="form-check-input client-checkbox" name="clients[]" value="<?php echo $client_id_select; ?>" <?php if (in_array($client_id_select, $client_access_array)) { echo "checked"; } ?>>
|
||||||
|
<label class="form-check-label ml-2"><?php echo $client_name_select; ?></label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_user" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
89
ajax/ajax_vendor_details.php
Normal file
89
ajax/ajax_vendor_details.php
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$vendor_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_id = $vendor_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$name = sanitizeInput($row['vendor_name']);
|
||||||
|
$description = sanitizeInput($row['vendor_description']);
|
||||||
|
$account_number = sanitizeInput($row['vendor_account_number']);
|
||||||
|
$contact_name = sanitizeInput($row['vendor_contact_name']);
|
||||||
|
$phone = preg_replace("/[^0-9]/", '',$row['vendor_phone']);
|
||||||
|
$extension = preg_replace("/[^0-9]/", '',$row['vendor_extension']);
|
||||||
|
$email = sanitizeInput($row['vendor_email']);
|
||||||
|
$website = sanitizeInput($row['vendor_website']);
|
||||||
|
$hours = sanitizeInput($row['vendor_hours']);
|
||||||
|
$sla = sanitizeInput($row['vendor_sla']);
|
||||||
|
$code = sanitizeInput($row['vendor_code']);
|
||||||
|
$notes = sanitizeInput($row['vendor_notes']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header bg-dark text-white">
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
<i class="fas fa-fw fa-building fa-2x mr-3"></i>
|
||||||
|
<div>
|
||||||
|
<h5 class="modal-title mb-0"><?php echo $name; ?></h5>
|
||||||
|
<div class="text-muted"><?php echo getFallback($description); ?></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-body bg-light">
|
||||||
|
|
||||||
|
<!-- Vendor Info Card -->
|
||||||
|
<div class="card mb-3 shadow-sm rounded">
|
||||||
|
<div class="card-body">
|
||||||
|
<h6 class="text-secondary"><i class="fas fa-info-circle mr-2"></i>Vendor Details</h6>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div><strong>Account Number:</strong> <?php echo getFallback($account_number); ?></div>
|
||||||
|
<div><strong>Hours:</strong> <?php echo getFallback($hours); ?></div>
|
||||||
|
<div><strong>SLA:</strong> <?php echo getFallback($sla); ?></div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div><strong>Code:</strong> <?php echo getFallback($code); ?></div>
|
||||||
|
<div><strong>Website:</strong> <?php echo !empty($website) ? '<a href="' . $website . '" target="_blank" class="text-primary">' . $website . '</a>' : '<span class="text-muted">Not Available</span>'; ?></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Contact Info Card -->
|
||||||
|
<div class="card mb-3 shadow-sm rounded">
|
||||||
|
<div class="card-body">
|
||||||
|
<h6 class="text-secondary"><i class="fas fa-user mr-2"></i>Contact Information</h6>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div><strong>Contact Name:</strong> <?php echo getFallback($contact_name); ?></div>
|
||||||
|
<div><strong>Phone:</strong> <?php echo getFallback($phone); ?></div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div><strong>Email:</strong> <?php echo !empty($email) ? '<a href="mailto:' . $email . '" class="text-primary">' . $email . '</a>' : '<span class="text-muted">Not Available</span>'; ?></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Notes Card -->
|
||||||
|
<div class="card mb-3 shadow-sm rounded">
|
||||||
|
<div class="card-body">
|
||||||
|
<h6 class="text-secondary"><i class="fas fa-sticky-note mr-2"></i>Notes</h6>
|
||||||
|
<div>
|
||||||
|
<?php echo getFallback($notes); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
215
ajax/ajax_vendor_edit.php
Normal file
215
ajax/ajax_vendor_edit.php
Normal file
@@ -0,0 +1,215 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$vendor_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_id = $vendor_id LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$vendor_name = nullable_htmlentities($row['vendor_name']);
|
||||||
|
$vendor_description = nullable_htmlentities($row['vendor_description']);
|
||||||
|
$vendor_account_number = nullable_htmlentities($row['vendor_account_number']);
|
||||||
|
$vendor_contact_name = nullable_htmlentities($row['vendor_contact_name']);
|
||||||
|
$vendor_phone_country_code = nullable_htmlentities($row['vendor_phone_country_code']);
|
||||||
|
$vendor_phone = nullable_htmlentities(formatPhoneNumber($row['vendor_phone'], $vendor_phone_country_code));
|
||||||
|
$vendor_extension = nullable_htmlentities($row['vendor_extension']);
|
||||||
|
$vendor_email = nullable_htmlentities($row['vendor_email']);
|
||||||
|
$vendor_website = nullable_htmlentities($row['vendor_website']);
|
||||||
|
$vendor_hours = nullable_htmlentities($row['vendor_hours']);
|
||||||
|
$vendor_sla = nullable_htmlentities($row['vendor_sla']);
|
||||||
|
$vendor_code = nullable_htmlentities($row['vendor_code']);
|
||||||
|
$vendor_notes = nullable_htmlentities($row['vendor_notes']);
|
||||||
|
$vendor_template_id = intval($row['vendor_template_id']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fas fa-fw fa-building mr-2"></i>Editing vendor: <strong><?php echo $vendor_name; ?></strong></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="vendor_id" value="<?php echo $vendor_id; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<ul class="nav nav-pills nav-justified mb-3">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" data-toggle="pill" href="#pills-details<?php echo $vendor_id; ?>">Details</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-support<?php echo $vendor_id; ?>">Support</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-notes<?php echo $vendor_id; ?>">Notes</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="tab-content">
|
||||||
|
|
||||||
|
<div class="tab-pane fade show active" id="pills-details<?php echo $vendor_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Vendor Name <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-building"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="name" placeholder="Vendor Name" maxlength="200" value="<?php echo "$vendor_name"; ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="description" placeholder="Description" maxlength="200" value="<?php echo $vendor_description; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Account Number</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-fingerprint"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="account_number" placeholder="Account number" maxlength="200" value="<?php echo $vendor_account_number; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Account Manager</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="contact_name" maxlength="200" value="<?php echo $vendor_contact_name; ?>" placeholder="Vendor contact name">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Template Base</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-puzzle-piece"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="vendor_template_id">
|
||||||
|
<option value="0">- None -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_vendor_templates = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_template = 1 AND vendor_archived_at IS NULL ORDER BY vendor_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_vendor_templates)) {
|
||||||
|
$vendor_template_id_select = $row['vendor_id'];
|
||||||
|
$vendor_template_name_select = nullable_htmlentities($row['vendor_name']); ?>
|
||||||
|
<option <?php if ($vendor_template_id == $vendor_template_id_select) { echo "selected"; } ?> value="<?php echo $vendor_template_id_select; ?>"><?php echo $vendor_template_name_select; ?></option>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-support<?php echo $vendor_id; ?>">
|
||||||
|
|
||||||
|
<label>Support Phone / <span class="text-secondary">Extension</span></label>
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="col-9">
|
||||||
|
<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="tel" class="form-control col-2" name="phone_country_code" value="<?php echo "+$vendor_phone_country_code"; ?>" placeholder="Code" maxlength="4">
|
||||||
|
<input type="tel" class="form-control" name="phone" value="<?php echo $vendor_phone; ?>" placeholder="Phone Number" maxlength="200">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="text" class="form-control" name="extension" value="<?php echo $vendor_extension; ?>" placeholder="ext." maxlength="200">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Support Hours</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="hours" placeholder="Support Hours" maxlength="200" value="<?php echo $vendor_hours; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Support Email</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-envelope"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="email" class="form-control" name="email" placeholder="Support Email" maxlength="200" value="<?php echo $vendor_email; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Support Website URL</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-globe"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="website" placeholder="Do not include http(s)://" maxlength="200" value="<?php echo $vendor_website; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>SLA</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-handshake"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="sla" placeholder="SLA Response Time" maxlength="200" value="<?php echo $vendor_sla; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Pin/Code</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-key"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="code" placeholder="Access Code or Pin" maxlength="200" value="<?php echo $vendor_code; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-notes<?php echo $vendor_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="form-control" rows="12" placeholder="Enter some notes" name="notes"><?php echo $vendor_notes; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="text-muted text-right">Vendor ID: <?= $vendor_id ?></p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="edit_vendor" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
251
ajax/ajax_vendor_template_edit.php
Normal file
251
ajax/ajax_vendor_template_edit.php
Normal file
@@ -0,0 +1,251 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$vendor_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_id = $vendor_id LIMIT 1");
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$vendor_name = nullable_htmlentities($row['vendor_name']);
|
||||||
|
$vendor_description = nullable_htmlentities($row['vendor_description']);
|
||||||
|
$vendor_account_number = nullable_htmlentities($row['vendor_account_number']);
|
||||||
|
$vendor_contact_name = nullable_htmlentities($row['vendor_contact_name']);
|
||||||
|
$vendor_phone = formatPhoneNumber($row['vendor_phone']);
|
||||||
|
$vendor_extension = nullable_htmlentities($row['vendor_extension']);
|
||||||
|
$vendor_email = nullable_htmlentities($row['vendor_email']);
|
||||||
|
$vendor_website = nullable_htmlentities($row['vendor_website']);
|
||||||
|
$vendor_hours = nullable_htmlentities($row['vendor_hours']);
|
||||||
|
$vendor_sla = nullable_htmlentities($row['vendor_sla']);
|
||||||
|
$vendor_code = nullable_htmlentities($row['vendor_code']);
|
||||||
|
$vendor_notes = nullable_htmlentities($row['vendor_notes']);
|
||||||
|
$vendor_template = intval($row['vendor_template']);
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fas fa-fw fa-building mr-2"></i>Editing vendor template: <strong><?php echo $vendor_name; ?></strong></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="vendor_id" value="<?php echo $vendor_id; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<ul class="nav nav-pills nav-justified mb-3">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" data-toggle="pill" href="#pills-details<?php echo $vendor_id; ?>">Details</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-support<?php echo $vendor_id; ?>">Support</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-notes<?php echo $vendor_id; ?>">Notes</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="alert alert-info">Check the fields you would like to update globally</div>
|
||||||
|
|
||||||
|
<div class="tab-content">
|
||||||
|
|
||||||
|
<div class="tab-pane fade show active" id="pills-details<?php echo $vendor_id; ?>">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Vendor Name <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-building"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="name" placeholder="Vendor Name" maxlength="200" value="<?php echo "$vendor_name"; ?>" required>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<div class="input-group-text">
|
||||||
|
<input type="checkbox" name="global_update_vendor_name" value="1">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="description" placeholder="Description" maxlength="200" value="<?php echo $vendor_description; ?>">
|
||||||
|
<div class="input-group-append">
|
||||||
|
<div class="input-group-text">
|
||||||
|
<input type="checkbox" name="global_update_vendor_description" value="1">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Account Number</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-fingerprint"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="account_number" placeholder="Account number" maxlength="200" value="<?php echo $vendor_account_number; ?>">
|
||||||
|
<div class="input-group-append">
|
||||||
|
<div class="input-group-text">
|
||||||
|
<input type="checkbox" name="global_update_vendor_account_number" value="1">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Account Manager</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="contact_name" maxlength="200" value="<?php echo $vendor_contact_name; ?>" placeholder="Vendor contact name">
|
||||||
|
<div class="input-group-append">
|
||||||
|
<div class="input-group-text">
|
||||||
|
<input type="checkbox" name="global_update_vendor_contact_name" value="1">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="custom-control custom-checkbox">
|
||||||
|
<input type="checkbox" class="custom-control-input" id="updateVendorsCheckbox<?php echo $vendor_id; ?>" name="update_base_vendors" value="1" >
|
||||||
|
<label class="custom-control-label" for="updateVendorsCheckbox<?php echo $vendor_id; ?>">Update All Base Vendors</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-support<?php echo $vendor_id; ?>">
|
||||||
|
|
||||||
|
<label>Support Phone</label>
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="col-8">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-phone"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="tel" class="form-control" name="phone" value="<?php echo $vendor_phone; ?>">
|
||||||
|
<div class="input-group-append">
|
||||||
|
<div class="input-group-text">
|
||||||
|
<input type="checkbox" name="global_update_vendor_phone" value="1">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-4">
|
||||||
|
<input type="text" class="form-control" name="extension" placeholder="Prompts" maxlength="200" value="<?php echo $vendor_extension; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Support Hours</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="hours" placeholder="Support Hours" maxlength="200" value="<?php echo $vendor_hours; ?>">
|
||||||
|
<div class="input-group-append">
|
||||||
|
<div class="input-group-text">
|
||||||
|
<input type="checkbox" name="global_update_vendor_hours" value="1">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Support Email</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-envelope"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="email" class="form-control" name="email" placeholder="Support Email" maxlength="200" value="<?php echo $vendor_email; ?>">
|
||||||
|
<div class="input-group-append">
|
||||||
|
<div class="input-group-text">
|
||||||
|
<input type="checkbox" name="global_update_vendor_email" value="1">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Support Website URL</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-globe"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="website" placeholder="Do not include http(s)://" maxlength="200" value="<?php echo $vendor_website; ?>">
|
||||||
|
<div class="input-group-append">
|
||||||
|
<div class="input-group-text">
|
||||||
|
<input type="checkbox" name="global_update_vendor_website" value="1">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>SLA</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-handshake"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="sla" placeholder="SLA Response Time" maxlength="200" value="<?php echo $vendor_sla; ?>">
|
||||||
|
<div class="input-group-append">
|
||||||
|
<div class="input-group-text">
|
||||||
|
<input type="checkbox" name="global_update_vendor_sla" value="1">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Pin/Code</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-key"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="code" placeholder="Access Code or Pin" maxlength="200" value="<?php echo $vendor_code; ?>">
|
||||||
|
<div class="input-group-append">
|
||||||
|
<div class="input-group-text">
|
||||||
|
<input type="checkbox" name="global_update_vendor_code" value="1">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-notes<?php echo $vendor_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="notes"><?php echo $vendor_notes; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Update Notes Globally?</label>
|
||||||
|
<input type="checkbox" name="global_update_vendor_notes" value="1">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" class="btn btn-primary text-bold" name="edit_vendor_template"><i class="fa fa-check mr-2"></i>Update Template</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
@@ -20,7 +20,7 @@ if (!empty($name) && !empty($client_id)) {
|
|||||||
$insert_id = mysqli_insert_id($mysqli);
|
$insert_id = mysqli_insert_id($mysqli);
|
||||||
|
|
||||||
// Add Primary Interface
|
// Add Primary Interface
|
||||||
mysqli_query($mysqli,"INSERT INTO asset_interfaces SET interface_name = 'Primary', interface_mac = '$mac', interface_ip = '$ip', interface_port = 'eth0', interface_primary = 1, interface_network_id = $network, interface_asset_id = $insert_id");
|
mysqli_query($mysqli,"INSERT INTO asset_interfaces SET interface_name = '1', interface_mac = '$mac', interface_ip = '$ip', interface_primary = 1, interface_network_id = $network, interface_asset_id = $insert_id");
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
logAction("Asset", "Create", "$name via API ($api_key_name)", $client_id, $insert_id);
|
logAction("Asset", "Create", "$name via API ($api_key_name)", $client_id, $insert_id);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ $insert_id = false;
|
|||||||
if (!empty($api_key_decrypt_password) && !empty($name) && !(empty($password))) {
|
if (!empty($api_key_decrypt_password) && !empty($name) && !(empty($password))) {
|
||||||
|
|
||||||
// Add credential
|
// Add credential
|
||||||
$insert_sql = mysqli_query($mysqli,"INSERT INTO logins SET login_name = '$name', login_description = '$description', login_uri = '$uri', login_uri_2 = '$uri_2', login_username = '$username', login_password = '$password', login_otp_secret = '$otp_secret', login_note = '$note', login_important = $important, login_contact_id = $contact_id, login_vendor_id = $vendor_id, login_asset_id = $asset_id, login_software_id = $software_id, login_client_id = $client_id");
|
$insert_sql = mysqli_query($mysqli,"INSERT INTO credentials SET credential_name = '$name', credential_description = '$description', credential_uri = '$uri', credential_uri_2 = '$uri_2', credential_username = '$username', credential_password = '$password', credential_otp_secret = '$otp_secret', credential_note = '$note', credential_important = $important, credential_contact_id = $contact_id, credential_vendor_id = $vendor_id, credential_asset_id = $asset_id, credential_software_id = $software_id, credential_client_id = $client_id");
|
||||||
|
|
||||||
// Check insert & get insert ID
|
// Check insert & get insert ID
|
||||||
if ($insert_sql) {
|
if ($insert_sql) {
|
||||||
|
|||||||
@@ -8,53 +8,53 @@ if (isset($_POST['api_key_decrypt_password'])) {
|
|||||||
$api_key_decrypt_password = $_POST['api_key_decrypt_password']; // No sanitization
|
$api_key_decrypt_password = $_POST['api_key_decrypt_password']; // No sanitization
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['login_name'])) {
|
if (isset($_POST['credential_name'])) {
|
||||||
$name = sanitizeInput($_POST['login_name']);
|
$name = sanitizeInput($_POST['credential_name']);
|
||||||
} elseif (isset($credential_row) && isset($credential_row['login_name'])) {
|
} elseif (isset($credential_row) && isset($credential_row['credential_name'])) {
|
||||||
$name = $credential_row['login_name'];
|
$name = $credential_row['credential_name'];
|
||||||
} else {
|
} else {
|
||||||
$name = '';
|
$name = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['login_description'])) {
|
if (isset($_POST['credential_description'])) {
|
||||||
$description = sanitizeInput($_POST['login_description']);
|
$description = sanitizeInput($_POST['credential_description']);
|
||||||
} elseif (isset($credential_row) && isset($credential_row['login_description'])) {
|
} elseif (isset($credential_row) && isset($credential_row['credential_description'])) {
|
||||||
$description = $credential_row['login_description'];
|
$description = $credential_row['credential_description'];
|
||||||
} else {
|
} else {
|
||||||
$description = '';
|
$description = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['login_uri'])) {
|
if (isset($_POST['credential_uri'])) {
|
||||||
$uri = sanitizeInput($_POST['login_uri']);
|
$uri = sanitizeInput($_POST['credential_uri']);
|
||||||
} elseif (isset($credential_row) && isset($credential_row['login_uri'])) {
|
} elseif (isset($credential_row) && isset($credential_row['credential_uri'])) {
|
||||||
$uri = $credential_row['login_uri'];
|
$uri = $credential_row['credential_uri'];
|
||||||
} else {
|
} else {
|
||||||
$uri = '';
|
$uri = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['login_uri_2'])) {
|
if (isset($_POST['credential_uri_2'])) {
|
||||||
$uri_2 = sanitizeInput($_POST['login_uri_2']);
|
$uri_2 = sanitizeInput($_POST['credential_uri_2']);
|
||||||
} elseif (isset($credential_row) && isset($credential_row['login_uri_2'])) {
|
} elseif (isset($credential_row) && isset($credential_row['credential_uri_2'])) {
|
||||||
$uri_2 = $credential_row['login_uri_2'];
|
$uri_2 = $credential_row['credential_uri_2'];
|
||||||
} else {
|
} else {
|
||||||
$uri_2 = '';
|
$uri_2 = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['login_username'])) {
|
if (isset($_POST['credential_username'])) {
|
||||||
$username = $_POST['login_username'];
|
$username = $_POST['credential_username'];
|
||||||
$username = apiEncryptLoginEntry($username, $api_key_decrypt_hash, $api_key_decrypt_password);
|
$username = apiEncryptLoginEntry($username, $api_key_decrypt_hash, $api_key_decrypt_password);
|
||||||
} elseif (isset($credential_row) && isset($credential_row['login_username'])) {
|
} elseif (isset($credential_row) && isset($credential_row['credential_username'])) {
|
||||||
$username = $credential_row['login_username'];
|
$username = $credential_row['credential_username'];
|
||||||
} else {
|
} else {
|
||||||
$username = '';
|
$username = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['login_password'])) {
|
if (isset($_POST['credential_password'])) {
|
||||||
$password = $_POST['login_password'];
|
$password = $_POST['credential_password'];
|
||||||
$password = apiEncryptLoginEntry($password, $api_key_decrypt_hash, $api_key_decrypt_password);
|
$password = apiEncryptLoginEntry($password, $api_key_decrypt_hash, $api_key_decrypt_password);
|
||||||
$password_changed = true;
|
$password_changed = true;
|
||||||
} elseif (isset($credential_row) && isset($credential_row['login_password'])) {
|
} elseif (isset($credential_row) && isset($credential_row['credential_password'])) {
|
||||||
$password = $credential_row['login_password'];
|
$password = $credential_row['credential_password'];
|
||||||
$password_changed = false;
|
$password_changed = false;
|
||||||
} else {
|
} else {
|
||||||
$password = '';
|
$password = '';
|
||||||
@@ -63,58 +63,58 @@ if (isset($_POST['login_password'])) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (isset($_POST['login_otp_secret'])) {
|
if (isset($_POST['credential_otp_secret'])) {
|
||||||
$otp_secret = sanitizeInput($_POST['login_otp_secret']);
|
$otp_secret = sanitizeInput($_POST['credential_otp_secret']);
|
||||||
} elseif (isset($credential_row) && isset($credential_row['login_otp_secret'])) {
|
} elseif (isset($credential_row) && isset($credential_row['credential_otp_secret'])) {
|
||||||
$otp_secret = $credential_row['login_otp_secret'];
|
$otp_secret = $credential_row['credential_otp_secret'];
|
||||||
} else {
|
} else {
|
||||||
$otp_secret = '';
|
$otp_secret = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['login_note'])) {
|
if (isset($_POST['credential_note'])) {
|
||||||
$note = sanitizeInput($_POST['login_note']);
|
$note = sanitizeInput($_POST['credential_note']);
|
||||||
} elseif (isset($credential_row) && isset($credential_row['login_note'])) {
|
} elseif (isset($credential_row) && isset($credential_row['credential_note'])) {
|
||||||
$note = $credential_row['login_note'];
|
$note = $credential_row['credential_note'];
|
||||||
} else {
|
} else {
|
||||||
$note = '';
|
$note = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['login_important'])) {
|
if (isset($_POST['credential_important'])) {
|
||||||
$important = intval($_POST['login_important']);
|
$important = intval($_POST['credential_important']);
|
||||||
} elseif (isset($credential_row) && isset($credential_row['login_important'])) {
|
} elseif (isset($credential_row) && isset($credential_row['credential_important'])) {
|
||||||
$important = $credential_row['login_important'];
|
$important = $credential_row['credential_important'];
|
||||||
} else {
|
} else {
|
||||||
$important = '';
|
$important = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['login_contact_id'])) {
|
if (isset($_POST['credential_contact_id'])) {
|
||||||
$contact_id = intval($_POST['login_contact_id']);
|
$contact_id = intval($_POST['credential_contact_id']);
|
||||||
} elseif (isset($credential_row) && isset($credential_row['login_contact_id'])) {
|
} elseif (isset($credential_row) && isset($credential_row['credential_contact_id'])) {
|
||||||
$contact_id = $credential_row['login_contact_id'];
|
$contact_id = $credential_row['credential_contact_id'];
|
||||||
} else {
|
} else {
|
||||||
$contact_id = '';
|
$contact_id = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['login_vendor_id'])) {
|
if (isset($_POST['credential_vendor_id'])) {
|
||||||
$vendor_id = intval($_POST['login_vendor_id']);
|
$vendor_id = intval($_POST['credential_vendor_id']);
|
||||||
} elseif (isset($credential_row) && isset($credential_row['login_vendor_id'])) {
|
} elseif (isset($credential_row) && isset($credential_row['credential_vendor_id'])) {
|
||||||
$vendor_id = $credential_row['login_vendor_id'];
|
$vendor_id = $credential_row['credential_vendor_id'];
|
||||||
} else {
|
} else {
|
||||||
$vendor_id = '';
|
$vendor_id = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['login_asset_id'])) {
|
if (isset($_POST['credential_asset_id'])) {
|
||||||
$asset_id = intval($_POST['login_asset_id']);
|
$asset_id = intval($_POST['credential_asset_id']);
|
||||||
} elseif (isset($credential_row) && isset($credential_row['login_asset_id'])) {
|
} elseif (isset($credential_row) && isset($credential_row['credential_asset_id'])) {
|
||||||
$asset_id = $credential_row['login_asset_id'];
|
$asset_id = $credential_row['credential_asset_id'];
|
||||||
} else {
|
} else {
|
||||||
$asset_id = '';
|
$asset_id = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['login_software_id'])) {
|
if (isset($_POST['credential_software_id'])) {
|
||||||
$software_id = intval($_POST['login_software_id']);
|
$software_id = intval($_POST['credential_software_id']);
|
||||||
} elseif (isset($credential_row) && isset($credential_row['login_software_id'])) {
|
} elseif (isset($credential_row) && isset($credential_row['credential_software_id'])) {
|
||||||
$software_id = $credential_row['login_software_id'];
|
$software_id = $credential_row['credential_software_id'];
|
||||||
} else {
|
} else {
|
||||||
$software_id = '';
|
$software_id = '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,17 +13,17 @@ if (isset($_GET['api_key_decrypt_password'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Specific credential/login via ID (single)
|
// Specific credential/login via ID (single)
|
||||||
if (isset($_GET['login_id']) && !empty($api_key_decrypt_password)) {
|
if (isset($_GET['credential_id']) && !empty($api_key_decrypt_password)) {
|
||||||
|
|
||||||
$id = intval($_GET['login_id']);
|
$id = intval($_GET['credential_id']);
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM logins WHERE login_id = '$id' AND login_client_id LIKE '$client_id' LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM credentials WHERE credential_id = '$id' AND credential_client_id LIKE '$client_id' LIMIT 1");
|
||||||
|
|
||||||
|
|
||||||
} elseif (!empty($api_key_decrypt_password)) {
|
} elseif (!empty($api_key_decrypt_password)) {
|
||||||
// All credentials ("logins")
|
// All credentials ("credentials")
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM logins WHERE login_client_id LIKE '$client_id' ORDER BY login_id LIMIT $limit OFFSET $offset");
|
$sql = mysqli_query($mysqli, "SELECT * FROM credentials WHERE credential_client_id LIKE '$client_id' ORDER BY credential_id LIMIT $limit OFFSET $offset");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,8 +37,8 @@ if ($sql && mysqli_num_rows($sql) > 0) {
|
|||||||
|
|
||||||
$row = array();
|
$row = array();
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
$row['login_username'] = apiDecryptLoginEntry($row['login_username'], $api_key_decrypt_hash, $api_key_decrypt_password);
|
$row['credential_username'] = apiDecryptCredentialEntry($row['credential_username'], $api_key_decrypt_hash, $api_key_decrypt_password);
|
||||||
$row['login_password'] = apiDecryptLoginEntry($row['login_password'], $api_key_decrypt_hash, $api_key_decrypt_password);
|
$row['credential_password'] = apiDecryptCredentialEntry($row['credential_password'], $api_key_decrypt_hash, $api_key_decrypt_password);
|
||||||
$return_arr['data'][] = $row;
|
$return_arr['data'][] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,30 +5,30 @@ require_once '../validate_api_key.php';
|
|||||||
require_once '../require_post_method.php';
|
require_once '../require_post_method.php';
|
||||||
|
|
||||||
// Parse ID
|
// Parse ID
|
||||||
$login_id = intval($_POST['login_id']);
|
$credential_id = intval($_POST['credential_id']);
|
||||||
|
|
||||||
// Default
|
// Default
|
||||||
$update_count = false;
|
$update_count = false;
|
||||||
|
|
||||||
if (!empty($_POST['api_key_decrypt_password']) && !empty($login_id)) {
|
if (!empty($_POST['api_key_decrypt_password']) && !empty($credential_id)) {
|
||||||
|
|
||||||
$credential_row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT * FROM logins WHERE login_id = '$login_id' AND login_client_id = $client_id LIMIT 1"));
|
$credential_row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT * FROM credentials WHERE credential_id = '$credential_id' AND credential_client_id = $client_id LIMIT 1"));
|
||||||
|
|
||||||
// Variable assignment from POST - assigning the current database value if a value is not provided
|
// Variable assignment from POST - assigning the current database value if a value is not provided
|
||||||
require_once 'credential_model.php';
|
require_once 'credential_model.php';
|
||||||
|
|
||||||
$update_sql = mysqli_query($mysqli,"UPDATE logins SET login_name = '$name', login_description = '$description', login_uri = '$uri', login_uri_2 = '$uri_2', login_username = '$username', login_password = '$password', login_otp_secret = '$otp_secret', login_note = '$note', login_important = $important, login_contact_id = $contact_id, login_vendor_id = $vendor_id, login_asset_id = $asset_id, login_software_id = $software_id, login_client_id = $client_id WHERE login_id = '$login_id' AND login_client_id = $client_id LIMIT 1");
|
$update_sql = mysqli_query($mysqli,"UPDATE credentials SET credential_name = '$name', credential_description = '$description', credential_uri = '$uri', credential_uri_2 = '$uri_2', credential_username = '$username', credential_password = '$password', credential_otp_secret = '$otp_secret', credential_note = '$note', credential_important = $important, credential_contact_id = $contact_id, credential_vendor_id = $vendor_id, credential_asset_id = $asset_id, credential_software_id = $software_id, credential_client_id = $client_id WHERE credential_id = '$credential_id' AND credential_client_id = $client_id LIMIT 1");
|
||||||
|
|
||||||
// Check insert & get insert ID
|
// Check insert & get insert ID
|
||||||
if ($update_sql) {
|
if ($update_sql) {
|
||||||
$update_count = mysqli_affected_rows($mysqli);
|
$update_count = mysqli_affected_rows($mysqli);
|
||||||
|
|
||||||
if ($password_changed) {
|
if ($password_changed) {
|
||||||
mysqli_query($mysqli, "UPDATE logins SET login_password_changed_at = NOW() WHERE login_id = $login_id LIMIT 1");
|
mysqli_query($mysqli, "UPDATE credentials SET credential_password_changed_at = NOW() WHERE credential_id = $credential_id LIMIT 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
logAction("Credential", "Edit", "$name via API ($api_key_name)", $client_id, $login_id);
|
logAction("Credential", "Edit", "$name via API ($api_key_name)", $client_id, $credential_id);
|
||||||
logAction("API", "Success", "Updated credential $name via API ($api_key_name)", $client_id);
|
logAction("API", "Success", "Updated credential $name via API ($api_key_name)", $client_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user