mirror of
https://github.com/itflow-org/itflow
synced 2026-03-10 07:44:50 +00:00
Compare commits
175 Commits
undefined-
...
ticket-tas
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
58bcb38617 | ||
|
|
77e4d2b566 | ||
|
|
88a29b7599 | ||
|
|
64525750b6 | ||
|
|
30499123f1 | ||
|
|
79703042ff | ||
|
|
ccd5605d97 | ||
|
|
908277065b | ||
|
|
f2d4eb0486 | ||
|
|
f784b659e8 | ||
|
|
e60a7a59f9 | ||
|
|
cab81ca170 | ||
|
|
a82e2c7ea1 | ||
|
|
a277380441 | ||
|
|
ad5710b1d8 | ||
|
|
3e3531a6ce | ||
|
|
a79ce23ae5 | ||
|
|
32f996d034 | ||
|
|
312eb4dffc | ||
|
|
1916456c84 | ||
|
|
9b8d37b577 | ||
|
|
05018e5f17 | ||
|
|
72ef918452 | ||
|
|
27fde82aff | ||
|
|
b27ffe6635 | ||
|
|
84cc4a094a | ||
|
|
e75600ee05 | ||
|
|
871ad2ea7e | ||
|
|
8b5f2e0f3f | ||
|
|
58d6ab7342 | ||
|
|
ca5fb2e010 | ||
|
|
da561b296e | ||
|
|
523da0dea0 | ||
|
|
0e4cc76a84 | ||
|
|
7e39a7ed89 | ||
|
|
4a26ea7ed9 | ||
|
|
7c83ba15b9 | ||
|
|
10bfbed4bb | ||
|
|
81550bd7a8 | ||
|
|
a430bb917e | ||
|
|
e1a579387f | ||
|
|
fe8df66c67 | ||
|
|
5bb410f80c | ||
|
|
29b79b9d4e | ||
|
|
0f8a8d1464 | ||
|
|
cc92a4b7ee | ||
|
|
3ffef6df51 | ||
|
|
78e4787b99 | ||
|
|
540512a156 | ||
|
|
7737dbc65d | ||
|
|
faa94d888d | ||
|
|
99e2487d2b | ||
|
|
f09d8ffe05 | ||
|
|
c486e3fe62 | ||
|
|
ba2d6b6709 | ||
|
|
a388a279bc | ||
|
|
5a64b19a06 | ||
|
|
53178b8d20 | ||
|
|
0347382a34 | ||
|
|
840460afe7 | ||
|
|
c851e54e1d | ||
|
|
5ef53b569c | ||
|
|
698b4166e8 | ||
|
|
1a9a36829b | ||
|
|
155b8598ff | ||
|
|
4153c91f84 | ||
|
|
a99b19a1b5 | ||
|
|
18429fda2c | ||
|
|
435da991ec | ||
|
|
ebd9aae924 | ||
|
|
414a84d5ec | ||
|
|
a3b2517603 | ||
|
|
43535082f6 | ||
|
|
e73af9980e | ||
|
|
0bdd5784ee | ||
|
|
48719ce29c | ||
|
|
29839d3b23 | ||
|
|
185ea7d6ac | ||
|
|
ac7623d4f5 | ||
|
|
3d119261cc | ||
|
|
169619c9b9 | ||
|
|
b991f787a2 | ||
|
|
215fc6803e | ||
|
|
a79c1c8246 | ||
|
|
1aa6419b1b | ||
|
|
02694f6720 | ||
|
|
f50aabb570 | ||
|
|
19b8d09bfd | ||
|
|
66fb999a8c | ||
|
|
0c5883b61b | ||
|
|
ef66d5172c | ||
|
|
118f9a34d8 | ||
|
|
b61dfac569 | ||
|
|
79160f9b5c | ||
|
|
d2523cff4a | ||
|
|
1839599769 | ||
|
|
29e1b56e78 | ||
|
|
47e647c712 | ||
|
|
a87b0b0447 | ||
|
|
96b8fcad3a | ||
|
|
cf0fa0024c | ||
|
|
aba5ed9271 | ||
|
|
63141f3578 | ||
|
|
612041635d | ||
|
|
efcc0fd5cb | ||
|
|
b0724f5b66 | ||
|
|
66a2b4b6d2 | ||
|
|
77b4dfa50a | ||
|
|
1e6e7fd6d8 | ||
|
|
46a1b673ba | ||
|
|
7230325e62 | ||
|
|
af8e733cfb | ||
|
|
26ab43c57f | ||
|
|
15ed4ef1ce | ||
|
|
0ac76766bd | ||
|
|
abb97ad99f | ||
|
|
6cdc26b55b | ||
|
|
9f19fd3c75 | ||
|
|
61dedb7e7b | ||
|
|
65d2b8b2cb | ||
|
|
1d3f206660 | ||
|
|
ab46899e72 | ||
|
|
723a423b06 | ||
|
|
a837b97870 | ||
|
|
8be0789f25 | ||
|
|
99d017144d | ||
|
|
891f71006b | ||
|
|
d25017216a | ||
|
|
83b7c7b054 | ||
|
|
283c2a17df | ||
|
|
44de049f3b | ||
|
|
920d08f039 | ||
|
|
0cf1e338c2 | ||
|
|
293a2b800e | ||
|
|
650a099e19 | ||
|
|
46c2c8616e | ||
|
|
6295a5c878 | ||
|
|
39d8e19e16 | ||
|
|
9d3a44d110 | ||
|
|
54d46719c2 | ||
|
|
dbed2c17db | ||
|
|
f772ef2efd | ||
|
|
2f28f96f8d | ||
|
|
1f2bcf7c34 | ||
|
|
a9a5850fd4 | ||
|
|
09f3bfd8f4 | ||
|
|
3813fbf8f2 | ||
|
|
16001f8d4e | ||
|
|
49d3dbad9a | ||
|
|
56f32a4da2 | ||
|
|
a297b8d6d8 | ||
|
|
d365f48192 | ||
|
|
df6d955261 | ||
|
|
9fcaf9f5cc | ||
|
|
43a7b7faa5 | ||
|
|
69253385c5 | ||
|
|
cea7d61481 | ||
|
|
41f9a2e6e2 | ||
|
|
31d3659098 | ||
|
|
c12bfb157e | ||
|
|
a55dabb1cd | ||
|
|
06fec3c280 | ||
|
|
f733a27ad7 | ||
|
|
7ea39eb545 | ||
|
|
a85f898ef5 | ||
|
|
519975f3cf | ||
|
|
0e9a071e96 | ||
|
|
b09e4938b7 | ||
|
|
0d5bfdafdf | ||
|
|
d829e39b66 | ||
|
|
b11730303e | ||
|
|
49d127e957 | ||
|
|
e7353c4757 | ||
|
|
3106685972 | ||
|
|
58d43063ec |
10
.gitignore
vendored
10
.gitignore
vendored
@@ -4,8 +4,16 @@ config.php
|
|||||||
uploads/favicon.ico
|
uploads/favicon.ico
|
||||||
uploads/clients/*
|
uploads/clients/*
|
||||||
!uploads/clients/index.php
|
!uploads/clients/index.php
|
||||||
|
uploads/custom/*
|
||||||
|
!uploads/custom/index.php
|
||||||
|
uploads/documents/*
|
||||||
|
!uploads/documents/index.php
|
||||||
|
uploads/document_templates/*
|
||||||
|
!uploads/document_templates/index.php
|
||||||
uploads/expenses/*
|
uploads/expenses/*
|
||||||
!uploads/expenses/index.php
|
!uploads/expenses/index.php
|
||||||
|
uploads/recurring_tickets/*
|
||||||
|
!uploads/recurring_tickets/index.php
|
||||||
uploads/settings/*
|
uploads/settings/*
|
||||||
!uploads/settings/index.php
|
!uploads/settings/index.php
|
||||||
uploads/users/*
|
uploads/users/*
|
||||||
@@ -14,6 +22,8 @@ uploads/tmp/*
|
|||||||
!uploads/tmp/index.php
|
!uploads/tmp/index.php
|
||||||
uploads/tickets/*
|
uploads/tickets/*
|
||||||
!uploads/tickets/index.php
|
!uploads/tickets/index.php
|
||||||
|
uploads/ticket_templates/*
|
||||||
|
!uploads/ticket_templates/index.php
|
||||||
.idea/*
|
.idea/*
|
||||||
plugins/htmlpurifier/standalone/HTMLPurifier/DefinitionCache/Serializer/HTML/*
|
plugins/htmlpurifier/standalone/HTMLPurifier/DefinitionCache/Serializer/HTML/*
|
||||||
!plugins/htmlpurifier/standalone/HTMLPurifier/DefinitionCache/Serializer/HTML/.gitkeep
|
!plugins/htmlpurifier/standalone/HTMLPurifier/DefinitionCache/Serializer/HTML/.gitkeep
|
||||||
|
|||||||
176
CHANGELOG.md
176
CHANGELOG.md
@@ -2,6 +2,180 @@
|
|||||||
|
|
||||||
This file documents all notable changes made to ITFlow.
|
This file documents all notable changes made to ITFlow.
|
||||||
|
|
||||||
|
## [25.12.1] Maint Release
|
||||||
|
|
||||||
|
### Major Changes
|
||||||
|
- Unified the Client/Agent Login and process (Note only Client Users can Reset passwords from the login page, does not apply to agent users).
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
- Fix Payment Provider not adding an account.
|
||||||
|
- Fix New ticket button in contact details in the related tickets section.
|
||||||
|
|
||||||
|
### New Features & Updates
|
||||||
|
- You can now Set Payment Provider income/expense account, expense vendor and expense category upond creation or editing.
|
||||||
|
- Moved Saved Payment Provider Methods away from admin side nav to the count link within Payment Providers page.
|
||||||
|
- Moved AI Models from the admin side nav to the model count link within AI Providers.
|
||||||
|
- Add Favicon Reset.
|
||||||
|
|
||||||
|
## [25.12] Stable Release
|
||||||
|
|
||||||
|
### Breaking Changes ###
|
||||||
|
- For Existing installs: **php-xml** extension needs to be installed for document creation and editing, new install script does this for you as of Dec 6th 2025. To install php-xml: `sudo apt install php-xml`
|
||||||
|
|
||||||
|
### Major Changes
|
||||||
|
- Consolidated "Files" and "Documents" into a single section called **Files**.
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
- Resolved issue with updating asset notes in asset details.
|
||||||
|
- Fixed problem with bulk ticket merging.
|
||||||
|
- Corrected issue where decimal inputs (e.g., price, cost) weren’t displaying on iPhones in certain forms.
|
||||||
|
- Added CSV escaping to the sample export data in areas where a sample CSV template is provided.
|
||||||
|
- Fix a race condition where dupe tickets, invoices, recurring invoices, recurring tickets, quotes will be created using the same number if created in parallel espcecially when using the API.
|
||||||
|
|
||||||
|
### New Features & Updates
|
||||||
|
- Introduced automatic subject-based ticket merging/reply detection. Now, if an email comes from a known contact or domain and the subject matches 95% of a ticket opened in the last 7 days, it will be merged automatically.
|
||||||
|
- Added `cleanInput` function to sanitize data before inserting it into the database when using MySQLi prepared statements.
|
||||||
|
- Migrated client post functionality to use MySQLi prepared statements.
|
||||||
|
- Updated payment method post functionality to use MySQLi prepared statements.
|
||||||
|
- Implemented `saveBase64Images()` to convert base64-encoded `<img>` tags into actual image files stored under `/uploads/<module>/<id>/` with secure filenames. Added wrapper functions, and updated document creation to use processed image paths.
|
||||||
|
- For new documents and document templates, images are now stored in `/uploads/documents/$document_id` instead of being stored as base64 in the database, using the `saveBase64Images()` function.
|
||||||
|
- UI/UX improvements made to the document details page.
|
||||||
|
- Removed sidebar quick-add options.
|
||||||
|
- Created new folders in the uploads directory: `documents`, `document_templates`, and `recurring_tickets`.
|
||||||
|
- Reworked the bulk action function to pass the name arrays, instead of a generic `selected_ids` array. This allows multiple bulk name arrays to be passed at once, currently used for the new file-document merge.
|
||||||
|
- Big task: Converted the remaining modals to use the new `ajax-modal` system, enabling more flexible flow expansion going forward.
|
||||||
|
- Mail queue: Added a `--no-mx-validation` flag to bypass recipient domain MX validation.
|
||||||
|
- Bump PHPMailer from 7.0.0 to 7.0.1.
|
||||||
|
- Bump stripe-php from 18.1.0 to 19.0.0.
|
||||||
|
- Bump TCPDF from 6.10.0 to 6.10.1.
|
||||||
|
- Bump TinyMCE from 8.2.0 to 8.2.2.
|
||||||
|
|
||||||
|
## [25.11.1] Maint Release
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
- Fix broken edit Payment Method.
|
||||||
|
- Fix unable to delete Vendor Template.
|
||||||
|
- Fix Mail Queue link in flash alert for testing email and sending a quote.
|
||||||
|
- Add Show Category Type select if not defined.
|
||||||
|
- Add Show Product Type select if not defined.
|
||||||
|
- Fix add ticket watcher.
|
||||||
|
- Fix if Client isn't assigned to a ticket dont show client view.
|
||||||
|
- Fix missing session client id check when paying an invoice from client portal.
|
||||||
|
- Update Composer Webklex-IMAP library dependency symfony/http-foundation from 7.3.3 to 7.3.7 to fix security related issues.
|
||||||
|
- Add back delete Payment provider the database will handle cascade deletes to saved cards, recurring payments and client payment provider reference.
|
||||||
|
- Don't show Client Tickets Breadcrumb if no client is assigned to a ticket.
|
||||||
|
- Don't Show Contact or Assignment Tab in edit ticket if no Client is Assigned.
|
||||||
|
- Don't Show add contact, asset, vendor, watcher if not client is assigned to a ticket.
|
||||||
|
- Don't Show Public Comment & Email if contact email doesn't exist.
|
||||||
|
- Fixed IMAP Test whicn now uses RAW TCP Connection instead of the depracated php-imap extension.
|
||||||
|
- Fix Broken Link in Ticket Updates via Client Portal to agent.
|
||||||
|
|
||||||
|
### Added / Changed
|
||||||
|
- [Feature] Added Asset Tags.
|
||||||
|
- [Feature] Added Quick Add Links to most side bar navs example quickly add a client from sidebar.
|
||||||
|
- Migrate ticket template add to ajax modal.
|
||||||
|
- Add TOTP secret to Client Export PDF in Credential section.
|
||||||
|
- Add UserID on hover in users listing.
|
||||||
|
- Merge ticket now redirects to the new ticket details page.
|
||||||
|
- [Feature] Add Pay via saved card under invoice Listings.
|
||||||
|
- Ticket Related Side Items UI Cleanup to use btn-tool class.
|
||||||
|
|
||||||
|
## [25.11] Stable
|
||||||
|
|
||||||
|
### Deprecation Notice:
|
||||||
|
- **Outdated CRON Scripts**: The following scripts are removed.
|
||||||
|
- `/scripts/cron_mail_queue.php`
|
||||||
|
- `/scripts/cron_ticket_email_parser.php`
|
||||||
|
- `/scripts/cron.php`
|
||||||
|
- `/scripts/cron_domain_refresher.php`
|
||||||
|
- `/scripts/cron_certificate_refresher.php`
|
||||||
|
|
||||||
|
**Action Required**: Transition to the new versions:
|
||||||
|
- `/cron/mail_queue.php`
|
||||||
|
- `/cron/ticket_email_parser.php`
|
||||||
|
- `/cron/cron.php`
|
||||||
|
- `/cron/domain_refresher.php`
|
||||||
|
- `/cron/certificate_refresher.php`
|
||||||
|
|
||||||
|
- PHP Extensions php-imap and php-mime-mail-parser are no longer required.
|
||||||
|
---
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
- **Ticket Listing**: Resolved issue where the “Check All” checkbox was visible even when ticket status wasn’t set. Now hidden for closed tickets only.
|
||||||
|
- **Timer Auto-Start**: Show H/M/S placeholders when timer auto-start is disabled.
|
||||||
|
- **Ticket Guest URL**: Fixed email not including the ticket guest URL key.
|
||||||
|
- **EML Generation**: Resolved issue with EML not being generated in the new ticket parser.
|
||||||
|
- **New Ticket Mail Notification**: Included message when notifying the tech of a reply in the new ticket mail parser.
|
||||||
|
- **Advanced Filter Collapse**: Added clause to prevent collapse of advanced filters when the “from” date is set to the default (1970-01-01).
|
||||||
|
- **Recurring Invoice**: Fixed issue where email was marked as sent but not actually sent when forcing a recurring invoice to an invoice.
|
||||||
|
- **CSRF Token**: Fixed issue with deleting recurring ticket from asset details page due to missing CSRF check token.
|
||||||
|
- **Vendor Website Link**: Fixed missing `https://` prefix in the vendor website link on the vendor details modal.
|
||||||
|
- **Agent Select Box**: Resolved issue where agents sometimes didn’t appear in the agent select boxes.
|
||||||
|
- **TinyMCE**: Fixed TinyMCE editor issue on Bulk Create Ticket in Assets.
|
||||||
|
- **Ticket Timer**: Fixed ticket timer initialization after reload and when the tab is put to sleep (background tab).
|
||||||
|
- **Client Deletion**: Fixed issue with client deletion.
|
||||||
|
- **Domain Records**: Added flag for missing SOA record when adding a domain (prevents subdomain creation).
|
||||||
|
- **Domain Fetching**: Quits domain record fetching if no SOA record exists (prevents subdomains).
|
||||||
|
- **Domain Expiry**: Only show time to expiry when there’s an expiry date set; otherwise, display a dash.
|
||||||
|
- **Certificates**: Improved handling of empty date in the agent UI.
|
||||||
|
- **Certificates API**: Fixed bug with missing JS to fetch certificate details.
|
||||||
|
- **API Updates**:
|
||||||
|
- Clients API: Added support for archiving/un-archiving clients, updating client data, and abbreviation support.
|
||||||
|
- Contacts API: Added archiving/un-archiving and restriction to only allow one primary contact per client.
|
||||||
|
- Mail Queue: Added recipient domain MX validation before sending emails.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Added / Changed
|
||||||
|
- **Backup / Restore**: Improved backup and restore by streaming data to disk (to prevent memory issues), setting unlimited timeouts, checking for bad backup contents, and using PHP for DB import instead of shell exec. Added `.htaccess` to prevent PHP execution in `/uploads/` directory.
|
||||||
|
- **Ajax Modals**: Migrated all Add and Bulk modals to the new Ajax Modal for improved performance.
|
||||||
|
- **Recurring Ticket Sorting**: Default sorting of recurring tickets by `RunDate` instead of subject.
|
||||||
|
- **Recurring Ticket Enhancements**:
|
||||||
|
- Added Billable column.
|
||||||
|
- Added bulk actions for setting priority, agent, billable status, and next run dates.
|
||||||
|
- Added filters for category, assigned agent, and billable status.
|
||||||
|
- Added new frequency options: 3-day and biweekly.
|
||||||
|
- **Asset Select**: Updated asset select dropdown to separate asset types using opt groups (planned for wider use).
|
||||||
|
- **Expiring Domains & Certificates**: Added "30 Day" warning for expiring domains and certificates in the dashboard.
|
||||||
|
- **Ticket Search**: Allowed search using both ticket prefix and number.
|
||||||
|
- **Recurring Invoice**: Cancel recurring invoices when the associated client is archived.
|
||||||
|
- **Credentials Import/Export**: Now includes TOTP secrets when importing/exporting credentials.
|
||||||
|
- **Asset Notes Import**: Allowed importing of asset notes.
|
||||||
|
- **Ticket View**: Added a "View HTML Code" button in all ticket views for TinyMCE.
|
||||||
|
- **Date Range Picker**: Updated all date filters to use the improved DateRangePicker JS.
|
||||||
|
- **Bulk Ticket Creation**: Added bulk ticket creation for clients.
|
||||||
|
- **Sidebar Updates**: Updated all sidebars to use absolute paths for easier integration with custom code.
|
||||||
|
- **Document Actions**: Added Archive and Delete buttons to the Document Details view with improved redirect behavior.
|
||||||
|
- **Ticket Template Sorting**: Allowed sorting by task count in ticket templates.
|
||||||
|
- **Contact Modal UI**: Updated contact details modal to display contact information at the top.
|
||||||
|
- **API & Code Updates**:
|
||||||
|
- Separated out post files for recurring tickets, invoices, expenses, and payments.
|
||||||
|
- Removed unused budget code.
|
||||||
|
- **Invoice Product Autocomplete**: Now allows searching for product codes as well as names.
|
||||||
|
- **Client Duplicate Check**: Flags duplicate clients or leads when using the client add modal.
|
||||||
|
- **Recurring Invoice Reference**: Added a column to invoices indicating if they were created from a recurring invoice.
|
||||||
|
- **Global Search Enhancements**:
|
||||||
|
- Allowed ticket details to be searchable in global search.
|
||||||
|
- Allowed searching for quotes in global search.
|
||||||
|
- **UI/UX Improvements**:
|
||||||
|
- Spruced up the ticket details page UI.
|
||||||
|
- Added contact email validation to flag duplicates or invalid addresses.
|
||||||
|
- **API Debugging**: Log API endpoint/URL path for authentication failures to aid in debugging.
|
||||||
|
- **Image Upload Optimization**: Removed image optimization from uploads (this will be handled by a cron job in the future).
|
||||||
|
- **View Behavior Change**: Updated ticket/invoice/quote views to always be in the Client section, showing client-side navigation and top info bar.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Library Updates:
|
||||||
|
- **DataTable**: Bumped from 2.3.3 to 2.3.4.
|
||||||
|
- **TinyMCE**: Bumped from 8.0.2 to 8.2.0.
|
||||||
|
- **Stripe-PHP**: Bumped from 17.6.0 to 18.1.0.
|
||||||
|
- **PHPMailer**: Bumped from 6.10.0 to 7.0.0.
|
||||||
|
- **Chart.js**: Bumped from 4.5.0 to 4.5.1.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [25.10.1]
|
## [25.10.1]
|
||||||
- Deprecation Notice: `/scripts/cron_mail_queue.php` , `/scripts/cron_ticket_email_parser.php` , `/scripts/cron.php` `/scripts/cron_domain_refresher.php`, `/scripts/cron_certificate_refresher.php` are being phased out. Please transition to `/cron/mail_queue.php` , `/cron/ticket_email_parser.php`, `/cron/cron.php`, `/cron/domain_refresher.php`, `/cron/certificate_refresher.php` These older scripts will be removed in the November 25.11 release—update accordingly. 25.10.1 installs have the script already configured.
|
- Deprecation Notice: `/scripts/cron_mail_queue.php` , `/scripts/cron_ticket_email_parser.php` , `/scripts/cron.php` `/scripts/cron_domain_refresher.php`, `/scripts/cron_certificate_refresher.php` are being phased out. Please transition to `/cron/mail_queue.php` , `/cron/ticket_email_parser.php`, `/cron/cron.php`, `/cron/domain_refresher.php`, `/cron/certificate_refresher.php` These older scripts will be removed in the November 25.11 release—update accordingly. 25.10.1 installs have the script already configured.
|
||||||
|
|
||||||
@@ -160,7 +334,7 @@ We will provide example code with directory structure for each custom directory
|
|||||||
---
|
---
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Several security vulnerabilities patched.
|
- Several security vulnerabilities patched (with thanks to www.helx.io).
|
||||||
- Ticket status is no longer updated when scheduling.
|
- Ticket status is no longer updated when scheduling.
|
||||||
- Client Portal: Tech contacts can no longer edit their own details.
|
- Client Portal: Tech contacts can no longer edit their own details.
|
||||||
- Fixed overlapping logo issue in Invoice/Quote PDF exports.
|
- Fixed overlapping logo issue in Invoice/Quote PDF exports.
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<br />
|
<br />
|
||||||
<a href="https://demo.itflow.org"><strong>View demo</strong></a>
|
<a href="https://demo.itflow.org"><strong>View demo</strong></a>
|
||||||
<br />
|
<br />
|
||||||
Username: <b>demo@demo</b> | Password: <b>demo</b>
|
Username: <b>demo@demo.com</b> | Password: <b>demo</b>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<a href="https://itflow.org/#about">About</a>
|
<a href="https://itflow.org/#about">About</a>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ We operate a rolling release model. Any bug fixes will be released into latest v
|
|||||||
|
|
||||||
| Version | Supported |
|
| Version | Supported |
|
||||||
|---------| ------------------ |
|
|---------| ------------------ |
|
||||||
| 25.05 | :white_check_mark: |
|
| 25.12 | :white_check_mark: |
|
||||||
|
|
||||||
## Reporting a Vulnerability via GitHub Security Advisories
|
## Reporting a Vulnerability via GitHub Security Advisories
|
||||||
|
|
||||||
|
|||||||
@@ -12,11 +12,21 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<ol class="breadcrumb d-print-none">
|
||||||
|
<li class="breadcrumb-item">
|
||||||
|
<a href="/admin">Admin</a>
|
||||||
|
</li>
|
||||||
|
<li class="breadcrumb-item">
|
||||||
|
<a href="ai_provider.php">AI Providers</a>
|
||||||
|
</li>
|
||||||
|
<li class="breadcrumb-item active">AI Models</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
<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-robot mr-2"></i>AI Models</h3>
|
<h3 class="card-title mt-2"><i class="fas fa-fw fa-robot mr-2"></i>AI Models</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addAIModelModal"><i class="fas fa-plus mr-2"></i>Add Model</button>
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/ai/ai_model_add.php"><i class="fas fa-plus mr-2"></i>Add Model</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@@ -104,5 +114,4 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/ai/ai_model_add.php";
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
<div class="card-header py-2">
|
<div class="card-header py-2">
|
||||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-robot mr-2"></i>AI Providers</h3>
|
<h3 class="card-title mt-2"><i class="fas fa-fw fa-robot mr-2"></i>AI Providers</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addAIProviderModal"><i class="fas fa-plus mr-2"></i>Add Provider</button>
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/ai/ai_provider_add.php"><i class="fas fa-plus mr-2"></i>Add Provider</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@@ -39,7 +39,7 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
Key <?php if ($sort == 'ai_provider_api_key') { echo $order_icon; } ?>
|
Key <?php if ($sort == 'ai_provider_api_key') { echo $order_icon; } ?>
|
||||||
</a>
|
</a>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th class="text-center">
|
||||||
<a class="text-dark">Models</a>
|
<a class="text-dark">Models</a>
|
||||||
</th>
|
</th>
|
||||||
<th class="text-center">Action</th>
|
<th class="text-center">Action</th>
|
||||||
@@ -67,7 +67,8 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
</td>
|
</td>
|
||||||
<td><?php echo $url; ?></td>
|
<td><?php echo $url; ?></td>
|
||||||
<td><?php echo $key; ?></td>
|
<td><?php echo $key; ?></td>
|
||||||
<td><?php echo $ai_model_count; ?></td>
|
<td class="text-center">
|
||||||
|
<a class="badge badge-dark badge-pill p-2" href="ai_model.php"><?= $ai_model_count ?></a>
|
||||||
<td>
|
<td>
|
||||||
<div class="dropdown dropleft text-center">
|
<div class="dropdown dropleft text-center">
|
||||||
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
||||||
@@ -105,5 +106,4 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/ai/ai_provider_add.php";
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<div class="card-header py-2">
|
<div class="card-header py-2">
|
||||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-key mr-2"></i>API Keys</h3>
|
<h3 class="card-title mt-2"><i class="fas fa-fw fa-key mr-2"></i>API Keys</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addApiKeyModal"><i class="fas fa-plus mr-2"></i>Create</button>
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/api/api_key_add.php"><i class="fas fa-plus mr-2"></i>New API Key</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -128,17 +128,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<input class="form-check-input bulk-select" type="checkbox" name="api_key_ids[]" value="<?php echo $api_key_id ?>">
|
<input class="form-check-input bulk-select" type="checkbox" name="api_key_ids[]" value="<?php echo $api_key_id ?>">
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="text-bold"><?php echo $api_key_name; ?></td>
|
<td class="text-bold"><?php echo $api_key_name; ?></td>
|
||||||
|
|
||||||
<td><?php echo $api_key_client; ?></td>
|
<td><?php echo $api_key_client; ?></td>
|
||||||
|
|
||||||
<td><?php echo $api_key_secret; ?></td>
|
<td><?php echo $api_key_secret; ?></td>
|
||||||
|
|
||||||
<td><?php echo $api_key_created_at; ?></td>
|
<td><?php echo $api_key_created_at; ?></td>
|
||||||
|
|
||||||
<td><?php echo $api_key_expire; ?></td>
|
<td><?php echo $api_key_expire; ?></td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<div class="dropdown dropleft text-center">
|
<div class="dropdown dropleft text-center">
|
||||||
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
||||||
@@ -162,15 +156,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<?php require_once "../includes/filter_footer.php";
|
<?php require_once "../includes/filter_footer.php"; ?>
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="../js/bulk_actions.js"></script>
|
<script src="../js/bulk_actions.js"></script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/api/api_key_add.php";
|
|
||||||
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|
||||||
|
|||||||
125
admin/contract_template.php
Normal file
125
admin/contract_template.php
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// Default Column Sort by Filter
|
||||||
|
$sort = "contract_template_name";
|
||||||
|
$order = "ASC";
|
||||||
|
|
||||||
|
require_once "includes/inc_all_admin.php";
|
||||||
|
|
||||||
|
// Search query
|
||||||
|
$sql = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT SQL_CALC_FOUND_ROWS * FROM contract_templates
|
||||||
|
WHERE contract_template_name LIKE '%$q%' OR contract_template_type LIKE '%$q%' OR contract_template_name LIKE '%$q%'
|
||||||
|
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||||
|
);
|
||||||
|
|
||||||
|
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="card card-dark">
|
||||||
|
<div class="card-header py-2">
|
||||||
|
<h3 class="card-title mt-2"><i class="fa fa-fw fa-file-contract mr-2"></i>Contract Templates</h3>
|
||||||
|
<div class="card-tools">
|
||||||
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/contract_template/contract_template_add.php" data-modal-size="lg">
|
||||||
|
<i class="fas fa-plus mr-2"></i>New Template
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
<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 templates">
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-secondary"><i class="fa fa-search"></i></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="table-responsive-sm">
|
||||||
|
<table class="table table-striped table-borderless table-hover">
|
||||||
|
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||||
|
<tr>
|
||||||
|
<th>Template Name</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Update Frequency</th>
|
||||||
|
<th>SLA (L/M/H Response)</th>
|
||||||
|
<th>SLA (L/M/H Resolution)</th>
|
||||||
|
<th>Hourly Rate</th>
|
||||||
|
<th>After Hours Rate</th>
|
||||||
|
<th>Support Hours</th>
|
||||||
|
<th>Net Terms</th>
|
||||||
|
<th>Created</th>
|
||||||
|
<th>Updated</th>
|
||||||
|
<th class="text-center">Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
|
$id = intval($row['contract_template_id']);
|
||||||
|
$name = nullable_htmlentities($row['contract_template_name']);
|
||||||
|
$type = nullable_htmlentities($row['contract_template_type']);
|
||||||
|
$freq = nullable_htmlentities($row['contract_template_update_frequency']);
|
||||||
|
$sla_low_resp = nullable_htmlentities($row['sla_low_response_time']);
|
||||||
|
$sla_med_resp = nullable_htmlentities($row['sla_medium_response_time']);
|
||||||
|
$sla_high_resp = nullable_htmlentities($row['sla_high_response_time']);
|
||||||
|
$sla_low_res = nullable_htmlentities($row['sla_low_resolution_time']);
|
||||||
|
$sla_med_res = nullable_htmlentities($row['sla_medium_resolution_time']);
|
||||||
|
$sla_high_res = nullable_htmlentities($row['sla_high_resolution_time']);
|
||||||
|
$hourly_rate = nullable_htmlentities($row['contract_template_hourly_rate']);
|
||||||
|
$after_hours = nullable_htmlentities($row['contract_template_after_hours_hourly_rate']);
|
||||||
|
$support_hours = nullable_htmlentities($row['contract_template_support_hours']);
|
||||||
|
$net_terms = nullable_htmlentities($row['contract_template_net_terms']);
|
||||||
|
$created = nullable_htmlentities($row['contract_template_created_at']);
|
||||||
|
$updated = nullable_htmlentities($row['contract_template_updated_at']);
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a class="text-bold" href="contract_template_details.php?contract_template_id=<?php echo $id; ?>">
|
||||||
|
<i class="fas fa-fw fa-file-alt text-dark"></i> <?php echo $name; ?>
|
||||||
|
</a>
|
||||||
|
<div class="mt-1 text-secondary"><?php echo nullable_htmlentities($row['contract_template_description']); ?></div>
|
||||||
|
</td>
|
||||||
|
<td><?php echo $type; ?></td>
|
||||||
|
<td><?php echo $freq; ?></td>
|
||||||
|
<td><?php echo "$sla_low_resp / $sla_med_resp / $sla_high_resp"; ?></td>
|
||||||
|
<td><?php echo "$sla_low_res / $sla_med_res / $sla_high_res"; ?></td>
|
||||||
|
<td><?php echo $hourly_rate; ?></td>
|
||||||
|
<td><?php echo $after_hours; ?></td>
|
||||||
|
<td><?php echo $support_hours; ?></td>
|
||||||
|
<td><?php echo $net_terms; ?></td>
|
||||||
|
<td><?php echo $created; ?></td>
|
||||||
|
<td><?php echo $updated; ?></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 ajax-modal" href="#"
|
||||||
|
data-modal-size="xl"
|
||||||
|
data-modal-url="modals/contract_template/contract_template_edit.php?id=<?= $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" href="post.php?delete_contract_template=<?php echo $id; ?>">
|
||||||
|
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<br>
|
||||||
|
</div>
|
||||||
|
<?php require_once "../includes/filter_footer.php"; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php require_once "../includes/footer.php"; ?>
|
||||||
@@ -21,7 +21,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<div class="card-header py-2">
|
<div class="card-header py-2">
|
||||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-external-link-alt mr-2"></i>Custom Links</h3>
|
<h3 class="card-title mt-2"><i class="fas fa-fw fa-external-link-alt mr-2"></i>Custom Links</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addLinkModal"><i class="fas fa-plus mr-2"></i>New Link</button>
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/custom_link/custom_link_add.php"><i class="fas fa-plus mr-2"></i>New Link</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -145,5 +145,4 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/custom_link/custom_link_add.php";
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -4033,10 +4033,131 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.3.6'");
|
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.3.6'");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (CURRENT_DATABASE_VERSION == '2.3.5') {
|
if (CURRENT_DATABASE_VERSION == '2.3.6') {
|
||||||
// // Insert queries here required to update to DB version 2.3.5
|
// Create New Contract Templates Table
|
||||||
|
mysqli_query($mysqli, "CREATE TABLE `contract_templates` (
|
||||||
|
`contract_template_id` INT(11) AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
`contract_template_name` VARCHAR(255) NOT NULL,
|
||||||
|
`contract_template_description` TEXT NULL DEFAULT NULL,
|
||||||
|
`contract_template_type` VARCHAR(50) NULL DEFAULT NULL,
|
||||||
|
|
||||||
|
`contract_template_sla_low_response_time` INT(11) NULL DEFAULT NULL,
|
||||||
|
`contract_template_sla_low_resolution_time` INT(11) NULL DEFAULT NULL,
|
||||||
|
`contract_template_sla_medium_response_time` INT(11) NULL DEFAULT NULL,
|
||||||
|
`contract_template_sla_medium_resolution_time` INT(11) NULL DEFAULT NULL,
|
||||||
|
`contract_template_sla_high_response_time` INT(11) NULL DEFAULT NULL,
|
||||||
|
`contract_template_sla_high_resolution_time` INT(11) NULL DEFAULT NULL,
|
||||||
|
|
||||||
|
`contract_template_rate_standard` DECIMAL(10,2) NULL DEFAULT NULL,
|
||||||
|
`contract_template_rate_after_hours` DECIMAL(10,2) NULL DEFAULT NULL,
|
||||||
|
|
||||||
|
`contract_template_net_terms` VARCHAR(50) NULL DEFAULT NULL,
|
||||||
|
`contract_template_support_hours` VARCHAR(100) NULL DEFAULT NULL,
|
||||||
|
`contract_template_renewal_frequency` VARCHAR(50) NULL DEFAULT NULL,
|
||||||
|
|
||||||
|
`contract_template_details` TEXT NULL DEFAULT NULL,
|
||||||
|
|
||||||
|
`contract_template_created_at` DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`contract_template_updated_at` DATETIME NULL ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
`contract_template_archived_at` DATETIME NULL DEFAULT NULL
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;");
|
||||||
|
|
||||||
|
|
||||||
|
// Create New Contracts Table
|
||||||
|
mysqli_query($mysqli, "CREATE TABLE `contracts` (
|
||||||
|
`contract_id` INT(11) AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
`contract_name` VARCHAR(255) NOT NULL,
|
||||||
|
`contract_status` VARCHAR(50) NOT NULL,
|
||||||
|
`contract_type` VARCHAR(50) NOT NULL,
|
||||||
|
|
||||||
|
`contract_sla_low_response_time` INT(11) NULL DEFAULT NULL,
|
||||||
|
`contract_sla_low_resolution_time` INT(11) NULL DEFAULT NULL,
|
||||||
|
`contract_sla_medium_response_time` INT(11) NULL DEFAULT NULL,
|
||||||
|
`contract_sla_medium_resolution_time` INT(11) NULL DEFAULT NULL,
|
||||||
|
`contract_sla_high_response_time` INT(11) NULL DEFAULT NULL,
|
||||||
|
`contract_sla_high_resolution_time` INT(11) NULL DEFAULT NULL,
|
||||||
|
|
||||||
|
`contract_details` TEXT NULL DEFAULT NULL,
|
||||||
|
|
||||||
|
`contract_client_id` INT(11) NULL DEFAULT NULL,
|
||||||
|
`contract_client_name` VARCHAR(255) NULL DEFAULT NULL,
|
||||||
|
`contract_client_address` TEXT NULL DEFAULT NULL,
|
||||||
|
`contract_client_email` VARCHAR(255) NULL DEFAULT NULL,
|
||||||
|
`contract_client_phone` VARCHAR(100) NULL DEFAULT NULL,
|
||||||
|
|
||||||
|
`contract_contact_name` VARCHAR(255) NULL DEFAULT NULL,
|
||||||
|
`contract_contact_signature` TEXT NULL DEFAULT NULL,
|
||||||
|
`contract_contact_signature_date` DATETIME NULL DEFAULT NULL,
|
||||||
|
|
||||||
|
`contract_agent_name` VARCHAR(255) NULL DEFAULT NULL,
|
||||||
|
`contract_agent_signature` TEXT NULL DEFAULT NULL,
|
||||||
|
`contract_agent_signature_date` DATETIME NULL DEFAULT NULL,
|
||||||
|
|
||||||
|
`contract_rate_standard` DECIMAL(10,2) NULL DEFAULT NULL,
|
||||||
|
`contract_rate_after_hours` DECIMAL(10,2) NULL DEFAULT NULL,
|
||||||
|
|
||||||
|
`contract_net_terms` VARCHAR(50) NULL DEFAULT NULL,
|
||||||
|
`contract_support_hours` VARCHAR(100) NULL DEFAULT NULL,
|
||||||
|
|
||||||
|
`contract_start_date` DATE NULL DEFAULT NULL,
|
||||||
|
`contract_end_date` DATE NULL DEFAULT NULL,
|
||||||
|
`contract_renewal_frequency` VARCHAR(50) NULL DEFAULT NULL,
|
||||||
|
|
||||||
|
`contract_created_at` DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`contract_updated_at` DATETIME NULL ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
`contract_archived_at` DATETIME NULL DEFAULT NULL,
|
||||||
|
|
||||||
|
FOREIGN KEY (`contract_client_id`) REFERENCES `clients`(`client_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;");
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.3.7'");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CURRENT_DATABASE_VERSION == '2.3.7') {
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "
|
||||||
|
CREATE TABLE `asset_tags` (
|
||||||
|
`asset_tag_asset_id` INT(11) NOT NULL,
|
||||||
|
`asset_tag_tag_id` INT(11) NOT NULL,
|
||||||
|
PRIMARY KEY (`asset_tag_asset_id`, `asset_tag_tag_id`),
|
||||||
|
CONSTRAINT `fk_asset`
|
||||||
|
FOREIGN KEY (`asset_tag_asset_id`)
|
||||||
|
REFERENCES `assets`(`asset_id`)
|
||||||
|
ON DELETE CASCADE,
|
||||||
|
CONSTRAINT `fk_tag`
|
||||||
|
FOREIGN KEY (`asset_tag_tag_id`)
|
||||||
|
REFERENCES `tags`(`tag_id`)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
");
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.3.8'");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CURRENT_DATABASE_VERSION == '2.3.8') {
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "
|
||||||
|
CREATE TABLE `task_approvals` (
|
||||||
|
`approval_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`approval_scope` enum('client','internal') NOT NULL,
|
||||||
|
`approval_type` enum('any','technical','billing','specific') NOT NULL,
|
||||||
|
`approval_required_user_id` int(11) DEFAULT NULL,
|
||||||
|
`approval_status` enum('pending','approved','declined') NOT NULL,
|
||||||
|
`approval_created_by` int(11) NOT NULL,
|
||||||
|
`approval_approved_by` varchar(255) DEFAULT NULL,
|
||||||
|
`approval_url_key` varchar(200) NOT NULL,
|
||||||
|
`approval_task_id` int(11) NOT NULL,
|
||||||
|
PRIMARY KEY (`approval_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
");
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.3.9'");
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (CURRENT_DATABASE_VERSION == '2.3.9') {
|
||||||
|
// // Insert queries here required to update to DB version 2.4.0
|
||||||
// // Then, update the database to the next sequential version
|
// // Then, update the database to the next sequential version
|
||||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.3.6'");
|
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.4.0'");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -46,14 +46,13 @@ $systemInfo[] = [
|
|||||||
// Section: PHP Extensions
|
// Section: PHP Extensions
|
||||||
$phpExtensions = [];
|
$phpExtensions = [];
|
||||||
$extensions = [
|
$extensions = [
|
||||||
'php-mailparse' => 'mailparse',
|
|
||||||
'php-imap' => 'imap',
|
|
||||||
'php-mysqli' => 'mysqli',
|
'php-mysqli' => 'mysqli',
|
||||||
'php-intl' => 'intl',
|
'php-intl' => 'intl',
|
||||||
'php-curl' => 'curl',
|
'php-curl' => 'curl',
|
||||||
'php-mbstring' => 'mbstring',
|
'php-mbstring' => 'mbstring',
|
||||||
'php-gd' => 'gd',
|
'php-gd' => 'gd',
|
||||||
'php-zip' => 'zip',
|
'php-zip' => 'zip',
|
||||||
|
'php-xml' => 'xml',
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($extensions as $name => $ext) {
|
foreach ($extensions as $name => $ext) {
|
||||||
@@ -767,4 +766,3 @@ $mysqli->close();
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
<div class="card-header py-2">
|
<div class="card-header py-2">
|
||||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-file mr-2"></i>Document Templates</h3>
|
<h3 class="card-title mt-2"><i class="fa fa-fw fa-file mr-2"></i>Document Templates</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addDocumentTemplateModal">
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/document_template/document_template_add.php" data-modal-size="xl">
|
||||||
<i class="fas fa-plus mr-2"></i>New Template
|
<i class="fas fa-plus mr-2"></i>New Template
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -121,38 +121,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php require_once "modals/document_template/document_template_add.php"; ?>
|
<?php require_once "../includes/footer.php";
|
||||||
<?php require_once "../includes/footer.php"; ?>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
$(document).ready(function(){
|
|
||||||
|
|
||||||
$('#generateAIContent').on('click', function(){
|
|
||||||
var prompt = $('#aiPrompt').val().trim();
|
|
||||||
if(prompt === '') {
|
|
||||||
alert('Please enter a prompt.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#generateAIContent').prop('disabled', true).html('<i class="fa fa-spinner fa-spin"></i> Generating...');
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: 'post.php?ai_create_document_template', // The PHP script that calls the OpenAI API
|
|
||||||
method: 'POST',
|
|
||||||
data: { prompt: prompt },
|
|
||||||
dataType: 'html',
|
|
||||||
success: function(response) {
|
|
||||||
// Assuming you have exactly one TinyMCE instance on the page
|
|
||||||
// and it's targeting the .tinymce textarea:
|
|
||||||
tinymce.activeEditor.setContent(response);
|
|
||||||
},
|
|
||||||
error: function() {
|
|
||||||
alert('Error generating content. Please try again.');
|
|
||||||
},
|
|
||||||
complete: function() {
|
|
||||||
$('#generateAIContent').prop('disabled', false).html('<i class="fa fa-fw fa-magic mr-1"></i>Generate with AI');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|||||||
@@ -15,7 +15,13 @@ if (isset($_GET['document_template_id'])) {
|
|||||||
$document_template_id = intval($_GET['document_template_id']);
|
$document_template_id = intval($_GET['document_template_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_document = mysqli_query($mysqli, "SELECT * FROM document_templates WHERE document_template_id = $document_template_id");
|
$sql_document = mysqli_query($mysqli, "SELECT * FROM document_templates WHERE document_template_id = $document_template_id LIMIT 1");
|
||||||
|
|
||||||
|
if (mysqli_num_rows($sql_document) == 0) {
|
||||||
|
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='javascript:history.back()'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>";
|
||||||
|
require_once "../includes/footer.php";
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql_document);
|
$row = mysqli_fetch_array($sql_document);
|
||||||
|
|
||||||
|
|||||||
@@ -27,12 +27,14 @@
|
|||||||
<p>Roles</p>
|
<p>Roles</p>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<!-- 2025-12-05 JQ - Hide Permission Modules currently just shows modules
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="/admin/modules.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "modules.php") {echo "active";} ?>">
|
<a href="/admin/modules.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "modules.php") {echo "active";} ?>">
|
||||||
<i class="nav-icon fas fa-puzzle-piece"></i>
|
<i class="nav-icon fas fa-puzzle-piece"></i>
|
||||||
<p>Modules</p>
|
<p>Modules</p>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
-->
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="/admin/api_keys.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "api_keys.php") {echo "active";} ?>">
|
<a href="/admin/api_keys.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "api_keys.php") {echo "active";} ?>">
|
||||||
<i class="nav-icon fas fa-key"></i>
|
<i class="nav-icon fas fa-key"></i>
|
||||||
@@ -67,30 +69,20 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="/admin/payment_provider.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'payment_provider.php' ? 'active' : ''); ?>">
|
<a href="/admin/payment_provider.php"
|
||||||
|
class="nav-link <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['payment_provider.php', 'saved_payment_method.php']) ? 'active' : ''); ?>">
|
||||||
<i class="nav-icon far fa-credit-card"></i>
|
<i class="nav-icon far fa-credit-card"></i>
|
||||||
<p>Payment Providers</p>
|
<p>Payment Providers</p>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
|
||||||
<a href="/admin/saved_payment_method.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'saved_payment_method.php' ? 'active' : ''); ?>">
|
|
||||||
<i class="nav-icon far fa-credit-card"></i>
|
|
||||||
<p>Saved Payments</p>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="/admin/ai_provider.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'ai_provider.php' ? 'active' : ''); ?>">
|
<a href="/admin/ai_provider.php"
|
||||||
|
class="nav-link <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['ai_provider.php', 'ai_model.php']) ? 'active' : ''); ?>">
|
||||||
<i class="nav-icon fas fa-robot"></i>
|
<i class="nav-icon fas fa-robot"></i>
|
||||||
<p>AI Providers</p>
|
<p>AI Providers</p>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
|
||||||
<a href="/admin/ai_model.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'ai_model.php' ? 'active' : ''); ?>">
|
|
||||||
<i class="nav-icon fas fa-robot"></i>
|
|
||||||
<p>AI Models</p>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<?php if ($config_module_enable_ticketing) { ?>
|
<?php if ($config_module_enable_ticketing) { ?>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
@@ -110,6 +102,17 @@
|
|||||||
<?php if ($config_module_enable_itdoc) { ?>
|
<?php if ($config_module_enable_itdoc) { ?>
|
||||||
<li class="nav-header">TEMPLATES</li>
|
<li class="nav-header">TEMPLATES</li>
|
||||||
|
|
||||||
|
<!-- 2025-11-16 JQ - Hide Contracts not yet ready
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="/admin/contract_template.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'contract_template.php' ? 'active' : ''); ?>">
|
||||||
|
<i class="nav-icon fas fa-file-contract"></i>
|
||||||
|
<p>
|
||||||
|
<span href="#" class="fas fa-plus-circle right ajax-modal" data-modal-url="/admin/modals/contract_template/contract_template_add.php" data-modal-size="lg"></span>
|
||||||
|
Contract Templates
|
||||||
|
</p>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
-->
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="/admin/project_template.php" class="nav-link <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['project_template.php', 'project_template_details.php']) ? 'active' : ''); ?>">
|
<a href="/admin/project_template.php" class="nav-link <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['project_template.php', 'project_template_details.php']) ? 'active' : ''); ?>">
|
||||||
<i class="nav-icon fas fa-project-diagram"></i>
|
<i class="nav-icon fas fa-project-diagram"></i>
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
<div class="form-group">
|
<?php
|
||||||
<div class="modal" id="addAIModelModal" tabindex="-1">
|
|
||||||
<div class="modal-dialog">
|
require_once '../../../includes/modal_header.php';
|
||||||
<div class="modal-content">
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fa fa-fw fa-robot mr-2"></i>Add AI Model</h5>
|
<h5 class="modal-title"><i class="fa fa-fw fa-robot mr-2"></i>Add AI Model</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
@@ -68,6 +72,6 @@
|
|||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<?php
|
||||||
</div>
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
<div class="form-group">
|
<?php
|
||||||
<div class="modal" id="addAIProviderModal" tabindex="-1">
|
|
||||||
<div class="modal-dialog">
|
require_once '../../../includes/modal_header.php';
|
||||||
<div class="modal-content">
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fa fa-fw fa-robot mr-2"></i>New AI Provider</h5>
|
<h5 class="modal-title"><i class="fa fa-fw fa-robot mr-2"></i>New AI Provider</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
@@ -49,6 +53,6 @@
|
|||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<?php
|
||||||
</div>
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
$key = randomString(156);
|
|
||||||
$decryptPW = randomString(160);
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
$key = randomString(32);
|
||||||
|
$decryptPW = randomString(32);
|
||||||
|
|
||||||
|
ob_start();
|
||||||
?>
|
?>
|
||||||
<div class="modal" id="addApiKeyModal" tabindex="-1">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fas fa-fw fa-key mr-2"></i>New Key</h5>
|
<h5 class="modal-title"><i class="fas fa-fw fa-key mr-2"></i>New Key</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
@@ -116,6 +119,6 @@ $decryptPW = randomString(160);
|
|||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<?php
|
||||||
</div>
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$category = nullable_htmlentities($_GET['category']);
|
$category = nullable_htmlentities($_GET['category'] ?? '');
|
||||||
|
|
||||||
|
$category_types_array = ['Expense', 'Income', 'Referral', 'Ticket'];
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@@ -13,10 +15,30 @@ $category = nullable_htmlentities($_GET['category']);
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="type" value="<?php echo ($category); ?>">
|
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
|
<?php if ($category) { ?>
|
||||||
|
<input type="hidden" name="type" value="<?= $category ?>">
|
||||||
|
<?php } else { ?>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
<option value="">- Select Type -</option>
|
||||||
|
<?php foreach ($category_types_array as $type_select) { ?>
|
||||||
|
<option><?= $type_select ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Name <strong class="text-danger">*</strong></label>
|
<label>Name <strong class="text-danger">*</strong></label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -39,7 +61,7 @@ $category = nullable_htmlentities($_GET['category']);
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="submit" name="add_category" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create</button>
|
<button type="submit" name="add_category" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create Category</button>
|
||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
221
admin/modals/contract_template/contract_template_add.php
Normal file
221
admin/modals/contract_template/contract_template_add.php
Normal file
@@ -0,0 +1,221 @@
|
|||||||
|
<?php
|
||||||
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
|
||||||
|
$contract_types_array = ['Fully Managed', 'Partialy Managed', 'Break/Fix'];
|
||||||
|
$renewal_frequency_array = ['Manual', 'Annually', '2 Year', '3 Year', '5 Year', '7 Year'];
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header bg-dark">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-file-contract mr-2"></i>New Contract Template</h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal"><span>×</span></button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Tabs Navigation -->
|
||||||
|
<ul class="modal-header nav nav-pills nav-justified">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" id="general-tab" data-toggle="tab" href="#general" role="tab">General Info</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" id="sla-tab" data-toggle="tab" href="#sla" role="tab">SLA</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" id="rates-tab" data-toggle="tab" href="#rates" role="tab">Rates & Support</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" id="details-tab" data-toggle="tab" href="#details" role="tab">Details</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="tab-content" id="contractTemplateTabContent">
|
||||||
|
|
||||||
|
<!-- General Info Tab -->
|
||||||
|
<div class="tab-pane fade show active" id="general" role="tabpanel">
|
||||||
|
<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-file-contract"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="name" placeholder="Contract Template Name" maxlength="200" required autofocus>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Template 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-align-left"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="description"
|
||||||
|
placeholder="Contract Template Description" maxlength="200" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Contract 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-list"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="type" required>
|
||||||
|
<option value="">- Select Type -</option>
|
||||||
|
<?php foreach ($contract_types_array as $type) { ?>
|
||||||
|
<option><?= $type ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Renewal Frequency</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="renewal_frequency">
|
||||||
|
<option value="">- Select Frequency -</option>
|
||||||
|
<?php foreach ($renewal_frequency_array as $renewal_frequency) { ?>
|
||||||
|
<option><?= $renewal_frequency ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- SLA Tab -->
|
||||||
|
<div class="tab-pane fade" id="sla" role="tabpanel">
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label>Low Priority Response (hrs)</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-clock"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="number" class="form-control" name="sla_low_response_time" placeholder="e.g., 24">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label>Low Priority Resolution (hrs)</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-hourglass-half"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="number" class="form-control" name="sla_low_resolution_time" placeholder="e.g., 48">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label>Medium Priority Response (hrs)</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-clock"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="number" class="form-control" name="sla_medium_response_time" placeholder="e.g., 12">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label>Medium Priority Resolution (hrs)</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-hourglass-half"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="number" class="form-control" name="sla_medium_resolution_time" placeholder="e.g., 24">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label>High Priority Response (hrs)</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-bolt"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="number" class="form-control" name="sla_high_response_time" placeholder="e.g., 1">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label>High Priority Resolution (hrs)</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-stopwatch"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="number" class="form-control" name="sla_high_resolution_time" placeholder="e.g., 4">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Rates & Support Tab -->
|
||||||
|
<div class="tab-pane fade" id="rates" role="tabpanel">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Standard Hourly Rate</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" name="rate_standard" placeholder="e.g., 100">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>After Hours Hourly Rate</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-moon"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="rate_after_hours" placeholder="e.g., 150">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Support Hours</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="support_hours" placeholder="e.g., Mon-Fri 9am-5pm">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Net Terms</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-file-invoice-dollar"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="net_terms" placeholder="e.g., Net 30">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Details Tab -->
|
||||||
|
<div class="tab-pane fade" id="details" role="tabpanel">
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="form-control tinymce" rows="6" name="details" placeholder="Enter Contract Details"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="submit" name="add_contract_template" class="btn btn-primary text-bold">
|
||||||
|
<i class="fa fa-check mr-2"></i>Create Template
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal">
|
||||||
|
<i class="fa fa-times mr-2"></i>Cancel
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
?>
|
||||||
265
admin/modals/contract_template/contract_template_edit.php
Normal file
265
admin/modals/contract_template/contract_template_edit.php
Normal file
@@ -0,0 +1,265 @@
|
|||||||
|
<?php
|
||||||
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
$contract_template_id = intval($_GET['id']);
|
||||||
|
|
||||||
|
$contract_types_array = ['Fully Managed', 'Partialy Managed', 'Break/Fix'];
|
||||||
|
$update_frequency_array = ['Manual', 'Annually', '2 Year', '3 Year', '5 Year', '7 Year'];
|
||||||
|
|
||||||
|
// Fetch existing template
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM contract_templates WHERE contract_template_id = $contract_template_id LIMIT 1");
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
|
||||||
|
// Assign locals
|
||||||
|
$name = nullable_htmlentities($row['contract_template_name']);
|
||||||
|
$description = nullable_htmlentities($row['contract_template_description']);
|
||||||
|
$type = nullable_htmlentities($row['contract_template_type']);
|
||||||
|
$renewal_frequency = nullable_htmlentities($row['contract_template_renewal_frequency']);
|
||||||
|
$sla_low_resp = intval($row['contract_template_sla_low_response_time']);
|
||||||
|
$sla_med_resp = intval($row['contract_template_sla_medium_response_time']);
|
||||||
|
$sla_high_resp = intval($row['contract_template_sla_high_response_time']);
|
||||||
|
$sla_low_res = intval($row['contract_template_sla_low_resolution_time']);
|
||||||
|
$sla_med_res = intval($row['contract_template_sla_medium_resolution_time']);
|
||||||
|
$sla_high_res = intval($row['contract_template_sla_high_resolution_time']);
|
||||||
|
$hourly_rate = intval($row['contract_template_rate_standard']);
|
||||||
|
$after_hours = intval($row['contract_template_rate_after_hours']);
|
||||||
|
$support_hours = nullable_htmlentities($row['contract_template_support_hours']);
|
||||||
|
$net_terms = intval($row['contract_template_net_terms']);
|
||||||
|
$details = nullable_htmlentities($row['contract_template_details']);
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="modal-header bg-dark">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-file-contract mr-2"></i>Edit Contract Template</h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal"><span>×</span></button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Tabs Navigation -->
|
||||||
|
<ul class="modal-header nav nav-pills nav-justified">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" id="general-tab" data-toggle="tab" href="#general" role="tab">General Info</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" id="sla-tab" data-toggle="tab" href="#sla" role="tab">SLA</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" id="rates-tab" data-toggle="tab" href="#rates" role="tab">Rates & Support</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" id="details-tab" data-toggle="tab" href="#details" role="tab">Details</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="contract_template_id" value="<?php echo $contract_template_id; ?>">
|
||||||
|
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="tab-content" id="contractTemplateTabContent">
|
||||||
|
|
||||||
|
<!-- General Info Tab -->
|
||||||
|
<div class="tab-pane fade show active" id="general" role="tabpanel">
|
||||||
|
<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-file-contract"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="name"
|
||||||
|
placeholder="Contract Template Name" maxlength="200" required autofocus
|
||||||
|
value="<?= $name ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Template 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-align-left"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="description"
|
||||||
|
placeholder="Contract Template Description" maxlength="200" required
|
||||||
|
value="<?= $description ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Contract 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-list"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="type" required>
|
||||||
|
<option value="">- Select Type -</option>
|
||||||
|
<?php foreach ($contract_types_array as $type_select) { ?>
|
||||||
|
<option <?php if ($type == $type_select) { echo "selected"; } ?>><?= $type_select ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Renewal Frequency</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="renewal_frequency">
|
||||||
|
<option value="">- Select Frequency -</option>
|
||||||
|
<?php foreach ($renewal_frequency_array as $renewal_frequency_select) { ?>
|
||||||
|
<option <?php if ($renewal_frequency == $renewal_frequency_select) { echo "selected"; } ?>><?= $renewal_frequency_select ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- SLA Tab -->
|
||||||
|
<div class="tab-pane fade" id="sla" role="tabpanel">
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label>Low Priority Response (hrs)</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-clock"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="number" class="form-control" name="sla_low_response_time" placeholder="e.g., 24"
|
||||||
|
value="<?= $sla_low_resp ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label>Low Priority Resolution (hrs)</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-hourglass-half"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="number" class="form-control" name="sla_low_resolution_time" placeholder="e.g., 48"
|
||||||
|
value="<?= $sla_low_res ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label>Medium Priority Response (hrs)</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-clock"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="number" class="form-control" name="sla_medium_response_time" placeholder="e.g., 12"
|
||||||
|
value="<?= $sla_med_resp ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label>Medium Priority Resolution (hrs)</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-hourglass-half"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="number" class="form-control" name="sla_medium_resolution_time" placeholder="e.g., 24"
|
||||||
|
value="<?= $sla_med_res ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label>High Priority Response (hrs)</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-bolt"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="number" class="form-control" name="sla_high_response_time" placeholder="e.g., 1"
|
||||||
|
value="<?= $sla_high_resp ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label>High Priority Resolution (hrs)</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-stopwatch"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="number" class="form-control" name="sla_high_resolution_time" placeholder="e.g., 4"
|
||||||
|
value="<?= $sla_high_res ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Rates & Support Tab -->
|
||||||
|
<div class="tab-pane fade" id="rates" role="tabpanel">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Standard Hourly Rate</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" name="rate_standard" placeholder="e.g., 100"
|
||||||
|
value="<?= $rate_standard ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>After Hours Hourly Rate</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-moon"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="rate_after_hours" placeholder="e.g., 150"
|
||||||
|
value="<?= $rate_after_hours ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Support Hours</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="support_hours" placeholder="e.g., Mon-Fri 9am-5pm"
|
||||||
|
value="<?= $support_hours ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Net Terms</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-file-invoice-dollar"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="net_terms" placeholder="e.g., Net 30"
|
||||||
|
value="<?= $net_terms ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Details Tab -->
|
||||||
|
<div class="tab-pane fade" id="details" role="tabpanel">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Contract Details</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-align-left"></i></span>
|
||||||
|
</div>
|
||||||
|
<textarea class="form-control tinymce" rows="6" name="details"
|
||||||
|
placeholder="Enter Contract Details"><?= $details ?></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="submit" name="edit_contract_template" class="btn btn-primary text-bold">
|
||||||
|
<i class="fa fa-check mr-2"></i>Save Changes
|
||||||
|
</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/modal_footer.php';
|
||||||
|
?>
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
<div class="modal" id="addLinkModal" tabindex="-1">
|
<?php
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fas fa-fw fa-external-link-alt mr-2"></i>New Custom Link</h5>
|
<h5 class="modal-title"><i class="fas fa-fw fa-external-link-alt mr-2"></i>New Custom Link</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
@@ -78,6 +83,6 @@
|
|||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<?php
|
||||||
</div>
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
<div class="modal" id="addDocumentTemplateModal" tabindex="-1">
|
<?php
|
||||||
<div class="modal-dialog modal-xl">
|
|
||||||
<div class="modal-content">
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fa fa-fw fa-file-alt mr-2"></i>Creating Document Template</h5>
|
<h5 class="modal-title"><i class="fa fa-fw fa-file-alt mr-2"></i>Creating Document Template</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
@@ -44,6 +49,39 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<script>
|
||||||
</div>
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
$('#generateAIContent').on('click', function(){
|
||||||
|
var prompt = $('#aiPrompt').val().trim();
|
||||||
|
if(prompt === '') {
|
||||||
|
alert('Please enter a prompt.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#generateAIContent').prop('disabled', true).html('<i class="fa fa-spinner fa-spin"></i> Generating...');
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: '/agent/ajax.php?ai_create_document_template', // The PHP script that calls the OpenAI API
|
||||||
|
method: 'POST',
|
||||||
|
data: { prompt: prompt },
|
||||||
|
dataType: 'html',
|
||||||
|
success: function(response) {
|
||||||
|
// Assuming you have exactly one TinyMCE instance on the page
|
||||||
|
// and it's targeting the .tinymce textarea:
|
||||||
|
tinymce.activeEditor.setContent(response);
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
alert('Error generating content. Please try again.');
|
||||||
|
},
|
||||||
|
complete: function() {
|
||||||
|
$('#generateAIContent').prop('disabled', false).html('<i class="fa fa-fw fa-magic mr-1"></i>Generate with AI');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
<div class="modal" id="addPaymentMethodModal" tabindex="-1">
|
<?php
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fa fa-fw fa-credit-card mr-2"></i>Creating: <strong>Payment Method</strong></h5>
|
<h5 class="modal-title"><i class="fa fa-fw fa-credit-card mr-2"></i>Creating: <strong>Payment Method</strong></h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
@@ -32,6 +37,6 @@
|
|||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<?php
|
||||||
</div>
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ ob_start();
|
|||||||
</div>
|
</div>
|
||||||
<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'] ?>">
|
||||||
|
<input type="hidden" name="payment_method_id" value="<?= $payment_method_id ?>">
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
<div class="form-group">
|
<?php
|
||||||
<div class="modal" id="addPaymentProviderModal" tabindex="-1">
|
|
||||||
<div class="modal-dialog">
|
require_once '../../../includes/modal_header.php';
|
||||||
<div class="modal-content">
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fa fa-fw fa-credit-card mr-2"></i>Add Payment Provider</h5>
|
<h5 class="modal-title"><i class="fa fa-fw fa-credit-card mr-2"></i>Add Payment Provider</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
@@ -13,11 +16,26 @@
|
|||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="alert alert-info">
|
<div class="alert alert-info text-center">
|
||||||
An income account named after the provider will always be created and used for income of paid invoices.<br>
|
<h6>Before Adding a Payment Provider!</h6>
|
||||||
If "Enable Expense" option is enabled, a matching vendor will also be automatically created for expense tracking. Additionally, an expense category named "Payment Processing" will be created.
|
We recommend you add an <strong>Account</strong> and <strong>Vendor</strong> based off the Provider name before continuing eg <strong>Stripe</strong>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<ul class="nav nav-pills nav-justified mb-3">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" data-toggle="pill" href="#pills-details">Details</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-expense">Expense</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="tab-content">
|
||||||
|
|
||||||
|
<div class="tab-pane fade show active" id="pills-details">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Provider <strong class="text-danger">*</strong></label>
|
<label>Provider <strong class="text-danger">*</strong></label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -50,18 +68,44 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Income / Expense 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 an Account -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT account_id, account_name FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
|
$account_id = intval($row['account_id']);
|
||||||
|
$account_name = nullable_htmlentities($row['account_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($account_name === 'Stripe') { echo "selected"; } ?> value="<?= $account_id ?>"><?= $account_name ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Threshold</label>
|
<label>Threshold</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-shopping-cart"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-shopping-cart"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,2}" name="threshold" placeholder="1000.00">
|
<input type="text" class="form-control" inputmode="decimal" pattern="[0-9]*\.?[0-9]{0,2}" name="threshold" placeholder="1000.00">
|
||||||
</div>
|
</div>
|
||||||
<small class="form-text text-muted">Will not show as an option at Checkout if invoice amount is above this number, 0 disables the threshold check.</small>
|
<small class="form-text text-muted">Will not show as an option at Checkout if invoice amount is above this number, 0 disables the threshold check.</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-expense">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="custom-control custom-switch">
|
<div class="custom-control custom-switch">
|
||||||
@@ -70,13 +114,67 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Payment Provider 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="expense_vendor" required>
|
||||||
|
<option value="0">Expense Disabled</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT vendor_id, vendor_name FROM vendors WHERE vendor_client_id = 0 AND vendor_archived_at IS NULL ORDER BY vendor_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
|
$vendor_id = intval($row['vendor_id']);
|
||||||
|
$vendor_name = nullable_htmlentities($row['vendor_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($vendor_name === 'Stripe') { echo "selected"; } ?> value="<?= $vendor_id ?>"><?= $vendor_name ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Expense 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="expense_category" required>
|
||||||
|
<option value="">- Select a Category -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Expense' AND 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 ($category_name === 'Processing Fee') { echo "selected"; } ?> value="<?= $category_id ?>"><?= $category_name ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-secondary ajax-modal" type="button"
|
||||||
|
data-modal-url="../admin/modals/category/category_add.php?category=Expense">
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Percentage Fee to expense</label>
|
<label>Percentage Fee to expense</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-percent"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-percent"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,2}" name="percentage_fee" placeholder="Enter Percentage">
|
<input type="text" class="form-control" inputmode="decimal" pattern="[0-9]*\.?[0-9]{0,2}" name="percentage_fee" placeholder="Enter Percentage">
|
||||||
</div>
|
</div>
|
||||||
<small class="form-text text-muted">See <a href="https://stripe.com/pricing" target="_blank">here <i class="fas fa-fw fa-external-link-alt"></i></a> for the latest Stripe Fees.</small>
|
<small class="form-text text-muted">See <a href="https://stripe.com/pricing" target="_blank">here <i class="fas fa-fw fa-external-link-alt"></i></a> for the latest Stripe Fees.</small>
|
||||||
</div>
|
</div>
|
||||||
@@ -87,17 +185,19 @@
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-shopping-cart"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-shopping-cart"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,3}" name="flat_fee" placeholder="0.030">
|
<input type="text" class="form-control" inputmode="decimal" pattern="[0-9]*\.?[0-9]{0,3}" name="flat_fee" placeholder="0.030">
|
||||||
</div>
|
</div>
|
||||||
<small class="form-text text-muted">See <a href="https://stripe.com/pricing" target="_blank">here <i class="fas fa-fw fa-external-link-alt"></i></a> for the latest Stripe Fees.</small>
|
<small class="form-text text-muted">See <a href="https://stripe.com/pricing" target="_blank">here <i class="fas fa-fw fa-external-link-alt"></i></a> for the latest Stripe Fees.</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="submit" name="add_payment_provider" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Add</button>
|
<button type="submit" name="add_payment_provider" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Add</button>
|
||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<?php
|
||||||
</div>
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ $row = mysqli_fetch_array($sql);
|
|||||||
$provider_name = nullable_htmlentities($row['payment_provider_name']);
|
$provider_name = nullable_htmlentities($row['payment_provider_name']);
|
||||||
$public_key = nullable_htmlentities($row['payment_provider_public_key']);
|
$public_key = nullable_htmlentities($row['payment_provider_public_key']);
|
||||||
$private_key = nullable_htmlentities($row['payment_provider_private_key']);
|
$private_key = nullable_htmlentities($row['payment_provider_private_key']);
|
||||||
$account_id = nullable_htmlentities($row['payment_provider_account']);
|
$account_id = intval($row['payment_provider_account']);
|
||||||
$threshold = floatval($row['payment_provider_threshold']);
|
$threshold = floatval($row['payment_provider_threshold']);
|
||||||
$vendor_id = nullable_htmlentities($row['payment_provider_expense_vendor']);
|
$vendor_id = intval($row['payment_provider_expense_vendor']);
|
||||||
$category_id = nullable_htmlentities($row['payment_provider_expense_category']);
|
$category_id = intval($row['payment_provider_expense_category']);
|
||||||
$percent_fee = floatval($row['payment_provider_expense_percentage_fee']) * 100;
|
$percent_fee = floatval($row['payment_provider_expense_percentage_fee']) * 100;
|
||||||
$flat_fee = floatval($row['payment_provider_expense_flat_fee']);
|
$flat_fee = floatval($row['payment_provider_expense_flat_fee']);
|
||||||
|
|
||||||
@@ -21,24 +21,39 @@ $flat_fee = floatval($row['payment_provider_expense_flat_fee']);
|
|||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fa fa-fw fa-credit-card mr-2"></i>Editing: <strong><?php echo $provider_name; ?></strong></h5>
|
<h5 class="modal-title"><i class="fa fa-fw fa-credit-card mr-2"></i>Editing: <strong><?= $provider_name ?></strong></h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
<span>×</span>
|
<span>×</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<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="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<input type="hidden" name="provider_id" value="<?php echo $provider_id; ?>">
|
<input type="hidden" name="provider_id" value="<?= $provider_id ?>">
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
|
<ul class="nav nav-pills nav-justified mb-3">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" data-toggle="pill" href="#pills-details">Details</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-expense">Expense</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="tab-content">
|
||||||
|
|
||||||
|
<div class="tab-pane fade show active" id="pills-details">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Publishable key <strong class="text-danger">*</strong></label>
|
<label>Publishable key <strong class="text-danger">*</strong></label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-eye"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-eye"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="public_key" placeholder="Publishable API Key (pk_...)" value="<?php echo $public_key; ?>">
|
<input type="text" class="form-control" name="public_key" placeholder="Publishable API Key (pk_...)" value="<?= $public_key ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -48,7 +63,31 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-key"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-key"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="private_key" placeholder="Secret API Key (sk_...)" value="<?php echo $private_key; ?>">
|
<input type="text" class="form-control" name="private_key" placeholder="Secret API Key (sk_...)" value="<?= $private_key ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Income / Expense 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 an Account -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT account_id, account_name FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
|
$account_id_select = intval($row['account_id']);
|
||||||
|
$account_name = nullable_htmlentities($row['account_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($account_id === $account_id_select) { echo "selected"; } ?> value="<?= $account_id_select ?>"><?= $account_name ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -58,19 +97,69 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-shopping-cart"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-shopping-cart"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,2}" name="threshold" placeholder="1000.00" value="<?php echo $threshold; ?>">
|
<input type="text" class="form-control" inputmode="decimal" pattern="[0-9]*\.?[0-9]{0,2}" name="threshold" placeholder="1000.00" value="<?php echo $threshold; ?>">
|
||||||
</div>
|
</div>
|
||||||
<small class="form-text text-muted">Will not show as an option at Checkout if above this number</small>
|
<small class="form-text text-muted">Will not show as an option at Checkout if above this number</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-expense">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="custom-control custom-switch">
|
<label>Payment Provider Vendor <strong class="text-danger">*</strong></label>
|
||||||
<input type="checkbox" class="custom-control-input" name="enable_expense" <?php if ($vendor_id) { echo "checked"; } ?> value="1" id="enableEditExpenseSwitch">
|
<div class="input-group">
|
||||||
<label class="custom-control-label" for="enableEditExpenseSwitch">Enable Expense</label>
|
<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="expense_vendor" required>
|
||||||
|
<option value="0">Expense Disabled</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT vendor_id, vendor_name FROM vendors WHERE vendor_client_id = 0 AND vendor_archived_at IS NULL ORDER BY vendor_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
|
$vendor_id_select = intval($row['vendor_id']);
|
||||||
|
$vendor_name = nullable_htmlentities($row['vendor_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($vendor_id === $vendor_id_select) { echo "selected"; } ?>
|
||||||
|
value="<?= $vendor_id_select ?>"><?= $vendor_name ?>
|
||||||
|
</option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Expense 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="expense_category" required>
|
||||||
|
<option value="">- Select a Category -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_category = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Expense' AND 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 === $category_id_select) { echo "selected"; } ?> value="<?= $category_id_select ?>"><?= $category_name ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-secondary ajax-modal" type="button"
|
||||||
|
data-modal-url="../admin/modals/category/category_add.php?category=Expense">
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<small>(Category: Payment Processing -- Vendor: <?php echo $provider_name; ?></small>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -79,7 +168,7 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-percent"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-percent"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,2}" name="percentage_fee" value="<?php echo $percent_fee; ?>" placeholder="Enter Percentage">
|
<input type="text" class="form-control" inputmode="decimal" pattern="[0-9]*\.?[0-9]{0,2}" name="percentage_fee" value="<?php echo $percent_fee; ?>" placeholder="Enter Percentage">
|
||||||
</div>
|
</div>
|
||||||
<small class="form-text text-muted">See <a href="https://stripe.com/pricing" target="_blank">here <i class="fas fa-fw fa-external-link-alt"></i></a> for the latest Stripe Fees.</small>
|
<small class="form-text text-muted">See <a href="https://stripe.com/pricing" target="_blank">here <i class="fas fa-fw fa-external-link-alt"></i></a> for the latest Stripe Fees.</small>
|
||||||
</div>
|
</div>
|
||||||
@@ -90,11 +179,12 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-shopping-cart"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-shopping-cart"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,3}" name="flat_fee" value="<?php echo $flat_fee; ?>" placeholder="0.030">
|
<input type="text" class="form-control" inputmode="decimal" pattern="[0-9]*\.?[0-9]{0,3}" name="flat_fee" value="<?php echo $flat_fee; ?>" placeholder="0.030">
|
||||||
</div>
|
</div>
|
||||||
<small class="form-text text-muted">See <a href="https://stripe.com/pricing" target="_blank">here <i class="fas fa-fw fa-external-link-alt"></i></a> for the latest Stripe Fees.</small>
|
<small class="form-text text-muted">See <a href="https://stripe.com/pricing" target="_blank">here <i class="fas fa-fw fa-external-link-alt"></i></a> for the latest Stripe Fees.</small>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="submit" name="edit_payment_provider" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
<button type="submit" name="edit_payment_provider" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
<div class="modal" id="addProjectTemplateModal" tabindex="-1">
|
<?php
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fas fa-fw fa-project-diagram mr-2"></i>Creating Project Template</h5>
|
<h5 class="modal-title"><i class="fas fa-fw fa-project-diagram mr-2"></i>Creating Project Template</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
@@ -36,6 +40,6 @@
|
|||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<?php
|
||||||
</div>
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -1,6 +1,18 @@
|
|||||||
<div class="modal" id="editProjectTemplateModal<?php echo $project_template_id; ?>" tabindex="-1">
|
<?php
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
$project_template_id = intval($_GET['project_template_id']);
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM project_templates WHERE project_template_id = $project_template_id LIMIT 1");
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$project_template_name = nullable_htmlentities($row['project_template_name']);
|
||||||
|
$project_template_description = nullable_htmlentities($row['project_template_description']);
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fas fa-fw fa-project-diagram mr-2"></i>Editing Project Template: <strong><?php echo $project_template_name; ?></strong></h5>
|
<h5 class="modal-title"><i class="fas fa-fw fa-project-diagram mr-2"></i>Editing Project Template: <strong><?php echo $project_template_name; ?></strong></h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
@@ -34,11 +46,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="submit" name="edit_project_template" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Create</button>
|
<button type="submit" name="edit_project_template" 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>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<?php
|
||||||
</div>
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
<div class="modal" id="addProjectTemplateTicketTemplateModal" tabindex="-1">
|
<?php
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
$project_template_id = intval($_GET['project_template_id']);
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fas fa-fw fa-life-ring mr-2"></i>Adding Ticket Template</h5>
|
<h5 class="modal-title"><i class="fas fa-fw fa-life-ring mr-2"></i>Adding Ticket Template</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
@@ -59,6 +66,6 @@
|
|||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<?php
|
||||||
</div>
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
<div class="modal" id="addRoleModal" tabindex="-1">
|
<?php
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fas fa-fw fa-user-shield mr-2"></i>Add new role</h5>
|
<h5 class="modal-title"><i class="fas fa-fw fa-user-shield mr-2"></i>New Role</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
<span>×</span>
|
<span>×</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -53,6 +57,6 @@
|
|||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<?php
|
||||||
</div>
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
<div class="modal" id="addSoftwareTemplateModal" tabindex="-1">
|
<?php
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fa fa-fw fa-cube mr-2"></i>New License Template</h5>
|
<h5 class="modal-title"><i class="fa fa-fw fa-cube mr-2"></i>New License Template</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
@@ -78,6 +83,6 @@
|
|||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<?php
|
||||||
</div>
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -15,8 +15,11 @@ if (isset($_GET['type'])) {
|
|||||||
$type_display = "Contact";
|
$type_display = "Contact";
|
||||||
} elseif ($type === 4) {
|
} elseif ($type === 4) {
|
||||||
$type_display = "Credential";
|
$type_display = "Credential";
|
||||||
|
} elseif ($type === 5) {
|
||||||
|
$type_display = "Asset";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ob_start();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@@ -57,6 +60,7 @@ if (isset($_GET['type'])) {
|
|||||||
<option value="2">Location Tag</option>
|
<option value="2">Location Tag</option>
|
||||||
<option value="3">Contact Tag</option>
|
<option value="3">Contact Tag</option>
|
||||||
<option value="4">Credential Tag</option>
|
<option value="4">Credential Tag</option>
|
||||||
|
<option value="5">Asset Tag</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -85,7 +89,7 @@ if (isset($_GET['type'])) {
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="submit" name="add_tag" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Create</button>
|
<button type="submit" name="add_tag" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Create Tag</button>
|
||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -12,11 +12,24 @@ $tag_type = intval($row['tag_type']);
|
|||||||
$tag_color = nullable_htmlentities($row['tag_color']);
|
$tag_color = nullable_htmlentities($row['tag_color']);
|
||||||
$tag_icon = nullable_htmlentities($row['tag_icon']);
|
$tag_icon = nullable_htmlentities($row['tag_icon']);
|
||||||
|
|
||||||
// Generate the HTML form content using output buffering.
|
if ($tag_type == 1) {
|
||||||
|
$tag_type_display = "Client";
|
||||||
|
} elseif ( $tag_type == 2) {
|
||||||
|
$tag_type_display = "Location";
|
||||||
|
} elseif ( $tag_type == 3) {
|
||||||
|
$tag_type_display = "Contact";
|
||||||
|
} elseif ( $tag_type == 4) {
|
||||||
|
$tag_type_display = "Credential";
|
||||||
|
} elseif ( $tag_type == 5) {
|
||||||
|
$tag_type_display = "Asset";
|
||||||
|
} else {
|
||||||
|
$tag_type_display = "Unknown";
|
||||||
|
}
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fas fa-fw fa-tag mr-2"></i>Editing tag: <strong><?php echo $tag_name; ?></strong></h5>
|
<h5 class="modal-title"><i class="fas fa-fw fa-tag mr-2"></i><?= $tag_type_display ?> Tag: <strong><?php echo $tag_name; ?></strong></h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
<span>×</span>
|
<span>×</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -35,22 +48,6 @@ ob_start();
|
|||||||
</div>
|
</div>
|
||||||
</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">
|
<div class="form-group">
|
||||||
<label>Color <strong class="text-danger">*</strong></label>
|
<label>Color <strong class="text-danger">*</strong></label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -73,7 +70,7 @@ ob_start();
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="submit" name="edit_tag" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
<button type="submit" name="edit_tag" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save changes</button>
|
||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
<div class="modal" id="addTaxModal" tabindex="-1">
|
<?php
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fas fa-fw fa-balance-scale mr-2"></i>New Tax</h5>
|
<h5 class="modal-title"><i class="fas fa-fw fa-balance-scale mr-2"></i>New Tax</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
@@ -25,6 +30,6 @@
|
|||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<?php
|
||||||
</div>
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
<div class="modal" id="addTicketStatusModal" tabindex="-1">
|
<?php
|
||||||
<div class="modal-dialog">
|
require_once '../../../includes/modal_header.php';
|
||||||
<div class="modal-content">
|
ob_start();
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fas fa-fw fa-info-circle mr-2"></i>New Ticket Status</h5>
|
<h5 class="modal-title"><i class="fas fa-fw fa-info-circle mr-2"></i>New Ticket Status</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
@@ -10,7 +12,6 @@
|
|||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Name <strong class="text-danger">*</strong></label>
|
<label>Name <strong class="text-danger">*</strong></label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -37,6 +38,6 @@
|
|||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<?php
|
||||||
</div>
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
<div class="modal" id="addTicketTemplateModal" tabindex="-1">
|
<?php
|
||||||
<div class="modal-dialog modal-lg">
|
|
||||||
<div class="modal-content">
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fa fa-fw fa-life-ring mr-2"></i>Creating Ticket Template</h5>
|
<h5 class="modal-title"><i class="fa fa-fw fa-life-ring mr-2"></i>New Ticket Template</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
<span>×</span>
|
<span>×</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -66,10 +70,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="submit" name="add_ticket_template" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create</button>
|
<button type="submit" name="add_ticket_template" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create Template</button>
|
||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<?php
|
||||||
</div>
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
<div class="modal" id="addUserModal" tabindex="-1">
|
<?php
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fas fa-fw fa-user-plus mr-2"></i>New User</h5>
|
<h5 class="modal-title"><i class="fas fa-fw fa-user-plus mr-2"></i>New User</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
@@ -151,6 +155,22 @@
|
|||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<script>
|
||||||
</div>
|
|
||||||
|
function generatePassword() {
|
||||||
|
jQuery.get(
|
||||||
|
"/agent/ajax.php", {
|
||||||
|
get_readable_pass: 'true'
|
||||||
|
},
|
||||||
|
function(data) {
|
||||||
|
const password = JSON.parse(data);
|
||||||
|
document.getElementById("password").value = password;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "../../../includes/modal_footer.php";
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
<div class="modal" id="resetAllUserPassModal" tabindex="-1">
|
<?php
|
||||||
<div class="modal-dialog modal-lg">
|
|
||||||
<div class="modal-content">
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="mb-4" style="text-align: center;">
|
<div class="mb-4" style="text-align: center;">
|
||||||
<i class="far fas fa-10x fa-skull-crossbones text-danger mb-3 mt-3"></i>
|
<i class="far fas fa-10x fa-skull-crossbones text-danger mb-3 mt-3"></i>
|
||||||
@@ -26,6 +30,6 @@
|
|||||||
<button type="button" class="btn btn-outline-secondary btn-lg px-5 mr-4" data-dismiss="modal">Cancel</button>
|
<button type="button" class="btn btn-outline-secondary btn-lg px-5 mr-4" data-dismiss="modal">Cancel</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
<?php
|
||||||
</div>
|
require_once "../../../includes/modal_footer.php";
|
||||||
|
|||||||
@@ -94,11 +94,14 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-lock"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-lock"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="password" class="form-control" data-toggle="password" name="new_password"
|
<input type="password" class="form-control" data-toggle="password" name="new_password" id="password"
|
||||||
placeholder="Leave Blank For No Password Change" autocomplete="new-password">
|
placeholder="Leave Blank For No Password Change" autocomplete="new-password">
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-eye"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-eye"></i></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<span class="btn btn-default"><i class="fa fa-fw fa-question" onclick="generatePassword()"></i></span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -200,5 +203,23 @@ ob_start();
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function generatePassword() {
|
||||||
|
// Send a GET request to ajax.php as ajax.php?get_readable_pass=true
|
||||||
|
jQuery.get(
|
||||||
|
"/agent/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);
|
||||||
|
document.getElementById("password").value = password;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "../../../includes/modal_footer.php";
|
require_once "../../../includes/modal_footer.php";
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
<div class="modal" id="exportUserModal" tabindex="-1">
|
<?php
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fas fa-fw fa-download mr-2"></i>Export Users to CSV</h5>
|
<h5 class="modal-title"><i class="fas fa-fw fa-download mr-2"></i>Export Users to CSV</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
@@ -16,6 +21,6 @@
|
|||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<?php
|
||||||
</div>
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
<div class="modal" id="userInviteModal" tabindex="-1">
|
<?php
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fas fa-fw fa-user-plus"></i>Invite User</h5>
|
<h5 class="modal-title"><i class="fas fa-fw fa-user-plus"></i>Invite User</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
@@ -40,6 +44,6 @@
|
|||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<?php
|
||||||
</div>
|
require_once "../../../includes/modal_footer.php";
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
<div class="modal" id="addVendorTemplateModal" tabindex="-1">
|
<?php
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fas fa-fw fa-building mr-2"></i>New Vendor Template</h5>
|
<h5 class="modal-title"><i class="fas fa-fw fa-building mr-2"></i>New Vendor Template</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
@@ -9,8 +14,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
|
||||||
<input type="hidden" name="client_id" value="<?php if (isset($_GET['client_id'])) { echo $client_id; } else { echo 0; } ?>">
|
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<ul class="nav nav-pills nav-justified mb-3">
|
<ul class="nav nav-pills nav-justified mb-3">
|
||||||
@@ -163,6 +166,6 @@
|
|||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<?php
|
||||||
</div>
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
<div class="card-header py-2">
|
<div class="card-header py-2">
|
||||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-credit-card mr-2"></i>Payment Methods</h3>
|
<h3 class="card-title mt-2"><i class="fas fa-fw fa-credit-card mr-2"></i>Payment Methods</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addPaymentMethodModal"><i class="fas fa-plus mr-2"></i>Add Payment Method</button>
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/payment_method/payment_method_add.php"><i class="fas fa-plus mr-2"></i>Add Payment Method</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@@ -98,5 +98,4 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/payment_method/payment_method_add.php";
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
<div class="card-header py-2">
|
<div class="card-header py-2">
|
||||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-credit-card mr-2"></i>Payment Providers</h3>
|
<h3 class="card-title mt-2"><i class="fas fa-fw fa-credit-card mr-2"></i>Payment Providers</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addPaymentProviderModal"><i class="fas fa-plus mr-2"></i>Add Provider</button>
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/payment_provider/payment_provider_add.php"><i class="fas fa-plus mr-2"></i>Add Provider</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@@ -57,7 +57,7 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
<th>
|
<th>
|
||||||
<a class="text-dark">Expensed Fee</a>
|
<a class="text-dark">Expensed Fee</a>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th class="text-center">
|
||||||
<a class="text-dark">Saved Payment Methods</a>
|
<a class="text-dark">Saved Payment Methods</a>
|
||||||
</th>
|
</th>
|
||||||
<th class="text-center">Action</th>
|
<th class="text-center">Action</th>
|
||||||
@@ -72,7 +72,7 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
$provider_description = nullable_htmlentities($row['payment_provider_description']);
|
$provider_description = nullable_htmlentities($row['payment_provider_description']);
|
||||||
$account_name = nullable_htmlentities($row['account_name']);
|
$account_name = nullable_htmlentities($row['account_name']);
|
||||||
$threshold = floatval($row['payment_provider_threshold']);
|
$threshold = floatval($row['payment_provider_threshold']);
|
||||||
$vendor_name = nullable_htmlentities($row['vendor_name']);
|
$vendor_name = nullable_htmlentities($row['vendor_name'] ?? "Expense Disabled");
|
||||||
$category = nullable_htmlentities($row['category_name']);
|
$category = nullable_htmlentities($row['category_name']);
|
||||||
$percent_fee = floatval($row['payment_provider_expense_percentage_fee']) * 100;
|
$percent_fee = floatval($row['payment_provider_expense_percentage_fee']) * 100;
|
||||||
$flat_fee = floatval($row['payment_provider_expense_flat_fee']);
|
$flat_fee = floatval($row['payment_provider_expense_flat_fee']);
|
||||||
@@ -94,7 +94,9 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
<td><?php echo $vendor_name; ?></td>
|
<td><?php echo $vendor_name; ?></td>
|
||||||
<td><?php echo $category; ?></td>
|
<td><?php echo $category; ?></td>
|
||||||
<td><?php echo $percent_fee; ?>% + <?php echo numfmt_format_currency($currency_format, $flat_fee, $session_company_currency); ?></td>
|
<td><?php echo $percent_fee; ?>% + <?php echo numfmt_format_currency($currency_format, $flat_fee, $session_company_currency); ?></td>
|
||||||
<td><?php echo $saved_payment_count; ?></td>
|
<td class="text-center">
|
||||||
|
<a class="badge badge-dark badge-pill p-2" href="saved_payment_method.php"><?= $saved_payment_count ?></a>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="dropdown dropleft text-center">
|
<div class="dropdown dropleft text-center">
|
||||||
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
||||||
@@ -106,12 +108,14 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
<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>
|
||||||
<!-- <a class="dropdown-item text-danger confirm-link" href="post.php?disable_payment_provider=--><?php //echo $provider_id; ?><!--&csrf_token=--><?php //echo $_SESSION['csrf_token'] ?><!--">-->
|
<a class="dropdown-item text-danger confirm-link" href="post.php?delete_payment_provider=<?= $provider_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
|
||||||
<!-- <i class="fas fa-fw fa-thumbs-down mr-2"></i>Disable-->
|
<i class="fas fa-fw fa-trash mr-2"></i><strong>Delete Provider and</strong>
|
||||||
<!-- </a>-->
|
<ul class="text-xs">
|
||||||
<!-- <a class="dropdown-item text-danger confirm-link" href="post.php?delete_payment_provider=--><?php //echo $provider_id; ?><!--&csrf_token=--><?php //echo $_SESSION['csrf_token'] ?><!--">-->
|
<li>Related Recurring Payments</li>
|
||||||
<!-- <i class="fas fa-fw fa-trash mr-2"></i>Delete-->
|
<li>Related Saved cards</li>
|
||||||
<!-- </a>-->
|
<li>Client Provider Relations</li>
|
||||||
|
</ul>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -135,5 +139,4 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/payment_provider/payment_provider_add.php";
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -36,7 +36,4 @@ if (isset($session_is_admin) && $session_is_admin) {
|
|||||||
require_once "../post/logout.php";
|
require_once "../post/logout.php";
|
||||||
|
|
||||||
// TODO: Find a home for these
|
// TODO: Find a home for these
|
||||||
|
|
||||||
require_once "../post/ai.php";
|
|
||||||
require_once "../post/misc.php";
|
require_once "../post/misc.php";
|
||||||
|
|
||||||
|
|||||||
157
admin/post/contract_template.php
Normal file
157
admin/post/contract_template.php
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ITFlow - GET/POST request handler for Contract Templates
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('FROM_POST_HANDLER') || die("Direct file access is not allowed");
|
||||||
|
|
||||||
|
if (isset($_POST['add_contract_template'])) {
|
||||||
|
|
||||||
|
// Sanitize text inputs
|
||||||
|
$name = sanitizeInput($_POST['name']);
|
||||||
|
$description = sanitizeInput($_POST['description']);
|
||||||
|
$type = sanitizeInput($_POST['type']);
|
||||||
|
$renewal_frequency = sanitizeInput($_POST['renewal_frequency']);
|
||||||
|
$support_hours = sanitizeInput($_POST['support_hours']);
|
||||||
|
$details = mysqli_escape_string($mysqli, $_POST['details']);
|
||||||
|
|
||||||
|
// Numeric fields cast to integer
|
||||||
|
$sla_low_resp = intval($_POST['sla_low_response_time']);
|
||||||
|
$sla_med_resp = intval($_POST['sla_medium_response_time']);
|
||||||
|
$sla_high_resp = intval($_POST['sla_high_response_time']);
|
||||||
|
$sla_low_res = intval($_POST['sla_low_resolution_time']);
|
||||||
|
$sla_med_res = intval($_POST['sla_medium_resolution_time']);
|
||||||
|
$sla_high_res = intval($_POST['sla_high_resolution_time']);
|
||||||
|
$rate_standard = intval($_POST['rate_standard']);
|
||||||
|
$rate_after_hours = intval($_POST['hourly_rate_after_hours']);
|
||||||
|
$net_terms = intval($_POST['net_terms']);
|
||||||
|
|
||||||
|
// Insert into database (numbers not quoted)
|
||||||
|
mysqli_query($mysqli, "
|
||||||
|
INSERT INTO contract_templates SET
|
||||||
|
contract_template_name = '$name',
|
||||||
|
contract_template_description = '$description',
|
||||||
|
contract_template_details = '$details',
|
||||||
|
contract_template_type = '$type',
|
||||||
|
contract_template_renewal_frequency = '$renewal_frequency',
|
||||||
|
contract_template_sla_low_response_time = $sla_low_resp,
|
||||||
|
contract_template_sla_medium_response_time = $sla_med_resp,
|
||||||
|
contract_template_sla_high_response_time = $sla_high_resp,
|
||||||
|
contract_template_sla_low_resolution_time = $sla_low_res,
|
||||||
|
contract_template_sla_medium_resolution_time = $sla_med_res,
|
||||||
|
contract_template_sla_high_resolution_time = $sla_high_res,
|
||||||
|
contract_template_rate_standard = $rate_standard,
|
||||||
|
contract_template_rate_after_hours = $rate_after_hours,
|
||||||
|
contract_template_support_hours = '$support_hours',
|
||||||
|
contract_template_net_terms = $net_terms
|
||||||
|
");
|
||||||
|
|
||||||
|
$contract_template_id = mysqli_insert_id($mysqli);
|
||||||
|
|
||||||
|
// Log action
|
||||||
|
logAction("Contract Template", "Create", "$session_name created contract template $name", 0, $contract_template_id);
|
||||||
|
|
||||||
|
// Flash message
|
||||||
|
flash_alert("Contract Template <strong>$name</strong> created");
|
||||||
|
|
||||||
|
// Redirect back
|
||||||
|
redirect();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['edit_contract_template'])) {
|
||||||
|
|
||||||
|
$contract_template_id = intval($_POST['contract_template_id']);
|
||||||
|
$name = sanitizeInput($_POST['name']);
|
||||||
|
$description = sanitizeInput($_POST['description']);
|
||||||
|
$type = sanitizeInput($_POST['type']);
|
||||||
|
$renewal_frequency= sanitizeInput($_POST['renewal_frequency']);
|
||||||
|
$support_hours = sanitizeInput($_POST['support_hours']);
|
||||||
|
$details = mysqli_escape_string($mysqli, $_POST['details']);
|
||||||
|
$sla_low_resp = intval($_POST['sla_low_response_time']);
|
||||||
|
$sla_med_resp = intval($_POST['sla_medium_response_time']);
|
||||||
|
$sla_high_resp = intval($_POST['sla_high_response_time']);
|
||||||
|
$sla_low_res = intval($_POST['sla_low_resolution_time']);
|
||||||
|
$sla_med_res = intval($_POST['sla_medium_resolution_time']);
|
||||||
|
$sla_high_res = intval($_POST['sla_high_resolution_time']);
|
||||||
|
$rate_standard = intval($_POST['rate_standard']);
|
||||||
|
$rate_after_hours = intval($_POST['rate_after_hours']);
|
||||||
|
$net_terms = intval($_POST['net_terms']);
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "
|
||||||
|
UPDATE contract_templates SET
|
||||||
|
contract_template_name = '$name',
|
||||||
|
contract_template_description = '$description',
|
||||||
|
contract_template_details = '$details',
|
||||||
|
contract_template_type = '$type',
|
||||||
|
contract_template_renewal_frequency = '$renewal_frequency',
|
||||||
|
contract_template_sla_low_response_time = $sla_low_resp,
|
||||||
|
contract_template_sla_medium_response_time = $sla_med_resp,
|
||||||
|
contract_template_sla_high_response_time = $sla_high_resp,
|
||||||
|
contract_template_sla_low_resolution_time = $sla_low_res,
|
||||||
|
contract_template_sla_medium_resolution_time = $sla_med_res,
|
||||||
|
contract_template_sla_high_resolution_time = $sla_high_res,
|
||||||
|
contract_template_rate_standard = $rate_standard,
|
||||||
|
contract_template_rate_after_hours = $rate_after_hours,
|
||||||
|
contract_template_support_hours = '$support_hours',
|
||||||
|
contract_template_net_terms = $net_terms
|
||||||
|
WHERE contract_template_id = $contract_template_id
|
||||||
|
");
|
||||||
|
|
||||||
|
// Log action
|
||||||
|
logAction("Contract Template", "Update", "$session_name updated contract template $name", 0, $contract_template_id);
|
||||||
|
|
||||||
|
// Flash + redirect
|
||||||
|
flash_alert("Contract Template <strong>$name</strong> updated");
|
||||||
|
redirect();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_GET['archive_contract_template'])) {
|
||||||
|
$contract_template_id = intval($_GET['archive_contract_template']);
|
||||||
|
|
||||||
|
$name = getFieldById('contract_templates', $contract_template_id, 'contract_template_name');
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "
|
||||||
|
UPDATE contract_templates SET contract_template_archived_at = NOW()
|
||||||
|
WHERE contract_template_id = $contract_template_id
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
|
||||||
|
logAction("Contract Template", "Archive", "$session_name archived contract template $name", 0, $contract_template_id);
|
||||||
|
flash_alert("Contract Template <strong>$name</strong> archived", "danger");
|
||||||
|
redirect();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_GET['restore_contract_template'])) {
|
||||||
|
$contract_template_id = intval($_GET['restore_contract_template']);
|
||||||
|
|
||||||
|
$name = getFieldById('contract_templates', $contract_template_id, 'contract_template_name');
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "
|
||||||
|
UPDATE contract_templates SET contract_template_archived_at = NULL
|
||||||
|
WHERE contract_template_id = $contract_template_id
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
|
||||||
|
logAction("Contract Template", "Restore", "$session_name restored contract template $name", 0, $contract_template_id);
|
||||||
|
flash_alert("Contract Template <strong>$name</strong> restored");
|
||||||
|
redirect();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_GET['delete_contract_template'])) {
|
||||||
|
$contract_template_id = intval($_GET['delete_contract_template']);
|
||||||
|
|
||||||
|
$name = getFieldById('contract_templates', $contract_template_id, 'contract_template_name');
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "
|
||||||
|
DELETE FROM contract_templates
|
||||||
|
WHERE contract_template_id = $contract_template_id
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
|
||||||
|
logAction("Contract Template", "Delete", "$session_name deleted contract template $name", 0, $contract_template_id);
|
||||||
|
flash_alert("Contract Template <strong>$name</strong> deleted", "danger");
|
||||||
|
redirect();
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -8,12 +8,24 @@ if (isset($_POST['add_document_template'])) {
|
|||||||
|
|
||||||
$name = sanitizeInput($_POST['name']);
|
$name = sanitizeInput($_POST['name']);
|
||||||
$description = sanitizeInput($_POST['description']);
|
$description = sanitizeInput($_POST['description']);
|
||||||
$content = mysqli_real_escape_string($mysqli,$_POST['content']);
|
|
||||||
|
|
||||||
mysqli_query($mysqli,"INSERT INTO document_templates SET document_template_name = '$name', document_template_description = '$description', document_template_content = '$content', document_template_created_by = $session_user_id");
|
mysqli_query($mysqli,"INSERT INTO document_templates SET document_template_name = '$name', document_template_description = '$description', document_template_content = '', document_template_created_by = $session_user_id");
|
||||||
|
|
||||||
$document_template_id = mysqli_insert_id($mysqli);
|
$document_template_id = mysqli_insert_id($mysqli);
|
||||||
|
|
||||||
|
$processed_content = mysqli_escape_string(
|
||||||
|
$mysqli,
|
||||||
|
saveBase64Images(
|
||||||
|
$_POST['content'],
|
||||||
|
$_SERVER['DOCUMENT_ROOT'] . "/uploads/document_templates/",
|
||||||
|
"uploads/document_templates/",
|
||||||
|
$document_template_id
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Document template update content
|
||||||
|
mysqli_query($mysqli,"UPDATE document_templates SET document_template_content = '$processed_content' WHERE document_template_id = $document_template_id");
|
||||||
|
|
||||||
logAction("Document Template", "Create", "$session_name created document template $name", 0, $document_template_id);
|
logAction("Document Template", "Create", "$session_name created document template $name", 0, $document_template_id);
|
||||||
|
|
||||||
flash_alert("Document template <strong>$name</strong> created");
|
flash_alert("Document template <strong>$name</strong> created");
|
||||||
@@ -27,10 +39,25 @@ if (isset($_POST['edit_document_template'])) {
|
|||||||
$document_template_id = intval($_POST['document_template_id']);
|
$document_template_id = intval($_POST['document_template_id']);
|
||||||
$name = sanitizeInput($_POST['name']);
|
$name = sanitizeInput($_POST['name']);
|
||||||
$description = sanitizeInput($_POST['description']);
|
$description = sanitizeInput($_POST['description']);
|
||||||
$content = mysqli_real_escape_string($mysqli,$_POST['content']);
|
|
||||||
|
$processed_content = saveBase64Images(
|
||||||
|
$_POST['content'],
|
||||||
|
$_SERVER['DOCUMENT_ROOT'] . "/uploads/document_templates/",
|
||||||
|
"uploads/document_templates/",
|
||||||
|
$document_template_id
|
||||||
|
);
|
||||||
|
|
||||||
|
$processed_content_escaped = mysqli_escape_string($mysqli, $processed_content);
|
||||||
|
|
||||||
|
// CLEAN UP unused images
|
||||||
|
cleanupUnusedImages(
|
||||||
|
$processed_content,
|
||||||
|
$_SERVER['DOCUMENT_ROOT'] . "/uploads/document_templates/" . $document_template_id,
|
||||||
|
"/uploads/document_templates/" . $document_template_id
|
||||||
|
);
|
||||||
|
|
||||||
// Document edit query
|
// Document edit query
|
||||||
mysqli_query($mysqli,"UPDATE document_templates SET document_template_name = '$name', document_template_description = '$description', document_template_content = '$content', document_template_updated_by = $session_user_id WHERE document_template_id = $document_template_id");
|
mysqli_query($mysqli,"UPDATE document_templates SET document_template_name = '$name', document_template_description = '$description', document_template_content = '$processed_content_escaped', document_template_updated_by = $session_user_id WHERE document_template_id = $document_template_id");
|
||||||
|
|
||||||
logAction("Document Template", "Edit", "$session_name edited document template $name", 0, $document_template_id);
|
logAction("Document Template", "Edit", "$session_name edited document template $name", 0, $document_template_id);
|
||||||
|
|
||||||
@@ -48,6 +75,9 @@ if (isset($_GET['delete_document_template'])) {
|
|||||||
|
|
||||||
mysqli_query($mysqli,"DELETE FROM document_templates WHERE document_template_id = $document_template_id");
|
mysqli_query($mysqli,"DELETE FROM document_templates WHERE document_template_id = $document_template_id");
|
||||||
|
|
||||||
|
// Delete uploads/document_templates/$document_template_id if exists
|
||||||
|
removeDirectory($_SERVER['DOCUMENT_ROOT'] . "/uploads/document_templates/" . $document_template_id);
|
||||||
|
|
||||||
logAction("Document Template", "Delete", "$session_name deleted document template $document_template_name");
|
logAction("Document Template", "Delete", "$session_name deleted document template $document_template_name");
|
||||||
|
|
||||||
flash_alert("Document Template <strong>$document_template_name</strong> deleted", 'error');
|
flash_alert("Document Template <strong>$document_template_name</strong> deleted", 'error');
|
||||||
|
|||||||
@@ -10,10 +10,17 @@ if (isset($_POST['add_payment_method'])) {
|
|||||||
|
|
||||||
validateCSRFToken($_POST['csrf_token']);
|
validateCSRFToken($_POST['csrf_token']);
|
||||||
|
|
||||||
$name = sanitizeInput($_POST['name']);
|
$name = cleanInput($_POST['name']);
|
||||||
$description = sanitizeInput($_POST['description']);
|
$description = cleanInput($_POST['description']);
|
||||||
|
|
||||||
mysqli_query($mysqli,"INSERT INTO payment_methods SET payment_method_name = '$name', payment_method_description = '$description'");
|
$query = mysqli_prepare(
|
||||||
|
$mysqli, "INSERT INTO payment_methods
|
||||||
|
SET payment_method_name = ?, payment_method_description = ?"
|
||||||
|
);
|
||||||
|
|
||||||
|
mysqli_stmt_bind_param($query, "ss", $name, $description);
|
||||||
|
|
||||||
|
mysqli_stmt_execute($query);
|
||||||
|
|
||||||
logAction("Payment Method", "Create", "$session_name created Payment Method $name");
|
logAction("Payment Method", "Create", "$session_name created Payment Method $name");
|
||||||
|
|
||||||
@@ -28,10 +35,19 @@ if (isset($_POST['edit_payment_method'])) {
|
|||||||
validateCSRFToken($_POST['csrf_token']);
|
validateCSRFToken($_POST['csrf_token']);
|
||||||
|
|
||||||
$payment_method_id = intval($_POST['payment_method_id']);
|
$payment_method_id = intval($_POST['payment_method_id']);
|
||||||
$name = sanitizeInput($_POST['name']);
|
$name = cleanInput($_POST['name']);
|
||||||
$description = sanitizeInput($_POST['description']);
|
$description = cleanInput($_POST['description']);
|
||||||
|
|
||||||
mysqli_query($mysqli,"UPDATE payment_methods SET payment_method_name = '$name', payment_method_description = '$description' WHERE payment_method_id = $payment_method_id");
|
$query = mysqli_prepare(
|
||||||
|
$mysqli,
|
||||||
|
"UPDATE payment_methods
|
||||||
|
SET payment_method_name = ?, payment_method_description = ?
|
||||||
|
WHERE payment_method_id = ?"
|
||||||
|
);
|
||||||
|
|
||||||
|
mysqli_stmt_bind_param($query, "ssi", $name, $description, $payment_method_id);
|
||||||
|
|
||||||
|
mysqli_stmt_execute($query);
|
||||||
|
|
||||||
logAction("Payment Method", "Edit", "$session_name edited Payment Method $name");
|
logAction("Payment Method", "Edit", "$session_name edited Payment Method $name");
|
||||||
|
|
||||||
|
|||||||
@@ -14,53 +14,20 @@ if (isset($_POST['add_payment_provider'])) {
|
|||||||
$public_key = sanitizeInput($_POST['public_key']);
|
$public_key = sanitizeInput($_POST['public_key']);
|
||||||
$private_key = sanitizeInput($_POST['private_key']);
|
$private_key = sanitizeInput($_POST['private_key']);
|
||||||
$threshold = floatval($_POST['threshold']);
|
$threshold = floatval($_POST['threshold']);
|
||||||
$enable_expense = intval($_POST['enable_expense'] ?? 0);
|
$account = intval($_POST['account']);
|
||||||
|
$expense_vendor = intval($_POST['expense_vendor']) ?? 0;
|
||||||
|
$expense_category = intval($_POST['expense_category']) ?? 0;
|
||||||
$percentage_fee = floatval($_POST['percentage_fee']) / 100 ?? 0;
|
$percentage_fee = floatval($_POST['percentage_fee']) / 100 ?? 0;
|
||||||
$flat_fee = floatval($_POST['flat_fee']) ?? 0;
|
$flat_fee = floatval($_POST['flat_fee']) ?? 0;
|
||||||
|
|
||||||
// Check to ensure provider isn't added twice
|
// Check to ensure provider isn't added twice
|
||||||
$sql = "SELECT 1 FROM payment_providers WHERE payment_provider_name = '$provider' LIMIT 1";
|
$sql = mysqli_query($mysqli, "SELECT 1 FROM payment_providers WHERE payment_provider_name = '$provider' LIMIT 1");
|
||||||
$result = mysqli_query($mysqli, $sql);
|
if (mysqli_num_rows($sql) > 0) {
|
||||||
if (mysqli_num_rows($result) > 0) {
|
|
||||||
flash_alert("Payment Provider <strong>$provider</strong> already exists", 'error');
|
flash_alert("Payment Provider <strong>$provider</strong> already exists", 'error');
|
||||||
redirect();
|
redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for Stripe Account, if not create it
|
mysqli_query($mysqli,"INSERT INTO payment_providers SET payment_provider_name = '$provider', payment_provider_public_key = '$public_key', payment_provider_private_key = '$private_key', payment_provider_threshold = $threshold, payment_provider_account = $account, payment_provider_expense_vendor = $expense_vendor, payment_provider_expense_category = $expense_category, payment_provider_expense_percentage_fee = $percentage_fee, payment_provider_expense_flat_fee = $flat_fee");
|
||||||
$sql_account = mysqli_query($mysqli,"SELECT account_id FROM accounts WHERE account_name = '$provider' AND account_archived_at IS NULL LIMIT 1");
|
|
||||||
if (mysqli_num_rows($sql_account) == 0) {
|
|
||||||
$account_id = mysqli_insert_id($mysqli);
|
|
||||||
} else {
|
|
||||||
$row = mysqli_fetch_array($sql_account);
|
|
||||||
$account_id = intval($row['account_id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Expense defaults
|
|
||||||
$category_id = 0;
|
|
||||||
$vendor_id = 0;
|
|
||||||
|
|
||||||
if ($enable_expense) {
|
|
||||||
// Category
|
|
||||||
$sql_category = mysqli_query($mysqli,"SELECT category_id FROM categories WHERE category_name = 'Payment Processing' AND category_type = 'Expense' AND category_archived_at IS NULL LIMIT 1");
|
|
||||||
if (mysqli_num_rows($sql_category) == 0) {
|
|
||||||
mysqli_query($mysqli,"INSERT INTO categories SET category_name = 'Processing Fee', category_type = 'Payment Processing', category_color = 'gray'");
|
|
||||||
$category_id = mysqli_insert_id($mysqli);
|
|
||||||
} else {
|
|
||||||
$row = mysqli_fetch_array($sql_category);
|
|
||||||
$category_id = intval($row['category_id']);
|
|
||||||
}
|
|
||||||
// Vendor
|
|
||||||
$sql_vendor = mysqli_query($mysqli,"SELECT vendor_id FROM vendors WHERE vendor_name = '$provider' AND vendor_client_id = 0 AND vendor_archived_at IS NULL LIMIT 1");
|
|
||||||
if (mysqli_num_rows($sql_vendor) == 0) {
|
|
||||||
mysqli_query($mysqli,"INSERT INTO vendors SET vendor_name = '$provider', vendor_description = 'Payment Processor Provider', vendor_client_id = 0");
|
|
||||||
$vendor_id = mysqli_insert_id($mysqli);
|
|
||||||
} else {
|
|
||||||
$row = mysqli_fetch_array($sql_vendor);
|
|
||||||
$vendor_id = intval($row['vendor_id']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mysqli_query($mysqli,"INSERT INTO payment_providers SET payment_provider_name = '$provider', payment_provider_public_key = '$public_key', payment_provider_private_key = '$private_key', payment_provider_threshold = $threshold, payment_provider_account = $account_id, payment_provider_expense_vendor = $vendor_id, payment_provider_expense_category = $category_id, payment_provider_expense_percentage_fee = $percentage_fee, payment_provider_expense_flat_fee = $flat_fee");
|
|
||||||
|
|
||||||
$provider_id = mysqli_insert_id($mysqli);
|
$provider_id = mysqli_insert_id($mysqli);
|
||||||
|
|
||||||
@@ -81,11 +48,13 @@ if (isset($_POST['edit_payment_provider'])) {
|
|||||||
$public_key = sanitizeInput($_POST['public_key']);
|
$public_key = sanitizeInput($_POST['public_key']);
|
||||||
$private_key = sanitizeInput($_POST['private_key']);
|
$private_key = sanitizeInput($_POST['private_key']);
|
||||||
$threshold = floatval($_POST['threshold']);
|
$threshold = floatval($_POST['threshold']);
|
||||||
$enable_expense = intval($_POST['enable_expense'] ?? 0);
|
$account = intval($_POST['account']);
|
||||||
|
$expense_vendor = intval($_POST['expense_vendor']) ?? 0;
|
||||||
|
$expense_category = intval($_POST['expense_category']) ?? 0;
|
||||||
$percentage_fee = floatval($_POST['percentage_fee']) / 100;
|
$percentage_fee = floatval($_POST['percentage_fee']) / 100;
|
||||||
$flat_fee = floatval($_POST['flat_fee']);
|
$flat_fee = floatval($_POST['flat_fee']);
|
||||||
|
|
||||||
mysqli_query($mysqli,"UPDATE payment_providers SET payment_provider_public_key = '$public_key', payment_provider_private_key = '$private_key', payment_provider_threshold = $threshold, payment_provider_expense_percentage_fee = $percentage_fee, payment_provider_expense_flat_fee = $flat_fee WHERE payment_provider_id = $provider_id");
|
mysqli_query($mysqli,"UPDATE payment_providers SET payment_provider_public_key = '$public_key', payment_provider_private_key = '$private_key', payment_provider_threshold = $threshold, payment_provider_account = $account, payment_provider_expense_vendor = $expense_vendor, payment_provider_expense_category = $expense_category, payment_provider_expense_percentage_fee = $percentage_fee, payment_provider_expense_flat_fee = $flat_fee WHERE payment_provider_id = $provider_id");
|
||||||
|
|
||||||
logAction("Payment Provider", "Edit", "$session_name edited Payment Provider $provider");
|
logAction("Payment Provider", "Edit", "$session_name edited Payment Provider $provider");
|
||||||
|
|
||||||
@@ -101,6 +70,11 @@ if (isset($_GET['delete_payment_provider'])) {
|
|||||||
|
|
||||||
$provider_id = intval($_GET['delete_payment_provider']);
|
$provider_id = intval($_GET['delete_payment_provider']);
|
||||||
|
|
||||||
|
// When deleted it cascades deletes
|
||||||
|
// all Recurring paymentes related to payment provider
|
||||||
|
// Delete all Saved Cards related
|
||||||
|
// Delete Client Payment Provider Releation
|
||||||
|
|
||||||
$provider_name = sanitizeInput(getFieldById('payment_providers', $provider_id, 'provider_name'));
|
$provider_name = sanitizeInput(getFieldById('payment_providers', $provider_id, 'provider_name'));
|
||||||
|
|
||||||
// Delete provider
|
// Delete provider
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ if (isset($_GET['delete_saved_payment'])) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Initialize stripe
|
// Initialize stripe
|
||||||
require_once 'plugins/stripe-php/init.php';
|
require_once '../plugins/stripe-php/init.php';
|
||||||
$stripe = new \Stripe\StripeClient($private_key);
|
$stripe = new \Stripe\StripeClient($private_key);
|
||||||
|
|
||||||
// Detach PM
|
// Detach PM
|
||||||
@@ -56,7 +56,7 @@ if (isset($_GET['delete_saved_payment'])) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove payment method from ITFlow
|
// Remove payment method from ITFlow. This will also cascade delete related recurring payments setup
|
||||||
mysqli_query($mysqli, "DELETE FROM client_saved_payment_methods WHERE saved_payment_id = $saved_payment_id");
|
mysqli_query($mysqli, "DELETE FROM client_saved_payment_methods WHERE saved_payment_id = $saved_payment_id");
|
||||||
|
|
||||||
// SQL Cascade delete will Remove All Associated Auto Payment Methods on recurring invoices in the recurring payments table.
|
// SQL Cascade delete will Remove All Associated Auto Payment Methods on recurring invoices in the recurring payments table.
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ if (isset($_POST['test_email_smtp'])) {
|
|||||||
$mail = addToMailQueue($data);
|
$mail = addToMailQueue($data);
|
||||||
|
|
||||||
if ($mail === true) {
|
if ($mail === true) {
|
||||||
flash_alert("Test email queued! <a class='text-bold text-light' href='admin_mail_queue.php'>Check Admin > Mail queue</a>");
|
flash_alert("Test email queued! <a class='text-bold text-light' href='mail_queue.php'>Check Admin > Mail queue</a>");
|
||||||
} else {
|
} else {
|
||||||
flash_alert("Failed to add test mail to queue", 'error');
|
flash_alert("Failed to add test mail to queue", 'error');
|
||||||
}
|
}
|
||||||
@@ -163,24 +163,125 @@ if (isset($_POST['test_email_imap'])) {
|
|||||||
|
|
||||||
validateCSRFToken($_POST['csrf_token']);
|
validateCSRFToken($_POST['csrf_token']);
|
||||||
|
|
||||||
// Setup your IMAP connection parameters
|
$host = $config_imap_host;
|
||||||
$hostname = "{" . $config_imap_host . ":" . $config_imap_port . "/" . $config_imap_encryption . "/novalidate-cert}INBOX";
|
$port = (int) $config_imap_port;
|
||||||
|
$encryption = strtolower(trim($config_imap_encryption)); // e.g. "ssl", "tls", "none"
|
||||||
$username = $config_imap_username;
|
$username = $config_imap_username;
|
||||||
$password = $config_imap_password;
|
$password = $config_imap_password;
|
||||||
|
|
||||||
try {
|
// Build remote socket (implicit SSL vs plain TCP)
|
||||||
$inbox = @imap_open($hostname, $username, $password);
|
$transport = 'tcp';
|
||||||
|
if ($encryption === 'ssl') {
|
||||||
|
$transport = 'ssl';
|
||||||
|
}
|
||||||
|
|
||||||
if ($inbox) {
|
$remote_socket = $transport . '://' . $host . ':' . $port;
|
||||||
imap_close($inbox);
|
|
||||||
|
// Stream context (you can tighten these if you want strict validation)
|
||||||
|
$contextOptions = [];
|
||||||
|
if (in_array($encryption, ['ssl', 'tls'], true)) {
|
||||||
|
$contextOptions['ssl'] = [
|
||||||
|
'verify_peer' => false,
|
||||||
|
'verify_peer_name' => false,
|
||||||
|
'allow_self_signed' => true,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$context = stream_context_create($contextOptions);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$errno = 0;
|
||||||
|
$errstr = '';
|
||||||
|
|
||||||
|
// 10-second timeout, adjust as needed
|
||||||
|
$fp = @stream_socket_client(
|
||||||
|
$remote_socket,
|
||||||
|
$errno,
|
||||||
|
$errstr,
|
||||||
|
10,
|
||||||
|
STREAM_CLIENT_CONNECT,
|
||||||
|
$context
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!$fp) {
|
||||||
|
throw new Exception("Could not connect to IMAP server: [$errno] $errstr");
|
||||||
|
}
|
||||||
|
|
||||||
|
stream_set_timeout($fp, 10);
|
||||||
|
|
||||||
|
// Read server greeting (IMAP servers send something like: * OK Dovecot ready)
|
||||||
|
$greeting = fgets($fp, 1024);
|
||||||
|
if ($greeting === false || strpos($greeting, '* OK') !== 0) {
|
||||||
|
fclose($fp);
|
||||||
|
throw new Exception("Invalid IMAP greeting: " . trim((string) $greeting));
|
||||||
|
}
|
||||||
|
|
||||||
|
// If you really want STARTTLS for "tls" (port 143), you can do it here
|
||||||
|
if ($encryption === 'tls' && stripos($greeting, 'STARTTLS') !== false) {
|
||||||
|
// Request STARTTLS
|
||||||
|
fwrite($fp, "A0001 STARTTLS\r\n");
|
||||||
|
$line = fgets($fp, 1024);
|
||||||
|
if ($line === false || stripos($line, 'A0001 OK') !== 0) {
|
||||||
|
fclose($fp);
|
||||||
|
throw new Exception("STARTTLS failed: " . trim((string) $line));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable crypto on the stream
|
||||||
|
if (!stream_socket_enable_crypto($fp, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
|
||||||
|
fclose($fp);
|
||||||
|
throw new Exception("Unable to enable TLS encryption on IMAP connection.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Do LOGIN command ---
|
||||||
|
$tag = 'A0002';
|
||||||
|
|
||||||
|
// Simple quoting; this may fail with some special chars in username/password.
|
||||||
|
$loginCmd = sprintf(
|
||||||
|
"%s LOGIN \"%s\" \"%s\"\r\n",
|
||||||
|
$tag,
|
||||||
|
addcslashes($username, "\\\""),
|
||||||
|
addcslashes($password, "\\\"")
|
||||||
|
);
|
||||||
|
|
||||||
|
fwrite($fp, $loginCmd);
|
||||||
|
|
||||||
|
$success = false;
|
||||||
|
$errorLine = '';
|
||||||
|
|
||||||
|
while (!feof($fp)) {
|
||||||
|
$line = fgets($fp, 2048);
|
||||||
|
if ($line === false) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Look for tagged response for our LOGIN
|
||||||
|
if (strpos($line, $tag . ' ') === 0) {
|
||||||
|
if (stripos($line, $tag . ' OK') === 0) {
|
||||||
|
$success = true;
|
||||||
|
} else {
|
||||||
|
$errorLine = trim($line);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Always logout / close
|
||||||
|
fwrite($fp, "A0003 LOGOUT\r\n");
|
||||||
|
fclose($fp);
|
||||||
|
|
||||||
|
if ($success) {
|
||||||
flash_alert("Connected successfully");
|
flash_alert("Connected successfully");
|
||||||
} else {
|
} else {
|
||||||
throw new Exception(imap_last_error());
|
if (!$errorLine) {
|
||||||
|
$errorLine = 'Unknown IMAP authentication error';
|
||||||
}
|
}
|
||||||
|
throw new Exception($errorLine);
|
||||||
|
}
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
flash_alert("<strong>IMAP connection failed:</strong> " . $e->getMessage(), 'error');
|
flash_alert("<strong>IMAP connection failed:</strong> " . htmlspecialchars($e->getMessage()), 'error');
|
||||||
}
|
}
|
||||||
|
|
||||||
redirect();
|
redirect();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,3 +49,17 @@ if (isset($_POST['edit_favicon_settings'])) {
|
|||||||
redirect();
|
redirect();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($_GET['reset_favicon'])) {
|
||||||
|
|
||||||
|
if (file_exists("../uploads/favicon.ico")) {
|
||||||
|
unlink("../uploads/favicon.ico");
|
||||||
|
}
|
||||||
|
|
||||||
|
logAction("Settings", "Edit", "$session_name reset Favicon");
|
||||||
|
|
||||||
|
flash_alert("Favicon reset", 'error');
|
||||||
|
|
||||||
|
redirect();
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ if (isset($_POST['edit_tag'])) {
|
|||||||
|
|
||||||
$tag_id = intval($_POST['tag_id']);
|
$tag_id = intval($_POST['tag_id']);
|
||||||
|
|
||||||
mysqli_query($mysqli,"UPDATE tags SET tag_name = '$name', tag_type = $type, tag_color = '$color', tag_icon = '$icon' WHERE tag_id = $tag_id");
|
mysqli_query($mysqli,"UPDATE tags SET tag_name = '$name', tag_color = '$color', tag_icon = '$icon' WHERE tag_id = $tag_id");
|
||||||
|
|
||||||
logAction("Tag", "Edit", "$session_name edited tag $name", 0, $tag_id);
|
logAction("Tag", "Edit", "$session_name edited tag $name", 0, $tag_id);
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<div class="card-header py-2">
|
<div class="card-header py-2">
|
||||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-project-diagram mr-2"></i>Project Templates</h3>
|
<h3 class="card-title mt-2"><i class="fas fa-fw fa-project-diagram mr-2"></i>Project Templates</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addProjectTemplateModal"><i class="fas fa-plus mr-2"></i>New Project Template</button>
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/project_template/project_template_add.php"><i class="fas fa-plus mr-2"></i>New Project Template</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@@ -87,7 +87,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="#editProjectTemplateModal<?php echo $project_template_id; ?>">
|
<a class="text-dark ajax-modal" href="#" data-modal-url="modals/project_template/project_template_edit.php?project_template_id=<?= $project_template_id ?>">
|
||||||
<div class="media">
|
<div class="media">
|
||||||
<i class="fa fa-fw fa-2x fa-project-diagram mr-3"></i>
|
<i class="fa fa-fw fa-2x fa-project-diagram mr-3"></i>
|
||||||
<div class="media-body">
|
<div class="media-body">
|
||||||
@@ -109,7 +109,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="#editProjectTemplateModal<?php echo $project_template_id; ?>">
|
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/project_template/project_template_edit.php?project_template_id=<?= $project_template_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) { ?>
|
||||||
@@ -125,8 +125,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require "modals/project_template/project_template_edit.php";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -134,12 +132,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?php require_once "../includes/filter_footer.php";
|
<?php require_once "../includes/filter_footer.php"; ?>
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/project_template/project_template_add.php";
|
|
||||||
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ if (isset($_GET['project_template_id'])) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (mysqli_num_rows($sql_project_templates) == 0) {
|
if (mysqli_num_rows($sql_project_templates) == 0) {
|
||||||
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='admin_project_template.php'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>";
|
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='javascript:history.back()'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>";
|
||||||
|
|
||||||
include_once "footer.php";
|
require_once "../includes/footer.php";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ if (isset($_GET['project_template_id'])) {
|
|||||||
|
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
<div class="btn-group float-right">
|
<div class="btn-group float-right">
|
||||||
<button type="button" class="btn btn-primary btn-sm" href="#" data-toggle="modal" data-target="#addProjectTemplateTicketTemplateModal">
|
<button type="button" class="btn btn-primary btn-sm ajax-modal" href="#" data-modal-url="modals/project_template/project_template_ticket_template_add.php?project_template_id=<?= $project_template_id ?>">
|
||||||
<i class="fas fa-fw fa-plus mr-2"></i>Add Ticket Template
|
<i class="fas fa-fw fa-plus mr-2"></i>Add Ticket Template
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown dropleft text-center ml-3">
|
<div class="dropdown dropleft text-center ml-3">
|
||||||
@@ -99,7 +99,7 @@ if (isset($_GET['project_template_id'])) {
|
|||||||
<i class="fas fa-fw fa-ellipsis-v"></i>
|
<i class="fas fa-fw fa-ellipsis-v"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editProjectTemplateModal<?php echo $project_template_id; ?>">
|
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/project_template/project_template_edit.php?project_template_id=<?= $project_template_id ?>">
|
||||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit Template
|
<i class="fas fa-fw fa-edit mr-2"></i>Edit Template
|
||||||
</a>
|
</a>
|
||||||
<?php if ($session_user_role == 3) { ?>
|
<?php if ($session_user_role == 3) { ?>
|
||||||
@@ -221,9 +221,6 @@ if (isset($_GET['project_template_id'])) {
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "modals/project_template/project_template_edit.php";
|
|
||||||
require_once "modals/project_template/project_template_ticket_template_add.php";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-user-shield mr-2"></i>Roles</h3>
|
<h3 class="card-title mt-2"><i class="fas fa-fw fa-user-shield mr-2"></i>Roles</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addRoleModal">
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/role/role_add.php">
|
||||||
<i class="fas fa-fw fa-user-plus mr-2"></i>New Role
|
<i class="fas fa-fw fa-user-plus mr-2"></i>New Role
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -143,6 +143,4 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "modals/role/role_add.php";
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -33,6 +33,16 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<ol class="breadcrumb d-print-none">
|
||||||
|
<li class="breadcrumb-item">
|
||||||
|
<a href="/admin">Admin</a>
|
||||||
|
</li>
|
||||||
|
<li class="breadcrumb-item">
|
||||||
|
<a href="payment_provider.php">Payment Providers</a>
|
||||||
|
</li>
|
||||||
|
<li class="breadcrumb-item active">Saved Payment Methods (Stripe)</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
<div class="card card-dark">
|
<div class="card card-dark">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title"><i class="fas fa-fw fa-credit-card mr-2"></i>Saved Payment Methods</h3>
|
<h3 class="card-title"><i class="fas fa-fw fa-credit-card mr-2"></i>Saved Payment Methods</h3>
|
||||||
@@ -107,8 +117,16 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $client_name; ?> (<?php echo $client_id; ?>)</td>
|
<td>
|
||||||
<td><?php echo $provider_name; ?> (<?php echo $provider_id; ?>)</td>
|
<?= $client_name ?>
|
||||||
|
<br>
|
||||||
|
<small class="text-secondary">ID: <?= $client_id ?></small>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?= $provider_name ?>
|
||||||
|
<br>
|
||||||
|
<small class="text-secondary">ID: <?= $provider_id ?></small>
|
||||||
|
</td>
|
||||||
<td><?php echo $saved_payment_description; ?></td>
|
<td><?php echo $saved_payment_description; ?></td>
|
||||||
<td><?php echo $provider_client; ?></td>
|
<td><?php echo $provider_client; ?></td>
|
||||||
<td><?php echo $provider_payment_method; ?></td>
|
<td><?php echo $provider_payment_method; ?></td>
|
||||||
|
|||||||
@@ -214,7 +214,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-clock"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-clock"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,2}" name="hourly_rate" value="<?php echo number_format($config_default_hourly_rate, 2, '.', ''); ?>" placeholder="0.00" required>
|
<input type="text" class="form-control" inputmode="decimal" pattern="[0-9]*\.?[0-9]{0,2}" name="hourly_rate" value="<?php echo number_format($config_default_hourly_rate, 2, '.', ''); ?>" placeholder="0.00" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -57,11 +57,12 @@ require_once "includes/inc_all_admin.php";
|
|||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<button type="submit" name="edit_favicon_settings" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Upload Icon</button>
|
<button type="submit" name="edit_favicon_settings" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Upload Icon</button>
|
||||||
|
<?php if(file_exists("../uploads/favicon.ico")) { ?>
|
||||||
|
<a href="post.php?reset_favicon" class="btn btn-outline-danger"><i class="fas fa-redo-alt mr-2"></i>Reset Favicon</a>
|
||||||
|
<?php } ?>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<div class="card-header py-2">
|
<div class="card-header py-2">
|
||||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-cube mr-2"></i>License Templates</h3>
|
<h3 class="card-title mt-2"><i class="fas fa-fw fa-cube mr-2"></i>License Templates</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addSoftwareTemplateModal"><i class="fas fa-plus mr-2"></i>New License Template</button>
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/software_template/software_template_add.php"><i class="fas fa-plus mr-2"></i>New License Template</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@@ -127,5 +127,4 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/software_template/software_template_add.php";
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -6,10 +6,31 @@ $order = "ASC";
|
|||||||
|
|
||||||
require_once "includes/inc_all_admin.php";
|
require_once "includes/inc_all_admin.php";
|
||||||
|
|
||||||
|
if (isset($_GET['type'])) {
|
||||||
|
$type_filter = intval($_GET['type']);
|
||||||
|
} else {
|
||||||
|
$type_filter = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type_filter == 1) {
|
||||||
|
$tag_type_display = "Client";
|
||||||
|
} elseif ( $type_filter == 2) {
|
||||||
|
$tag_type_display = "Location";
|
||||||
|
} elseif ( $type_filter == 3) {
|
||||||
|
$tag_type_display = "Contact";
|
||||||
|
} elseif ( $type_filter == 4) {
|
||||||
|
$tag_type_display = "Credential";
|
||||||
|
} elseif ( $type_filter == 5) {
|
||||||
|
$tag_type_display = "Asset";
|
||||||
|
} else {
|
||||||
|
$tag_type_display = "Unknown";
|
||||||
|
}
|
||||||
|
|
||||||
$sql = mysqli_query(
|
$sql = mysqli_query(
|
||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT SQL_CALC_FOUND_ROWS * FROM tags
|
"SELECT SQL_CALC_FOUND_ROWS * FROM tags
|
||||||
WHERE tag_name LIKE '%$q%'
|
WHERE tag_name LIKE '%$q%'
|
||||||
|
AND tag_type = $type_filter
|
||||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -19,9 +40,9 @@ $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-tags mr-2"></i>Tags</h3>
|
<h3 class="card-title mt-2"><i class="fas fa-fw fa-tags mr-2"></i><?= $tag_type_display ?> Tags</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/tag/tag_add.php"><i class="fas fa-plus mr-2"></i>New Tag</button>
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/tag/tag_add.php?type=<?= $type_filter ?>"><i class="fas fa-plus mr-2"></i>New <?= $tag_type_display ?> Tag</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -30,7 +51,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<div class="col-sm-4 mb-2">
|
<div class="col-sm-4 mb-2">
|
||||||
<form autocomplete="off">
|
<form autocomplete="off">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search Tags">
|
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search <?= $tag_type_display ?> Tags">
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
|
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
|
||||||
</div>
|
</div>
|
||||||
@@ -38,6 +59,45 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
|
<div class="btn-group float-right">
|
||||||
|
<a href="?type=1"
|
||||||
|
class="btn <?php if ($type_filter == 1) {
|
||||||
|
echo 'btn-primary';
|
||||||
|
} else {
|
||||||
|
echo 'btn-default';
|
||||||
|
} ?>">Client</a>
|
||||||
|
<a href="?type=2"
|
||||||
|
class="btn <?php if ($type_filter == 2) {
|
||||||
|
echo 'btn-primary';
|
||||||
|
} else {
|
||||||
|
echo 'btn-default';
|
||||||
|
} ?>">Location</a>
|
||||||
|
<a href="?type=3"
|
||||||
|
class="btn <?php if ($type_filter == 3) {
|
||||||
|
echo 'btn-primary';
|
||||||
|
} else {
|
||||||
|
echo 'btn-default';
|
||||||
|
} ?>">Contact</a>
|
||||||
|
<a href="?type=4"
|
||||||
|
class="btn <?php if ($type_filter == 4) {
|
||||||
|
echo 'btn-primary';
|
||||||
|
} else {
|
||||||
|
echo 'btn-default';
|
||||||
|
} ?>">Credential</a>
|
||||||
|
<a href="?type=5"
|
||||||
|
class="btn <?php if ($type_filter == 5) {
|
||||||
|
echo 'btn-primary';
|
||||||
|
} else {
|
||||||
|
echo 'btn-default';
|
||||||
|
} ?>">Asset</a>
|
||||||
|
<a href="?<?= $url_query_strings_sort ?>&archived=1"
|
||||||
|
class="btn <?php if (isset($_GET['archived'])) {
|
||||||
|
echo 'btn-primary';
|
||||||
|
} else {
|
||||||
|
echo 'btn-default';
|
||||||
|
} ?>"><i
|
||||||
|
class="fas fa-fw fa-archive mr-2"></i>Archived</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -51,11 +111,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
Name <?php if ($sort == 'tag_name') { echo $order_icon; } ?>
|
Name <?php if ($sort == 'tag_name') { echo $order_icon; } ?>
|
||||||
</a>
|
</a>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
|
||||||
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=tag_type&order=<?php echo $disp; ?>">
|
|
||||||
Type <?php if ($sort == 'tag_type') { echo $order_icon; } ?>
|
|
||||||
</a>
|
|
||||||
</th>
|
|
||||||
<th class="text-center">Action</th>
|
<th class="text-center">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -65,18 +120,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
$tag_id = intval($row['tag_id']);
|
$tag_id = intval($row['tag_id']);
|
||||||
$tag_name = nullable_htmlentities($row['tag_name']);
|
$tag_name = nullable_htmlentities($row['tag_name']);
|
||||||
$tag_type = intval($row['tag_type']);
|
|
||||||
if ( $tag_type == 1) {
|
|
||||||
$tag_type_display = "Client Tag";
|
|
||||||
} elseif ( $tag_type == 2) {
|
|
||||||
$tag_type_display = "Location Tag";
|
|
||||||
} elseif ( $tag_type == 3) {
|
|
||||||
$tag_type_display = "Contact Tag";
|
|
||||||
} elseif ( $tag_type == 4) {
|
|
||||||
$tag_type_display = "Credential Tag";
|
|
||||||
} else {
|
|
||||||
$tag_type_display = "Unknown Tag";
|
|
||||||
}
|
|
||||||
$tag_color = nullable_htmlentities($row['tag_color']);
|
$tag_color = nullable_htmlentities($row['tag_color']);
|
||||||
$tag_icon = nullable_htmlentities($row['tag_icon']);
|
$tag_icon = nullable_htmlentities($row['tag_icon']);
|
||||||
|
|
||||||
@@ -88,7 +131,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<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>
|
||||||
<td><?php echo $tag_type_display; ?></td>
|
|
||||||
<td>
|
<td>
|
||||||
<div class="dropdown dropleft text-center">
|
<div class="dropdown dropleft text-center">
|
||||||
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
||||||
@@ -117,8 +159,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?php require_once "../includes/filter_footer.php";
|
<?php require_once "../includes/filter_footer.php"; ?>
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
<div class="card-header py-2">
|
<div class="card-header py-2">
|
||||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-balance-scale mr-2"></i>Taxes</h3>
|
<h3 class="card-title mt-2"><i class="fas fa-fw fa-balance-scale mr-2"></i>Taxes</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addTaxModal"><i class="fas fa-plus mr-2"></i>New Tax</button>
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/tax/tax_add.php"><i class="fas fa-plus mr-2"></i>New Tax</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@@ -96,5 +96,4 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/tax/tax_add.php";
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<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 ajax-modal" data-modal-url="modals/ticket_status/ticket_status_add.php"><i class="fas fa-plus mr-2"></i>New Ticket Status</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -120,13 +120,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?php require_once "../includes/filter_footer.php";
|
<?php require_once "../includes/filter_footer.php"; ?>
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/ticket_status/ticket_status_add.php";
|
|
||||||
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<div class="card-header py-2">
|
<div class="card-header py-2">
|
||||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-life-ring mr-2"></i>Ticket Templates</h3>
|
<h3 class="card-title mt-2"><i class="fas fa-fw fa-life-ring mr-2"></i>Ticket Templates</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addTicketTemplateModal"><i class="fas fa-plus mr-2"></i>New Ticket Template</button>
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/ticket_template/ticket_template_add.php" data-modal-size="lg"><i class="fas fa-plus mr-2"></i>New Ticket Template</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@@ -120,5 +120,4 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/ticket_template/ticket_template_add.php";
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -15,9 +15,15 @@ if (isset($_GET['ticket_template_id'])) {
|
|||||||
$ticket_template_id = intval($_GET['ticket_template_id']);
|
$ticket_template_id = intval($_GET['ticket_template_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_ticket_templates = mysqli_query($mysqli, "SELECT * FROM ticket_templates WHERE ticket_template_id = $ticket_template_id");
|
$sql_ticket_template = mysqli_query($mysqli, "SELECT * FROM ticket_templates WHERE ticket_template_id = $ticket_template_id LIMIT 1");
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql_ticket_templates);
|
if (mysqli_num_rows($sql_ticket_template) == 0) {
|
||||||
|
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='javascript:history.back()'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>";
|
||||||
|
require_once "../includes/footer.php";
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql_ticket_template);
|
||||||
|
|
||||||
$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']);
|
||||||
|
|||||||
@@ -26,16 +26,23 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-users mr-2"></i>Users</h3>
|
<h3 class="card-title mt-2"><i class="fas fa-fw fa-users mr-2"></i>Users</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addUserModal">
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/user/user_add.php">
|
||||||
<i class="fas fa-fw fa-user-plus mr-2"></i>New User
|
<i class="fas fa-fw fa-user-plus mr-2"></i>New User
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||||
<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 ajax-modal" href="#" data-modal-url="modals/user/user_invite.php"><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>
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/user/user_export.php">
|
||||||
|
<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 ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/user/user_all_reset_password.php"
|
||||||
|
data-modal-size="lg">
|
||||||
|
<i class="fas fa-skull-crossbones mr-2"></i>IR
|
||||||
|
</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -156,7 +163,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<a href="#"
|
<a href="#" title="UserID: <?= $user_id ?>"
|
||||||
<?php if ($user_id !== $session_user_id) { // Prevent modifying self ?>
|
<?php if ($user_id !== $session_user_id) { // Prevent modifying self ?>
|
||||||
class="ajax-modal"
|
class="ajax-modal"
|
||||||
data-modal-url="modals/user/user_edit.php?id=<?= $user_id ?>"
|
data-modal-url="modals/user/user_edit.php?id=<?= $user_id ?>"
|
||||||
@@ -233,15 +240,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
|
||||||
function generatePassword() {
|
|
||||||
document.getElementById("password").value = "<?php echo randomString() ?>"
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/user/user_add.php";
|
|
||||||
require_once "modals/user/user_invite.php";
|
|
||||||
require_once "modals/user/user_export.php";
|
|
||||||
require_once "modals/user/user_all_reset_password.php";
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
@@ -22,7 +22,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<i class="fas fa-fw fa-building mr-2"></i>Vendor Templates
|
<i class="fas fa-fw fa-building mr-2"></i>Vendor Templates
|
||||||
</h3>
|
</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addVendorTemplateModal">
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/vendor_template/vendor_template_add.php">
|
||||||
<i class="fas fa-plus mr-2"></i>New Vendor Template
|
<i class="fas fa-plus mr-2"></i>New Vendor Template
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -140,7 +140,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</a>
|
</a>
|
||||||
<?php if ($session_user_role == 3) { ?>
|
<?php if ($session_user_role == 3) { ?>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_vendor=<?php echo $vendor_template_id; ?>">
|
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_vendor_template=<?= $vendor_template_id ?>">
|
||||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||||
</a>
|
</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@@ -158,11 +158,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?php require_once "../includes/filter_footer.php";
|
<?php require_once "../includes/filter_footer.php"; ?>
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/vendor_template/vendor_template_add.php";
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<div class="card-header py-2">
|
<div class="card-header py-2">
|
||||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-piggy-bank mr-2"></i>Accounts</h3>
|
<h3 class="card-title mt-2"><i class="fa fa-fw fa-piggy-bank mr-2"></i>Accounts</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addAccountModal"><i class="fas fa-plus mr-2"></i>New Account</button>
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/account/account_add.php"><i class="fas fa-plus mr-2"></i>New Account</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@@ -123,6 +123,4 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "modals/account/account_add.php";
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
319
agent/ajax.php
319
agent/ajax.php
@@ -46,7 +46,7 @@ if (isset($_GET['certificate_fetch_parse_json_details'])) {
|
|||||||
if (isset($_GET['merge_ticket_get_json_details'])) {
|
if (isset($_GET['merge_ticket_get_json_details'])) {
|
||||||
enforceUserPermission('module_support');
|
enforceUserPermission('module_support');
|
||||||
|
|
||||||
$merge_into_ticket_number = intval($_GET['merge_into_ticket_number']);
|
$merge_into_ticket_number = intval(preg_replace('/[^0-9]/', '', $_GET['merge_into_ticket_number']));
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT ticket_id, ticket_number, ticket_prefix, ticket_subject, ticket_priority, ticket_status, ticket_status_name, client_name, contact_name FROM tickets
|
$sql = mysqli_query($mysqli, "SELECT ticket_id, ticket_number, ticket_prefix, ticket_subject, ticket_priority, ticket_status, ticket_status_name, client_name, contact_name FROM tickets
|
||||||
LEFT JOIN clients ON ticket_client_id = client_id
|
LEFT JOIN clients ON ticket_client_id = client_id
|
||||||
@@ -195,7 +195,7 @@ if (isset($_GET['share_generate_link'])) {
|
|||||||
$item_expires_friendly = "1 month";
|
$item_expires_friendly = "1 month";
|
||||||
}
|
}
|
||||||
|
|
||||||
$item_key = randomString(156);
|
$item_key = randomString(32);
|
||||||
|
|
||||||
if ($item_type == "Document") {
|
if ($item_type == "Document") {
|
||||||
$row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT document_name FROM documents WHERE document_id = $item_id AND document_client_id = $client_id LIMIT 1"));
|
$row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT document_name FROM documents WHERE document_id = $item_id AND document_client_id = $client_id LIMIT 1"));
|
||||||
@@ -432,7 +432,7 @@ 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(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -699,3 +699,316 @@ if (isset($_GET['client_duplicate_check'])) {
|
|||||||
|
|
||||||
echo json_encode($response);
|
echo json_encode($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($_GET['contact_email_check'])) {
|
||||||
|
enforceUserPermission('module_client', 2);
|
||||||
|
|
||||||
|
$email = sanitizeInput($_GET['email']);
|
||||||
|
$domain = sanitizeInput(substr($_GET['email'], strpos($_GET['email'], '@') + 1));
|
||||||
|
|
||||||
|
$response['message'] = ""; // default
|
||||||
|
|
||||||
|
if (strlen($email) >= 3) {
|
||||||
|
|
||||||
|
// 1. Duplicate check
|
||||||
|
$sql_contacts = mysqli_query($mysqli, "SELECT contact_email FROM contacts WHERE contact_email = '$email' LIMIT 1");
|
||||||
|
if (mysqli_num_rows($sql_contacts) > 0) {
|
||||||
|
while ($row = mysqli_fetch_array($sql_contacts)) {
|
||||||
|
$response['message'] = "<i class='fas fa-fw fa-copy mr-2'></i> Potential duplicate: <i>" . nullable_htmlentities($row['contact_email']) . "</i> already exists.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. MX record check
|
||||||
|
if (!checkdnsrr($domain, 'MX')) {
|
||||||
|
$response['message'] = "<i class='fas fa-fw fa-exclamation-triangle mr-2'></i> E-mail domain invalid.";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($response);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_GET['ai_reword'])) {
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM ai_models LEFT JOIN ai_providers ON ai_model_ai_provider_id = ai_provider_id WHERE ai_model_use_case = 'General' LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$model_name = $row['ai_model_name'];
|
||||||
|
$promptText = $row['ai_model_prompt'];
|
||||||
|
$url = $row['ai_provider_api_url'];
|
||||||
|
$key = $row['ai_provider_api_key'];
|
||||||
|
|
||||||
|
// Collecting the input data from the AJAX request.
|
||||||
|
$inputJSON = file_get_contents('php://input');
|
||||||
|
$input = json_decode($inputJSON, TRUE); // Convert JSON into array.
|
||||||
|
|
||||||
|
$userText = $input['text'];
|
||||||
|
|
||||||
|
// Preparing the data for the OpenAI Chat API request.
|
||||||
|
$data = [
|
||||||
|
"model" => "$model_name", // Specify the model
|
||||||
|
"messages" => [
|
||||||
|
["role" => "system", "content" => $promptText],
|
||||||
|
["role" => "user", "content" => $userText],
|
||||||
|
],
|
||||||
|
"temperature" => 0.5
|
||||||
|
];
|
||||||
|
|
||||||
|
// Initialize cURL session to the OpenAI Chat API.
|
||||||
|
$ch = curl_init("$url");
|
||||||
|
|
||||||
|
// Set cURL options for the request.
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||||
|
'Content-Type: application/json',
|
||||||
|
'Authorization: Bearer ' . $key,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Execute the cURL session and capture the response.
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
// Decode the JSON response.
|
||||||
|
$responseData = json_decode($response, true);
|
||||||
|
|
||||||
|
// Check if the response contains the expected data and return it.
|
||||||
|
if (isset($responseData['choices'][0]['message']['content'])) {
|
||||||
|
// Get the response content.
|
||||||
|
$content = $responseData['choices'][0]['message']['content'];
|
||||||
|
|
||||||
|
// Clean any leading "html" word or other unwanted text at the beginning.
|
||||||
|
$content = preg_replace('/^html/i', '', $content); // Remove any occurrence of 'html' at the start
|
||||||
|
|
||||||
|
// Clean the response content to remove backticks or code block markers.
|
||||||
|
$cleanedContent = str_replace('```', '', $content); // Remove backticks if they exist.
|
||||||
|
|
||||||
|
// Trim any leading/trailing whitespace.
|
||||||
|
$cleanedContent = trim($cleanedContent);
|
||||||
|
|
||||||
|
// Return the cleaned response.
|
||||||
|
echo json_encode(['rewordedText' => $cleanedContent]);
|
||||||
|
} else {
|
||||||
|
// Handle errors or unexpected response structure.
|
||||||
|
echo json_encode(['rewordedText' => 'Failed to get a response from the AI API.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_GET['ai_create_document_template'])) {
|
||||||
|
// get_ai_document_template.php
|
||||||
|
|
||||||
|
header('Content-Type: text/html; charset=UTF-8');
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM ai_models LEFT JOIN ai_providers ON ai_model_ai_provider_id = ai_provider_id WHERE ai_model_use_case = 'General' LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$model_name = $row['ai_model_name'];
|
||||||
|
$url = $row['ai_provider_api_url'];
|
||||||
|
$key = $row['ai_provider_api_key'];
|
||||||
|
|
||||||
|
$prompt = $_POST['prompt'] ?? '';
|
||||||
|
|
||||||
|
// Basic validation
|
||||||
|
if(empty($prompt)){
|
||||||
|
echo "No prompt provided.";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepare prompt
|
||||||
|
$system_message = "You are a helpful IT documentation assistant. You will create a well-structured HTML template for IT documentation based on a given prompt. Include headings, subheadings, bullet points, and possibly tables for clarity. No Lorem Ipsum, use realistic placeholders and professional language.";
|
||||||
|
$user_message = "Create an HTML formatted IT documentation template based on the following request:\n\n\"$prompt\"\n\nThe template should be structured, professional, and useful for IT staff. Include relevant sections, instructions, prerequisites, and best practices.";
|
||||||
|
|
||||||
|
$post_data = [
|
||||||
|
"model" => "$model_name",
|
||||||
|
"messages" => [
|
||||||
|
["role" => "system", "content" => $system_message],
|
||||||
|
["role" => "user", "content" => $user_message]
|
||||||
|
],
|
||||||
|
"temperature" => 0.5
|
||||||
|
];
|
||||||
|
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||||
|
'Content-Type: application/json',
|
||||||
|
'Authorization: Bearer ' . $key
|
||||||
|
]);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_data));
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
if (curl_errno($ch)) {
|
||||||
|
echo "Error: " . curl_error($ch);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
$response_data = json_decode($response, true);
|
||||||
|
$template = $response_data['choices'][0]['message']['content'] ?? "<p>No content returned from AI.</p>";
|
||||||
|
|
||||||
|
// Print the generated HTML template directly
|
||||||
|
echo $template;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_GET['ai_ticket_summary'])) {
|
||||||
|
|
||||||
|
header('Content-Type: text/html; charset=UTF-8');
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM ai_models LEFT JOIN ai_providers ON ai_model_ai_provider_id = ai_provider_id WHERE ai_model_use_case = 'General' LIMIT 1");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql);
|
||||||
|
$model_name = $row['ai_model_name'];
|
||||||
|
$url = $row['ai_provider_api_url'];
|
||||||
|
$key = $row['ai_provider_api_key'];
|
||||||
|
|
||||||
|
// Retrieve the ticket_id from POST
|
||||||
|
$ticket_id = intval($_POST['ticket_id']);
|
||||||
|
|
||||||
|
// Query the database for ticket details
|
||||||
|
$sql = mysqli_query($mysqli, "
|
||||||
|
SELECT ticket_subject, ticket_details, ticket_source, ticket_priority, ticket_status_name, category_name
|
||||||
|
FROM tickets
|
||||||
|
LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
|
||||||
|
LEFT JOIN categories ON ticket_category = category_id
|
||||||
|
WHERE ticket_id = $ticket_id
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
$row = mysqli_fetch_assoc($sql);
|
||||||
|
$ticket_subject = $row['ticket_subject'];
|
||||||
|
$ticket_details = strip_tags($row['ticket_details']); // strip HTML for cleaner prompt
|
||||||
|
$ticket_status = $row['ticket_status_name'];
|
||||||
|
$ticket_category = $row['category_name'];
|
||||||
|
$ticket_source = $row['ticket_source'];
|
||||||
|
$ticket_priority = $row['ticket_priority'];
|
||||||
|
|
||||||
|
// Get ticket replies
|
||||||
|
$sql_replies = mysqli_query($mysqli, "
|
||||||
|
SELECT ticket_reply, ticket_reply_type, user_name
|
||||||
|
FROM ticket_replies
|
||||||
|
LEFT JOIN users ON ticket_reply_by = user_id
|
||||||
|
WHERE ticket_reply_ticket_id = $ticket_id
|
||||||
|
AND ticket_reply_archived_at IS NULL
|
||||||
|
ORDER BY ticket_reply_id ASC
|
||||||
|
");
|
||||||
|
|
||||||
|
$all_replies_text = "";
|
||||||
|
while ($reply = mysqli_fetch_assoc($sql_replies)) {
|
||||||
|
$reply_type = $reply['ticket_reply_type'];
|
||||||
|
$reply_text = strip_tags($reply['ticket_reply']);
|
||||||
|
$reply_by = $reply['user_name'];
|
||||||
|
$all_replies_text .= "\nReply Type: $reply_type Reply By: $reply_by: Reply Text: $reply_text";
|
||||||
|
}
|
||||||
|
|
||||||
|
$prompt = "
|
||||||
|
Summarize the following IT support ticket and its responses in a concise, clear, and professional manner.
|
||||||
|
The summary should include:
|
||||||
|
|
||||||
|
1. Main Issue: What was the problem reported by the user?
|
||||||
|
2. Actions Taken: What steps were taken to address the issue?
|
||||||
|
3. Resolution or Next Steps: Was the issue resolved or is it ongoing?
|
||||||
|
|
||||||
|
Please ensure:
|
||||||
|
- If there are multiple issues, summarize each separately.
|
||||||
|
- Urgency: If the ticket or replies express urgency or escalation, highlight it.
|
||||||
|
- Attachments: If mentioned in the ticket, note any relevant attachments or files.
|
||||||
|
- Avoid extra explanations or unnecessary information.
|
||||||
|
|
||||||
|
Ticket Data:
|
||||||
|
- Ticket Source: $ticket_source
|
||||||
|
- Current Ticket Status: $ticket_status
|
||||||
|
- Ticket Priority: $ticket_priority
|
||||||
|
- Ticket Category: $ticket_category
|
||||||
|
- Ticket Subject: $ticket_subject
|
||||||
|
- Ticket Details: $ticket_details
|
||||||
|
- Replies:
|
||||||
|
$all_replies_text
|
||||||
|
|
||||||
|
Formatting instructions:
|
||||||
|
- Use valid HTML tags only.
|
||||||
|
- Use <h3> for section headers (Main Issue, Actions Taken, Resolution).
|
||||||
|
- Use <ul><li> for bullet points under each section.
|
||||||
|
- Do NOT wrap the output in ```html or any other code fences.
|
||||||
|
- Do NOT include <html>, <head>, or <body>.
|
||||||
|
- Output only the summary content in pure HTML.
|
||||||
|
If any part of the ticket or replies is unclear or ambiguous, mention it in the summary and suggest if further clarification is needed.
|
||||||
|
";
|
||||||
|
|
||||||
|
// Prepare the POST data
|
||||||
|
$post_data = [
|
||||||
|
"model" => "$model_name",
|
||||||
|
"messages" => [
|
||||||
|
["role" => "system", "content" => "Your task is to summarize IT support tickets with clear, concise details."],
|
||||||
|
["role" => "user", "content" => $prompt]
|
||||||
|
],
|
||||||
|
"temperature" => 0.3
|
||||||
|
];
|
||||||
|
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||||
|
'Content-Type: application/json',
|
||||||
|
'Authorization: Bearer ' . $key
|
||||||
|
]);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_data));
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
if (curl_errno($ch)) {
|
||||||
|
echo "Error: " . curl_error($ch);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
$response_data = json_decode($response, true);
|
||||||
|
$summary = $response_data['choices'][0]['message']['content'] ?? "No summary available.";
|
||||||
|
|
||||||
|
|
||||||
|
echo $summary; // nl2br to convert newlines to <br>, htmlspecialchars to prevent XSS
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stops people trying to use sub-domains in the domains tracker
|
||||||
|
if (isset($_GET['apex_domain_check'])) {
|
||||||
|
enforceUserPermission('module_support', 2);
|
||||||
|
|
||||||
|
$domain = sanitizeInput($_GET['domain']);
|
||||||
|
|
||||||
|
$response['message'] = ""; // default
|
||||||
|
|
||||||
|
if (strlen($domain) >= 4) {
|
||||||
|
|
||||||
|
// SOA record check
|
||||||
|
// This isn't 100%, as sub-domains can have their own SOA but will capture 99%
|
||||||
|
if (!checkdnsrr($domain, 'SOA')) {
|
||||||
|
$response['message'] = "<i class='fas fa-fw fa-exclamation-triangle mr-2'></i> Domain name is invalid.";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($response);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get internal users/techs
|
||||||
|
if (isset($_GET['get_internal_users'])) {
|
||||||
|
enforceUserPermission('module_support');
|
||||||
|
|
||||||
|
$sql = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT user_id, user_name
|
||||||
|
FROM users
|
||||||
|
WHERE user_type = 1 AND user_status = 1 AND user_archived_at IS NULL
|
||||||
|
ORDER BY user_name"
|
||||||
|
);
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
|
$response['users'][] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($response);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
if (isset($_GET['client_id'])) {
|
if (isset($_GET['client_id'])) {
|
||||||
require_once "includes/inc_all_client.php";
|
require_once "includes/inc_all_client.php";
|
||||||
$client_query = "AND asset_client_id = $client_id";
|
$client_query = "AND asset_client_id = $client_id";
|
||||||
$client_url = "AND client_id=$client_id&";
|
$client_url = "client_id=$client_id&";
|
||||||
} else {
|
} else {
|
||||||
require_once "includes/inc_client_overview_all.php";
|
require_once "includes/inc_client_overview_all.php";
|
||||||
$client_query = '';
|
$client_query = '';
|
||||||
@@ -118,6 +118,28 @@ if (isset($_GET['asset_id'])) {
|
|||||||
);
|
);
|
||||||
$document_count = mysqli_num_rows($sql_related_documents);
|
$document_count = mysqli_num_rows($sql_related_documents);
|
||||||
|
|
||||||
|
// Tags - many to many relationship
|
||||||
|
$asset_tag_name_display_array = array();
|
||||||
|
$asset_tag_id_array = array();
|
||||||
|
$sql_asset_tags = mysqli_query($mysqli, "SELECT * FROM asset_tags LEFT JOIN tags ON asset_tag_tag_id = tag_id WHERE asset_tag_asset_id = $asset_id ORDER BY tag_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_asset_tags)) {
|
||||||
|
|
||||||
|
$asset_tag_id = intval($row['tag_id']);
|
||||||
|
$asset_tag_name = nullable_htmlentities($row['tag_name']);
|
||||||
|
$asset_tag_color = nullable_htmlentities($row['tag_color']);
|
||||||
|
if (empty($asset_tag_color)) {
|
||||||
|
$asset_tag_color = "dark";
|
||||||
|
}
|
||||||
|
$asset_tag_icon = nullable_htmlentities($row['tag_icon']);
|
||||||
|
if (empty($asset_tag_icon)) {
|
||||||
|
$asset_tag_icon = "tag";
|
||||||
|
}
|
||||||
|
|
||||||
|
$asset_tag_id_array[] = $asset_tag_id;
|
||||||
|
$asset_tag_name_display_array[] = "<a href='client_assets.php?client_id=$client_id&q=$asset_tag_name'><span class='badge text-light p-1 mr-1' style='background-color: $asset_tag_color;'><i class='fa fa-fw fa-$asset_tag_icon mr-2'></i>$asset_tag_name</span></a>";
|
||||||
|
}
|
||||||
|
$asset_tags_display = implode('', $asset_tag_name_display_array);
|
||||||
|
|
||||||
// Network Interfaces
|
// Network Interfaces
|
||||||
$sql_related_interfaces = mysqli_query($mysqli, "
|
$sql_related_interfaces = mysqli_query($mysqli, "
|
||||||
SELECT
|
SELECT
|
||||||
@@ -257,8 +279,13 @@ if (isset($_GET['asset_id'])) {
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
<?php if ($asset_tags_display) { ?>
|
||||||
|
<div>
|
||||||
|
<?= $asset_tags_display ?>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
<?php if ($asset_type) { ?>
|
<?php if ($asset_type) { ?>
|
||||||
<div><i class="fa fa-fw fa-tag text-secondary mr-3"></i><?= $asset_type; ?></div>
|
<div class="mt-1"><i class="fa fa-fw fa-tag text-secondary mr-3"></i><?= $asset_type; ?></div>
|
||||||
<?php }
|
<?php }
|
||||||
if ($asset_make) { ?>
|
if ($asset_make) { ?>
|
||||||
<div class="mt-2"><i class="fa fa-fw fa-circle text-secondary mr-3"></i><?= "$asset_make $asset_model"; ?></div>
|
<div class="mt-2"><i class="fa fa-fw fa-circle text-secondary mr-3"></i><?= "$asset_make $asset_model"; ?></div>
|
||||||
@@ -361,23 +388,23 @@ if (isset($_GET['asset_id'])) {
|
|||||||
<div class="dropdown dropleft mr-2">
|
<div class="dropdown dropleft mr-2">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="dropdown"><i class="fas fa-plus mr-2"></i>New</button>
|
<button type="button" class="btn btn-primary" data-toggle="dropdown"><i class="fas fa-plus mr-2"></i>New</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addTicketModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#" data-modal-url="modals/ticket/ticket_add.php?<?= $client_url ?>&asset_id=<?= $asset_id ?>" data-modal-size="lg">
|
||||||
<i class="fa fa-fw fa-life-ring mr-2"></i>New Ticket
|
<i class="fa fa-fw fa-life-ring mr-2"></i>New Ticket
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addRecurringTicketModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#" data-modal-url="modals/recurring_ticket/recurring_ticket_add.php?<?= $client_url ?>&asset_id=<?= $asset_id ?>" data-modal-size="lg">
|
||||||
<i class="fa fa-fw fa-recycle mr-2"></i>New Recurring Ticket
|
<i class="fa fa-fw fa-recycle mr-2"></i>New Recurring Ticket
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addCredentialModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#" data-modal-url="modals/credential/credential_add.php?<?= $client_url ?>asset_id=<?= $asset_id ?>">
|
||||||
<i class="fa fa-fw fa-key mr-2"></i>New Credential
|
<i class="fa fa-fw fa-key mr-2"></i>New Credential
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addDocumentModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#" data-modal-url="modals/document/document_add.php?<?= $client_url ?>&asset_id=<?= $asset_id ?>" data-modal-size="lg">
|
||||||
<i class="fa fa-fw fa-file-alt mr-2"></i>New Document
|
<i class="fa fa-fw fa-file-alt mr-2"></i>New Document
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#uploadFilesModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#" data-modal-url="modals/file/file_upload.php?<?= $client_url ?>&asset_id=<?= $asset_id ?>">
|
||||||
<i class="fa fa-fw fa-upload mr-2"></i>Upload file(s)
|
<i class="fa fa-fw fa-upload mr-2"></i>Upload file(s)
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -419,7 +446,7 @@ if (isset($_GET['asset_id'])) {
|
|||||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-ethernet mr-2"></i>Interfaces</h3>
|
<h3 class="card-title mt-2"><i class="fa fa-fw fa-ethernet mr-2"></i>Interfaces</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addAssetInterfaceModal">
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/asset/asset_interface_add.php?&asset_id=<?= $asset_id ?>">
|
||||||
<i class="fas fa-plus mr-2"></i>New Interface
|
<i class="fas fa-plus mr-2"></i>New Interface
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||||
@@ -442,11 +469,15 @@ if (isset($_GET['asset_id'])) {
|
|||||||
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>)
|
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>)
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#bulkAssignNetworkModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/asset/asset_interface_bulk_edit_network.php?client_id=<?= $client_id ?>"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-network-wired mr-2"></i>Assign Network
|
<i class="fas fa-fw fa-network-wired mr-2"></i>Assign Network
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#bulkSetInterfaceTypeModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/asset/asset_interface_bulk_edit_type.php?client_id=<?= $client_id ?>"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-ethernet mr-2"></i>Set Type
|
<i class="fas fa-fw fa-ethernet mr-2"></i>Set Type
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
@@ -570,8 +601,6 @@ if (isset($_GET['asset_id'])) {
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?php require_once "modals/asset/asset_interface_bulk_edit_type.php"; ?>
|
|
||||||
<?php require_once "modals/asset/asset_interface_bulk_edit_network.php"; ?>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1220,16 +1249,9 @@ if (isset($_GET['asset_id'])) {
|
|||||||
<script src="../js/bulk_actions.js"></script>
|
<script src="../js/bulk_actions.js"></script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "modals/asset/asset_interface_add.php";
|
|
||||||
require_once "modals/asset/asset_interface_multiple_add.php";
|
require_once "modals/asset/asset_interface_multiple_add.php";
|
||||||
require_once "modals/asset/asset_interface_import.php";
|
require_once "modals/asset/asset_interface_import.php";
|
||||||
require_once "modals/asset/asset_interface_export.php";
|
require_once "modals/asset/asset_interface_export.php";
|
||||||
require_once "modals/ticket/ticket_add.php";
|
|
||||||
require_once "modals/recurring_ticket/recurring_ticket_add.php";
|
|
||||||
require_once "modals/credential/credential_add.php";
|
|
||||||
require_once "modals/document/document_add.php";
|
|
||||||
require_once "modals/file/file_upload.php";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
145
agent/assets.php
145
agent/assets.php
@@ -78,6 +78,18 @@ if ($client_url && isset($_GET['location']) && !empty($_GET['location'])) {
|
|||||||
$location_filter = 0;
|
$location_filter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tags Filter
|
||||||
|
if (isset($_GET['tags']) && is_array($_GET['tags']) && !empty($_GET['tags'])) {
|
||||||
|
// Sanitize each element of the tags array
|
||||||
|
$sanitizedTags = array_map('intval', $_GET['tags']);
|
||||||
|
// Convert the sanitized tags into a comma-separated string
|
||||||
|
$tag_filter = implode(",", $sanitizedTags);
|
||||||
|
$tag_query = "AND tag_id IN ($tag_filter)";
|
||||||
|
} else {
|
||||||
|
$tag_filter = 0;
|
||||||
|
$tag_query = '';
|
||||||
|
}
|
||||||
|
|
||||||
//Get Asset Counts
|
//Get Asset Counts
|
||||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "
|
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "
|
||||||
SELECT
|
SELECT
|
||||||
@@ -93,9 +105,13 @@ $row = mysqli_fetch_assoc(mysqli_query($mysqli, "
|
|||||||
LEFT JOIN contacts ON asset_contact_id = contact_id
|
LEFT JOIN contacts ON asset_contact_id = contact_id
|
||||||
LEFT JOIN locations ON asset_location_id = location_id
|
LEFT JOIN locations ON asset_location_id = location_id
|
||||||
LEFT JOIN asset_interfaces ON interface_asset_id = asset_id AND interface_primary = 1
|
LEFT JOIN asset_interfaces ON interface_asset_id = asset_id AND interface_primary = 1
|
||||||
|
LEFT JOIN asset_tags ON asset_tag_asset_id = asset_id
|
||||||
|
LEFT JOIN tags ON tag_id = asset_tag_tag_id
|
||||||
WHERE $archive_query
|
WHERE $archive_query
|
||||||
|
$tag_query
|
||||||
$access_permission_query
|
$access_permission_query
|
||||||
$client_query
|
$client_query
|
||||||
|
GROUP BY asset_id
|
||||||
) AS filtered_assets;
|
) AS filtered_assets;
|
||||||
"));
|
"));
|
||||||
|
|
||||||
@@ -117,9 +133,6 @@ $network_count = intval($row['network_count']);
|
|||||||
//Other Count
|
//Other Count
|
||||||
$other_count = intval($row['other_count']);
|
$other_count = intval($row['other_count']);
|
||||||
|
|
||||||
//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 assets
|
"SELECT SQL_CALC_FOUND_ROWS * FROM assets
|
||||||
@@ -127,13 +140,16 @@ $sql = mysqli_query(
|
|||||||
LEFT JOIN contacts ON asset_contact_id = contact_id
|
LEFT JOIN contacts ON asset_contact_id = contact_id
|
||||||
LEFT JOIN locations ON asset_location_id = location_id
|
LEFT JOIN locations ON asset_location_id = location_id
|
||||||
LEFT JOIN asset_interfaces ON interface_asset_id = asset_id AND interface_primary = 1
|
LEFT JOIN asset_interfaces ON interface_asset_id = asset_id AND interface_primary = 1
|
||||||
|
LEFT JOIN asset_tags ON asset_tag_asset_id = asset_id
|
||||||
|
LEFT JOIN tags ON tag_id = asset_tag_tag_id
|
||||||
WHERE $archive_query
|
WHERE $archive_query
|
||||||
AND (asset_name LIKE '%$q%' OR asset_description LIKE '%$q%' OR asset_type LIKE '%$q%' OR interface_ip LIKE '%$q%' OR interface_ipv6 LIKE '%$q%' OR interface_mac LIKE '%$q%' OR asset_make LIKE '%$q%' OR asset_model LIKE '%$q%' OR asset_serial LIKE '%$q%' OR asset_os LIKE '%$q%' OR contact_name LIKE '%$q%' OR location_name LIKE '%$q%' OR client_name LIKE '%$q%')
|
$tag_query
|
||||||
|
AND (asset_name LIKE '%$q%' OR asset_description LIKE '%$q%' OR asset_type LIKE '%$q%' OR interface_ip LIKE '%$q%' OR interface_ipv6 LIKE '%$q%' OR interface_mac LIKE '%$q%' OR asset_make LIKE '%$q%' OR asset_model LIKE '%$q%' OR asset_serial LIKE '%$q%' OR asset_os LIKE '%$q%' OR contact_name LIKE '%$q%' OR location_name LIKE '%$q%' OR client_name LIKE '%$q%' OR tag_name LIKE '%$q%')
|
||||||
AND ($type_query)
|
AND ($type_query)
|
||||||
$access_permission_query
|
$access_permission_query
|
||||||
$location_query
|
$location_query
|
||||||
$client_query
|
$client_query
|
||||||
|
GROUP BY asset_id
|
||||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -184,14 +200,16 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<?php if ($client_url) { ?>
|
<?php if ($client_url) { ?>
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#importAssetModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/asset/asset_import.php?<?= $client_url ?>">
|
||||||
<i class="fa fa-fw fa-upload mr-2"></i>Import
|
<i class="fa fa-fw fa-upload mr-2"></i>Import
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if ($num_rows[0] > 0) { ?>
|
<?php if ($num_rows[0] > 0) { ?>
|
||||||
|
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportAssetModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/asset/asset_export.php?<?= $client_url ?>">
|
||||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||||
</a>
|
</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@@ -270,7 +288,32 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<div class="col-md-3">
|
<div class="col-md-2">
|
||||||
|
<div class="input-group mb-3 mb-md-0">
|
||||||
|
<select onchange="this.form.submit()" class="form-control select2" name="tags[]" data-placeholder="- Select Tags -" multiple>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$sql_tags_filter = mysqli_query($mysqli, "
|
||||||
|
SELECT tag_id, tag_name
|
||||||
|
FROM tags
|
||||||
|
LEFT JOIN asset_tags ON asset_tag_tag_id = tag_id
|
||||||
|
LEFT JOIN assets ON asset_tag_asset_id = asset_id
|
||||||
|
WHERE tag_type = 5
|
||||||
|
$client_query OR tag_id IN ($tag_filter)
|
||||||
|
GROUP BY tag_id
|
||||||
|
HAVING COUNT(asset_tag_asset_id) > 0 OR tag_id IN ($tag_filter)
|
||||||
|
");
|
||||||
|
while ($row = mysqli_fetch_array($sql_tags_filter)) {
|
||||||
|
$tag_id = intval($row['tag_id']);
|
||||||
|
$tag_name = nullable_htmlentities($row['tag_name']); ?>
|
||||||
|
|
||||||
|
<option value="<?php echo $tag_id ?>" <?php if (isset($_GET['tags']) && in_array($tag_id, $_GET['tags'])) { echo 'selected'; } ?>> <?php echo $tag_name ?> </option>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<select onchange="this.form.submit()" class="form-control select2" name="show_column[]" data-placeholder="- Show Additional Columns -" multiple>
|
<select onchange="this.form.submit()" class="form-control select2" name="show_column[]" data-placeholder="- Show Additional Columns -" multiple>
|
||||||
<option
|
<option
|
||||||
@@ -291,7 +334,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-2">
|
||||||
<div class="btn-group float-right">
|
<div class="btn-group float-right">
|
||||||
<a href="?<?php echo $client_url; ?>&archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>"
|
<a href="?<?php echo $client_url; ?>&archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>"
|
||||||
class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"; } ?>">
|
class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"; } ?>">
|
||||||
@@ -303,27 +346,47 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<?php if ($client_url) { ?>
|
<?php if ($client_url) { ?>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkAssignContactModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/asset/asset_bulk_assign_contact.php?<?= $client_url ?>"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-user mr-2"></i>Assign Contact
|
<i class="fas fa-fw fa-user mr-2"></i>Assign Contact
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkAssignLocationModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/asset/asset_bulk_assign_location.php?<?= $client_url ?>"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-map-marker-alt mr-2"></i>Assign Location
|
<i class="fas fa-fw fa-map-marker-alt mr-2"></i>Assign Location
|
||||||
</a>
|
</a>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkAssignPhysicalLocationModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/asset/asset_bulk_assign_tags.php"
|
||||||
|
data-bulk="true">
|
||||||
|
<i class="fas fa-fw fa-tags mr-2"></i>Assign Tags
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/asset/asset_bulk_assign_physical_location.php"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-map-marker-alt mr-2"></i>Set Physical Location
|
<i class="fas fa-fw fa-map-marker-alt mr-2"></i>Set Physical Location
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkEditStatusModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/asset/asset_bulk_edit_status.php"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-info mr-2"></i>Set Status
|
<i class="fas fa-fw fa-info mr-2"></i>Set Status
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkAddTicketModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/asset/asset_bulk_add_ticket.php"
|
||||||
|
data-modal-size="lg"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-life-ring mr-2"></i>Create Tickets
|
<i class="fas fa-fw fa-life-ring mr-2"></i>Create Tickets
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkTransferAssetClientModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/asset/asset_bulk_transfer_client.php?<?= $client_url ?>"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-arrow-right mr-2"></i>Transfer to Client
|
<i class="fas fa-fw fa-arrow-right mr-2"></i>Transfer to Client
|
||||||
</a>
|
</a>
|
||||||
<?php if ($archived) { ?>
|
<?php if ($archived) { ?>
|
||||||
@@ -563,20 +626,48 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$sql_credentials = mysqli_query($mysqli, "SELECT * FROM credentials WHERE credential_asset_id = $asset_id");
|
$sql_credentials = mysqli_query($mysqli, "SELECT * FROM credentials WHERE credential_asset_id = $asset_id");
|
||||||
$credential_count = mysqli_num_rows($sql_credentials);
|
$credential_count = mysqli_num_rows($sql_credentials);
|
||||||
|
|
||||||
|
// Tags
|
||||||
|
$asset_tag_name_display_array = array();
|
||||||
|
$asset_tag_id_array = array();
|
||||||
|
$sql_asset_tags = mysqli_query($mysqli, "SELECT * FROM asset_tags LEFT JOIN tags ON asset_tag_tag_id = tag_id WHERE asset_tag_asset_id = $asset_id ORDER BY tag_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_asset_tags)) {
|
||||||
|
|
||||||
|
$asset_tag_id = intval($row['tag_id']);
|
||||||
|
$asset_tag_name = nullable_htmlentities($row['tag_name']);
|
||||||
|
$asset_tag_color = nullable_htmlentities($row['tag_color']);
|
||||||
|
if (empty($asset_tag_color)) {
|
||||||
|
$asset_tag_color = "dark";
|
||||||
|
}
|
||||||
|
$asset_tag_icon = nullable_htmlentities($row['tag_icon']);
|
||||||
|
if (empty($asset_tag_icon)) {
|
||||||
|
$asset_tag_icon = "tag";
|
||||||
|
}
|
||||||
|
|
||||||
|
$asset_tag_id_array[] = $asset_tag_id;
|
||||||
|
$asset_tag_name_display_array[] = "<a href='assets.php?$client_url tags[]=$asset_tag_id'><span class='badge text-light p-1 mr-1' style='background-color: $asset_tag_color;'><i class='fa fa-fw fa-$asset_tag_icon mr-2'></i>$asset_tag_name</span></a>";
|
||||||
|
}
|
||||||
|
$asset_tags_display = implode('', $asset_tag_name_display_array);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="pr-0 bg-light">
|
<td class="pr-0 bg-light">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input bulk-select" type="checkbox" name="asset_ids[]" value="<?php echo $asset_id ?>">
|
<input class="form-check-input bulk-select" type="checkbox" name="asset_ids[]" value="<?= $asset_id ?>">
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a class="text-dark" href="asset_details.php?client_id=<?php echo $client_id; ?>&asset_id=<?php echo $asset_id; ?>">
|
<a class="text-dark" href="asset_details.php?client_id=<?= $client_id ?>&asset_id=<?= $asset_id ?>">
|
||||||
<div class="media">
|
<div class="media">
|
||||||
<i class="fa fa-fw fa-2x fa-<?php echo $device_icon; ?> mr-3 mt-1"></i>
|
<i class="fa fa-fw fa-2x fa-<?= $device_icon ?> mr-3 mt-1"></i>
|
||||||
<div class="media-body">
|
<div class="media-body">
|
||||||
<div><?php echo $asset_name; ?></div>
|
<div><?= $asset_name ?></div>
|
||||||
<div><small class="text-secondary"><?php echo $asset_description; ?></small></div>
|
<div><small class="text-secondary"><?= $asset_description ?></small></div>
|
||||||
|
<?php
|
||||||
|
if ($asset_tags_display) { ?>
|
||||||
|
<div class="mt-1">
|
||||||
|
<?= $asset_tags_display ?>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
@@ -692,16 +783,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
|
||||||
if ($client_url) {
|
|
||||||
require_once "modals/asset/asset_bulk_assign_contact.php";
|
|
||||||
require_once "modals/asset/asset_bulk_assign_location.php";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<?php require_once "modals/asset/asset_bulk_assign_physical_location.php"; ?>
|
|
||||||
<?php require_once "modals/asset/asset_bulk_transfer_client.php"; ?>
|
|
||||||
<?php require_once "modals/asset/asset_bulk_edit_status.php"; ?>
|
|
||||||
<?php require_once "modals/asset/asset_bulk_add_ticket.php"; ?>
|
|
||||||
</form>
|
</form>
|
||||||
<?php require_once "../includes/filter_footer.php"; ?>
|
<?php require_once "../includes/filter_footer.php"; ?>
|
||||||
</div>
|
</div>
|
||||||
@@ -710,8 +791,4 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<script src="../js/bulk_actions.js"></script>
|
<script src="../js/bulk_actions.js"></script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/asset/asset_export.php";
|
|
||||||
if ($client_url) {
|
|
||||||
require_once "modals/asset/asset_import.php";
|
|
||||||
}
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -1,72 +0,0 @@
|
|||||||
<?php require_once "includes/inc_all.php"; ?>
|
|
||||||
|
|
||||||
<!-- Breadcrumbs-->
|
|
||||||
<ol class="breadcrumb">
|
|
||||||
<li class="breadcrumb-item">
|
|
||||||
<a href="index.html">Dashboard</a>
|
|
||||||
</li>
|
|
||||||
<li class="breadcrumb-item active">Blank Page</li>
|
|
||||||
</ol>
|
|
||||||
|
|
||||||
<!-- Page Content -->
|
|
||||||
<h1>Blank Page</h1>
|
|
||||||
<hr>
|
|
||||||
<p>This is a great starting point for new custom pages.</p>
|
|
||||||
<h1><?php echo $session_user_role; ?></h1>
|
|
||||||
<?php validateAdminRole(); ?>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$start_date = date('Y') . "-10-10";
|
|
||||||
|
|
||||||
echo "<H1>$start_date</H1>";
|
|
||||||
|
|
||||||
echo "<H2>User Agent</H2>";
|
|
||||||
echo getUserAgent();
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<input type="tel" name="phone" id="phone">
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Minimal</label>
|
|
||||||
<select class="form-control select2 select2-hidden-accessible" style="width: 100%;" data-select2-id="1" tabindex="-1" aria-hidden="true">
|
|
||||||
<option selected="selected" data-select2-id="3">Alabama</option>
|
|
||||||
<option data-select2-id="35">Alaska</option>
|
|
||||||
<option data-select2-id="36">California</option>
|
|
||||||
<option data-select2-id="37">Delaware</option>
|
|
||||||
<option data-select2-id="38">Tennessee</option>
|
|
||||||
<option data-select2-id="39">Texas</option>
|
|
||||||
<option data-select2-id="40">Washington</option>
|
|
||||||
</select><span class="select2 select2-container select2-container--default select2-container--below" dir="ltr" data-select2-id="2" style="width: 100%;"><span class="selection"><span class="select2-selection select2-selection--single" role="combobox" aria-haspopup="true" aria-expanded="false" tabindex="0" aria-disabled="false" aria-labelledby="select2-nbex-container"><span class="select2-selection__rendered" id="select2-nbex-container" role="textbox" aria-readonly="true" title="Alabama">Alabama</span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span></span></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<dl>
|
|
||||||
<dt>Requester</dt>
|
|
||||||
<dd>Sam Adams</dd>
|
|
||||||
|
|
||||||
<dt>Created</dt>
|
|
||||||
<dd><time datetime="2024-04-11T17:52:30+00:00" title="2024-04-11 13:52" data-datetime="calendar">Today at 13:52</time></dd>
|
|
||||||
|
|
||||||
<dt>Last activity</dt>
|
|
||||||
<dd><time datetime="2024-04-11T18:08:55+00:00" title="2024-04-11 14:08" data-datetime="calendar">Today at 14:08</time></dd>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
<?php echo randomString(100); ?>
|
|
||||||
<br>
|
|
||||||
<textarea class="tinymceTest"></textarea>
|
|
||||||
|
|
||||||
<textarea class="tinymce"></textarea>
|
|
||||||
|
|
||||||
<textarea class="tinymceTicket"></textarea>
|
|
||||||
<?php
|
|
||||||
// show the current Date and Time
|
|
||||||
$date_time = date('Y-m-d H:i:s');
|
|
||||||
echo "Current Date and Time: <strong>$date_time</strong>";
|
|
||||||
?>
|
|
||||||
|
|
||||||
<script>toastr.success('Have Fun Wozz!!')</script>
|
|
||||||
|
|
||||||
<?php require_once "../includes/footer.php";
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ if (isset($_GET['calendar_id'])) {
|
|||||||
<div class="card-header py-2">
|
<div class="card-header py-2">
|
||||||
<h3 class="card-title mt-1">Calendars</h3>
|
<h3 class="card-title mt-1">Calendars</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="button" class="btn btn-dark btn-sm" data-toggle="modal" data-target="#addCalendarModal"><i class="fas fa-plus"></i></button>
|
<button type="button" class="btn btn-dark btn-sm ajax-modal" data-modal-url="modals/calendar/calendar_add.php"><i class="fas fa-plus"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@@ -82,8 +82,6 @@ if (isset($_GET['calendar_id'])) {
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "modals/calendar/calendar_event_add.php";
|
require_once "modals/calendar/calendar_event_add.php";
|
||||||
require_once "modals/calendar/calendar_add.php";
|
|
||||||
|
|
||||||
|
|
||||||
//loop through IDs and create a modal for each
|
//loop through IDs and create a modal for each
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM calendar_events LEFT JOIN calendars ON event_calendar_id = calendar_id $client_event_query");
|
$sql = mysqli_query($mysqli, "SELECT * FROM calendar_events LEFT JOIN calendars ON event_calendar_id = calendar_id $client_event_query");
|
||||||
|
|||||||
@@ -64,11 +64,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-lock mr-2"></i>Certificates</h3>
|
<h3 class="card-title mt-2"><i class="fas fa-fw fa-lock mr-2"></i>Certificates</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addCertificateModal"><i class="fas fa-plus mr-2"></i>New Certificate</button>
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/certificate/certificate_add.php?<?= $client_url ?>"><i class="fas fa-plus mr-2"></i>New Certificate</button>
|
||||||
<?php if ($num_rows[0] > 0) { ?>
|
<?php if ($num_rows[0] > 0) { ?>
|
||||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportCertificateModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"\
|
||||||
|
data-modal-url="modals/certificate/certificate_export.php?<?= $client_url ?>">
|
||||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -249,8 +250,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<td><?php echo $certificate_issued_by; ?></td>
|
<td><?php echo $certificate_issued_by; ?></td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<div><?php echo $certificate_expire; ?></div>
|
<div><?php echo $certificate_expire ?: '-'; ?></div>
|
||||||
|
<?php if (!empty($certificate_expire)) { ?>
|
||||||
<div><small><?php echo $certificate_expire_ago; ?></small></div>
|
<div><small><?php echo $certificate_expire_ago; ?></small></div>
|
||||||
|
<?php } ?>
|
||||||
</td>
|
</td>
|
||||||
<?php if (!$client_url) { ?>
|
<?php if (!$client_url) { ?>
|
||||||
<td><a href="certificates.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a></td>
|
<td><a href="certificates.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a></td>
|
||||||
@@ -297,17 +300,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<?php require_once "../includes/filter_footer.php";
|
<?php require_once "../includes/filter_footer.php"; ?>
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
|
||||||
require_once "modals/certificate/certificate_add.php";
|
|
||||||
require_once "modals/certificate/certificate_export.php";
|
|
||||||
?>
|
|
||||||
|
|
||||||
<script src="../js/bulk_actions.js"></script>
|
<script src="../js/bulk_actions.js"></script>
|
||||||
<script src="js/certificate_fetch_ssl.js"></script>
|
|
||||||
|
|
||||||
<?php require_once "../includes/footer.php";
|
<?php require_once "../includes/footer.php";
|
||||||
@@ -92,11 +92,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#importClientModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/client/client_import.php">
|
||||||
<i class="fa fa-fw fa-upload mr-2"></i>Import
|
<i class="fa fa-fw fa-upload mr-2"></i>Import
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportClientModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/client/client_export.php">
|
||||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -137,27 +139,41 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<i class="fas fa-fw fa-layer-group"></i><span class="d-none d-sm-inline ml-2">Action</span> (<span id="selectedCount">0</span>)
|
<i class="fas fa-fw fa-layer-group"></i><span class="d-none d-sm-inline ml-2">Action</span> (<span id="selectedCount">0</span>)
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkAddTicketModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/client/client_bulk_add_ticket.php"
|
||||||
|
data-modal-size="lg"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-life-ring mr-2"></i>Open Tickets
|
<i class="fas fa-fw fa-life-ring mr-2"></i>Open Tickets
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkEditHourlyRateModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/client/client_bulk_edit_hourly_rate.php"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-clock mr-2"></i>Set Hourly Rate
|
<i class="fas fa-fw fa-clock mr-2"></i>Set Hourly Rate
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkEditIndustryModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/client/client_bulk_edit_industry.php"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-briefcase mr-2"></i>Set Industry
|
<i class="fas fa-fw fa-briefcase mr-2"></i>Set Industry
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkEditReferralModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/client/client_bulk_edit_referral.php"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-link mr-2"></i>Set Referral
|
<i class="fas fa-fw fa-link mr-2"></i>Set Referral
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkAssignTagsModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/client/client_bulk_assign_tags.php"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-tags mr-2"></i>Assign Tags
|
<i class="fas fa-fw fa-tags mr-2"></i>Assign Tags
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkSendEmailModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/client/client_bulk_email.php"
|
||||||
|
data-modal-size="lg"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-paper-plane mr-2"></i>Send Email
|
<i class="fas fa-fw fa-paper-plane mr-2"></i>Send Email
|
||||||
</a>
|
</a>
|
||||||
<?php if ($archived) { ?>
|
<?php if ($archived) { ?>
|
||||||
@@ -268,9 +284,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form id="bulkActions" action="post.php" method="post" enctype="multipart/form-data">
|
<form id="bulkActions" 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="table-responsive-sm">
|
<div class="table-responsive">
|
||||||
<table class="table table-hover mb-0 text-nowrap">
|
<table class="table table-hover mb-0 text-nowrap">
|
||||||
<thead class="<?php if ($num_rows[0] == 0) { echo "d-none"; } ?> bg-light">
|
<thead class="<?php if ($num_rows[0] == 0) { echo "d-none"; } ?> bg-light">
|
||||||
<tr>
|
<tr>
|
||||||
@@ -600,14 +616,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
|
||||||
require_once "modals/client/client_bulk_edit_industry.php";
|
|
||||||
require_once "modals/client/client_bulk_edit_referral.php";
|
|
||||||
require_once "modals/client/client_bulk_edit_hourly_rate.php";
|
|
||||||
require_once "modals/client/client_bulk_assign_tags.php";
|
|
||||||
require_once "modals/client/client_bulk_add_ticket.php";
|
|
||||||
require_once "modals/client/client_bulk_email.php";
|
|
||||||
?>
|
|
||||||
</form>
|
</form>
|
||||||
<!-- Ends Card Body -->
|
<!-- Ends Card Body -->
|
||||||
<?php require_once "../includes/filter_footer.php"; ?>
|
<?php require_once "../includes/filter_footer.php"; ?>
|
||||||
@@ -617,6 +625,4 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<script src="../js/bulk_actions.js"></script>
|
<script src="../js/bulk_actions.js"></script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/client/client_import.php";
|
|
||||||
require_once "modals/client/client_export.php";
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -20,8 +20,15 @@ if (isset($_GET['contact_id'])) {
|
|||||||
LEFT JOIN users ON user_id = contact_user_id
|
LEFT JOIN users ON user_id = contact_user_id
|
||||||
WHERE contact_id = $contact_id
|
WHERE contact_id = $contact_id
|
||||||
$client_query
|
$client_query
|
||||||
|
LIMIT 1
|
||||||
");
|
");
|
||||||
|
|
||||||
|
if (mysqli_num_rows($sql) == 0) {
|
||||||
|
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='javascript:history.back()'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>";
|
||||||
|
require_once "../includes/footer.php";
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_array($sql);
|
||||||
$client_id = intval($row['client_id']);
|
$client_id = intval($row['client_id']);
|
||||||
$client_name = nullable_htmlentities($row['client_name']);
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
@@ -57,7 +64,14 @@ if (isset($_GET['contact_id'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Related Assets Query - 1 to 1 relationship
|
// 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");
|
$sql_related_assets = mysqli_query($mysqli, "SELECT * FROM assets
|
||||||
|
LEFT JOIN asset_interfaces ON interface_asset_id = asset_id AND interface_primary = 1
|
||||||
|
LEFT JOIN asset_tags ON asset_tag_asset_id = asset_id
|
||||||
|
LEFT JOIN tags ON tag_id = asset_tag_tag_id
|
||||||
|
WHERE asset_contact_id = $contact_id
|
||||||
|
GROUP BY asset_id
|
||||||
|
ORDER BY asset_name ASC"
|
||||||
|
);
|
||||||
$asset_count = mysqli_num_rows($sql_related_assets);
|
$asset_count = mysqli_num_rows($sql_related_assets);
|
||||||
|
|
||||||
// Linked Software Licenses
|
// Linked Software Licenses
|
||||||
@@ -83,7 +97,7 @@ if (isset($_GET['contact_id'])) {
|
|||||||
LEFT JOIN tags ON tags.tag_id = credential_tags.tag_id
|
LEFT JOIN tags ON tags.tag_id = credential_tags.tag_id
|
||||||
WHERE credential_contact_id = $contact_id
|
WHERE credential_contact_id = $contact_id
|
||||||
GROUP BY credentials.credential_id
|
GROUP BY credentials.credential_id
|
||||||
ORDER BY credential_name DESC
|
ORDER BY credential_name ASC
|
||||||
");
|
");
|
||||||
$credential_count = mysqli_num_rows($sql_related_credentials);
|
$credential_count = mysqli_num_rows($sql_related_credentials);
|
||||||
|
|
||||||
@@ -255,11 +269,11 @@ if (isset($_GET['contact_id'])) {
|
|||||||
<div class="dropdown dropleft mr-2">
|
<div class="dropdown dropleft mr-2">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="dropdown"><i class="fas fa-plus mr-2"></i>New</button>
|
<button type="button" class="btn btn-primary" data-toggle="dropdown"><i class="fas fa-plus mr-2"></i>New</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addTicketModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#" data-modal-url="modals/ticket/ticket_add.php?<?= $client_url ?>&contact_id=<?= $contact_id ?>" data-modal-size="lg">
|
||||||
<i class="fa fa-fw fa-life-ring mr-2"></i>New Ticket
|
<i class="fa fa-fw fa-life-ring mr-2"></i>New Ticket
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addRecurringTicketModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#" data-modal-url="modals/recurring_ticket/recurring_ticket_add.php?<?= $client_url ?>&contact_id=<?= $contact_id ?>" data-modal-size="lg">
|
||||||
<i class="fa fa-fw fa-recycle mr-2"></i>New Recurring Ticket
|
<i class="fa fa-fw fa-recycle mr-2"></i>New Recurring Ticket
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
@@ -267,15 +281,15 @@ if (isset($_GET['contact_id'])) {
|
|||||||
<i class="fa fa-fw fa-desktop mr-2"></i>New Asset
|
<i class="fa fa-fw fa-desktop mr-2"></i>New Asset
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addCredentialModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#" data-modal-url="modals/credential/credential_add.php?<?= $client_url ?>&contact_id=<?= $contact_id ?>">
|
||||||
<i class="fa fa-fw fa-key mr-2"></i>New Credential
|
<i class="fa fa-fw fa-key mr-2"></i>New Credential
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addDocumentModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#" data-modal-url="modals/document/document_add.php?<?= $client_url ?>&contact_id=<?= $contact_id ?>" data-modal-size="lg">
|
||||||
<i class="fa fa-fw fa-file-alt mr-2"></i>New Document
|
<i class="fa fa-fw fa-file-alt mr-2"></i>New Document
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#uploadFilesModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#" data-modal-url="modals/file/file_upload.php?<?= $client_url ?>&contact_id=<?= $contact_id ?>">
|
||||||
<i class="fa fa-fw fa-upload mr-2"></i>Upload file(s)
|
<i class="fa fa-fw fa-upload mr-2"></i>Upload file(s)
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
@@ -394,6 +408,28 @@ if (isset($_GET['contact_id'])) {
|
|||||||
$asset_created_at = nullable_htmlentities($row['asset_created_at']);
|
$asset_created_at = nullable_htmlentities($row['asset_created_at']);
|
||||||
$device_icon = getAssetIcon($asset_type);
|
$device_icon = getAssetIcon($asset_type);
|
||||||
|
|
||||||
|
// Tags
|
||||||
|
$asset_tag_name_display_array = array();
|
||||||
|
$asset_tag_id_array = array();
|
||||||
|
$sql_asset_tags = mysqli_query($mysqli, "SELECT * FROM asset_tags LEFT JOIN tags ON asset_tag_tag_id = tag_id WHERE asset_tag_asset_id = $asset_id ORDER BY tag_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_asset_tags)) {
|
||||||
|
|
||||||
|
$asset_tag_id = intval($row['tag_id']);
|
||||||
|
$asset_tag_name = nullable_htmlentities($row['tag_name']);
|
||||||
|
$asset_tag_color = nullable_htmlentities($row['tag_color']);
|
||||||
|
if (empty($asset_tag_color)) {
|
||||||
|
$asset_tag_color = "dark";
|
||||||
|
}
|
||||||
|
$asset_tag_icon = nullable_htmlentities($row['tag_icon']);
|
||||||
|
if (empty($asset_tag_icon)) {
|
||||||
|
$asset_tag_icon = "tag";
|
||||||
|
}
|
||||||
|
|
||||||
|
$asset_tag_id_array[] = $asset_tag_id;
|
||||||
|
$asset_tag_name_display_array[] = "<a href='assets.php?$client_url tags[]=$asset_tag_id'><span class='badge text-light p-1 mr-1' style='background-color: $asset_tag_color;'><i class='fa fa-fw fa-$asset_tag_icon mr-2'></i>$asset_tag_name</span></a>";
|
||||||
|
}
|
||||||
|
$asset_tags_display = implode('', $asset_tag_name_display_array);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
@@ -406,6 +442,12 @@ if (isset($_GET['contact_id'])) {
|
|||||||
<div class="mt-0">
|
<div class="mt-0">
|
||||||
<small class="text-muted"><?php echo $asset_description; ?></small>
|
<small class="text-muted"><?php echo $asset_description; ?></small>
|
||||||
</div>
|
</div>
|
||||||
|
<?php
|
||||||
|
if ($asset_tags_display) { ?>
|
||||||
|
<div class="mt-1">
|
||||||
|
<?= $asset_tags_display ?>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
</th>
|
</th>
|
||||||
<td><?php echo $asset_type; ?></td>
|
<td><?php echo $asset_type; ?></td>
|
||||||
<td>
|
<td>
|
||||||
@@ -755,7 +797,9 @@ if (isset($_GET['contact_id'])) {
|
|||||||
<div class="card-header py-2">
|
<div class="card-header py-2">
|
||||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-life-ring mr-2"></i>Related Tickets</h3>
|
<h3 class="card-title mt-2"><i class="fa fa-fw fa-life-ring mr-2"></i>Related Tickets</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addTicketModal">
|
<button type="button" class="btn btn-primary ajax-modal"
|
||||||
|
data-modal-url="modals/ticket/ticket_add.php?<?= $client_url ?>&contact_id=<?= $contact_id ?>"
|
||||||
|
data-modal-size="lg">
|
||||||
<i class="fas fa-plus mr-2"></i>New Ticket
|
<i class="fas fa-plus mr-2"></i>New Ticket
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -1172,11 +1216,4 @@ if (isset($_GET['contact_id'])) {
|
|||||||
<script src="js/credential_show_otp_via_id.js"></script>
|
<script src="js/credential_show_otp_via_id.js"></script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "modals/ticket/ticket_add.php";
|
|
||||||
require_once "modals/recurring_ticket/recurring_ticket_add.php";
|
|
||||||
require_once "modals/credential/credential_add.php";
|
|
||||||
require_once "modals/document/document_add.php";
|
|
||||||
require_once "modals/file/file_upload.php";
|
|
||||||
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -98,12 +98,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<?php if ($client_url) { ?>
|
<?php if ($client_url) { ?>
|
||||||
<!-- <a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#contactInviteModal"><i class="fas fa-fw fa-paper-plane mr-2"></i>Invite</a>-->
|
<!-- <a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#contactInviteModal"><i class="fas fa-fw fa-paper-plane mr-2"></i>Invite</a>-->
|
||||||
<!-- <div class="dropdown-divider"></div>-->
|
<!-- <div class="dropdown-divider"></div>-->
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#importContactModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/contact/contact_import.php?<?= $client_url ?>">
|
||||||
<i class="fa fa-fw fa-upload mr-2"></i>Import
|
<i class="fa fa-fw fa-upload mr-2"></i>Import
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportContactModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/contact/contact_export.php?<?= $client_url ?>">
|
||||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -220,28 +222,41 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<?php if ($client_url) { ?>
|
<?php if ($client_url) { ?>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkAssignLocationModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/contact/contact_bulk_assign_location.php?<?= $client_url ?>"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-map-marker-alt mr-2"></i>Assign Location
|
<i class="fas fa-fw fa-map-marker-alt mr-2"></i>Assign Location
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkEditPhoneModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/contact/contact_bulk_edit_phone.php"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-phone-alt mr-2"></i>Set Phone Number
|
<i class="fas fa-fw fa-phone-alt mr-2"></i>Set Phone Number
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkEditDepartmentModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/contact/contact_bulk_edit_department.php"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-users mr-2"></i>Set Department
|
<i class="fas fa-fw fa-users mr-2"></i>Set Department
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkEditRoleModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/contact/contact_bulk_edit_role.php"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-user-shield mr-2"></i>Set Roles
|
<i class="fas fa-fw fa-user-shield mr-2"></i>Set Roles
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkAssignTagsModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/contact/contact_bulk_assign_tags.php"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-tags mr-2"></i>Assign Tags
|
<i class="fas fa-fw fa-tags mr-2"></i>Assign Tags
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkSendEmailModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/contact/contact_bulk_email.php"
|
||||||
|
data-modal-size="lg"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-paper-plane mr-2"></i>Send Email
|
<i class="fas fa-fw fa-paper-plane mr-2"></i>Send Email
|
||||||
</a>
|
</a>
|
||||||
<?php if ($archived) { ?>
|
<?php if ($archived) { ?>
|
||||||
@@ -545,25 +560,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?php if ($client_url) { require_once "modals/contact/contact_bulk_assign_location.php"; } ?>
|
|
||||||
<?php require_once "modals/contact/contact_bulk_edit_phone.php"; ?>
|
|
||||||
<?php require_once "modals/contact/contact_bulk_edit_department.php"; ?>
|
|
||||||
<?php require_once "modals/contact/contact_bulk_edit_role.php"; ?>
|
|
||||||
<?php require_once "modals/contact/contact_bulk_assign_tags.php"; ?>
|
|
||||||
<?php require_once "modals/contact/contact_bulk_email.php"; ?>
|
|
||||||
</form>
|
</form>
|
||||||
<?php require_once "../includes/filter_footer.php";
|
<?php require_once "../includes/filter_footer.php"; ?>
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="../js/bulk_actions.js"></script>
|
<script src="../js/bulk_actions.js"></script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "modals/contact/contact_export.php";
|
|
||||||
if ($client_url) {
|
|
||||||
require_once "modals/contact/contact_invite.php";
|
|
||||||
require_once "modals/contact/contact_import.php";
|
|
||||||
}
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -106,19 +106,21 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<?php if (lookupUserPermission("module_credential") >= 2) { ?>
|
<?php if (lookupUserPermission("module_credential") >= 2) { ?>
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addCredentialModal" <?php if (!isset($_COOKIE['user_encryption_session_key'])) { echo "disabled"; } ?>>
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/credential/credential_add.php?<?= $client_url ?>" <?php if (!isset($_COOKIE['user_encryption_session_key'])) { echo "disabled"; } ?>>
|
||||||
<i class="fas fa-plus mr-2"></i>New Credential
|
<i class="fas fa-plus mr-2"></i>New Credential
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<?php if ($client_url) { ?>
|
<?php if ($client_url) { ?>
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#importCredentialModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/credential/credential_import.php?<?= $client_url ?>">
|
||||||
<i class="fa fa-fw fa-upload mr-2"></i>Import
|
<i class="fa fa-fw fa-upload mr-2"></i>Import
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if ($num_rows[0] > 0) { ?>
|
<?php if ($num_rows[0] > 0) { ?>
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportCredentialModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/credential/credential_export.php?<?= $client_url ?>">
|
||||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||||
</a>
|
</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@@ -241,7 +243,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||||
</button>
|
</button>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkAssignTagsModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/credential/credential_bulk_assign_tags.php"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-tags mr-2"></i>Assign Tags
|
<i class="fas fa-fw fa-tags mr-2"></i>Assign Tags
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
@@ -519,25 +523,17 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?php require_once "modals/credential/credential_bulk_assign_tags.php"; ?>
|
|
||||||
</form>
|
</form>
|
||||||
<?php require_once "../includes/filter_footer.php";
|
<?php require_once "../includes/filter_footer.php"; ?>
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Include script to get TOTP code via the login ID -->
|
<!-- Include script to get TOTP code via the login ID -->
|
||||||
<script src="js/credential_show_otp_via_id.js"></script>
|
<script src="js/credential_show_otp_via_id.js"></script>
|
||||||
<!-- Include script to generate readable passwords for login entries -->
|
|
||||||
<script src="js/generate_password.js"></script>
|
|
||||||
<script src="../js/bulk_actions.js"></script>
|
<script src="../js/bulk_actions.js"></script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "modals/credential/credential_add.php";
|
|
||||||
require_once "modals/credential/credential_export.php";
|
|
||||||
if ($client_url) {
|
if ($client_url) {
|
||||||
require_once "modals/credential/credential_import.php";
|
|
||||||
require_once "modals/share_modal.php";
|
require_once "modals/share_modal.php";
|
||||||
}
|
}
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -729,13 +729,22 @@ if ($user_config_dashboard_technical_enable == 1) {
|
|||||||
$client_name = nullable_htmlentities($row['client_name']);
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
$contact_id = intval($row['ticket_contact_id']);
|
$contact_id = intval($row['ticket_contact_id']);
|
||||||
$contact_name = nullable_htmlentities($row['contact_name']);
|
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||||
|
if ($client_id) {
|
||||||
|
$has_client = "&client_id=$client_id";
|
||||||
|
} else {
|
||||||
|
$has_client = "";
|
||||||
|
}
|
||||||
|
|
||||||
$ticket_priority_color = $ticket_priority == "High" ? "danger" : ($ticket_priority == "Medium" ? "warning" : "info");
|
$ticket_priority_color = $ticket_priority == "High" ? "danger" : ($ticket_priority == "Medium" ? "warning" : "info");
|
||||||
$contact_display = empty($contact_name) ? "-" : "<a href='contact_details.php?client_id=$client_id&contact_id=$contact_id'>$contact_name</a>";
|
$contact_display = empty($contact_name) ? "-" : "<a href='contact_details.php?client_id=$client_id&contact_id=$contact_id'>$contact_name</a>";
|
||||||
?>
|
?>
|
||||||
<tr class="<?php echo empty($ticket_updated_at) ? 'text-bold' : ''; ?>">
|
<tr class="<?php echo empty($ticket_updated_at) ? 'text-bold' : ''; ?>">
|
||||||
<td><a class="text-dark" href="ticket.php?ticket_id=<?php echo $ticket_id; ?>"><?php echo "$ticket_prefix$ticket_number"; ?></a></td>
|
<td>
|
||||||
<td><a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>"><?php echo $ticket_subject; ?></a></td>
|
<a class="text-dark"
|
||||||
|
href="ticket.php?ticket_id=<?= "$ticket_id$has_client" ?>"><?= "$ticket_prefix$ticket_number" ?>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td><a href="ticket.php?ticket_id=<?= "$ticket_id$has_client" ?>"><?= $ticket_subject ?></a></td>
|
||||||
<td><a href="tickets.php?client_id=<?php echo $client_id; ?>"><strong><?php echo $client_name; ?></strong></a></td>
|
<td><a href="tickets.php?client_id=<?php echo $client_id; ?>"><strong><?php echo $client_name; ?></strong></a></td>
|
||||||
<td><?php echo $contact_display; ?></td>
|
<td><?php echo $contact_display; ?></td>
|
||||||
<td><span class='p-2 badge badge-pill badge-<?php echo $ticket_priority_color; ?>'><?php echo $ticket_priority; ?></span></td>
|
<td><span class='p-2 badge badge-pill badge-<?php echo $ticket_priority_color; ?>'><?php echo $ticket_priority; ?></span></td>
|
||||||
|
|||||||
@@ -20,9 +20,16 @@ $folder_location = 0;
|
|||||||
$sql_document = mysqli_query($mysqli, "SELECT * FROM documents
|
$sql_document = mysqli_query($mysqli, "SELECT * FROM documents
|
||||||
LEFT JOIN folders ON document_folder_id = folder_id
|
LEFT JOIN folders ON document_folder_id = folder_id
|
||||||
LEFT JOIN users ON document_created_by = user_id
|
LEFT JOIN users ON document_created_by = user_id
|
||||||
WHERE document_client_id = $client_id AND document_id = $document_id"
|
WHERE document_client_id = $client_id AND document_id = $document_id
|
||||||
|
LIMIT 1"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (mysqli_num_rows($sql_document) == 0) {
|
||||||
|
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='javascript:history.back()'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>";
|
||||||
|
require_once "../includes/footer.php";
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql_document);
|
$row = mysqli_fetch_array($sql_document);
|
||||||
|
|
||||||
$folder_name = nullable_htmlentities($row['folder_name']);
|
$folder_name = nullable_htmlentities($row['folder_name']);
|
||||||
@@ -44,10 +51,10 @@ $page_title = $row['document_name'];
|
|||||||
|
|
||||||
<ol class="breadcrumb d-print-none">
|
<ol class="breadcrumb d-print-none">
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="client_overview.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a>
|
<a href="client_overview.php?client_id=<?= $client_id ?>"><?= $client_name ?></a>
|
||||||
</li>
|
</li>
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="documents.php?client_id=<?php echo $client_id; ?>">Documents</a>
|
<a href="files.php?client_id=<?= $client_id ?>">Files</a>
|
||||||
</li>
|
</li>
|
||||||
<?php
|
<?php
|
||||||
// Build the full folder path
|
// Build the full folder path
|
||||||
@@ -77,7 +84,7 @@ $page_title = $row['document_name'];
|
|||||||
$bread_crumb_folder_name = $folder['folder_name']; // Sanitized before put in array
|
$bread_crumb_folder_name = $folder['folder_name']; // Sanitized before put in array
|
||||||
?>
|
?>
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="documents.php?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $bread_crumb_folder_id; ?>">
|
<a href="files.php?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $bread_crumb_folder_id; ?>">
|
||||||
<i class="fas fa-fw fa-folder-open mr-2"></i><?php echo $bread_crumb_folder_name; ?>
|
<i class="fas fa-fw fa-folder-open mr-2"></i><?php echo $bread_crumb_folder_name; ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@@ -97,18 +104,31 @@ $page_title = $row['document_name'];
|
|||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header bg-dark">
|
<div class="card-header bg-dark">
|
||||||
|
|
||||||
<h3><?php echo $document_name; ?> <?php if (!empty($document_description)) { ?><span class="h6 text-muted">(<?php echo $document_description; ?>)</span><?php } ?></h3>
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col"><strong>Date:</strong> <?php echo date('Y-m-d', strtotime($document_created_at)); ?></div>
|
<div class="col">
|
||||||
<?php if(!empty($document_created_by_name)){ ?>
|
<div class="h4 mb-0"><?= $document_name ?></div>
|
||||||
<div class="col"><strong>Prepared By:</strong> <?php echo $document_created_by_name; ?></div>
|
<?php if ($document_description) { ?>
|
||||||
|
<div class="text-light"><?= $document_description ?></div>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<div class="float-right">
|
||||||
|
<div>
|
||||||
|
Date:
|
||||||
|
<strong><?= date('Y-m-d', strtotime($document_created_at)); ?></strong>
|
||||||
|
</div>
|
||||||
|
<?php if($document_created_by_name) { ?>
|
||||||
|
<div>
|
||||||
|
Prepared By:
|
||||||
|
<strong><?= $document_created_by_name ?></strong>
|
||||||
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="card-body prettyContent">
|
<div class="card-body prettyContent">
|
||||||
<?php echo $document_content; ?>
|
<?= $document_content ?>
|
||||||
<hr>
|
<hr>
|
||||||
<h4>Documentation Revision History</h4>
|
<h4>Documentation Revision History</h4>
|
||||||
|
|
||||||
@@ -144,11 +164,11 @@ $page_title = $row['document_name'];
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $document_version_count; ?></td>
|
<td><?= $document_version_count ?></td>
|
||||||
<td><?php echo $document_version_created_date; ?></td>
|
<td><?= $document_version_created_date ?></td>
|
||||||
<td><?php echo $document_version_name; ?></td>
|
<td><?= $document_version_name ?></td>
|
||||||
<td><?php echo $document_version_description_display; ?></td>
|
<td><?= $document_version_description_display ?></td>
|
||||||
<td><?php echo $document_version_author; ?></td>
|
<td><?= $document_version_author ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
$document_version_count++; // Increment the counter
|
$document_version_count++; // Increment the counter
|
||||||
@@ -169,10 +189,10 @@ $page_title = $row['document_name'];
|
|||||||
<i class="fas fa-fw fa-edit" title="Edit"></i>
|
<i class="fas fa-fw fa-edit" title="Edit"></i>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-secondary mr-1" data-toggle="modal" data-target="#shareModal"
|
<button type="button" class="btn btn-secondary mr-1" data-toggle="modal" data-target="#shareModal"
|
||||||
onclick="populateShareModal(<?php echo "$client_id, 'Document', $document_id"; ?>)">
|
onclick="populateShareModal(<?= "$client_id, 'Document', $document_id"; ?>)">
|
||||||
<i class="fas fa-fw fa-share" title="Share"></i>
|
<i class="fas fa-fw fa-share" title="Share"></i>
|
||||||
</button>
|
</button>
|
||||||
<a class="btn btn-success mr-1" href="post.php?export_document=<?php echo $document_id; ?>"><i class='fas fa-fw fa-file-pdf' title="PDF Export"></i></a>
|
<a class="btn btn-success mr-1" href="post.php?export_document=<?= $document_id ?>"><i class='fas fa-fw fa-file-pdf' title="PDF Export"></i></a>
|
||||||
<button type="button" class="btn btn-secondary mr-4" onclick="window.print();"><i class="fas fa-fw fa-print" title="Print"></i></button>
|
<button type="button" class="btn btn-secondary mr-4" onclick="window.print();"><i class="fas fa-fw fa-print" title="Print"></i></button>
|
||||||
<a class="btn btn-warning mr-1 confirm-link" href="post.php?archive_document=<?= $document_id ?>" title="Archive"><i class='fas fa-fw fa-archive'></i></a>
|
<a class="btn btn-warning mr-1 confirm-link" href="post.php?archive_document=<?= $document_id ?>" title="Archive"><i class='fas fa-fw fa-archive'></i></a>
|
||||||
<a class="btn btn-danger confirm-link" href="post.php?delete_document=<?= $document_id ?>&from=document_details" title="Delete"><i class='fas fa-fw fa-trash-alt'></i></a>
|
<a class="btn btn-danger confirm-link" href="post.php?delete_document=<?= $document_id ?>&from=document_details" title="Delete"><i class='fas fa-fw fa-trash-alt'></i></a>
|
||||||
@@ -182,7 +202,8 @@ $page_title = $row['document_name'];
|
|||||||
<h5 class="mb-3"><i class="fas fa-tags mr-2"></i>Related Items</h5>
|
<h5 class="mb-3"><i class="fas fa-tags mr-2"></i>Related Items</h5>
|
||||||
<h6>
|
<h6>
|
||||||
<i class="fas fa-fw fa-paperclip text-secondary mr-2"></i>Files
|
<i class="fas fa-fw fa-paperclip text-secondary mr-2"></i>Files
|
||||||
<button type="button" class="btn btn-link btn-sm" data-toggle="modal" data-target="#linkFileToDocumentModal">
|
<button type="button" class="btn btn-link btn-sm ajax-modal"
|
||||||
|
data-modal-url="modals/document/document_link_file.php?document_id=<?= $document_id ?>">
|
||||||
<i class="fas fa-fw fa-plus"></i>
|
<i class="fas fa-fw fa-plus"></i>
|
||||||
</button>
|
</button>
|
||||||
</h6>
|
</h6>
|
||||||
@@ -204,9 +225,9 @@ $page_title = $row['document_name'];
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="ml-2">
|
<div class="ml-2">
|
||||||
<a href="files.php?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $folder_id; ?>&q=<?php echo $file_name; ?>" target="_blank"><?php echo $file_name; ?></a>
|
<a href="files.php?client_id=<?= $client_id ?>&folder_id=<?= $folder_id ?>&q=<?= $file_name ?>" target="_blank"><?= $file_name ?></a>
|
||||||
<a class="confirm-link" href="post.php?unlink_file_from_document&file_id=<?php echo $file_id; ?>&document_id=<?php echo $document_id; ?>">
|
<a class="confirm-link" href="post.php?unlink_file_from_document&file_id=<?= $file_id ?>&document_id=<?= $document_id ?>">
|
||||||
<i class="fas fa-fw fa-trash-alt text-secondary float-right"></i>
|
<i class="fas fa-fw fa-unlink text-secondary float-right" title="Unlink File"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
@@ -214,7 +235,8 @@ $page_title = $row['document_name'];
|
|||||||
?>
|
?>
|
||||||
<h6>
|
<h6>
|
||||||
<i class="fas fa-fw fa-users text-secondary mt-3 mr-2"></i>Contacts
|
<i class="fas fa-fw fa-users text-secondary mt-3 mr-2"></i>Contacts
|
||||||
<button type="button" class="btn btn-link btn-sm" data-toggle="modal" data-target="#linkContactToDocumentModal">
|
<button type="button" class="btn btn-link btn-sm ajax-modal"
|
||||||
|
data-modal-url="modals/document/document_link_contact.php?document_id=<?= $document_id ?>">
|
||||||
<i class="fas fa-fw fa-plus"></i>
|
<i class="fas fa-fw fa-plus"></i>
|
||||||
</button>
|
</button>
|
||||||
</h6>
|
</h6>
|
||||||
@@ -240,7 +262,7 @@ $page_title = $row['document_name'];
|
|||||||
data-modal-url="modals/contact/contact_details.php?id=<?= $contact_id ?>">
|
data-modal-url="modals/contact/contact_details.php?id=<?= $contact_id ?>">
|
||||||
<?php echo $contact_name; ?></a>
|
<?php echo $contact_name; ?></a>
|
||||||
<a class="confirm-link float-right" href="post.php?unlink_contact_from_document&contact_id=<?php echo $contact_id; ?>&document_id=<?php echo $document_id; ?>">
|
<a class="confirm-link float-right" href="post.php?unlink_contact_from_document&contact_id=<?php echo $contact_id; ?>&document_id=<?php echo $document_id; ?>">
|
||||||
<i class="fas fa-fw fa-trash-alt text-secondary"></i>
|
<i class="fas fa-fw fa-unlink text-secondary" title="Unlink Contact"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
@@ -248,7 +270,7 @@ $page_title = $row['document_name'];
|
|||||||
?>
|
?>
|
||||||
<h6>
|
<h6>
|
||||||
<i class="fas fa-fw fa-laptop text-secondary mr-2 mt-3"></i>Assets
|
<i class="fas fa-fw fa-laptop text-secondary mr-2 mt-3"></i>Assets
|
||||||
<button type="button" class="btn btn-link btn-sm" data-toggle="modal" data-target="#linkAssetToDocumentModal">
|
<button type="button" class="btn btn-link btn-sm ajax-modal" data-modal-url="modals/document/document_link_asset.php?document_id=<?= $document_id ?>">
|
||||||
<i class="fas fa-fw fa-plus"></i>
|
<i class="fas fa-fw fa-plus"></i>
|
||||||
</button>
|
</button>
|
||||||
</h6>
|
</h6>
|
||||||
@@ -275,7 +297,7 @@ $page_title = $row['document_name'];
|
|||||||
<?php echo $asset_name; ?>
|
<?php echo $asset_name; ?>
|
||||||
</a>
|
</a>
|
||||||
<a class="confirm-link float-right" href="post.php?unlink_asset_from_document&asset_id=<?php echo $asset_id; ?>&document_id=<?php echo $document_id; ?>">
|
<a class="confirm-link float-right" href="post.php?unlink_asset_from_document&asset_id=<?php echo $asset_id; ?>&document_id=<?php echo $document_id; ?>">
|
||||||
<i class="fas fa-fw fa-trash-alt text-secondary"></i>
|
<i class="fas fa-fw fa-unlink text-secondary" title="Unlink Asset"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
@@ -283,7 +305,8 @@ $page_title = $row['document_name'];
|
|||||||
?>
|
?>
|
||||||
<h6>
|
<h6>
|
||||||
<i class="fas fa-fw fa-cube text-secondary mr-2 mt-3"></i>Licenses
|
<i class="fas fa-fw fa-cube text-secondary mr-2 mt-3"></i>Licenses
|
||||||
<button type="button" class="btn btn-link btn-sm" data-toggle="modal" data-target="#linkSoftwareToDocumentModal">
|
<button type="button" class="btn btn-link btn-sm ajax-modal"
|
||||||
|
data-modal-url="modals/document/document_link_software.php?document_id=<?= $document_id ?>">
|
||||||
<i class="fas fa-fw fa-plus"></i>
|
<i class="fas fa-fw fa-plus"></i>
|
||||||
</button>
|
</button>
|
||||||
</h6>
|
</h6>
|
||||||
@@ -306,7 +329,7 @@ $page_title = $row['document_name'];
|
|||||||
<div class="ml-2">
|
<div class="ml-2">
|
||||||
<a href="software.php?client_id=<?php echo $client_id; ?>&q=<?php echo $software_name; ?>" target="_blank"><?php echo $software_name; ?></a>
|
<a href="software.php?client_id=<?php echo $client_id; ?>&q=<?php echo $software_name; ?>" target="_blank"><?php echo $software_name; ?></a>
|
||||||
<a class="confirm-link float-right" href="post.php?unlink_software_from_document&software_id=<?php echo $software_id; ?>&document_id=<?php echo $document_id; ?>">
|
<a class="confirm-link float-right" href="post.php?unlink_software_from_document&software_id=<?php echo $software_id; ?>&document_id=<?php echo $document_id; ?>">
|
||||||
<i class="fas fa-fw fa-trash-alt text-secondary"></i>
|
<i class="fas fa-fw fa-unlink text-secondary" title="Unlink License"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
@@ -314,7 +337,8 @@ $page_title = $row['document_name'];
|
|||||||
?>
|
?>
|
||||||
<h6>
|
<h6>
|
||||||
<i class="fas fa-fw fa-building text-secondary mr-2 mt-3"></i>Vendors
|
<i class="fas fa-fw fa-building text-secondary mr-2 mt-3"></i>Vendors
|
||||||
<button type="button" class="btn btn-link btn-sm" data-toggle="modal" data-target="#linkVendorToDocumentModal">
|
<button type="button" class="btn btn-link btn-sm ajax-modal"
|
||||||
|
data-modal-url="modals/document/document_link_vendor.php?document_id=<?= $document_id ?>">
|
||||||
<i class="fas fa-fw fa-plus"></i>
|
<i class="fas fa-fw fa-plus"></i>
|
||||||
</button>
|
</button>
|
||||||
</h6>
|
</h6>
|
||||||
@@ -339,7 +363,7 @@ $page_title = $row['document_name'];
|
|||||||
<?php echo $vendor_name; ?>
|
<?php echo $vendor_name; ?>
|
||||||
</a>
|
</a>
|
||||||
<a class="confirm-link float-right" href="post.php?unlink_vendor_from_document&vendor_id=<?php echo $vendor_id; ?>&document_id=<?php echo $document_id; ?>">
|
<a class="confirm-link float-right" href="post.php?unlink_vendor_from_document&vendor_id=<?php echo $vendor_id; ?>&document_id=<?php echo $document_id; ?>">
|
||||||
<i class="fas fa-fw fa-trash-alt text-secondary"></i>
|
<i class="fas fa-fw fa-unlink text-secondary" title="Unlink Vendor"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
@@ -352,7 +376,8 @@ $page_title = $row['document_name'];
|
|||||||
<h6><i class="fas fa-handshake mr-2"></i>Portal Collaboration</h6>
|
<h6><i class="fas fa-handshake mr-2"></i>Portal Collaboration</h6>
|
||||||
<div class="mt-1">
|
<div class="mt-1">
|
||||||
<i class="fa fa-fw fa-eye<?php if (!$document_client_visible) { echo '-slash'; } ?> text-secondary mr-2"></i>Document is
|
<i class="fa fa-fw fa-eye<?php if (!$document_client_visible) { echo '-slash'; } ?> text-secondary mr-2"></i>Document is
|
||||||
<a href="#" data-toggle="modal" data-target="#editDocumentClientVisibileModal">
|
<a class="ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/document/document_edit_visibility.php?document_id=<?= $document_id ?>">
|
||||||
<?php
|
<?php
|
||||||
if ($document_client_visible) {
|
if ($document_client_visible) {
|
||||||
echo "<span class='text-bold text-dark'>visible</span>";
|
echo "<span class='text-bold text-dark'>visible</span>";
|
||||||
@@ -407,11 +432,5 @@ $page_title = $row['document_name'];
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "modals/document/document_link_file.php";
|
|
||||||
require_once "modals/document/document_link_contact.php";
|
|
||||||
require_once "modals/document/document_link_asset.php";
|
|
||||||
require_once "modals/document/document_link_software.php";
|
|
||||||
require_once "modals/document/document_link_vendor.php";
|
|
||||||
require_once "modals/document/document_edit_visibility.php";
|
|
||||||
require_once "modals/share_modal.php";
|
require_once "modals/share_modal.php";
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -1,484 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// Default Column Sortby Filter
|
|
||||||
$sort = "document_name";
|
|
||||||
$order = "ASC";
|
|
||||||
|
|
||||||
require_once "includes/inc_all_client.php";
|
|
||||||
|
|
||||||
// Perms
|
|
||||||
enforceUserPermission('module_support');
|
|
||||||
|
|
||||||
// Folder
|
|
||||||
if (!empty($_GET['folder_id'])) {
|
|
||||||
$folder = intval($_GET['folder_id']);
|
|
||||||
} else {
|
|
||||||
$folder = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search query SQL snippet
|
|
||||||
if (!empty($q)) {
|
|
||||||
$query_snippet = "AND (MATCH(document_content_raw) AGAINST ('$q') OR document_name LIKE '%$q%')";
|
|
||||||
} else {
|
|
||||||
$query_snippet = ""; // empty
|
|
||||||
}
|
|
||||||
|
|
||||||
//Rebuild URL
|
|
||||||
$url_query_strings_sort = http_build_query($get_copy);
|
|
||||||
|
|
||||||
// Folder ID
|
|
||||||
$get_folder_id = 0;
|
|
||||||
if (!empty($_GET['folder_id'])) {
|
|
||||||
$get_folder_id = intval($_GET['folder_id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set Folder Location Var used when creating folders
|
|
||||||
$folder_location = 0;
|
|
||||||
|
|
||||||
if ($get_folder_id == 0 && isset($_GET["q"])) {
|
|
||||||
$sql = mysqli_query(
|
|
||||||
$mysqli,
|
|
||||||
"SELECT SQL_CALC_FOUND_ROWS * FROM documents
|
|
||||||
LEFT JOIN users ON document_created_by = user_id
|
|
||||||
WHERE document_client_id = $client_id
|
|
||||||
AND document_archived_at IS NULL
|
|
||||||
$query_snippet
|
|
||||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
|
||||||
);
|
|
||||||
}else{
|
|
||||||
$sql = mysqli_query(
|
|
||||||
$mysqli,
|
|
||||||
"SELECT SQL_CALC_FOUND_ROWS * FROM documents
|
|
||||||
LEFT JOIN users ON document_created_by = user_id
|
|
||||||
WHERE document_client_id = $client_id
|
|
||||||
AND document_folder_id = $folder
|
|
||||||
AND document_archived_at IS NULL
|
|
||||||
$query_snippet
|
|
||||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|
||||||
|
|
||||||
// Breadcrumbs
|
|
||||||
// Build the full folder path
|
|
||||||
$folder_id = $get_folder_id;
|
|
||||||
$folder_path = array();
|
|
||||||
|
|
||||||
while ($folder_id > 0) {
|
|
||||||
$sql_folder = mysqli_query($mysqli, "SELECT folder_name, parent_folder FROM folders WHERE folder_id = $folder_id");
|
|
||||||
if ($row_folder = mysqli_fetch_assoc($sql_folder)) {
|
|
||||||
$folder_name = nullable_htmlentities($row_folder['folder_name']);
|
|
||||||
$parent_folder = intval($row_folder['parent_folder']);
|
|
||||||
|
|
||||||
// Prepend the folder to the beginning of the array
|
|
||||||
array_unshift($folder_path, array('folder_id' => $folder_id, 'folder_name' => $folder_name));
|
|
||||||
|
|
||||||
// Move up to the parent folder
|
|
||||||
$folder_id = $parent_folder;
|
|
||||||
} else {
|
|
||||||
// If the folder is not found, break the loop
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="card card-dark">
|
|
||||||
<div class="card-header py-2">
|
|
||||||
<h3 class="card-title mt-2">
|
|
||||||
<i class="fa fa-fw fa-folder mr-2"></i>Documents
|
|
||||||
</h3>
|
|
||||||
<div class="card-tools">
|
|
||||||
|
|
||||||
<div class="btn-group">
|
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addDocumentModal">
|
|
||||||
<i class="fas fa-plus mr-2"></i>New Document
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
|
||||||
<div class="dropdown-menu">
|
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#createFolderModal">
|
|
||||||
<i class="fa fa-fw fa-folder-plus mr-2"></i>New Folder
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addDocumentFromTemplateModal">From Template</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card-body">
|
|
||||||
<form autocomplete="off">
|
|
||||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
|
||||||
<input type="hidden" name="folder_id" value="<?php echo $get_folder_id; ?>">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="input-group mb-3 mb-md-0">
|
|
||||||
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search documents in <?php if($get_folder_id == 0) { echo "all folders"; } else { echo "current folder"; } ?>">
|
|
||||||
<div class="input-group-append">
|
|
||||||
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-8">
|
|
||||||
<div class="btn-group float-right">
|
|
||||||
<div class="dropdown ml-2" id="bulkActionButton" hidden>
|
|
||||||
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown">
|
|
||||||
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>)
|
|
||||||
</button>
|
|
||||||
<div class="dropdown-menu">
|
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkMoveDocumentModal">
|
|
||||||
<i class="fas fa-fw fa-exchange-alt mr-2"></i>Move
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<button class="dropdown-item text-danger text-bold"
|
|
||||||
type="submit" form="bulkActions" name="bulk_delete_documents">
|
|
||||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-3 border-right mb-3">
|
|
||||||
<h4>Folders</h4>
|
|
||||||
<hr>
|
|
||||||
<ul class="nav nav-pills flex-column bg-light">
|
|
||||||
<li class="nav-item">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-10">
|
|
||||||
<?php
|
|
||||||
// Get a count of documents that have no folder
|
|
||||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('document_id') AS num FROM documents WHERE document_folder_id = 0 AND document_client_id = $client_id AND document_archived_at IS NULL"));
|
|
||||||
$num_documents = intval($row['num']);
|
|
||||||
?>
|
|
||||||
<a class="nav-link <?php if ($get_folder_id == 0) { echo "active"; } ?>" href="?client_id=<?php echo $client_id; ?>&folder_id=0">
|
|
||||||
/ <?php if ($num_documents > 0) { echo "<span class='badge badge-pill badge-dark float-right mt-1'>$num_documents</span>"; } ?>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="col-2">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<?php
|
|
||||||
// Function to check if a folder is an ancestor of the current folder
|
|
||||||
function is_ancestor_folder($folder_id, $current_folder_id, $client_id) {
|
|
||||||
global $mysqli;
|
|
||||||
|
|
||||||
// Base case: if current_folder_id is 0 or equal to folder_id
|
|
||||||
if ($current_folder_id == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ($current_folder_id == $folder_id) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the parent folder of the current folder
|
|
||||||
$result = mysqli_query($mysqli, "SELECT parent_folder FROM folders WHERE folder_id = $current_folder_id AND folder_client_id = $client_id");
|
|
||||||
if ($row = mysqli_fetch_assoc($result)) {
|
|
||||||
$parent_folder_id = intval($row['parent_folder']);
|
|
||||||
// Recursive call to check the parent folder
|
|
||||||
return is_ancestor_folder($folder_id, $parent_folder_id, $client_id);
|
|
||||||
} else {
|
|
||||||
// Folder not found
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Recursive function to display folders and subfolders
|
|
||||||
function display_folders($parent_folder_id, $client_id, $indent = 0) {
|
|
||||||
global $mysqli, $get_folder_id, $session_user_role;
|
|
||||||
|
|
||||||
$sql_folders = mysqli_query($mysqli, "SELECT * FROM folders WHERE parent_folder = $parent_folder_id AND folder_location = 0 AND folder_client_id = $client_id ORDER BY folder_name ASC");
|
|
||||||
while ($row = mysqli_fetch_array($sql_folders)) {
|
|
||||||
$folder_id = intval($row['folder_id']);
|
|
||||||
$folder_name = nullable_htmlentities($row['folder_name']);
|
|
||||||
|
|
||||||
// Get the number of documents in the folder
|
|
||||||
$row2 = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('document_id') AS num FROM documents WHERE document_folder_id = $folder_id AND document_archived_at IS NULL"));
|
|
||||||
$num_documents = intval($row2['num']);
|
|
||||||
|
|
||||||
// Get the number of subfolders
|
|
||||||
$subfolder_result = mysqli_query($mysqli, "SELECT COUNT(*) AS count FROM folders WHERE parent_folder = $folder_id AND folder_client_id = $client_id");
|
|
||||||
$subfolder_count = intval(mysqli_fetch_assoc($subfolder_result)['count']);
|
|
||||||
|
|
||||||
echo '<li class="nav-item">';
|
|
||||||
echo '<div class="row">';
|
|
||||||
echo '<div class="col-10">';
|
|
||||||
echo '<a class="nav-link ';
|
|
||||||
if ($get_folder_id == $folder_id) { echo "active"; }
|
|
||||||
echo '" href="?client_id=' . $client_id . '&folder_id=' . $folder_id . '">';
|
|
||||||
|
|
||||||
// Indentation for subfolders
|
|
||||||
echo str_repeat(' ', $indent * 4);
|
|
||||||
|
|
||||||
// Determine if the folder is open
|
|
||||||
if ($get_folder_id == $folder_id || is_ancestor_folder($folder_id, $get_folder_id, $client_id)) {
|
|
||||||
echo '<i class="fas fa-fw fa-folder-open"></i>';
|
|
||||||
} else {
|
|
||||||
echo '<i class="fas fa-fw fa-folder"></i>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo ' ' . $folder_name;
|
|
||||||
|
|
||||||
if ($num_documents > 0) {
|
|
||||||
echo "<span class='badge badge-pill badge-dark float-right mt-1'>$num_documents</span>";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</a>';
|
|
||||||
echo '</div>';
|
|
||||||
echo '<div class="col-2">';
|
|
||||||
?>
|
|
||||||
<div class="dropdown">
|
|
||||||
<button class="btn btn-sm" type="button" data-toggle="dropdown">
|
|
||||||
<i class="fas fa-ellipsis-v"></i>
|
|
||||||
</button>
|
|
||||||
<div class="dropdown-menu">
|
|
||||||
<a class="dropdown-item ajax-modal" href="#"
|
|
||||||
data-modal-url="modals/folder/folder_rename.php?id=<?= $folder_id ?>">
|
|
||||||
<i class="fas fa-fw fa-edit mr-2"></i>Rename
|
|
||||||
</a>
|
|
||||||
<?php
|
|
||||||
// Only show delete option if user is admin, folder has no documents, and no subfolders
|
|
||||||
if ($session_user_role == 3 && $num_documents == 0 && $subfolder_count == 0) { ?>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_folder=<?php echo $folder_id; ?>">
|
|
||||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
|
||||||
</a>
|
|
||||||
<?php } ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
echo '</div>';
|
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
if ($subfolder_count > 0) {
|
|
||||||
// Display subfolders
|
|
||||||
echo '<ul class="nav nav-pills flex-column bg-light">';
|
|
||||||
display_folders($folder_id, $client_id, $indent + 1);
|
|
||||||
echo '</ul>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</li>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start displaying folders from the root (parent_folder = 0)
|
|
||||||
display_folders(0, $client_id);
|
|
||||||
?>
|
|
||||||
</ul>
|
|
||||||
<?php require_once "modals/folder/folder_add.php"; ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-9">
|
|
||||||
|
|
||||||
<nav>
|
|
||||||
<ol class="breadcrumb">
|
|
||||||
<li class="breadcrumb-item">
|
|
||||||
<a href="?client_id=<?php echo $client_id; ?>&folder_id=0">
|
|
||||||
<i class="fas fa-fw fa-folder mr-2"></i>Root
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<?php
|
|
||||||
// Output breadcrumb items for each folder in the path
|
|
||||||
foreach ($folder_path as $folder) {
|
|
||||||
$bread_crumb_folder_id = $folder['folder_id']; // Already Sanitized before it was pushed into array
|
|
||||||
$bread_crumb_folder_name = $folder['folder_name']; // Already Sanitized before it was pushed into array
|
|
||||||
|
|
||||||
?>
|
|
||||||
<li class="breadcrumb-item">
|
|
||||||
<a href="?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $bread_crumb_folder_id; ?>">
|
|
||||||
<i class="fas fa-fw fa-folder-open mr-2"></i><?php echo $bread_crumb_folder_name; ?>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<form id="bulkActions" action="post.php" method="post">
|
|
||||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
|
||||||
|
|
||||||
<div class="table-responsive-sm">
|
|
||||||
<table class="table table-border">
|
|
||||||
<thead class="thead-light <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
|
||||||
<tr>
|
|
||||||
<td class="bg-light pr-0">
|
|
||||||
<div class="form-check">
|
|
||||||
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<th>
|
|
||||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_name&order=<?php echo $disp; ?>">
|
|
||||||
Name <?php if ($sort == 'document_name') { echo $order_icon; } ?>
|
|
||||||
</a>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_created_at&order=<?php echo $disp; ?>">
|
|
||||||
Created <?php if ($sort == 'document_created_at') { echo $order_icon; } ?>
|
|
||||||
</a>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_updated_at&order=<?php echo $disp; ?>">
|
|
||||||
Last Update <?php if ($sort == 'document_updated_at') { echo $order_icon; } ?>
|
|
||||||
</a>
|
|
||||||
</th>
|
|
||||||
<th></th>
|
|
||||||
<th class="text-center">Action</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
|
||||||
$document_id = intval($row['document_id']);
|
|
||||||
$document_name = nullable_htmlentities($row['document_name']);
|
|
||||||
$document_description = nullable_htmlentities($row['document_description']);
|
|
||||||
$document_content = nullable_htmlentities($row['document_content']);
|
|
||||||
$document_created_by_name = nullable_htmlentities($row['user_name']);
|
|
||||||
$document_created_at = date("m/d/Y",strtotime($row['document_created_at']));
|
|
||||||
if ($row['document_updated_at']) {
|
|
||||||
$document_updated_at_display = date("m/d/Y",strtotime($row['document_updated_at']));
|
|
||||||
} else {
|
|
||||||
$document_updated_at_display = "-";
|
|
||||||
}
|
|
||||||
$document_folder_id = intval($row['document_folder_id']);
|
|
||||||
|
|
||||||
// Check if shared
|
|
||||||
$sql_shared = mysqli_query(
|
|
||||||
$mysqli,
|
|
||||||
"SELECT * FROM shared_items
|
|
||||||
WHERE item_client_id = $client_id
|
|
||||||
AND item_active = 1
|
|
||||||
AND item_views != item_view_limit
|
|
||||||
AND item_expire_at > NOW()
|
|
||||||
AND item_type = 'Document'
|
|
||||||
AND item_related_id = $document_id
|
|
||||||
LIMIT 1"
|
|
||||||
);
|
|
||||||
$row = mysqli_fetch_array($sql_shared);
|
|
||||||
if($row) {
|
|
||||||
$item_id = intval($row['item_id']);
|
|
||||||
$item_active = nullable_htmlentities($row['item_active']);
|
|
||||||
$item_key = nullable_htmlentities($row['item_key']);
|
|
||||||
$item_type = nullable_htmlentities($row['item_type']);
|
|
||||||
$item_related_id = intval($row['item_related_id']);
|
|
||||||
$item_note = nullable_htmlentities($row['item_note']);
|
|
||||||
$item_recipient = nullable_htmlentities($row['item_recipient']);
|
|
||||||
$item_views = nullable_htmlentities($row['item_views']);
|
|
||||||
$item_view_limit = nullable_htmlentities($row['item_view_limit']);
|
|
||||||
$item_created_at = nullable_htmlentities($row['item_created_at']);
|
|
||||||
$item_expire_at = nullable_htmlentities($row['item_expire_at']);
|
|
||||||
$item_expire_at_human = timeAgo($row['item_expire_at']);
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td class="bg-light pr-0">
|
|
||||||
<div class="form-check">
|
|
||||||
<input class="form-check-input bulk-select" type="checkbox" name="document_ids[]" value="<?php echo $document_id ?>">
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="document_details.php?client_id=<?php echo $client_id; ?>&document_id=<?php echo $document_id; ?>"><i class="fas fa-fw fa-file-alt"></i> <?php echo $document_name; ?></a>
|
|
||||||
<div class="text-secondary mt-1"><?php echo $document_description; ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php echo $document_created_at; ?>
|
|
||||||
<div class="text-secondary mt-1"><?php echo $document_created_by_name; ?>
|
|
||||||
</td>
|
|
||||||
<td><?php echo $document_updated_at_display; ?></td>
|
|
||||||
<td>
|
|
||||||
<?php if (mysqli_num_rows($sql_shared) > 0) { ?>
|
|
||||||
<div class="media" title="Expires <?php echo $item_expire_at_human; ?>">
|
|
||||||
<i class="fas fa-link mr-2 mt-1"></i>
|
|
||||||
<div class="media-body">Shared
|
|
||||||
<br>
|
|
||||||
<small class="text-secondary"><?php echo $item_recipient; ?></small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php } ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="dropdown dropleft text-center">
|
|
||||||
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
|
||||||
<i class="fas fa-ellipsis-h"></i>
|
|
||||||
</button>
|
|
||||||
<div class="dropdown-menu">
|
|
||||||
<a class="dropdown-item ajax-modal" href="#"
|
|
||||||
data-modal-size="lg"
|
|
||||||
data-modal-url="modals/document/document_view.php?id=<?= $document_id ?>">
|
|
||||||
<i class="fas fa-fw fa-eye mr-2"></i>Quick View
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<a class="dropdown-item ajax-modal" href="#"
|
|
||||||
data-modal-size="lg"
|
|
||||||
data-modal-url="modals/document/document_edit.php?id=<?= $document_id ?>">
|
|
||||||
<i class="fas fa-fw fa-pencil-alt mr-2"></i>Edit
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#shareModal" onclick="populateShareModal(<?php echo "$client_id, 'Document', $document_id"; ?>)">
|
|
||||||
<i class="fas fa-fw fa-share mr-2"></i>Share
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<a class="dropdown-item ajax-modal" href="#"
|
|
||||||
data-modal-url="modals/document/document_rename.php?id=<?= $document_id ?>">
|
|
||||||
<i class="fas fa-fw fa-pencil-alt mr-2"></i>Rename
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<a class="dropdown-item ajax-modal" href="#"
|
|
||||||
data-modal-url="modals/document/document_move.php?id=<?= $document_id ?>">
|
|
||||||
<i class="fas fa-fw fa-exchange-alt mr-2"></i>Move
|
|
||||||
</a>
|
|
||||||
<?php if ($session_user_role == 3) { ?>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_document=<?php echo $document_id; ?>">
|
|
||||||
<i class="fas fa-fw fa-archive mr-2"></i>Archive
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_document=<?php echo $document_id; ?>">
|
|
||||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
|
||||||
</a>
|
|
||||||
<?php } ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<br>
|
|
||||||
</div>
|
|
||||||
<?php require_once "modals/document/document_bulk_move.php"; ?>
|
|
||||||
</form>
|
|
||||||
<?php require_once "../includes/filter_footer.php";
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="../js/bulk_actions.js"></script>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
require_once "modals/share_modal.php";
|
|
||||||
require_once "modals/document/document_add.php";
|
|
||||||
require_once "modals/document/document_add_from_template.php";
|
|
||||||
require_once "../includes/footer.php";
|
|
||||||
@@ -76,11 +76,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-globe mr-2"></i>Domains</h3>
|
<h3 class="card-title mt-2"><i class="fa fa-fw fa-globe mr-2"></i>Domains</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addDomainModal"><i class="fas fa-plus mr-2"></i>New Domain</button>
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/domain/domain_add.php?<?= $client_url ?>"><i class="fas fa-plus mr-2"></i>New Domain</button>
|
||||||
<?php if ($num_rows[0] > 0) { ?>
|
<?php if ($num_rows[0] > 0) { ?>
|
||||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportDomainModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/domain/domain_export.php?<?= $client_url ?>">
|
||||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -307,8 +308,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<td><?php echo $domain_dnshost_name_display; ?></td>
|
<td><?php echo $domain_dnshost_name_display; ?></td>
|
||||||
<td><?php echo $domain_mailhost_name_display; ?></td>
|
<td><?php echo $domain_mailhost_name_display; ?></td>
|
||||||
<td>
|
<td>
|
||||||
<div><?php echo $domain_expire; ?></div>
|
<div><?php echo $domain_expire ?: '-'; ?></div>
|
||||||
|
<?php if (!empty($domain_expire)) { ?>
|
||||||
<div><small><?php echo $domain_expire_ago; ?></small></div>
|
<div><small><?php echo $domain_expire_ago; ?></small></div>
|
||||||
|
<?php } ?>
|
||||||
</td>
|
</td>
|
||||||
<?php if (!$client_url) { ?>
|
<?php if (!$client_url) { ?>
|
||||||
<td><a href="domains.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a></td>
|
<td><a href="domains.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a></td>
|
||||||
@@ -355,17 +358,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<?php require_once "../includes/filter_footer.php";
|
<?php require_once "../includes/filter_footer.php"; ?>
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
|
||||||
require_once "modals/domain/domain_add.php";
|
|
||||||
require_once "modals/domain/domain_export.php";
|
|
||||||
?>
|
|
||||||
|
|
||||||
<script src="../js/bulk_actions.js"></script>
|
<script src="../js/bulk_actions.js"></script>
|
||||||
|
|
||||||
<?php require_once "../includes/footer.php";
|
<?php require_once "../includes/footer.php";
|
||||||
|
|
||||||
|
|||||||
@@ -64,10 +64,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-shopping-cart mr-2"></i>Expenses</h3>
|
<h3 class="card-title mt-2"><i class="fas fa-fw fa-shopping-cart mr-2"></i>Expenses</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addExpenseModal"><i class="fas fa-plus mr-2"></i>New Expense</button>
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/expense/expense_add.php" data-modal-size="lg"><i class="fas fa-plus mr-2"></i>New Expense</button>
|
||||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportExpensesModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/expense/expense_export.php">
|
||||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -94,23 +95,30 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>)
|
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>)
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkEditCategoryModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/expense/expense_bulk_edit_category.php"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-list mr-2"></i>Set Category
|
<i class="fas fa-fw fa-list mr-2"></i>Set Category
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkEditAccountModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/expense/expense_bulk_edit_account.php"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-piggy-bank mr-2"></i>Set Account
|
<i class="fas fa-fw fa-piggy-bank mr-2"></i>Set Account
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkEditClientModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/expense/expense_bulk_edit_client.php"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-user mr-2"></i>Set Client
|
<i class="fas fa-fw fa-user mr-2"></i>Set Client
|
||||||
</a>
|
</a>
|
||||||
<?php if ($session_user_role == 3) { ?>
|
<?php if ($session_user_role == 3) { ?>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<button class="dropdown-item text-danger text-bold"
|
<a class="dropdown-item text-danger text-bold ajax-modal" href="#"
|
||||||
type="submit" form="bulkActions" name="bulk_delete_expenses">
|
data-modal-url="modals/expense/expense_bulk_delete.php"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||||
</button>
|
</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -193,8 +201,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<hr>
|
<hr>
|
||||||
<form id="bulkActions" action="post.php" method="post" enctype="multipart/form-data">
|
|
||||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
|
||||||
|
|
||||||
<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">
|
||||||
@@ -281,7 +287,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="pr-0 bg-light">
|
<td class="pr-0 bg-light">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input bulk-select" type="checkbox" name="expense_ids[]" value="<?php echo $expense_id ?>">
|
<input class="form-check-input bulk-select" type="checkbox" name="expense_ids[]" value="<?= $expense_id ?>">
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@@ -345,19 +351,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?php require_once "modals/expense/expense_bulk_edit_category.php"; ?>
|
<?php require_once "../includes/filter_footer.php"; ?>
|
||||||
<?php require_once "modals/expense/expense_bulk_edit_account.php"; ?>
|
|
||||||
<?php require_once "modals/expense/expense_bulk_edit_client.php"; ?>
|
|
||||||
</form>
|
|
||||||
<?php require_once "../includes/filter_footer.php";
|
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="../js/bulk_actions.js"></script>
|
<script src="/js/bulk_actions.js"></script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/expense/expense_add.php";
|
|
||||||
require_once "modals/expense/expense_export.php";
|
|
||||||
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
671
agent/files.php
671
agent/files.php
@@ -1,12 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Default Column Sortby Filter
|
// Unified sort: "name" is logical field, not DB column
|
||||||
$sort = "file_name";
|
$sort = "name";
|
||||||
$order = "ASC";
|
$order = "ASC";
|
||||||
|
|
||||||
require_once "includes/inc_all_client.php";
|
require_once "includes/inc_all_client.php";
|
||||||
|
|
||||||
|
|
||||||
// Folder
|
// Folder
|
||||||
if (!empty($_GET['folder_id'])) {
|
if (!empty($_GET['folder_id'])) {
|
||||||
$folder_id = intval($_GET['folder_id']);
|
$folder_id = intval($_GET['folder_id']);
|
||||||
@@ -14,119 +13,49 @@ if (!empty($_GET['folder_id'])) {
|
|||||||
$folder_id = 0;
|
$folder_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Rebuild URL
|
// Folder ID (used in forms/etc)
|
||||||
$url_query_strings_sort = http_build_query($get_copy);
|
$get_folder_id = $folder_id;
|
||||||
|
|
||||||
// Folder ID
|
// View Mode -- 0 List, 1 Thumbnail (thumbnail = files only)
|
||||||
$get_folder_id = 0;
|
|
||||||
if (!empty($_GET['folder_id'])) {
|
|
||||||
$get_folder_id = intval($_GET['folder_id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// View Mode -- 0 List, 1 Thumbnail
|
|
||||||
if (!empty($_GET['view'])) {
|
if (!empty($_GET['view'])) {
|
||||||
$view = intval($_GET['view']);
|
$view = intval($_GET['view']);
|
||||||
} else {
|
} else {
|
||||||
$view = 0;
|
$view = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($view == 1) {
|
if (!isset($q)) {
|
||||||
$query_images = "AND (file_ext LIKE 'JPG' OR file_ext LIKE 'jpg' OR file_ext LIKE 'JPEG' OR file_ext LIKE 'jpeg' OR file_ext LIKE 'png' OR file_ext LIKE 'PNG' OR file_ext LIKE 'webp' OR file_ext LIKE 'WEBP')";
|
$q = '';
|
||||||
} else {
|
|
||||||
$query_images = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set Folder Location Var used when creating folders
|
// ---------------------------------------------
|
||||||
$folder_location = 1;
|
// Breadcrumbs: build full folder path
|
||||||
|
// ---------------------------------------------
|
||||||
|
$folder_path = [];
|
||||||
|
$breadcrumb_folder_id = $get_folder_id;
|
||||||
|
|
||||||
if ($get_folder_id == 0 && isset($_GET["q"])) {
|
while ($breadcrumb_folder_id > 0) {
|
||||||
$sql = mysqli_query(
|
$sql_folder = mysqli_query($mysqli, "SELECT folder_name, parent_folder FROM folders WHERE folder_id = $breadcrumb_folder_id AND folder_client_id = $client_id");
|
||||||
$mysqli,
|
|
||||||
"SELECT SQL_CALC_FOUND_ROWS * FROM files
|
|
||||||
LEFT JOIN users ON file_created_by = user_id
|
|
||||||
WHERE file_client_id = $client_id
|
|
||||||
AND file_archived_at IS NULL
|
|
||||||
AND (file_name LIKE '%$q%' OR file_ext LIKE '%$q%' OR file_description LIKE '%$q%')
|
|
||||||
$query_images
|
|
||||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
|
||||||
);
|
|
||||||
}else{
|
|
||||||
$sql = mysqli_query(
|
|
||||||
$mysqli,
|
|
||||||
"SELECT SQL_CALC_FOUND_ROWS * FROM files
|
|
||||||
LEFT JOIN users ON file_created_by = user_id
|
|
||||||
WHERE file_client_id = $client_id
|
|
||||||
AND file_folder_id = $folder_id
|
|
||||||
AND file_archived_at IS NULL
|
|
||||||
AND (file_name LIKE '%$q%' OR file_ext LIKE '%$q%' OR file_description LIKE '%$q%')
|
|
||||||
$query_images
|
|
||||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|
||||||
|
|
||||||
$num_of_files = mysqli_num_rows($sql);
|
|
||||||
|
|
||||||
// Breadcrumbs
|
|
||||||
// Build the full folder path
|
|
||||||
$folder_id = $get_folder_id;
|
|
||||||
$folder_path = array();
|
|
||||||
|
|
||||||
while ($folder_id > 0) {
|
|
||||||
$sql_folder = mysqli_query($mysqli, "SELECT folder_name, parent_folder FROM folders WHERE folder_id = $folder_id");
|
|
||||||
if ($row_folder = mysqli_fetch_assoc($sql_folder)) {
|
if ($row_folder = mysqli_fetch_assoc($sql_folder)) {
|
||||||
$folder_name = nullable_htmlentities($row_folder['folder_name']);
|
$folder_name = nullable_htmlentities($row_folder['folder_name']);
|
||||||
$parent_folder = intval($row_folder['parent_folder']);
|
$parent_folder = intval($row_folder['parent_folder']);
|
||||||
|
|
||||||
// Prepend the folder to the beginning of the array
|
array_unshift($folder_path, [
|
||||||
array_unshift($folder_path, array('folder_id' => $folder_id, 'folder_name' => $folder_name));
|
'folder_id' => $breadcrumb_folder_id,
|
||||||
|
'folder_name' => $folder_name
|
||||||
|
]);
|
||||||
|
|
||||||
// Move up to the parent folder
|
$breadcrumb_folder_id = $parent_folder;
|
||||||
$folder_id = $parent_folder;
|
|
||||||
} else {
|
} else {
|
||||||
// If the folder is not found, break the loop
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
// ---------------------------------------------
|
||||||
|
// Helper: unified folder tree (no folder_location)
|
||||||
<div class="card card-dark">
|
// ---------------------------------------------
|
||||||
|
|
||||||
<div class="card-header py-2">
|
|
||||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-paperclip mr-2"></i>Files</h3>
|
|
||||||
|
|
||||||
<div class="card-tools">
|
|
||||||
<div class="btn-group">
|
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#uploadFilesModal">
|
|
||||||
<i class="fas fa-fw fa-cloud-upload-alt mr-2"></i>Upload
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
|
||||||
<div class="dropdown-menu">
|
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#createFolderModal">
|
|
||||||
<i class="fa fa-fw fa-folder-plus mr-2"></i>New Folder
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-3 border-right mb-3">
|
|
||||||
<h4>Folders</h4>
|
|
||||||
<hr>
|
|
||||||
<ul class="nav nav-pills flex-column bg-light">
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link <?php if ($get_folder_id == 0) { echo "active"; } ?>" href="?client_id=<?php echo $client_id; ?>&folder_id=0">/</a>
|
|
||||||
</li>
|
|
||||||
<?php
|
|
||||||
// Function to check if a folder is an ancestor of the current folder
|
|
||||||
function is_ancestor_folder($folder_id, $current_folder_id, $client_id) {
|
function is_ancestor_folder($folder_id, $current_folder_id, $client_id) {
|
||||||
global $mysqli;
|
global $mysqli;
|
||||||
|
|
||||||
// Base case: if current_folder_id is 0 or equal to folder_id
|
|
||||||
if ($current_folder_id == 0) {
|
if ($current_folder_id == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -134,32 +63,34 @@ while ($folder_id > 0) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the parent folder of the current folder
|
|
||||||
$result = mysqli_query($mysqli, "SELECT parent_folder FROM folders WHERE folder_id = $current_folder_id AND folder_client_id = $client_id");
|
$result = mysqli_query($mysqli, "SELECT parent_folder FROM folders WHERE folder_id = $current_folder_id AND folder_client_id = $client_id");
|
||||||
if ($row = mysqli_fetch_assoc($result)) {
|
if ($row = mysqli_fetch_assoc($result)) {
|
||||||
$parent_folder_id = intval($row['parent_folder']);
|
$parent_folder_id = intval($row['parent_folder']);
|
||||||
// Recursive call to check the parent folder
|
|
||||||
return is_ancestor_folder($folder_id, $parent_folder_id, $client_id);
|
return is_ancestor_folder($folder_id, $parent_folder_id, $client_id);
|
||||||
} else {
|
} else {
|
||||||
// Folder not found
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recursive function to display folders and subfolders
|
|
||||||
function display_folders($parent_folder_id, $client_id, $indent = 0) {
|
function display_folders($parent_folder_id, $client_id, $indent = 0) {
|
||||||
global $mysqli, $get_folder_id, $session_user_role;
|
global $mysqli, $get_folder_id, $session_user_role;
|
||||||
|
|
||||||
$sql_folders = mysqli_query($mysqli, "SELECT * FROM folders WHERE parent_folder = $parent_folder_id AND folder_location = 1 AND folder_client_id = $client_id ORDER BY folder_name ASC");
|
$sql_folders = mysqli_query($mysqli, "SELECT * FROM folders WHERE parent_folder = $parent_folder_id AND folder_client_id = $client_id ORDER BY folder_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql_folders)) {
|
while ($row = mysqli_fetch_array($sql_folders)) {
|
||||||
$folder_id = intval($row['folder_id']);
|
$folder_id = intval($row['folder_id']);
|
||||||
$folder_name = nullable_htmlentities($row['folder_name']);
|
$folder_name = nullable_htmlentities($row['folder_name']);
|
||||||
|
|
||||||
// Get the number of files in the folder
|
// Count files in folder
|
||||||
$row2 = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('file_id') AS num FROM files WHERE file_folder_id = $folder_id AND file_archived_at IS NULL"));
|
$row_files = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('file_id') AS num FROM files WHERE file_folder_id = $folder_id AND file_client_id = $client_id AND file_archived_at IS NULL"));
|
||||||
$num_files = intval($row2['num']);
|
$num_files = intval($row_files['num']);
|
||||||
|
|
||||||
// Get the number of subfolders
|
// Count documents in folder
|
||||||
|
$row_docs = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('document_id') AS num FROM documents WHERE document_folder_id = $folder_id AND document_client_id = $client_id AND document_archived_at IS NULL"));
|
||||||
|
$num_docs = intval($row_docs['num']);
|
||||||
|
|
||||||
|
$num_total = $num_files + $num_docs;
|
||||||
|
|
||||||
|
// Count subfolders
|
||||||
$subfolder_result = mysqli_query($mysqli, "SELECT COUNT(*) AS count FROM folders WHERE parent_folder = $folder_id AND folder_client_id = $client_id");
|
$subfolder_result = mysqli_query($mysqli, "SELECT COUNT(*) AS count FROM folders WHERE parent_folder = $folder_id AND folder_client_id = $client_id");
|
||||||
$subfolder_count = intval(mysqli_fetch_assoc($subfolder_result)['count']);
|
$subfolder_count = intval(mysqli_fetch_assoc($subfolder_result)['count']);
|
||||||
|
|
||||||
@@ -170,10 +101,8 @@ while ($folder_id > 0) {
|
|||||||
if ($get_folder_id == $folder_id) { echo "active"; }
|
if ($get_folder_id == $folder_id) { echo "active"; }
|
||||||
echo '" href="?client_id=' . $client_id . '&folder_id=' . $folder_id . '">';
|
echo '" href="?client_id=' . $client_id . '&folder_id=' . $folder_id . '">';
|
||||||
|
|
||||||
// Indentation for subfolders
|
|
||||||
echo str_repeat(' ', $indent * 4);
|
echo str_repeat(' ', $indent * 4);
|
||||||
|
|
||||||
// Determine if the folder is open
|
|
||||||
if ($get_folder_id == $folder_id || is_ancestor_folder($folder_id, $get_folder_id, $client_id)) {
|
if ($get_folder_id == $folder_id || is_ancestor_folder($folder_id, $get_folder_id, $client_id)) {
|
||||||
echo '<i class="fas fa-fw fa-folder-open"></i>';
|
echo '<i class="fas fa-fw fa-folder-open"></i>';
|
||||||
} else {
|
} else {
|
||||||
@@ -182,8 +111,8 @@ while ($folder_id > 0) {
|
|||||||
|
|
||||||
echo ' ' . $folder_name;
|
echo ' ' . $folder_name;
|
||||||
|
|
||||||
if ($num_files > 0) {
|
if ($num_total > 0) {
|
||||||
echo "<span class='badge badge-pill badge-dark float-right mt-1'>$num_files</span>";
|
echo "<span class='badge badge-pill badge-dark float-right mt-1'>$num_total</span>";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</a>';
|
echo '</a>';
|
||||||
@@ -200,8 +129,8 @@ while ($folder_id > 0) {
|
|||||||
<i class="fas fa-fw fa-edit mr-2"></i>Rename
|
<i class="fas fa-fw fa-edit mr-2"></i>Rename
|
||||||
</a>
|
</a>
|
||||||
<?php
|
<?php
|
||||||
// Only show delete option if user is admin, folder has no files, and no subfolders
|
// Only show delete if admin and no contents and no subfolders
|
||||||
if ($session_user_role == 3 && $num_files == 0 && $subfolder_count == 0) { ?>
|
if ($session_user_role == 3 && $num_total == 0 && $subfolder_count == 0) { ?>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_folder=<?php echo $folder_id; ?>">
|
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_folder=<?php echo $folder_id; ?>">
|
||||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||||
@@ -214,7 +143,6 @@ while ($folder_id > 0) {
|
|||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
if ($subfolder_count > 0) {
|
if ($subfolder_count > 0) {
|
||||||
// Display subfolders
|
|
||||||
echo '<ul class="nav nav-pills flex-column bg-light">';
|
echo '<ul class="nav nav-pills flex-column bg-light">';
|
||||||
display_folders($folder_id, $client_id, $indent + 1);
|
display_folders($folder_id, $client_id, $indent + 1);
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
@@ -224,16 +152,277 @@ while ($folder_id > 0) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start displaying folders from the root (parent_folder = 0)
|
// ---------------------------------------------
|
||||||
|
// DATA LOAD
|
||||||
|
// view=1 (thumbs) uses original files-only query
|
||||||
|
// view=0 (list) loads ALL files+documents, merges, sorts in PHP
|
||||||
|
// ---------------------------------------------
|
||||||
|
|
||||||
|
$items = [];
|
||||||
|
$num_rows = [0];
|
||||||
|
|
||||||
|
if ($view == 1) {
|
||||||
|
|
||||||
|
// Thumbnail view - only image files, similar to original behavior
|
||||||
|
$query_images = "AND (file_ext LIKE 'JPG' OR file_ext LIKE 'jpg' OR file_ext LIKE 'JPEG' OR file_ext LIKE 'jpeg' OR file_ext LIKE 'png' OR file_ext LIKE 'PNG' OR file_ext LIKE 'webp' OR file_ext LIKE 'WEBP')";
|
||||||
|
|
||||||
|
if ($get_folder_id == 0 && isset($_GET["q"])) {
|
||||||
|
$sql = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT SQL_CALC_FOUND_ROWS * FROM files
|
||||||
|
LEFT JOIN users ON file_created_by = user_id
|
||||||
|
WHERE file_client_id = $client_id
|
||||||
|
AND file_archived_at IS NULL
|
||||||
|
AND (file_name LIKE '%$q%' OR file_ext LIKE '%$q%' OR file_description LIKE '%$q%')
|
||||||
|
$query_images
|
||||||
|
ORDER BY file_name ASC
|
||||||
|
LIMIT $record_from, $record_to"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$sql = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT SQL_CALC_FOUND_ROWS * FROM files
|
||||||
|
LEFT JOIN users ON file_created_by = user_id
|
||||||
|
WHERE file_client_id = $client_id
|
||||||
|
AND file_folder_id = $folder_id
|
||||||
|
AND file_archived_at IS NULL
|
||||||
|
AND (file_name LIKE '%$q%' OR file_ext LIKE '%$q%' OR file_description LIKE '%$q%')
|
||||||
|
$query_images
|
||||||
|
ORDER BY file_name ASC
|
||||||
|
LIMIT $record_from, $record_to"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// -------- LIST VIEW: build unified items[] --------
|
||||||
|
|
||||||
|
// Folder filter
|
||||||
|
if ($get_folder_id == 0 && isset($_GET["q"])) {
|
||||||
|
$file_folder_snippet = ""; // search across all folders
|
||||||
|
$doc_folder_snippet = "";
|
||||||
|
} else {
|
||||||
|
$file_folder_snippet = "AND file_folder_id = $folder_id";
|
||||||
|
$doc_folder_snippet = "AND document_folder_id = $folder_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search filters
|
||||||
|
$safe_q = mysqli_real_escape_string($mysqli, $q);
|
||||||
|
|
||||||
|
$file_search_snippet = "";
|
||||||
|
if (!empty($q)) {
|
||||||
|
$file_search_snippet = "AND (file_name LIKE '%$safe_q%' OR file_ext LIKE '%$safe_q%' OR file_description LIKE '%$safe_q%')";
|
||||||
|
}
|
||||||
|
|
||||||
|
$doc_search_snippet = "";
|
||||||
|
if (!empty($q)) {
|
||||||
|
$doc_search_snippet = "AND (MATCH(document_content_raw) AGAINST ('$safe_q') OR document_name LIKE '%$safe_q%')";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Files query (NO limit - we'll paginate in PHP)
|
||||||
|
$sql_files = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT files.*, users.user_name
|
||||||
|
FROM files
|
||||||
|
LEFT JOIN users ON file_created_by = user_id
|
||||||
|
WHERE file_client_id = $client_id
|
||||||
|
AND file_archived_at IS NULL
|
||||||
|
$file_folder_snippet
|
||||||
|
$file_search_snippet"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Documents query (NO limit - paginate in PHP)
|
||||||
|
$sql_documents = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT documents.*, users.user_name
|
||||||
|
FROM documents
|
||||||
|
LEFT JOIN users ON document_created_by = user_id
|
||||||
|
WHERE document_client_id = $client_id
|
||||||
|
AND document_archived_at IS NULL
|
||||||
|
$doc_folder_snippet
|
||||||
|
$doc_search_snippet"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Normalize FILES into $items
|
||||||
|
while ($row = mysqli_fetch_assoc($sql_files)) {
|
||||||
|
$file_id = intval($row['file_id']);
|
||||||
|
$file_name = nullable_htmlentities($row['file_name']);
|
||||||
|
$file_description = nullable_htmlentities($row['file_description']);
|
||||||
|
$file_reference_name= nullable_htmlentities($row['file_reference_name']);
|
||||||
|
$file_ext = nullable_htmlentities($row['file_ext']);
|
||||||
|
$file_size = intval($row['file_size']);
|
||||||
|
$file_mime_type = nullable_htmlentities($row['file_mime_type']);
|
||||||
|
$file_uploaded_by = nullable_htmlentities($row['user_name']);
|
||||||
|
$file_created_at = nullable_htmlentities($row['file_created_at']);
|
||||||
|
|
||||||
|
// determine icon
|
||||||
|
if ($file_ext == 'pdf') {
|
||||||
|
$file_icon = "file-pdf";
|
||||||
|
} elseif (in_array($file_ext, ['gz','tar','zip','7z','rar'])) {
|
||||||
|
$file_icon = "file-archive";
|
||||||
|
} elseif (in_array($file_ext, ['txt','md'])) {
|
||||||
|
$file_icon = "file-alt";
|
||||||
|
} elseif ($file_ext == 'msg') {
|
||||||
|
$file_icon = "envelope";
|
||||||
|
} elseif (in_array($file_ext, ['doc','docx','odt'])) {
|
||||||
|
$file_icon = "file-word";
|
||||||
|
} elseif (in_array($file_ext, ['xls','xlsx','ods'])) {
|
||||||
|
$file_icon = "file-excel";
|
||||||
|
} elseif (in_array($file_ext, ['pptx','odp'])) {
|
||||||
|
$file_icon = "file-powerpoint";
|
||||||
|
} elseif (in_array($file_ext, ['mp3','wav','ogg'])) {
|
||||||
|
$file_icon = "file-audio";
|
||||||
|
} elseif (in_array($file_ext, ['mov','mp4','av1'])) {
|
||||||
|
$file_icon = "file-video";
|
||||||
|
} elseif (in_array($file_ext, ['jpg','jpeg','png','gif','webp','bmp','tif'])) {
|
||||||
|
$file_icon = "file-image";
|
||||||
|
} else {
|
||||||
|
$file_icon = "file";
|
||||||
|
}
|
||||||
|
|
||||||
|
$items[] = [
|
||||||
|
'kind' => 'file',
|
||||||
|
'id' => $file_id,
|
||||||
|
'name' => $file_name,
|
||||||
|
'description' => $file_description,
|
||||||
|
'reference_name' => $file_reference_name,
|
||||||
|
'icon' => $file_icon,
|
||||||
|
'mime' => $file_mime_type,
|
||||||
|
'size' => $file_size,
|
||||||
|
'created_at' => $file_created_at,
|
||||||
|
'created_by' => $file_uploaded_by,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Normalize DOCUMENTS into $items
|
||||||
|
while ($row = mysqli_fetch_assoc($sql_documents)) {
|
||||||
|
$document_id = intval($row['document_id']);
|
||||||
|
$document_name = nullable_htmlentities($row['document_name']);
|
||||||
|
$document_description = nullable_htmlentities($row['document_description']);
|
||||||
|
$document_created_by_name = nullable_htmlentities($row['user_name']);
|
||||||
|
$document_created_at = $row['document_created_at'];
|
||||||
|
|
||||||
|
$items[] = [
|
||||||
|
'kind' => 'document',
|
||||||
|
'id' => $document_id,
|
||||||
|
'name' => $document_name,
|
||||||
|
'description' => $document_description,
|
||||||
|
'mime' => 'Document',
|
||||||
|
'size' => null,
|
||||||
|
'created_at' => $document_created_at,
|
||||||
|
'created_by' => $document_created_by_name,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort combined items
|
||||||
|
$sort = isset($_GET['sort']) ? $_GET['sort'] : 'name';
|
||||||
|
$order = isset($_GET['order']) ? $_GET['order'] : 'ASC';
|
||||||
|
|
||||||
|
usort($items, function($a, $b) use ($sort, $order) {
|
||||||
|
$direction = ($order === 'DESC') ? -1 : 1;
|
||||||
|
|
||||||
|
if ($sort == 'created') {
|
||||||
|
$valA = strtotime($a['created_at']);
|
||||||
|
$valB = strtotime($b['created_at']);
|
||||||
|
} elseif ($sort == 'type') {
|
||||||
|
$valA = strtolower($a['mime']);
|
||||||
|
$valB = strtolower($b['mime']);
|
||||||
|
} elseif ($sort == 'size') {
|
||||||
|
$valA = (int)($a['size'] ?? 0);
|
||||||
|
$valB = (int)($b['size'] ?? 0);
|
||||||
|
} else {
|
||||||
|
// default: name
|
||||||
|
$valA = strtolower($a['name']);
|
||||||
|
$valB = strtolower($b['name']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($valA == $valB) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ($valA < $valB) ? -1 * $direction : 1 * $direction;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Total items (for pagination footer)
|
||||||
|
$total_items = count($items);
|
||||||
|
$num_rows = [$total_items];
|
||||||
|
|
||||||
|
// Apply pagination slice
|
||||||
|
$items = array_slice($items, $record_from, $record_to);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------
|
||||||
|
// Root folder count (for "/" badge)
|
||||||
|
// ---------------------------------------------
|
||||||
|
$row_root_files = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('file_id') AS num FROM files WHERE file_folder_id = 0 AND file_client_id = $client_id AND file_archived_at IS NULL"));
|
||||||
|
$row_root_docs = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('document_id') AS num FROM documents WHERE document_folder_id = 0 AND document_client_id = $client_id AND document_archived_at IS NULL"));
|
||||||
|
$num_root_items = intval($row_root_files['num']) + intval($row_root_docs['num']);
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="card card-dark">
|
||||||
|
|
||||||
|
<div class="card-header py-2">
|
||||||
|
<h3 class="card-title mt-2"><i class="fa fa-fw fa-folder mr-2"></i>Files</h3>
|
||||||
|
|
||||||
|
<div class="card-tools">
|
||||||
|
|
||||||
|
<div class="btn-group">
|
||||||
|
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
|
||||||
|
<i class="fas fa-fw fa-plus mr-2"></i>New
|
||||||
|
</button>
|
||||||
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/file/file_upload.php?client_id=<?= $client_id ?>&folder_id=<?= $get_folder_id ?>">
|
||||||
|
<i class="fas fa-fw fa-cloud-upload-alt mr-2"></i>Upload File
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/document/document_add.php?client_id=<?= $client_id ?>&folder_id=<?= $get_folder_id ?>"
|
||||||
|
data-modal-size="lg">
|
||||||
|
<i class="fas fa-fw fa-file-alt mr-2"></i>Document
|
||||||
|
</a>
|
||||||
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/document/document_add_from_template.php?client_id=<?= $client_id ?>&folder_id=<?= $get_folder_id ?>">
|
||||||
|
<i class="fas fa-fw fa-file mr-2"></i>Document from Template
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/folder/folder_add.php?client_id=<?= $client_id ?>¤t_folder_id=<?= $get_folder_id ?>">
|
||||||
|
<i class="fa fa-fw fa-folder-plus mr-2"></i>Folder
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<!-- Folders -->
|
||||||
|
<div class="col-md-3 border-right mb-3">
|
||||||
|
<h4>Folders</h4>
|
||||||
|
<hr>
|
||||||
|
<ul class="nav nav-pills flex-column bg-light">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link <?php if ($get_folder_id == 0) { echo "active"; } ?>"
|
||||||
|
href="?client_id=<?php echo $client_id; ?>&folder_id=0">
|
||||||
|
/ <?php if ($num_root_items > 0) { echo "<span class='badge badge-pill badge-dark float-right mt-1'>$num_root_items</span>"; } ?>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<?php
|
||||||
|
// Start folder tree from root
|
||||||
display_folders(0, $client_id);
|
display_folders(0, $client_id);
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
<?php require_once "modals/folder/folder_add.php"; ?>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Main content -->
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
|
|
||||||
|
<!-- Search + view toggle -->
|
||||||
<form autocomplete="off">
|
<form autocomplete="off">
|
||||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||||
<input type="hidden" name="view" value="<?php echo $view; ?>">
|
<input type="hidden" name="view" value="<?php echo $view; ?>">
|
||||||
@@ -241,7 +430,9 @@ while ($folder_id > 0) {
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-5">
|
<div class="col-md-5">
|
||||||
<div class="input-group mb-3 mb-md-0">
|
<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 for files in <?php if($get_folder_id == 0) { echo "all folders"; } else { echo "current folder"; } ?>">
|
<input type="search" class="form-control" name="q"
|
||||||
|
value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>"
|
||||||
|
placeholder="Search files and documents in <?php echo ($get_folder_id == 0 ? 'all folders' : 'current folder'); ?>">
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
|
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
|
||||||
</div>
|
</div>
|
||||||
@@ -249,21 +440,23 @@ while ($folder_id > 0) {
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-7">
|
<div class="col-md-7">
|
||||||
<div class="btn-group float-right">
|
<div class="btn-group float-right">
|
||||||
<a href="?<?php echo $url_query_strings_sort; ?>&view=0" class="btn <?php if($view == 0){ echo "btn-primary"; } else { echo "btn-outline-secondary"; } ?>"><i class="fas fa-list-ul"></i></a>
|
<a href="?<?php echo $url_query_strings_sort; ?>&view=0&folder_id=<?php echo $get_folder_id; ?>" class="btn <?php if($view == 0){ echo "btn-primary"; } else { echo "btn-outline-secondary"; } ?>"><i class="fas fa-list-ul"></i></a>
|
||||||
<a href="?<?php echo $url_query_strings_sort; ?>&view=1" class="btn <?php if($view == 1){ echo "btn-primary"; } else { echo "btn-outline-secondary"; } ?>"><i class="fas fa-th-large"></i></a>
|
<a href="?<?php echo $url_query_strings_sort; ?>&view=1&folder_id=<?php echo $get_folder_id; ?>" class="btn <?php if($view == 1){ echo "btn-primary"; } else { echo "btn-outline-secondary"; } ?>"><i class="fas fa-th-large"></i></a>
|
||||||
|
|
||||||
<div class="dropdown ml-2" id="bulkActionButton" hidden>
|
<div class="dropdown ml-2" id="bulkActionButton" hidden>
|
||||||
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown">
|
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown">
|
||||||
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>)
|
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>)
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkMoveFilesModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
<i class="fas fa-fw fa-exchange-alt mr-2"></i>Move
|
data-modal-url="modals/file/file_bulk_move.php?client_id=<?= $client_id ?>¤t_folder_id=<?= $get_folder_id ?>"
|
||||||
|
data-bulk="true">
|
||||||
|
<i class="fas fa-fw fa-exchange-alt mr-2"></i>Move Files
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<button class="dropdown-item text-danger text-bold"
|
<button class="dropdown-item text-danger text-bold"
|
||||||
type="submit" form="bulkActions" name="bulk_delete_files">
|
type="submit" form="bulkActions" name="bulk_delete_files">
|
||||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
<i class="fas fa-fw fa-trash mr-2"></i>Delete Files
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -273,6 +466,7 @@ while ($folder_id > 0) {
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<!-- Breadcrumb -->
|
||||||
<nav class="mt-3">
|
<nav class="mt-3">
|
||||||
<ol class="breadcrumb">
|
<ol class="breadcrumb">
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
@@ -280,34 +474,24 @@ while ($folder_id > 0) {
|
|||||||
<i class="fas fa-fw fa-folder mr-2"></i>Root
|
<i class="fas fa-fw fa-folder mr-2"></i>Root
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php
|
<?php foreach ($folder_path as $folder) {
|
||||||
// Output breadcrumb items for each folder in the path
|
$bread_crumb_folder_id = $folder['folder_id'];
|
||||||
foreach ($folder_path as $folder) {
|
$bread_crumb_folder_name = $folder['folder_name']; ?>
|
||||||
$bread_crumb_folder_id = $folder['folder_id']; // Already Sanitized before it was pushed into array
|
|
||||||
$bread_crumb_folder_name = $folder['folder_name']; // Already Sanitized before it was pushed into array
|
|
||||||
|
|
||||||
?>
|
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $bread_crumb_folder_id; ?>">
|
<a href="?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $bread_crumb_folder_id; ?>">
|
||||||
<i class="fas fa-fw fa-folder-open mr-2"></i><?php echo $bread_crumb_folder_name; ?>
|
<i class="fas fa-fw fa-folder-open mr-2"></i><?php echo $bread_crumb_folder_name; ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php
|
<?php } ?>
|
||||||
}
|
|
||||||
?>
|
|
||||||
</ol>
|
</ol>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<?php
|
<?php if ($view == 1) { ?>
|
||||||
|
|
||||||
if($view == 1){
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
<!-- THUMBNAIL VIEW (files only) -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$files = [];
|
$files = [];
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
@@ -320,23 +504,20 @@ while ($folder_id > 0) {
|
|||||||
$file_mime_type = nullable_htmlentities($row['file_mime_type']);
|
$file_mime_type = nullable_htmlentities($row['file_mime_type']);
|
||||||
$file_uploaded_by = nullable_htmlentities($row['user_name']);
|
$file_uploaded_by = nullable_htmlentities($row['user_name']);
|
||||||
|
|
||||||
// Store file data into an array for JS
|
|
||||||
$files[] = [
|
$files[] = [
|
||||||
'id' => $file_id,
|
'id' => $file_id,
|
||||||
'name' => $file_name,
|
'name' => $file_name,
|
||||||
'preview' => "../uploads/clients/$client_id/$file_reference_name"
|
'preview' => "../uploads/clients/$client_id/$file_reference_name"
|
||||||
];
|
];
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="col-xl-2 col-lg-2 col-md-6 col-sm-6 mb-3 text-center">
|
<div class="col-xl-2 col-lg-2 col-md-6 col-sm-6 mb-3 text-center">
|
||||||
|
|
||||||
<a href="#" onclick="openModal(<?php echo count($files)-1; ?>)"><!-- passing the index -->
|
<a href="#" onclick="openModal(<?php echo count($files)-1; ?>)">
|
||||||
<img class="img-thumbnail" src="<?php echo "../uploads/clients/$client_id/$file_reference_name"; ?>" alt="<?php echo $file_reference_name ?>">
|
<img class="img-thumbnail" src="<?php echo "../uploads/clients/$client_id/$file_reference_name"; ?>" alt="<?php echo $file_reference_name ?>">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<div class="dropdown float-right">
|
<div class="dropdown float-right">
|
||||||
<button class="btn btn-link btn-sm" type="button" data-toggle="dropdown">
|
<button class="btn btn-link btn-sm" type="button" data-toggle="dropdown">
|
||||||
<i class="fas fa-ellipsis-v"></i>
|
<i class="fas fa-ellipsis-v"></i>
|
||||||
@@ -377,24 +558,22 @@ while ($folder_id > 0) {
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
require "modals/file/file_view.php";
|
require "modals/file/file_view.php";
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<script>
|
<script>
|
||||||
// Pass PHP array to JavaScript
|
|
||||||
var files = <?php echo json_encode($files); ?>;
|
var files = <?php echo json_encode($files); ?>;
|
||||||
var currentIndex = 0; // Keep track of which file is displayed
|
var currentIndex = 0;
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
|
|
||||||
|
<!-- LIST VIEW: unified Files + Documents -->
|
||||||
<form id="bulkActions" action="post.php" method="post">
|
<form id="bulkActions" 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="table-responsive-sm">
|
<div class="table-responsive-sm">
|
||||||
<table class="table border">
|
<table class="table border">
|
||||||
|
|
||||||
<thead class="thead-light <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
<thead class="thead-light <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="bg-light pr-0">
|
<td class="bg-light pr-0">
|
||||||
@@ -403,23 +582,23 @@ while ($folder_id > 0) {
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<th>
|
<th>
|
||||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=file_name&order=<?php echo $disp; ?>">
|
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=name&order=<?php echo $disp; ?>">
|
||||||
Name <?php if ($sort == 'file_name') { echo $order_icon; } ?>
|
Name <?php if ($sort == 'name') { echo $order_icon; } ?>
|
||||||
</a>
|
</a>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=file_mime_type&order=<?php echo $disp; ?>">
|
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=type&order=<?php echo $disp; ?>">
|
||||||
Type <?php if ($sort == 'file_mime_type') { echo $order_icon; } ?>
|
Type <?php if ($sort == 'type') { echo $order_icon; } ?>
|
||||||
</a>
|
</a>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=file_size&order=<?php echo $disp; ?>">
|
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=size&order=<?php echo $disp; ?>">
|
||||||
Size <?php if ($sort == 'file_size') { echo $order_icon; } ?>
|
Size <?php if ($sort == 'size') { echo $order_icon; } ?>
|
||||||
</a>
|
</a>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=file_created_at&order=<?php echo $disp; ?>">
|
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=created&order=<?php echo $disp; ?>">
|
||||||
Uploaded <?php if ($sort == 'file_created_at') { echo $order_icon; } ?>
|
Uploaded <?php if ($sort == 'created') { echo $order_icon; } ?>
|
||||||
</a>
|
</a>
|
||||||
</th>
|
</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
@@ -428,46 +607,22 @@ while ($folder_id > 0) {
|
|||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
foreach ($items as $item) {
|
||||||
$file_id = intval($row['file_id']);
|
|
||||||
$file_name = nullable_htmlentities($row['file_name']);
|
|
||||||
$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_size = intval($row['file_size']);
|
|
||||||
$file_size_KB = number_format($file_size / 1024);
|
|
||||||
$file_mime_type = nullable_htmlentities($row['file_mime_type']);
|
|
||||||
$file_size = intval($row['file_size']);
|
|
||||||
$file_uploaded_by = nullable_htmlentities($row['user_name']);
|
|
||||||
$file_created_at = nullable_htmlentities($row['file_created_at']);
|
|
||||||
$file_folder_id = intval($row['file_folder_id']);
|
|
||||||
|
|
||||||
// Check if shared
|
if ($item['kind'] === 'file') {
|
||||||
|
$file_id = $item['id'];
|
||||||
|
$file_name = $item['name'];
|
||||||
|
$file_description = $item['description'];
|
||||||
|
$file_reference_name= $item['reference_name'];
|
||||||
|
$file_icon = $item['icon'];
|
||||||
|
$file_size = $item['size'];
|
||||||
|
$file_size_KB = $file_size ? number_format($file_size / 1024) : 0;
|
||||||
|
$file_mime_type = $item['mime'];
|
||||||
|
$file_uploaded_by = $item['created_by'];
|
||||||
|
$file_created_at = $item['created_at'];
|
||||||
|
|
||||||
|
// Shared?
|
||||||
$sql_shared = mysqli_query(
|
$sql_shared = mysqli_query(
|
||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT * FROM shared_items
|
"SELECT * FROM shared_items
|
||||||
@@ -479,25 +634,13 @@ while ($folder_id > 0) {
|
|||||||
AND item_related_id = $file_id
|
AND item_related_id = $file_id
|
||||||
LIMIT 1"
|
LIMIT 1"
|
||||||
);
|
);
|
||||||
$file_shared = (mysqli_num_rows($sql_shared) > 0) ? true : false;
|
$file_shared = (mysqli_num_rows($sql_shared) > 0);
|
||||||
if ($file_shared) {
|
if ($file_shared) {
|
||||||
$row = mysqli_fetch_array($sql_shared);
|
$row_shared = mysqli_fetch_array($sql_shared);
|
||||||
$item_id = intval($row['item_id']);
|
$item_recipient = nullable_htmlentities($row_shared['item_recipient']);
|
||||||
$item_active = nullable_htmlentities($row['item_active']);
|
$item_expire_at_human = timeAgo($row_shared['item_expire_at']);
|
||||||
$item_key = nullable_htmlentities($row['item_key']);
|
|
||||||
$item_type = nullable_htmlentities($row['item_type']);
|
|
||||||
$item_related_id = intval($row['item_related_id']);
|
|
||||||
$item_note = nullable_htmlentities($row['item_note']);
|
|
||||||
$item_recipient = nullable_htmlentities($row['item_recipient']);
|
|
||||||
$item_views = nullable_htmlentities($row['item_views']);
|
|
||||||
$item_view_limit = nullable_htmlentities($row['item_view_limit']);
|
|
||||||
$item_created_at = nullable_htmlentities($row['item_created_at']);
|
|
||||||
$item_expire_at = nullable_htmlentities($row['item_expire_at']);
|
|
||||||
$item_expire_at_human = timeAgo($row['item_expire_at']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="bg-light pr-0">
|
<td class="bg-light pr-0">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
@@ -575,19 +718,125 @@ while ($folder_id > 0) {
|
|||||||
<?php
|
<?php
|
||||||
require "modals/file/file_link_asset.php";
|
require "modals/file/file_link_asset.php";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// DOCUMENT ROW
|
||||||
|
$document_id = $item['id'];
|
||||||
|
$document_name = $item['name'];
|
||||||
|
$document_description = $item['description'];
|
||||||
|
$document_created_by_name = $item['created_by'];
|
||||||
|
$document_created_at = date("m/d/Y", strtotime($item['created_at']));
|
||||||
|
|
||||||
|
$sql_shared = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT * FROM shared_items
|
||||||
|
WHERE item_client_id = $client_id
|
||||||
|
AND item_active = 1
|
||||||
|
AND item_views != item_view_limit
|
||||||
|
AND item_expire_at > NOW()
|
||||||
|
AND item_type = 'Document'
|
||||||
|
AND item_related_id = $document_id
|
||||||
|
LIMIT 1"
|
||||||
|
);
|
||||||
|
$doc_shared = (mysqli_num_rows($sql_shared) > 0);
|
||||||
|
if ($doc_shared) {
|
||||||
|
$row_shared = mysqli_fetch_array($sql_shared);
|
||||||
|
$item_recipient = nullable_htmlentities($row_shared['item_recipient']);
|
||||||
|
$item_expire_at_human = timeAgo($row_shared['item_expire_at']);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td class="bg-light pr-0">
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input bulk-select" type="checkbox" name="document_ids[]" value="<?php echo $document_id ?>">
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="document_details.php?client_id=<?php echo $client_id; ?>&document_id=<?php echo $document_id; ?>">
|
||||||
|
<div class="media">
|
||||||
|
<i class="fa fa-fw fa-2x fa-file-alt text-dark mr-3"></i>
|
||||||
|
<div class="media-body">
|
||||||
|
<p>
|
||||||
|
<?php echo $document_name; ?>
|
||||||
|
<br>
|
||||||
|
<small class="text-secondary"><?php echo $document_description; ?></small>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>Document</td>
|
||||||
|
<td>-</td>
|
||||||
|
<td>
|
||||||
|
<?php echo $document_created_at; ?>
|
||||||
|
<div class="text-secondary mt-1"><?php echo $document_created_by_name; ?></div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php if ($doc_shared) { ?>
|
||||||
|
<div class="media" title="Expires <?php echo $item_expire_at_human; ?>">
|
||||||
|
<i class="fas fa-link mr-2 mt-1"></i>
|
||||||
|
<div class="media-body">Shared
|
||||||
|
<br>
|
||||||
|
<small class="text-secondary"><?php echo $item_recipient; ?></small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div class="dropdown dropleft text-center">
|
||||||
|
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
||||||
|
<i class="fas fa-ellipsis-h"></i>
|
||||||
|
</button>
|
||||||
|
<div class="dropdown-menu">
|
||||||
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-size="lg"
|
||||||
|
data-modal-url="modals/document/document_view.php?id=<?= $document_id ?>">
|
||||||
|
<i class="fas fa-fw fa-eye mr-2"></i>Quick View
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-size="lg"
|
||||||
|
data-modal-url="modals/document/document_edit.php?id=<?= $document_id ?>">
|
||||||
|
<i class="fas fa-fw fa-pencil-alt mr-2"></i>Edit
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#shareModal" onclick="populateShareModal(<?php echo "$client_id, 'Document', $document_id"; ?>)">
|
||||||
|
<i class="fas fa-fw fa-share mr-2"></i>Share
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/document/document_rename.php?id=<?= $document_id ?>">
|
||||||
|
<i class="fas fa-fw fa-pencil-alt mr-2"></i>Rename
|
||||||
|
</a>
|
||||||
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/document/document_move.php?id=<?= $document_id ?>">
|
||||||
|
<i class="fas fa-fw fa-exchange-alt mr-2"></i>Move
|
||||||
|
</a>
|
||||||
|
<?php if ($session_user_role == 3) { ?>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_document=<?php echo $document_id; ?>">
|
||||||
|
<i class="fas fa-fw fa-archive mr-2"></i>Archive
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_document=<?php echo $document_id; ?>">
|
||||||
|
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||||
|
</a>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?php require_once "modals/file/file_bulk_move.php"; ?>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php require_once "../includes/filter_footer.php";
|
<?php require_once "../includes/filter_footer.php"; ?>
|
||||||
?>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -607,12 +856,12 @@ function updateModalContent() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function nextFile() {
|
function nextFile() {
|
||||||
currentIndex = (currentIndex + 1) % files.length; // loop around
|
currentIndex = (currentIndex + 1) % files.length;
|
||||||
updateModalContent();
|
updateModalContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
function prevFile() {
|
function prevFile() {
|
||||||
currentIndex = (currentIndex - 1 + files.length) % files.length; // loop around
|
currentIndex = (currentIndex - 1 + files.length) % files.length;
|
||||||
updateModalContent();
|
updateModalContent();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -620,7 +869,7 @@ function prevFile() {
|
|||||||
<script src="../js/bulk_actions.js"></script>
|
<script src="../js/bulk_actions.js"></script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/file/file_upload.php";
|
|
||||||
require_once "modals/share_modal.php";
|
require_once "modals/share_modal.php";
|
||||||
require_once "modals/file/file_delete.php";
|
require_once "modals/file/file_delete.php";
|
||||||
|
//require_once "modals/document/document_add_from_template.php";
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
622
agent/files_legacy.php
Normal file
622
agent/files_legacy.php
Normal file
@@ -0,0 +1,622 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// Default Column Sortby Filter
|
||||||
|
$sort = "file_name";
|
||||||
|
$order = "ASC";
|
||||||
|
|
||||||
|
require_once "includes/inc_all_client.php";
|
||||||
|
|
||||||
|
|
||||||
|
// Folder
|
||||||
|
if (!empty($_GET['folder_id'])) {
|
||||||
|
$folder_id = intval($_GET['folder_id']);
|
||||||
|
} else {
|
||||||
|
$folder_id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Folder ID
|
||||||
|
$get_folder_id = 0;
|
||||||
|
if (!empty($_GET['folder_id'])) {
|
||||||
|
$get_folder_id = intval($_GET['folder_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// View Mode -- 0 List, 1 Thumbnail
|
||||||
|
if (!empty($_GET['view'])) {
|
||||||
|
$view = intval($_GET['view']);
|
||||||
|
} else {
|
||||||
|
$view = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($view == 1) {
|
||||||
|
$query_images = "AND (file_ext LIKE 'JPG' OR file_ext LIKE 'jpg' OR file_ext LIKE 'JPEG' OR file_ext LIKE 'jpeg' OR file_ext LIKE 'png' OR file_ext LIKE 'PNG' OR file_ext LIKE 'webp' OR file_ext LIKE 'WEBP')";
|
||||||
|
} else {
|
||||||
|
$query_images = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set Folder Location Var used when creating folders
|
||||||
|
$folder_location = 1;
|
||||||
|
|
||||||
|
if ($get_folder_id == 0 && isset($_GET["q"])) {
|
||||||
|
$sql = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT SQL_CALC_FOUND_ROWS * FROM files
|
||||||
|
LEFT JOIN users ON file_created_by = user_id
|
||||||
|
WHERE file_client_id = $client_id
|
||||||
|
AND file_archived_at IS NULL
|
||||||
|
AND (file_name LIKE '%$q%' OR file_ext LIKE '%$q%' OR file_description LIKE '%$q%')
|
||||||
|
$query_images
|
||||||
|
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||||
|
);
|
||||||
|
}else{
|
||||||
|
$sql = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT SQL_CALC_FOUND_ROWS * FROM files
|
||||||
|
LEFT JOIN users ON file_created_by = user_id
|
||||||
|
WHERE file_client_id = $client_id
|
||||||
|
AND file_folder_id = $folder_id
|
||||||
|
AND file_archived_at IS NULL
|
||||||
|
AND (file_name LIKE '%$q%' OR file_ext LIKE '%$q%' OR file_description LIKE '%$q%')
|
||||||
|
$query_images
|
||||||
|
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||||
|
|
||||||
|
$num_of_files = mysqli_num_rows($sql);
|
||||||
|
|
||||||
|
// Breadcrumbs
|
||||||
|
// Build the full folder path
|
||||||
|
$folder_id = $get_folder_id;
|
||||||
|
$folder_path = array();
|
||||||
|
|
||||||
|
while ($folder_id > 0) {
|
||||||
|
$sql_folder = mysqli_query($mysqli, "SELECT folder_name, parent_folder FROM folders WHERE folder_id = $folder_id");
|
||||||
|
if ($row_folder = mysqli_fetch_assoc($sql_folder)) {
|
||||||
|
$folder_name = nullable_htmlentities($row_folder['folder_name']);
|
||||||
|
$parent_folder = intval($row_folder['parent_folder']);
|
||||||
|
|
||||||
|
// Prepend the folder to the beginning of the array
|
||||||
|
array_unshift($folder_path, array('folder_id' => $folder_id, 'folder_name' => $folder_name));
|
||||||
|
|
||||||
|
// Move up to the parent folder
|
||||||
|
$folder_id = $parent_folder;
|
||||||
|
} else {
|
||||||
|
// If the folder is not found, break the loop
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="card card-dark">
|
||||||
|
|
||||||
|
<div class="card-header py-2">
|
||||||
|
<h3 class="card-title mt-2"><i class="fa fa-fw fa-paperclip mr-2"></i>Files</h3>
|
||||||
|
|
||||||
|
<div class="card-tools">
|
||||||
|
<div class="btn-group">
|
||||||
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/file/file_upload.php?client_id=<?= $client_id ?>&folder_id=<?= $get_folder_id ?>">
|
||||||
|
<i class="fas fa-fw fa-cloud-upload-alt mr-2"></i>Upload
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||||
|
<div class="dropdown-menu">
|
||||||
|
<a class="dropdown-item text-dark ajax-modal" href="#" data-modal-url="modals/folder/folder_add.php?client_id=<?= $client_id ?>&folder_location=1¤t_folder_id=<?= $get_folder_id ?>">
|
||||||
|
<i class="fa fa-fw fa-folder-plus mr-2"></i>New Folder
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3 border-right mb-3">
|
||||||
|
<h4>Folders</h4>
|
||||||
|
<hr>
|
||||||
|
<ul class="nav nav-pills flex-column bg-light">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link <?php if ($get_folder_id == 0) { echo "active"; } ?>" href="?client_id=<?php echo $client_id; ?>&folder_id=0">/</a>
|
||||||
|
</li>
|
||||||
|
<?php
|
||||||
|
// Function to check if a folder is an ancestor of the current folder
|
||||||
|
function is_ancestor_folder($folder_id, $current_folder_id, $client_id) {
|
||||||
|
global $mysqli;
|
||||||
|
|
||||||
|
// Base case: if current_folder_id is 0 or equal to folder_id
|
||||||
|
if ($current_folder_id == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ($current_folder_id == $folder_id) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the parent folder of the current folder
|
||||||
|
$result = mysqli_query($mysqli, "SELECT parent_folder FROM folders WHERE folder_id = $current_folder_id AND folder_client_id = $client_id");
|
||||||
|
if ($row = mysqli_fetch_assoc($result)) {
|
||||||
|
$parent_folder_id = intval($row['parent_folder']);
|
||||||
|
// Recursive call to check the parent folder
|
||||||
|
return is_ancestor_folder($folder_id, $parent_folder_id, $client_id);
|
||||||
|
} else {
|
||||||
|
// Folder not found
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recursive function to display folders and subfolders
|
||||||
|
function display_folders($parent_folder_id, $client_id, $indent = 0) {
|
||||||
|
global $mysqli, $get_folder_id, $session_user_role;
|
||||||
|
|
||||||
|
$sql_folders = mysqli_query($mysqli, "SELECT * FROM folders WHERE parent_folder = $parent_folder_id AND folder_location = 1 AND folder_client_id = $client_id ORDER BY folder_name ASC");
|
||||||
|
while ($row = mysqli_fetch_array($sql_folders)) {
|
||||||
|
$folder_id = intval($row['folder_id']);
|
||||||
|
$folder_name = nullable_htmlentities($row['folder_name']);
|
||||||
|
|
||||||
|
// Get the number of files in the folder
|
||||||
|
$row2 = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('file_id') AS num FROM files WHERE file_folder_id = $folder_id AND file_archived_at IS NULL"));
|
||||||
|
$num_files = intval($row2['num']);
|
||||||
|
|
||||||
|
// Get the number of subfolders
|
||||||
|
$subfolder_result = mysqli_query($mysqli, "SELECT COUNT(*) AS count FROM folders WHERE parent_folder = $folder_id AND folder_client_id = $client_id");
|
||||||
|
$subfolder_count = intval(mysqli_fetch_assoc($subfolder_result)['count']);
|
||||||
|
|
||||||
|
echo '<li class="nav-item">';
|
||||||
|
echo '<div class="row">';
|
||||||
|
echo '<div class="col-10">';
|
||||||
|
echo '<a class="nav-link ';
|
||||||
|
if ($get_folder_id == $folder_id) { echo "active"; }
|
||||||
|
echo '" href="?client_id=' . $client_id . '&folder_id=' . $folder_id . '">';
|
||||||
|
|
||||||
|
// Indentation for subfolders
|
||||||
|
echo str_repeat(' ', $indent * 4);
|
||||||
|
|
||||||
|
// Determine if the folder is open
|
||||||
|
if ($get_folder_id == $folder_id || is_ancestor_folder($folder_id, $get_folder_id, $client_id)) {
|
||||||
|
echo '<i class="fas fa-fw fa-folder-open"></i>';
|
||||||
|
} else {
|
||||||
|
echo '<i class="fas fa-fw fa-folder"></i>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo ' ' . $folder_name;
|
||||||
|
|
||||||
|
if ($num_files > 0) {
|
||||||
|
echo "<span class='badge badge-pill badge-dark float-right mt-1'>$num_files</span>";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</a>';
|
||||||
|
echo '</div>';
|
||||||
|
echo '<div class="col-2">';
|
||||||
|
?>
|
||||||
|
<div class="dropdown">
|
||||||
|
<button class="btn btn-sm" type="button" data-toggle="dropdown">
|
||||||
|
<i class="fas fa-ellipsis-v"></i>
|
||||||
|
</button>
|
||||||
|
<div class="dropdown-menu">
|
||||||
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/folder/folder_rename.php?id=<?= $folder_id ?>">
|
||||||
|
<i class="fas fa-fw fa-edit mr-2"></i>Rename
|
||||||
|
</a>
|
||||||
|
<?php
|
||||||
|
// Only show delete option if user is admin, folder has no files, and no subfolders
|
||||||
|
if ($session_user_role == 3 && $num_files == 0 && $subfolder_count == 0) { ?>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_folder=<?php echo $folder_id; ?>">
|
||||||
|
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||||
|
</a>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
echo '</div>';
|
||||||
|
echo '</div>';
|
||||||
|
|
||||||
|
if ($subfolder_count > 0) {
|
||||||
|
// Display subfolders
|
||||||
|
echo '<ul class="nav nav-pills flex-column bg-light">';
|
||||||
|
display_folders($folder_id, $client_id, $indent + 1);
|
||||||
|
echo '</ul>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</li>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start displaying folders from the root (parent_folder = 0)
|
||||||
|
display_folders(0, $client_id);
|
||||||
|
?>
|
||||||
|
</ul>
|
||||||
|
<?php //require_once "modals/folder/folder_add.php"; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="col-md-9">
|
||||||
|
|
||||||
|
<form autocomplete="off">
|
||||||
|
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||||
|
<input type="hidden" name="view" value="<?php echo $view; ?>">
|
||||||
|
<input type="hidden" name="folder_id" value="<?php echo $get_folder_id; ?>">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<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 for files in <?php if($get_folder_id == 0) { echo "all folders"; } else { echo "current folder"; } ?>">
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-7">
|
||||||
|
<div class="btn-group float-right">
|
||||||
|
<a href="?<?php echo $url_query_strings_sort; ?>&view=0" class="btn <?php if($view == 0){ echo "btn-primary"; } else { echo "btn-outline-secondary"; } ?>"><i class="fas fa-list-ul"></i></a>
|
||||||
|
<a href="?<?php echo $url_query_strings_sort; ?>&view=1" class="btn <?php if($view == 1){ echo "btn-primary"; } else { echo "btn-outline-secondary"; } ?>"><i class="fas fa-th-large"></i></a>
|
||||||
|
|
||||||
|
<div class="dropdown ml-2" id="bulkActionButton" hidden>
|
||||||
|
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown">
|
||||||
|
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>)
|
||||||
|
</button>
|
||||||
|
<div class="dropdown-menu">
|
||||||
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/file/file_bulk_move.php?client_id=<?= $client_id ?>"
|
||||||
|
data-bulk="true">
|
||||||
|
<i class="fas fa-fw fa-exchange-alt mr-2"></i>Move
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<button class="dropdown-item text-danger text-bold"
|
||||||
|
type="submit" form="bulkActions" name="bulk_delete_files">
|
||||||
|
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<nav class="mt-3">
|
||||||
|
<ol class="breadcrumb">
|
||||||
|
<li class="breadcrumb-item">
|
||||||
|
<a href="?client_id=<?php echo $client_id; ?>&folder_id=0">
|
||||||
|
<i class="fas fa-fw fa-folder mr-2"></i>Root
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<?php
|
||||||
|
// Output breadcrumb items for each folder in the path
|
||||||
|
foreach ($folder_path as $folder) {
|
||||||
|
$bread_crumb_folder_id = $folder['folder_id']; // Already Sanitized before it was pushed into array
|
||||||
|
$bread_crumb_folder_name = $folder['folder_name']; // Already Sanitized before it was pushed into array
|
||||||
|
|
||||||
|
?>
|
||||||
|
<li class="breadcrumb-item">
|
||||||
|
<a href="?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $bread_crumb_folder_id; ?>">
|
||||||
|
<i class="fas fa-fw fa-folder-open mr-2"></i><?php echo $bread_crumb_folder_name; ?>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</ol>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if($view == 1){
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$files = [];
|
||||||
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
|
$file_id = intval($row['file_id']);
|
||||||
|
$file_name = nullable_htmlentities($row['file_name']);
|
||||||
|
$file_reference_name = nullable_htmlentities($row['file_reference_name']);
|
||||||
|
$file_ext = nullable_htmlentities($row['file_ext']);
|
||||||
|
$file_size = intval($row['file_size']);
|
||||||
|
$file_size_KB = number_format($file_size / 1024);
|
||||||
|
$file_mime_type = nullable_htmlentities($row['file_mime_type']);
|
||||||
|
$file_uploaded_by = nullable_htmlentities($row['user_name']);
|
||||||
|
|
||||||
|
// Store file data into an array for JS
|
||||||
|
$files[] = [
|
||||||
|
'id' => $file_id,
|
||||||
|
'name' => $file_name,
|
||||||
|
'preview' => "../uploads/clients/$client_id/$file_reference_name"
|
||||||
|
];
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="col-xl-2 col-lg-2 col-md-6 col-sm-6 mb-3 text-center">
|
||||||
|
|
||||||
|
<a href="#" onclick="openModal(<?php echo count($files)-1; ?>)"><!-- passing the index -->
|
||||||
|
<img class="img-thumbnail" src="<?php echo "../uploads/clients/$client_id/$file_reference_name"; ?>" alt="<?php echo $file_reference_name ?>">
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
|
||||||
|
<div class="dropdown float-right">
|
||||||
|
<button class="btn btn-link btn-sm" type="button" data-toggle="dropdown">
|
||||||
|
<i class="fas fa-ellipsis-v"></i>
|
||||||
|
</button>
|
||||||
|
<div class="dropdown-menu">
|
||||||
|
<a class="dropdown-item" href="<?php echo "../uploads/clients/$client_id/$file_reference_name"; ?>" download="<?php echo $file_name; ?>">
|
||||||
|
<i class="fas fa-fw fa-cloud-download-alt mr-2"></i>Download
|
||||||
|
</a>
|
||||||
|
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#shareModal" onclick="populateShareModal(<?php echo "$client_id, 'File', $file_id"; ?>)">
|
||||||
|
<i class="fas fa-fw fa-share mr-2"></i>Share
|
||||||
|
</a>
|
||||||
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/file/file_rename.php?id=<?= $file_id ?>">
|
||||||
|
<i class="fas fa-fw fa-edit mr-2"></i>Rename
|
||||||
|
</a>
|
||||||
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/file/file_move.php?id=<?= $file_id ?>">
|
||||||
|
<i class="fas fa-fw fa-exchange-alt mr-2"></i>Move
|
||||||
|
</a>
|
||||||
|
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#linkAssetToFileModal<?php echo $file_id; ?>">
|
||||||
|
<i class="fas fa-fw fa-desktop mr-2"></i>Asset
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_file=<?php echo $file_id; ?>">
|
||||||
|
<i class="fas fa-fw fa-archive mr-2"></i>Archive
|
||||||
|
</a>
|
||||||
|
<?php if ($session_user_role == 3) { ?>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<a class="dropdown-item text-danger text-bold" href="#" data-toggle="modal" data-target="#deleteFileModal" onclick="populateFileDeleteModal(<?php echo "$file_id , '$file_name'" ?>)">
|
||||||
|
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||||
|
</a>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<small class="text-secondary"><?php echo $file_name; ?></small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require "modals/file/file_view.php";
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<script>
|
||||||
|
// Pass PHP array to JavaScript
|
||||||
|
var files = <?php echo json_encode($files); ?>;
|
||||||
|
var currentIndex = 0; // Keep track of which file is displayed
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php } else { ?>
|
||||||
|
|
||||||
|
<form id="bulkActions" action="post.php" method="post">
|
||||||
|
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||||
|
|
||||||
|
<div class="table-responsive-sm">
|
||||||
|
<table class="table border">
|
||||||
|
|
||||||
|
<thead class="thead-light <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||||
|
<tr>
|
||||||
|
<td class="bg-light pr-0">
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<th>
|
||||||
|
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=file_name&order=<?php echo $disp; ?>">
|
||||||
|
Name <?php if ($sort == 'file_name') { echo $order_icon; } ?>
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=file_mime_type&order=<?php echo $disp; ?>">
|
||||||
|
Type <?php if ($sort == 'file_mime_type') { echo $order_icon; } ?>
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=file_size&order=<?php echo $disp; ?>">
|
||||||
|
Size <?php if ($sort == 'file_size') { echo $order_icon; } ?>
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=file_created_at&order=<?php echo $disp; ?>">
|
||||||
|
Uploaded <?php if ($sort == 'file_created_at') { echo $order_icon; } ?>
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
|
<th></th>
|
||||||
|
<th class="text-center">Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
|
$file_id = intval($row['file_id']);
|
||||||
|
$file_name = nullable_htmlentities($row['file_name']);
|
||||||
|
$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_size = intval($row['file_size']);
|
||||||
|
$file_size_KB = number_format($file_size / 1024);
|
||||||
|
$file_mime_type = nullable_htmlentities($row['file_mime_type']);
|
||||||
|
$file_size = intval($row['file_size']);
|
||||||
|
$file_uploaded_by = nullable_htmlentities($row['user_name']);
|
||||||
|
$file_created_at = nullable_htmlentities($row['file_created_at']);
|
||||||
|
$file_folder_id = intval($row['file_folder_id']);
|
||||||
|
|
||||||
|
// Check if shared
|
||||||
|
$sql_shared = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT * FROM shared_items
|
||||||
|
WHERE item_client_id = $client_id
|
||||||
|
AND item_active = 1
|
||||||
|
AND item_views != item_view_limit
|
||||||
|
AND item_expire_at > NOW()
|
||||||
|
AND item_type = 'File'
|
||||||
|
AND item_related_id = $file_id
|
||||||
|
LIMIT 1"
|
||||||
|
);
|
||||||
|
$file_shared = (mysqli_num_rows($sql_shared) > 0) ? true : false;
|
||||||
|
if ($file_shared) {
|
||||||
|
$row = mysqli_fetch_array($sql_shared);
|
||||||
|
$item_id = intval($row['item_id']);
|
||||||
|
$item_active = nullable_htmlentities($row['item_active']);
|
||||||
|
$item_key = nullable_htmlentities($row['item_key']);
|
||||||
|
$item_type = nullable_htmlentities($row['item_type']);
|
||||||
|
$item_related_id = intval($row['item_related_id']);
|
||||||
|
$item_note = nullable_htmlentities($row['item_note']);
|
||||||
|
$item_recipient = nullable_htmlentities($row['item_recipient']);
|
||||||
|
$item_views = nullable_htmlentities($row['item_views']);
|
||||||
|
$item_view_limit = nullable_htmlentities($row['item_view_limit']);
|
||||||
|
$item_created_at = nullable_htmlentities($row['item_created_at']);
|
||||||
|
$item_expire_at = nullable_htmlentities($row['item_expire_at']);
|
||||||
|
$item_expire_at_human = timeAgo($row['item_expire_at']);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="bg-light pr-0">
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input bulk-select" type="checkbox" name="file_ids[]" value="<?php echo $file_id ?>">
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="<?php echo "../uploads/clients/$client_id/$file_reference_name"; ?>" target="_blank">
|
||||||
|
<div class="media">
|
||||||
|
<i class="fa fa-fw fa-2x fa-<?php echo $file_icon; ?> text-dark mr-3"></i>
|
||||||
|
<div class="media-body">
|
||||||
|
<p>
|
||||||
|
<?php echo basename($file_name); ?>
|
||||||
|
<br>
|
||||||
|
<small class="text-secondary"><?php echo $file_description; ?></small>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td><?php echo $file_mime_type; ?></td>
|
||||||
|
<td><?php echo $file_size_KB; ?> KB</td>
|
||||||
|
<td>
|
||||||
|
<?php echo $file_created_at; ?>
|
||||||
|
<div class="text-secondary mt-1"><?php echo $file_uploaded_by; ?></div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php if ($file_shared) { ?>
|
||||||
|
<div class="media" title="Expires <?php echo $item_expire_at_human; ?>">
|
||||||
|
<i class="fas fa-link mr-2 mt-1"></i>
|
||||||
|
<div class="media-body">Shared
|
||||||
|
<br>
|
||||||
|
<small class="text-secondary"><?php echo $item_recipient; ?></small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div class="dropdown dropleft text-center">
|
||||||
|
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
||||||
|
<i class="fas fa-ellipsis-h"></i>
|
||||||
|
</button>
|
||||||
|
<div class="dropdown-menu">
|
||||||
|
<a class="dropdown-item" href="<?php echo "../uploads/clients/$client_id/$file_reference_name"; ?>" download="<?php echo $file_name; ?>">
|
||||||
|
<i class="fas fa-fw fa-cloud-download-alt mr-2"></i>Download
|
||||||
|
</a>
|
||||||
|
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#shareModal" onclick="populateShareModal(<?php echo "$client_id, 'File', $file_id"; ?>)">
|
||||||
|
<i class="fas fa-fw fa-share mr-2"></i>Share
|
||||||
|
</a>
|
||||||
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/file/file_rename.php?id=<?= $file_id ?>">
|
||||||
|
<i class="fas fa-fw fa-edit mr-2"></i>Rename
|
||||||
|
</a>
|
||||||
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/file/file_move.php?id=<?= $file_id ?>">
|
||||||
|
<i class="fas fa-fw fa-exchange-alt mr-2"></i>Move
|
||||||
|
</a>
|
||||||
|
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#linkAssetToFileModal<?php echo $file_id; ?>">
|
||||||
|
<i class="fas fa-fw fa-desktop mr-2"></i>Asset
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_file=<?php echo $file_id; ?>">
|
||||||
|
<i class="fas fa-fw fa-archive mr-2"></i>Archive
|
||||||
|
</a>
|
||||||
|
<?php if ($session_user_role == 3) { ?>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<a class="dropdown-item text-danger text-bold" href="#" data-toggle="modal" data-target="#deleteFileModal" onclick="populateFileDeleteModal(<?php echo "$file_id , '$file_name'" ?>)">
|
||||||
|
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||||
|
</a>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
require "modals/file/file_link_asset.php";
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php require_once "../includes/filter_footer.php"; ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function openModal(index) {
|
||||||
|
currentIndex = index;
|
||||||
|
updateModalContent();
|
||||||
|
$('#viewFileModal').modal('show');
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateModalContent() {
|
||||||
|
document.getElementById('modalTitle').innerText = files[currentIndex].name;
|
||||||
|
document.getElementById('modalImage').src = files[currentIndex].preview;
|
||||||
|
}
|
||||||
|
|
||||||
|
function nextFile() {
|
||||||
|
currentIndex = (currentIndex + 1) % files.length; // loop around
|
||||||
|
updateModalContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
function prevFile() {
|
||||||
|
currentIndex = (currentIndex - 1 + files.length) % files.length; // loop around
|
||||||
|
updateModalContent();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script src="../js/bulk_actions.js"></script>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once "modals/share_modal.php";
|
||||||
|
require_once "modals/file/file_delete.php";
|
||||||
|
require_once "../includes/footer.php";
|
||||||
@@ -109,11 +109,20 @@ if (isset($_GET['query'])) {
|
|||||||
ORDER BY credential_id DESC LIMIT 5"
|
ORDER BY credential_id DESC LIMIT 5"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$sql_quotes = mysqli_query($mysqli, "SELECT * FROM quotes
|
||||||
|
LEFT JOIN clients ON quote_client_id = client_id
|
||||||
|
LEFT JOIN categories ON quote_category_id = category_id
|
||||||
|
WHERE quote_archived_at IS NULL
|
||||||
|
AND (CONCAT(quote_prefix,quote_number) LIKE '%$query%' OR quote_number LIKE '%$query%' OR quote_scope LIKE '%$query%')
|
||||||
|
$access_permission_query
|
||||||
|
ORDER BY quote_number DESC LIMIT 5"
|
||||||
|
);
|
||||||
|
|
||||||
$sql_invoices = mysqli_query($mysqli, "SELECT * FROM invoices
|
$sql_invoices = mysqli_query($mysqli, "SELECT * FROM invoices
|
||||||
LEFT JOIN clients ON invoice_client_id = client_id
|
LEFT JOIN clients ON invoice_client_id = client_id
|
||||||
LEFT JOIN categories ON invoice_category_id = category_id
|
LEFT JOIN categories ON invoice_category_id = category_id
|
||||||
WHERE invoice_archived_at IS NULL
|
WHERE invoice_archived_at IS NULL
|
||||||
AND (CONCAT(invoice_prefix,invoice_number) LIKE '%$query%' OR invoice_scope LIKE '%$query%')
|
AND (CONCAT(invoice_prefix,invoice_number) LIKE '%$query%' OR invoice_number LIKE '%$query%' OR invoice_scope LIKE '%$query%')
|
||||||
$access_permission_query
|
$access_permission_query
|
||||||
ORDER BY invoice_number DESC LIMIT 5"
|
ORDER BY invoice_number DESC LIMIT 5"
|
||||||
);
|
);
|
||||||
@@ -509,10 +518,10 @@ if (isset($_GET['query'])) {
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="ticket.php?ticket_id=<?php echo $ticket_id ?>"><?php echo $ticket_prefix . $ticket_number; ?></a></td>
|
<td><a href="ticket.php?client_id=<?= $client_id ?>&ticket_id=<?= $ticket_id ?>"><?= $ticket_prefix . $ticket_number ?></a></td>
|
||||||
<td><?php echo $ticket_subject; ?></td>
|
<td><?= $ticket_subject ?></td>
|
||||||
<td><?php echo $ticket_status_name; ?></td>
|
<td><?= $ticket_status_name ?></td>
|
||||||
<td><a href="tickets.php?client_id=<?php echo $client_id ?>"><?php echo $client_name; ?></a></td>
|
<td><a href="tickets.php?client_id=<?= $client_id ?>"><?= $client_name ?></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@@ -628,6 +637,57 @@ if (isset($_GET['query'])) {
|
|||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if (mysqli_num_rows($sql_quotes) > 0) { ?>
|
||||||
|
|
||||||
|
<!-- Contacts-->
|
||||||
|
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="card card-dark mb-3">
|
||||||
|
<div class="card-header">
|
||||||
|
<h6 class="card-title"><i class="fas fa-fw fa-file-invoice mr-2"></i>Quotes</h6>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<table class="table table-striped table-borderless">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Number</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Amount</th>
|
||||||
|
<th>Client</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_array($sql_quotes)) {
|
||||||
|
$quote_id = intval($row['quote_id']);
|
||||||
|
$quote_prefix = nullable_htmlentities($row['quote_prefix']);
|
||||||
|
$quote_number = intval($row['quote_number']);
|
||||||
|
$quote_amount = floatval($row['quote_amount']);
|
||||||
|
$quote_currency_code = nullable_htmlentities($row['quote_currency_code']);
|
||||||
|
$quote_status = nullable_htmlentities($row['quote_status']);
|
||||||
|
$client_id = intval($row['client_id']);
|
||||||
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td><a href="quote.php?client_id=<?= $client_id ?>"e_id=<?php echo $quote_id; ?>"><?php echo "$quote_prefix$quote_number"; ?></a></td>
|
||||||
|
<td><?php echo $quote_status; ?></td>
|
||||||
|
<td><?php echo numfmt_format_currency($currency_format, $quote_amount, $quote_currency_code); ?></td>
|
||||||
|
<td><a href="client_overview.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<?php if (mysqli_num_rows($sql_invoices) > 0) { ?>
|
<?php if (mysqli_num_rows($sql_invoices) > 0) { ?>
|
||||||
|
|
||||||
<!-- Contacts-->
|
<!-- Contacts-->
|
||||||
@@ -662,7 +722,7 @@ if (isset($_GET['query'])) {
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="invoice.php?invoice_id=<?php echo $invoice_id; ?>"><?php echo "$invoice_prefix$invoice_number"; ?></a></td>
|
<td><a href="invoice.php?client_id=<?= $client_id ?>&invoice_id=<?php echo $invoice_id; ?>"><?php echo "$invoice_prefix$invoice_number"; ?></a></td>
|
||||||
<td><?php echo $invoice_status; ?></td>
|
<td><?php echo $invoice_status; ?></td>
|
||||||
<td><?php echo numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code); ?></td>
|
<td><?php echo numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code); ?></td>
|
||||||
<td><a href="client_overview.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a></td>
|
<td><a href="client_overview.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a></td>
|
||||||
@@ -807,7 +867,7 @@ if (isset($_GET['query'])) {
|
|||||||
<?php echo "$client_name - $ticket_prefix$ticket_number - $ticket_subject"; ?>
|
<?php echo "$client_name - $ticket_prefix$ticket_number - $ticket_subject"; ?>
|
||||||
</h3>
|
</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>" target="_blank">Open <i class="fa fa-fw fa-external-link-alt"></i></a>
|
<a href="ticket.php?client_id=<?= $client_id ?>&ticket_id=<?= $ticket_id ?>" target="_blank">Open <i class="fa fa-fw fa-external-link-alt"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body prettyContent">
|
<div class="card-body prettyContent">
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ $num_software = $row['num'];
|
|||||||
<i class="nav-icon fas fa-address-book"></i>
|
<i class="nav-icon fas fa-address-book"></i>
|
||||||
<p>
|
<p>
|
||||||
Contacts
|
Contacts
|
||||||
|
<span href="#" class="fas fa-plus-circle right ajax-modal" data-modal-url="/agent/modals/contact/contact_add.php"></span>
|
||||||
<?php
|
<?php
|
||||||
if ($num_contacts > 0) { ?>
|
if ($num_contacts > 0) { ?>
|
||||||
<span class="right badge text-light"><?php echo $num_contacts; ?></span>
|
<span class="right badge text-light"><?php echo $num_contacts; ?></span>
|
||||||
@@ -65,6 +66,7 @@ $num_software = $row['num'];
|
|||||||
<i class="nav-icon fas fa-map-marker-alt"></i>
|
<i class="nav-icon fas fa-map-marker-alt"></i>
|
||||||
<p>
|
<p>
|
||||||
Locations
|
Locations
|
||||||
|
<span href="#" class="fas fa-plus-circle right ajax-modal" data-modal-url="/agent/modals/location/location_add.php"></span>
|
||||||
<?php
|
<?php
|
||||||
if ($num_locations > 0) { ?>
|
if ($num_locations > 0) { ?>
|
||||||
<span class="right badge text-light"><?php echo $num_locations; ?></span>
|
<span class="right badge text-light"><?php echo $num_locations; ?></span>
|
||||||
@@ -77,6 +79,7 @@ $num_software = $row['num'];
|
|||||||
<i class="nav-icon fas fa-desktop"></i>
|
<i class="nav-icon fas fa-desktop"></i>
|
||||||
<p>
|
<p>
|
||||||
Assets
|
Assets
|
||||||
|
<span href="#" class="fas fa-plus-circle right ajax-modal" data-modal-url="/agent/modals/asset/asset_add.php"></span>
|
||||||
<?php
|
<?php
|
||||||
if ($num_assets > 0) { ?>
|
if ($num_assets > 0) { ?>
|
||||||
<span class="right badge text-light"><?php echo $num_assets; ?></span>
|
<span class="right badge text-light"><?php echo $num_assets; ?></span>
|
||||||
@@ -89,6 +92,7 @@ $num_software = $row['num'];
|
|||||||
<i class="nav-icon fas fa-cube"></i>
|
<i class="nav-icon fas fa-cube"></i>
|
||||||
<p>
|
<p>
|
||||||
Licenses
|
Licenses
|
||||||
|
<span href="#" class="fas fa-plus-circle right ajax-modal" data-modal-url="/agent/modals/software/software_add.php"></span>
|
||||||
<?php
|
<?php
|
||||||
if ($num_software > 0) { ?>
|
if ($num_software > 0) { ?>
|
||||||
<span class="right badge text-light"><?php echo $num_software; ?></span>
|
<span class="right badge text-light"><?php echo $num_software; ?></span>
|
||||||
@@ -101,6 +105,7 @@ $num_software = $row['num'];
|
|||||||
<i class="nav-icon fas fa-key"></i>
|
<i class="nav-icon fas fa-key"></i>
|
||||||
<p>
|
<p>
|
||||||
Credentials
|
Credentials
|
||||||
|
<span href="#" class="fas fa-plus-circle right ajax-modal" data-modal-url="/agent/modals/credential/credential_add.php"></span>
|
||||||
<?php
|
<?php
|
||||||
if ($num_credentials > 0) { ?>
|
if ($num_credentials > 0) { ?>
|
||||||
<span class="right badge text-light"><?php echo $num_credentials; ?></span>
|
<span class="right badge text-light"><?php echo $num_credentials; ?></span>
|
||||||
@@ -113,6 +118,7 @@ $num_software = $row['num'];
|
|||||||
<i class="nav-icon fas fa-network-wired"></i>
|
<i class="nav-icon fas fa-network-wired"></i>
|
||||||
<p>
|
<p>
|
||||||
Networks
|
Networks
|
||||||
|
<span href="#" class="fas fa-plus-circle right ajax-modal" data-modal-url="/agent/modals/network/network_add.php"></span>
|
||||||
<?php
|
<?php
|
||||||
if ($num_networks > 0) { ?>
|
if ($num_networks > 0) { ?>
|
||||||
<span class="right badge text-light"><?php echo $num_networks; ?></span>
|
<span class="right badge text-light"><?php echo $num_networks; ?></span>
|
||||||
@@ -125,6 +131,7 @@ $num_software = $row['num'];
|
|||||||
<i class="nav-icon fas fa-lock"></i>
|
<i class="nav-icon fas fa-lock"></i>
|
||||||
<p>
|
<p>
|
||||||
Certificates
|
Certificates
|
||||||
|
<span href="#" class="fas fa-plus-circle right ajax-modal" data-modal-url="/agent/modals/certificate/certificate_add.php"></span>
|
||||||
<?php
|
<?php
|
||||||
if ($num_certificates > 0) { ?>
|
if ($num_certificates > 0) { ?>
|
||||||
<span class="right badge text-light"><?php echo $num_certificates; ?></span>
|
<span class="right badge text-light"><?php echo $num_certificates; ?></span>
|
||||||
@@ -137,6 +144,7 @@ $num_software = $row['num'];
|
|||||||
<i class="nav-icon fas fa-globe"></i>
|
<i class="nav-icon fas fa-globe"></i>
|
||||||
<p>
|
<p>
|
||||||
Domains
|
Domains
|
||||||
|
<span href="#" class="fas fa-plus-circle right ajax-modal" data-modal-url="/agent/modals/domain/domain_add.php"></span>
|
||||||
<?php
|
<?php
|
||||||
if ($num_domains > 0) { ?>
|
if ($num_domains > 0) { ?>
|
||||||
<span class="right badge text-light"><?php echo $num_domains; ?></span>
|
<span class="right badge text-light"><?php echo $num_domains; ?></span>
|
||||||
@@ -149,6 +157,7 @@ $num_software = $row['num'];
|
|||||||
<i class="nav-icon fas fa-stream"></i>
|
<i class="nav-icon fas fa-stream"></i>
|
||||||
<p>
|
<p>
|
||||||
Services
|
Services
|
||||||
|
<span href="#" class="fas fa-plus-circle right ajax-modal" data-modal-url="/agent/modals/service/service_add.php"></span>
|
||||||
<?php
|
<?php
|
||||||
if ($num_services > 0) { ?>
|
if ($num_services > 0) { ?>
|
||||||
<span class="right badge text-light"><?php echo $num_services; ?></span>
|
<span class="right badge text-light"><?php echo $num_services; ?></span>
|
||||||
|
|||||||
@@ -199,7 +199,6 @@
|
|||||||
<i class="nav-icon fas fa-lock"></i>
|
<i class="nav-icon fas fa-lock"></i>
|
||||||
<p>
|
<p>
|
||||||
Certificates
|
Certificates
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ($num_certificates > 0) { ?>
|
if ($num_certificates > 0) { ?>
|
||||||
<span class="right badge <?php if ($num_certificates_expiring > 0) { ?> badge-warning text-dark <?php } ?> <?php if ($num_certificates_expired > 0) { ?> badge-danger <?php } ?> text-white"><?php echo $num_certificates; ?></span>
|
<span class="right badge <?php if ($num_certificates_expiring > 0) { ?> badge-warning text-dark <?php } ?> <?php if ($num_certificates_expired > 0) { ?> badge-danger <?php } ?> text-white"><?php echo $num_certificates; ?></span>
|
||||||
@@ -213,7 +212,6 @@
|
|||||||
<i class="nav-icon fas fa-globe"></i>
|
<i class="nav-icon fas fa-globe"></i>
|
||||||
<p>
|
<p>
|
||||||
Domains
|
Domains
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ($num_domains > 0) { ?>
|
if ($num_domains > 0) { ?>
|
||||||
<span class="right badge <?php if (isset($num_domains_expiring)) { ?> badge-warning text-dark<?php } ?> <?php if (isset($num_domains_expired)) { ?> badge-danger <?php } ?> text-white"><?php echo $num_domains; ?></span>
|
<span class="right badge <?php if (isset($num_domains_expiring)) { ?> badge-warning text-dark<?php } ?> <?php if (isset($num_domains_expired)) { ?> badge-danger <?php } ?> text-white"><?php echo $num_domains; ?></span>
|
||||||
@@ -235,25 +233,12 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="nav-item">
|
|
||||||
<a href="/agent/documents.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "documents.php" || basename($_SERVER["PHP_SELF"]) == "document_details.php") { echo "active"; } ?>">
|
|
||||||
<i class="nav-icon fas fa-folder"></i>
|
|
||||||
<p>
|
|
||||||
Documents
|
|
||||||
<?php
|
|
||||||
if ($num_documents > 0) { ?>
|
|
||||||
<span class="right badge text-light"><?php echo $num_documents; ?></span>
|
|
||||||
<?php } ?>
|
|
||||||
</p>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<!-- Allow files even without module_support for things like contracts, etc. ) -->
|
<!-- Allow files even without module_support for things like contracts, etc. ) -->
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="/agent/files.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "files.php") { echo "active"; } ?>">
|
<a href="/agent/files.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "files.php") { echo "active"; } ?>">
|
||||||
<i class="nav-icon fas fa-paperclip"></i>
|
<i class="nav-icon fas fa-folder"></i>
|
||||||
<p>
|
<p>
|
||||||
Files
|
Files
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
@@ -29,15 +29,16 @@ if (isset($_GET['client_id'])) {
|
|||||||
$sql = mysqli_query(
|
$sql = mysqli_query(
|
||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT * FROM clients
|
"SELECT * FROM clients
|
||||||
LEFT JOIN locations ON clients.client_id = locations.location_client_id AND location_primary = 1
|
LEFT JOIN locations ON client_id = location_client_id AND location_primary = 1
|
||||||
LEFT JOIN contacts ON clients.client_id = contacts.contact_client_id AND contact_primary = 1
|
LEFT JOIN contacts ON client_id = contact_client_id AND contact_primary = 1
|
||||||
WHERE client_id = $client_id"
|
WHERE client_id = $client_id"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (mysqli_num_rows($sql) == 0) {
|
if (mysqli_num_rows($sql) == 0) {
|
||||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php';
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php';
|
||||||
|
|
||||||
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1></center>";
|
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='javascript:history.back()'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>";
|
||||||
|
exit;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_array($sql);
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ if (isset($_GET['invoice_id'])) {
|
|||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT * FROM invoices
|
"SELECT * FROM invoices
|
||||||
LEFT JOIN clients ON invoice_client_id = client_id
|
LEFT JOIN clients ON invoice_client_id = client_id
|
||||||
LEFT JOIN contacts ON clients.client_id = contacts.contact_client_id AND contact_primary = 1
|
LEFT JOIN contacts ON client_id = contact_client_id AND contact_primary = 1
|
||||||
LEFT JOIN locations ON clients.client_id = locations.location_client_id AND location_primary = 1
|
LEFT JOIN locations ON client_id = location_client_id AND location_primary = 1
|
||||||
WHERE invoice_id = $invoice_id
|
WHERE invoice_id = $invoice_id
|
||||||
$access_permission_query
|
$access_permission_query
|
||||||
LIMIT 1"
|
LIMIT 1"
|
||||||
@@ -199,21 +199,12 @@ if (isset($_GET['invoice_id'])) {
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<ol class="breadcrumb d-print-none">
|
<ol class="breadcrumb d-print-none">
|
||||||
<?php if (isset($_GET['client_id'])) { ?>
|
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="client_overview.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a>
|
<a href="invoices.php">All Invoices</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="invoices.php?client_id=<?php echo $client_id; ?>">Invoices</a>
|
<a href="invoices.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?> Invoices</a>
|
||||||
</li>
|
</li>
|
||||||
<?php } else { ?>
|
|
||||||
<li class="breadcrumb-item">
|
|
||||||
<a href="invoices.php">Invoices</a>
|
|
||||||
</li>
|
|
||||||
<li class="breadcrumb-item">
|
|
||||||
<a href="invoices.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a>
|
|
||||||
</li>
|
|
||||||
<?php } ?>
|
|
||||||
<li class="breadcrumb-item active"><?php echo "$invoice_prefix$invoice_number"; ?></li>
|
<li class="breadcrumb-item active"><?php echo "$invoice_prefix$invoice_number"; ?></li>
|
||||||
<?php if (isset($invoice_overdue)) { ?>
|
<?php if (isset($invoice_overdue)) { ?>
|
||||||
<span class="p-2 ml-2 badge badge-danger"><?php echo $invoice_overdue; ?></span>
|
<span class="p-2 ml-2 badge badge-danger"><?php echo $invoice_overdue; ?></span>
|
||||||
@@ -286,7 +277,8 @@ if (isset($_GET['invoice_id'])) {
|
|||||||
data-modal-url="modals/invoice/invoice_copy.php?id=<?= $invoice_id ?>">
|
data-modal-url="modals/invoice/invoice_copy.php?id=<?= $invoice_id ?>">
|
||||||
<i class="fa fa-fw fa-copy text-secondary mr-2"></i>Copy
|
<i class="fa fa-fw fa-copy text-secondary mr-2"></i>Copy
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addInvoiceRecurringModal<?php echo $invoice_id; ?>">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/invoice/invoice_recurring_add.php?invoice_id=<?= $invoice_id ?>">
|
||||||
<i class="fa fa-fw fa-sync-alt text-secondary mr-2"></i>Recurring
|
<i class="fa fa-fw fa-sync-alt text-secondary mr-2"></i>Recurring
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
@@ -465,10 +457,10 @@ if (isset($_GET['invoice_id'])) {
|
|||||||
<textarea class="form-control" rows="2" id="desc" name="description" placeholder="Enter a Description"></textarea>
|
<textarea class="form-control" rows="2" id="desc" name="description" placeholder="Enter a Description"></textarea>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,2}" class="form-control" style="text-align: center;" id="qty" name="qty" placeholder="Qty">
|
<input type="text" inputmode="decimal" pattern="[0-9]*\.?[0-9]{0,2}" class="form-control" style="text-align: center;" id="qty" name="qty" placeholder="Qty">
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" class="form-control" inputmode="numeric" pattern="-?[0-9]*\.?[0-9]{0,2}" style="text-align: right;" id="price" name="price" placeholder="Price (<?php echo $invoice_currency_code; ?>)">
|
<input type="text" class="form-control" inputmode="decimal" pattern="-?[0-9]*\.?[0-9]{0,2}" style="text-align: right;" id="price" name="price" placeholder="Price (<?php echo $invoice_currency_code; ?>)">
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control select2" name="tax_id" id="tax" required>
|
<select class="form-control select2" name="tax_id" id="tax" required>
|
||||||
@@ -734,7 +726,6 @@ if (isset($_GET['invoice_id'])) {
|
|||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
include_once "modals/invoice/invoice_add_ticket.php";
|
include_once "modals/invoice/invoice_add_ticket.php";
|
||||||
include_once "modals/invoice/invoice_recurring_add.php";
|
|
||||||
include_once "modals/invoice/invoice_note.php";
|
include_once "modals/invoice/invoice_note.php";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,10 +162,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-file-invoice mr-2"></i>Invoices</h3>
|
<h3 class="card-title mt-2"><i class="fa fa-fw fa-file-invoice mr-2"></i>Invoices</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addInvoiceModal"><i class="fas fa-plus mr-2"></i>New Invoice</button>
|
<button type="button" class="btn btn-primary ajax-modal"
|
||||||
|
data-modal-url="modals/invoice/invoice_add.php?<?= $client_url ?>">
|
||||||
|
<i class="fas fa-plus mr-2"></i>New Invoice
|
||||||
|
</button>
|
||||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportInvoicesModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/invoice/invoice_export.php?<?= $client_url ?>">
|
||||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -218,12 +222,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<?php if ($client_url && $balance > 0) { ?>
|
<?php if ($client_url && $balance > 0) { ?>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addBulkPaymentModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/payment/payment_bulk_add.php?<?= $client_url ?>">
|
||||||
<i class="fa fa-credit-card mr-2"></i>Batch Payment
|
<i class="fa fa-credit-card mr-2"></i>Batch Payment
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkEditCategoryModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/invoice/invoice_bulk_edit_category.php"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-list-ul mr-2"></i>Set Category
|
<i class="fas fa-fw fa-list-ul mr-2"></i>Set Category
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -246,7 +253,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<hr>
|
<hr>
|
||||||
<form id="bulkActions" action="post.php" method="post" enctype="multipart/form-data">
|
<form id="bulkActions" 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="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">
|
||||||
@@ -341,8 +348,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$recurring_invoice_display = "-";
|
$recurring_invoice_display = "-";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$now = time();
|
$now = time();
|
||||||
|
|
||||||
if (($invoice_status == "Sent" || $invoice_status == "Partial" || $invoice_status == "Viewed") && strtotime($invoice_due) + 86400 < $now) {
|
if (($invoice_status == "Sent" || $invoice_status == "Partial" || $invoice_status == "Viewed") && strtotime($invoice_due) + 86400 < $now) {
|
||||||
@@ -353,6 +358,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
$invoice_badge_color = getInvoiceBadgeColor($invoice_status);
|
$invoice_badge_color = getInvoiceBadgeColor($invoice_status);
|
||||||
|
|
||||||
|
// Saved Payment Methods
|
||||||
|
$sql_saved_payment_methods = mysqli_query($mysqli, "
|
||||||
|
SELECT * FROM client_saved_payment_methods
|
||||||
|
LEFT JOIN payment_providers
|
||||||
|
ON client_saved_payment_methods.saved_payment_provider_id = payment_providers.payment_provider_id
|
||||||
|
WHERE saved_payment_client_id = $client_id
|
||||||
|
AND payment_provider_active = 1;
|
||||||
|
");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
@@ -362,7 +376,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="text-bold">
|
<td class="text-bold">
|
||||||
<a href="invoice.php?<?php echo $client_url; ?>invoice_id=<?php echo $invoice_id; ?>">
|
<a href="invoice.php?client_id=<?= $client_id ?>&invoice_id=<?= $invoice_id ?>">
|
||||||
<?php echo "$invoice_prefix$invoice_number"; ?>
|
<?php echo "$invoice_prefix$invoice_number"; ?>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
@@ -392,10 +406,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<i class="fa fa-fw fa-credit-card mr-2"></i>Add Payment
|
<i class="fa fa-fw fa-credit-card mr-2"></i>Add Payment
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<?php if ($invoice_status !== 'Partial' && $config_stripe_enable && $stripe_id && $stripe_pm) { ?>
|
<?php if (mysqli_num_rows($sql_saved_payment_methods) > 0 && ($invoice_status === 'Sent' || $invoice_status === 'Viewed')) { ?>
|
||||||
<a class="dropdown-item confirm-link" href="post.php?add_payment_stripe&invoice_id=<?php echo $invoice_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token']; ?>">
|
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/payment/payment_saved_method_add.php?id=<?= $invoice_id ?>"><i class="fas fa-fw fa-wallet mr-2"></i>Pay with Saved Card</a>
|
||||||
<i class="fa fa-fw fa-credit-card mr-2"></i>Pay via saved card
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@@ -437,17 +449,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?php require_once "modals/invoice/invoice_bulk_edit_category.php"; ?>
|
|
||||||
</form>
|
</form>
|
||||||
<?php require_once "../includes/filter_footer.php";
|
<?php require_once "../includes/filter_footer.php"; ?>
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="../js/bulk_actions.js"></script>
|
<script src="../js/bulk_actions.js"></script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/invoice/invoice_add.php";
|
|
||||||
if ($client_url) { require_once "modals/payment/payment_bulk_add.php"; }
|
|
||||||
require_once "modals/invoice/invoice_export.php";
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -1,94 +1,55 @@
|
|||||||
/*
|
$(document).ready(function() {
|
||||||
* LISTENERS
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Modal loaded listener - populate client select
|
// Function to load contacts for a given client
|
||||||
const changeClientModalLoad = document.getElementById('clientChangeTicketModalLoad');
|
function loadContacts(clientId) {
|
||||||
changeClientModalLoad.addEventListener('click', function() {
|
if (!clientId) return;
|
||||||
populateChangeClientModal_Clients();
|
|
||||||
|
var $contactSelect = $('#contact_select');
|
||||||
|
$contactSelect.html('<option value="">Loading...</option>');
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: 'ajax.php',
|
||||||
|
type: 'GET',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
get_client_contacts: 1,
|
||||||
|
client_id: clientId
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
$contactSelect.empty();
|
||||||
|
if (response.contacts && response.contacts.length > 0) {
|
||||||
|
$contactSelect.append('<option value="">Select a contact</option>');
|
||||||
|
$.each(response.contacts, function(i, contact) {
|
||||||
|
$contactSelect.append(
|
||||||
|
$('<option>', {
|
||||||
|
value: contact.contact_id,
|
||||||
|
text: contact.contact_name
|
||||||
})
|
})
|
||||||
|
|
||||||
// Client selected listener - populate contact select
|
|
||||||
// We seem to have to use jQuery to listen for events, as the client input is a select2 component?
|
|
||||||
const clientSelectDropdown = document.getElementById("changeClientSelect");
|
|
||||||
$(clientSelectDropdown).on('select2:select', function (e) {
|
|
||||||
let client_id = $(this).find(':selected').val();
|
|
||||||
populateChangeClientModal_Contacts(client_id);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* FUNCTIONS
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Populate client list function
|
|
||||||
function populateChangeClientModal_Clients() {
|
|
||||||
|
|
||||||
// Get current client ID
|
|
||||||
let current_client_id = document.getElementById("client_id").value;
|
|
||||||
|
|
||||||
// Send a GET request to ajax.php as ajax.php?get_active_clients=true
|
|
||||||
jQuery.get(
|
|
||||||
"ajax.php",
|
|
||||||
{get_active_clients: 'true'},
|
|
||||||
function(data) {
|
|
||||||
|
|
||||||
// If we get a response from ajax.php, parse it as JSON
|
|
||||||
const response = JSON.parse(data);
|
|
||||||
|
|
||||||
// Access the data for clients (multiple)
|
|
||||||
const clients = response.clients;
|
|
||||||
|
|
||||||
// Client dropdown already defined in listeners as clientSelectDropdown
|
|
||||||
|
|
||||||
// Clear dropdown
|
|
||||||
let i, L = clientSelectDropdown.options.length - 1;
|
|
||||||
for (i = L; i >= 0; i--) {
|
|
||||||
clientSelectDropdown.remove(i);
|
|
||||||
}
|
|
||||||
clientSelectDropdown[clientSelectDropdown.length] = new Option('- Client -', '0');
|
|
||||||
|
|
||||||
// Populate dropdown
|
|
||||||
clients.forEach(client => {
|
|
||||||
if (parseInt(current_client_id) !== parseInt(client.client_id)) {
|
|
||||||
// Show clients returned (excluding the current client ID - we can't change a ticket client to itself)
|
|
||||||
clientSelectDropdown[clientSelectDropdown.length] = new Option(client.client_name, client.client_id);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
// Populate client contact function (after a client is selected)
|
|
||||||
function populateChangeClientModal_Contacts(client_id) {
|
|
||||||
// Send a GET request to ajax.php as ajax.php?get_client_contacts=true&client_id=NUM
|
|
||||||
jQuery.get(
|
|
||||||
"ajax.php",
|
|
||||||
{get_client_contacts: 'true', client_id: client_id},
|
|
||||||
function(data) {
|
|
||||||
|
|
||||||
// If we get a response from ajax.php, parse it as JSON
|
|
||||||
const response = JSON.parse(data);
|
|
||||||
|
|
||||||
// Access the data for contacts (multiple)
|
|
||||||
const contacts = response.contacts;
|
|
||||||
|
|
||||||
// Contacts dropdown
|
|
||||||
const contactSelectDropdown = document.getElementById("changeContactSelect");
|
|
||||||
|
|
||||||
// Clear Category dropdown
|
|
||||||
let i, L = contactSelectDropdown.options.length - 1;
|
|
||||||
for (i = L; i >= 0; i--) {
|
|
||||||
contactSelectDropdown.remove(i);
|
|
||||||
}
|
|
||||||
contactSelectDropdown[contactSelectDropdown.length] = new Option('- Contact -', '0');
|
|
||||||
|
|
||||||
// Populate dropdown
|
|
||||||
contacts.forEach(contact => {
|
|
||||||
contactSelectDropdown[contactSelectDropdown.length] = new Option(contact.contact_name, contact.contact_id);
|
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
$contactSelect.append('<option value="">No contacts found</option>');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Refresh Select2
|
||||||
|
if ($.fn.select2) {
|
||||||
|
$contactSelect.trigger('change.select2');
|
||||||
}
|
}
|
||||||
);
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error('AJAX Error:', error);
|
||||||
|
$contactSelect.html('<option value="">Failed to load contacts</option>');
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load contacts for the currently selected client when modal opens
|
||||||
|
var initialClientId = $('#client_select').val();
|
||||||
|
loadContacts(initialClientId);
|
||||||
|
|
||||||
|
// Load contacts when client changes
|
||||||
|
$('#client_select').on('change', function() {
|
||||||
|
var clientId = $(this).val();
|
||||||
|
loadContacts(clientId);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
(function() {
|
(function() {
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
// Initialize variables
|
|
||||||
var timerInterval = null;
|
var timerInterval = null;
|
||||||
var ticketID = getCurrentTicketID();
|
var ticketID = getCurrentTicketID();
|
||||||
var elapsedSecs = getElapsedSeconds();
|
var elapsedSecs = getElapsedSeconds();
|
||||||
@@ -22,6 +21,10 @@
|
|||||||
return pausedTime + timeSinceStart;
|
return pausedTime + timeSinceStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function pad(val) {
|
||||||
|
return val < 10 ? "0" + val : val;
|
||||||
|
}
|
||||||
|
|
||||||
function displayTime() {
|
function displayTime() {
|
||||||
|
|
||||||
// Show hrs, mins, sec input placeholders if auto-start is off
|
// Show hrs, mins, sec input placeholders if auto-start is off
|
||||||
@@ -38,17 +41,21 @@
|
|||||||
let minutes = Math.floor(totalSeconds / 60);
|
let minutes = Math.floor(totalSeconds / 60);
|
||||||
let seconds = totalSeconds % 60;
|
let seconds = totalSeconds % 60;
|
||||||
|
|
||||||
document.getElementById("hours").value = pad(hours);
|
let hoursEl = document.getElementById("hours");
|
||||||
document.getElementById("minutes").value = pad(minutes);
|
let minutesEl = document.getElementById("minutes");
|
||||||
document.getElementById("seconds").value = pad(seconds);
|
let secondsEl = document.getElementById("seconds");
|
||||||
}
|
|
||||||
|
|
||||||
function pad(val) {
|
if (hoursEl && minutesEl && secondsEl) {
|
||||||
return val < 10 ? "0" + val : val;
|
hoursEl.value = pad(hours);
|
||||||
|
minutesEl.value = pad(minutes);
|
||||||
|
secondsEl.value = pad(seconds);
|
||||||
|
} else {
|
||||||
|
console.warn("Timer input elements not found");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function countTime() {
|
function countTime() {
|
||||||
elapsedSecs++;
|
elapsedSecs = getElapsedSeconds();
|
||||||
displayTime();
|
displayTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,7 +64,8 @@
|
|||||||
localStorage.setItem(getLocalStorageKey("startTime"), Date.now().toString());
|
localStorage.setItem(getLocalStorageKey("startTime"), Date.now().toString());
|
||||||
}
|
}
|
||||||
timerInterval = setInterval(countTime, 1000);
|
timerInterval = setInterval(countTime, 1000);
|
||||||
document.getElementById("startStopTimer").innerHTML = "<i class='fas fa-pause'></i>";
|
let btn = document.getElementById("startStopTimer");
|
||||||
|
if (btn) btn.innerHTML = "<i class='fas fa-pause'></i>";
|
||||||
localStorage.setItem("ticket-timer-running-" + ticketID, "true");
|
localStorage.setItem("ticket-timer-running-" + ticketID, "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +77,8 @@
|
|||||||
let currentElapsed = getElapsedSeconds();
|
let currentElapsed = getElapsedSeconds();
|
||||||
localStorage.setItem(getLocalStorageKey("pausedTime"), currentElapsed.toString());
|
localStorage.setItem(getLocalStorageKey("pausedTime"), currentElapsed.toString());
|
||||||
localStorage.removeItem(getLocalStorageKey("startTime"));
|
localStorage.removeItem(getLocalStorageKey("startTime"));
|
||||||
document.getElementById("startStopTimer").innerHTML = "<i class='fas fa-play'></i>";
|
let btn = document.getElementById("startStopTimer");
|
||||||
|
if (btn) btn.innerHTML = "<i class='fas fa-play'></i>";
|
||||||
localStorage.setItem("ticket-timer-running-" + ticketID, "false");
|
localStorage.setItem("ticket-timer-running-" + ticketID, "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +95,8 @@
|
|||||||
elapsedSecs = 0;
|
elapsedSecs = 0;
|
||||||
clearTimeStorage();
|
clearTimeStorage();
|
||||||
displayTime();
|
displayTime();
|
||||||
document.getElementById("startStopTimer").innerHTML = "<i class='fas fa-play'></i>";
|
let btn = document.getElementById("startStopTimer");
|
||||||
|
if (btn) btn.innerHTML = "<i class='fas fa-play'></i>";
|
||||||
}
|
}
|
||||||
localStorage.setItem("ticket-timer-running-" + ticketID, "false");
|
localStorage.setItem("ticket-timer-running-" + ticketID, "false");
|
||||||
}
|
}
|
||||||
@@ -97,7 +107,8 @@
|
|||||||
elapsedSecs = 0;
|
elapsedSecs = 0;
|
||||||
clearTimeStorage();
|
clearTimeStorage();
|
||||||
displayTime();
|
displayTime();
|
||||||
document.getElementById("startStopTimer").innerHTML = "<i class='fas fa-play'></i>";
|
let btn = document.getElementById("startStopTimer");
|
||||||
|
if (btn) btn.innerHTML = "<i class='fas fa-play'></i>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleInputFocus() {
|
function handleInputFocus() {
|
||||||
@@ -105,9 +116,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateTimeFromInput() {
|
function updateTimeFromInput() {
|
||||||
const hours = parseInt(document.getElementById("hours").value, 10) || 0;
|
const hours = parseInt(document.getElementById("hours")?.value, 10) || 0;
|
||||||
const minutes = parseInt(document.getElementById("minutes").value, 10) || 0;
|
const minutes = parseInt(document.getElementById("minutes")?.value, 10) || 0;
|
||||||
const seconds = parseInt(document.getElementById("seconds").value, 10) || 0;
|
const seconds = parseInt(document.getElementById("seconds")?.value, 10) || 0;
|
||||||
elapsedSecs = (hours * 3600) + (minutes * 60) + seconds;
|
elapsedSecs = (hours * 3600) + (minutes * 60) + seconds;
|
||||||
|
|
||||||
if (!timerInterval) {
|
if (!timerInterval) {
|
||||||
@@ -120,61 +131,93 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function checkStatusAndPauseTimer() {
|
function checkStatusAndPauseTimer() {
|
||||||
var status = document.querySelector('select[name="status"]').value;
|
var statusEl = document.querySelector('select[name="status"]');
|
||||||
|
if (statusEl) {
|
||||||
|
var status = statusEl.value;
|
||||||
if (status.includes("Pending") || status.includes("Close")) {
|
if (status.includes("Pending") || status.includes("Close")) {
|
||||||
pauseTimer();
|
pauseTimer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Attach input listeners
|
// Update on tab visibility change to handle background sleep
|
||||||
document.getElementById("hours").addEventListener('change', updateTimeFromInput);
|
document.addEventListener('visibilitychange', function() {
|
||||||
document.getElementById("minutes").addEventListener('change', updateTimeFromInput);
|
if (!document.hidden) {
|
||||||
document.getElementById("seconds").addEventListener('change', updateTimeFromInput);
|
elapsedSecs = getElapsedSeconds();
|
||||||
|
displayTime();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
document.getElementById("hours").addEventListener('focus', handleInputFocus);
|
// Attach input listeners with null checks
|
||||||
document.getElementById("minutes").addEventListener('focus', handleInputFocus);
|
const hoursEl = document.getElementById("hours");
|
||||||
document.getElementById("seconds").addEventListener('focus', handleInputFocus);
|
if (hoursEl) {
|
||||||
|
hoursEl.addEventListener('change', updateTimeFromInput);
|
||||||
|
hoursEl.addEventListener('focus', handleInputFocus);
|
||||||
|
}
|
||||||
|
|
||||||
document.querySelector('select[name="status"]').addEventListener('change', checkStatusAndPauseTimer);
|
const minutesEl = document.getElementById("minutes");
|
||||||
|
if (minutesEl) {
|
||||||
|
minutesEl.addEventListener('change', updateTimeFromInput);
|
||||||
|
minutesEl.addEventListener('focus', handleInputFocus);
|
||||||
|
}
|
||||||
|
|
||||||
document.getElementById("startStopTimer").addEventListener('click', function() {
|
const secondsEl = document.getElementById("seconds");
|
||||||
|
if (secondsEl) {
|
||||||
|
secondsEl.addEventListener('change', updateTimeFromInput);
|
||||||
|
secondsEl.addEventListener('focus', handleInputFocus);
|
||||||
|
}
|
||||||
|
|
||||||
|
const statusEl = document.querySelector('select[name="status"]');
|
||||||
|
if (statusEl) {
|
||||||
|
statusEl.addEventListener('change', checkStatusAndPauseTimer);
|
||||||
|
}
|
||||||
|
|
||||||
|
const startStopBtn = document.getElementById("startStopTimer");
|
||||||
|
if (startStopBtn) {
|
||||||
|
startStopBtn.addEventListener('click', function() {
|
||||||
if (timerInterval === null) {
|
if (timerInterval === null) {
|
||||||
startTimer();
|
startTimer();
|
||||||
} else {
|
} else {
|
||||||
pauseTimer();
|
pauseTimer();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
document.getElementById("resetTimer").addEventListener('click', function() {
|
const resetBtn = document.getElementById("resetTimer");
|
||||||
|
if (resetBtn) {
|
||||||
|
resetBtn.addEventListener('click', function() {
|
||||||
resetTimer();
|
resetTimer();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
document.getElementById("ticket_add_reply").addEventListener('click', function() {
|
const addReplyBtn = document.getElementById("ticket_add_reply");
|
||||||
|
if (addReplyBtn) {
|
||||||
|
addReplyBtn.addEventListener('click', function() {
|
||||||
setTimeout(forceResetTimer, 100);
|
setTimeout(forceResetTimer, 100);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
document.getElementById("ticket_close").addEventListener('click', function() {
|
const closeBtn = document.getElementById("ticket_close");
|
||||||
|
if (closeBtn) {
|
||||||
|
closeBtn.addEventListener('click', function() {
|
||||||
setTimeout(clearTimeStorage, 100);
|
setTimeout(clearTimeStorage, 100);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Final initialization logic
|
// Final initialization logic
|
||||||
try {
|
try {
|
||||||
displayTime();
|
displayTime();
|
||||||
|
|
||||||
// If no timer state, respect ticketAutoStart
|
|
||||||
if (!localStorage.getItem(getLocalStorageKey("startTime")) && !localStorage.getItem(getLocalStorageKey("pausedTime"))) {
|
if (!localStorage.getItem(getLocalStorageKey("startTime")) && !localStorage.getItem(getLocalStorageKey("pausedTime"))) {
|
||||||
if (ticketAutoStart === 1) {
|
if (typeof ticketAutoStart !== "undefined" && ticketAutoStart === 1) {
|
||||||
startTimer();
|
startTimer();
|
||||||
} else {
|
} else {
|
||||||
pauseTimer();
|
pauseTimer();
|
||||||
}
|
}
|
||||||
}
|
} else if (localStorage.getItem(getLocalStorageKey("startTime"))) {
|
||||||
// If timer already running, resume it
|
|
||||||
else if (localStorage.getItem(getLocalStorageKey("startTime"))) {
|
|
||||||
startTimer();
|
startTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check and pause timer if status is pending
|
|
||||||
checkStatusAndPauseTimer();
|
checkStatusAndPauseTimer();
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -79,17 +79,19 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-map-marker-alt mr-2"></i>Locations</h3>
|
<h3 class="card-title mt-2"><i class="fa fa-fw fa-map-marker-alt mr-2"></i>Locations</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addLocationModal">
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/location/location_add.php?<?= $client_url ?>">
|
||||||
<i class="fas fa-plus mr-2"></i>New Location
|
<i class="fas fa-plus mr-2"></i>New Location
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#importLocationModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/location/location_import.php?<?= $client_url ?>">
|
||||||
<i class="fa fa-fw fa-upload mr-2"></i>Import
|
<i class="fa fa-fw fa-upload mr-2"></i>Import
|
||||||
</a>
|
</a>
|
||||||
<?php if ($num_rows[0] > 0) { ?>
|
<?php if ($num_rows[0] > 0) { ?>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportLocationModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/location/location_export.php?<?= $client_url ?>">
|
||||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||||
</a>
|
</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@@ -180,7 +182,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>)
|
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>)
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkAssignTagsModal">
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/location/location_bulk_assign_tags.php"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-tags mr-2"></i>Assign Tags
|
<i class="fas fa-fw fa-tags mr-2"></i>Assign Tags
|
||||||
</a>
|
</a>
|
||||||
<?php if ($archived) { ?>
|
<?php if ($archived) { ?>
|
||||||
@@ -393,18 +397,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?php require_once "modals/location/location_bulk_assign_tags.php"; ?>
|
|
||||||
</form>
|
</form>
|
||||||
<?php require_once "../includes/filter_footer.php";
|
<?php require_once "../includes/filter_footer.php"; ?>
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="../js/bulk_actions.js"></script>
|
<script src="../js/bulk_actions.js"></script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "modals/location/location_add.php";
|
|
||||||
require_once "modals/location/location_import.php";
|
|
||||||
require_once "modals/location/location_export.php";
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
<div class="modal" id="addAccountModal" tabindex="-1">
|
<?php
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fa fa-fw fa-piggy-bank mr-2"></i>New Account</h5>
|
<h5 class="modal-title"><i class="fa fa-fw fa-piggy-bank mr-2"></i>New Account</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
@@ -28,7 +32,7 @@
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-dollar-sign"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-dollar-sign"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" inputmode="numeric" pattern="-?[0-9]*\.?[0-9]{0,2}" name="opening_balance" placeholder="0.00" required>
|
<input type="text" class="form-control" inputmode="decimal" pattern="-?[0-9]*\.?[0-9]{0,2}" name="opening_balance" placeholder="0.00" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -58,6 +62,6 @@
|
|||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<?php
|
||||||
</div>
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ if ($os_sql && mysqli_num_rows($os_sql) > 0) {
|
|||||||
$json_os = json_encode($os_arr);
|
$json_os = json_encode($os_arr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sql_tags_select = mysqli_query($mysqli, "SELECT tag_id, tag_name FROM tags WHERE tag_type = 5 ORDER BY tag_name ASC");
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -465,6 +467,33 @@ ob_start();
|
|||||||
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="notes"></textarea>
|
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="notes"></textarea>
|
||||||
</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
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_array($sql_tags_select)) {
|
||||||
|
$tag_id = intval($row['tag_id']);
|
||||||
|
$tag_name = nullable_htmlentities($row['tag_name']);
|
||||||
|
?>
|
||||||
|
<option value="<?= $tag_id ?>"><?= $tag_name ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-secondary ajax-modal" type="button"
|
||||||
|
data-modal-url="../admin/modals/tag/tag_add.php?type=5">
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,13 +1,26 @@
|
|||||||
<div class="modal" id="bulkAddTicketModal" tabindex="-1">
|
<?php
|
||||||
<div class="modal-dialog modal-lg">
|
|
||||||
<div class="modal-content">
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
$asset_ids = array_map('intval', $_GET['asset_ids'] ?? []);
|
||||||
|
|
||||||
|
$count = count($asset_ids);
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fas fa-fw fa-life-ring mr-2"></i>Creating Tickets for Assets</h5>
|
<h5 class="modal-title"><i class="fas fa-fw fa-life-ring mr-2"></i>Create Tickets for <strong><?= $count ?></strong> Assets</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
<span>×</span>
|
<span>×</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
|
<?php foreach ($asset_ids as $asset_id) { ?><input type="hidden" name="asset_ids[]" value="<?= $asset_id ?>"><?php } ?>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -16,7 +29,7 @@
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="bulk_subject" placeholder="Asset Name will be prepended to Subject" maxlength="200">
|
<input type="text" class="form-control" name="bulk_subject" placeholder="Asset Name will be prepended to Subject" maxlength="200" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -33,7 +46,7 @@
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-thermometer-half"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-thermometer-half"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<select class="form-control select2" name="bulk_priority">
|
<select class="form-control select2" name="bulk_priority" required>
|
||||||
<option>Low</option>
|
<option>Low</option>
|
||||||
<option>Medium</option>
|
<option>Medium</option>
|
||||||
<option>High</option>
|
<option>High</option>
|
||||||
@@ -125,10 +138,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="submit" name="bulk_add_asset_ticket" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Create</button>
|
<button type="submit" name="bulk_add_asset_ticket" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Create Tickets</button>
|
||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
</div>
|
<?php
|
||||||
</div>
|
require_once '../../../includes/modal_footer.php';
|
||||||
</div>
|
|
||||||
|
|||||||
@@ -1,17 +1,30 @@
|
|||||||
<div class="modal" id="bulkAssignContactModal" tabindex="-1">
|
<?php
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
$client_id = intval($_GET['client_id']);
|
||||||
|
$asset_ids = array_map('intval', $_GET['asset_ids'] ?? []);
|
||||||
|
|
||||||
|
$count = count($asset_ids);
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fa fa-fw fa-user-check mr-2"></i>Bulk Assign Contact</h5>
|
<h5 class="modal-title"><i class="fa fa-fw fa-user-check mr-2"></i>Assign Contact to <strong><?= $count ?></strong> Assets</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
<span>×</span>
|
<span>×</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
|
<?php foreach ($asset_ids as $asset_id) { ?><input type="hidden" name="asset_ids[]" value="<?= $asset_id ?>"><?php } ?>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Assign To</label>
|
<label>Contact</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||||
@@ -36,9 +49,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="submit" name="bulk_assign_asset_contact" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Assign</button>
|
<button type="submit" name="bulk_assign_asset_contact" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Assign Contact</button>
|
||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<?php
|
||||||
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -1,13 +1,27 @@
|
|||||||
<div class="modal" id="bulkAssignLocationModal" tabindex="-1">
|
<?php
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
$client_id = intval($_GET['client_id']);
|
||||||
|
$asset_ids = array_map('intval', $_GET['asset_ids'] ?? []);
|
||||||
|
|
||||||
|
$count = count($asset_ids);
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fa fa-fw fa-map-marker-alt mr-2"></i>Bulk Assign Location</h5>
|
<h5 class="modal-title"><i class="fa fa-fw fa-map-marker-alt mr-2"></i>Assign Location to <strong><?= $count ?></strong> Assets</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
<span>×</span>
|
<span>×</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
|
<?php foreach ($asset_ids as $asset_id) { ?><input type="hidden" name="asset_ids[]" value="<?= $asset_id ?>"><?php } ?>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -35,9 +49,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="submit" name="bulk_assign_asset_location" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Assign</button>
|
<button type="submit" name="bulk_assign_asset_location" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Assign Location</button>
|
||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<?php
|
||||||
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -1,13 +1,24 @@
|
|||||||
<div class="modal" id="bulkAssignPhysicalLocationModal" tabindex="-1">
|
<?php
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
$asset_ids = array_map('intval', $_GET['asset_ids'] ?? []);
|
||||||
|
|
||||||
|
$count = count($asset_ids);
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fa fa-fw fa-map-marker-alt mr-2"></i>Bulk Set Physical Location</h5>
|
<h5 class="modal-title"><i class="fa fa-fw fa-map-marker-alt mr-2"></i>Set Physical Location for <strong><?= $count ?></strong> Assets</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
<span>×</span>
|
<span>×</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
|
<?php foreach ($asset_ids as $asset_id) { ?><input type="hidden" name="asset_ids[]" value="<?= $asset_id ?>"><?php } ?>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -23,9 +34,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="submit" name="bulk_assign_asset_physical_location" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Assign</button>
|
<button type="submit" name="bulk_assign_asset_physical_location" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Set Physical Location</button>
|
||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<?php
|
||||||
|
require_once '../../../includes/modal_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