mirror of
https://github.com/itflow-org/itflow
synced 2026-12-03 01:29:01 +00:00
Shorten the long windows: a role has Details and What it can open, each module one row with what its level allows under it; Edit Ticket gets a Planning tab for its due date, tags and billing, opened by the Due pencil; a recurring ticket's Schedule tab becomes Planning with the priority, category and billing of the tickets it raises, and Frequency reads How often; a recurring expense has Expense, and Client and reference; the tag, category, link and asset type icon pickers show three rows and scroll to the icon picked; invoicing a ticket gives a new invoice the ticket as its scope; a smaller description box when quoting a ticket; 26.12.3 changelog entries
This commit is contained in:
@@ -39,6 +39,12 @@ Update from Maintenance > Update as usual - this release has four database chang
|
||||
- Writing a document in the client portal works as it does for you: the editor shows it as it will read, with headings, lists, quotes, code, tables and lines on its toolbar, or contacts can write it in Markdown, with the Markdown toolbar and Preview, switching either way as they write. The next document starts in the way they wrote last.
|
||||
- Long windows are split into tabs, so they are shorter. New Ticket has a Planning tab for the due date, the status it starts in, the work booked, tags and billing, leaving who it is for and what it is about on Details. A product or service has Details, Billing, Ordering and, for a product, Asset. A service has Service, Recovery & notes and, when it is new, Depends on. An event has When and Who & where. An expense has Expense, and Client & receipt. In Admin, a payment provider has Keys, Payments and Card fee, an RMM provider or network platform Connection, Alerts and Asset types, an identity provider Setup, Who it signs in and The app (or The mail server), and a ticket status Details and What it does.
|
||||
- When the check on saving a payment provider or an RMM provider finds something wrong, the window opens the tab that field is on, so the message is next to it. A required field left empty on a hidden tab already opened its tab.
|
||||
- A role's window has Details and What it can open, and each part of ITFlow is a single row: its name and what it covers, the None, Read, Modify and Full buttons, and under it what the level picked allows. Point at a level for what it adds.
|
||||
- Edit Ticket has a Planning tab like New Ticket's, with the due date, tags and billing. The pencil beside Due on a ticket opens it there.
|
||||
- A recurring ticket's Schedule tab is now Planning, and it has the priority, category and billing of the tickets it raises. Frequency is How often in New Recurring Ticket, as in Edit.
|
||||
- A recurring expense has Expense, and Client & reference, like a one-off expense.
|
||||
- The icon pickers in the tag, category, link and asset type windows show three rows and scroll, starting on the icon picked.
|
||||
- Invoicing a ticket on a new invoice gives the invoice the ticket's number and subject as its scope, without asking - change it on the invoice. Making a quote from a ticket has a smaller description box.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -80,6 +86,7 @@ Update from Maintenance > Update as usual - this release has four database chang
|
||||
- includes/document_editors.php is a document's two editors and the switch between them, shared by agent/modals/document/document_form.php and client/document_add.php (which now posts format, content and markdown, saved through documentPostedContent()). js/document_markdown.js converts at the address its script tag gives (data-markdown-url, client/post.php markdown_to_html and html_to_markdown in the portal). itflowProseContentStyle() moved to js/tinymce_defaults.js; js/portal.js sets up .tinymce-document, and its required check looks in the Markdown box when that is shown.
|
||||
- agent/includes/inc_all_client.php: without a client_id, or with one that isn't there, it draws That client isn't here in the agent layout and exits, before anything queries with no client - it was an SQL error (or a tagPills() TypeError) and a blank page. admin/modules.php and its commented-out menu entry are removed.
|
||||
- Tabs in agent/modals/product/product_form.php, service/service_form.php, calendar/calendar_event_form.php, expense/expense_form.php and ticket/ticket_add.php, and in admin/modals/payment_provider/payment_provider_edit.php, rmm/rmm_provider_edit.php, identity_provider/identity_provider_edit.php and ticket_status/ticket_status_form.php - the same field names, so the posts and their handlers are unchanged. js/app.js has window.itflowRevealTab(field), used by the invalid-field handler and by the provider windows' server-check errors, to open the tab a field is on.
|
||||
- admin/modals/role/role_form.php draws a module as a list-group row with data-role-allows (its levels' text as JSON); js/role_form.js writes what the level picked allows into [data-role-can]. agent/modals/ticket/ticket_edit.php takes ?tab=planning. ticket_invoice_add.php posts scope as a hidden field, so add_invoice_from_ticket is unchanged. .itflow-tag-icons is three rows high (6.6rem), and js/app.js scrolls its .active icon into the box on shown.bs.modal and shown.bs.tab.
|
||||
|
||||
## [26.12.2]
|
||||
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
/*
|
||||
* A role's fields - for role_add.php (new, or a copy) and role_edit.php,
|
||||
* which set $role (a roleRow() to fill from, or null) and $role_admin_blocker
|
||||
* (why it can't stop being an admin role, '' when it can). An admin role
|
||||
* opens everything; any other has a level of each module, each showing what
|
||||
* it lets them do. js/role_form.js hides the levels for an admin role and
|
||||
* ticks off what a level allows as it is picked.
|
||||
* (why it can't stop being an admin role, '' when it can). Two tabs:
|
||||
* Details (name, description, Admin) and What it can open. An admin role
|
||||
* opens everything; any other has a level of each module, one line each, with
|
||||
* what the level picked allows under it and what each level adds on its
|
||||
* button. js/role_form.js hides the levels for an admin role and says what a
|
||||
* level allows as it is picked.
|
||||
*/
|
||||
|
||||
isset($mysqli) || die("Direct file access is not allowed");
|
||||
@@ -19,79 +21,90 @@ $r_admin_locked = ($role_admin_blocker ?? '') !== '';
|
||||
?>
|
||||
|
||||
<div data-role-form>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-user-tag"></i></span>
|
||||
<input type="text" class="form-control" name="name" maxlength="200" placeholder="Help Desk, Billing, Field Tech" value="<?= escapeHtml($r['role_name'] ?? '') ?>" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="nav nav-pills nav-fill flex-nowrap overflow-auto mb-3 itflow-asset-form-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-bs-toggle="pill" href="#roleFormDetails<?= intval($r['role_id'] ?? 0) ?>"><i class="fas fa-fw fa-user-tag me-2 d-none d-lg-inline"></i>Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-bs-toggle="pill" href="#roleFormModules<?= intval($r['role_id'] ?? 0) ?>"><i class="fas fa-fw fa-th-large me-2 d-none d-lg-inline"></i>What it can open</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Description</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-align-left"></i></span>
|
||||
<input type="text" class="form-control" name="description" maxlength="200" placeholder="Who it is for" value="<?= escapeHtml($r['role_description'] ?? '') ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" name="admin" value="1" id="roleAdmin" data-role-admin<?= $r_admin ? ' checked' : '' ?><?= $r_admin_locked ? ' disabled' : '' ?>>
|
||||
<label class="form-check-label fw-semibold" for="roleAdmin"><i class="fas fa-fw fa-user-shield me-1"></i>Admin</label>
|
||||
<div class="form-text mt-0">Every part of ITFlow, every client, and Admin - users, roles and settings.</div>
|
||||
<?php if ($r_admin_locked) { ?>
|
||||
<input type="hidden" name="admin" value="1">
|
||||
<div class="form-text mt-0 text-warning-emphasis"><i class="fas fa-fw fa-lock me-1"></i>It stays an admin role: <?= escapeHtml($role_admin_blocker) ?></div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-role-levels<?= $r_admin ? ' hidden' : '' ?>>
|
||||
<label class="mb-2">What its agents can open</label>
|
||||
<?php
|
||||
// Each client's pages need Clients - most of the rest is on them
|
||||
$r_by_name = [];
|
||||
foreach (roleModules() as $module_id => $module) {
|
||||
$r_by_name[$module['module_name']] = intval($r_levels[$module_id] ?? 0);
|
||||
}
|
||||
$r_needs_clients = empty($r_by_name['module_client'])
|
||||
&& max($r_by_name['module_support'] ?? 0, $r_by_name['module_credential'] ?? 0, $r_by_name['module_sales'] ?? 0, $r_by_name['module_financial'] ?? 0) > 0;
|
||||
?>
|
||||
<div class="alert alert-warning small py-2" data-role-needs-clients<?= $r_needs_clients ? '' : ' hidden' ?>><i class="fas fa-fw fa-exclamation-triangle me-1"></i>Each client's pages need Clients at Read, and most of what is picked here is on them - with Clients at None, its agents are turned away from most of it.</div>
|
||||
<?php foreach (roleModules() as $module_id => $module) {
|
||||
$level = min(intval($r_levels[$module_id] ?? 0), $module['max']);
|
||||
$label = escapeHtml($module['label']); ?>
|
||||
<div class="border rounded p-2 mb-2" data-role-module="<?= escapeHtml($module['module_name']) ?>">
|
||||
<div class="d-flex flex-wrap align-items-center gap-2">
|
||||
<div class="d-flex align-items-center gap-2 flex-grow-1 min-w-0">
|
||||
<span class="itflow-asset-icon itflow-asset-icon-sm itflow-asset-tone-other" aria-hidden="true"><i class="fas fa-fw <?= $module['icon'] ?>"></i></span>
|
||||
<div class="min-w-0">
|
||||
<div class="fw-semibold"><?= $label ?></div>
|
||||
<div class="small text-secondary"><?= escapeHtml($module['about']) ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group btn-group-sm" role="group" aria-label="<?= $label ?>">
|
||||
<?php foreach (ROLE_LEVELS as $value => $level_label) {
|
||||
if ($value > $module['max']) {
|
||||
break;
|
||||
}
|
||||
$id = "roleLevel{$module_id}_$value"; ?>
|
||||
<input class="btn-check" type="radio" name="levels[<?= $module_id ?>]" id="<?= $id ?>" value="<?= $value ?>" autocomplete="off"<?= $level === $value ? ' checked' : '' ?>>
|
||||
<label class="btn btn-outline-<?= ROLE_LEVEL_TONES[$value] ?>" for="<?= $id ?>"><?= $level_label ?></label>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<!-- Its name, and whether it is an admin role -->
|
||||
<div class="tab-pane fade show active" id="roleFormDetails<?= intval($r['role_id'] ?? 0) ?>">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-user-tag"></i></span>
|
||||
<input type="text" class="form-control" name="name" maxlength="200" placeholder="Help Desk, Billing, Field Tech" value="<?= escapeHtml($r['role_name'] ?? '') ?>" required autofocus>
|
||||
</div>
|
||||
<ul class="list-unstyled small mb-0 mt-2 itflow-role-level-list">
|
||||
<?php foreach ($module['levels'] as $value => $text) {
|
||||
$on = $value <= $level; ?>
|
||||
<li data-role-level="<?= $value ?>"<?= $on ? '' : ' class="is-off"' ?>><i class="fas fa-fw <?= $on ? 'fa-check text-success' : 'fa-times' ?> me-1" aria-hidden="true"></i><?= escapeHtml($text) ?></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Description</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-align-left"></i></span>
|
||||
<input type="text" class="form-control" name="description" maxlength="200" placeholder="Who it is for" value="<?= escapeHtml($r['role_description'] ?? '') ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" name="admin" value="1" id="roleAdmin" data-role-admin<?= $r_admin ? ' checked' : '' ?><?= $r_admin_locked ? ' disabled' : '' ?>>
|
||||
<label class="form-check-label fw-semibold" for="roleAdmin"><i class="fas fa-fw fa-user-shield me-1"></i>Admin</label>
|
||||
<div class="form-text mt-0">Every part of ITFlow, every client, and Admin - users, roles and settings.</div>
|
||||
<?php if ($r_admin_locked) { ?>
|
||||
<input type="hidden" name="admin" value="1">
|
||||
<div class="form-text mt-0 text-warning-emphasis"><i class="fas fa-fw fa-lock me-1"></i>It stays an admin role: <?= escapeHtml($role_admin_blocker) ?></div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- A level of each module - one line each, with what the level picked allows under it -->
|
||||
<div class="tab-pane fade" id="roleFormModules<?= intval($r['role_id'] ?? 0) ?>">
|
||||
<div data-role-levels<?= $r_admin ? ' hidden' : '' ?>>
|
||||
<?php
|
||||
// Each client's pages need Clients - most of the rest is on them
|
||||
$r_by_name = [];
|
||||
foreach (roleModules() as $module_id => $module) {
|
||||
$r_by_name[$module['module_name']] = intval($r_levels[$module_id] ?? 0);
|
||||
}
|
||||
$r_needs_clients = empty($r_by_name['module_client'])
|
||||
&& max($r_by_name['module_support'] ?? 0, $r_by_name['module_credential'] ?? 0, $r_by_name['module_sales'] ?? 0, $r_by_name['module_financial'] ?? 0) > 0;
|
||||
?>
|
||||
<div class="alert alert-warning small py-2" data-role-needs-clients<?= $r_needs_clients ? '' : ' hidden' ?>><i class="fas fa-fw fa-exclamation-triangle me-1"></i>Each client's pages need Clients at Read, and most of what is picked here is on them - with Clients at None, its agents are turned away from most of it.</div>
|
||||
<div class="list-group">
|
||||
<?php foreach (roleModules() as $module_id => $module) {
|
||||
$level = min(intval($r_levels[$module_id] ?? 0), $module['max']);
|
||||
$label = escapeHtml($module['label']);
|
||||
$allows = array_slice($module['levels'], 0, $level); ?>
|
||||
<div class="list-group-item d-flex align-items-center gap-2 py-2 itflow-role-module" data-role-module="<?= escapeHtml($module['module_name']) ?>" data-role-allows="<?= escapeHtml(json_encode($module['levels'])) ?>">
|
||||
<span class="itflow-asset-icon itflow-asset-icon-sm itflow-asset-tone-other" aria-hidden="true"><i class="fas fa-fw <?= $module['icon'] ?>"></i></span>
|
||||
<div class="flex-grow-1 min-w-0">
|
||||
<div class="text-truncate"><span class="fw-semibold"><?= $label ?></span> <span class="small text-secondary" title="<?= escapeHtml($module['about']) ?>"><?= escapeHtml($module['about']) ?></span></div>
|
||||
<div class="small text-truncate <?= $level ? 'text-body' : 'text-secondary' ?>" data-role-can title="<?= escapeHtml($allows ? implode(' · ', $allows) : 'Nothing') ?>"><i class="fas fa-fw <?= $level ? 'fa-check text-success' : 'fa-times' ?> me-1" aria-hidden="true"></i><?= escapeHtml($allows ? implode(' · ', $allows) : 'Nothing') ?></div>
|
||||
</div>
|
||||
<div class="btn-group btn-group-sm flex-shrink-0" role="group" aria-label="<?= $label ?>">
|
||||
<?php foreach (ROLE_LEVELS as $value => $level_label) {
|
||||
if ($value > $module['max']) {
|
||||
break;
|
||||
}
|
||||
$id = "roleLevel{$module_id}_$value"; ?>
|
||||
<input class="btn-check" type="radio" name="levels[<?= $module_id ?>]" id="<?= $id ?>" value="<?= $value ?>" autocomplete="off"<?= $level === $value ? ' checked' : '' ?>>
|
||||
<label class="btn btn-outline-<?= ROLE_LEVEL_TONES[$value] ?>" for="<?= $id ?>" title="<?= escapeHtml($value ? $module['levels'][$value] : 'Nothing - its agents can\'t open it') ?>"><?= $level_label ?></label>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="small text-secondary" data-role-admin-note<?= $r_admin ? '' : ' hidden' ?>><i class="fas fa-fw fa-info-circle me-1"></i>An admin role opens every part of ITFlow, so there are no levels to set. Its levels are kept, for if it stops being one.</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="small text-secondary" data-role-admin-note<?= $r_admin ? '' : ' hidden' ?>><i class="fas fa-fw fa-info-circle me-1"></i>An admin role opens every part of ITFlow, so there are no levels to set. Its levels are kept, for if it stops being one.</div>
|
||||
</div>
|
||||
|
||||
<script src="<?= staticFileUrl('/js/role_form.js') ?>"></script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* The Schedule tab's booking and making ahead, in New and Edit Recurring
|
||||
* The Planning tab's booking and making ahead, in New and Edit Recurring
|
||||
* Ticket (agent/modals/recurring_ticket/) - the time, length and visit each
|
||||
* ticket is booked for, and how many days ahead it is made (functions/ticket.php). Set
|
||||
* $ahead_row to the recurring ticket when editing, null for a new one. Only
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
/*
|
||||
* The fields of a recurring expense - shared by New Recurring Expense and
|
||||
* Edit. Set before including:
|
||||
* Edit, on two tabs as New Expense: Expense (who, how much, how often, what
|
||||
* for, where from) and Client & reference. Set before including:
|
||||
*
|
||||
* $form_row recurringExpenseRow() when editing, null for a new one
|
||||
* $form_vendor_id the vendor a new one starts with (0 to pick)
|
||||
@@ -71,177 +72,200 @@ while ($row = mysqli_fetch_assoc($sql)) {
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="row g-3" id="<?= $form_id ?>" data-recurring-expense-form>
|
||||
<div id="<?= $form_id ?>" data-recurring-expense-form>
|
||||
|
||||
<div class="col-md-7">
|
||||
<label class="form-label">Vendor <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-building"></i></span>
|
||||
<select class="form-select select2" name="vendor" required data-expense-vendor>
|
||||
<option value="">- Select a vendor -</option>
|
||||
<?php foreach ($form_vendors as $vendor_id => $vendor) { ?>
|
||||
<option value="<?= $vendor_id ?>" <?= $form_vendor === $vendor_id ? 'selected' : '' ?><?= selectOptionVendor($vendor['vendor_name'], $vendor['vendor_archived_at'] ? 'Archived' : (string) $vendor['vendor_description']) ?>><?= escapeHtml($vendor['vendor_name']) ?></option>
|
||||
<ul class="nav nav-pills nav-fill flex-nowrap overflow-auto mb-3 itflow-asset-form-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-bs-toggle="pill" href="#<?= $form_id ?>Expense"><i class="fas fa-fw fa-shopping-cart me-2 d-none d-lg-inline"></i>Expense</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-bs-toggle="pill" href="#<?= $form_id ?>Client"><i class="fas fa-fw fa-user me-2 d-none d-lg-inline"></i>Client & reference</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<!-- Who is paid, how much, how often, what for, and from where -->
|
||||
<div class="tab-pane fade show active" id="<?= $form_id ?>Expense">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-7">
|
||||
<label class="form-label">Vendor <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-building"></i></span>
|
||||
<select class="form-select select2" name="vendor" required data-expense-vendor>
|
||||
<option value="">- Select a vendor -</option>
|
||||
<?php foreach ($form_vendors as $vendor_id => $vendor) { ?>
|
||||
<option value="<?= $vendor_id ?>" <?= $form_vendor === $vendor_id ? 'selected' : '' ?><?= selectOptionVendor($vendor['vendor_name'], $vendor['vendor_archived_at'] ? 'Archived' : (string) $vendor['vendor_description']) ?>><?= escapeHtml($vendor['vendor_name']) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<a class="btn btn-outline-secondary" title="Add a vendor - opens Vendors in a new tab" href="vendors.php" target="_blank" rel="noopener"><i class="fas fa-fw fa-plus"></i></a>
|
||||
</div>
|
||||
<div class="form-text" data-expense-filled hidden>Filled in from the last expense with them.</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-5">
|
||||
<label class="form-label">Amount each time <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-dollar-sign"></i></span>
|
||||
<input type="text" class="form-control text-end fw-semibold" inputmode="decimal" pattern="[0-9,]*\.?[0-9]{0,2}" name="amount" placeholder="0.00" required
|
||||
value="<?= $form_edit ? number_format(floatval($form_row['recurring_expense_amount']), 2, '.', '') : '' ?>" data-recurring-amount>
|
||||
<span class="input-group-text"><?= escapeHtml($form_currency) ?></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$tax_form_id = $form_id;
|
||||
$tax_selected = $form_edit ? intval($form_row['recurring_expense_tax_id']) : 0;
|
||||
$tax_amount = $form_edit ? floatval($form_row['recurring_expense_tax_amount']) : null;
|
||||
$tax_currency = $form_currency;
|
||||
$tax_lock = false;
|
||||
require __DIR__ . '/../expense/expense_tax_fields.php';
|
||||
?>
|
||||
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">How often <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-sync-alt"></i></span>
|
||||
<select class="form-select select2" name="frequency" required data-recurring-frequency>
|
||||
<?php foreach (recurringInvoiceFrequencies() as $key => $label) { ?>
|
||||
<option value="<?= $key ?>" <?= $form_frequency === $key ? 'selected' : '' ?>><?= $label ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<label class="form-label"><?= $form_edit ? 'Next one on' : 'First one on' ?> <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-calendar-day"></i></span>
|
||||
<input type="date" class="form-control" name="next_date" max="2999-12-31" value="<?= escapeHtml($form_next) ?>" required data-recurring-next>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Ends</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-flag-checkered"></i></span>
|
||||
<input type="date" class="form-control" name="end_date" max="2999-12-31" value="<?= escapeHtml($form_end) ?>" data-recurring-end>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<div class="small text-body-secondary"><i class="fas fa-fw fa-redo-alt me-1"></i><span data-recurring-summary><?= $form_edit ? escapeHtml(recurringExpenseScheduleText($form_row)) : '' ?></span>. Leave Ends empty unless it stops - a lease or financing that is paid off on a date.</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-7">
|
||||
<label class="form-label">Category <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-list"></i></span>
|
||||
<select class="form-select select2" name="category" required data-expense-category>
|
||||
<option value="">- Select a category -</option>
|
||||
<?= categoryOptionsHtml('Expense', $form_category) ?>
|
||||
</select>
|
||||
<?= categoryAddButtonHtml('Expense') ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!moduleOn('bookkeeping')) { // Bookkeeping off - the account it is in, or the default ?>
|
||||
<input type="hidden" name="account" value="<?= $form_edit && isset($form_accounts[$form_account]) ? $form_account : bookkeepingAccount('expense') ?>" data-expense-account>
|
||||
<?php } else { ?>
|
||||
<div class="col-md-7">
|
||||
<label class="form-label">Paid from <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-piggy-bank"></i></span>
|
||||
<select class="form-select select2" name="account" required data-expense-account>
|
||||
<option value="">- Select an account -</option>
|
||||
<?php foreach ($form_accounts as $account_id => $account) { ?>
|
||||
<option value="<?= $account_id ?>" <?= $form_account === $account_id ? 'selected' : '' ?> data-icon="fas fa-piggy-bank"
|
||||
data-description="<?= escapeHtml(billingMoney($account['balance'], $account['account_currency_code'])) ?><?= $account['account_archived_at'] ? ' - archived' : '' ?>"><?= escapeHtml($account['account_name']) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<a class="btn btn-outline-secondary" title="Add a vendor - opens Vendors in a new tab" href="vendors.php" target="_blank" rel="noopener"><i class="fas fa-fw fa-plus"></i></a>
|
||||
</div>
|
||||
<div class="form-text" data-expense-filled hidden>Filled in from the last expense with them.</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-5">
|
||||
<label class="form-label">Amount each time <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-dollar-sign"></i></span>
|
||||
<input type="text" class="form-control text-end fw-semibold" inputmode="decimal" pattern="[0-9,]*\.?[0-9]{0,2}" name="amount" placeholder="0.00" required
|
||||
value="<?= $form_edit ? number_format(floatval($form_row['recurring_expense_amount']), 2, '.', '') : '' ?>" data-recurring-amount>
|
||||
<span class="input-group-text"><?= escapeHtml($form_currency) ?></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<label class="form-label">Paid by</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-credit-card"></i></span>
|
||||
<select class="form-select select2" name="payment_method" data-expense-method>
|
||||
<option value="">- Select a payment method -</option>
|
||||
<?php foreach ($form_methods as $method) { ?>
|
||||
<option value="<?= escapeHtml($method) ?>" <?= $form_method === $method ? 'selected' : '' ?>><?= escapeHtml($method) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$tax_form_id = $form_id;
|
||||
$tax_selected = $form_edit ? intval($form_row['recurring_expense_tax_id']) : 0;
|
||||
$tax_amount = $form_edit ? floatval($form_row['recurring_expense_tax_amount']) : null;
|
||||
$tax_currency = $form_currency;
|
||||
$tax_lock = false;
|
||||
require __DIR__ . '/../expense/expense_tax_fields.php';
|
||||
?>
|
||||
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">How often <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-sync-alt"></i></span>
|
||||
<select class="form-select select2" name="frequency" required data-recurring-frequency>
|
||||
<?php foreach (recurringInvoiceFrequencies() as $key => $label) { ?>
|
||||
<option value="<?= $key ?>" <?= $form_frequency === $key ? 'selected' : '' ?>><?= $label ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<label class="form-label"><?= $form_edit ? 'Next one on' : 'First one on' ?> <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-calendar-day"></i></span>
|
||||
<input type="date" class="form-control" name="next_date" max="2999-12-31" value="<?= escapeHtml($form_next) ?>" required data-recurring-next>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Ends</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-flag-checkered"></i></span>
|
||||
<input type="date" class="form-control" name="end_date" max="2999-12-31" value="<?= escapeHtml($form_end) ?>" data-recurring-end>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<div class="small text-body-secondary"><i class="fas fa-fw fa-redo-alt me-1"></i><span data-recurring-summary><?= $form_edit ? escapeHtml(recurringExpenseScheduleText($form_row)) : '' ?></span>. Leave Ends empty unless it stops - a lease or financing that is paid off on a date.</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-7">
|
||||
<label class="form-label">Category <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-list"></i></span>
|
||||
<select class="form-select select2" name="category" required data-expense-category>
|
||||
<option value="">- Select a category -</option>
|
||||
<?= categoryOptionsHtml('Expense', $form_category) ?>
|
||||
</select>
|
||||
<?= categoryAddButtonHtml('Expense') ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-5">
|
||||
<label class="form-label">Client</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-user"></i></span>
|
||||
<select class="form-select select2" name="client_id" data-recurring-client>
|
||||
<option value="0">- Not for a client -</option>
|
||||
<?php foreach ($form_clients as $client) { ?>
|
||||
<option value="<?= intval($client['client_id']) ?>" <?= $form_client === intval($client['client_id']) ? 'selected' : '' ?><?= selectOptionClient($client['client_id'], $client['client_name'], $client['client_abbreviation'] ?? '') ?>><?= escapeHtml($client['client_name']) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12" data-recurring-billing <?= $form_client ? '' : 'hidden' ?>>
|
||||
<div class="row g-2 align-items-start p-2 rounded border bg-body-tertiary mx-0">
|
||||
<div class="col-md-5">
|
||||
<label class="form-label small mb-1">For them</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-file-invoice-dollar"></i></span>
|
||||
<select class="form-select select2" name="billing" data-recurring-billing-mode>
|
||||
<option value="" <?= $form_billing === '' ? 'selected' : '' ?>>Our cost - not billed on</option>
|
||||
<option value="bill" <?= $form_billing === 'bill' ? 'selected' : '' ?>>Billed on to them each time</option>
|
||||
<option value="covered" <?= $form_billing === 'covered' ? 'selected' : '' ?>>Covered by their recurring invoice</option>
|
||||
</select>
|
||||
<div class="col-12">
|
||||
<label class="form-label">Description</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text align-items-start pt-2"><i class="fas fa-fw fa-align-left"></i></span>
|
||||
<textarea class="form-control" rows="2" name="description" placeholder="What it is - office rent, colocation, M365 partner licensing"><?= escapeHtml($form_value('recurring_expense_description')) ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3" data-recurring-billing-for="bill">
|
||||
<label class="form-label small mb-1">Markup</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-percent"></i></span>
|
||||
<input type="text" class="form-control text-end" name="markup" inputmode="decimal" value="<?= rtrim(rtrim(number_format($form_markup, 2, '.', ''), '0'), '.') ?>" aria-label="Markup">
|
||||
</div>
|
||||
|
||||
<!-- The client it is for, whether they pay for it, and the reference on each expense -->
|
||||
<div class="tab-pane fade" id="<?= $form_id ?>Client">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-7">
|
||||
<label class="form-label">Client</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-user"></i></span>
|
||||
<select class="form-select select2" name="client_id" data-recurring-client>
|
||||
<option value="0">- Not for a client -</option>
|
||||
<?php foreach ($form_clients as $client) { ?>
|
||||
<option value="<?= intval($client['client_id']) ?>" <?= $form_client === intval($client['client_id']) ? 'selected' : '' ?><?= selectOptionClient($client['client_id'], $client['client_name'], $client['client_abbreviation'] ?? '') ?>><?= escapeHtml($client['client_name']) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-5">
|
||||
<label class="form-label">Reference</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-hashtag"></i></span>
|
||||
<input type="text" class="form-control" name="reference" maxlength="255" placeholder="Account or contract number" value="<?= escapeHtml($form_value('recurring_expense_reference')) ?>">
|
||||
</div>
|
||||
<div class="form-text">It goes on each expense it records.</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12" data-recurring-billing <?= $form_client ? '' : 'hidden' ?>>
|
||||
<div class="row g-2 align-items-start p-2 rounded border bg-body-tertiary mx-0">
|
||||
<div class="col-md-5">
|
||||
<label class="form-label small mb-1">For them</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-file-invoice-dollar"></i></span>
|
||||
<select class="form-select select2" name="billing" data-recurring-billing-mode>
|
||||
<option value="" <?= $form_billing === '' ? 'selected' : '' ?>>Our cost - not billed on</option>
|
||||
<option value="bill" <?= $form_billing === 'bill' ? 'selected' : '' ?>>Billed on to them each time</option>
|
||||
<option value="covered" <?= $form_billing === 'covered' ? 'selected' : '' ?>>Covered by their recurring invoice</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3" data-recurring-billing-for="bill">
|
||||
<label class="form-label small mb-1">Markup</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-percent"></i></span>
|
||||
<input type="text" class="form-control text-end" name="markup" inputmode="decimal" value="<?= rtrim(rtrim(number_format($form_markup, 2, '.', ''), '0'), '.') ?>" aria-label="Markup">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-7" data-recurring-billing-for="covered">
|
||||
<label class="form-label small mb-1">Recurring invoice</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-redo-alt"></i></span>
|
||||
<select class="form-select select2" name="recurring_invoice_id" data-recurring-cover data-selected="<?= $form_covered_by ?>"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 small text-body-secondary" data-recurring-billing-note></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-7" data-recurring-billing-for="covered">
|
||||
<label class="form-label small mb-1">Recurring invoice</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-redo-alt"></i></span>
|
||||
<select class="form-select select2" name="recurring_invoice_id" data-recurring-cover data-selected="<?= $form_covered_by ?>"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 small text-body-secondary" data-recurring-billing-note></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!moduleOn('bookkeeping')) { // Bookkeeping off - the account it is in, or the default ?>
|
||||
<input type="hidden" name="account" value="<?= $form_edit && isset($form_accounts[$form_account]) ? $form_account : bookkeepingAccount('expense') ?>" data-expense-account>
|
||||
<?php } else { ?>
|
||||
<div class="col-md-7">
|
||||
<label class="form-label">Paid from <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-piggy-bank"></i></span>
|
||||
<select class="form-select select2" name="account" required data-expense-account>
|
||||
<option value="">- Select an account -</option>
|
||||
<?php foreach ($form_accounts as $account_id => $account) { ?>
|
||||
<option value="<?= $account_id ?>" <?= $form_account === $account_id ? 'selected' : '' ?> data-icon="fas fa-piggy-bank"
|
||||
data-description="<?= escapeHtml(billingMoney($account['balance'], $account['account_currency_code'])) ?><?= $account['account_archived_at'] ? ' - archived' : '' ?>"><?= escapeHtml($account['account_name']) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="col-md-5">
|
||||
<label class="form-label">Paid by</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-credit-card"></i></span>
|
||||
<select class="form-select select2" name="payment_method" data-expense-method>
|
||||
<option value="">- Select a payment method -</option>
|
||||
<?php foreach ($form_methods as $method) { ?>
|
||||
<option value="<?= escapeHtml($method) ?>" <?= $form_method === $method ? 'selected' : '' ?>><?= escapeHtml($method) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<label class="form-label">Reference</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-hashtag"></i></span>
|
||||
<input type="text" class="form-control" name="reference" maxlength="255" placeholder="Account or contract number - it goes on each expense" value="<?= escapeHtml($form_value('recurring_expense_reference')) ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<label class="form-label">Description</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text align-items-start pt-2"><i class="fas fa-fw fa-align-left"></i></span>
|
||||
<textarea class="form-control" rows="2" name="description" placeholder="What it is - office rent, colocation, M365 partner licensing"><?= escapeHtml($form_value('recurring_expense_description')) ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
require_once '../../../includes/modal_header.php';
|
||||
|
||||
/*
|
||||
* New Recurring Ticket - what the tickets it raises will say, how often and
|
||||
* from when, what they are about and their tasks. Opened from a client,
|
||||
* contact or asset, it starts with that filled in; picking an asset fills
|
||||
* in the person it is assigned to.
|
||||
* New Recurring Ticket - what the tickets it raises will say (Details), how
|
||||
* often and from when, with their priority, category and billing (Planning),
|
||||
* what they are about and their tasks. Opened from a client, contact or
|
||||
* asset, it starts with that filled in; picking an asset fills in the person
|
||||
* it is assigned to.
|
||||
*/
|
||||
|
||||
enforceUserPermission('module_support', 2);
|
||||
@@ -39,7 +40,7 @@ ob_start();
|
||||
<a class="nav-link active" data-bs-toggle="pill" href="#pills-add-details"><i class="fas fa-fw fa-life-ring me-2"></i>Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-bs-toggle="pill" href="#pills-add-schedule"><i class="fas fa-fw fa-calendar-alt me-2"></i>Schedule</a>
|
||||
<a class="nav-link" data-bs-toggle="pill" href="#pills-add-schedule"><i class="fas fa-fw fa-calendar-alt me-2"></i>Planning</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-bs-toggle="pill" href="#pills-add-assets"><i class="fas fa-fw fa-link me-2"></i>Related</a>
|
||||
@@ -109,6 +110,75 @@ ob_start();
|
||||
<textarea class="form-control tinymceTicket" id="detailsInput" name="details" data-template-field="details"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Assign to</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-user-check"></i></span>
|
||||
<select class="form-select select2" name="assigned_to" data-template-field="assigned">
|
||||
<option value="0">- Unassigned -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT user_id, user_name, user_avatar FROM users
|
||||
WHERE user_type = 1" . serviceAccountsOutSql() . " AND user_status = 1 AND user_archived_at IS NULL ORDER BY user_name ASC"
|
||||
);
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$user_id = intval($row['user_id']);
|
||||
$user_name = escapeHtml($row['user_name']); ?>
|
||||
<option value="<?= $user_id ?>"<?= selectOptionUser($row['user_id'], $row['user_name'], $row['user_avatar'] ?? '') ?>><?= $user_name ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-add-tasks">
|
||||
|
||||
<?php require_once '../../includes/inc_ticket_tasks_section.php'; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-add-schedule">
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">How often <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-recycle"></i></span>
|
||||
<select class="form-select select2" name="frequency" required>
|
||||
<option value="">- How often -</option>
|
||||
<optgroup label="Days">
|
||||
<option>Three Days</option>
|
||||
<option>Weekly</option>
|
||||
<option>Biweekly</option>
|
||||
</optgroup>
|
||||
<optgroup label="Months">
|
||||
<option>Monthly</option>
|
||||
<option>Quarterly</option>
|
||||
<option>Biannually</option>
|
||||
<option>Annually</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">First run <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-calendar-day"></i></span>
|
||||
<input class="form-control" type="date" name="start_date" min="<?= date("Y-m-d") ?>" max="2999-12-31" value="<?= date("Y-m-d", strtotime('+1 day')) ?>" required>
|
||||
</div>
|
||||
<div class="form-text">The nightly cron raises a ticket on this day, then again each time it comes round. Monthly ones keep to this day of the month - the last day, in a shorter month.</div>
|
||||
</div>
|
||||
|
||||
<?= byDayField('[name=start_date]', '[name=frequency]', ['Monthly', 'Quarterly', 'Biannually', 'Annually'], ['Annually'], '') ?>
|
||||
|
||||
<?php $ahead_row = null; require __DIR__ . '/../../includes/inc_recurring_ticket_ahead.php'; ?>
|
||||
|
||||
<div class="itflow-form-section mt-3">The tickets it raises</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col">
|
||||
@@ -142,30 +212,8 @@ ob_start();
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Assign to</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-user-check"></i></span>
|
||||
<select class="form-select select2" name="assigned_to" data-template-field="assigned">
|
||||
<option value="0">- Unassigned -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT user_id, user_name, user_avatar FROM users
|
||||
WHERE user_type = 1" . serviceAccountsOutSql() . " AND user_status = 1 AND user_archived_at IS NULL ORDER BY user_name ASC"
|
||||
);
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$user_id = intval($row['user_id']);
|
||||
$user_name = escapeHtml($row['user_name']); ?>
|
||||
<option value="<?= $user_id ?>"<?= selectOptionUser($row['user_id'], $row['user_name'], $row['user_avatar'] ?? '') ?>><?= $user_name ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($config_module_enable_accounting && lookupUserPermission('module_sales') >= 2) { ?>
|
||||
<div class="mb-3">
|
||||
<div class="mb-0">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" name="billable" <?php if ($config_ticket_default_billable == 1) { echo "checked"; } ?> value="1" id="billable" data-template-field="billable">
|
||||
<label class="form-check-label" for="billable">The tickets it raises are billable</label>
|
||||
@@ -175,50 +223,6 @@ ob_start();
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-add-tasks">
|
||||
|
||||
<?php require_once '../../includes/inc_ticket_tasks_section.php'; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-add-schedule">
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Frequency <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-recycle"></i></span>
|
||||
<select class="form-select select2" name="frequency" required>
|
||||
<option value="">- Select a frequency -</option>
|
||||
<optgroup label="Days">
|
||||
<option>Three Days</option>
|
||||
<option>Weekly</option>
|
||||
<option>Biweekly</option>
|
||||
</optgroup>
|
||||
<optgroup label="Months">
|
||||
<option>Monthly</option>
|
||||
<option>Quarterly</option>
|
||||
<option>Biannually</option>
|
||||
<option>Annually</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">First run <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-calendar-day"></i></span>
|
||||
<input class="form-control" type="date" name="start_date" min="<?= date("Y-m-d") ?>" max="2999-12-31" value="<?= date("Y-m-d", strtotime('+1 day')) ?>" required>
|
||||
</div>
|
||||
<div class="form-text">The nightly cron raises a ticket on this day, then again each time it comes round. Monthly ones keep to this day of the month - the last day, in a shorter month.</div>
|
||||
</div>
|
||||
|
||||
<?= byDayField('[name=start_date]', '[name=frequency]', ['Monthly', 'Quarterly', 'Biannually', 'Annually'], ['Annually'], '') ?>
|
||||
|
||||
<?php $ahead_row = null; require __DIR__ . '/../../includes/inc_recurring_ticket_ahead.php'; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-add-assets">
|
||||
|
||||
<div class="mb-3">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
/*
|
||||
* Edit Recurring Ticket - the same tabs as New Recurring Ticket. The
|
||||
* Schedule tab shows the next few runs as it stands, and a paused one says
|
||||
* Planning tab shows the next few runs as it stands, and a paused one says
|
||||
* so. What it links to now stays on offer even once archived, so saving
|
||||
* doesn't drop it.
|
||||
*/
|
||||
@@ -73,7 +73,7 @@ ob_start();
|
||||
<a class="nav-link active" data-bs-toggle="pill" href="#pills-recurring-details"><i class="fas fa-fw fa-life-ring me-2"></i>Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-bs-toggle="pill" href="#pills-recurring-schedule"><i class="fas fa-fw fa-calendar-alt me-2"></i>Schedule</a>
|
||||
<a class="nav-link" data-bs-toggle="pill" href="#pills-recurring-schedule"><i class="fas fa-fw fa-calendar-alt me-2"></i>Planning</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-bs-toggle="pill" href="#pills-recurring-related"><i class="fas fa-fw fa-link me-2"></i>Related</a>
|
||||
@@ -128,35 +128,6 @@ ob_start();
|
||||
<textarea class="form-control tinymceTicket" id="detailsInput" name="details" data-template-field="details"><?= escapeHtml($recurring['recurring_ticket_details']) ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Priority <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-thermometer-half"></i></span>
|
||||
<select class="form-select select2" name="priority" data-template-field="priority" required>
|
||||
<?php foreach (['Low' => 'var(--bs-info)', 'Medium' => 'var(--bs-warning)', 'High' => 'var(--bs-danger)', 'Urgent' => 'var(--bs-emphasis-color)'] as $priority => $color) { ?>
|
||||
<option <?= $recurring['recurring_ticket_priority'] === $priority ? 'selected' : '' ?> data-color="<?= $color ?>"><?= $priority ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Category</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-layer-group"></i></span>
|
||||
<select class="form-select select2" name="category_id" data-template-field="category">
|
||||
<option value="0">- Not categorized -</option>
|
||||
<?= categoryOptionsHtml('Ticket', $category_id) ?>
|
||||
</select>
|
||||
<?= categoryAddButtonHtml('Ticket') ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Assign to</label>
|
||||
<div class="input-group">
|
||||
@@ -174,12 +145,6 @@ ob_start();
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($config_module_enable_accounting && lookupUserPermission('module_sales') >= 2) { ?>
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" id="recurringBillable<?= $recurring_ticket_id ?>" name="billable" <?= $billable ? 'checked' : '' ?> value="1" data-template-field="billable">
|
||||
<label class="form-check-label" for="recurringBillable<?= $recurring_ticket_id ?>">The tickets it raises are billable</label>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -222,6 +187,44 @@ ob_start();
|
||||
<div class="mt-1"><?= escapeHtml(ucfirst(recurringTicketCadenceText($recurring))) ?>. Moving the next run moves the day it keeps to.</div>
|
||||
</div>
|
||||
|
||||
<div class="itflow-form-section mt-3">The tickets it raises</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Priority <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-thermometer-half"></i></span>
|
||||
<select class="form-select select2" name="priority" data-template-field="priority" required>
|
||||
<?php foreach (['Low' => 'var(--bs-info)', 'Medium' => 'var(--bs-warning)', 'High' => 'var(--bs-danger)', 'Urgent' => 'var(--bs-emphasis-color)'] as $priority => $color) { ?>
|
||||
<option <?= $recurring['recurring_ticket_priority'] === $priority ? 'selected' : '' ?> data-color="<?= $color ?>"><?= $priority ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Category</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-layer-group"></i></span>
|
||||
<select class="form-select select2" name="category_id" data-template-field="category">
|
||||
<option value="0">- Not categorized -</option>
|
||||
<?= categoryOptionsHtml('Ticket', $category_id) ?>
|
||||
</select>
|
||||
<?= categoryAddButtonHtml('Ticket') ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($config_module_enable_accounting && lookupUserPermission('module_sales') >= 2) { ?>
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" id="recurringBillable<?= $recurring_ticket_id ?>" name="billable" <?= $billable ? 'checked' : '' ?> value="1" data-template-field="billable">
|
||||
<label class="form-check-label" for="recurringBillable<?= $recurring_ticket_id ?>">The tickets it raises are billable</label>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-recurring-related">
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Edit Ticket - the same two tabs as New Ticket: what it is (with who it is
|
||||
* for), and what it is related to. A ticket with no client is internal
|
||||
* work, so it has no contact, asset or site - only our own vendors and
|
||||
* internal projects. Whatever it links to now stays on offer even when that
|
||||
* has since been archived or completed, so saving doesn't drop it.
|
||||
* Edit Ticket - tabs like New Ticket's: what it is (with who it is for), when
|
||||
* it is due with its tags and billing (Planning - ?tab=planning opens it, for
|
||||
* the Due pencil on the ticket), and what it is related to. A ticket with no
|
||||
* client is internal work, so it has no contact, asset or site - only our own
|
||||
* vendors and internal projects. Whatever it links to now stays on offer even
|
||||
* when that has since been archived or completed, so saving doesn't drop it.
|
||||
*/
|
||||
|
||||
require_once '../../../includes/modal_header.php';
|
||||
@@ -36,6 +37,7 @@ $ticket_assigned_to = intval($ticket['ticket_assigned_to']);
|
||||
$ticket_category = intval($ticket['ticket_category']);
|
||||
$ticket_billable = intval($ticket['ticket_billable']);
|
||||
$ticket_due_at = $ticket['ticket_due_at'] ? date('Y-m-d\TH:i', strtotime($ticket['ticket_due_at'])) : '';
|
||||
$edit_tab = ($_GET['tab'] ?? '') === 'planning' ? 'planning' : 'details';
|
||||
|
||||
$other_asset_ids = [];
|
||||
$sql_other_assets = mysqli_query($mysqli, "SELECT asset_id FROM ticket_assets WHERE ticket_id = $ticket_id");
|
||||
@@ -59,7 +61,10 @@ ob_start();
|
||||
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-bs-toggle="pill" href="#pills-edit-details"><i class="fas fa-fw fa-life-ring me-2"></i>Details</a>
|
||||
<a class="nav-link <?= $edit_tab === 'details' ? 'active' : '' ?>" data-bs-toggle="pill" href="#pills-edit-details"><i class="fas fa-fw fa-life-ring me-2"></i>Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?= $edit_tab === 'planning' ? 'active' : '' ?>" data-bs-toggle="pill" href="#pills-edit-planning"><i class="fas fa-fw fa-calendar-alt me-2"></i>Planning</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-bs-toggle="pill" href="#pills-edit-related"><i class="fas fa-fw fa-link me-2"></i>Related</a>
|
||||
@@ -68,7 +73,7 @@ ob_start();
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-edit-details">
|
||||
<div class="tab-pane fade <?= $edit_tab === 'details' ? 'show active' : '' ?>" id="pills-edit-details">
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">For</label>
|
||||
@@ -160,6 +165,14 @@ ob_start();
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- When it is due, its tags and billing -->
|
||||
<div class="tab-pane fade <?= $edit_tab === 'planning' ? 'show active' : '' ?>" id="pills-edit-planning">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Due</label>
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
* one for a ticket opened outside business hours), else the client's. A ticket still open can be billed from
|
||||
* here too - time logged after that isn't billed. Write it (with AI, for
|
||||
* the Billing use case) says what was done in the description, from the
|
||||
* replies and notes, for the client. ?ticket_id=
|
||||
* replies and notes, for the client. A new invoice's scope is the ticket's
|
||||
* reference and subject, changed on the invoice if need be. ?ticket_id=
|
||||
*/
|
||||
|
||||
require_once '../../../includes/modal_header.php';
|
||||
@@ -61,7 +62,7 @@ while ($draft = mysqli_fetch_assoc($sql)) {
|
||||
}
|
||||
$taxes = billingTaxes();
|
||||
$ai_describe = aiReady('Billing');
|
||||
$scopes = ["Ticket $reference - " . $row['ticket_subject'], 'Support - ' . date('F Y')];
|
||||
$scope = "Ticket $reference - " . $row['ticket_subject'];
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -122,6 +123,11 @@ ob_start();
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<!-- A new one is for the ticket - its scope can be changed on the invoice -->
|
||||
<div class="form-text" data-ticket-invoice-new>
|
||||
<input type="hidden" name="scope" value="<?= escapeHtml($scope) ?>">
|
||||
Its scope is <?= escapeHtml($scope) ?> - change it on the invoice.
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6" data-ticket-invoice-new>
|
||||
<label class="form-label">Invoice date <strong class="text-danger">*</strong></label>
|
||||
@@ -141,18 +147,6 @@ ob_start();
|
||||
<?= categoryAddButtonHtml('Income') ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12" data-ticket-invoice-new>
|
||||
<label class="form-label">Scope</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-comment"></i></span>
|
||||
<input type="text" class="form-control" name="scope" maxlength="255" value="<?= escapeHtml($scopes[0]) ?>" list="ticketInvoiceScopes">
|
||||
<datalist id="ticketInvoiceScopes">
|
||||
<?php foreach ($scopes as $scope) { ?>
|
||||
<option value="<?= escapeHtml($scope) ?>"></option>
|
||||
<?php } ?>
|
||||
</datalist>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label class="form-label">Line <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
|
||||
@@ -159,7 +159,7 @@ ob_start();
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Item description</label>
|
||||
<div class="input-group">
|
||||
<textarea class="form-control" rows="10" name="item_description"><?= trim($description) ?></textarea>
|
||||
<textarea class="form-control" rows="3" name="item_description"><?= trim($description) ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1420,7 +1420,7 @@ if (isset($_GET['ticket_id'])) {
|
||||
<dt>Due</dt>
|
||||
<dd>
|
||||
<?php if ($can_change_fields) { ?>
|
||||
<a href="#" class="ticket-prop-edit ajax-modal" data-modal-url="modals/ticket/ticket_edit.php?id=<?= $ticket_id ?>" data-modal-size="lg" title="Change due date">
|
||||
<a href="#" class="ticket-prop-edit ajax-modal" data-modal-url="modals/ticket/ticket_edit.php?id=<?= $ticket_id ?>&tab=planning" data-modal-size="lg" title="Change due date">
|
||||
<span><?= $due_value ?></span>
|
||||
<i class="fas fa-pen ticket-prop-edit-icon"></i>
|
||||
</a>
|
||||
|
||||
@@ -3313,10 +3313,12 @@ a.itflow-tag:focus-visible {
|
||||
box-shadow: 0 0 0 2px var(--itflow-accent, var(--bs-primary));
|
||||
}
|
||||
.itflow-tag-icons {
|
||||
position: relative;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(2.25rem, 1fr));
|
||||
gap: .125rem;
|
||||
max-height: 10.5rem;
|
||||
/* Three rows - the rest scroll, and the search finds any of them */
|
||||
max-height: 6.6rem;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.itflow-tag-icon {
|
||||
@@ -3379,9 +3381,9 @@ a.itflow-tag:focus-visible {
|
||||
.itflow-role-agents > .itflow-contact-avatar {
|
||||
box-shadow: 0 0 0 2px var(--bs-body-bg);
|
||||
}
|
||||
.itflow-role-level-list li.is-off {
|
||||
color: var(--bs-secondary-color);
|
||||
opacity: .7;
|
||||
/* A role's module, one line - what its level allows under its name (admin/modals/role/role_form.php) */
|
||||
.itflow-role-module .btn-group .btn {
|
||||
min-width: 3.6rem;
|
||||
}
|
||||
/* A category's icon beside its name in a list (categoryMarkHtml()) - in its
|
||||
colour, set as the dot it stands in for is */
|
||||
|
||||
23
js/app.js
23
js/app.js
@@ -1001,6 +1001,29 @@ itflowBindOnce('itflowModalFocus', 'shown.bs.modal', '.modal', function () {
|
||||
}, 0);
|
||||
});
|
||||
|
||||
/**
|
||||
* The icon pickers of the tag, category, link and asset type windows show
|
||||
* three rows and scroll - the icon picked is scrolled into the box as the
|
||||
* window, or the tab it is on, opens.
|
||||
*/
|
||||
function itflowShowPickedIcon(root) {
|
||||
root.querySelectorAll('.itflow-tag-icons').forEach(function (grid) {
|
||||
const picked = grid.querySelector('.active');
|
||||
if (picked && grid.offsetParent !== null) {
|
||||
grid.scrollTop = Math.max(0, picked.offsetTop - (grid.clientHeight - picked.offsetHeight) / 2);
|
||||
}
|
||||
});
|
||||
}
|
||||
itflowBindOnce('itflowIconPickerModal', 'shown.bs.modal', '.modal', function () {
|
||||
itflowShowPickedIcon(this);
|
||||
});
|
||||
itflowBindOnce('itflowIconPickerTab', 'shown.bs.tab', '[data-bs-toggle]', function () {
|
||||
const pane = document.querySelector(this.getAttribute('href') || this.getAttribute('data-bs-target') || '#none');
|
||||
if (pane) {
|
||||
itflowShowPickedIcon(pane);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* A window opened over another - the + beside a category picker opens the
|
||||
* category window over the form - goes above it with its backdrop, so the
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// New Role and Edit Role (admin/modals/role/role_form.php). An admin role
|
||||
// opens everything, so its levels are hidden while Admin is on. Picking a
|
||||
// module's level ticks off what that level lets its agents do - each level
|
||||
// takes in the ones before it. Each client's pages need Clients, so a role
|
||||
// module's level says, under its name, what that level lets its agents do -
|
||||
// each level takes in the ones before it. Each client's pages need Clients, so a role
|
||||
// given other modules with Clients at None is warned. The server checks it
|
||||
// all again.
|
||||
//
|
||||
@@ -42,11 +42,21 @@
|
||||
return;
|
||||
}
|
||||
const level = parseInt(e.target.value, 10);
|
||||
module.querySelectorAll('[data-role-level]').forEach(function (line) {
|
||||
const on = parseInt(line.dataset.roleLevel, 10) <= level;
|
||||
line.classList.toggle('is-off', !on);
|
||||
line.querySelector('i').className = 'fas fa-fw me-1 ' + (on ? 'fa-check text-success' : 'fa-times');
|
||||
});
|
||||
const allows = JSON.parse(module.dataset.roleAllows || '{}');
|
||||
const text = Object.keys(allows).filter(function (value) {
|
||||
return parseInt(value, 10) <= level;
|
||||
}).map(function (value) {
|
||||
return allows[value];
|
||||
}).join(' · ') || 'Nothing';
|
||||
const can = module.querySelector('[data-role-can]');
|
||||
can.title = text;
|
||||
can.classList.toggle('text-body', level > 0);
|
||||
can.classList.toggle('text-secondary', level === 0);
|
||||
can.replaceChildren();
|
||||
const icon = document.createElement('i');
|
||||
icon.className = 'fas fa-fw me-1 ' + (level > 0 ? 'fa-check text-success' : 'fa-times');
|
||||
icon.setAttribute('aria-hidden', 'true');
|
||||
can.append(icon, text);
|
||||
checkClients();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user