mirror of
https://github.com/itflow-org/itflow
synced 2026-03-10 15:54:51 +00:00
Compare commits
503 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
939b07422d | ||
|
|
88369d480a | ||
|
|
cf083e94e6 | ||
|
|
11e8f5acfc | ||
|
|
77b3a89eb2 | ||
|
|
f572f4265a | ||
|
|
0b66c8e1be | ||
|
|
a8328a3f56 | ||
|
|
8b42b17121 | ||
|
|
db418ce662 | ||
|
|
96fe566e08 | ||
|
|
a00f26d8a4 | ||
|
|
eeef63d1c3 | ||
|
|
0b88ea85ae | ||
|
|
c564118156 | ||
|
|
01a7dc2068 | ||
|
|
bb44ecec3f | ||
|
|
b7b24d7de6 | ||
|
|
dcca93e34f | ||
|
|
4124188505 | ||
|
|
eb5d59623b | ||
|
|
8631c06731 | ||
|
|
40eb40fd86 | ||
|
|
c486682a0e | ||
|
|
336da073f1 | ||
|
|
d2e187a239 | ||
|
|
f69de29353 | ||
|
|
61de8bc792 | ||
|
|
d31f19707b | ||
|
|
811312466f | ||
|
|
5ecfb3e962 | ||
|
|
77be5af4e5 | ||
|
|
c512a716d2 | ||
|
|
14f5630caf | ||
|
|
8532bdc172 | ||
|
|
9d74bf8e19 | ||
|
|
f75445b4d0 | ||
|
|
e04fa1b696 | ||
|
|
e07dfb5f67 | ||
|
|
3d1af05fc2 | ||
|
|
0e38925d74 | ||
|
|
c0f3343412 | ||
|
|
6a368840fa | ||
|
|
5361391b3b | ||
|
|
b80662bb24 | ||
|
|
4c272b6b8d | ||
|
|
96abdef3ad | ||
|
|
0b04bc79e9 | ||
|
|
cefbbdc3a8 | ||
|
|
83ffe05a99 | ||
|
|
b6f73083ef | ||
|
|
693736023e | ||
|
|
fed87c93ab | ||
|
|
f53b77b556 | ||
|
|
b858d82b0b | ||
|
|
ccb2af6d17 | ||
|
|
8d937ac8f5 | ||
|
|
2786fb65ed | ||
|
|
025532f579 | ||
|
|
5bd03be1ad | ||
|
|
40086f1ce0 | ||
|
|
be66ad9a4c | ||
|
|
0df5c01bb7 | ||
|
|
b85fa38b67 | ||
|
|
546246d7c5 | ||
|
|
d5536e78f4 | ||
|
|
908738b7ca | ||
|
|
797e02bffa | ||
|
|
d856685782 | ||
|
|
1400983d8c | ||
|
|
2a43c5d868 | ||
|
|
a67675c649 | ||
|
|
fc344ef636 | ||
|
|
2ffb2be083 | ||
|
|
069772f27d | ||
|
|
241ec50802 | ||
|
|
b943c9cd89 | ||
|
|
80625f8c3f | ||
|
|
58435d3460 | ||
|
|
7a7ac4a47f | ||
|
|
429dfa5ca4 | ||
|
|
e1f212d30d | ||
|
|
670450bcfb | ||
|
|
83e15e9e4a | ||
|
|
b309081d75 | ||
|
|
f1a7b35aa6 | ||
|
|
469c5ef06d | ||
|
|
07cbe561bd | ||
|
|
b69a70cfc3 | ||
|
|
923001928c | ||
|
|
75ed461c67 | ||
|
|
691aebce91 | ||
|
|
846947ff49 | ||
|
|
65e107d154 | ||
|
|
19b809b699 | ||
|
|
60fe02bb47 | ||
|
|
3e708059c6 | ||
|
|
424104bb66 | ||
|
|
62696b9ebe | ||
|
|
87403e8c2d | ||
|
|
7a5a607ff6 | ||
|
|
a195774726 | ||
|
|
8d0da7b55b | ||
|
|
58c315cd09 | ||
|
|
dd6c4602db | ||
|
|
d413e0c8ff | ||
|
|
b356658635 | ||
|
|
d92f0fc49b | ||
|
|
f206a28cf7 | ||
|
|
70cb0ac635 | ||
|
|
a0ece18876 | ||
|
|
4a22b03952 | ||
|
|
5ebf797c90 | ||
|
|
a20759f1f2 | ||
|
|
c273cab36e | ||
|
|
8306a04eda | ||
|
|
f078203136 | ||
|
|
15e89c3c4e | ||
|
|
595c4f1440 | ||
|
|
91a523dc23 | ||
|
|
8567c97c09 | ||
|
|
3621e99c61 | ||
|
|
d99b9cbe68 | ||
|
|
e319768fd3 | ||
|
|
c30ffcf096 | ||
|
|
7286248fef | ||
|
|
dc49f80cc3 | ||
|
|
1ae2da8054 | ||
|
|
090f4cb560 | ||
|
|
0914716b8e | ||
|
|
ab463c1773 | ||
|
|
36af4d11fc | ||
|
|
14d8dc6fa6 | ||
|
|
2032b48ad3 | ||
|
|
2af795f548 | ||
|
|
7b4edb2948 | ||
|
|
17a906fd03 | ||
|
|
af46a1fd96 | ||
|
|
393c0b8c11 | ||
|
|
e92f2f714d | ||
|
|
42606067c0 | ||
|
|
98bb65509d | ||
|
|
a2599e5d43 | ||
|
|
0390b1bc2a | ||
|
|
531f3ec741 | ||
|
|
127afdca0d | ||
|
|
c4df5bf988 | ||
|
|
30234e044d | ||
|
|
1e98ee8916 | ||
|
|
d5665c2577 | ||
|
|
762ec51a19 | ||
|
|
309ad724ec | ||
|
|
34397fe468 | ||
|
|
2f82647f5e | ||
|
|
7d7854424c | ||
|
|
eaeadbe933 | ||
|
|
cf3f0cee6c | ||
|
|
a5f7b7fa9c | ||
|
|
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
|
||||||
|
|||||||
226
CHANGELOG.md
226
CHANGELOG.md
@@ -2,6 +2,232 @@
|
|||||||
|
|
||||||
This file documents all notable changes made to ITFlow.
|
This file documents all notable changes made to ITFlow.
|
||||||
|
|
||||||
|
## [25.05]
|
||||||
|
|
||||||
|
### Added / Changed
|
||||||
|
- Expanded file upload allow-list to include .bat and .stk file types.
|
||||||
|
- Added full backup/restore functionality. Backup downloads a zip that includes the SQL dump and uploads folder, setup now has option to restore from zip backup.
|
||||||
|
- Migrated Asset and Contact Links to modals to resolve variable overlap issue.
|
||||||
|
- Added Pagination to Notification Modal.
|
||||||
|
- Removed 500 Records Per Page option.
|
||||||
|
- Removed unused old DB checks in the top nav.
|
||||||
|
- Clients can now use the portal to setup Stripe automatic payments themselves for recurring invoices
|
||||||
|
- Automatic payments are now disabled for all recurring invoices if the saved payment method is removed
|
||||||
|
- Added Card Details and Payment added to Client Stripe.
|
||||||
|
- UI / UX updates to guest pay Make use of cards.
|
||||||
|
- Don't show Checkbox columns when ticket is closed, compact ticket list now matches round pills for status and priority.
|
||||||
|
- Ticket UI/UX update allow the ticket toolbar to be a little more mobile-friendly
|
||||||
|
- UI / UX Updates to Expenses - Combine Category and Description into 1 column.
|
||||||
|
- Country information is now displayed in Invoices, Quotes, Recurring Invoices, Clients, Locations, and the client top header.
|
||||||
|
- Added country-based search filters in Locations and Clients sections.
|
||||||
|
- Changed the settings name from Integrations to Identity Providers to make room for future iDPs (e.g. Google).
|
||||||
|
- Bump FullCalendar from 6.1.15 to 6.1.17.
|
||||||
|
- Bump DataTables from 2.2.2 to 2.3.1.
|
||||||
|
- Bump TCPDF from 6.8.2 to 6.9.4.
|
||||||
|
- Bump tinyMCE from 7.7.1 to 7.9.0.
|
||||||
|
- Bump phpMailer from 6.9.2 to 6.10.0.
|
||||||
|
- Bump stripe-php from 16.4.0 to 17.2.1.
|
||||||
|
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- "None" option for SMTP encryption now functions correctly.
|
||||||
|
- Debug table row counts now reflect actual counts instead of relying on SHOW TABLE STATUS.
|
||||||
|
- Archived Categories now display properly.
|
||||||
|
- Stripe saved payment methods are now limited to credit/debit cards only.
|
||||||
|
|
||||||
|
## [25.03.6]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Set default to date to 2035-12-31 as 9999-12-31 and 2999-12-31 broke certain browsers.
|
||||||
|
- Update Client PDF Export, add header added company logo.
|
||||||
|
- Present Larger clearer Warning about updates on update page.
|
||||||
|
- Allow to search by project reference.
|
||||||
|
|
||||||
|
## [25.03.5]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Fixed the user listing issue when copying a trip.
|
||||||
|
- Corrected the display of recurring invoice amounts on the dashboard.
|
||||||
|
- Fixed the linking of entities with assets and contacts.
|
||||||
|
- Resolved the issue with displaying the correct mobile country code in the contact listing.
|
||||||
|
- Set the default date to `9999-12-31` to ensure future items (like invoices) are displayed by default.
|
||||||
|
- Fixed the display issue where file folders were not showing properly during document creation.
|
||||||
|
- Migrated from Dragula to SortableJS for a more modern, mobile-friendly solution.
|
||||||
|
- Added Handlebars icons for drag-and-drop items.
|
||||||
|
- Changed behavior to open Contact and Asset Details pages directly instead of using a modal.
|
||||||
|
|
||||||
|
## [25.03.4]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Ability to remove additional assets from the ticket details screen.
|
||||||
|
- Fix the ability to remove assets from edit ticket not working when only 1 asset exists.
|
||||||
|
- Fix Database Backup corruption.
|
||||||
|
- Client Portal - show ticket number instead of ticket id in ticket listing.
|
||||||
|
- Add Purchase Reference to copy asset.
|
||||||
|
- Add Link to asset details from the global search.
|
||||||
|
- Fix Bulk assign ticket only showing contacts instead of ITFlow users.
|
||||||
|
|
||||||
|
|
||||||
|
## [25.03.3]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Fix adding ITFlow user.
|
||||||
|
- Do not alert on inactive recurring invoices.
|
||||||
|
- Fix ticket user assignment including bulk assignment.
|
||||||
|
- Fix adding a location phone extension.
|
||||||
|
- Do not default to +1 Country code, instead default to null.
|
||||||
|
- Do not format numbers unless a country code is entered.
|
||||||
|
- Fix editing network location.
|
||||||
|
- Fix ticket redaction on client replies.
|
||||||
|
- Remove more from user activity as it requires admin privledges.
|
||||||
|
- Fix MFA Enforcement page.
|
||||||
|
|
||||||
|
## [25.03.2]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Revert DB.sql change
|
||||||
|
|
||||||
|
## [25.03.1]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Phone number missing in various sections.
|
||||||
|
- Match Database.
|
||||||
|
- Client Export Only display licenses users and assets from the selected client only.
|
||||||
|
|
||||||
|
## [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.
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ If you want to improve ITFlow, feel free to fork the repo and create a pull requ
|
|||||||
We’re incredibly grateful to the organizations and individuals who support the project - a big thank you to:
|
We’re incredibly grateful to the organizations and individuals who support the project - a big thank you to:
|
||||||
- CompuMatter
|
- CompuMatter
|
||||||
- F1 for HELP
|
- F1 for HELP
|
||||||
|
- JetBrains (PhpStorm)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
ITFlow is distributed "as is" under the GPL License, WITHOUT WARRANTY OF ANY KIND. See [`LICENSE`](https://github.com/itflow-org/itflow/blob/master/LICENSE) for details.
|
ITFlow is distributed "as is" under the GPL License, WITHOUT WARRANTY OF ANY KIND. See [`LICENSE`](https://github.com/itflow-org/itflow/blob/master/LICENSE) for details.
|
||||||
|
|||||||
@@ -12,10 +12,8 @@
|
|||||||
We operate a rolling release model. Any bug fixes will be released into latest version of ITFlow, so you must stay up-to-date.
|
We operate a rolling release model. Any bug fixes will be released into latest version of ITFlow, so you must stay up-to-date.
|
||||||
|
|
||||||
| Version | Supported |
|
| Version | Supported |
|
||||||
| ------- | ------------------ |
|
|---------| ------------------ |
|
||||||
| Beta | :x: |
|
| 25.05 | :white_check_mark: |
|
||||||
| 24.12 | :white_check_mark: |
|
|
||||||
| 25.1 | :white_check_mark: (When released) |
|
|
||||||
|
|
||||||
## Reporting a Vulnerability via GitHub Security Advisories
|
## Reporting a Vulnerability via GitHub Security Advisories
|
||||||
|
|
||||||
|
|||||||
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";
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@@ -48,14 +48,16 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<h3 class="card-title"><i class="fas fa-fw fa-history mr-2"></i>App Logs</h3>
|
<h3 class="card-title"><i class="fas fa-fw fa-history mr-2"></i>App Logs</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form class="mb-4" autocomplete="off">
|
<form autocomplete="off">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<div class="input-group">
|
<div class="form-group">
|
||||||
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search app logs">
|
<div class="input-group">
|
||||||
<div class="input-group-append">
|
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search app logs">
|
||||||
<button class="btn btn-secondary" type="button" data-toggle="collapse" data-target="#advancedFilter"><i class="fas fa-filter"></i></button>
|
<div class="input-group-append">
|
||||||
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
|
<button class="btn btn-secondary" type="button" data-toggle="collapse" data-target="#advancedFilter"><i class="fas fa-filter"></i></button>
|
||||||
|
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<form class="mb-4" autocomplete="off">
|
<form class="mb-4" autocomplete="off">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<div class="input-group">
|
<div class="input-group mb-3 mb-md-0">
|
||||||
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search audit logs">
|
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search audit logs">
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<button class="btn btn-secondary" type="button" data-toggle="collapse" data-target="#advancedFilter"><i class="fas fa-filter"></i></button>
|
<button class="btn btn-secondary" type="button" data-toggle="collapse" data-target="#advancedFilter"><i class="fas fa-filter"></i></button>
|
||||||
@@ -85,7 +85,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
<div class="form-group">
|
<div class="input-group mb-3 mb-md-0">
|
||||||
<select class="form-control select2" name="client" onchange="this.form.submit()">
|
<select class="form-control select2" name="client" onchange="this.form.submit()">
|
||||||
<option value="">- All Clients -</option>
|
<option value="">- All Clients -</option>
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
<div class="form-group">
|
<div class="input-group mb-3 mb-md-0">
|
||||||
<select class="form-control select2" name="user" onchange="this.form.submit()">
|
<select class="form-control select2" name="user" onchange="this.form.submit()">
|
||||||
<option value="">- All Users -</option>
|
<option value="">- All Users -</option>
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
<div class="form-group">
|
<div class="input-group mb-3 mb-md-0">
|
||||||
<select class="form-control select2" name="type" onchange="this.form.submit()">
|
<select class="form-control select2" name="type" onchange="this.form.submit()">
|
||||||
<option value="">- All Types -</option>
|
<option value="">- All Types -</option>
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
<div class="form-group">
|
<div class="input-group mb-3 mb-md-0">
|
||||||
<select class="form-control select2" name="action" onchange="this.form.submit()">
|
<select class="form-control select2" name="action" onchange="this.form.submit()">
|
||||||
<option value="">- All Actions -</option>
|
<option value="">- All Actions -</option>
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<hr>
|
<hr>
|
||||||
<div class="table-responsive-sm">
|
<div class="table-responsive-sm">
|
||||||
<table class="table table-sm table-striped table-borderless table-hover">
|
<table class="table table-sm table-striped table-borderless table-hover">
|
||||||
<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"; } ?> text-nowrap">
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=log_created_at&order=<?php echo $disp; ?>">
|
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=log_created_at&order=<?php echo $disp; ?>">
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ require_once "includes/inc_all_admin.php";
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-body" style="text-align: center;">
|
<div class="card-body" style="text-align: center;">
|
||||||
<div class="alert alert-secondary">If you are unable to back up the entire VM, you'll need to back up the files & database individually. There is no built-in restore. See the <a href="https://docs.itflow.org/backups" target="_blank">docs here</a>.</div>
|
<div class="alert alert-secondary">If you are unable to back up the entire VM, you'll need to back up the files & database individually. There is no built-in restore. See the <a href="https://docs.itflow.org/backups" target="_blank">docs here</a>.</div>
|
||||||
<a class="btn btn-primary btn-lg p-3" href="post.php?download_database&csrf_token=<?php echo $_SESSION['csrf_token'] ?>"><i class="fas fa-fw fa-4x fa-download"></i><br><br>Download database</a>
|
<a class="btn btn-primary btn-lg p-3" href="post.php?download_backup&csrf_token=<?php echo $_SESSION['csrf_token'] ?>"><i class="fas fa-fw fa-4x fa-download"></i><br><br>Download Backup</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -20,12 +20,12 @@ require_once "includes/inc_all_admin.php";
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form action="post.php" method="POST">
|
<form action="post.php" method="POST">
|
||||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||||
<div class="row d-flex justify-content-center">
|
<div class="d-flex justify-content-center">
|
||||||
<div class="input-group col-4">
|
<div class="input-group col-sm-4">
|
||||||
<div class="input-group-prepend">
|
<input type="password" class="form-control" placeholder="Enter your account password" name="password" autocomplete="new-password" required>
|
||||||
<input type="password" class="form-control" placeholder="Enter your account password" name="password" autocomplete="new-password" required>
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-primary" type="submit" name="backup_master_key"><i class="fas fa-key"></i></button>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-primary" type="submit" name="backup_master_key"><i class="fas fa-fw fa-key mr-2"></i>Get Master Key</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -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";
|
|
||||||
@@ -27,13 +27,8 @@ $sql = mysqli_query(
|
|||||||
);
|
);
|
||||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||||
|
|
||||||
if (isset($_GET['archived'])) {
|
|
||||||
$category = "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>
|
||||||
@@ -99,7 +94,7 @@ if (isset($_GET['archived'])) {
|
|||||||
} else {
|
} else {
|
||||||
echo 'btn-default';
|
echo 'btn-default';
|
||||||
} ?>">Ticket</a>
|
} ?>">Ticket</a>
|
||||||
<a href="?archived=1"
|
<a href="?<?php echo $url_query_strings_sort ?>&archived=1"
|
||||||
class="btn <?php if (isset($_GET['archived'])) {
|
class="btn <?php if (isset($_GET['archived'])) {
|
||||||
echo 'btn-primary';
|
echo 'btn-primary';
|
||||||
} else {
|
} else {
|
||||||
@@ -134,10 +129,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">
|
||||||
@@ -146,7 +146,7 @@ if (isset($_GET['archived'])) {
|
|||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<?php
|
<?php
|
||||||
if ($category == "Archived") {
|
if ($archived) {
|
||||||
?>
|
?>
|
||||||
<a class="dropdown-item text-success confirm-link"
|
<a class="dropdown-item text-success confirm-link"
|
||||||
href="post.php?unarchive_category=<?php echo $category_id; ?>">
|
href="post.php?unarchive_category=<?php echo $category_id; ?>">
|
||||||
@@ -159,8 +159,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 +180,6 @@ if (isset($_GET['archived'])) {
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require "modals/admin_category_edit_modal.php";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -193,5 +194,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";
|
||||||
|
|
||||||
|
|||||||
400
admin_debug.php
400
admin_debug.php
@@ -296,7 +296,13 @@ if ($tablesResult) {
|
|||||||
|
|
||||||
while ($table = $tablesResult->fetch_assoc()) {
|
while ($table = $tablesResult->fetch_assoc()) {
|
||||||
$tableName = $table['Name'];
|
$tableName = $table['Name'];
|
||||||
$tableRows = $table['Rows'];
|
|
||||||
|
// Accurate row count
|
||||||
|
$countResult = $mysqli->query("SELECT COUNT(*) AS cnt FROM `$tableName`");
|
||||||
|
$countRow = $countResult->fetch_assoc();
|
||||||
|
$tableRows = $countRow['cnt'];
|
||||||
|
$countResult->free();
|
||||||
|
|
||||||
$dataLength = $table['Data_length'];
|
$dataLength = $table['Data_length'];
|
||||||
$indexLength = $table['Index_length'];
|
$indexLength = $table['Index_length'];
|
||||||
$tableSize = ($dataLength + $indexLength) / (1024 * 1024); // Size in MB
|
$tableSize = ($dataLength + $indexLength) / (1024 * 1024); // Size in MB
|
||||||
@@ -336,11 +342,6 @@ if ($tablesResult) {
|
|||||||
'name' => 'Total database size (MB)',
|
'name' => 'Total database size (MB)',
|
||||||
'value' => round($totalSize, 2) . ' MB',
|
'value' => round($totalSize, 2) . ' MB',
|
||||||
];
|
];
|
||||||
} else {
|
|
||||||
$databaseStats[] = [
|
|
||||||
'name' => 'Database connection error',
|
|
||||||
'value' => $mysqli->error,
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Section: Database Structure Comparison
|
// Section: Database Structure Comparison
|
||||||
@@ -518,24 +519,26 @@ $mysqli->close();
|
|||||||
</ul>
|
</ul>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<table class="table table-bordered mb-3">
|
<div class="table-responsive">
|
||||||
<tr>
|
<table class="table table-bordered mb-3">
|
||||||
<th>ITFlow release version</th>
|
<tr>
|
||||||
<th><?php echo APP_VERSION; ?></th>
|
<th>ITFlow release version</th>
|
||||||
</tr>
|
<th><?php echo APP_VERSION; ?></th>
|
||||||
<tr>
|
</tr>
|
||||||
<td>Current DB Version</td>
|
<tr>
|
||||||
<td><?php echo CURRENT_DATABASE_VERSION; ?></td>
|
<td>Current DB Version</td>
|
||||||
</tr>
|
<td><?php echo CURRENT_DATABASE_VERSION; ?></td>
|
||||||
<tr>
|
</tr>
|
||||||
<td>Current Code Commit</td>
|
<tr>
|
||||||
<td><?php echo $commitHash; ?></td>
|
<td>Current Code Commit</td>
|
||||||
</tr>
|
<td><?php echo $commitHash; ?></td>
|
||||||
<tr>
|
</tr>
|
||||||
<td>Current Branch</td>
|
<tr>
|
||||||
<td><?php echo $gitBranch; ?></td>
|
<td>Current Branch</td>
|
||||||
</tr>
|
<td><?php echo $gitBranch; ?></td>
|
||||||
</table>
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- System Information Table -->
|
<!-- System Information Table -->
|
||||||
<h3>System Information</h3>
|
<h3>System Information</h3>
|
||||||
@@ -552,200 +555,209 @@ $mysqli->close();
|
|||||||
|
|
||||||
<!-- PHP Extensions and Configuration Table -->
|
<!-- PHP Extensions and Configuration Table -->
|
||||||
<h3 class="mt-3">PHP Extensions and Configuration</h3>
|
<h3 class="mt-3">PHP Extensions and Configuration</h3>
|
||||||
<table class="table table-sm table-bordered">
|
<div class="table-responsive">
|
||||||
<!-- PHP Extensions Section -->
|
<table class="table table-sm table-bordered">
|
||||||
<thead>
|
<!-- PHP Extensions Section -->
|
||||||
<tr class="table-secondary">
|
<thead>
|
||||||
<th colspan="3">PHP Extensions</th>
|
<tr class="table-secondary">
|
||||||
</tr>
|
<th colspan="3">PHP Extensions</th>
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php foreach ($phpExtensions as $check): ?>
|
|
||||||
<tr>
|
|
||||||
<td><?= htmlspecialchars($check['name']); ?></td>
|
|
||||||
<td class="text-center">
|
|
||||||
<?php if ($check['passed']): ?>
|
|
||||||
<i class="fas fa-check" style="color:green"></i>
|
|
||||||
<?php else: ?>
|
|
||||||
<i class="fas fa-times" style="color:red"></i>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td><?= htmlspecialchars($check['value']); ?></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
</thead>
|
||||||
</tbody>
|
<tbody>
|
||||||
<!-- PHP Configuration Section -->
|
<?php foreach ($phpExtensions as $check): ?>
|
||||||
<thead>
|
<tr>
|
||||||
<tr class="table-secondary">
|
<td><?= htmlspecialchars($check['name']); ?></td>
|
||||||
<th colspan="3">PHP Configuration</th>
|
<td class="text-center">
|
||||||
</tr>
|
<?php if ($check['passed']): ?>
|
||||||
</thead>
|
<i class="fas fa-check" style="color:green"></i>
|
||||||
<tbody>
|
<?php else: ?>
|
||||||
<?php foreach ($phpConfig as $check): ?>
|
<i class="fas fa-times" style="color:red"></i>
|
||||||
<tr>
|
<?php endif; ?>
|
||||||
<td><?= htmlspecialchars($check['name']); ?></td>
|
</td>
|
||||||
<td class="text-center">
|
<td><?= htmlspecialchars($check['value']); ?></td>
|
||||||
<?php if ($check['passed']): ?>
|
</tr>
|
||||||
<i class="fas fa-check" style="color:green"></i>
|
<?php endforeach; ?>
|
||||||
<?php else: ?>
|
</tbody>
|
||||||
<i class="fas fa-times" style="color:red"></i>
|
<!-- PHP Configuration Section -->
|
||||||
<?php endif; ?>
|
<thead>
|
||||||
</td>
|
<tr class="table-secondary">
|
||||||
<td><?= htmlspecialchars($check['value']); ?></td>
|
<th colspan="3">PHP Configuration</th>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
</thead>
|
||||||
</tbody>
|
<tbody>
|
||||||
<thead>
|
<?php foreach ($phpConfig as $check): ?>
|
||||||
<tr class="table-secondary">
|
<tr>
|
||||||
<th colspan="3">Shell Commands</th>
|
<td><?= htmlspecialchars($check['name']); ?></td>
|
||||||
</tr>
|
<td class="text-center">
|
||||||
</thead>
|
<?php if ($check['passed']): ?>
|
||||||
<tbody>
|
<i class="fas fa-check" style="color:green"></i>
|
||||||
<?php foreach ($shellCommands as $check): ?>
|
<?php else: ?>
|
||||||
<tr>
|
<i class="fas fa-times" style="color:red"></i>
|
||||||
<td><?= htmlspecialchars($check['name']); ?></td>
|
<?php endif; ?>
|
||||||
<td class="text-center">
|
</td>
|
||||||
<?php if ($check['passed']): ?>
|
<td><?= htmlspecialchars($check['value']); ?></td>
|
||||||
<i class="fas fa-check" style="color:green"></i>
|
</tr>
|
||||||
<?php else: ?>
|
<?php endforeach; ?>
|
||||||
<i class="fas fa-times" style="color:red"></i>
|
</tbody>
|
||||||
<?php endif; ?>
|
<thead>
|
||||||
</td>
|
<tr class="table-secondary">
|
||||||
<td><?= htmlspecialchars($check['value']); ?></td>
|
<th colspan="3">Shell Commands</th>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
</thead>
|
||||||
</tbody>
|
<tbody>
|
||||||
<thead>
|
<?php foreach ($shellCommands as $check): ?>
|
||||||
<tr class="table-secondary">
|
<tr>
|
||||||
<th colspan="3">SSL Checks</th>
|
<td><?= htmlspecialchars($check['name']); ?></td>
|
||||||
</tr>
|
<td class="text-center">
|
||||||
</thead>
|
<?php if ($check['passed']): ?>
|
||||||
<tbody>
|
<i class="fas fa-check" style="color:green"></i>
|
||||||
<?php foreach ($sslChecks as $check): ?>
|
<?php else: ?>
|
||||||
<tr>
|
<i class="fas fa-times" style="color:red"></i>
|
||||||
<td><?= htmlspecialchars($check['name']); ?></td>
|
<?php endif; ?>
|
||||||
<td class="text-center">
|
</td>
|
||||||
<?php if ($check['passed']): ?>
|
<td><?= htmlspecialchars($check['value']); ?></td>
|
||||||
<i class="fas fa-check" style="color:green"></i>
|
</tr>
|
||||||
<?php else: ?>
|
<?php endforeach; ?>
|
||||||
<i class="fas fa-times" style="color:red"></i>
|
</tbody>
|
||||||
<?php endif; ?>
|
<thead>
|
||||||
</td>
|
<tr class="table-secondary">
|
||||||
<td><?= htmlspecialchars($check['value']); ?></td>
|
<th colspan="3">SSL Checks</th>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
</thead>
|
||||||
</tbody>
|
<tbody>
|
||||||
<thead>
|
<?php foreach ($sslChecks as $check): ?>
|
||||||
<tr class="table-secondary">
|
<tr>
|
||||||
<th colspan="3">Domain Checks</th>
|
<td><?= htmlspecialchars($check['name']); ?></td>
|
||||||
</tr>
|
<td class="text-center">
|
||||||
</thead>
|
<?php if ($check['passed']): ?>
|
||||||
<tbody>
|
<i class="fas fa-check" style="color:green"></i>
|
||||||
<?php foreach ($domainChecks as $check): ?>
|
<?php else: ?>
|
||||||
<tr>
|
<i class="fas fa-times" style="color:red"></i>
|
||||||
<td><?= htmlspecialchars($check['name']); ?></td>
|
<?php endif; ?>
|
||||||
<td class="text-center">
|
</td>
|
||||||
<?php if ($check['passed']): ?>
|
<td><?= htmlspecialchars($check['value']); ?></td>
|
||||||
<i class="fas fa-check" style="color:green"></i>
|
</tr>
|
||||||
<?php else: ?>
|
<?php endforeach; ?>
|
||||||
<i class="fas fa-times" style="color:red"></i>
|
</tbody>
|
||||||
<?php endif; ?>
|
<thead>
|
||||||
</td>
|
<tr class="table-secondary">
|
||||||
<td><?= htmlspecialchars($check['value']); ?></td>
|
<th colspan="3">Domain Checks</th>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
</thead>
|
||||||
</tbody>
|
<tbody>
|
||||||
|
<?php foreach ($domainChecks as $check): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?= htmlspecialchars($check['name']); ?></td>
|
||||||
|
<td class="text-center">
|
||||||
|
<?php if ($check['passed']): ?>
|
||||||
|
<i class="fas fa-check" style="color:green"></i>
|
||||||
|
<?php else: ?>
|
||||||
|
<i class="fas fa-times" style="color:red"></i>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
<td><?= htmlspecialchars($check['value']); ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
|
||||||
<!-- File Permissions Table -->
|
<!-- File Permissions Table -->
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="table-secondary">
|
<tr class="table-secondary">
|
||||||
<th colspan="3">File Permissions</th>
|
<th colspan="3">File Permissions</th>
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php foreach ($filePermissions as $check): ?>
|
|
||||||
<tr>
|
|
||||||
<td><?= htmlspecialchars($check['name']); ?></td>
|
|
||||||
<td class="text-center">
|
|
||||||
<?php if ($check['passed']): ?>
|
|
||||||
<i class="fas fa-check" style="color:green"></i>
|
|
||||||
<?php else: ?>
|
|
||||||
<i class="fas fa-times" style="color:red"></i>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td><?= htmlspecialchars($check['value']); ?></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
</thead>
|
||||||
</tbody>
|
<tbody>
|
||||||
</table>
|
<?php foreach ($filePermissions as $check): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?= htmlspecialchars($check['name']); ?></td>
|
||||||
|
<td class="text-center">
|
||||||
|
<?php if ($check['passed']): ?>
|
||||||
|
<i class="fas fa-check" style="color:green"></i>
|
||||||
|
<?php else: ?>
|
||||||
|
<i class="fas fa-times" style="color:red"></i>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
<td><?= htmlspecialchars($check['value']); ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- Database Structure Comparison Table -->
|
<!-- Database Structure Comparison Table -->
|
||||||
<h3 class="mt-3">Database Structure Comparison</h3>
|
<h3 class="mt-3">Database Structure Comparison</h3>
|
||||||
<table class="table table-sm table-bordered">
|
<div class="table-responsive">
|
||||||
<tbody>
|
<table class="table table-sm table-bordered">
|
||||||
<?php if (!empty($dbComparison)): ?>
|
<tbody>
|
||||||
<?php foreach ($dbComparison as $issue): ?>
|
<?php if (!empty($dbComparison)): ?>
|
||||||
|
<?php foreach ($dbComparison as $issue): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?= htmlspecialchars($issue['name']); ?></td>
|
||||||
|
<td colspan="2"><?= htmlspecialchars($issue['status']); ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php else: ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?= htmlspecialchars($issue['name']); ?></td>
|
<td colspan="3">No discrepancies found between the database and db.sql file.</td>
|
||||||
<td colspan="2"><?= htmlspecialchars($issue['status']); ?></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endif; ?>
|
||||||
<?php else: ?>
|
</tbody>
|
||||||
<tr>
|
</table>
|
||||||
<td colspan="3">No discrepancies found between the database and db.sql file.</td>
|
</div>
|
||||||
</tr>
|
|
||||||
<?php endif; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<!-- Uploads Directory Stats Table -->
|
<!-- Uploads Directory Stats Table -->
|
||||||
<h3 class="mt-3">Uploads Directory Stats</h3>
|
<h3 class="mt-3">Uploads Directory Stats</h3>
|
||||||
<table class="table table-sm table-bordered">
|
<div class="table-responsive">
|
||||||
<tbody>
|
<table class="table table-sm table-bordered">
|
||||||
<?php foreach ($uploadsStats as $stat): ?>
|
<tbody>
|
||||||
<tr>
|
<?php foreach ($uploadsStats as $stat): ?>
|
||||||
<td><?= htmlspecialchars($stat['name']); ?></td>
|
<tr>
|
||||||
<td colspan="2"><?= htmlspecialchars($stat['value']); ?></td>
|
<td><?= htmlspecialchars($stat['name']); ?></td>
|
||||||
</tr>
|
<td colspan="2"><?= htmlspecialchars($stat['value']); ?></td>
|
||||||
<?php endforeach; ?>
|
</tr>
|
||||||
</tbody>
|
<?php endforeach; ?>
|
||||||
</table>
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Database Stats Table -->
|
<!-- Database Stats Table -->
|
||||||
<h3 class="mt-3">Database Stats</h3>
|
<h3 class="mt-3">Database Stats</h3>
|
||||||
<table class="table table-sm table-bordered">
|
<div class="table-responsive">
|
||||||
<tbody>
|
<table class="table table-sm table-bordered">
|
||||||
<?php foreach ($databaseStats as $stat): ?>
|
<tbody>
|
||||||
<tr>
|
<?php foreach ($databaseStats as $stat): ?>
|
||||||
<td><?= htmlspecialchars($stat['name']); ?></td>
|
<tr>
|
||||||
<td colspan="2"><?= htmlspecialchars($stat['value']); ?></td>
|
<td><?= htmlspecialchars($stat['name']); ?></td>
|
||||||
</tr>
|
<td colspan="2"><?= htmlspecialchars($stat['value']); ?></td>
|
||||||
<?php endforeach; ?>
|
</tr>
|
||||||
</tbody>
|
<?php endforeach; ?>
|
||||||
</table>
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Table Stats Table -->
|
<!-- Table Stats Table -->
|
||||||
<h3 class="mt-3">Table Stats</h3>
|
<h3 class="mt-3">Table Stats</h3>
|
||||||
<table class="table table-sm table-bordered">
|
<div class="table-responsive">
|
||||||
<thead>
|
<table class="table table-sm table-bordered">
|
||||||
<tr>
|
<thead>
|
||||||
<th>Table Name</th>
|
|
||||||
<th>Fields / Rows</th>
|
|
||||||
<th>Size (MB)</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php foreach ($tableDetails as $table): ?>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><?= htmlspecialchars($table['name']); ?></td>
|
<th>Table Name</th>
|
||||||
<td><?= htmlspecialchars("Fields: {$table['fields']}, Rows: {$table['rows']}"); ?></td>
|
<th>Fields / Rows</th>
|
||||||
<td><?= htmlspecialchars($table['size'] . ' MB'); ?></td>
|
<th>Size (MB)</th>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
</thead>
|
||||||
</tbody>
|
<tbody>
|
||||||
</table>
|
<?php foreach ($tableDetails as $table): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?= htmlspecialchars($table['name']); ?></td>
|
||||||
|
<td><?= htmlspecialchars("Fields: {$table['fields']}, Rows: {$table['rows']}"); ?></td>
|
||||||
|
<td><?= htmlspecialchars($table['size'] . ' MB'); ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -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";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -27,40 +27,41 @@ $document_updated_at = nullable_htmlentities($row['document_updated_at']);
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<ol class="breadcrumb d-print-none">
|
<ol class="breadcrumb d-print-none">
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="clients.php">Home</a>
|
<a href="clients.php">Home</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="admin_user.php">Admin</a>
|
<a href="admin_user.php">Admin</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="admin_document_template.php">Document Templates</a>
|
<a href="admin_document_template.php">Document Templates</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="breadcrumb-item active"><i class="fas fa-file mr-2"></i><?php echo $document_name; ?></li>
|
<li class="breadcrumb-item active"><i class="fas fa-file mr-2"></i><?php echo $document_name; ?></li>
|
||||||
</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"
|
||||||
<i class="fas fa-edit mr-2"></i>Edit
|
data-toggle="ajax-modal"
|
||||||
</button>
|
data-modal-size="xl"
|
||||||
</div>
|
data-ajax-url="ajax/ajax_document_template_edit.php"
|
||||||
</div>
|
data-ajax-id="<?php echo $document_id; ?>"
|
||||||
<div class="card-body prettyContent">
|
>
|
||||||
<?php echo $document_content; ?>
|
<i class="fas fa-edit mr-2"></i>Edit
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="card-body prettyContent">
|
||||||
|
<?php echo $document_content; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<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";
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,29 @@ require_once "includes/inc_all_admin.php";
|
|||||||
|
|
||||||
<div class="card card-dark">
|
<div class="card card-dark">
|
||||||
<div class="card-header py-3">
|
<div class="card-header py-3">
|
||||||
<h3 class="card-title"><i class="fas fa-fw fa-plug mr-2"></i>Integration Settings</h3>
|
<h3 class="card-title"><i class="fas fa-fw fa-fingerprint mr-2"></i>Identity Providers</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||||
|
|
||||||
<h4>Client Portal SSO via Microsoft Entra</h4>
|
<h4>Client Portal SSO via Microsoft Entra</h4>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Identity Provider <small class='text-secondary'>(Currently only works with Microsft Entra)</small></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>
|
||||||
|
<select class="form-control select2" readonly>
|
||||||
|
<option <?php if (empty($config_azure_client_id)) { echo "selected"; } ?>>Disabled</option>
|
||||||
|
<option <?php if ($config_azure_client_id) { echo "selected"; } ?>>Microsoft Entra</option>
|
||||||
|
<option>Google (WIP)</option>
|
||||||
|
<option>Custom SSO (WIP)</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>MS Entra OAuth App (Client) ID</label>
|
<label>MS Entra OAuth App (Client) ID</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -33,11 +49,10 @@ require_once "includes/inc_all_admin.php";
|
|||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<button type="submit" name="edit_integrations_settings" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
<button type="submit" name="edit_identity_provider" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php require_once "includes/footer.php";
|
<?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"
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -50,17 +50,17 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<hr>
|
<hr>
|
||||||
<div class="table-responsive-sm">
|
<div class="table-responsive-sm">
|
||||||
<table class="table table-striped table-borderless table-hover">
|
<table class="table table-striped table-borderless table-hover">
|
||||||
<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"; } ?> text-nowrap">
|
||||||
<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 = [];
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Convert the array of user names to a comma-separated string
|
// Convert the array of user names to a comma-separated string
|
||||||
$user_names_string = implode(",", $user_names) ;
|
$user_names_string = implode(",", $user_names);
|
||||||
|
|
||||||
if (empty($user_names_string)) {
|
if (empty($user_names_string)) {
|
||||||
$user_names_string = "-";
|
$user_names_string = "-";
|
||||||
@@ -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="input-group">
|
<div class="col-md-9">
|
||||||
<div class="input-group-prepend">
|
<div class="form-group">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-phone"></i></span>
|
<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 $company_phone_country_code; ?>" placeholder="+" maxlength="4">
|
||||||
|
<input type="tel" class="form-control" name="phone" value="<?php echo $company_phone; ?>" placeholder="Phone Number" maxlength="200">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="phone" placeholder="Phone Number" value="<?php echo $company_phone; ?>">
|
|
||||||
</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>
|
||||||
|
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ require_once "includes/inc_all_admin.php";
|
|||||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||||
|
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<button type="submit" name="test_email_imap" class="btn btn-success"><i class="fas fa-fw fa-inbox mr-2"></i>Test</button>
|
<button type="submit" name="test_email_imap" class="btn btn-success" disabled><i class="fas fa-fw fa-inbox mr-2"></i>Test (WIP)</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -18,158 +18,159 @@ require_once "includes/inc_all_admin.php";
|
|||||||
<label class="custom-control-label" for="enableCronSwitch">Enable Cron (recommended) <small>(several cron scripts must also be added to cron with correct schedules, <a href="https://docs.itflow.org/cron">docs</a>)</small></label>
|
<label class="custom-control-label" for="enableCronSwitch">Enable Cron (recommended) <small>(several cron scripts must also be added to cron with correct schedules, <a href="https://docs.itflow.org/cron">docs</a>)</small></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<thead class="thead-dark">
|
||||||
|
<tr>
|
||||||
|
<th>Notification</th>
|
||||||
|
<th>App Notify</th>
|
||||||
|
<th>Tech Email Notify</th>
|
||||||
|
<th>Client Email Notify</th>
|
||||||
|
<th>Create Ticket</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th colspan=5>Expirations</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<div><i class="fas fa-fw fa-globe mr-2"></i>Domain Expiration Notice</div>
|
||||||
|
<small class="text-muted">
|
||||||
|
(This setting triggers a notification when a domain is approaching its expiration date, specifically at 1, 7 and 45 days prior to expiry.)
|
||||||
|
</small>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<div class="custom-control custom-checkbox text-center">
|
||||||
|
<input type="checkbox" class="custom-control-input" name="config_enable_alert_domain_expire" id="customCheck1" <?php if ($config_enable_alert_domain_expire == 1) { echo "checked"; } ?> value="1">
|
||||||
|
<label class="custom-control-label" for="customCheck1"></label>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<div><i class="fas fa-fw fa-lock mr-2"></i>Certificate Expiration Notice</div>
|
||||||
|
<small class="text-muted">
|
||||||
|
(This setting triggers a notification when a certificate is approaching its expiration date, specifically at 1, 7 and 45 days prior to expiry.)
|
||||||
|
</small>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<div><i class="fas fa-fw fa-desktop mr-2"></i>Asset Warranty Expiration Notice</div>
|
||||||
|
<small class="text-muted">
|
||||||
|
(This setting triggers a notification when an asset is approaching its expiration date, specifically at 1, 7 and 45 days prior to expiry.)
|
||||||
|
</small>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th colspan=5>Billing</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<div><i class="fas fa-fw fa-file-invoice mr-2"></i>Invoice Reminders</div>
|
||||||
|
<small class="text-muted">
|
||||||
|
(This will automatically dispatch a reminder email for the invoice to the primary contact's email every 30 days following the invoice's due date.)
|
||||||
|
</small>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
|
||||||
<table class="table table-bordered">
|
</td>
|
||||||
<thead class="thead-dark">
|
<td></td>
|
||||||
<tr>
|
<td>
|
||||||
<th>Notification</th>
|
<div class="custom-control custom-checkbox text-center">
|
||||||
<th>App Notify</th>
|
<input type="checkbox" class="custom-control-input" name="config_send_invoice_reminders" <?php if ($config_send_invoice_reminders == 1) { echo "checked"; } ?> value="1" id="sendInvoiceRemindersSwitch">
|
||||||
<th>Tech Email Notify</th>
|
<label class="custom-control-label" for="sendInvoiceRemindersSwitch"></label>
|
||||||
<th>Client Email Notify</th>
|
</div>
|
||||||
<th>Create Ticket</th>
|
</td>
|
||||||
</tr>
|
<td></td>
|
||||||
</thead>
|
</tr>
|
||||||
<tbody>
|
<tr>
|
||||||
<tr>
|
<th>
|
||||||
<th colspan=5>Expirations</th>
|
<div><i class="fas fa-fw fa-redo-alt mr-2"></i>Send Recurring Invoice</div>
|
||||||
</tr>
|
<small class="text-muted">
|
||||||
<tr>
|
(This will notify all primary and billing contacts of a client that a new invoice was generated from recurring invoices)
|
||||||
<th>
|
</small>
|
||||||
<div><i class="fas fa-fw fa-globe mr-2"></i>Domain Expiration Notice</div>
|
</th>
|
||||||
<small class="text-muted">
|
<td>
|
||||||
(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.)
|
|
||||||
</small>
|
|
||||||
</th>
|
|
||||||
<td>
|
|
||||||
<div class="custom-control custom-checkbox text-center">
|
|
||||||
<input type="checkbox" class="custom-control-input" name="config_enable_alert_domain_expire" id="customCheck1" <?php if ($config_enable_alert_domain_expire == 1) { echo "checked"; } ?> value="1">
|
|
||||||
<label class="custom-control-label" for="customCheck1"></label>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
<div><i class="fas fa-fw fa-lock mr-2"></i>Certificate Expiration Notice</div>
|
|
||||||
<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.)
|
|
||||||
</small>
|
|
||||||
</th>
|
|
||||||
<td>
|
|
||||||
</td>
|
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
<div><i class="fas fa-fw fa-desktop mr-2"></i>Asset Warranty Expiration Notice</div>
|
|
||||||
<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.)
|
|
||||||
</small>
|
|
||||||
</th>
|
|
||||||
<td>
|
|
||||||
</td>
|
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th colspan=5>Billing</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
<div><i class="fas fa-fw fa-file-invoice mr-2"></i>Invoice Reminders</div>
|
|
||||||
<small class="text-muted">
|
|
||||||
(This will automatically dispatch a reminder email for the invoice to the primary contact's email every 30 days following the invoice's due date.)
|
|
||||||
</small>
|
|
||||||
</th>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="custom-control custom-checkbox text-center">
|
<div class="custom-control custom-checkbox text-center">
|
||||||
<input type="checkbox" class="custom-control-input" name="config_send_invoice_reminders" <?php if ($config_send_invoice_reminders == 1) { echo "checked"; } ?> value="1" id="sendInvoiceRemindersSwitch">
|
<input type="checkbox" class="custom-control-input" name="config_recurring_auto_send_invoice" <?php if ($config_recurring_auto_send_invoice == 1) { echo "checked"; } ?> value="1" id="sendRecurringSwitch">
|
||||||
<label class="custom-control-label" for="sendInvoiceRemindersSwitch"></label>
|
<label class="custom-control-label" for="sendRecurringSwitch"></label>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th colspan=5>Operational</th>
|
||||||
<div><i class="fas fa-fw fa-redo-alt mr-2"></i>Send Recurring Invoice</div>
|
</tr>
|
||||||
<small class="text-muted">
|
<tr>
|
||||||
(This will notify all primary and billing contacts of a client that a new invoice was generated from recurring invoices)
|
<th>
|
||||||
</small>
|
<div><i class="fas fa-fw fa-bell mr-2"></i>Send clients general notification emails</div>
|
||||||
</th>
|
<small class="text-secondary">(Should clients receive automatic emails when tickets are raised/closed?)</small>
|
||||||
<td>
|
</th>
|
||||||
|
<td></td>
|
||||||
</td>
|
<td></td>
|
||||||
<td></td>
|
<td>
|
||||||
<td>
|
<div class="custom-control custom-checkbox text-center">
|
||||||
<div class="custom-control custom-checkbox text-center">
|
<input type="checkbox" class="custom-control-input" name="config_ticket_client_general_notifications" <?php if($config_ticket_client_general_notifications == 1){ echo "checked"; } ?> value="1" id="ticketNotificationSwitch">
|
||||||
<input type="checkbox" class="custom-control-input" name="config_recurring_auto_send_invoice" <?php if ($config_recurring_auto_send_invoice == 1) { echo "checked"; } ?> value="1" id="sendRecurringSwitch">
|
<label class="custom-control-label" for="ticketNotificationSwitch"></label>
|
||||||
<label class="custom-control-label" for="sendRecurringSwitch"></label>
|
</div>
|
||||||
</div>
|
</td>
|
||||||
</td>
|
<td></td>
|
||||||
<td></td>
|
</tr>
|
||||||
</tr>
|
<tr>
|
||||||
<tr>
|
<th>
|
||||||
<th colspan=5>Operational</th>
|
<div><i class="fas fa-fw fa-link mr-2"></i>Shared Item View</div>
|
||||||
</tr>
|
<small class="text-secondary">(Notify when Shared items are viewed)</small>
|
||||||
<tr>
|
</th>
|
||||||
<th>
|
<td></td>
|
||||||
<div><i class="fas fa-fw fa-bell mr-2"></i>Send clients general notification emails</div>
|
<td></td>
|
||||||
<small class="text-secondary">(Should clients receive automatic emails when tickets are raised/closed?)</small>
|
<td>
|
||||||
</th>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
</tr>
|
||||||
<td>
|
<tr>
|
||||||
<div class="custom-control custom-checkbox text-center">
|
<th>
|
||||||
<input type="checkbox" class="custom-control-input" name="config_ticket_client_general_notifications" <?php if($config_ticket_client_general_notifications == 1){ echo "checked"; } ?> value="1" id="ticketNotificationSwitch">
|
<div><i class="fas fa-fw fa-clock mr-2"></i>Cron Execution</div>
|
||||||
<label class="custom-control-label" for="ticketNotificationSwitch"></label>
|
<small class="text-secondary">(Notify when the nightly cron job ran)</small>
|
||||||
</div>
|
</th>
|
||||||
</td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
<td>
|
||||||
<tr>
|
</td>
|
||||||
<th>
|
<td></td>
|
||||||
<div><i class="fas fa-fw fa-link mr-2"></i>Shared Item View</div>
|
</tr>
|
||||||
<small class="text-secondary">(Notify when Shared items are viewed)</small>
|
<tr>
|
||||||
</th>
|
<th>
|
||||||
<td></td>
|
<div><i class="fas fa-fw fa-download mr-2"></i>ITFlow Updates</div>
|
||||||
<td></td>
|
<small class="text-secondary">(Notify when ITFlow has an update)</small>
|
||||||
<td>
|
</th>
|
||||||
</td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
<td>
|
||||||
<tr>
|
</td>
|
||||||
<th>
|
<td></td>
|
||||||
<div><i class="fas fa-fw fa-clock mr-2"></i>Cron Execution</div>
|
</tr>
|
||||||
<small class="text-secondary">(Notify when the nightly cron job ran)</small>
|
</tbody>
|
||||||
</th>
|
</table>
|
||||||
<td></td>
|
</div>
|
||||||
<td></td>
|
|
||||||
<td>
|
|
||||||
</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
<div><i class="fas fa-fw fa-download mr-2"></i>ITFlow Updates</div>
|
|
||||||
<small class="text-secondary">(Notify when ITFlow has an update)</small>
|
|
||||||
</th>
|
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
<td>
|
|
||||||
</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
|||||||
@@ -11,56 +11,63 @@ $stripe_clients_sql = mysqli_query($mysqli, "SELECT * FROM client_stripe LEFT JO
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
<div class="table-responsive">
|
||||||
<table class="table border border-dark">
|
<table class="table border border-dark">
|
||||||
<thead class="thead-dark">
|
<thead class="thead-dark text-nowrap">
|
||||||
<tr>
|
|
||||||
<th>Client</th>
|
|
||||||
<th>Stripe Customer ID</th>
|
|
||||||
<th>Stripe Payment ID</th>
|
|
||||||
<th class="text-center">Action</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
while ($row = mysqli_fetch_array($stripe_clients_sql)) {
|
|
||||||
$client_id = intval($row['client_id']);
|
|
||||||
$client_name = nullable_htmlentities($row['client_name']);
|
|
||||||
$stripe_id = nullable_htmlentities($row['stripe_id']);
|
|
||||||
$stripe_pm = nullable_htmlentities($row['stripe_pm']);
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo "$client_name ($client_id)" ?></td>
|
<th>Client</th>
|
||||||
<td><?php echo $stripe_id; ?></td>
|
<th>Stripe Customer ID</th>
|
||||||
<td><?php echo $stripe_pm ?></td>
|
<th>Stripe Payment ID</th>
|
||||||
<td>
|
<th>Payment Details</th>
|
||||||
<div class="dropdown dropleft text-center">
|
<th>Created</th>
|
||||||
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
<th class="text-center">Action</th>
|
||||||
<i class="fas fa-ellipsis-h"></i>
|
|
||||||
</button>
|
|
||||||
<div class="dropdown-menu">
|
|
||||||
<?php if (!empty($stripe_pm)) { ?>
|
|
||||||
<a class="dropdown-item text-danger confirm-link" href="post.php?stripe_remove_pm&client_id=<?php echo $client_id ?>&pm=<?php echo $stripe_pm ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
|
|
||||||
<i class="fas fa-fw fa-credit-card mr-2"></i>Delete payment method
|
|
||||||
</a>
|
|
||||||
<?php } else { ?>
|
|
||||||
<a data-toggle="tooltip" data-placement="left" title="May result in duplicate customer records in Stripe" class="dropdown-item text-danger confirm-link" href="post.php?stripe_reset_customer&client_id=<?php echo $client_id ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
|
|
||||||
<i class="fas fa-fw fa-trash mr-2"></i>Reset Stripe
|
|
||||||
</a>
|
|
||||||
<?php } ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
<?php } ?>
|
<?php
|
||||||
|
while ($row = mysqli_fetch_array($stripe_clients_sql)) {
|
||||||
|
$client_id = intval($row['client_id']);
|
||||||
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
|
$stripe_id = nullable_htmlentities($row['stripe_id']);
|
||||||
|
$stripe_pm = nullable_htmlentities($row['stripe_pm']);
|
||||||
|
$stripe_pm_details = nullable_htmlentities($row['stripe_pm_details']);
|
||||||
|
$stripe_pm_created_at = nullable_htmlentities($row['stripe_pm_created_at']);
|
||||||
|
|
||||||
</tbody>
|
?>
|
||||||
</table>
|
|
||||||
|
<tr>
|
||||||
|
<td><?php echo "$client_name ($client_id)"; ?></td>
|
||||||
|
<td><?php echo $stripe_id; ?></td>
|
||||||
|
<td><?php echo $stripe_pm; ?></td>
|
||||||
|
<td><?php echo $stripe_pm_details; ?></td>
|
||||||
|
<td><?php echo $stripe_pm_created_at; ?></td>
|
||||||
|
<td>
|
||||||
|
<div class="dropdown dropleft text-center">
|
||||||
|
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
||||||
|
<i class="fas fa-ellipsis-h"></i>
|
||||||
|
</button>
|
||||||
|
<div class="dropdown-menu">
|
||||||
|
<?php if (!empty($stripe_pm)) { ?>
|
||||||
|
<a class="dropdown-item text-danger confirm-link" href="post.php?stripe_remove_pm&client_id=<?php echo $client_id ?>&pm=<?php echo $stripe_pm ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
|
||||||
|
<i class="fas fa-fw fa-credit-card mr-2"></i>Delete payment method
|
||||||
|
</a>
|
||||||
|
<?php } else { ?>
|
||||||
|
<a data-toggle="tooltip" data-placement="left" title="May result in duplicate customer records in Stripe" class="dropdown-item text-danger confirm-link" href="post.php?stripe_reset_customer&client_id=<?php echo $client_id ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
|
||||||
|
<i class="fas fa-fw fa-trash mr-2"></i>Reset Stripe
|
||||||
|
</a>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -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"; } ?>>
|
||||||
|
|||||||
@@ -73,6 +73,31 @@ require_once "includes/inc_all_admin.php";
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Tickets Default View</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-eye"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control" name="config_ticket_default_view">
|
||||||
|
<option value=0 <?php if ($config_ticket_default_view == 0) { echo "selected"; } ?>>List</option>
|
||||||
|
<option value=1 <?php if ($config_ticket_default_view == 1) { echo "selected"; } ?>>Compact</option>
|
||||||
|
<option value=2 <?php if ($config_ticket_default_view == 2) { echo "selected"; } ?>>Kanban</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Kanban Settings</label>
|
||||||
|
<div class="custom-control custom-switch">
|
||||||
|
<input type="checkbox" class="custom-control-input" name="config_ticket_ordering" <?php if ($config_ticket_ordering == 1) { echo "checked"; } ?> value="1" id="ticketOrderingSwitch">
|
||||||
|
<label class="custom-control-label" for="ticketOrderingSwitch">Allow ticket ordering within its column<small class="text-secondary">(uncheked will result in ordering it by priority and id)</small></label>
|
||||||
|
</div>
|
||||||
|
<div class="custom-control custom-switch">
|
||||||
|
<input type="checkbox" class="custom-control-input" name="config_ticket_moving_columns" <?php if ($config_ticket_moving_columns == 1) { echo "checked"; } ?> value="1" id="ticketMovingColumnsSwitch">
|
||||||
|
<label class="custom-control-label" for="ticketMovingColumnsSwitch">Allow moving columns</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<button type="submit" name="edit_ticket_settings" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
<button type="submit" name="edit_ticket_settings" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Default Column Sortby Filter
|
// Default Column Sortby Filter
|
||||||
$sort = "ticket_status_name";
|
$sort = "ticket_status_order";
|
||||||
$order = "ASC";
|
$order = "ASC";
|
||||||
|
|
||||||
require_once "includes/inc_all_admin.php";
|
require_once "includes/inc_all_admin.php";
|
||||||
@@ -21,112 +21,113 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="card card-dark">
|
<div class="card card-dark">
|
||||||
<div class="card-header py-2">
|
<div class="card-header py-2">
|
||||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-info-circle mr-2"></i>Tickets Statuses</h3>
|
<h3 class="card-title mt-2"><i class="fas fa-fw fa-info-circle mr-2"></i>Tickets Statuses</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addTicketStatusModal"><i class="fas fa-plus mr-2"></i>New Ticket Status</button>
|
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addTicketStatusModal"><i class="fas fa-plus mr-2"></i>New Ticket Status</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-4 mb-2">
|
||||||
|
<form autocomplete="off">
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search Ticket Statuses">
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-8">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-body">
|
<hr>
|
||||||
<div class="row">
|
<div class="table-responsive-sm">
|
||||||
<div class="col-sm-4 mb-2">
|
<table class="table table-striped table-borderless table-hover">
|
||||||
<form autocomplete="off">
|
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||||
<div class="input-group">
|
<tr>
|
||||||
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search Ticket Statuses">
|
<th>
|
||||||
<div class="input-group-append">
|
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_status_name&order=<?php echo $disp; ?>">
|
||||||
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
|
Name <?php if ($sort == 'ticket_status_name') { echo $order_icon; } ?>
|
||||||
</div>
|
</a>
|
||||||
</div>
|
</th>
|
||||||
</form>
|
<th>
|
||||||
</div>
|
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_status_color&order=<?php echo $disp; ?>">
|
||||||
<div class="col-sm-8">
|
Color <?php if ($sort == 'ticket_status_color') { echo $order_icon; } ?>
|
||||||
</div>
|
</a>
|
||||||
</div>
|
</th>
|
||||||
|
<th>
|
||||||
|
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_status_active&order=<?php echo $disp; ?>">
|
||||||
|
Status <?php if ($sort == 'ticket_status_active') { echo $order_icon; } ?>
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
|
<th class="text-center">Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
|
||||||
<hr>
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
<div class="table-responsive-sm">
|
$ticket_status_id = intval($row['ticket_status_id']);
|
||||||
<table class="table table-striped table-borderless table-hover">
|
$ticket_status_name = nullable_htmlentities($row['ticket_status_name']);
|
||||||
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
$ticket_status_color = nullable_htmlentities($row['ticket_status_color']);
|
||||||
<tr>
|
$ticket_status_active = intval($row['ticket_status_active']);
|
||||||
<th>
|
if ($ticket_status_active) {
|
||||||
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_status_name&order=<?php echo $disp; ?>">
|
$ticket_status_display = "<div class='text-success text-bold'>Active</div>";
|
||||||
Name <?php if ($sort == 'ticket_status_name') { echo $order_icon; } ?>
|
} else {
|
||||||
</a>
|
$ticket_status_display = "<div class='text-secondary'>Inactive</div>";
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_status_color&order=<?php echo $disp; ?>">
|
|
||||||
Color <?php if ($sort == 'ticket_status_color') { echo $order_icon; } ?>
|
|
||||||
</a>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_status_active&order=<?php echo $disp; ?>">
|
|
||||||
Status <?php if ($sort == 'ticket_status_active') { echo $order_icon; } ?>
|
|
||||||
</a>
|
|
||||||
</th>
|
|
||||||
<th class="text-center">Action</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
|
||||||
$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_status_active = intval($row['ticket_status_active']);
|
|
||||||
if ($ticket_status_active) {
|
|
||||||
$ticket_status_display = "<div class='text-success text-bold'>Active</div>";
|
|
||||||
} else {
|
|
||||||
$ticket_status_display = "<div class='text-secondary'>Disabled</div>";
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="#" data-toggle="modal" data-target="#editTicketStatusModal<?php echo $ticket_status_id; ?>">
|
|
||||||
<?php echo $ticket_status_name; ?>
|
|
||||||
</a>
|
|
||||||
</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><?php echo $ticket_status_display; ?></td>
|
|
||||||
<td>
|
|
||||||
<?php if ( $ticket_status_id > 5 ) { ?>
|
|
||||||
<div class="dropdown dropleft text-center">
|
|
||||||
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
|
||||||
<i class="fas fa-ellipsis-h"></i>
|
|
||||||
</button>
|
|
||||||
<div class="dropdown-menu">
|
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editTicketStatusModal<?php echo $ticket_status_id; ?>">
|
|
||||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_ticket_status=<?php echo $ticket_status_id; ?>">
|
|
||||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php } ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
if ( $ticket_status_id > 5 ) {
|
|
||||||
require "modals/admin_ticket_status_edit_modal.php";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<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; ?>
|
||||||
|
</a>
|
||||||
|
</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><?php echo $ticket_status_display; ?></td>
|
||||||
|
<td>
|
||||||
|
<div class="dropdown dropleft text-center">
|
||||||
|
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
||||||
|
<i class="fas fa-ellipsis-h"></i>
|
||||||
|
</button>
|
||||||
|
<div class="dropdown-menu">
|
||||||
|
<a class="dropdown-item" href="#" data-toggle="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
|
||||||
|
</a>
|
||||||
|
<?php if (!$ticket_status_active) { ?>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_ticket_status=<?php echo $ticket_status_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token']; ?>">
|
||||||
|
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||||
|
</a>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
<?php
|
||||||
</table>
|
}
|
||||||
</div>
|
|
||||||
<?php require_once "includes/filter_footer.php";
|
?>
|
||||||
?>
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
<?php require_once "includes/filter_footer.php";
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/admin_ticket_status_add_modal.php";
|
require_once "modals/admin_ticket_status_add_modal.php";
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ $sql_ticket_templates = mysqli_query($mysqli, "SELECT * FROM ticket_templates WH
|
|||||||
$row = mysqli_fetch_array($sql_ticket_templates);
|
$row = mysqli_fetch_array($sql_ticket_templates);
|
||||||
|
|
||||||
$ticket_template_name = nullable_htmlentities($row['ticket_template_name']);
|
$ticket_template_name = nullable_htmlentities($row['ticket_template_name']);
|
||||||
$ticket_template_description = nullable_htmlentities($row['ticket_template_description']);
|
//$ticket_template_description = nullable_htmlentities($row['ticket_template_description']);
|
||||||
$ticket_template_subject = nullable_htmlentities($row['ticket_template_subject']);
|
$ticket_template_subject = nullable_htmlentities($row['ticket_template_subject']);
|
||||||
$ticket_template_details = $purifier->purify($row['ticket_template_details']);
|
$ticket_template_details = $purifier->purify($row['ticket_template_details']);
|
||||||
$ticket_template_created_at = nullable_htmlentities($row['ticket_template_created_at']);
|
$ticket_template_created_at = nullable_htmlentities($row['ticket_template_created_at']);
|
||||||
@@ -31,112 +31,134 @@ $sql_task_templates = mysqli_query($mysqli, "SELECT * FROM task_templates WHERE
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<ol class="breadcrumb d-print-none">
|
<ol class="breadcrumb d-print-none">
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="clients.php">Home</a>
|
<a href="clients.php">Home</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="admin_user.php">Admin</a>
|
<a href="admin_user.php">Admin</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="admin_ticket_template.php">Ticket Templates</a>
|
<a href="admin_ticket_template.php">Ticket Templates</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="breadcrumb-item active"><i class="fas fa-life-ring mr-2"></i><?php echo $ticket_template_name; ?></li>
|
<li class="breadcrumb-item active"><i class="fas fa-life-ring mr-2"></i><?php echo $ticket_template_name; ?></li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8">
|
<div class="col-9">
|
||||||
|
|
||||||
<div class="card card-dark">
|
<div class="card card-dark">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title mt-2">
|
<h3 class="card-title mt-2">
|
||||||
<div class="media">
|
<div class="media">
|
||||||
<i class="fa fa-fw fa-2x fa-life-ring mr-3"></i>
|
<i class="fa fa-fw fa-2x fa-life-ring mr-3"></i>
|
||||||
<div class="media-body">
|
<div class="media-body">
|
||||||
<h3 class="mb-0"><?php echo $ticket_template_name; ?></h3>
|
<h3 class="mb-0"><?php echo $ticket_template_name; ?></h3>
|
||||||
<div><small class="text-secondary"><?php echo $ticket_template_description; ?></small></div>
|
<div><small class="text-secondary"><?php //echo $ticket_template_description; ?></small></div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</h3>
|
|
||||||
<div class="card-tools">
|
|
||||||
<button type="button" class="btn btn-default btn-sm" data-toggle="modal" data-target="#editTicketTemplateModal">
|
|
||||||
<i class="fas fa-edit"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</h3>
|
||||||
<h5><?php echo $ticket_template_subject; ?></h5>
|
<div class="card-tools">
|
||||||
<div class="card-body prettyContent">
|
<button type="button" class="btn btn-default btn-sm" data-toggle="modal" data-target="#editTicketTemplateModal">
|
||||||
<?php echo $ticket_template_details; ?>
|
<i class="fas fa-edit"></i>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<h5><?php echo $ticket_template_subject; ?></h5>
|
||||||
</div>
|
<div class="card-body prettyContent">
|
||||||
|
<?php echo $ticket_template_details; ?>
|
||||||
<div class="col-4">
|
|
||||||
|
|
||||||
<div class="card card-dark">
|
|
||||||
<div class="card-header">
|
|
||||||
<h5 class="card-title"><i class="fa fa-fw fa-tasks mr-2"></i>Tasks</h5>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
|
||||||
<input type="hidden" name="ticket_template_id" value="<?php echo $ticket_template_id; ?>">
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-tasks"></i></span>
|
|
||||||
</div>
|
|
||||||
<input type="text" class="form-control" name="task_name" placeholder="Create a task" required>
|
|
||||||
<div class="input-group-append">
|
|
||||||
<button type="submit" name="add_ticket_template_task" class="btn btn-primary"><i class="fas fa-fw fa-check"></i></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<table class="table table-striped table-sm">
|
|
||||||
<?php
|
|
||||||
while($row = mysqli_fetch_array($sql_task_templates)){
|
|
||||||
$task_id = intval($row['task_template_id']);
|
|
||||||
$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_description = nullable_htmlentities($row['task_template_description']);
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<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 class="text-right">
|
|
||||||
<div class="float-right">
|
|
||||||
<div class="dropdown dropleft text-center">
|
|
||||||
<button class="btn btn-link text-secondary btn-sm" type="button" data-toggle="dropdown">
|
|
||||||
<i class="fas fa-fw fa-ellipsis-v"></i>
|
|
||||||
</button>
|
|
||||||
<div class="dropdown-menu">
|
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editTaskModal<?php echo $task_id; ?>">
|
|
||||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<a class="dropdown-item text-danger confirm-link" href="post.php?delete_task_template=<?php echo $task_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
|
|
||||||
<i class="fas fa-fw fa-trash-alt mr-2"></i>Delete
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
require "modals/task_edit_modal.php";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="js/pretty_content.js"></script>
|
<div class="col-3">
|
||||||
|
|
||||||
|
<div class="card card-dark">
|
||||||
|
<div class="card-header">
|
||||||
|
<h5 class="card-title"><i class="fa fa-fw fa-tasks mr-2"></i>Tasks</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="ticket_template_id" value="<?php echo $ticket_template_id; ?>">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="input-group input-group-sm">
|
||||||
|
<input type="text" class="form-control" name="task_name" placeholder="Create a task" required maxlength="200">
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button type="submit" name="add_ticket_template_task" class="btn btn-primary"><i class="fas fa-fw fa-check"></i></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<table class="table table-sm" id="tasks">
|
||||||
|
<?php
|
||||||
|
while($row = mysqli_fetch_array($sql_task_templates)){
|
||||||
|
$task_id = intval($row['task_template_id']);
|
||||||
|
$task_name = nullable_htmlentities($row['task_template_name']);
|
||||||
|
$task_completion_estimate = intval($row['task_template_completion_estimate']);
|
||||||
|
//$task_description = nullable_htmlentities($row['task_template_description']);
|
||||||
|
?>
|
||||||
|
<tr data-task-id="<?php echo $task_id; ?>">
|
||||||
|
<td>
|
||||||
|
<a href="#" class="drag-handle"><i class="fas fa-bars text-muted mr-2"></i></a>
|
||||||
|
<span class="text-dark"><?php echo $task_name; ?></span>
|
||||||
|
</td>
|
||||||
|
<td class="text-right">
|
||||||
|
<div class="float-right">
|
||||||
|
<div class="dropdown dropleft text-center">
|
||||||
|
<button class="btn btn-light text-secondary btn-sm" type="button" data-toggle="dropdown">
|
||||||
|
<i class="fas fa-ellipsis-v"></i>
|
||||||
|
</button>
|
||||||
|
<div class="dropdown-menu">
|
||||||
|
<a class="dropdown-item" href="#"
|
||||||
|
data-toggle = "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
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<a class="dropdown-item text-danger confirm-link" href="post.php?delete_task_template=<?php echo $task_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
|
||||||
|
<i class="fas fa-fw fa-trash-alt mr-2"></i>Delete
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="js/pretty_content.js"></script>
|
||||||
|
|
||||||
|
<script src="plugins/SortableJS/Sortable.min.js"></script>
|
||||||
|
<script>
|
||||||
|
new Sortable(document.querySelector('table#tasks tbody'), {
|
||||||
|
handle: '.drag-handle',
|
||||||
|
animation: 150,
|
||||||
|
onEnd: function (evt) {
|
||||||
|
const rows = document.querySelectorAll('table#tasks tbody tr');
|
||||||
|
const positions = Array.from(rows).map((row, index) => ({
|
||||||
|
id: row.dataset.taskId,
|
||||||
|
order: index
|
||||||
|
}));
|
||||||
|
|
||||||
|
$.post('ajax.php', {
|
||||||
|
update_task_templates_order: true,
|
||||||
|
ticket_template_id: <?php echo $ticket_template_id; ?>,
|
||||||
|
positions: positions
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,11 @@ $git_log = shell_exec("git log $repo_branch..origin/$repo_branch --pretty=format
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) { ?>
|
<?php if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) { ?>
|
||||||
<div class="alert alert-warning">
|
<div class="alert alert-danger">
|
||||||
<strong>Ensure you have a current <a href="https://docs.itflow.org/backups">app & database backup</a> before updating!</strong>
|
<h1 class="font-weight-bold text-center">⚠️ DANGER ⚠️</h1>
|
||||||
|
<h2 class="font-weight-bold text-center">Do NOT run updates without first taking a backup</h2>
|
||||||
|
<p>VM Snapshots are highly recommended over other methods - see the <a href="https://docs.itflow.org/backups" class="alert-link" target="_blank">docs</a>. Review the <a href="https://github.com/itflow-org/itflow/blob/master/CHANGELOG.md" class="alert-link" target="_blank">changelog</a> for breaking changes that may require manual remediation.</p>
|
||||||
|
<p class="text-center font-weight-bold">Ignore this warning at your own risk.</p>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<a class="btn btn-dark btn-lg my-4" href="post.php?update_db"><i class="fas fa-fw fa-4x fa-download mb-1"></i><h5>Update Database</h5></a>
|
<a class="btn btn-dark btn-lg my-4" href="post.php?update_db"><i class="fas fa-fw fa-4x fa-download mb-1"></i><h5>Update Database</h5></a>
|
||||||
@@ -46,9 +49,17 @@ $git_log = shell_exec("git log $repo_branch..origin/$repo_branch --pretty=format
|
|||||||
|
|
||||||
<?php } else {
|
<?php } else {
|
||||||
if (!empty($git_log)) { ?>
|
if (!empty($git_log)) { ?>
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<h1 class="font-weight-bold text-center">⚠️ DANGER ⚠️</h1>
|
||||||
|
<h2 class="font-weight-bold text-center">Do NOT run updates without first taking a backup</h2>
|
||||||
|
<p>VM Snapshots are highly recommended over other methods - see the <a href="https://docs.itflow.org/backups" class="alert-link" target="_blank">docs</a>. Review the <a href="https://github.com/itflow-org/itflow/blob/master/CHANGELOG.md" class="alert-link" target="_blank">changelog</a> for breaking changes that may require manual remediation.</p>
|
||||||
|
<p class="text-center font-weight-bold">Ignore this warning at your own risk.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<a class="btn btn-primary btn-lg my-4" href="post.php?update"><i class="fas fa-fw fa-4x fa-download mb-1"></i><h5>Update App</h5></a>
|
<a class="btn btn-primary btn-lg my-4 confirm-link" href="post.php?no"><i class="fas fa-fw fa-4x fa-download mb-1"></i><h5>TEST</h5></a>
|
||||||
<a class="btn btn-danger btn-lg" href="post.php?update&force_update=1"><i class="fas fa-fw fa-4x fa-hammer mb-1"></i><h5>FORCE Update App</h5></a>
|
|
||||||
|
<a class="btn btn-primary btn-lg my-4 confirm-link" href="post.php?update"><i class="fas fa-fw fa-4x fa-download mb-1"></i><h5>Update App</h5></a>
|
||||||
|
<a class="btn btn-danger btn-lg confirm-link" href="post.php?update&force_update=1"><i class="fas fa-fw fa-4x fa-hammer mb-1"></i><h5>FORCE Update App</h5></a>
|
||||||
|
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<p><strong>Application Release Version:<br><strong class="text-dark"><?php echo APP_VERSION; ?></strong></p>
|
<p><strong>Application Release Version:<br><strong class="text-dark"><?php echo APP_VERSION; ?></strong></p>
|
||||||
@@ -56,6 +67,17 @@ $git_log = shell_exec("git log $repo_branch..origin/$repo_branch --pretty=format
|
|||||||
<p class="text-secondary">Code Commit:<br><strong class="text-dark"><?php echo $current_version; ?></strong></p>
|
<p class="text-secondary">Code Commit:<br><strong class="text-dark"><?php echo $current_version; ?></strong></p>
|
||||||
<p class="text-muted">You are up to date!<br>Everything is going to be alright</p>
|
<p class="text-muted">You are up to date!<br>Everything is going to be alright</p>
|
||||||
<i class="far fa-3x text-dark fa-smile-wink"></i><br>
|
<i class="far fa-3x text-dark fa-smile-wink"></i><br>
|
||||||
|
|
||||||
|
<?php if (rand(1,10) == 1) { ?>
|
||||||
|
<br>
|
||||||
|
<div class="alert alert-info alert-dismissible fade show" role="alert">
|
||||||
|
You're up to date, but when was the last time you checked your ITFlow backup works?
|
||||||
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<?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";
|
||||||
|
|
||||||
|
|||||||
487
ajax.php
487
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,102 +284,17 @@ 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,
|
||||||
"SELECT client_id, client_name FROM clients
|
"SELECT client_id, client_name FROM clients
|
||||||
WHERE client_archived_at IS NULL
|
WHERE client_archived_at IS NULL
|
||||||
|
$access_permission_query
|
||||||
ORDER BY client_accessed_at DESC"
|
ORDER BY client_accessed_at DESC"
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -481,12 +309,16 @@ 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(
|
||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT contact_id, contact_name, contact_primary, contact_important, contact_technical FROM contacts
|
"SELECT contact_id, contact_name, contact_primary, contact_important, contact_technical FROM contacts
|
||||||
|
LEFT JOIN clients on contact_client_id = client_id
|
||||||
WHERE contacts.contact_archived_at IS NULL AND contact_client_id = $client_id
|
WHERE contacts.contact_archived_at IS NULL AND contact_client_id = $client_id
|
||||||
|
$access_permission_query
|
||||||
ORDER BY contact_primary DESC, contact_technical DESC, contact_important DESC, contact_name"
|
ORDER BY contact_primary DESC, contact_technical DESC, contact_important DESC, contact_name"
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -502,26 +334,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 +361,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_invoice_id = intval($_POST['recurring_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_recurring_invoice_id = $recurring_invoice_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">
|
</div>
|
||||||
<a href="admin_mail_queue.php"><i class="fas fa-fw fa-mail-bulk mr-2"></i>Mail Queue</a>
|
<div class="modal-body bg-white">
|
||||||
</li>
|
<div class="row">
|
||||||
<li class="breadcrumb-item active"><i class="fas fa-fw fa-envelope-open mr-2"></i><?php echo $email_subject; ?></li>
|
<div class="col-md-1">
|
||||||
</ol>
|
<span class="text-secondary">From:</span>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="col-md-10">
|
||||||
|
<?php echo "<strong>$email_from_name</strong> ($email_from)"; ?>
|
||||||
<div class="col-md-12">
|
</div>
|
||||||
<div class="card">
|
</div>
|
||||||
<div class="card-header bg-dark">
|
<hr class="my-2">
|
||||||
<div>From: <?php echo "$email_from_name <small>($email_from)</small>"; ?></div>
|
<div class="row">
|
||||||
<div>To: <?php echo "$email_recipient_name <small>($email_recipient)</small>"; ?></div>
|
<div class="col-md-1">
|
||||||
<div>Subject: <?php echo $email_subject; ?></div>
|
<span class="text-secondary">To:</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body prettyContent">
|
<div class="col-md-10">
|
||||||
<?php echo $email_content; ?>
|
<?php echo "<strong>$email_recipient_name</strong> ($email_recipient)"; ?>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr class="my-2">
|
||||||
|
<div class="prettyContent">
|
||||||
|
<?php echo $email_content; ?>
|
||||||
</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";
|
|
||||||
446
ajax/ajax_asset_copy.php
Normal file
446
ajax/ajax_asset_copy.php
Normal file
@@ -0,0 +1,446 @@
|
|||||||
|
<?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 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" >
|
||||||
|
</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-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";
|
||||||
69
ajax/ajax_asset_link_credential.php
Normal file
69
ajax/ajax_asset_link_credential.php
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$asset_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM assets
|
||||||
|
WHERE asset_id = $asset_id
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||||
|
$client_id = intval($row['asset_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-key mr-2"></i>Link Credential to <strong><?php echo $asset_name; ?></strong></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="asset_id" value="<?php echo $asset_id; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-key"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="credential_id">
|
||||||
|
<option value="">- Select a Credential -</option>
|
||||||
|
<?php
|
||||||
|
$sql_credentials_select = mysqli_query($mysqli, "
|
||||||
|
SELECT credentials.credential_id, credentials.credential_name
|
||||||
|
FROM credentials
|
||||||
|
LEFT JOIN assets ON credentials.credential_asset_id = assets.asset_id
|
||||||
|
AND credentials.credential_asset_id = $asset_id
|
||||||
|
WHERE credentials.credential_client_id = $client_id
|
||||||
|
AND credentials.credential_asset_id = 0
|
||||||
|
AND credentials.credential_archived_at IS NULL
|
||||||
|
ORDER BY credentials.credential_name ASC
|
||||||
|
");
|
||||||
|
while ($row = mysqli_fetch_array($sql_credentials_select)) {
|
||||||
|
$credential_id = intval($row['credential_id']);
|
||||||
|
$credential_name = nullable_htmlentities($row['credential_name']);
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $credential_id ?>"><?php echo $credential_name; ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="link_asset_to_credential" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Link</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_asset_link_document.php
Normal file
70
ajax/ajax_asset_link_document.php
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$asset_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM assets
|
||||||
|
WHERE asset_id = $asset_id
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||||
|
$client_id = intval($row['asset_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-folder mr-2"></i>Link Document to <strong><?php echo $asset_name; ?></strong></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="asset_id" value="<?php echo $asset_id; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<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="document_id">
|
||||||
|
<option value="">- Select a Document -</option>
|
||||||
|
<?php
|
||||||
|
$sql_documents_select = mysqli_query($mysqli, "
|
||||||
|
SELECT documents.document_id, documents.document_name
|
||||||
|
FROM documents
|
||||||
|
LEFT JOIN asset_documents
|
||||||
|
ON documents.document_id = asset_documents.document_id
|
||||||
|
AND asset_documents.asset_id = $asset_id
|
||||||
|
WHERE documents.document_client_id = $client_id
|
||||||
|
AND documents.document_archived_at IS NULL
|
||||||
|
AND asset_documents.asset_id IS NULL
|
||||||
|
ORDER BY documents.document_name ASC
|
||||||
|
");
|
||||||
|
while ($row = mysqli_fetch_array($sql_documents_select)) {
|
||||||
|
$document_id = intval($row['document_id']);
|
||||||
|
$document_name = nullable_htmlentities($row['document_name']);
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $document_id ?>"><?php echo $document_name; ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="link_asset_to_document" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Link</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";
|
||||||
|
?>
|
||||||
73
ajax/ajax_asset_link_file.php
Normal file
73
ajax/ajax_asset_link_file.php
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$asset_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM assets
|
||||||
|
WHERE asset_id = $asset_id
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||||
|
$client_id = intval($row['asset_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-paperclip mr-2"></i>Link File to <strong><?php echo $asset_name; ?></strong></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="asset_id" value="<?php echo $asset_id; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-paperclip"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="file_id">
|
||||||
|
<option value="">- Select a File -</option>
|
||||||
|
<?php
|
||||||
|
$sql_files_select = mysqli_query($mysqli, "
|
||||||
|
SELECT files.file_id, files.file_name, folders.folder_name
|
||||||
|
FROM files
|
||||||
|
LEFT JOIN asset_files
|
||||||
|
ON files.file_id = asset_files.file_id
|
||||||
|
AND asset_files.asset_id = $asset_id
|
||||||
|
LEFT JOIN folders
|
||||||
|
ON folders.folder_id = files.file_folder_id
|
||||||
|
WHERE files.file_client_id = $client_id
|
||||||
|
AND asset_files.asset_id IS NULL
|
||||||
|
ORDER BY folders.folder_name ASC, files.file_name ASC
|
||||||
|
");
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_array($sql_files_select)) {
|
||||||
|
$file_id = intval($row['file_id']);
|
||||||
|
$file_name = nullable_htmlentities($row['file_name']);
|
||||||
|
$folder_name = nullable_htmlentities($row['folder_name']);
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $file_id ?>"><?php echo "$folder_name/$file_name"; ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="link_asset_to_file" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Link</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";
|
||||||
|
?>
|
||||||
68
ajax/ajax_asset_link_service.php
Normal file
68
ajax/ajax_asset_link_service.php
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$asset_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM assets
|
||||||
|
WHERE asset_id = $asset_id
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||||
|
$client_id = intval($row['asset_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-stream mr-2"></i>Link Service to <strong><?php echo $asset_name; ?></strong></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="asset_id" value="<?php echo $asset_id; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-stream"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="service_id">
|
||||||
|
<option value="">- Select a Service -</option>
|
||||||
|
<?php
|
||||||
|
$sql_services_select = mysqli_query($mysqli, "
|
||||||
|
SELECT services.service_id, services.service_name
|
||||||
|
FROM services
|
||||||
|
LEFT JOIN service_assets
|
||||||
|
ON services.service_id = service_assets.service_id
|
||||||
|
AND service_assets.asset_id = $asset_id
|
||||||
|
WHERE services.service_client_id = $client_id
|
||||||
|
AND service_assets.asset_id IS NULL
|
||||||
|
ORDER BY services.service_name ASC
|
||||||
|
");
|
||||||
|
while ($row = mysqli_fetch_array($sql_services_select)) {
|
||||||
|
$service_id = intval($row['service_id']);
|
||||||
|
$service_name = nullable_htmlentities($row['service_name']);
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $service_id ?>"><?php echo $service_name; ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="link_service_to_asset" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Link</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";
|
||||||
73
ajax/ajax_asset_link_software.php
Normal file
73
ajax/ajax_asset_link_software.php
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$asset_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM assets
|
||||||
|
WHERE asset_id = $asset_id
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||||
|
$client_id = intval($row['asset_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-cube mr-2"></i>License Software to <strong><?php echo $asset_name; ?></strong></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="asset_id" value="<?php echo $asset_id; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<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="software_id">
|
||||||
|
<option value="">- Select a Device Software License -</option>
|
||||||
|
<?php
|
||||||
|
$sql_software_select = mysqli_query($mysqli, "
|
||||||
|
SELECT software.software_id, software.software_name
|
||||||
|
FROM software
|
||||||
|
LEFT JOIN software_assets
|
||||||
|
ON software.software_id = software_assets.software_id
|
||||||
|
AND software_assets.asset_id = $asset_id
|
||||||
|
WHERE software.software_client_id = $client_id
|
||||||
|
AND software.software_archived_at IS NULL
|
||||||
|
AND software.software_license_type = 'Device'
|
||||||
|
AND software_assets.asset_id IS NULL
|
||||||
|
ORDER BY software.software_name ASC
|
||||||
|
");
|
||||||
|
while ($row = mysqli_fetch_array($sql_software_select)) {
|
||||||
|
$software_id = intval($row['software_id']);
|
||||||
|
$software_name = nullable_htmlentities($row['software_name']);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $software_id ?>"><?php echo $software_name; ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="link_software_to_asset" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Link</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_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_mobile'], $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_mobile'], $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="+" 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="+" 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";
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
67
ajax/ajax_contact_link_asset.php
Normal file
67
ajax/ajax_contact_link_asset.php
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$contact_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||||
|
WHERE contact_id = $contact_id
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||||
|
$client_id = intval($row['contact_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-desktop mr-2"></i>Link Asset to <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">
|
||||||
|
<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_id">
|
||||||
|
<option value="">- Select an Asset -</option>
|
||||||
|
<?php
|
||||||
|
$sql_assets_select = mysqli_query($mysqli, "
|
||||||
|
SELECT asset_id, asset_name
|
||||||
|
FROM assets
|
||||||
|
WHERE asset_client_id = $client_id
|
||||||
|
AND asset_contact_id = 0
|
||||||
|
AND asset_archived_at IS NULL
|
||||||
|
ORDER BY asset_name ASC
|
||||||
|
");
|
||||||
|
while ($row = mysqli_fetch_array($sql_assets_select)) {
|
||||||
|
$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>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="link_contact_to_asset" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Link</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";
|
||||||
|
?>
|
||||||
67
ajax/ajax_contact_link_credential.php
Normal file
67
ajax/ajax_contact_link_credential.php
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$contact_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||||
|
WHERE contact_id = $contact_id
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||||
|
$client_id = intval($row['contact_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-key mr-2"></i>Link Credential to <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">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-key"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="credential_id">
|
||||||
|
<option value="">- Select a Credential -</option>
|
||||||
|
<?php
|
||||||
|
$sql_credentials_select = mysqli_query($mysqli, "
|
||||||
|
SELECT credential_id, credential_name
|
||||||
|
FROM credentials
|
||||||
|
WHERE credential_client_id = $client_id
|
||||||
|
AND credential_contact_id = 0
|
||||||
|
AND credential_archived_at IS NULL
|
||||||
|
ORDER BY credential_name ASC
|
||||||
|
");
|
||||||
|
while ($row = mysqli_fetch_array($sql_credentials_select)) {
|
||||||
|
$credential_id = intval($row['credential_id']);
|
||||||
|
$credential_name = nullable_htmlentities($row['credential_name']);
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $credential_id ?>"><?php echo $credential_name; ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="link_contact_to_credential" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Link</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_contact_link_document.php
Normal file
70
ajax/ajax_contact_link_document.php
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$contact_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||||
|
WHERE contact_id = $contact_id
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||||
|
$client_id = intval($row['contact_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-folder mr-2"></i>Link Document to <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">
|
||||||
|
<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="document_id">
|
||||||
|
<option value="">- Select a Document -</option>
|
||||||
|
<?php
|
||||||
|
$sql_documents_select = mysqli_query($mysqli, "
|
||||||
|
SELECT documents.document_id, documents.document_name
|
||||||
|
FROM documents
|
||||||
|
LEFT JOIN contact_documents
|
||||||
|
ON documents.document_id = contact_documents.document_id
|
||||||
|
AND contact_documents.contact_id = $contact_id
|
||||||
|
WHERE documents.document_client_id = $client_id
|
||||||
|
AND documents.document_archived_at IS NULL
|
||||||
|
AND contact_documents.contact_id IS NULL
|
||||||
|
ORDER BY documents.document_name ASC
|
||||||
|
");
|
||||||
|
while ($row = mysqli_fetch_array($sql_documents_select)) {
|
||||||
|
$document_id = intval($row['document_id']);
|
||||||
|
$document_name = nullable_htmlentities($row['document_name']);
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $document_id ?>"><?php echo $document_name; ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="link_contact_to_document" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Link</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";
|
||||||
|
?>
|
||||||
72
ajax/ajax_contact_link_file.php
Normal file
72
ajax/ajax_contact_link_file.php
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$contact_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||||
|
WHERE contact_id = $contact_id
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||||
|
$client_id = intval($row['contact_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-paperclip mr-2"></i>Link File to <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">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-paperclip"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="file_id">
|
||||||
|
<option value="">- Select a File -</option>
|
||||||
|
<?php
|
||||||
|
$sql_files_select = mysqli_query($mysqli, "
|
||||||
|
SELECT files.file_id, files.file_name, folders.folder_name
|
||||||
|
FROM files
|
||||||
|
LEFT JOIN contact_files
|
||||||
|
ON files.file_id = contact_files.file_id
|
||||||
|
AND contact_files.contact_id = $contact_id
|
||||||
|
LEFT JOIN folders
|
||||||
|
ON folders.folder_id = files.file_folder_id
|
||||||
|
WHERE files.file_client_id = $client_id
|
||||||
|
AND contact_files.contact_id IS NULL
|
||||||
|
ORDER BY folders.folder_name ASC, files.file_name ASC
|
||||||
|
");
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_array($sql_files_select)) {
|
||||||
|
$file_id = intval($row['file_id']);
|
||||||
|
$file_name = nullable_htmlentities($row['file_name']);
|
||||||
|
$folder_name = nullable_htmlentities($row['folder_name']);
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $file_id ?>"><?php echo "$folder_name/$file_name"; ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="link_contact_to_file" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Link</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";
|
||||||
68
ajax/ajax_contact_link_service.php
Normal file
68
ajax/ajax_contact_link_service.php
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$contact_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||||
|
WHERE contact_id = $contact_id
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||||
|
$client_id = intval($row['contact_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-stream mr-2"></i>Link Service to <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">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-stream"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="service_id">
|
||||||
|
<option value="">- Select a Service -</option>
|
||||||
|
<?php
|
||||||
|
$sql_services_select = mysqli_query($mysqli, "
|
||||||
|
SELECT services.service_id, services.service_name
|
||||||
|
FROM services
|
||||||
|
LEFT JOIN service_contacts
|
||||||
|
ON services.service_id = service_contacts.service_id
|
||||||
|
AND service_contacts.contact_id = $contact_id
|
||||||
|
WHERE services.service_client_id = $client_id
|
||||||
|
AND service_contacts.contact_id IS NULL
|
||||||
|
ORDER BY services.service_name ASC
|
||||||
|
");
|
||||||
|
while ($row = mysqli_fetch_array($sql_services_select)) {
|
||||||
|
$service_id = intval($row['service_id']);
|
||||||
|
$service_name = nullable_htmlentities($row['service_name']);
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $service_id ?>"><?php echo $service_name; ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="link_service_to_contact" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Link</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";
|
||||||
71
ajax/ajax_contact_link_software.php
Normal file
71
ajax/ajax_contact_link_software.php
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$contact_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||||
|
WHERE contact_id = $contact_id
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||||
|
$client_id = intval($row['contact_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-cube mr-2"></i>License Software to <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">
|
||||||
|
<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="software_id">
|
||||||
|
<option value="">- Select a User Software License -</option>
|
||||||
|
<?php
|
||||||
|
$sql_software_select = mysqli_query($mysqli, "
|
||||||
|
SELECT software.software_id, software.software_name
|
||||||
|
FROM software
|
||||||
|
LEFT JOIN software_contacts
|
||||||
|
ON software.software_id = software_contacts.software_id
|
||||||
|
AND software_contacts.contact_id = $contact_id
|
||||||
|
WHERE software.software_client_id = $client_id
|
||||||
|
AND software.software_archived_at IS NULL
|
||||||
|
AND software.software_license_type = 'User'
|
||||||
|
AND software_contacts.contact_id IS NULL
|
||||||
|
ORDER BY software.software_name ASC
|
||||||
|
");
|
||||||
|
while ($row = mysqli_fetch_array($sql_software_select)) {
|
||||||
|
$software_id = intval($row['software_id']);
|
||||||
|
$software_name = nullable_htmlentities($row['software_name']);
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $software_id ?>"><?php echo $software_name; ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="submit" name="link_software_to_contact" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Link</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_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";
|
||||||
79
ajax/ajax_custom_ticket_status_edit.php
Normal file
79
ajax/ajax_custom_ticket_status_edit.php
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
<?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_order = intval($row['ticket_status_order']);
|
||||||
|
$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 <?php if ($ticket_status_id <= 5) { echo "readonly"; } ?>>
|
||||||
|
</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>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 $ticket_status_order; ?>">
|
||||||
|
</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" <?php if ($ticket_status_id <= 5) { echo "disabled"; } ?>>Inactive</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="+" 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="+" 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";
|
||||||
135
ajax/ajax_notifications.php
Normal file
135
ajax/ajax_notifications.php
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
<?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) { ?>
|
||||||
|
<table class="table table-sm table-hover table-borderless">
|
||||||
|
|
||||||
|
|
||||||
|
<?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 = "#";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<tr class="notification-item">
|
||||||
|
<th>
|
||||||
|
<a class="text-dark" href="<?php echo $notification_action; ?>">
|
||||||
|
<i class="fas fa-bullhorn mr-2"></i><?php echo $notification_type; ?>
|
||||||
|
<small class="text-muted float-right">
|
||||||
|
<?php echo $notification_timestamp_formated; ?>
|
||||||
|
</small>
|
||||||
|
<br>
|
||||||
|
<small class="text-secondary text-wrap"><?php echo $notification_details; ?></small>
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
<div class="text-center mt-2">
|
||||||
|
<button id="prev-btn" class="btn btn-sm btn-outline-secondary mr-2"><i class="fas fa-caret-left"></i></button>
|
||||||
|
<button id="next-btn" class="btn btn-sm btn-outline-secondary"><i class="fas fa-caret-right"></i></button>
|
||||||
|
</div>
|
||||||
|
<?php } else { ?>
|
||||||
|
<div class="text-center text-secondary pt-3">
|
||||||
|
<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">
|
||||||
|
<?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>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
var perPage = 8;
|
||||||
|
var $items = $(".notification-item");
|
||||||
|
var totalItems = $items.length;
|
||||||
|
var totalPages = Math.ceil(totalItems / perPage);
|
||||||
|
var currentPage = 0;
|
||||||
|
|
||||||
|
function showPage(page) {
|
||||||
|
$items.hide().slice(page * perPage, (page + 1) * perPage).show();
|
||||||
|
$("#prev-btn").prop("disabled", page === 0);
|
||||||
|
$("#next-btn").prop("disabled", page >= totalPages - 1);
|
||||||
|
$("#page-indicator").text(`Page ${page + 1} of ${totalPages} (${totalItems} total)`);
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#prev-btn").on("click", function () {
|
||||||
|
if (currentPage > 0) {
|
||||||
|
currentPage--;
|
||||||
|
showPage(currentPage);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#next-btn").on("click", function () {
|
||||||
|
if (currentPage < totalPages - 1) {
|
||||||
|
currentPage++;
|
||||||
|
showPage(currentPage);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (totalItems <= perPage) {
|
||||||
|
$("#prev-btn, #next-btn, #page-indicator").hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
showPage(currentPage);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?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";
|
||||||
120
ajax/ajax_project_edit.php
Normal file
120
ajax/ajax_project_edit.php
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
<?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 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-users"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="client_id">
|
||||||
|
<option value="0">- No Client -</option>
|
||||||
|
<?php
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at IS NULL $access_permission_query ORDER BY client_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
|
$select_client_id = intval($row['client_id']);
|
||||||
|
$select_client_name = nullable_htmlentities($row['client_name']);
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $select_client_id; ?>" <?php if ($client_id == $select_client_id) { echo "selected"; } ?>><?php echo $select_client_name; ?></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";
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user